posthog-js 1.428.8 → 1.428.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +64 -0
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.d.ts +1 -0
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +1 -1
- package/dist/module.d.ts +1 -0
- package/dist/module.full.d.ts +1 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +1 -0
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.d.ts +1 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.d.ts +1 -0
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.d.ts +577 -653
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +1 -1
- package/dist/recorder.d.ts +577 -653
- package/dist/rrweb-plugin-console-record.d.ts +436 -500
- package/dist/rrweb-types.d.ts +688 -735
- package/dist/rrweb.d.ts +1303 -1433
- package/dist/src/entrypoints/rrweb-types.es.d.ts +9 -0
- package/dist/src/extensions/replay/types/rrweb-types.d.ts +1 -0
- package/lib/package.json +1 -1
- package/lib/src/entrypoints/rrweb-types.es.d.ts +9 -0
- package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js +12 -2
- package/lib/src/extensions/replay/external/lazy-loaded-session-recorder.js.map +1 -1
- package/lib/src/extensions/replay/types/rrweb-types.d.ts +1 -0
- package/lib/src/extensions/replay/types/rrweb-types.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,t=["type"],r=["retriesPerformedSoFar"],i=["$set_once","$set"];function s(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},n.apply(null,arguments)}function o(e,t,r,i,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,s)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(i,s){var n=e.apply(t,r);function a(e){o(n,i,s,a,l,"next",e)}function l(e){o(n,i,s,a,l,"throw",e)}a(void 0)})}}var l="u">typeof window?window:void 0,u="u">typeof globalThis?globalThis:l,d=null==u?void 0:u.navigator,c=null==u?void 0:u.document,h=null==u?void 0:u.location,p=null==u?void 0:u.fetch,_=null!=u&&u.XMLHttpRequest&&"withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:void 0,g=null==u?void 0:u.AbortController,v=null==u?void 0:u.CompressionStream,f=null==d?void 0:d.userAgent;function m(){return!(!l||!1===l.navigator.onLine)}var y="undefined"!=typeof globalThis?globalThis:l;y&&"undefined"==typeof self&&(y.self=y),y&&"undefined"==typeof File&&(y.File=function(){});var b=null!=l?l:{},S="$people_distinct_id",w="distinct_id",k="$device_id",C="$device_model",E="__alias",x="__cmpns",T="$fbc",I="$fbc_persistence",R="__timers",P="$autocapture_disabled_server_side",M="$heatmaps_enabled_server_side",F="$exception_capture_enabled_server_side",L="$error_tracking_suppression_rules",A="$error_tracking_capture_extension_exceptions",O="$web_vitals_enabled_server_side",D="$dead_clicks_enabled_server_side",N="$product_tours_enabled_server_side",B="$logs_capture_enabled_server_side",q="$web_vitals_allowed_metrics",H="$session_recording_remote_config",U="$session_recording_enabled_server_side",W="$replay_sample_rate",z="$replay_override_sampling",V="$replay_override_linked_flag",j="$replay_override_url_trigger",G="$replay_override_event_trigger",Q="$sesid",K="$session_is_sampled",Z="$session_past_minimum_duration",Y="$session_recording_url_trigger_activated_session",J="$session_recording_event_trigger_activated_session",X="$posthog_sr_group_event_trigger_",ee="$posthog_sr_group_url_trigger_",te="$posthog_sr_group_sampling_",re="$debug_first_full_snapshot_timestamp",ie="$sess_rec_flush_size",se="$enabled_feature_flags",ne="$active_feature_flags",oe="$early_access_features",ae="$feature_flag_details",le="$feature_flag_payloads",ue="$feature_flag_request_id",de="$minimal_flag_called_events",ce="$override_feature_flags",he="$override_feature_flag_payloads",pe="$stored_person_properties",_e="$stored_group_properties",ge="$groups",ve="$surveys",fe="$surveys_loaded_at",me="$surveys_activated",ye="$surveys_activated_session",be="$surveys_activated_timestamps",Se="ph_product_tours",we="$product_tours_activated",ke="$product_tours_activated_session",Ce="$conversations_widget_session_id",Ee="$conversations_ticket_id",xe="$conversations_widget_state",Te="$conversations_user_traits",Ie="$flag_call_reported",Re="$flag_call_reported_session_id",Pe="$feature_flag_errors",Me="$feature_flag_evaluated_at",Fe="$user_state",Le="$client_session_props",Ae="$capture_rate_limit",Oe="$initial_campaign_params",De="$initial_referrer_info",Ne="$initial_person_info",Be="$epp",$e="$posthog_cookieless",qe="$cookieless_mode",He="$sdk_debug_extensions_init_method",Ue="$sdk_debug_extensions_init_time_ms",We="$sdk_debug_recording_script_not_loaded",ze="$sdk_debug_replay_event_trigger_status",Ve="$sdk_debug_replay_linked_flag_trigger_status",je="$sdk_debug_replay_matched_recording_trigger_groups",Ge="$sdk_debug_replay_pending_trigger_conditions",Qe="$sdk_debug_replay_remote_trigger_matching_config",Ke="$sdk_debug_replay_trigger_groups_count",Ze="$sdk_debug_replay_url_trigger_status",Ye="$sdk_debug_rrweb_attached",Je="$sdk_debug_rrweb_start_attempted",Xe="$session_recording_start_reason",et="PostHog loadExternalDependency extension not found.",tt="anonymous",rt="identified",it="identified_only",st="visibilitychange",nt="beforeunload",ot="$pageview",at="$pageleave",lt="$identify",ut="$groupidentify",dt=["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"],ct=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return dt.concat(t).some(e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)})};function ht(e,t){return-1!==e.indexOf(t)}var pt=function(e){return e.trim()},_t=function(e){return e.replace(/^\$/,"")};function gt(e){var t,r=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}}))&&void 0!==t?t:"null"}var vt=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),ft=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),mt="min_length",yt="max_length",bt=["$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"],St=["token"],wt=Object.prototype,kt=wt.hasOwnProperty,Ct=wt.toString,Et=Array.isArray||function(e){return"[object Array]"===Ct.call(e)},xt=e=>"function"==typeof e,Tt=e=>e===Object(e)&&!Et(e),It=e=>{if(Tt(e)){for(var t in e)if(kt.call(e,t))return!1;return!0}return!1},Rt=e=>void 0===e,Pt=e=>"[object String]"==Ct.call(e),Mt=e=>Pt(e)&&0===e.trim().length,Ft=e=>null===e,Lt=e=>Rt(e)||Ft(e),At=e=>"[object Number]"==Ct.call(e)&&e==e,Ot=e=>At(e)&&e>0,Dt=e=>"[object Boolean]"===Ct.call(e),Nt=e=>e instanceof FormData,Bt=e=>ht(bt,e),$t=e=>ht(St,e);function qt(e){return null===e||"object"!=typeof e}function Ht(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Ut(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return zt(e,Error)}}function Wt(e){return"u">typeof Event&&zt(e,Event)}function zt(e,t){try{return e instanceof t}catch(e){return!1}}var Vt=[!0,"true",1,"1","yes"],jt=e=>ht(Vt,e),Gt=[!1,"false",0,"0","no"];function Qt(e,t,r,i,s){return t>r&&(i.warn("min cannot be greater than max."),t=r),At(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),Qt(null!=s?s:r,t,r,i))}var Kt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Qt(e.bucketSize,0,100,e._logger),this._refillRate=Qt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Qt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var r=Math.floor((t-e.lastAccess)/this._refillInterval);r>0&&(e.tokens=Math.min(e.tokens+r*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),s=this._buckets[i];return s?this._applyRefill(s,r):this._buckets[i]=s={tokens:this._bucketSize,lastAccess:r},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}},Zt="Mobile",Yt="Android",Jt="Tablet",Xt="Android Tablet",er="iPad",tr="Apple Watch",rr="Safari",ir="BlackBerry",sr="Samsung Internet",nr="Chrome",or="Chrome iOS",ar="Internet Explorer",lr="Internet Explorer Mobile",ur="Opera",dr="Microsoft Edge",cr="Firefox",hr="Firefox iOS",pr="Nintendo",_r="PlayStation",gr="Xbox",vr="Android Mobile",fr="Mobile Safari",mr="Windows",yr="Windows Phone",br="Nokia",Sr="Ouya",wr="Generic "+Zt.toLowerCase(),kr="Generic "+Jt.toLowerCase(),Cr="Konqueror",Er="Oculus Browser",xr="Vivaldi",Tr="Yandex",Ir="Whale",Rr="DuckDuckGo",Pr="Pale Moon",Mr="Waterfox",Fr="Brave",Lr="Claude",Ar="Codex",Or="ChatGPT",Dr="Google Search App",Nr=new RegExp("Version/(\\d+(\\.\\d+)?)"),Br=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),$r=new RegExp(gr,"i"),qr=new RegExp("PlayStation \\w+","i"),Hr=new RegExp("Nintendo \\w+","i"),Ur=new RegExp("BlackBerry|PlayBook|BB10","i"),Wr={"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"},zr=function(e,t,r,i){t=t||"";var s=function(e){return null!=e&&e.brave?Fr:null}(r);return s||(null!=i&&i.detectGoogleSearchApp&&ht(e,"GSA/")?Dr:ht(e," OPR/")&&ht(e,"Mini")?"Opera Mini":ht(e," OPR/")?ur:Ur.test(e)?ir:ht(e,"IEMobile")||ht(e,"WPDesktop")?lr:ht(e,"OculusBrowser")?Er:ht(e,"SamsungBrowser")?sr:ht(e,"Edge")||ht(e,"Edg/")?dr:ht(e,"Vivaldi/")?xr:ht(e,"YaBrowser/")?Tr:ht(e,"Whale/")?Ir:ht(e,"DuckDuckGo/")||ht(e,"Ddg/")?Rr:ht(e,"Claude/")?Lr:ht(e,"Codex/")?Ar:ht(e,"ChatGPT/")?Or:ht(e,"FBIOS")?"Facebook Mobile":ht(e,"UCWEB")||ht(e,"UCBrowser")?"UC Browser":ht(e,"CriOS")?or:ht(e,"CrMo")||ht(e,nr)?nr:ht(e,Yt)&&ht(e,rr)?vr:ht(e,"FxiOS")?hr:ht(e.toLowerCase(),Cr.toLowerCase())?Cr:ht(e,"Brave/")?Fr:((e,t)=>t&&ht(t,"Apple")||function(e){return ht(e,rr)&&!ht(e,nr)&&!ht(e,Yt)}(e))(e,t)?ht(e,Zt)?fr:rr:ht(e,"PaleMoon/")?Pr:ht(e,"Waterfox/")?Mr:ht(e,cr)?cr:ht(e,"MSIE")||ht(e,"Trident/")?ar:ht(e,"Gecko")?cr:"")},Vr={[lr]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[dr]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[nr]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[or]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[rr]:[Nr],[fr]:[Nr],[ur]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[cr]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[hr]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Cr]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ir]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Nr],[vr]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[sr]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Er]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[xr]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tr]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ir]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Fr]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Lr]:[Br],[Ar]:[Br],[Or]:[Br],[Rr]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Pr]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Mr]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Dr]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ar]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},jr=function(e,t,r,i){var s=Vr[zr(e,t,r,i)];if(Rt(s))return null;for(var n=0;s.length>n;n++){var o=e.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},Gr=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[gr,e&&e[1]||""]],[new RegExp(pr,"i"),[pr,""]],[new RegExp(_r,"i"),[_r,""]],[Ur,[ir,""]],[new RegExp(mr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[yr,""];if(new RegExp(Zt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=Wr[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[mr,i]}return[mr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Rt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Yt,[e[2],e[3],e[4]||"0"].join(".")]:[Yt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Qr=function(e){for(var t=0;Gr.length>t;t++){var r=Gr[t],i=r[1],s=r[0].exec(e),n=s&&(xt(i)?i(s,e):i);if(n)return n}return["",""]},Kr=function(e){return Hr.test(e)?pr:qr.test(e)?_r:$r.test(e)?gr:new RegExp(Sr,"i").test(e)?Sr:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?yr:/iPad/.test(e)?er:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?tr:Ur.test(e)?ir:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(br,"i").test(e)?br:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Zt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Yt:Xt:new RegExp("(pda|Mobile)","i").test(e)?wr:new RegExp(Jt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?kr:""},Zr=function(e,t){var r,i,s,n,o=Kr(e);return o===er||o===Xt||"Kobo"===o||"Kindle Fire"===o||o===kr?Jt:o===pr||o===gr||o===_r||o===Sr?"Console":o===tr?"Wearable":o?Zt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(r=null==t?void 0:t.maxTouchPoints)&&void 0!==r?r:0)>0?600>Math.min(null!==(i=null==t?void 0:t.screenWidth)&&void 0!==i?i:0,null!==(s=null==t?void 0:t.screenHeight)&&void 0!==s?s:0)/(null!==(n=null==t?void 0:t.devicePixelRatio)&&void 0!==n?n:1)?Zt:Jt:"Desktop"},Yr=/\bFBAV\/(\d+(?:\.\d+)*)/i,Jr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Yr],[/\bFBAN\/EMA\b/i,"Facebook Lite",Yr],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Yr],[/\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"]],Xr="[Truncated]",ei="[Unserializable]";function ti(e){for(var t="",r=0;e.length>r;r++){var i=e.charCodeAt(r);if(55296>i||i>56319)t+=56320>i||i>57343?e[r]:"�";else{var s=e.charCodeAt(r+1);56320>s||s>57343?t+="�":(t+=e[r]+e[r+1],r++)}}return t}Date,Date;var ri,ii,si,ni=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function oi(e,t){return"string"==typeof(r=e)&&ni.test(r)?e:t();var r}function ai(e,t){var r=new Error(t);try{Object.defineProperty(r,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return r}function li(e){return e?e.split("#")[0]:e}function ui(e,t){var r=setTimeout(e,t);return null!=r&&r.unref&&(null==r||r.unref()),r}function di(e,t,r){return ci.apply(this,arguments)}function ci(){return(ci=a(function*(e,t,r){var i;try{return yield Promise.race([e,new Promise((e,s)=>{i=ui(()=>{try{null==r||r(),e()}catch(e){s(e)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}function hi(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return si&&r.length===ii?si:(ii=r.length,si=r.reduce((r,i)=>{ri||(ri={});var s=ri[i];if(s)r[s[0]]=s[1];else for(var n=e(i),o=n.length-1;o>=0;o--){var a,l=null==(a=n[o])?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,ri[i]=[l,u];break}}return r},{}))}}var pi=class{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(n,r),$exception_level:"error"}}modifyFrames(e){var t=this;return a(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Et(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),n({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return a(function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,t){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(i=t.handled)||void 0===i||i,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,n({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:hi(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var i=(r,i)=>{if(4>=i){var s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return n({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}};function _i(e,t,r,i,s){var n={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!!t&&!t.startsWith("webkit-masked-url://")&&"<anonymous>"!==t};return Rt(i)||(n.lineno=i),Rt(s)||(n.colno=s),n}var gi=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},vi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,fi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,mi=/\((\S*)(?::(\d+))(?::(\d+))\)/,yi=(e,t)=>{var r=vi.exec(e);if(r)return _i(t,r[1],"?",+r[2],+r[3]);var i=fi.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var s=mi.exec(i[2]);s&&(i[2]=s[1],i[3]=s[2],i[4]=s[3])}var n=gi(i[1]||"?",i[2]);return _i(t,n[1],n[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},bi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Si=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wi=(e,t)=>{var r=bi.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=Si.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var s=r[3],n=r[1]||"?",o=gi(n,s);return _i(t,s=o[1],n=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},ki=/\(error: (.*)\)/;function Ci(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Ei(e){for(var t=1;10>=t;t++){var r=e.length-2*t;if(0>r)break;for(var i=!0,s=0;t>s;s++)if(!Ci(e[r+s],e[r+t+s])){i=!1;break}if(i){for(var n=0;t>n;n++)e[r+n]=e[r+t+n];return e.length=r+t,{start:r,length:t}}}}function xi(e,t){var r=t.start+t.length,i=Ii(e,t);i&&e.splice(r+i===e.length?r:t.start,i)}function Ti(e,t){for(var r=t.start;r>0&&Ci(e[r-1],e[r-1+t.length]);)r--;return t.start-r}function Ii(e,t){for(var r=t.start+t.length,i=r;e.length>i&&Ci(e[i],e[i-t.length]);)i++;return i-r}function Ri(e,t){var r=t[0],i=e.length-(r?Ti(e,r):0);for(var s of t)i-=Ii(e,s);return i}function Pi(e,t,r){for(var i=0;e.length>i;i++){var s=e[(t+i)%e.length],n=e[(r+i)%e.length];if(s!==n)return n>s}return!1}var Mi=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Pt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Ht(e,"DOMException")}isDOMError(e){return Ht(e,"DOMError")}},Fi=class{match(e){return Ut(e)}coerce(e,t){var r,i=this.getStack(e),s=void 0===i;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=i?i:null==(r=t.syntheticException)?void 0:r.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}},Li=class{match(e){return!!Ht(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var r;if(null!=e.error)return t.apply(e.error);var i=t.apply(e.message);return n({},i,{stack:null!==(r=this._buildLocationStack(e))&&void 0!==r?r:i.stack,synthetic:!0})}_hasUsableMessage(e){return Pt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,r,i=e,s=null!==(t=i.lineno)&&void 0!==t?t:0,n=null!==(r=i.colno)&&void 0!==r?r:0;if(Pt(i.filename)&&0!==i.filename.length&&0!==s)return"Error\n at "+i.filename+":"+s+":"+n}},Ai=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Oi=class{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),s=i[0],n=i[1];return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(Ai);return i&&(t=i[1],r=i[2]),[t,r]}},Di=["fatal","error","warning","log","info","debug"];function Ni(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var s=r.slice(0,i).join(", ");if(t>=s.length)return i===r.length?s:s.length>t?s.slice(0,t)+"...":s}return""}var Bi=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null!==(r=this.getStack(e))&&void 0!==r?r:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Wt(e))return e.constructor.name;var t="name"in e?e.name:void 0;return Pt(t)&&!Mt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+Ni(e)}isSeverityLevel(e){return Pt(e)&&!Mt(e)&&Di.indexOf(e)>=0}getStack(e){try{return Pt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Pt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(Ut(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},$i=class{match(e){return Wt(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Ni(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}},qi=class{match(e){return qt(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}},Hi=class{match(e){return Ht(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Wt(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return qt(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}},Ui="$message",Wi="$timestamp",zi=new Set([Ui,Wi]),Vi={enabled:!0,max_bytes:32768};function ji(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Vi.enabled,max_bytes:Qi(e.max_bytes,Vi.max_bytes)}:n({},Vi)}var Gi=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=ji(e)}setConfig(e){this._config=ji(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=gt(e)}catch(e){return}try{var r=JSON.parse(t);if(!Tt(r))return;var i=r,s=i[Ui],n=i[Wi];if(!Pt(s)||0===s.trim().length)return;if(!Pt(n)&&!At(n))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,i=0;t.length>i;i++)"%"===t[i]?(r+=1,i+=2):r+=1;return r}(t.json);r>this._config.max_bytes||(this._entries.push({step:t.step,bytes:r}),this._totalBytes+=r,this._trimToMaxBytes())}}getAttachable(){return this._entries.map(e=>e.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function Qi(e,t){if(!At(e)||1/0===e||-1/0===e)return t;var r=Math.floor(e);return 0>r?t:r}var Ki=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function Zi(e){return"string"==typeof e||e}function Yi(e){return"string"==typeof e?e:void 0}var Ji,Xi=["$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"],es="NativeGzipValidationError",ts=e=>e.length>=2&&31===e[0]&&139===e[1],rs=(e,t)=>e===ft.GZipJS||t===ft.GZipJS||"gzip"===t,is=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),ss=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return is(e)||t===es},ns=e=>{throw ai(es,"Native gzip produced invalid output: "+e)},os=function(){var e=a(function*(e,t){18>e.size&&ns("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());ts(r)&&8===r[2]||ns("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Ji)return Ji;Ji=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;Ji[e]=t>>>0}return Ji})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&ns("invalid-crc");var s=t.length>>>0;i.getUint32(4,!0)!==s&&ns("invalid-size")});return function(t,r){return e.apply(this,arguments)}}();function as(e,t,r){return ls.apply(this,arguments)}function ls(){return ls=a(function*(e,t,r){void 0===t&&(t=!0);try{var i=(new TextEncoder).encode(e),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(i).then(()=>n.close()).catch(function(){var e=a(function*(e){try{yield n.abort(e)}catch(e){}throw e});return function(t){return e.apply(this,arguments)}}()),l=new Response(s.readable).blob(),u=(yield Promise.all([l,o]))[0];return yield os(u,i),u}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}}),ls.apply(this,arguments)}var us={}.propertyIsEnumerable;function ds(e,t){try{return ps(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function cs(e,t,r,i){if(0>=r.remainingNodes)return{stringValue:Xr};if(r.remainingNodes--,Dt(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){var r=e.toString(),i=BigInt("9223372036854775808");return e>=i||-i>e?(null==t||t.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}(e,t);if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};var s=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:ti(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(r.ancestors.has(e))return{stringValue:"[Circular]"};if(i>=20)return{stringValue:Xr};if(e instanceof Date){var n=e.getTime(),o=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:"string"==typeof o?ti(o):String(o)}}r.ancestors.add(e);try{try{var a=e.toJSON;if("function"==typeof a)return cs(a.call(e),t,r,i+1)}catch(e){}return Et(e)?{arrayValue:{values:hs(e,t,r,i+1)}}:{kvlistValue:{values:ps(e,t,r,i+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:ti(String(e))}}function hs(e,t,r,i){for(var s=[],n=Math.min(e.length,1e3),o=0;n>o&&r.remainingNodes>0;o++)try{var a=o in e?e[o]:void 0;if(Lt(a))continue;s.push(cs(a,t,r,i))}catch(e){s.push({stringValue:ei})}return e.length>o&&s.push({stringValue:Xr}),s}function ps(e,t,r,i){var s=[];for(var n in e)if(us.call(e,n)){if(!n){null==t||t.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=r.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[n];if(Ft(o)||Rt(o))continue;s.push({key:ti(n),value:cs(o,t,r,i)})}catch(e){s.push({key:ti(n),value:{stringValue:ei}})}}return s}function _s(e,t,r){return n({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":r})}var gs={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var vs={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}},fs=vs.info;function ms(e){try{return ti(String(e))}catch(e){return ei}}function ys(e,t,r,i){var s,o=vs[e.level||"info"]||fs,a=o.text,l=o.number,u=(void 0===(s=At(i)?i:void 0)&&(s=Date.now()),String(s)+"000000"),d={};t.distinctId&&(d.posthogDistinctId=t.distinctId),t.sessionId&&(d.sessionId=t.sessionId),t.windowId&&(d["window.id"]=t.windowId),Lt(t.sessionStartTimestamp)||(d.sessionStartTimestamp=String(t.sessionStartTimestamp)),Lt(t.lastActivityTimestamp)||(d.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(d["url.full"]=t.currentUrl),t.screenName&&(d["screen.name"]=t.screenName),t.appState&&(d["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(d.feature_flags=t.activeFeatureFlags);var c=n({},d),h=e.attributes;if(h){var p=[];try{p=Object.keys(h)}catch(e){p=[]}for(var _ of p){var g=void 0;try{g=h[_]}catch(e){g=ei}Object.defineProperty(c,_,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var v={timeUnixNano:u,observedTimeUnixNano:u,severityNumber:l,severityText:a,body:{stringValue:ms(e.body)},attributes:ds(c,r)};return e.trace_id&&(v.traceId=e.trace_id),e.span_id&&(v.spanId=e.span_id),Rt(e.trace_flags)||(v.flags=e.trace_flags),v}function bs(e,t,r){return _s(e,t,r)}function Ss(e,t,r,i){return{resourceLogs:[{resource:{attributes:ds(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}var ws=class{constructor(e,t,r,i,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=s,this._waitForStoragePersist=n,this._scopeName=o,this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._consecutiveFlushFailures=0,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(vt.LogsQueue,[])}reset(){this._clearFlushTimer(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushInBackground()}captureLog(e,t){var r;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var i=this._runBeforeSend(e);if(null!==i)if(i.body){if(this._checkRateLimit()){var s={record:ys(i,null!==(r=null==t?void 0:t.context)&&void 0!==r?r:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(s))}}else this._logger.info("Log was rejected in beforeSend function")}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Et(t)?t:[t],i=e;for(var s of r)try{var n=s(i);if(!n)return this._logger.info("Log was rejected in beforeSend function"),null;i=n}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return i}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;var e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+this._maxLogsPerInterval+" logs per "+this._rateCapWindowMs+"ms"),this._droppedWarned=!0),!1)}flush(){var e=this;return a(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return a(function*(){var t;e._clearFlushTimer();var r=null!==(t=e._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==t?t:[];if(0!==r.length)for(var i=r.length,s=0;r.length>0&&i>s;){var n,o,a=e._queueGeneration;e._evictedSinceAdvance=0;var l=Math.min(r.length,e._maxBatchRecordsPerPost),u=r.slice(0,l),d=Ss(u.map(e=>e.record),e._buildResourceAttributes(),null!==(n=e._scopeName)&&void 0!==n?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(d);if(e._queueGeneration!==a)return;if("too-large"===c.kind&&u.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(u.length/2)),e._logger.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+e._maxBatchRecordsPerPost);else{if("retry-later"===c.kind)throw c.error;if("too-large"===c.kind?e._logger.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(u.length),r=null!==(o=e._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==o?o:[],s+=u.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return a(function*(){var r,i=Math.max(0,e-t._evictedSinceAdvance),s=null!==(r=t._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==r?r:[];t._instance.setPersistedProperty(vt.LogsQueue,s.slice(i)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return bs(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>r.length||(r.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(vt.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=ui(()=>{this._flushTimer=void 0,this._flushInBackground()},e))}_nextFlushDelay(){var e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){var e=this._instance.getPersistedProperty(vt.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return a(function*(){t._clearFlushTimer();var r=t.flush().catch(()=>{});void 0!==e?yield di(r,e):yield r})()}flushWithTimeout(e){var t=this;return a(function*(){var r=t.flush();yield di(r,e,()=>{r.catch(()=>{})})})()}_flushInBackground(){this.flush().then(()=>{this._consecutiveFlushFailures=0},e=>{this._consecutiveFlushFailures++,this._logger.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._armFlushTimer(this._nextFlushDelay())})}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}},ks=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Cs(e){return String(e)+"000000"}function Es(e,t,r,i){var s="";return i&&(s=Object.keys(i).sort().map(e=>JSON.stringify(e)+":"+JSON.stringify(i[e])).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+s}var xs=class{constructor(e,t,r){this._instance=e,this._config=t,this._logger=r,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t,r){void 0===t&&(t=1),this._capture({name:e,type:"count",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}gauge(e,t,r){this._capture({name:e,type:"gauge",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}histogram(e,t,r){this._capture({name:e,type:"histogram",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}flush(){var e=this,t=this._flushPromise,r=function(){var r=a(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return r.apply(this,arguments)}}()().finally(()=>{this._flushPromise===r&&(this._flushPromise=null)});return this._flushPromise=r,r}drainWindow(){if(0===this._series.size)return null;var e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._clearFlushTimer(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this._runBeforeSend(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this._logger.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var r,i;try{r=t.attributes?n({},t.attributes):void 0,i=Es(t.type,t.name,t.unit,r)}catch(e){return void this._logger.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var s=this._series.get(i);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this._series.set(i,s)}var o=this._typeByName.get(t.name);void 0===o?this._typeByName.set(t.name,t.type):o===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(s,t.value),this._armFlushTimer()}else this._logger.warn("Dropping metric '"+t.name+"': value must be a finite number");else this._logger.warn("Dropping metric with empty name")}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn("Metric series cap reached ("+this._config.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}_fold(e,t){var r;switch(e.type){case"count":e.total=(null!==(r=e.total)&&void 0!==r?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(ks.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var r=0;t.length>r;r++)if(t[r]>=e)return r;return t.length}(t,ks)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Et(t)?t:[t],i=e;for(var s of r)try{var n=s(i);if(!n)return this._logger.info("Metric was rejected in beforeSend function"),null;i=n}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=ui(()=>{this._flushTimer=void 0,this.flush().catch(e=>{this._logger.error("Metrics flush failed:",e)})},this._config.flushIntervalMs))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_doFlush(){var e=this;return a(function*(){if(0!==e._series.size){var t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;var r=e._generation,i=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(r===e._generation)switch(i.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._armFlushTimer();case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",i.error)}}})()}_buildPayload(e){return t=this._buildMetrics(e),r=function(e,t,r){return _s(e,t,r)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ds(r)},scopeMetrics:[{scope:{name:i,version:s},metrics:t}]}]};var t,r,i,s}_buildMetrics(e){var t=Cs(Date.now()),r=new Map;for(var i of e.values()){var s,o=Es(i.type,i.name,i.unit,void 0),a=r.get(o);a||(a=n({name:i.name},i.unit&&{unit:i.unit}),"count"===i.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===i.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=ds(null!==(s=i.attributes)&&void 0!==s?s:{},this._logger),u=Cs(i.windowStartMs);if("count"===i.type){var d,c={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:null!==(d=i.total)&&void 0!==d?d:0};a.sum.dataPoints.push(c)}else if("gauge"===i.type){var h,p={attributes:l,timeUnixNano:t,asDouble:null!==(h=i.last)&&void 0!==h?h:0};a.gauge.dataPoints.push(p)}else i.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:ks})}return Array.from(r.values())}_mergeWindowBack(e){var t,r;for(var i of e){var s=i[0],n=i[1],o=this._series.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=n.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function Ts(e,t){var r;if(e)return null==(r=e.find(e=>e.type===t))?void 0:r.value}var Is="0.8.2",Rs={DEBUG:!1,LIB_VERSION:Is,LIB_NAME:"browser-common",JS_SDK_VERSION:Is},Ps=function(e,t){var r=(void 0===t?{}:t).debugEnabled,i={_log(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;i>n;n++)s[n-1]=arguments[n];l&&(Rs.DEBUG||l.POSTHOG_DEBUG||r)&&!Rt(l.console)&&l.console&&("__rrweb_original__"in l.console[t]?l.console[t].__rrweb_original__:l.console[t])(e,...s)},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("error",...t)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(e){i.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>Ps(e+" "+t,r)};return i},Ms=Ps("[PostHog.js]"),Fs=Ms.createLogger;function Ls(e,t){Et(e)&&e.forEach(t)}function As(e,t){if(!Lt(e))if(Et(e))e.forEach(t);else if(Nt(e))e.forEach((e,r)=>t(e,r));else for(var r in e)kt.call(e,r)&&t(e[r],r)}var Os=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var s of r)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function Ds(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var Ns=function(e){try{return e()}catch(e){return}},Bs=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){Ms.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ms.critical(e)}}},$s=function(e){var t={};return As(e,function(e,r){(Pt(e)&&e.length>0||At(e))&&(t[r]=e)}),t};function qs(e){var t=n({},e);for(var r of["name","message","stack","cause","errors"])try{r in e&&(t[r]=e[r])}catch(e){}return t}var Hs=["herokuapp.com","vercel.app","netlify.app"];function Us(e){var t=null==e?void 0:e.hostname;if(!Pt(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of Hs)if(r===i)return!1;return!0}function Ws(e,t,r,i){var s=null!=i?i:{},n=s.capture,o=s.passive;null==e||e.addEventListener(t,r,{capture:void 0!==n&&n,passive:void 0===o||o})}function zs(e){return"ph_toolbar_internal"===e.name}var Vs=["localhost","127.0.0.1"],js=(e,t)=>{try{var r;return JSON.stringify(e,(e,t)=>Ut(t)?(null!=r||(r=new WeakMap),r.has(t)||r.set(t,qs(t)),r.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return gt(e)}},Gs=e=>{var t=null==c?void 0:c.createElement("a");return Rt(t)?null:(t.href=e,t)},Qs=function(e,t){var r,i;void 0===t&&(t="&");var s=[];return As(e,function(e,t){Rt(e)||Rt(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+r)}),s.join(t)},Ks=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;i.length>s;s++){var n=i[s].split("=");if(n[0]===t){r=n;break}}if(!Et(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){Ms.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zs=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),s=i[1],n=(i[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],d=0;l.length>d;d++){var c=l[d].split("=");Et(c)&&(t.includes(c[0])?u.push(c[0]+"="+r):u.push(l[d]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},Ys=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},Js=(e,t)=>e>=t&&m(),Xs=(e,t,r,i)=>{if(0===e){if(m()){var s=t+1;return s===r&&i(),s}return t}return 0};function en(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!xt(i))return t;try{var s=i(t);return Pt(s)&&s?s:t}catch(e){return Ms.error("Error in get_current_url, falling back to window.location.href",e),t}}function tn(e){var t,r=null==l||null==(t=l.location)?void 0:t.href;return Rt(r)?void 0:en(e,r)}function rn(e){return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function sn(e){return!!e&&1===e.nodeType}function nn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function on(e){return!!e&&3===e.nodeType}function an(e){return!!e&&11===e.nodeType&&sn(e.host)}function ln(e){return e?pt(e).split(/\s+/):[]}function un(e,t){var r=tn(t);return!!(r&&e&&e.some(e=>r.match(e)))}function dn(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return ln(t)}function cn(e){return Lt(e)?null:pt(e).split(/(\s+)/).filter(e=>Nn(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function hn(e){var t="";return In(e)&&!Rn(e)&&e.childNodes&&e.childNodes.length&&As(e.childNodes,function(e){var r;on(e)&&e.textContent&&(t+=null!==(r=cn(e.textContent))&&void 0!==r?r:"")}),pt(t)}function pn(e){var t;return Rt(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var _n=["a","button","form","input","select","textarea","label"];function gn(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}}function vn(e,t){if(Rt(t))return!0;var r,i=function(e){if(t.some(t=>gn(e,t)))return{v:!0}};for(var s of e)if(r=i(s))return r.v;return!1}function fn(e){var t=e.parentNode;return!(!t||!sn(t))&&t}var mn=[".ph-no-autocapture","[data-ph-no-autocapture]"],yn=["next","previous","prev",">","<"],bn=[...yn,"+","-","−","–"],Sn=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,wn=[".ph-no-deadclick",".ph-no-capture"],kn=[".ph-no-rageclick",".ph-no-capture"],Cn=["","text","search","email","password","url","tel","number"];function En(e,t){if(!l||xn(e))return!1;var r,i,s,n,o;if(Dt(t)?(r=!!t&&kn,i=void 0,s=!1):(r=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:kn,i=null==t?void 0:t.content_ignorelist,s=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===r)return!1;if(s&&function(e){return!(!e||!sn(e))&&(!!nn(e,"textarea")||(nn(e,"input")?ht(Cn,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(e))return!1;var a=Tn(e,!1).targetElementList;return!function(e,t){if(!1===e||Rt(e))return!1;var r;if(!0===e)r=yn;else{if(!Et(e))return!1;if(e.length>10)return Ms.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map(e=>e.toLowerCase())}return t.some(e=>{var t=e.safeText,i=e.ariaLabel;return r.some(e=>Sn(t,e)||Sn(i,e))})}(i,a.map(e=>{var t;return{safeText:hn(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!vn(a,r)}var xn=e=>!e||nn(e,"html")||!sn(e),Tn=(e,t)=>{if(!l||xn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],s=e;s.parentNode&&!nn(s,"body");)if(an(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=fn(s);if(!n)break;if(t||_n.indexOf(n.tagName.toLowerCase())>-1)r=!0;else try{var o=l.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}catch(e){}i.push(n),s=n}return{parentIsUsefulElement:r,targetElementList:i}};function In(e){for(var t=new Set,r=0,i=e;i.parentNode&&!nn(i,"body");i=i.parentNode){if(r++>=1e3||t.has(i))return!1;t.add(i);var s=dn(i);if(ht(s,"ph-sensitive")||ht(s,"ph-no-capture"))return!1}if(ht(dn(e),"ph-include"))return!0;var n=e.type||"";if(Pt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!Pt(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Rn(e){return!!(nn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||nn(e,"select")||nn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Pn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Mn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Fn=[16,15,14,13],Ln=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),An=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),On=/[0-9A-Za-z_]/;function Dn(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var s=e.charCodeAt(i)-48;r&&(s*=2)>9&&(s-=9),t+=s,r=!r}return t%10==0}function Nn(e,t){if(void 0===t&&(t=!0),Lt(e))return!1;if(Pt(e)){if(e=pt(e),t?Pn.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Mn.lastIndex=0;t=Mn.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),s=0;i.length>s;s++)for(var n of Fn){var o=s+n;if(i.length>=o){var a=i.slice(s,o);if(Pn.test(a)&&Dn(a))return!0}}}return!1}(e))return!1;if(t?Ln.test(e):function(e){var t;for(An.lastIndex=0;t=An.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&On.test(r)&&On.test(i)))return!0}return!1}(e))return!1}return!0}function Bn(e){var t=hn(e);return Nn(t=(t+" "+$n(e)).trim())?t:""}function $n(e){var t="";return e&&e.childNodes&&e.childNodes.length&&As(e.childNodes,function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=hn(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+$n(e)).trim())}catch(e){Ms.error("[AutoCapture]",e)}}),t}function qn(e){return e.replace(/"|\\"/g,'\\"')}function Hn(e){var t=e.attr__class;if(t)return Et(t)?t:ln(t)}var Un=1e6;function Wn(e){var t;return Math.min(Un,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:1e6)}var zn={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Un,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},Vn=["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"],jn=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Gn=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Qn=e=>{Lt(e)||As(Object.keys(e),t=>{(e=>{var t=e.toLowerCase();return Vn.includes(t)||Gn.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},Kn=["/s/","/e/","/i/"];function Zn(e,t,r,i){if(Lt(e))return e;var s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Pt(s)&&(s=parseInt(s)),s>r?"[SessionRecording] "+i+" body too large to record ("+s+" bytes)":e}function Yn(e,t){if(Lt(e))return e;var r=e;return Nn(r,!1)||(r="[SessionRecording] "+t+" body redacted"),As(jn,e=>{var i,s;null!=(i=r)&&i.length&&-1!==(null==(s=r)?void 0:s.indexOf(e))&&(r="[SessionRecording] "+t+" body redacted as might contain: "+e)}),r}var Jn=new WeakSet,Xn="disabled",eo="sampled",to="active",ro="buffering",io="paused",so="lazy_loading",no="rrweb_error",oo="trigger_activated",ao="trigger_pending",lo="trigger_disabled";function uo(e,t,r,i,s,n){return 0===t?lo:(null==e?void 0:e.get_property(r?i+r:s))===n?oo:ao}function co(e,t,r){return t.some(t=>{var i;return"regex"===t.matching&&(null!==(i=null==r?void 0:r.get(t.url))&&void 0!==i?i:new RegExp(t.url)).test(e)})}function ho(e){return e.includes("trigger_activated")?oo:e.includes("trigger_pending")?ao:lo}function po(e){var t=new Set(e);switch(t.delete(lo),t.size){case 0:return lo;case 1:return Array.from(t)[0];default:return ao}}var _o=class{constructor(e){this._matchers=e}triggerStatus(e){return ho(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return ho(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},go=class{constructor(e){this._matchers=e}triggerStatus(e){return po(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return po(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},vo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return oo}stop(){}},fo=e=>"sessionRecording"in e,mo=class{constructor(e,t){this._instance=e,this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._groupId=t}onConfig(e){var t,r;this._urlTriggers=(fo(e)?Tt(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(fo(e)?Tt(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){for(var e of(this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear(),this._urlTriggers))if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){Ms.error("Invalid URL trigger regex pattern:",e.url,t)}for(var t of this._urlBlocklist)if("regex"===t.matching&&!this._compiledBlocklistRegexes.has(t.url))try{this._compiledBlocklistRegexes.set(t.url,new RegExp(t.url))}catch(e){Ms.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return uo(this._instance,this._urlTriggers.length,this._groupId,ee,Y,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ze]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){var e=tn(this._instance);if(!e)return!1;try{return co(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){var r=tn(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,s=co(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&s||(s&&!i?e():!s&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var s=tn(this._instance);if(s&&s!==this._lastCheckedUrl){this._lastCheckedUrl=s;var n=this.urlBlocked,o=co(s,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!n?e():!o&&n&&t();var a=this._urlTriggerStatus(i)===oo,l=co(s,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",s)}}stop(){this._lastCheckedUrl=""}},yo=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){var e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Ve]:e}),e}triggerStatusNoSideEffects(){var e=ao;return Lt(this.linkedFlag)&&(e=lo),this.linkedFlagSeen&&(e=oo),e}onConfig(e,t){var r;if(this.linkedFlag=(fo(e)?Tt(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Lt(this.linkedFlag)&&!this.linkedFlagSeen){var i=Pt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=Pt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((e,r)=>{var n=!1;if(Tt(r)&&i in r){var o=r[i];n=Dt(o)?!0===o:s?o===s:!!o}var a=n&&!this.linkedFlagSeen;this.linkedFlagSeen=n,a&&t(i,s)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},bo=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(fo(e)?Tt(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return uo(this._instance,this._eventTriggers.length,this._groupId,X,J,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[ze]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===oo,s=this._eventTriggers.includes(e);!i&&s&&t("event",e)}}stop(){}},So=class{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new mo(e,t.id),this._eventTriggerMatching=new bo(e,t.id),this._linkedFlagMatching=new yo(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var i=(t.conditions.events||[]).map(e=>e.name),s={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,r);var n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new _o(n):new go(n)}else this._combinedMatching=new vo}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return"trigger_pending"!==this.triggerStatusNoSideEffects(e)?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(e=>e.status===ao).map(e=>e.label)}checkEventTriggerConditions(e,t,r){this._eventTriggerMatching.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,r,i)}activateTrigger(e,t){var r,i="url"===e?ee+this.group.id:X+this.group.id;null==(r=this._instance.persistence)||r.register({[i]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function wo(e){if(e.rrwebError)return no;if(!e.receivedFlags)return ro;if(!e.isRecordingEnabled)return Xn;if(e.urlTriggerMatching.urlBlocked)return io;var t=!0===e.isSampled,r=new _o([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?eo:"trigger_activated"===r?to:"trigger_pending"===r?ro:!1===e.isSampled?Xn:to}function ko(e){if(e.rrwebError)return no;if(!e.receivedFlags)return ro;if(!e.isRecordingEnabled)return Xn;if(e.urlTriggerMatching.urlBlocked)return io;var t=new go([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==lo,i=Dt(e.isSampled);return r&&"trigger_pending"===t?ro:r&&"trigger_disabled"===t||i&&!e.isSampled?Xn:!0===e.isSampled?eo:to}function Co(){var e=[];return function(t,r){if(Tt(r)||Et(r)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(r)?"[Circular]":(e.push(r),r)}return r}}function Eo(e){var t=JSON.stringify(e,Co());return t?new Blob([t]).size:0}function xo(e){if(Ft(e))return 4;if(Rt(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(Et(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=Rt(i)||Ft(i)?4:xo(i)}return t}var s=e,n=2,o=!0;for(var a in s)if({}.hasOwnProperty.call(s,a)){var l=s[a];Rt(l)||(o||(n+=1),o=!1,n+=a.length+3+xo(l))}return n;default:return 0}}function To(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),i=e.sizes.slice(0,r),s=e.sizes.slice(r);return[To({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),To({size:s.reduce((e,t)=>e+t,0),data:e.data.slice(r),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Io=Uint8Array,Ro=Uint16Array,Po=Uint32Array,Mo=new Io([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]),Fo=new Io([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]),Lo=new Io([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ao=function(e,t){for(var r=new Ro(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var s=new Po(r[30]);for(i=1;30>i;++i)for(var n=r[i];r[i+1]>n;++n)s[n]=n-r[i]<<5|i;return[r,s]},Oo=Ao(Mo,2),Do=Oo[1];Oo[0][28]=258,Do[258]=28;for(var No=Ao(Fo,0)[1],Bo=new Ro(32768),$o=0;32768>$o;++$o){var qo=(43690&$o)>>>1|(21845&$o)<<1;Bo[$o]=((65280&(qo=(61680&(qo=(52428&qo)>>>2|(13107&qo)<<2))>>>4|(3855&qo)<<4))>>>8|(255&qo)<<8)>>>1}var Ho=function(e,t,r){for(var i=e.length,s=0,n=new Ro(t);i>s;++s)++n[e[s]-1];var o,a=new Ro(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(r){o=new Ro(1<<t);var l=15-t;for(s=0;i>s;++s)if(e[s])for(var u=s<<4|e[s],d=t-e[s],c=a[e[s]-1]++<<d,h=c|(1<<d)-1;h>=c;++c)o[Bo[c]>>>l]=u}else for(o=new Ro(i),s=0;i>s;++s)o[s]=Bo[a[e[s]-1]++]>>>15-e[s];return o},Uo=new Io(288);for($o=0;144>$o;++$o)Uo[$o]=8;for($o=144;256>$o;++$o)Uo[$o]=9;for($o=256;280>$o;++$o)Uo[$o]=7;for($o=280;288>$o;++$o)Uo[$o]=8;var Wo=new Io(32);for($o=0;32>$o;++$o)Wo[$o]=5;var zo=Ho(Uo,9,0),Vo=Ho(Wo,5,0),jo=function(e){return(e/8|0)+(7&e&&1)},Go=function(e,t,r){(null==t||0>t)&&(t=0),(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof Ro?Ro:e instanceof Po?Po:Io)(r-t);return i.set(e.subarray(t,r)),i},Qo=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},Ko=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},Zo=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var s=r.length,n=r.slice();if(!s)return[new Io(0),0];if(1==s){var o=new Io(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,d=1,c=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=s-1;)a=r[r[c].f>r[u].f?u++:c++],l=r[u!=d&&r[c].f>r[u].f?u++:c++],r[d++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(i=1;s>i;++i)n[i].s>h&&(h=n[i].s);var p=new Ro(h+1),_=Yo(r[d-1],p,0);if(_>t){i=0;var g=0,v=_-t,f=1<<v;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>i;++i){var m=n[i].s;if(t>=p[m])break;g+=f-(1<<_-p[m]),p[m]=t}for(g>>>=v;g>0;){var y=n[i].s;t>p[y]?g-=1<<t-p[y]++-1:++i}for(;i>=0&&g;--i){var b=n[i].s;p[b]==t&&(--p[b],++g)}_=t}return[new Io(p),_]},Yo=function(e,t,r){return-1==e.s?Math.max(Yo(e.l,t,r+1),Yo(e.r,t,r+1)):t[e.s]=r},Jo=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Ro(++t),i=0,s=e[0],n=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[r.subarray(0,i),t]},Xo=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},ea=function(e,t,r){var i=r.length,s=jo(t+2);e[s]=255&i,e[s+1]=i>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;i>n;++n)e[s+n+4]=r[n];return 8*(s+4+i)},ta=function(e,t,r,i,s,n,o,a,l,u,d){Qo(t,d++,r),++s[256];for(var c=Zo(s,15),h=c[0],p=c[1],_=Zo(n,15),g=_[0],v=_[1],f=Jo(h),m=f[0],y=f[1],b=Jo(g),S=b[0],w=b[1],k=new Ro(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var E=Zo(k,7),x=E[0],T=E[1],I=19;I>4&&!x[Lo[I-1]];--I);var R,P,M,F,L=u+5<<3,A=Xo(s,Uo)+Xo(n,Wo)+o,O=Xo(s,h)+Xo(n,g)+o+14+3*I+Xo(k,x)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return ea(t,d,e.subarray(l,l+u));if(Qo(t,d,1+(A>O)),d+=2,A>O){R=Ho(h,p,0),P=h,M=Ho(g,v,0),F=g;var D=Ho(x,T,0);for(Qo(t,d,y-257),Qo(t,d+5,w-1),Qo(t,d+10,I-4),d+=14,C=0;I>C;++C)Qo(t,d+3*C,x[Lo[C]]);d+=3*I;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)Qo(t,d,D[H=31&q[C]]),d+=x[H],H>15&&(Qo(t,d,q[C]>>>5&127),d+=q[C]>>>12)}}else R=zo,P=Uo,M=Vo,F=Wo;for(C=0;a>C;++C)if(i[C]>255){var H;Ko(t,d,R[257+(H=i[C]>>>18&31)]),d+=P[H+257],H>7&&(Qo(t,d,i[C]>>>23&31),d+=Mo[H]);var U=31&i[C];Ko(t,d,M[U]),d+=F[U],U>3&&(Ko(t,d,i[C]>>>5&8191),d+=Fo[U])}else Ko(t,d,R[i[C]]),d+=P[i[C]];return Ko(t,d,R[256]),d+P[256]},ra=new Po([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ia=new Io(0),sa=function(){for(var e=new Po(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),na=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function oa(e,t){void 0===t&&(t={});var r=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=sa[255&r^t[i]]^r>>>8;e=r},d(){return 4294967295^e}}}(),i=e.length;r.p(e);var s,n,o,a,l,u=(s=e,n=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,r,i,s,n){var o=e.length,a=new Io(i+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(i,a.length-s),u=0;if(!t||8>o)for(var d=0;o>=d;d+=65535){var c=d+65535;o>c?u=ea(l,u,e.subarray(d,c)):(l[d]=n,u=ea(l,u,e.subarray(d,o)))}else{for(var h=ra[t-1],p=h>>>13,_=8191&h,g=(1<<r)-1,v=new Ro(32768),f=new Ro(g+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new Po(25e3),w=new Ro(288),k=new Ro(32),C=0,E=0,x=(d=0,0),T=0,I=0;o>d;++d){var R=b(d),P=32767&d,M=f[R];if(v[P]=M,f[R]=P,d>=T){var F=o-d;if((C>7e3||x>24576)&&F>423){u=ta(e,l,0,S,w,k,E,x,I,d-I,u),x=C=E=0,I=d;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=_,N=P-M&32767;if(F>2&&R==b(d-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,d),H=Math.min(258,F);q>=N&&--D&&P!=M;){if(e[d+A]==e[d+A-N]){for(var U=0;H>U&&e[d+U]==e[d+U-N];++U);if(U>A){if(A=U,O=N,U>B)break;var W=Math.min(N,U-2),z=0;for(L=0;W>L;++L){var V=d-N+L+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,M=V)}}}N+=(P=M)-(M=v[P])+32768&32767}if(O){S[x++]=268435456|Do[A]<<18|No[O];var G=31&Do[A],Q=31&No[O];E+=Mo[G]+Fo[Q],++w[257+G],++k[Q],T=d+A,++C}else S[x++]=e[d],++w[e[d]]}}u=ta(e,l,n,S,w,k,E,x,I,d-I,u),n||(u=ea(l,u,ia))}return Go(a,0,i+jo(u)+s)}(s,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+n.mem,o,a,!l)),d=u.length;return function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&na(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}}(u,t),na(u,d-8,r.d()),na(u,d-4,i),u}function aa(e,t){var r=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Io(e.length+(e.length>>>1)),s=0,n=function(e){i[s++]=e},o=0;r>o;++o){if(s+5>i.length){var a=new Io(s+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Go(i,0,s)}function la(e,t){var r="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var i=0;e.length>i;){var s=e[i++];128>s||t?r+=String.fromCharCode(s):224>s?r+=String.fromCharCode((31&s)<<6|63&e[i++]):240>s?r+=String.fromCharCode((15&s)<<12|(63&e[i++])<<6|63&e[i++]):(s=((15&s)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,r+=String.fromCharCode(55296|s>>10,56320|1023&s))}return r}var ua=class{constructor(e,t){var r,i,s,n;void 0===t&&(t={}),this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{var e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,r;this._loggedTracker[e]=!0;var i=this._getNode(e);null==(t=(r=this._options).onBlockedNode)||t.call(r,e,i)}},this._getNodeOrRelevantParent=e=>{var t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,r,i,s,n,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(s=e.attributes)?void 0:s.length)&&void 0!==i?i:0)+(null!==(n=null==(o=e.texts)?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null==(l=e.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this._numberOfChanges(t);if(t.attributes){var i,s,n=t.attributes.length;t.attributes=t.attributes.filter(e=>{var t=this._getNodeOrRelevantParent(e.id)[0];return!this._rateLimiter.consumeRateLimit(t)&&e});var o=n-t.attributes.length;o>0&&(null==(i=(s=this._options).onDroppedAttributeMutations)||i.call(s,o))}var a=this._numberOfChanges(t);if(0!==a||r===a){if(this._byteBudgetDisabled)return e;this._refillByteBudget();var l,u,d=xo(e);return d>this._byteTokens?(null==(l=(u=this._options).onDroppedOversizedMutation)||l.call(u,d),void this._scheduleResync()):(this._byteTokens-=d,e)}},this._scheduleResync=()=>{if(!this._resyncTimer){var e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout(()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null==(e=(t=this._options).requestFullSnapshot)||e.call(t)},e)}},this._rateLimiter=new Kt({bucketSize:null!==(r=this._options.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this._options.refillRate)&&void 0!==i?i:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:Ms}),this._bytesBucketSize=null!==(s=this._options.bytesBucketSize)&&void 0!==s?s:0,this._bytesRefillRate=null!==(n=this._options.bytesRefillRate)&&void 0!==n?n:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;var o=this._options.resyncIntervalMs;this._resyncIntervalMs=At(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}},da=e=>{if(c){try{for(var t=e+"=",r=c.cookie.split(";").filter(e=>e.length),i=0;r.length>i;i++){for(var s=r[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return At(e)&&isFinite(e)&&Math.floor(e)===e});var ca=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,i,s){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(s)||0>t||0>r||0>i||0>s||t>0xffffffffffff||r>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}},ha=class{generate(){var e=this.generateOrAbort();if(!Rt(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(Rt(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e,t=(e=Date.now(),At(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0);if(t>this._timestamp)this._timestamp=t,this._resetCounter();else{if(this._timestamp>=t+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ca.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new ga}},pa=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};l&&!Rt(l.crypto)&&crypto.getRandomValues&&(pa=e=>crypto.getRandomValues(e));var _a,ga=class{nextUint32(){return this._buffer.length>this._cursor||(pa(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}},va=()=>fa().toString(),fa=()=>(_a||(_a=new ha)).generate(),ma="",ya=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ba=null,Sa={_is_supported(){if(!Ft(ba))return ba;if(ba=!1,c)try{var e="__ph_cookie_support_"+va();Sa._set(e,"xyz"),ba='"xyz"'===da(e),Sa._remove(e)}catch(e){ba=!1}return ba},_error(e){Ms.error("cookieStore error: "+e)},_get:da,_parse(e){var t;try{t=JSON.parse(Sa._get(e))||{}}catch(e){}return t},_set(e,t,r,i,s){if(!c)return!1;try{var n="",o="",a=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=c),ma)return ma;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),i=Math.min(r.length,8),s="dmn_chk_"+va();!ma&&i--;){var n=r.slice(i).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",ma=n)}return ma}(e);if(!r){var i=(e=>{var t=e.match(ya);return t?t[0]:""})(e);i!==r&&Ms.info("Warning: cookie subdomain discovery mismatch",i,r),r=i}return r?"; domain=."+r:""}return""}(c.location.hostname,i);if(r){var l=new Date;l.setTime(l.getTime()+864e5*r),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Ms.warn("cookieStore warning: large cookie, len="+u.length),c.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=c&&c.cookie)try{Sa._set(e,"",-1,t)}catch(e){return}}},wa=null,ka={_is_supported(){if(!Ft(wa))return wa;var e=!0;if(Rt(l))e=!1;else try{var t="__mplssupport__";ka._set(t,"xyz"),'"xyz"'!==ka._get(t)&&(e=!1),ka._remove(t)}catch(t){e=!1}return e||Ms.error("localStorage unsupported; falling back to cookie store"),wa=e,e},_error(e){Ms.error("localStorage error: "+e)},_get(e){try{return null==l?void 0:l.localStorage.getItem(e)}catch(e){ka._error(e)}return null},_parse(e){try{return JSON.parse(ka._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==l||l.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){ka._error(e)}return!1},_remove(e){try{null==l||l.localStorage.removeItem(e)}catch(e){ka._error(e)}}},Ca=[pe,ne,se,ae,le,ue,Me,Pe,Ie],Ea=[k,w,Q,K,Be,Ne,I,Fe],xa=e=>e+"_cpm",Ta=["__proto__","constructor","prototype"],Ia=e=>{if(!Tt(e))return{};var t={};return Object.keys(e).forEach(r=>{-1===Ta.indexOf(r)&&(t[r]=e[r])}),t},Ra=function(e,t){void 0===t&&(t=[]);var r={};return[...Ea,...t].forEach(t=>{var i=e[t];Rt(i)||Ft(i)||""===i||(r[t]=i)}),r},Pa=e=>{for(var t=5381,r=2166136261,i=0;e.length>i;i++){var s=e.charCodeAt(i);t=33*t^s,r=Math.imul(r^s,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},Ma=(e,t)=>({p:t,f:Pa(JSON.stringify(e))}),Fa=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var r=Sa._parse(xa(e)),i=(null==r?void 0:r.f)===Pa(t)&&Et(r.p);return{properties:i?r.p:[],isValid:i}}catch(e){return{properties:[],isValid:!1}}},La=(e,t)=>t+"|"+(Sa._get(xa(e))||""),Aa={},Oa={_is_supported:()=>!0,_error(e){Ms.error("memoryStorage error: "+e)},_get:e=>e in Aa?Aa[e]:null,_parse:e=>e in Aa?Aa[e]:null,_set:(e,t)=>(Aa[e]=t,!0),_remove(e){delete Aa[e]}},Da=null,Na={_is_supported(){if(!Ft(Da))return Da;if(Da=!0,Rt(l))Da=!1;else try{var e="__support__";Na._set(e,"xyz"),'"xyz"'!==Na._get(e)&&(Da=!1),Na._remove(e)}catch(e){Da=!1}return Da},_error(e){Ms.error("sessionStorage error: ",e)},_get(e){try{return null==l?void 0:l.sessionStorage.getItem(e)}catch(e){Na._error(e)}return null},_parse(e){try{return JSON.parse(Na._get(e))||null}catch(e){}return null},_set(e,t){try{return null==l||l.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Na._error(e)}return!1},_remove(e){try{null==l||l.sessionStorage.removeItem(e)}catch(e){Na._error(e)}}};Rs.DEBUG=!1,Rs.LIB_VERSION="1.428.8",Rs.LIB_NAME="web";var Ba=Rs,$a=class{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(ie,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(ie);return Tt(t=r)&&Pt(t.sessionId)&&At(t.size)&&r.sessionId===e?r.size:0}};function qa(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<Qt(100*t,0,100,Ms)}function Ha(e){return"$survey_response_"+e}function Ua(e,t){if(!t)return null;var r=e[Ha(t)];return Et(r)?[...r]:r}function Wa(e,t,r){void 0===e&&(e={});var i={};return t.questions.forEach(t=>{if(!Rt(t.originalQuestionIndex)){var r,s=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,n=Ua(e,t.id);Rt(n)||(i[s]=n)}}),n({$survey_questions:t.questions.map(t=>{var i,s;return{id:t.id,question:null!==(i=null==r?void 0:r[null!==(s=t.id)&&void 0!==s?s:""])&&void 0!==i?i:t.question,response:Ua(e,t.id)}})},e,i)}function za(e,t){var r="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(r="$survey_"+t+"/"+e.id+"/"+e.current_iteration),r}function Va(e){return"string"==typeof e&&e.trim()?e.trim():null}function ja(e){return e.toLowerCase()}function Ga(e,t,r){if(!e||!t)return null;var i=ja(t),s=Object.keys(e).find(e=>ja(e)===i);if(s)return null==r||r.debug("Found exact translation match: "+s),s;if(i.includes("-")){var n=i.split("-")[0],o=Object.keys(e).find(e=>ja(e)===n);if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}var Qa=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Ka(e,t,r){var i,s=Ga(e.translations,t,r),o=n({},e),a=!1;if(s){var l,u=null==(l=e.translations)?void 0:l[s];if(u)if(null==r||r.info("Applying survey-level translation for language: "+s),Rt(u.name)||(o.name=u.name,a=!0),o.appearance){var d=n({},o.appearance);for(var c of Qa){var h=u[c];Rt(h)||(d[c]=h,a=!0)}o.appearance=d}else(function(e){return Qa.some(t=>!Rt(e[t]))})(u)&&(a=!0)}var p=e.questions.map(e=>function(e,t,r){var i,s=Ga(e.translations,t,r);if(!s)return{question:e,matchedKey:null,hasChanges:!1};var o=null==(i=e.translations)?void 0:i[s];if(!o)return{question:e,matchedKey:null,hasChanges:!1};var a=n({},e),l=!1;return Rt(o.question)||(a.question=o.question,l=!0),Rt(o.description)||(a.description=o.description,l=!0),Rt(o.buttonText)||(a.buttonText=o.buttonText,l=!0),"link"in a&&!Rt(o.link)&&(a.link=o.link,l=!0),"lowerBoundLabel"in a&&!Rt(o.lowerBoundLabel)&&(a.lowerBoundLabel=o.lowerBoundLabel,l=!0),"upperBoundLabel"in a&&!Rt(o.upperBoundLabel)&&(a.upperBoundLabel=o.upperBoundLabel,l=!0),"choices"in a&&function(e){return Et(e.choices)}(o)&&(a.choices=o.choices,l=!0),{question:l?a:e,matchedKey:l?s:null,hasChanges:l}}(e,t,r)),_=p.map(e=>e.question),g=p.some(e=>e.hasChanges),v=null;return s||(v=(null==(i=p.find(e=>e.matchedKey))?void 0:i.matchedKey)||null),g&&(o.questions=_,a=!0,null==r||r.info("Applied question-level translations for language: "+t)),{survey:o,matchedKey:a?s||v:null}}function Za(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function Ya(e){var t;return Za(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var Ja=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},Xa=e=>e.toLowerCase(),el={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Ja(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Ja(t,e))),icontains:(e,t)=>t.map(Xa).some(t=>e.map(Xa).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(Xa).every(t=>e.map(Xa).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r<parseFloat(e))})};function tl(e,t){return!e||Object.entries(e).every(e=>{var r=e[1],i=null==t?void 0:t[e[0]];if(null==i)return!1;var s=el[r.operator];return!!s&&s(r.values,[String(i)])})}function rl(e,t,r){return js({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var il=new Set(["is_not","not_icontains","not_regex"]);function sl(e,t,r){return!e||0===e.length||e.every(e=>{var i,s=null==(i="person"===e.type?r:t)?void 0:i[e.key],n=e.operator||"exact";if(Rt(s)||Ft(s))return il.has(n);var o=el[n];return!!o&&!Rt(e.value)&&!Ft(e.value)&&o(Et(e.value)?e.value.map(String):[String(e.value)],Et(s)?s.map(String):[String(s)])})}var nl=Fs("[SessionRecording]");function ol(e,t){return t?e:"!"+e}function al(e,t){return e===t||e!=="!"+t&&null}var ll=class{constructor(e,t,r,i,s,n,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=s,this._tryTakeFullSnapshot=n,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=ko}onRemoteConfig(e){this._sampleRate=At(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new _o([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=wo):(this._triggerStatusMatcher=new go([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=ko),this._instance.register_for_session({[Qe]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,(e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()})}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t,r=null==(t=this._instance.get_property("$session_recording_remote_config"))?void 0:t.minimumDurationMilliseconds;return At(r)?r:null}checkUrlTriggers(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(t,r,i,e)}setupEventTriggerListeners(e,t,r){if(0!==this._eventTriggerMatching._eventTriggers.length&&Lt(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){nl.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,s=this._sampleRate;if(!At(s))return null==(r=this._instance.persistence)||r.unregister(K),void(null==(i=this._instance.persistence)||i.unregister(W));var n=this._instance.get_property(K),o=this._instance.get_property(W),a=al(n,e),l=At(o)&&o!==s,u=Rt(o)&&n===e,d=l||u||!Dt(a),c=d?qa(e,s):a;d&&(c?this._reportStarted("sampled"):nl.warn("Sample rate ("+s+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[K]:ol(e,c),[W]:Ft(o)&&n===e?null:s})}ensureSamplingDecision(e){At(this._sampleRate)&&(Dt(al(this._instance.get_property(K),e))||this.makeSamplingDecisions(e))}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,s;null==(e=this._instance.persistence)||e.unregister(J),null==(t=this._instance.persistence)||t.unregister(Y),null==(r=this._instance.persistence)||r.unregister(K),null==(i=this._instance.persistence)||i.unregister(W),null==(s=this._instance.persistence)||s.unregister(Z)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===ao}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(e=>e.status===ao).map(e=>e.label)}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},ul=class{constructor(e,t,r,i,s){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=s,this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Qe]:"v2_trigger_groups",[Ke]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):nl.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return no;if(!e.receivedFlags)return ro;if(!e.isRecordingEnabled)return Xn;if(e.urlTriggerMatching.urlBlocked)return io;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return Xn;var i=!1,s=!1;for(var n of t){var o=n.triggerStatus(e.sessionId);if("trigger_activated"===o){var a=n.group.id,l=r.get(a);Rt(l)?Ms.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(s=!0)}else"trigger_pending"===o&&(i=!0)}return s?eo:i?ro:Xn}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this._triggerGroupMatchers)if("trigger_activated"===r.triggerStatus(e)){var i=r.group.minDurationMs;At(i)&&(Ft(t)||t>i)&&(t=i)}return t}checkUrlTriggers(e,t,r,i){var s=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var n=function(i){i.checkUrlTriggerConditions(t,r,t=>{s._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),s.updateActiveTriggers(e),s._onTriggerActivated(t))},e)};for(var o of this._triggerGroupMatchers)n(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e(e=>{var r;if(this._hasCompletedInitialFlush)return nl.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var s=function(r){r.checkEventTriggerConditions(e.event,s=>{if(i._checkGroupLevelProperties(r,e.properties)){var n=(r.group.conditions.events||[]).filter(t=>t.name===e.event),o=i._instance.get_property(pe);n.some(t=>!t.properties||0===t.properties.length||sl(t.properties,e.properties,o))&&(r.activateTrigger(s,t),i.updateActiveTriggers(t),i._onTriggerActivated(s))}},t)};for(var n of this._triggerGroupMatchers)s(n)}catch(e){nl.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(var t of this._triggerGroupMatchers){var r,i=t.group,s=i.id,n=i.sampleRate,o=te+s,a=this._instance.get_property(o),l=null,u=!1,d=!1,c=!1;if(Tt(a)){var h=a.sessionId,p=a.sampleRate,_=a.sampled;u="string"==typeof h&&h!==e,d=At(p)&&p!==n,l=h===e&&At(p)&&p===n&&Dt(_)?_:null}else l=a===e||null,u="string"==typeof a&&a!==e,c=a===e;var g=u||d||c||!Dt(l),v=g?qa(e+s,n):l;g&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:s,group_name:i.name,sampleRate:n,isSampled:v}),this._triggerGroupSamplingResults.set(s,v),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:n,sampled:v}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,r;for(var i of(null==(e=this._instance.persistence)||e.unregister(K),null==(t=this._instance.persistence)||t.unregister(W),null==(r=this._instance.persistence)||r.unregister(Z),this._triggerGroupMatchers)){var s,n,o,a=i.group.id;null==(s=this._instance.persistence)||s.unregister(X+a),null==(n=this._instance.persistence)||n.unregister(ee+a),null==(o=this._instance.persistence)||o.unregister(te+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,s=i.id,n="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(s);n&&t.push({id:s,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[je]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if("trigger_pending"===t.triggerStatus(e))return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap(t=>"trigger_pending"!==t.triggerStatusNoSideEffects(e)?[]:t.getPendingTriggerConditions(e).map(e=>'trigger group "'+t.group.name+'": '+e))}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){var r=e.group.conditions.properties;return!r||0===r.length||sl(r,t,this._instance.get_property(pe))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new So(t._instance,e,(r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name}),t._onTriggerActivated()});t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}},dl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],cl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...dl],hl="<masked>",pl=["li_fat_id"];function _l(e,t,r){if(!c)return{};var i,s=t?[...dl,...r||[]]:[],n=gl(Zs(c.URL,s,hl),e);return Os((i={},As(pl,function(e){var t=da(e);i[e]=t||null}),i),n)}function gl(e,t){var r=cl.concat(t||[]),i={};return As(r,function(t){var r=Ks(e,t);i[t]=r||null}),i}function vl(e){var t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",i={};if(!Ft(t)){i.$search_engine=t;var s=c?Ks(c.referrer,r):"";s.length&&(i.ph_keyword=s)}return i}function fl(){return navigator.language||navigator.userLanguage}var ml="$direct";function yl(){return(null==c?void 0:c.referrer)||ml}function bl(e,t,r){var i;void 0===r&&(r=!1);var s=e?[...dl,...t||[]]:[],n=null==(i=r?li(null==h?void 0:h.href):null==h?void 0:h.href)?void 0:i.substring(0,1e3);return{r:yl().substring(0,1e3),u:n?Zs(n,s,hl):void 0}}function Sl(e,t){var r;void 0===t&&(t=!1);var i=e.r,s=e.u,n=t?li(s):s,o={$referrer:i,$referring_domain:null==i?void 0:i==ml?ml:null==(r=Gs(i))?void 0:r.host};if(n){o.$current_url=n;var a=Gs(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,Os(o,gl(n))}return i&&Os(o,vl(i)),o}function wl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function kl(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Cl=1e5,El=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,xl=[],Tl=()=>!1,Il="@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(" "),Rl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Pl="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(" "),Ml="Accommodation AdministrativeArea Country Place State".split(" "),Fl={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:Rl,publisher:Pl},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:xl},Offer:{seller:Pl},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:Pl,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Pl,areaServed:Ml,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:xl}},Ll=[["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(" "),Fl.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Fl.Event],[Pl,Fl.Organization],[Ml,Fl.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Fl.Product]];function Al(e,t){return kt.call(e,t)?e[t]:void 0}function Ol(e){var t=typeof e;return Ft(e)||"string"===t||"number"===t||"boolean"===t}function Dl(e){return Ol(e)||Et(e)&&e.every(Ol)?e:void 0}function Nl(e,t){if("string"==typeof e){var r=e.trim(),i=r.indexOf("#"),s=0>i?r:r.slice(i+1);if(!(!s||0>i&&(/^[a-z][a-z\d+.-]*:/i.test(r)||r.includes("/")||r.includes("?"))))try{return t(s)?s:void 0}catch(e){return}}}function Bl(e){if(kt.call(Fl,e))return Fl[e];for(var t of Ll){var r=t[1];if(t[0].includes(e))return r}}function $l(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function ql(e,t,r,i){if(Et(e)){var s=e.map(e=>ql(e,t,r,i)).filter(e=>!Rt(e));return s.length?s:void 0}return Hl(e,t,r,i)||void 0}function Hl(e,t,r,i){if(!Tt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(r))return null;var s=Al(e,"@type"),n=function(e){var t=new Set,r="string"==typeof e?[e]:Et(e)?e:[],i=[];for(var s of r)if("string"==typeof s){var n=s.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&El.test(n)&&!t.has(n)&&(t.add(n),i.push(n),20===i.length))break}return i}(s),o=n.filter(e=>!!Bl(e)&&(!i||!i.length||i.includes(e))),a={};for(var l of Il){var u="@type"===l?n.length?"string"==typeof s?n[0]:n:void 0:"@id"===l?Nl(Al(e,l),t):Dl(Al(e,l));Rt(u)||$l(a,l,u)}for(var d of o){var c=Bl(d);for(var h of Object.keys(c)){var p=Al(e,h),_=c[h];if(!0===_){var g=Dl(p);Rt(g)||$l(a,h,g)}else{var v=ql(p,t,r,_);Rt(v)||$l(a,h,v)}}}var f=ql(Al(e,"@graph"),t,r);return Rt(f)||$l(a,"@graph",f),Object.keys(a).length?a:null}function Ul(e,t,r){if(!Tt(e))return null;var i=Al(e,"@context");if("string"!=typeof i||!/^https?:\/\/schema\.org\/?$/.test(i))return null;var s=Hl(e,t,r);return s?n({"@context":"https://schema.org"},s):null}function Wl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null==(t=e.getAttribute("type"))?void 0:t.trim().toLowerCase())}function zl(e,t,r){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some(e=>(t.lastIndex=0,t.test(e))))return!0;try{return!!r&&e.matches(r)}catch(e){return!1}}function Vl(e,t,r){for(var i=e;i;){if(zl(i,t,r))return!0;var s=i.parentNode;i=i.parentElement||(s&&s.nodeType===s.DOCUMENT_FRAGMENT_NODE?s.host:null)}return!1}function jl(e){return Wl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(Wl)}function Gl(e){return Rt(e)?void 0:Math.round(e)}function Ql(e){return Tt(e)?e.network_timing:e}var Kl,Zl,Yl=Fs("[SessionRecording]"),Jl=[1,2,3,4,5,6,7,12],Xl=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function eu(){var e;return null==b||null==(e=b.__PosthogExtensions__)?void 0:e.rrweb}function tu(){var e;return null==(e=eu())?void 0:e.record}function ru(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,Co())}}function iu(e){return la(oa(aa(ru(e))),!0)}function su(e){return nu.apply(this,arguments)}function nu(){return(nu=a(function*(e){var t=yield as(ru(e),Ba.DEBUG,{rethrow:!0});return la(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}var ou="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,au=!1;function lu(e){return Et(e)&&0===e.length?Kl=null!=Kl?Kl:iu([]):iu(e)}function uu(e){return du.apply(this,arguments)}function du(){return(du=a(function*(e){return Et(e)&&0===e.length?Kl||(Zl=null!=Zl?Zl:su([]).then(e=>(Kl=e,e)).catch(e=>{throw Kl=void 0,Zl=void 0,e})):su(e)})).apply(this,arguments)}function cu(e){return ou&&!au&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function hu(e){return{event:e,size:xo(e)}}function pu(e,t){return n({},e,{data:t,cv:"2024-10"})}function _u(e,t){return n({},e,{cv:"2024-10",data:n({},e.data,t)})}function gu(e){try{if(2===e.type)return hu(pu(e,iu(e.data)));if(3===e.type&&0===e.data.source)return hu(_u(e,{texts:lu(e.data.texts),attributes:lu(e.data.attributes),removes:lu(e.data.removes),adds:lu(e.data.adds)}));if(3===e.type&&8===e.data.source)return hu(_u(e,{adds:e.data.adds?iu(e.data.adds):void 0,removes:e.data.removes?iu(e.data.removes):void 0}))}catch(e){Yl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:Eo(e)}}function vu(){return vu=a(function*(e){try{if(2===e.type)return hu(pu(e,yield su(e.data)));if(3===e.type&&0===e.data.source){var t=yield Promise.all([uu(e.data.texts),uu(e.data.attributes),uu(e.data.removes),uu(e.data.adds)]);return hu(_u(e,{texts:t[0],attributes:t[1],removes:t[2],adds:t[3]}))}if(3===e.type&&8===e.data.source){var r=yield Promise.all([e.data.adds?su(e.data.adds):void 0,e.data.removes?su(e.data.removes):void 0]);return hu(_u(e,{adds:r[0],removes:r[1]}))}}catch(t){return ss(t)&&(au=!0),Yl.error("could not compress event asynchronously - trying synchronous compression",t),gu(e)}return{event:e,size:Eo(e)}}),vu.apply(this,arguments)}function fu(e,t){return 5===e.type&&e.data.tag===t}function mu(e){return fu(e,"sessionIdle")}function yu(e){return fu(e,"$session_ending")}function bu(e){return fu(e,"$session_starting")}var Su=class{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return al(this._instance.get_property(K),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return At(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._instance=e,this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingBufferRestored=!1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,r)=>{var i,s,n,o;if(r&&(e!==this._sessionId||t!==this._windowId)){var a=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this._sessionId,u=this._windowId;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null==(i=this._flushedSizeTracker)?void 0:i.currentTrackedSize(l)}),null==(s=this._instance.persistence)||s.unregister(re),this._maxDepthExceeded=!1,null==(n=eu())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){var d=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(d)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp}),null==(o=this._strategy)||o.makeSamplingDecisions(e)}},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Z])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;var r=null==(e=this._buffer.data[0])?void 0:e.timestamp,i=null==(t=this._buffer.data[this._buffer.data.length-1])?void 0:t.timestamp;return At(r)&&At(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!At(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var i=this._sessionDuration;return At(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var s,n=this._getBufferDuration();return!!Ft(n)||r>n||(null==(s=this._instance.persistence)||s.register({[Z]:this._sessionId}),!1)},this._onBeforeUnload=()=>{"buffering"!==this.status?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&!this._heldBufferOverflowed&&this._setFlushHold(void 0),this._drainCompressionQueueSync(),this._flushBuffer(!0)):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=c&&c.visibilityState&&("visible"===c.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+c.visibilityState,{}))},this._documentWasEverVisible=null==t||t;var r=this._sessionManager.checkAndGetSessionAndWindowId(),i=r.windowId,s=r.sessionStartTimestamp;this._sessionId=r.sessionId,this._windowId=i,this._sessionStartTimestamp=s,this._linkedFlagMatching=new yo(this._instance),this._urlTriggerMatching=new mo(this._instance),this._eventTriggerMatching=new bo(this._instance),this._buffer=this._clearBuffer(),this._pendingBufferStorageKey="ph_"+(this._instance.config.persistence_name||this._instance.config.token)+"_replay_pending_buffer",this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||Yl.warn("session_idle_threshold_ms ("+this._sessionIdleThresholdMilliseconds+") is greater than the session timeout ("+this._sessionManager.sessionTimeoutMs+"). Session will never be detected as idle"),this._flushedSizeTracker=new $a(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,r,i,s,n,o,a,l,u=null==(e=this._remoteConfig)?void 0:e.masking,d={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector,maskAllElementAttributes:null==(s=this._instance.config.session_recording)?void 0:s.maskAllElementAttributes},c=null!==(n=null==d?void 0:d.maskAllInputs)&&void 0!==n?n:null==u?void 0:u.maskAllInputs,h=null!==(o=null==d?void 0:d.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,p=null!==(a=null==d?void 0:d.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,_=null!==(l=null==d?void 0:d.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return Rt(c)&&Rt(h)&&Rt(p)&&Rt(_)?void 0:{maskAllInputs:null==c||c,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(!this._hasWarnedClientMaskingOverride){var t=null==(e=this._remoteConfig)?void 0:e.masking;if(!Lt(t)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{var i=null==r?void 0:r[e],s=t[e];return!Rt(i)&&i!==s});0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,Yl.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: '+i.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==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector,maskAllElementAttributes:null==r?void 0:r.maskAllElementAttributes},project:t}))}}}get _canvasResolutionScale(){var e;return Qt(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,Fs("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,s,n,o,a=this._instance.config.session_recording.captureCanvas,l=null==(e=this._remoteConfig)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==a?void 0:a.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,d=null!==(i=null!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==i?i:4,c=null!==(n=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==n?n:.4;if("string"==typeof c){var h=parseFloat(c);c=isNaN(h)?.4:h}return{enabled:u,fps:Qt(d,0,12,Fs("canvas recording fps"),4),quality:Qt(c,0,1,Fs("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e,t,r=!(null==(e=this._remoteConfig)||!e.consoleLogRecordingEnabled);return null!==(t=this._instance.config.enable_recording_console_log)&&void 0!==t?t:r}get _networkPayloadCapture(){var e,t,r,i=null==(e=this._remoteConfig)?void 0:e.networkPayloadCapture,s={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},n=(null==s?void 0:s.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==i?void 0:i.recordBody),a=Ql(this._instance.config.capture_performance),l=Ql(null==i?void 0:i.capturePerformance),u=!!(Dt(a)?a:l);return n||o||u?{recordHeaders:n,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,r=[],i=null==(e=b.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;i&&this._isConsoleLogCaptureEnabled&&r.push(i());var s=null==(t=b.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&xt(s))if(!Vs.includes(h.hostname)||this._forceAllowLocalhostNetworkCapture){var o=xt(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;r.push(s(((e,t,r)=>{var i,s={payloadSizeLimitBytes:zn.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...zn.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...zn.payloadHostDenyList]},o=!1!==e.session_recording.recordHeaders&&t.recordHeaders,a=!1!==e.session_recording.recordBody&&t.recordBody,l=!1!==e.capture_performance&&t.recordPerformance,u=(i=Wn(s),e=>(null!=e&&e.requestBody&&(e.requestBody=Zn(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=Zn(e.responseBody,e.responseHeaders,i,"Response")),e)),d=t=>{return u(((e,t,r)=>{var i;if(null==r||!r(e.name)){var s=Gs(e.name),n=0===t.indexOf("http")?null==(i=Gs(t))?void 0:i.pathname:t;"/"===n&&(n="");var o=null==s?void 0:s.pathname.replace(n||"","");if(!(s&&o&&Kn.some(e=>0===o.indexOf(e))))return e}})((Qn((i=t).requestHeaders),Qn(i.responseHeaders),i),e.api_host,r));var i},c=xt(e.session_recording.maskNetworkRequestFn);return c&&xt(e.session_recording.maskCapturedNetworkRequestFn)&&Ms.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var r=e.session_recording.maskNetworkRequestFn({url:t.name});return!r&&t.isInitial?r:n({},t,{name:null==r?void 0:r.url})}),s.maskRequestFn=xt(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var r=d(t);if(r){var i=r.isInitial?{name:"",entryType:r.entryType,startTime:r.startTime,duration:r.duration,endTime:r.endTime,timeOrigin:r.timeOrigin,timestamp:r.timestamp,isInitial:!0}:void 0,s=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(r);return Lt(s)&&i?(Jn.add(i),i):null!=s?s:void 0}}:e=>function(e){if(!Rt(e))return e.requestBody=Yn(e.requestBody,"Request"),e.responseBody=Yn(e.responseBody,"Response"),e}(d(e)),n({},zn,s,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,o)))}else Yl.info("NetworkCapture not started because we are on localhost.");return r}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?li(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?li(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...dl,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(Zs(r,i,hl))}_maskUrl(e){var t,r=this._instance.config.session_recording;if(r.maskCapturedNetworkRequestFn){var i,s=r.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==s?void 0:s.name)&&void 0!==i?i:null==s?void 0:s.url}return r.maskNetworkRequestFn?null==(t=r.maskNetworkRequestFn({url:e}))?void 0:t.url:e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):Yl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Xl(()=>tu().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{var t=tu();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e){void 0===e&&(e=!1),Promise.resolve().then(()=>{var t;return null==(t=this._jsonLdCapture)?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!l)return;var e=new URL(l.location.href),t=this._maskReplayUrl(e.origin+e.pathname+e.search);this._lastHref!==t&&(this._lastHref=t,this._tryAddCustomEvent("$url_changed",{href:t}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){var e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Xl(()=>tu().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,s=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return At(s)&&Number.isFinite(s)&&s>=1e3&&36e5>=s?s:6e4}return null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0!==this._isIdle){var e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null==(e=this._jsonLdCapture)||e.scan(),clearInterval(this._fullSnapshotTimer),Yl.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null==(e=this._jsonLdCapture)||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Yl.info("recording resumed"))}_activateTrigger(e,t){var r;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)){this._isActivatingTrigger=!0;try{var i,s,n="url"===e?Y:J;null==(i=this._instance.persistence)||i.register({[n]:this.sessionId}),null==(s=this._strategy)||s.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){var e=this._instance.get_property(H);if(e){var t;try{t=Tt(e)?e:JSON.parse(e)}catch(e){return void Yl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var r,i,s=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-s>36e5)return Yl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(H))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(e){var t,r,i=this._remoteConfig;if(i){if(!this.isStarted){var s=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(s?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=s,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());var n=this._sessionManager.checkAndGetSessionAndWindowId(),o=n.windowId,a=n.sessionStartTimestamp;this._sessionId=n.sessionId,this._windowId=o,this._sessionStartTimestamp=a,this._restorePendingBuffer(),null==(t=this._instance.persistence)||t.unregister(re),null!=i&&i.endpoint&&(this._endpoint=null==i?void 0:i.endpoint),this._strategy=2===(null==i?void 0:i.version)&&null!=i&&i.triggerGroups&&i.triggerGroups.length>0?new ul(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new ll(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(i),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(z,()=>{this.overrideSampling()},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(z)}),this._checkOverride(V,()=>{this.overrideLinkedFlag()},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(V)}),this._checkOverride(G,()=>{this.overrideTrigger("event")},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(G)}),this._checkOverride(j,()=>{this.overrideTrigger("url")},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(j)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Ws(l,"beforeunload",this._onBeforeUnload),Ws(l,"pagehide",this._onPageHide),Ws(l,"offline",this._onOffline),Ws(l,"online",this._onOnline),Ws(c,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&xt(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&xt(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,r)=>{var i;null==(i=this._forceIdleSessionIdListener)||i.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,r)})}):xt(this._sessionManager.on)||Yl.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Lt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){Yl.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(e||"recording_initialized"))}else Yl.info("remote config must be stored in persistence before recording can start")}_teardown(){var e,t,r,i,s,n;null==l||l.removeEventListener("beforeunload",this._onBeforeUnload),null==l||l.removeEventListener("pagehide",this._onPageHide),null==l||l.removeEventListener("offline",this._onOffline),null==l||l.removeEventListener("online",this._onOnline),null==c||c.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null==(e=this._removePageViewCaptureHook)||e.call(this),this._removePageViewCaptureHook=void 0,null==(t=this._removeEventTriggerCaptureHook)||t.call(this),this._removeEventTriggerCaptureHook=void 0,null==(r=this._onSessionIdListener)||r.call(this),this._onSessionIdListener=void 0,null==(i=this._onSessionIdleResetForcedListener)||i.call(this),this._onSessionIdleResetForcedListener=void 0,null==(s=this._forceIdleSessionIdListener)||s.call(this),this._forceIdleSessionIdListener=void 0,null==(n=this._strategy)||n.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null==(e=this._mutationThrottler)||e.stop(),this._queuedRRWebEvents=[],null==(t=this._jsonLdCapture)||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var r;null==(r=this._stopRrweb)||r.call(this)}catch(e){Yl.warn("could not stop rrweb",e)}this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0,this._flushHoldReason=void 0;var e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch(()=>{}).then(()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),Yl.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),Yl.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),Yl.info("stopped")}_releaseHoldAfterStop(){this._setFlushHold(void 0,{preserveLogDedup:this._isRestartingForSessionIdChange}),this._heldEpochShipsOnUnload=!1}flushBeforeIdentityReset(){(this.isStarted||this._isStoppingAfterCompression)&&(this._drainCompressionQueueSync(),this._flushBuffer())}_restartForSessionIdChange(e){this._isRestartingForSessionIdChange=!0,this._lastActivityTimestamp=Date.now();try{var t;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null==(t=eu())||null==t.resetSnapshotCostState||t.resetSnapshotCostState(),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,t){var r=(void 0===t?{}:t).preserveLogDedup,i=void 0!==r&&r;if(this._holdFlushUntilInteraction=!Rt(e),this._flushHoldReason=e,Rt(e))i||(this._lastLoggedFlushHold=void 0);else if(!this._isRestartingForSessionIdChange){var s=this.sessionId+":"+e;s!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=s,Yl.info("holding buffer: "+e+". nothing is uploaded until the user interacts with the page"))}}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._setFlushHold(void 0),this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard(e){var t=(void 0===e?{}:e).discardProducerEvents,r=void 0!==t&&t;this._holdFlushUntilInteraction=!0,r&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),Yl.info("discarded")}_captureProcessedEvent(e,t,r,i,s){var n={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:s};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(n)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,Yl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t=null==(e=eu())||null==e.getLastSnapshotCost?void 0:e.getLastSnapshotCost();t&&t!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=t,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=t.durationMs||(this._slowestFullSnapshot=t),500>t.durationMs||Yl.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(t.durationMs),stylesheetMs:Math.round(t.stylesheetMs),nodeCount:t.nodeCount,cssRuleCount:t.cssRuleCount,nonDeferrableCssRuleCount:t.nonDeferrableCssRuleCount,deferredStylesheetCount:t.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(Rt(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,Yl.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter(t=>t!==e)}_captureQueuedCompressionEvent(e,t,r){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,r,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{var t=e.event,r=Eo(e.event);if(e.compressionEnabled)try{var i=gu(e.event);t=i.event,r=i.size}catch(e){Yl.error("could not process queued compression event - will use uncompressed event",e)}try{this._captureQueuedCompressionEvent(e,t,r)}catch(e){Yl.error("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{this._processQueuedCompressionEventSync(e)})}_enqueueCompression(e,t,r,i){var s=this,n={event:e,compressionEnabled:t,targetSessionId:r,targetWindowId:i,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(n),this._queuedCompressionEvents+=1;var o=function(){var r=a(function*(){try{if(n.processed)return;var r,i;try{var o=t?cu(e)?yield function(e){return vu.apply(this,arguments)}(e):gu(e):{event:e,size:Eo(e)};r=o.event,i=o.size}catch(t){Yl.error("could not process queued compression event - will use uncompressed event",t),r=e,i=Eo(e)}s._captureQueuedCompressionEvent(n,r,i)}finally{s._finishQueuedCompressionEvent(n)}});return function(){return r.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(e){var t,r,i,s,n,o,a,l,u;if(this._instance.sessionManager&&(this._processQueuedEvents(),e&&Tt(e))){if(4===e.type){var d=this._maskReplayUrl(e.data.href);if(this._lastHref=d,!d)return;e.data.href=d}else this._pageViewFallBack();if(null==(t=this._strategy)||t.checkUrlTriggers(this.sessionId,()=>this._pauseRecording(),()=>this._resumeRecording(),(e,t)=>this._activateTrigger(e,t)),!this._urlTriggerMatching.urlBlocked||function(e){return 5===e.type&&"recording paused"===e.data.tag}(e)){var c,h,p;2===e.type&&(null!=(c=eu())&&null!=c.wasMaxDepthReached&&c.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null==(h=this._mutationThrottler)||h.reset(),null==(p=this._instance.persistence)||p.register_once({[re]:e.timestamp},void 0));var _=2===e.type&&(null==(r=this._strategy)?void 0:r.hasPendingTriggers(this.sessionId));_&&this._clearBufferBeforeMostRecentMeta();var g=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(g){var v=function(e){var t=e;if(t&&Tt(t)&&6===t.type&&Tt(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;t.data.payload.payload.length>i;i++)r.push(t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?t.data.payload.payload[i].slice(0,2e3)+"...[truncated]":t.data.payload.payload[i]);return t.data.payload.payload=r,e}return e}(g),f=function(e){return yu(e)?e.data.payload:null}(v),m=function(e){return bu(e)?e.data.payload:null}(v),y=function(e){return mu(e)?e.data.payload:null}(v);f||m?null!=f&&f.lastActivityTimestamp&&(v.timestamp=f.lastActivityTimestamp):null!=y&&y.sessionId||this._updateWindowAndSessionIds(v),2===e.type&&(this._fullSnapshotTimestamps.push([this._sessionId,e.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));var b=null!==(i=null!==(s=null!==(n=null==f?void 0:f.currentSessionId)&&void 0!==n?n:null==m?void 0:m.nextSessionId)&&void 0!==s?s:null==y?void 0:y.sessionId)&&void 0!==i?i:this._sessionId,S=null!==(o=null!==(a=null!==(l=null==f?void 0:f.currentWindowId)&&void 0!==l?l:null==m?void 0:m.nextWindowId)&&void 0!==a?a:null==y?void 0:y.windowId)&&void 0!==o?o:this._windowId;if(!0!==this._isIdle||function(e){return mu(e)||yu(e)||bu(e)}(v)){2===v.type&&(this._eventsDroppedWhileIdle=0),y&&(v.timestamp=y.lastActivityTimestamp+y.threshold);var w=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,_?this._scheduleJsonLdScan(!0):w||this._scheduleJsonLdScan();var k=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(this._queuedCompressionEvents>0||k&&cu(v))this._enqueueCompression(v,k,b,S);else{var C=k?gu(v):{event:v,size:Eo(v)};this._captureProcessedEvent(v,C.event,C.size,b,S)}}else(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source})(v)&&this._eventsDroppedWhileIdle++}else!0===this._isIdle&&this._eventsDroppedWhileIdle++}}}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):Xn}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[K]:this.sessionId,[W]:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var e,t=null==l||null==(e=l.location)?void 0:e.href;if(!t)return;var r=this._maskReplayUrl(t);if(!r)return;return new URL(r).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every(e=>5===(null==e?void 0:e.type)&&!yu(e)&&!bu(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return Rt(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ge]:[]}),void(this._lastLoggedBufferingReason=void 0);var t=this._describePendingTriggerConditions();if(0===t.length)return Rt(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ge]:[]}),void(this._lastLoggedBufferingReason=void 0);var r=t.join(", "),i=this.sessionId+":"+r;i!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=i,this._instance.register_for_session({[Ge]:t}),Yl.info("buffering: "+r))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null==(e=this._instance.persistence)?void 0:e._disabled)&&Na._is_supported()}_parkBufferForNextPage(){0!==this._buffer.data.length&&this._buffer.size!==this._lastParkedBufferSize&&943718.4>=this._buffer.size&&this._canParkPendingBuffer()&&(this._lastParkedBufferSize=this._buffer.size,Na._set(this._pendingBufferStorageKey,this._buffer))}_restorePendingBuffer(){if(!this._pendingBufferRestored&&this._canParkPendingBuffer()){this._pendingBufferRestored=!0;var e=Na._parse(this._pendingBufferStorageKey);Na._remove(this._pendingBufferStorageKey),Tt(e)&&Et(e.data)&&0!==e.data.length&&Et(e.sizes)&&e.sizes.length===e.data.length&&At(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}}_flushBuffer(e){var t;if(void 0===e&&(e=!1),this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);var r=this._buffer;null==(t=this._strategy)||t.ensureSamplingDecision(this.sessionId);var i=this._isBelowMinimumDuration(),s=this.status;if(this._maybeLogBufferingReason(s),"buffering"===s||"paused"===s||"disabled"===s||i)return!e||"active"!==s&&"sampled"!==s||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==r)return this._buffer;if(r.data.length>0){var n,o=this._currentMaskedHostname();To(r).forEach(e=>{try{var t;null==(t=this._flushedSizeTracker)||t.trackSize(e.sessionId,e.size),this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Ba.LIB_NAME,$lib_version:Ba.LIB_VERSION,$snapshot_host:o})}catch(e){Yl.warn("could not capture snapshot chunk - skipping it",e)}}),Rt(this._lastParkedBufferSize)||(Na._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null==(n=this._strategy)||n.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,s=this._buffer.sessionId!==i;if(s||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+r>943718.4){var n=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==n)return;s&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=i,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+r>943718.4)?this._heldBufferOverflowed||(this._heldBufferOverflowed=!0,this._buffer=this._clearBuffer()):(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t,r=null==(e=this._buffer)?void 0:e.data[(null==(t=this._buffer)?void 0:t.data.length)-1];return r?r.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();for(var e=-1,t=this._buffer.data.length-1;t>=0;t--)if(4===this._buffer.data[t].type){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce((e,t)=>e+t,0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Xe]:e}),Yl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",n({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==Jl.indexOf(null==(t=e.data)?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());var r=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),i=r.windowId,s=r.sessionId,n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){var o="unknown"===this._isIdle;this._isIdle=!1,o||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}var a=this._sessionId!==s,l=this._windowId!==i;if(this._windowId=i,this._sessionId=s,a||l){var u=a&&!1!==this._isIdle;u&&(this._isIdle="unknown"),this._restartForSessionIdChange(u)}else if(t&&this._releaseHoldAndFlush(),n){var d,c=["sampled","active"].includes(this.status)||(null==(d=this._strategy)?void 0:d.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&c&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,r,i,s,n,o,a,l,u=null==(e=eu())||null==e.getDeferredStylesheetStats?void 0:e.getDeferredStylesheetStats();return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this._flushHoldReason,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this._flushedSizeTracker)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:Gl(null==(r=this._slowestFullSnapshot)?void 0:r.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Gl(null==(i=this._slowestFullSnapshot)?void 0:i.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(s=this._slowestFullSnapshot)?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(n=this._slowestFullSnapshot)?void 0:n.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null==(o=this._slowestFullSnapshot)?void 0:o.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==u?void 0:u.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==u?void 0:u.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==u?void 0:u.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Gl(null==u?void 0:u.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Gl(null==u?void 0:u.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Gl(null==(a=eu())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null==(l=eu())||null==l.getDiscardedDurationSamples?void 0:l.getDiscardedDurationSamples(),$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped,$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped,$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped,$sdk_debug_replay_rrweb_error:this._rrwebError,[Ye]:!!this._stopRrweb,[Je]:this._rrwebStartAttempted}}_startRecorder(){var e;if(!this._stopRrweb){this._rrwebStartAttempted=!0;var t,r,i,s,o={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},a=this._instance.config.session_recording;for(var u of Object.entries(a||{})){var d=u[0],h=u[1];if(d in o)if("maskInputOptions"===d)o.maskInputOptions=n({password:!0},h);else if("sampling"===d){var p=null!=h?h:{},_={};Rt(p.mousemove)||(_.mousemove=p.mousemove),Rt(p.mouseInteraction)||(_.mouseInteraction=p.mouseInteraction),o.sampling=_}else o[d]=h}!0===(null==a?void 0:a.captureJsonLd)&&!0!==o.slimDOMOptions&&"all"!==o.slimDOMOptions&&(o.slimDOMOptions=n({},o.slimDOMOptions,{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(o.recordCanvas=!0,o.sampling=n({},o.sampling,{canvas:this._canvasRecording.fps}),o.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},o.canvasResolutionScale=this._canvasResolutionScale,o.canvasMasking={configured:()=>{var e;return xt(null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn)},regionsFn:e=>{var t,r=null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn;if(xt(r))try{var i;return null!==(i=r(e))&&void 0!==i?i:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,Yl.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(o.maskAllInputs=null===(t=this._masking.maskAllInputs)||void 0===t||t,o.maskTextSelector=null!==(r=this._masking.maskTextSelector)&&void 0!==r?r:void 0,o.blockSelector=null!==(i=this._masking.blockSelector)&&void 0!==i?i:void 0,o.maskAllElementAttributes=null!==(s=this._masking.maskAllElementAttributes)&&void 0!==s&&s),o.maskAllElementAttributes&&o.maskAttributeFn&&(o.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,Yl.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._warnIfClientMaskingShadowsServer();var g=tu();if(g){this._mutationThrottler=null!==(e=this._mutationThrottler)&&void 0!==e?e:new ua(g,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";Yl.info(r,{node:t}),this.log("[SessionRecording] "+r,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});var v=this._gatherRRWebPlugins();if(this._stopRrweb=g(n({emit:e=>{this.onRRwebEmit(e)},plugins:v,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,Yl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},o)),!this._stopRrweb)return this._rrwebError=!0,void Yl.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==a?void 0:a.captureJsonLd)&&c&&null!=l&&l.MutationObserver&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,r){var i=new WeakMap,s=r.getCaptureState||(()=>!0),n=Cl,o=function(e,t){var r=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||null!=r&&r.length&&!r.includes("id")?Tl:r=>{var i=e.getElementById(r);return!!i&&"SCRIPT"!==i.nodeName&&(!t.isRecordedElement||t.isRecordedElement(i))&&!Vl(i,t.blockClass,t.blockSelector)}}(e,r),a=t=>{try{var a=s();if(!n||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return Vl(e,t.blockClass,t.blockSelector)||Vl(e,t.maskTextClass,t.maskTextSelector)}(t,r))return;var l=function(e,t){if(void 0===t&&(t=Tl),!e||e.length>Cl)return null;try{var r=JSON.parse(e),i={remainingNodes:2048,exceeded:!1},s=Et(r)?r.map(e=>Ul(e,t,i)):Ul(r,t,i);if(i.exceeded||Ft(s)||Et(s)&&(!s.length||s.some(Ft)))return null;var n=JSON.stringify(s);return n.length>2e4?null:[s,n]}catch(e){return null}}(t.text,o);if(!l)return void i.delete(t);var u=l[0],d=l[1];if(Ft(a))return void i.set(t,d);if(i.get(t)!==d){if(d.length>n)return void(n=0);r.emit(u)&&(i.set(t,d),n-=d.length)}}catch(e){return}};try{var l=new t(e=>{try{if(!n||!1===s())return;var t=e=>{for(var t of jl(e))a(t)};for(var r of e)if("childList"===r.type)Wl(r.target)&&a(r.target),r.addedNodes.forEach(t);else if("characterData"===r.type){var i=r.target.parentNode;i&&Wl(i)&&a(i)}else"attributes"===r.type&&Wl(r.target)&&a(r.target)}catch(e){return}});return l.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t){void 0===t&&(t=!1),n&&!1!==s()&&jl(e.documentElement).forEach(e=>{t&&i.delete(e),a(e)})},stop(){return l.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(c,l.MutationObserver,{attributeFilter:o.attributeFilter,blockClass:o.blockClass,blockSelector:o.blockSelector,isRecordedElement:e=>g.mirror.getId(e)>0,maskAllElementAttributes:o.maskAllElementAttributes,maskAttributeFn:o.maskAttributeFn,maskTextClass:o.maskTextClass,maskTextSelector:o.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=Dt(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:o,activePlugins:v.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else Yl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}},wu=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}({}),ku=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}({}),Cu=function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e}({}),Eu=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),xu=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),Tu=function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e}({}),Iu=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}({});function Ru(e,t){return-1!==e.indexOf(t)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Pu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Mu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Fu={};function Lu(e){if(Fu[e])return Fu[e];var t=function(e){var t,r,i=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(r=t.__symbol__)||void 0===r?void 0:r.call(t,e);return i&&globalThis[i]?globalThis[i]:void 0}(e)||globalThis[e],r=t.prototype,i=e in Pu?Pu[e]:void 0,s=Boolean(i&&i.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(r,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),n=e in Mu?Mu[e]:void 0,o=Boolean(n&&n.every(e=>{var t;return"function"==typeof r[e]&&(null===(t=r[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(s&&o)return Fu[e]=t.prototype,t.prototype;var a=document.createElement("iframe");a.style.display="none";var l=!1;try{document.body.appendChild(a);var u=a.contentWindow;if(!u)return t.prototype;var d=u[e].prototype;return d?(function(e){return Ru(e,"AppleWebKit")&&!Ru(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Fu[e]=d):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Au=Object.create(null);function Ou(e,t,r){var i,s=Au[e],n=s[r];if(n)return n.call(t);var o=Lu(e),a=null===(i=Object.getOwnPropertyDescriptor(o,r))||void 0===i?void 0:i.get;return a?(s[r]=a,a.call(t)):t[r]}Au.Node=Object.create(null),Au.ShadowRoot=Object.create(null),Au.MutationObserver=Object.create(null),Au.Element=Object.create(null);var Du,Nu={};function Bu(e,t,r){var i=e+"."+String(r);if(Nu[i])return Nu[i].bind(t);var s=Lu(e)[r];return"function"!=typeof s?t[r]:(Nu[i]=s,s.bind(t))}function $u(){return Lu("MutationObserver").constructor}function qu(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],s={next:i},n=r(function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return s.next.apply(this,t)});return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]!==n)for(var r=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0},i=e[t],o=r(i);o;){if(o.next===n)return void(o.next=s.next);o=r(i=o.next)}else e[t]=s.next}}catch(e){return()=>{}}}var Hu={childNodes:e=>Ou("Node",e,"childNodes"),parentNode:e=>Ou("Node",e,"parentNode"),parentElement:e=>Ou("Node",e,"parentElement"),textContent:e=>Ou("Node",e,"textContent"),isConnected(e){if(void 0===Du){var t,r=null===(t=Object.getOwnPropertyDescriptor(Lu("Node"),"isConnected"))||void 0===t?void 0:t.get;Du=(null==r?void 0:r.toString().includes("[native code]"))?r:null}return null==Du?void 0:Du.call(e)},contains:(e,t)=>Bu("Node",e,"contains")(t),getRootNode:e=>Bu("Node",e,"getRootNode")(),host:e=>e&&"host"in e?Ou("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?Ou("Element",e,"shadowRoot"):null,querySelector:(e,t)=>Bu("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>Bu("Element",e,"querySelectorAll")(t),mutationObserver:$u,patch:qu};function Uu(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var Wu=0;function zu(){Wu+=1}function Vu(){return Wu}function ju(e,t){return(t!==Wu||e>6e4)&&!0}var Gu=0,Qu=0,Ku=0,Zu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Yu=null,Ju=null,Xu=[],ed=0,td=0,rd={slowestBatchMs:0},id={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function sd(e){(Gu+=1)>1||(Zu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Xu=[],ed=0,Ju=(e=>e&&e>0?e:null)(e),Qu=Uu(),Ku=Wu)}function nd(){return 0===Gu?Yu||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Gu-=1)>0?Zu:(Zu.durationMs=Uu()-Qu,Zu.deferredStylesheetCount=ed,id.deferredCount+=ed,Ju=null,ju(Zu.durationMs,Ku)?Zu:Yu=Zu)}function od(e,t,r){var i=e.length;if(r>=32)return i;for(var s=0;e.length>s;s++){var n=e[s];try{var o=n.cssRules;if(o&&o.length)i+=od(o,t,r+1);else if(t&&n.styleSheet){var a=n.styleSheet;if(!t.has(a)){t.add(a);var l=a.rules||a.cssRules;l&&(i+=od(l,t,r+1))}}}catch(e){}}return i}function ad(e){if(0!==Gu){var t=od(e,null,0);Zu.cssRuleCount+=t,td>0&&(Zu.nonDeferrableCssRuleCount+=t)}}function ld(e){td+=1;try{return e()}finally{td-=1}}function ud(e){Gu>0&&(Zu.stylesheetMs+=e)}function dd(e){if(0===Gu||null===Ju)return!1;var t=Zu.cssRuleCount-Zu.nonDeferrableCssRuleCount;return t>=Ju||t+function(e){try{var t=e&&(e.rules||e.cssRules);if(!t)return 0;var r=new WeakSet;return r.add(e),od(t,r,0)}catch(e){return 0}}(e)>Ju}function cd(){id.failedCount+=1}function hd(e){e>0&&(id.abandonedCount+=e)}function pd(e){return pd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pd(e)}function _d(e,t,r){return(t=function(e){var t=function(e){if("object"!=pd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=pd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gd(e){return e.nodeType===e.ELEMENT_NODE}function vd(e){var t=e&&"host"in e&&"mode"in e&&Hu.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Hu.shadowRoot(t)===e)}function fd(e){return"[object ShadowRoot]"==={}.toString.call(e)}function md(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function yd(e){var t=e.cssText;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}var bd=0;function Sd(e){var t=0===bd,r=t?Uu():0;bd+=1;try{var i=e.rules||e.cssRules;if(!i)return null;ad(i);var s=e.href;return!s&&e.ownerNode&&(s=e.ownerNode.baseURI),md(Array.from(i,e=>wd(e,s)).join(""))}catch(e){return null}finally{bd-=1,t&&ud(Uu()-r)}}function wd(e,t){if(Cd(e)){var r;try{r=Sd(e.styleSheet)||yd(e)}catch(t){r=e.cssText}try{var i;if(r&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return qd(r,e.styleSheet.href)}catch(e){}return r}var s=e.cssText;return Ed(e)&&e.selectorText.includes(":")&&(s=kd(s)),t?qd(s,t):s}function kd(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Cd(e){return"styleSheet"in e}function Ed(e){return"selectorText"in e}var xd=/^-?[A-Za-z_][\w-]*$/,Td=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Id(e){var t=[],r=!1,i=null,s=new Map;function n(e){var s=t.pop();if("group"===s.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void n(null)}var a=t[t.length-1];return a.parts.push(e),void(a.index+=1)}if(!s.importRule)return r=!0,void(i=e);o(t[t.length-1],s.importRule,e)}function o(e,t,r){try{var i;try{i=r||yd(t)}catch(e){i=t.cssText}try{var s;i&&(null===(s=t.styleSheet)||void 0===s?void 0:s.href)&&(i=qd(i,t.styleSheet.href))}catch(e){}i&&e.parts.push(i),e.index+=1}catch(e){n(null)}}function a(e){var r=e.rules[e.index];if("sheet"===e.kind&&Cd(r)){var i=s.get(r);return null===i?(e.parts.push(r.cssText),void(e.index+=1)):i?void t.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:r}):void o(e,r,null)}if(!function(e,r){try{var i=function(e){var t=e;if(!t.cssRules||0===t.cssRules.length)return null;if(t.media&&"string"==typeof t.media.mediaText)return"@media "+t.media.mediaText+" {";if(Ed(e)){if("number"==typeof t.type&&1!==t.type)return null;var r=t.style?t.style.cssText:"";return e.selectorText+" {"+(r?" "+r:"")}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!xd.test(t.containerName)?null:"@container "+(t.containerName?t.containerName+" ":"")+t.containerQuery+" {";if("string"==typeof t.conditionText){var i="";try{var s;i=(null===(s=e.constructor)||void 0===s?void 0:s.name)||""}catch(e){return null}return""===i||"Object"===i||"CSSSupportsRule"===i?"@supports "+t.conditionText+" {":null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?xd.test(t.name)?"@keyframes "+t.name+" {":null:""===t.name?"@layer {":Td.test(t.name)?"@layer "+t.name+" {":null:null}(e);if(null===i)return!1;var s=r.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:s,index:0,parts:[],prelude:s?qd(i,s):i,fixColons:"sheet"===r.kind&&Ed(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(r,e)){var n=r.cssText;"sheet"===e.kind&&Ed(r)&&r.selectorText.includes(":")&&(n=kd(n)),e.parts.push(e.sheetHref?qd(n,e.sheetHref):n),e.index+=1}}return function(e){try{var r=e.rules||e.cssRules;if(!r)return!1;ad(r);var i=e.href;!i&&e.ownerNode&&(i=e.ownerNode.baseURI);var n=Array.from(r);return t.push({kind:"sheet",sheet:e,rules:n,sheetHref:i,index:0,parts:[],importRule:null}),function(e,t){for(var r=[{sheet:t,rules:e,index:0}],i=function(){var e=r[r.length-1];if(e.index>=e.rules.length)return r.pop(),0;var t=e.rules[e.index];if(e.index+=1,!Cd(t)||s.has(t))return 0;var i=null;try{i=t.styleSheet}catch(e){return s.set(t,null),0}if(!i||r.some(e=>e.sheet===i))return 0;try{var n=i.rules||i.cssRules;if(!n)return 0;ad(n);var o=i.href;!o&&i.ownerNode&&(o=i.ownerNode.baseURI);var a=Array.from(n);s.set(t,{sheet:i,rules:a,sheetHref:o}),r.push({sheet:i,rules:a,index:0})}catch(e){}};r.length>0;)i()}(n,e),!0}catch(e){return!1}}(e)||(r=!0),{advance(e){if(r)return!0;var s=Uu(),o=e>0?e:1;try{for(;!r&&o>0;){var l=t[t.length-1];if(l.rules.length>l.index){o-=1;try{a(l)}catch(e){n(null)}}else{var u=null;try{if("group"===l.kind){var d=l.prelude+l.parts.join("")+"}";u=l.fixColons?kd(d):d}else u=md(l.parts.join(""))}catch(e){}n(u)}}}catch(e){r=!0,i=null}finally{ud(Uu()-s)}return r},text:()=>r?i:null,remainingRules(){if(r)return 0;var e=0;for(var i of t)e+=i.rules.length-i.index;return e}}}var Rd=class{constructor(){_d(this,"idNodeMap",new Map),_d(this,"nodeMetaMap",new WeakMap)}getId(e){var t,r;return e&&null!==(t=null===(r=this.getMeta(e))||void 0===r?void 0:r.id)&&void 0!==t?t:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),gd(e)){var r=Hu.shadowRoot(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Pd(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,s=e.type,n=e.maskInputFn,o=e.value||"",a=s&&Md(s);return(r[i.toLowerCase()]||a&&r[a])&&(o=n?n(o,t):"*".repeat(o.length)),o}function Md(e){return e.toLowerCase()}var Fd=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 Ld(e){var t=e.element,r=e.name,i=e.value,s=e.maskAttributeFn,n=e.isGenerated;return i?e.maskAllElementAttributes?void 0!==n&&n&&Fd.has(Md(r))?i:"*".repeat(i.length):s?s(r,i,t):i:i}var Ad="__rrweb_original__";function Od(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Md(t):null}catch(e){return null}}var Dd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Nd=/^(?:[a-z+]+:)?\/\//i,Bd=/^www\..*/i,$d=/^(data:)([^,]*),(.*)/i;function qd(e,t){return(e||"").replace(Dd,(e,r,i,s,n,o)=>{var a,l=i||n||o,u=r||s||"";if(!l)return e;if(Nd.test(l)||Bd.test(l))return"url("+u+l+u+")";if($d.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)+u+")";var d=t.split("/"),c=l.split("/");for(var h of(d.pop(),c))"."!==h&&(".."===h?d.pop():d.push(h));return"url("+u+d.join("/")+u+")"})}var Hd,Ud,Wd=new Map,zd=1,Vd=new RegExp("[^a-z0-9-_:]");function jd(){return zd++}var Gd=/^[^ \t\n\r\u000c]+/,Qd=/^[, \t\n\r\u000c]+/,Kd=new WeakMap;function Zd(e,t){return t&&""!==t.trim()?Yd(e,t):t}function Yd(e,t){var r=Kd.get(e);if(r||(r=e.createElement("a"),Kd.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Jd(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":e}(e,t.maxBase64ImageLength):e}function Xd(e,t,r,i,s,n){if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&s){var o,a=null===(o=s.sheet)||void 0===o?void 0:o.href;if(a)return a}var l=Zd(e,i);if(l.startsWith("data:")){if("img"===t&&s){var u=l;return((null==n?void 0:n.type)||void 0!==(null==n?void 0:n.quality))&&(u=function(e,t,r,i){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;var s=Wd.get(t);if(s&&s.type===r&&s.quality===i)return s.result;try{var n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;var o=n.getContext("2d");if(!o)return t;o.drawImage(e,0,0);var a=n.toDataURL(r||"image/webp",null!=i?i:.4),l=t.length>a.length?a:t;if(Wd.size>=10){var u=Wd.keys().next().value;void 0!==u&&Wd.delete(u)}return Wd.set(t,{type:r,quality:i,result:l}),l}catch(e){return t}}(s,l,n.type,n.quality)),Jd(u,n)}if("image"===t)return Jd(l,n)}return l}if("xlink:href"===r&&"#"!==i[0]){var d=Zd(e,i);return"image"===t&&d.startsWith("data:")?Jd(d,n):d}return"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function i(e){var i,s=e.exec(t.substring(r));return s?(r+=(i=s[0]).length,i):""}for(var s=[];i(Qd),t.length>r;){var n=i(Gd);if(","===n.slice(-1))n=Zd(e,n.substring(0,n.length-1)),s.push(n);else{var o="";n=Zd(e,n);for(var a=!1;;){var l=t.charAt(r);if(""===l){s.push((n+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,s.push((n+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return s.join(", ")}(e,i):"style"===r?qd(i,Yd(e)):"object"===t&&"data"===r?Zd(e,i):i:Zd(e,i)}function ec(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function tc(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&tc(Hu.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&tc(Hu.parentNode(e),t,r)}function rc(e,t,r,i){var s;if(gd(e)){if(!Hu.childNodes(s=e).length)return!1}else{if(null===Hu.parentElement(e))return!1;s=Hu.parentElement(e)}try{if("string"==typeof t){if(i){if(s.closest("."+t))return!0}else if(s.classList.contains(t))return!0}else if(tc(s,t,i))return!0;if(r)if(i){if(s.closest(r))return!0}else if(s.matches(r))return!0}catch(e){}return!1}function ic(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var sc=new Map;function nc(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function oc(e){return null==e?"":e.toLowerCase()}var ac=!1,lc=!1;function uc(e,t){var r=t.doc,i=t.mirror,s=t.blockClass,n=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,c=void 0===d||d,h=t.maskInputOptions,p=void 0===h?{}:h,_=t.maskTextFn,g=t.maskInputFn,v=t.maskAllElementAttributes,f=void 0!==v&&v,m=t.maskAttributeFn,y=t.slimDOMOptions,b=t.dataURLOptions,S=void 0===b?{}:b,w=t.inlineImages,k=void 0!==w&&w,C=t.recordCanvas,E=void 0!==C&&C,x=t.canvasMaskingConfigured,T=t.onSerialize,I=t.onIframeLoad,R=t.iframeLoadTimeout,P=void 0===R?5e3:R,M=t.onIframeListenerRegistered,F=t.onStylesheetLoad,L=t.stylesheetLoadTimeout,A=void 0===L?5e3:L,O=t.keepIframeSrcFn,D=void 0===O?()=>!1:O,N=t.newlyAddedElement,B=void 0!==N&&N,q=t.depth,H=void 0===q?0:q,U=t.maxDepth,W=void 0===U?50:U,z=t.needsMask,V=t.preserveWhiteSpace,j=void 0===V||V;if(H>=W)return lc=!0,ac||(ac=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=rc(e,o,a,void 0===z)),Gu>0&&(Zu.nodeCount+=1);var G,Q=function(e,t){var r=t.doc,i=t.blockClass,s=t.blockSelector,n=t.needsMask,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskTextFn,d=t.maskInputFn,c=t.maskAllElementAttributes,h=void 0!==c&&c,p=t.maskAttributeFn,_=t.dataURLOptions,g=void 0===_?{}:_,v=t.inlineImages,f=t.recordCanvas,m=t.canvasMaskingConfigured,y=t.keepIframeSrcFn,b=t.newlyAddedElement,S=void 0!==b&&b,w=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,t.mirror);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Iu.Document,childNodes:[],compatMode:e.compatMode}:{type:Iu.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Iu.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return function(e,t){for(var r=t.doc,i=t.inlineStylesheet,s=t.maskInputOptions,n=void 0===s?{}:s,o=t.maskInputFn,a=t.maskAllElementAttributes,l=void 0!==a&&a,u=t.maskAttributeFn,d=t.dataURLOptions,c=void 0===d?{}:d,h=t.inlineImages,p=t.recordCanvas,_=t.canvasMaskingConfigured,g=t.keepIframeSrcFn,v=t.newlyAddedElement,f=void 0!==v&&v,m=t.rootId,y=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(r)return e.matches(r)}catch(e){}return!1}(e,t.blockClass,t.blockSelector),b=function(e){if(e instanceof HTMLFormElement)return"form";var t=Md(e.tagName);return Vd.test(t)?"div":t}(e),S=new Set,w={},k=e.attributes.length,C=0;k>C;C++){var E=e.attributes[C];ec(b,E.name)||(w[E.name]=Xd(r,b,Md(E.name),E.value,e,c))}if("link"===b&&i&&!y){var x=e.sheet;if(!x){var T=function(e){return e.href}(e);T&&!(x=nc(r,T))&&T.includes(".css")&&(x=nc(r,window.location.origin+"/"+T.replace(window.location.href,"")))}var I=null;x&&(dd(x)?Gu>0&&(Xu.push(e),ed+=1):I=Sd(x)),I&&(delete w.rel,delete w.href,w._cssText=I)}if("style"===b&&e.sheet&&!(e.innerText||Hu.textContent(e)||"").trim().length){var R=ld(()=>Sd(e.sheet));R&&(w._cssText=R)}if("input"===b||"textarea"===b||"select"===b){var P=e.value,M=e.checked;"radio"!==w.type&&"checkbox"!==w.type&&"submit"!==w.type&&"button"!==w.type&&P?w.value=Pd({element:e,type:Od(e),tagName:b,value:P,maskInputOptions:n,maskInputFn:o}):M&&(w.checked=M)}if("option"===b&&(e.selected&&!n.select?w.selected=!0:delete w.selected),"dialog"===b&&e.open){try{w.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){w.rr_open_mode="modal",w.ph_rr_could_not_detect_modal=!0}S.add("rr_open_mode")}if("canvas"===b&&p&&!(null==_?void 0:_()))if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var i=0;e.height>i;i+=50){var s=t.getImageData;if(new Uint32Array((Ad in s?s[Ad]:s).call(t,r,i,Math.min(50,e.width-r),Math.min(50,e.height-i)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(w.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var F=e.toDataURL(c.type,c.quality),L=r.createElement("canvas");L.width=e.width,L.height=e.height,F!==L.toDataURL(c.type,c.quality)&&(w.rr_dataURL=F)}var A,O,D=!1;if("img"===b&&h){Hd||(Hd=r.createElement("canvas"),Ud=Hd.getContext("2d"));var N=e,B=N.currentSrc||N.getAttribute("src")||"<unknown-src>",q=N.crossOrigin,H=(t,r)=>D?Ld({element:e,name:t,value:r,maskAllElementAttributes:l,maskAttributeFn:u}):r,U=()=>{ic(N,"load",U);try{Hd.width=N.naturalWidth,Hd.height=N.naturalHeight,Ud.drawImage(N,0,0);var e=Hd.toDataURL(c.type,c.quality);w.rr_dataURL=H("rr_dataURL",e)}catch(e){if("anonymous"!==N.crossOrigin)return N.crossOrigin="anonymous",void(N.complete&&0!==N.naturalWidth?U():N.addEventListener("load",U));console.warn("Cannot inline img src="+B+"! Error: "+e)}"anonymous"===N.crossOrigin&&(q?w.crossOrigin=H("crossOrigin",q):N.removeAttribute("crossorigin"))};N.complete&&0!==N.naturalWidth?U():N.addEventListener("load",U)}if("audio"===b||"video"===b){var W=w;W.rr_mediaState=e.paused?"paused":"played",S.add("rr_mediaState"),W.rr_mediaCurrentTime=e.currentTime,W.rr_mediaPlaybackRate=e.playbackRate,W.rr_mediaMuted=e.muted,W.rr_mediaLoop=e.loop,W.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(w.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(w.rr_scrollTop=e.scrollTop)),y){var z,V,j,G=e.getBoundingClientRect(),Q=G.width,K=G.height,Z=G.left,Y=G.top,J=null===(z=r.defaultView)||void 0===z?void 0:z.getComputedStyle(e);w={class:w.class,rr_width:Q+"px",rr_height:K+"px",rr_left:Math.floor(Z+((null===(V=r.defaultView)||void 0===V?void 0:V.scrollX)||0))+"px",rr_top:Math.floor(Y+((null===(j=r.defaultView)||void 0===j?void 0:j.scrollY)||0))+"px"},S.add("rr_width"),S.add("rr_height"),S.add("rr_left"),S.add("rr_top"),J&&(w.rr_position=J.position||"static",S.add("rr_position"),J.transform&&"none"!==J.transform&&(w.rr_transform=J.transform,S.add("rr_transform")),J.display&&J.display.startsWith("inline")&&(w.rr_display=J.display,S.add("rr_display")))}if("iframe"!==b||g(w.src)||(e.contentDocument||(w.rr_src=w.src),delete w.src),l||u)for(var X of Object.entries(w)){var ee=X[0],te=X[1];"string"!=typeof te&&null!==te||(w[ee]=Ld({element:e,name:ee,value:te,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:S.has(ee)}))}D=!0;try{customElements.get(b)&&(A=!0)}catch(e){}return{type:Iu.Element,tagName:b,attributes:w,childNodes:[],isSVG:(O=e,Boolean("svg"===O.tagName||O.ownerSVGElement)||void 0),needBlock:y,rootId:m,isCustom:A}}(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:l,maskInputFn:d,maskAllElementAttributes:h,maskAttributeFn:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,canvasMaskingConfigured:m,keepIframeSrcFn:y,newlyAddedElement:S,rootId:w});case e.TEXT_NODE:return function(e,t){var r=t.needsMask,i=t.maskTextFn,s=t.rootId,n=Hu.parentNode(e),o=n&&n.tagName,a=Hu.textContent(e),l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var d;if(e.nextSibling||e.previousSibling);else if(dd(n.sheet));else if(null===(d=n.sheet)||void 0===d?void 0:d.cssRules){var c=Sd(n.sheet);c&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(c)&&(a=c)}}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: "+t,e)}a=qd(a,Yd(t.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&r&&(a=i?i(a,Hu.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Iu.Text,textContent:a||"",isStyle:l,rootId:s}}(e,{doc:r,needsMask:n,maskTextFn:u,rootId:w});case e.CDATA_SECTION_NODE:return{type:Iu.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:Iu.Comment,textContent:Hu.textContent(e)||"",rootId:w};default:return!1}}(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,keepIframeSrcFn:D,newlyAddedElement:B});if(!Q)return console.warn(e,"not serialized"),null;G=i.hasNode(e)?i.getId(e):function(e,t){if(t.comment&&e.type===Iu.Comment)return!0;if(e.type===Iu.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e){var t,r;try{r=new URL(e,window.location.href)}catch(e){return null}var i=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==i?void 0:i[1])&&void 0!==t?t:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(oc(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===oc(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(oc(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&oc(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(oc(e.attributes.property).match(/^(og|twitter|fb):/)||oc(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===oc(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(oc(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(oc(e.attributes.name))||oc(e.attributes.property).match(/^article:/)||oc(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(oc(e.attributes.name)))return!0}}return!1}(Q,y)||!j&&Q.type===Iu.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?-2:jd();var K=Object.assign(Q,{id:G});if(i.add(e,K),-2===G)return null;T&&T(e);var Z=!u;if(K.type===Iu.Element){Z=Z&&!K.needBlock,delete K.needBlock;var Y=Hu.shadowRoot(e);Y&&fd(Y)&&(K.isShadowHost=!0)}if((K.type===Iu.Document||K.type===Iu.Element)&&Z){y.headWhitespace&&K.type===Iu.Element&&"head"===K.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,preserveWhiteSpace:j,onSerialize:T,onIframeLoad:I,iframeLoadTimeout:P,onIframeListenerRegistered:M,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W};if(K.type===Iu.Element&&"textarea"===K.tagName&&void 0!==K.attributes.value);else for(var X of Array.from(Hu.childNodes(e))){var ee=uc(X,J);ee&&K.childNodes.push(ee)}var te=null;if(gd(e)&&(te=Hu.shadowRoot(e)))for(var re of Array.from(Hu.childNodes(te))){var ie=uc(re,J);ie&&(fd(te)&&(ie.isShadow=!0),K.childNodes.push(ie))}}var se=Hu.parentNode(e);if(se&&vd(se)&&fd(se)&&(K.isShadow=!0),K.type===Iu.Element&&"iframe"===K.tagName){var ne=function(e,t,r){var i,s=()=>{},n=e.contentWindow;if(!n)return s;try{i=n.document.readyState}catch(e){return s}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),ic(e,"load",d),e.addEventListener("load",o),t())},d=()=>u();return l=setTimeout(u,r),e.addEventListener("load",d),()=>{null!==l&&(clearTimeout(l),l=null),a?ic(e,"load",o):(a=!0,ic(e,"load",d))}}var c,h="about:blank";try{c=n.location.href}catch(e){return s}if(c!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),ic(e,"load",o)}}return e.addEventListener("load",o),()=>{ic(e,"load",o)}}(e,()=>{var t=e.contentDocument;if(t&&I){var r=uc(t,{doc:t,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,preserveWhiteSpace:j,onSerialize:T,onIframeLoad:I,iframeLoadTimeout:P,onIframeListenerRegistered:M,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W});r&&I(e,r)}},P);null==M||M(e,ne)}return K.type===Iu.Element&&"link"===K.tagName&&"stylesheet"===K.attributes.rel&&function(t,l,u){if(!sc.has(t)){var d;try{d=t.sheet}catch(e){return}if(!d){var h=new AbortController,v=!1,b=()=>{if(!v){v=!0;try{(()=>{if(F){var t=uc(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,preserveWhiteSpace:j,onSerialize:T,onIframeLoad:I,iframeLoadTimeout:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H,maxDepth:W});t&&F(e,t)}})()}finally{sc.delete(t),h.abort()}}},w=setTimeout(b,u);h.signal.addEventListener("abort",()=>clearTimeout(w),{once:!0}),t.addEventListener("load",b,{signal:h.signal,once:!0}),sc.set(t,h)}}}(e,0,A),K}function dc(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}var cc=class e{constructor(){_d(this,"parentElement",null),_d(this,"parentNode",null),_d(this,"ownerDocument",void 0),_d(this,"firstChild",null),_d(this,"lastChild",null),_d(this,"previousSibling",null),_d(this,"nextSibling",null),_d(this,"ELEMENT_NODE",1),_d(this,"TEXT_NODE",3),_d(this,"nodeType",void 0),_d(this,"nodeName",void 0),_d(this,"RRNodeType",void 0)}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function hc(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>pc(r,e,t,i)}function pc(e,t,r,i){_c(()=>{var s=e.removeEventListener;"function"==typeof s&&(void 0!==i?s.call(e,t,r,i):s.call(e,t,r))})}function _c(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function gc(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var vc="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.",fc={map:{},getId(){return console.error(vc),-1},getNode(){return console.error(vc),null},removeNodeFromMap(){console.error(vc)},has(){return console.error(vc),!1},reset(){console.error(vc)}};function mc(e,t,r){void 0===r&&(r={});var i=null,s=0;return function(){for(var n=arguments.length,o=new Array(n),a=0;n>a;a++)o[a]=arguments[a];var l=Date.now();s||!1!==r.leading||(s=l);var u=t-(l-s),d=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),s=l,e.apply(d,o)):i||!1===r.trailing||(i=setTimeout(()=>{s=!1===r.leading?0:Date.now(),i=null,e.apply(d,o)},u))}}function yc(e,t,r,i,s){void 0===s&&(s=window);var n=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout(()=>{try{r.set.call(this,e)}catch(e){}},0),n&&n.set){if(n.get)try{n.get.call(this)}catch(e){return}n.set.call(this,e)}}}),()=>yc(e,t,n||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(fc=new Proxy(fc,{get(e,t,r){return"map"===t&&console.error(vc),Reflect.get(e,t,r)}}));var bc=Date.now;function Sc(e){var t,r,i,s,n=e.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:n.documentElement.scrollLeft||(null==n?void 0:n.body)&&(null===(t=Hu.parentElement(n.body))||void 0===t?void 0:t.scrollLeft)||(null==n||null===(r=n.body)||void 0===r?void 0:r.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==n?void 0:n.documentElement.scrollTop)||(null==n?void 0:n.body)&&(null===(i=Hu.parentElement(n.body))||void 0===i?void 0:i.scrollTop)||(null==n||null===(s=n.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 kc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Cc(e){return e?e.nodeType===e.ELEMENT_NODE?e:Hu.parentElement(e):null}function Ec(e,t,r,i){if(!e)return!1;var s=Cc(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(tc(s,t,i))return!0}catch(e){}if(r){if(s.matches(r))return!0;if(i&&null!==s.closest(r))return!0}return!1}function xc(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function Tc(e,t){if(vd(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=Hu.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||Tc(i,t))}function Ic(e){return Boolean(e.changedTouches)}function Rc(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Pc(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Mc(e){return!!e&&(e instanceof cc&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Hu.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(bc=()=>(new Date).getTime());var Fc=class{constructor(){_d(this,"id",1),_d(this,"styleIDMap",new WeakMap),_d(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Lc(e){var t,r=null;return"getRootNode"in e&&(null===(t=Hu.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Hu.host(Hu.getRootNode(e))&&(r=Hu.host(Hu.getRootNode(e))),r}function Ac(e){var t=e.ownerDocument;if(!t)return!1;if(Hu.contains(t,e))return!0;var r=Hu.isConnected(e);return"boolean"==typeof r?r:function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Lc(r);)r=t;return r}(e);return Hu.contains(t,r)}(e)}function Oc(e){return"__ln"in e}var Dc,Nc=class{constructor(){_d(this,"length",0),_d(this,"head",null),_d(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Oc(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Oc(e.nextSibling)&&e.nextSibling.__ln.previous){var i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Bc=(e,t)=>e+"@"+t,$c=class{constructor(){_d(this,"frozen",!1),_d(this,"locked",!1),_d(this,"texts",[]),_d(this,"attributes",[]),_d(this,"attributeMap",new WeakMap),_d(this,"generatedAttributes",new WeakMap),_d(this,"removes",[]),_d(this,"mapRemoves",new Set),_d(this,"movedMap",{}),_d(this,"addedSet",new Set),_d(this,"movedSet",new Set),_d(this,"droppedSet",new Set),_d(this,"removesSubTreeCache",new Set),_d(this,"mutationCb",void 0),_d(this,"blockClass",void 0),_d(this,"blockSelector",void 0),_d(this,"maskTextClass",void 0),_d(this,"maskTextSelector",void 0),_d(this,"inlineStylesheet",void 0),_d(this,"maskInputOptions",void 0),_d(this,"maskTextFn",void 0),_d(this,"maskInputFn",void 0),_d(this,"maskAllElementAttributes",void 0),_d(this,"maskAttributeFn",void 0),_d(this,"keepIframeSrcFn",void 0),_d(this,"recordCanvas",void 0),_d(this,"canvasMaskingConfigured",void 0),_d(this,"inlineImages",void 0),_d(this,"slimDOMOptions",void 0),_d(this,"dataURLOptions",void 0),_d(this,"doc",void 0),_d(this,"mirror",void 0),_d(this,"iframeManager",void 0),_d(this,"stylesheetManager",void 0),_d(this,"shadowDomManager",void 0),_d(this,"canvasManager",void 0),_d(this,"processedNodeManager",void 0),_d(this,"unattachedDoc",void 0),_d(this,"canvasManagerReleased",!1),_d(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),_d(this,"emit",()=>{if(!this.frozen&&!this.locked){var e,t,r=Uu(),i=Vu();try{this.processBufferedMutations()}finally{e=Uu()-r,t=i,Gu>0||ju(e,null!=t?t:Wu)||e>rd.slowestBatchMs&&(rd.slowestBatchMs=e)}}}),_d(this,"processBufferedMutations",()=>{var e,t=[],r=new Set,i=new Nc,s=e=>{for(var t=e,r=-2;-2===r;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var o=Hu.parentNode(n);if(o&&Ac(n)&&"TEXTAREA"!==o.tagName&&!this.isBlockedAtEmission(o)){var a=vd(o)?this.mirror.getId(Lc(n)):this.mirror.getId(o),l=s(n);if(-1===a||-1===l)return i.addNode(n);null!=e||(e={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:e=>{Rc(e,this.mirror)&&this.iframeManager.addIframe(e),Pc(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Mc(e)&&!Ec(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Hu.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});var u=uc(n,e);u&&(t.push({parentId:a,nextId:l,node:u}),r.add(u.id))}};for(var o of this.mapRemoves)this.mapRemoves.delete(o),this.mirror.removeNodeFromMap(o);for(var a of this.movedSet)Hc(this.removesSubTreeCache,a)&&!this.movedSet.has(Hu.parentNode(a))||n(a);for(var l of this.addedSet)Uc(this.droppedSet,l)||Hc(this.removesSubTreeCache,l)?Uc(this.movedSet,l)?n(l):this.droppedSet.add(l):n(l);for(var u=null;i.length;){var d=null;if(u){var c=this.mirror.getId(Hu.parentNode(u.value)),h=s(u.value);-1!==c&&-1!==h&&(d=u)}if(!d)for(var p=i.tail;p;){var _=p;if(p=p.previous,_){var g=this.mirror.getId(Hu.parentNode(_.value));if(-1===s(_.value))continue;if(-1!==g){d=_;break}var v=Hu.parentNode(_.value);if(v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var f=Hu.host(v);if(-1!==this.mirror.getId(f)){d=_;break}}}}if(!d){for(;i.head;)i.removeNode(i.head.value);break}u=d.previous,i.removeNode(d.value),n(d.value)}var m={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{var t=e.node,r=Hu.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!r.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{var t=e.attributes;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){var r=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);t.style.length>r.length&&(r+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(var s of Object.entries(t)){var n,o=s[0],a=s[1];"string"!=typeof a&&null!==a||(t[o]=Ld({element:e.node,name:o,value:a,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(n=this.generatedAttributes.get(e.node))||void 0===n?void 0:n.has(o)}))}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!r.has(e.id)).filter(e=>this.mirror.has(e.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={},(m.texts.length||m.attributes.length||m.removes.length||m.adds.length)&&this.mutationCb(m)}),_d(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),_d(this,"genTextAreaValueMutation",e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(Hu.childNodes(e),e=>Hu.textContent(e)||"").join("");t.attributes.value=Pd({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Od(e),value:r,maskInputFn:this.maskInputFn})}),_d(this,"processMutation",e=>{if(!xc(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=Hu.textContent(e.target);Ec(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:rc(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Cc(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break;case"attributes":var r,i=e.target,s=e.attributeName,n=null!==(r=e.attributeNamespace)&&void 0!==r?r:null,o=function(e,t,r){if(!r)return t;var i=e.getAttributeNodeNS(r,t);if(i)return i.name;if("http://www.w3.org/1999/xlink"===r)return"xlink:"+t;if("http://www.w3.org/XML/1998/namespace"===r)return"xml:"+t;if("http://www.w3.org/2000/xmlns/"===r)return"xmlns"===t?t:"xmlns:"+t;var s=e.lookupPrefix(r);return s?s+":"+t:t}(i,s,n),a=n?i.getAttributeNS(n,s):e.target.getAttribute(s);if("value"===o){var l=i,u=Od(l);a=Pd({element:l,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:u,value:a,maskInputFn:this.maskInputFn})}if(Ec(e.target,this.blockClass,this.blockSelector,!1)||a===e.oldValue)return;var d=this.attributeMap.get(e.target),c="IFRAME"===i.tagName&&"src"===o;if(c&&!this.keepIframeSrcFn(a)&&i.contentDocument)return;if(d||(this.attributes.push(d={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,d)),"type"===o&&"INPUT"===i.tagName&&"password"===(e.oldValue||"").toLowerCase()&&i.setAttribute("data-rr-is-password","true"),!ec(i.tagName,o)){var h,p=Xd(this.doc,Md(i.tagName),Md(o),a,i,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(a)&&(o="rr_src"),d.attributes[o]=p,null===(h=this.generatedAttributes.get(e.target))||void 0===h||h.delete(o),"style"===o){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}var _=this.unattachedDoc.createElement("span"),g=i.style;for(var v of(e.oldValue&&(_.style.cssText=e.oldValue),Array.from(g))){var f=g.getPropertyValue(v),m=g.getPropertyPriority(v);f!==_.style.getPropertyValue(v)||m!==_.style.getPropertyPriority(v)?d.styleDiff[v]=""===m?f:[f,m]:d._unchangedStyles[v]=[f,m]}for(var y of Array.from(_.style))""===g.getPropertyValue(y)&&(d.styleDiff[y]=!1)}else if("open"===o&&"DIALOG"===i.tagName){d.attributes.rr_open_mode=i.matches("dialog:modal")?"modal":"non-modal";var b=this.generatedAttributes.get(e.target);b||this.generatedAttributes.set(e.target,b=new Set),b.add("rr_open_mode")}}break;case"childList":if(Ec(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{var r=this.mirror.getId(t),i=vd(e.target)?this.mirror.getId(Hu.host(e.target)):this.mirror.getId(e.target);Ec(e.target,this.blockClass,this.blockSelector,!1)||xc(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(qc(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Tc(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Bc(r,i)]?qc(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!vd(e.target)||!fd(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),Hu.childNodes(i).forEach(e=>r.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),_d(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(xc(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[Bc(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!Ec(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;for(var i=Hu.childNodes(e),s=0,n=i.length;n>s;s++){var o=i[s];o&&this.genAdds(o)}if(Mc(e))for(var a=Hu.childNodes(Hu.shadowRoot(e)),l=0,u=a.length;u>l;l++){var d=a[l];d&&(this.processedNodeManager.add(d,this),this.genAdds(d,e))}}}}})}init(e){["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(t=>{this[t]=e[t]}),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(var e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){for(var t=this.blockClass,r=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;e;){if(r&&(r.lastIndex=0),Ec(e,r||t,this.blockSelector,!0))return!0;var i="getRootNode"in e?Hu.getRootNode(e):null;e=(null==i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Hu.host(i):null}return!1}};function qc(e,t){for(var r=[t];r.length;){var i=r.pop();if(e.delete(i),i.nodeType!==i.TEXT_NODE)for(var s=Hu.childNodes(i),n=0,o=s.length;o>n;n++){var a=s[n];a&&r.push(a)}}}function Hc(e,t,r){return 0!==e.size&&function(e,t){var r=Hu.parentNode(t);return!!r&&e.has(r)}(e,t)}function Uc(e,t){if(0===e.size)return!1;for(var r=Hu.parentNode(t);r;){if(e.has(r))return!0;r=Hu.parentNode(r)}return!1}var Wc=function(e,t){return void 0===t&&(t="rrweb"),Dc?function(){try{return e(...arguments)}catch(e){if(Dc&&!0===Dc(e,t))return;throw e}}:e},zc=[];function Vc(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function jc(e,t){var r,i=new $c;i.init(e);try{r=new($u())(Wc(i.processMutations.bind(i)));var s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(s.attributeFilter=e.attributeFilter),r.observe(t,s),zc.push(i),{observer:r,buffer:i}}catch(e){try{null==r||r.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function Gc(e){var t=e.scrollCb,r=e.doc,i=e.mirror,s=e.blockClass,n=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=Vc(e);if(o&&!Ec(o,s,n,!0)){var l,u,d=i.getId(o);if(o===r&&r.defaultView){var c=Sc(r.defaultView);l=c.left,u=c.top}else l=o.scrollLeft,u=o.scrollTop;var h=l+","+u;a.get(d)!==h&&(a.set(d,h),t({id:d,x:l,y:u}))}},u=[hc("scroll",Wc(mc(Wc(e=>l(e)),o.scroll||100)),r)];return"onscrollend"in r&&u.push(hc("scrollend",Wc(l),r)),()=>u.forEach(e=>e())}function Qc(e,t){for(var r=zc.length-1;r>=0;r--){var i=zc[r];if(i){var s=i.bufferBelongsToIframe(e);!s&&t&&t.has(i.bufferDoc())&&(s=!0),s&&(i.reset(),zc.splice(r,1))}}}var Kc=["INPUT","TEXTAREA","SELECT"],Zc=new WeakMap;function Yc(e){return function e(t,r){if(th("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||th("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||th("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||th("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var i=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(i),e(t.parentRule,r)}if(t.parentStyleSheet){var s=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(s)}return r}(e,[])}function Jc(e,t,r){var i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:i}):{}}function Xc(e,t){var r,i,s,n=e.stylesheetManager;s=e.mirror.getId("#document"===t.nodeName?t:Hu.host(t));var o="#document"===t.nodeName?null===(r=t.defaultView)||void 0===r?void 0:r.Document:null===(i=t.ownerDocument)||void 0===i||null===(i=i.defaultView)||void 0===i?void 0:i.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&a?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){var t;try{var r;t=null===(r=a.set)||void 0===r?void 0:r.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==s&&-1!==s)try{n.adoptStyleSheets(e,s)}catch(e){}return t}}),Wc(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}function eh(e,t){void 0===t&&(t={});var r,i,s=e.doc.defaultView;if(!s)return()=>{};!function(e,t){var r=e.mutationCb,i=e.mousemoveCb,s=e.mouseInteractionCb,n=e.scrollCb,o=e.viewportResizeCb,a=e.inputCb,l=e.mediaInteractionCb,u=e.styleSheetRuleCb,d=e.styleDeclarationCb,c=e.canvasMutationCb,h=e.fontCb,p=e.selectionCb,_=e.customElementCb;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),i(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),s(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),n(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),o(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),a(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),d(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),c(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),_(...arguments)}}(e,t);var o=[],a=Wc(()=>{try{if(i)try{i.destroy(),i.reset()}finally{var t=zc.indexOf(i);-1!==t&&zc.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==r||r.disconnect()}finally{gc(o)}});try{if(e.recordDOM){var l=jc(e,e.doc);r=l.observer,i=l.buffer}if(o.push(function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,s=e.mirror;if(!1===r.mousemove)return()=>{};var n,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],u=mc(Wc(e=>{var r=Date.now()-n;t(l.map(e=>(e.timeOffset-=r,e)),e),l=[],n=null}),a),d=Wc(mc(Wc(e=>{var t=Vc(e),r=Ic(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;n||(n=bc()),l.push({x:i,y:o,id:s.getId(t),timeOffset:bc()-n}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?ku.Drag:e instanceof MouseEvent?ku.MouseMove:ku.TouchMove)}),o,{trailing:!1})),c=[hc("mousemove",d,i),hc("touchmove",d,i),hc("drag",d,i)];return Wc(()=>{c.forEach(e=>e())})}(e)),o.push(function(e){var t=e.mouseInteractionCb,r=e.doc,i=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.sampling;if(!1===a.mouseInteraction)return()=>{};var l=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,u=[],d=null;return Object.keys(Cu).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e]).forEach(e=>{var a=Md(e),l=(e=>r=>{var a=Vc(r);if(!Ec(a,s,o,!0)){var l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=Eu.Mouse;break;case"touch":l=Eu.Touch;break;case"pen":l=Eu.Pen}l===Eu.Touch&&(Cu[e]===Cu.MouseDown?u="TouchStart":Cu[e]===Cu.MouseUp&&(u="TouchEnd"))}else Ic(r)&&(l=Eu.Touch);null!==l?(d=l,(u.startsWith("Touch")&&l===Eu.Touch||u.startsWith("Mouse")&&l===Eu.Mouse)&&(l=null)):Cu[e]===Cu.Click&&(l=d,d=null);var c=Ic(r)?r.changedTouches[0]:r;if(c){var h=i.getId(a),p=c.clientX,_=c.clientY;Wc(t)(n({type:Cu[u],id:h,x:p,y:_},null!==l&&{pointerType:l}))}}})(e);if(window.PointerEvent)switch(Cu[e]){case Cu.MouseDown:case Cu.MouseUp:a=a.replace("mouse","pointer");break;case Cu.TouchStart:case Cu.TouchEnd:return}u.push(hc(a,l,r))}),Wc(()=>{u.forEach(e=>e())})}(e)),o.push(Gc(e)),o.push(function(e,t){var r=e.viewportResizeCb,i=t.win,s=-1,n=-1;return hc("resize",Wc(mc(Wc(()=>{var e=wc(),t=kc();s===e&&n===t||(r({width:Number(t),height:Number(e)}),s=e,n=t)}),200)),i)}(e,{win:s})),o.push(function(e){var t=e.inputCb,r=e.doc,i=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.ignoreClass,l=e.ignoreSelector,u=e.maskInputOptions,d=e.maskInputFn,c=e.userTriggeredOnInput;function h(e){var t=Vc(e),i=e.isTrusted,n=r.defaultView;if(!t||!n||t instanceof n.HTMLElement){var h=t&&t.tagName;if(t&&"OPTION"===h&&(t=Hu.parentElement(t)),t&&h&&Kc.indexOf(h)>=0&&!Ec(t,s,o,!0)&&!(t.classList.contains(a)||l&&t.matches(l))){var _=t.value,g=!1,v=Od(t)||"";"radio"===v||"checkbox"===v?g=t.checked:(u[h.toLowerCase()]||u[v])&&(_=Pd({element:t,maskInputOptions:u,tagName:h,type:v,value:_,maskInputFn:d})),p(t,c?{text:_,isChecked:g,userTriggered:i}:{text:_,isChecked:g});var f=t.name;"radio"===v&&f&&g&&r.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach(e=>{if(e!==t){var r=e.value;p(e,c?{text:r,isChecked:!g,userTriggered:!1}:{text:r,isChecked:!g})}})}}}function p(e,r){var s=Zc.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Zc.set(e,r);var o=i.getId(e);Wc(t)(n({},r,{id:o}))}}var _=("last"===e.sampling.input?["change"]:["input","change"]).map(e=>hc(e,Wc(h),r)),g=r.defaultView;if(!g)return()=>{_.forEach(e=>e())};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&_.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map(e=>yc(e[0],e[1],{set(){Wc(h)({target:this,isTrusted:!1})}},!1,g))),Wc(()=>{gc(_)})}(e)),o.push(function(e){var t=e.mediaInteractionCb,r=e.blockClass,i=e.blockSelector,s=e.mirror,n=e.sampling,o=e.doc,a=Wc(e=>mc(Wc(n=>{var o=Vc(n);if(o&&!Ec(o,r,i,!0)){var a=o.currentTime,l=o.volume,u=o.muted,d=o.playbackRate,c=o.loop;t({type:e,id:s.getId(o),currentTime:a,volume:l,muted:u,playbackRate:d,loop:c})}}),n.media||500)),l=[hc("play",a(Tu.Play),o),hc("pause",a(Tu.Pause),o),hc("seeked",a(Tu.Seeked),o),hc("volumechange",a(Tu.VolumeChange),o),hc("ratechange",a(Tu.RateChange),o)];return Wc(()=>{l.forEach(e=>e())})}(e)),e.recordDOM){var u=function(e){var t=new Map,r=new Set,i=!0,s=e=>{if(i)try{e()}catch(e){}},n=e=>{var r,i=t.get(e);if(i){for(;null===(r=i[0])||void 0===r?void 0:r.ready;){var n=i.shift();(null==n?void 0:n.emit)&&s(n.emit)}0===i.length&&t.delete(e)}};return{queueMutation(e,r){if(e){var i=t.get(e);i?(i.push({emit:r,ready:!0}),n(e)):s(r)}else s(r)},queuePendingMutation(o,a,l){if(!i)return()=>{};var u=t.get(o);u||t.set(o,u=[]);var d={emit:a,ready:!1};u.push(d);var c,h=!1,p=!1,_=()=>{h||p||(h=!0,void 0!==c&&r.delete(c),d.ready=!0,d.emit=void 0,n(o))};try{c=e.setTimeout(_,5e3),h||p?e.clearTimeout(c):r.add(c)}catch(e){_()}return t=>{!p&&i&&(p=!0,void 0!==c&&(e.clearTimeout(c),r.delete(c)),h?t&&s(l):(d.ready=!0,t||(d.emit=void 0),n(o)))}},reset(){i=!1,r.forEach(t=>e.clearTimeout(t)),r.clear(),t.clear()}}}(s);o.push(u.reset),o.push(function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,s=e.stylesheetManager,n=t.win,o=t.mutationQueue;if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};var a=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Jc(t,i,s.styleMirror),d=u.id,c=u.styleId;return(d&&-1!==d||c&&-1!==c)&&o.queueMutation(t,()=>r({id:d,styleId:c,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),n.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var l,u,d=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(d,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Jc(t,i,s.styleMirror),d=u.id,c=u.styleId;return(d&&-1!==d||c&&-1!==c)&&o.queueMutation(t,()=>r({id:d,styleId:c,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);try{var u=null==l?void 0:l.then;if(t.ownerNode||!l||"function"!=typeof u)return l;s.onCssomSheetMutation(t);var d=Jc(t,i,s.styleMirror),c=d.id,h=d.styleId;if(!(c&&-1!==c||h&&-1!==h))return l;var p=o.queuePendingMutation(t,()=>r({id:c,styleId:h,replace:a}),()=>{var e=Sd(t);null!==e&&r({id:c,styleId:h,replace:e})});try{u.call(l,()=>p(!0),()=>p(!1))}catch(e){p(!1)}}catch(e){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(u=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Jc(t,i,s.styleMirror),d=u.id,c=u.styleId;return(d&&-1!==d||c&&-1!==c)&&o.queueMutation(t,()=>r({id:d,styleId:c,replaceSync:a})),l},"host")}));var c={};rh("CSSGroupingRule")?c.CSSGroupingRule=n.CSSGroupingRule:(rh("CSSMediaRule")&&(c.CSSMediaRule=n.CSSMediaRule),rh("CSSConditionRule")&&(c.CSSConditionRule=n.CSSConditionRule),rh("CSSSupportsRule")&&(c.CSSSupportsRule=n.CSSSupportsRule));var h={};return Object.entries(c).forEach(e=>{var t=e[0],n=e[1];h[t]={insertRule:n.prototype.insertRule,deleteRule:n.prototype.deleteRule},n.prototype.insertRule=new Proxy(h[t].insertRule,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Jc(t.parentStyleSheet,i,s.styleMirror),d=u.id,c=u.styleId;if(t.parentStyleSheet&&(d&&-1!==d||c&&-1!==c)){var h=[...Yc(t),l];o.queueMutation(t.parentStyleSheet,()=>r({id:d,styleId:c,adds:[{rule:a,index:h}]}))}return l},"host")}),n.prototype.deleteRule=new Proxy(h[t].deleteRule,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Jc(t.parentStyleSheet,i,s.styleMirror),d=u.id,c=u.styleId;if(t.parentStyleSheet&&(d&&-1!==d||c&&-1!==c)){var h=[...Yc(t),a];o.queueMutation(t.parentStyleSheet,()=>r({id:d,styleId:c,removes:[{index:h}]}))}return l},"host")})}),Wc(()=>{n.CSSStyleSheet.prototype.insertRule=a,n.CSSStyleSheet.prototype.deleteRule=d,l&&(n.CSSStyleSheet.prototype.replace=l),u&&(n.CSSStyleSheet.prototype.replaceSync=u),Object.entries(c).forEach(e=>{var t=e[0],r=e[1];r.prototype.insertRule=h[t].insertRule,r.prototype.deleteRule=h[t].deleteRule})})}(e,{win:s,mutationQueue:u})),o.push(Xc(e,e.doc)),o.push(function(e,t){var r=e.styleDeclarationCb,i=e.mirror,s=e.ignoreCSSAttributes,n=e.stylesheetManager,o=t.win,a=t.mutationQueue,l=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(l,{apply:Wc((e,t,o)=>{var l,u=o[0],d=o[1],c=o[2],h=e.apply(t,o);if(s.has(u))return h;var p=null===(l=t.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(p);var _=Jc(p,i,n.styleMirror),g=_.id,v=_.styleId;if(g&&-1!==g||v&&-1!==v){var f=Yc(t.parentRule);a.queueMutation(p,()=>r({id:g,styleId:v,set:{property:u,value:d,priority:c},index:f}))}return h},"host")});var u=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:Wc((e,t,o)=>{var l,u=o[0],d=e.apply(t,o);if(s.has(u))return d;var c=null===(l=t.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(c);var h=Jc(c,i,n.styleMirror),p=h.id,_=h.styleId;if(p&&-1!==p||_&&-1!==_){var g=Yc(t.parentRule);a.queueMutation(c,()=>r({id:p,styleId:_,remove:{property:u},index:g}))}return d},"host")}),Wc(()=>{o.CSSStyleDeclaration.prototype.setProperty=l,o.CSSStyleDeclaration.prototype.removeProperty=u})}(e,{win:s,mutationQueue:u})),e.collectFonts&&o.push(function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var s=[],n=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return n.set(i,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};var a=qu(r.fonts,"add",function(e){return function(r){return setTimeout(Wc(()=>{var e=n.get(r);e&&(t(e),n.delete(r))}),0),e.apply(this,[r])}});return s.push(()=>{i.FontFace=o}),s.push(a),Wc(()=>{s.forEach(e=>e())})}(e))}for(var d of(o.push(function(e){var t=e.doc,r=e.mirror,i=e.blockClass,s=e.blockSelector,n=e.selectionCb,o=!0,a=Wc(()=>{var e=t.getSelection();if(!(!e||o&&(null==e?void 0:e.isCollapsed))){o=e.isCollapsed||!1;for(var a=[],l=e.rangeCount||0,u=0;l>u;u++){var d=e.getRangeAt(u),c=d.startContainer,h=d.startOffset,p=d.endContainer,_=d.endOffset;Ec(c,i,s,!0)||Ec(p,i,s,!0)||a.push({start:r.getId(c),startOffset:h,end:r.getId(p),endOffset:_})}n({ranges:a})}});return a(),hc("selectionchange",a)}(e)),o.push(function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?qu(r.customElements,"define",function(e){return function(r,i,s){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,s])}}):()=>{}}(e)),e.plugins))o.push(d.observer(d.callback,s,d.options))}catch(e){try{a()}catch(e){}throw e}return a}function th(e){return void 0!==window[e]}function rh(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ih=class{constructor(e){_d(this,"generateIdFn",void 0),_d(this,"iframeRemoteIdToLocalIdMap",new WeakMap),_d(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){if(0>t)return t;var s=r||this.getRemoteIdToLocalIdMap(e),n=i||this.getLocalIdToRemoteIdMap(e),o=s.get(t);return void 0===o&&(o=this.generateIdFn(),s.set(t,o),n.set(o,t)),o}getIds(e,t){var r=this.getRemoteIdToLocalIdMap(e),i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,r,i))}getRemoteId(e,t,r){var i;return"number"!=typeof t||0>t?t:null!==(i=(r||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==i?i:-1}getRemoteIds(e,t){var r=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){var t=this.iframeRemoteIdToLocalIdMap.get(e);return t||this.iframeRemoteIdToLocalIdMap.set(e,t=new Map),t}getLocalIdToRemoteIdMap(e){var t=this.iframeLocalIdToRemoteIdMap.get(e);return t||this.iframeLocalIdToRemoteIdMap.set(e,t=new Map),t}},sh=class{constructor(e){_d(this,"iframes",new WeakMap),_d(this,"crossOriginIframeMap",new WeakMap),_d(this,"crossOriginIframeMirror",new ih(jd)),_d(this,"crossOriginIframeStyleMirror",void 0),_d(this,"crossOriginIframeRootIdMap",new WeakMap),_d(this,"mirror",void 0),_d(this,"mutationCb",void 0),_d(this,"wrappedEmit",void 0),_d(this,"loadListener",void 0),_d(this,"pageHideListener",void 0),_d(this,"stylesheetManager",void 0),_d(this,"recordCrossOriginIframes",void 0),_d(this,"messageHandler",void 0),_d(this,"nestedIframeListeners",new Map),_d(this,"attachedWindows",new WeakMap),_d(this,"attachedDocuments",new WeakMap),_d(this,"attachedIframes",new Map),_d(this,"loadListenerDisposers",new WeakMap),_d(this,"iframeElementsById",new Map),_d(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ih(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){var r=this.loadListenerDisposers.get(e);r||this.loadListenerDisposers.set(e,r=new Set),r.add(t);var i=this.mirror.getId(e);-1!==i&&this.iframeElementsById.set(i,e)}getIframeElementById(e){var t,r,i;return null!==(t=null!==(r=null===(i=this.attachedIframes.get(e))||void 0===i?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){var t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>_c(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach(e=>{pc(e.win,"pagehide",e.handler)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,i=this.trackIframeContent(e,t);if(e.contentDocument){var s=this.attachedDocuments.get(e);s||this.attachedDocuments.set(e,s=new Set),s.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){var o=this.handleMessage.bind(this);_c(()=>{n.addEventListener("message",o),this.nestedIframeListeners.set(n,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(n)})}_c(()=>{var t=e.contentWindow;if(t){var r=this.pageHideHandlers.get(e);if(r)for(var i of r)if(i.win===t)return;var s=()=>{var t;null===(t=this.pageHideListener)||void 0===t||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument)};t.addEventListener("pagehide",s),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:s})}}),null===(r=this.loadListener)||void 0===r||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var r=this.crossOriginIframeMap.get(e.source);if(r){var i=this.transformCrossOriginEvent(r,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){switch(t.type){case wu.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:wu.IncrementalSnapshot,data:{source:ku.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case wu.Meta:case wu.Load:case wu.DomContentLoaded:return!1;case wu.Plugin:return t;case wu.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case wu.IncrementalSnapshot:switch(t.data.source){case ku.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ku.Drag:case ku.TouchMove:case ku.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ku.ViewportResize:return!1;case ku.MediaInteraction:case ku.MouseInteraction:case ku.Scroll:case ku.CanvasMutation:case ku.Input:return this.replaceIds(t.data,e,["id"]),t;case ku.StyleSheetRule:case ku.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ku.Font:return t;case ku.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case ku.AdoptedStyleSheet:var i;return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(i=t.data.styles)||void 0===i||i.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(var s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(t[s]=Array.isArray(t[s])?e.getIds(r,t[s]):e.getId(r,t[s]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===Iu.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),r){var i=r.contentWindow,s=this.attachedWindows.get(r);s&&(s.forEach(e=>{var t=this.nestedIframeListeners.get(e);t&&(pc(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(pc(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var n=this.attachedDocuments.get(r);n&&(n.forEach(e=>{_c(()=>this.mirror.removeNodeFromMap(e))}),_c(()=>Qc(r,n)),this.attachedDocuments.delete(r))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var e=[];this.attachedIframes.forEach((t,r)=>{this.mirror.has(r)||e.push(r)}),e.forEach(e=>this.removeIframeById(e))}}reattachIframes(){this.attachedIframes.forEach((e,t)=>{var r=e.content;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&pc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{pc(t,"message",e)}),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(t=>e.add(t.element)),e.forEach(e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)}),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}},nh=class{constructor(e){_d(this,"shadowDoms",new WeakSet),_d(this,"mutationCb",void 0),_d(this,"scrollCb",void 0),_d(this,"bypassOptions",void 0),_d(this,"mirror",void 0),_d(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var r,i;if(fd(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var s=null!==(r=null===(i=Hu.host(e))||void 0===i?void 0:i.ownerDocument)&&void 0!==r?r:t,o=jc(n({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),a=o.observer,l=o.buffer;this.restoreHandlers.push({doc:s,handler(){a.disconnect(),l.destroy(),l.releaseCanvasManager();var e=zc.indexOf(l);-1!==e&&zc.splice(e,1)}}),this.restoreHandlers.push({doc:s,handler:Gc(n({},this.bypassOptions,{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(Hu.host(e))),this.restoreHandlers.push({doc:s,handler:Xc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)})},0)}}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){var r=this;this.restoreHandlers.push({doc:t,handler:qu(e.prototype,"attachShadow",function(e){return function(i){var s=e.call(this,i),n=Hu.shadowRoot(this);return n&&Ac(this)&&r.addShadowRoot(n,t),s}})})}reset(){this.restoreHandlers.forEach(e=>{var t=e.handler;try{t()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){var t=[];for(var r of this.restoreHandlers)if(r.doc===e)try{r.handler()}catch(e){}else t.push(r);this.restoreHandlers=t}},oh="skip-frame";function ah(e){if("object"!=typeof e||null===e)return!1;var t=e.y,r=e.width,i=e.height;return Number.isFinite(e.x)&&Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var lh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",uh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),dh=0;64>dh;dh++)uh[lh.charCodeAt(dh)]=dh;var ch=function(e){var t,r=new Uint8Array(e),i=r.length,s="";for(t=0;i>t;t+=3)s+=lh[r[t]>>2],s+=lh[(3&r[t])<<4|r[t+1]>>4],s+=lh[(15&r[t+1])<<2|r[t+2]>>6],s+=lh[63&r[t+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s},hh=new Map,ph=(e,t,r)=>{if(e&&(vh(e,t)||"object"==typeof e)){var i=function(e,t){var r=hh.get(e);return r||hh.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),s=i.indexOf(e);return-1===s&&(s=i.length,i.push(e)),s}};function _h(e,t,r,i){return e instanceof Array?e.map(e=>_h(e,t,r,i)):null===e?e:e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray?{rr_type:e.constructor.name,args:[Object.values(e)]}:e instanceof ArrayBuffer?{rr_type:e.constructor.name,base64:ch(e)}:e instanceof DataView?{rr_type:e.constructor.name,args:[_h(e.buffer,t,r,i),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[_h(e.data,t,r,i),e.width,e.height]}:vh(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ph(e,t,r)}:e}var gh=(e,t,r,i)=>e.map(e=>_h(e,t,r,i)),vh=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))},fh=["webgl","webgl2"];function mh(e){return"nodeType"in e}function yh(e,t,r,i){var s=[];try{if(i){var o=function(e,t,r){var i=e.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return qu(i.prototype,"configure",function(i){return function(s){var o=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!o||mh(o)&&Ec(o,t,r,!0))return i.call(this,s);mh(o)&&!("__context"in o)&&(o.__context="webgpu");var a=function(e){var t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return i.call(this,null!==a&&s?n({},s,{usage:"number"==typeof s.usage?s.usage|a:a}):s)}})}(e,t,r);o&&s.push(o)}var a=qu(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(s){for(var n=function(e){return"experimental-webgl"===e?"webgl":e}(s),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!Ec(this,t,r,!0)&&("__context"in this||(this.__context=n),i&&fh.includes(n)))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[s,...a])}});s.push(a)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(e=>e())}}function bh(e,t,r,i,s,n,o){var a=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=qu(e,l,function(e){return function(){for(var a=arguments.length,u=new Array(a),d=0;a>d;d++)u[d]=arguments[d];var c=e.apply(this,u);if(ph(c,n,this),this.canvas&&"tagName"in this.canvas&&!Ec(this.canvas,i,s,!0)){var h={type:t,property:l,args:gh(u,n,this,o)};r(this.canvas,h)}return c}});a.push(u)}catch(n){var d=yc(e,l,{set(e){this.canvas&&"tagName"in this.canvas&&!Ec(this.canvas,i,s,!0)&&r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});a.push(d)}};for(var d of l)u(d);return a}var Sh='(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',wh="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Sh],{type:"text/javascript;charset=utf-8"});function kh(e){var t;try{if(!(t=wh&&(self.URL||self.webkitURL).createObjectURL(wh)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Sh),{name:null==e?void 0:e.name})}}var Ch,Eh,xh,Th=class{onFullSnapshot(){var e;null===(e=this.resetFrameDedup)||void 0===e||e.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(e){_d(this,"pendingCanvasMutations",new Map),_d(this,"rafStamps",{latestId:0,invokeId:null}),_d(this,"mirror",void 0),_d(this,"mutationCb",void 0),_d(this,"resetObservers",void 0),_d(this,"frozen",!1),_d(this,"locked",!1),_d(this,"rafIdTimestamp",null),_d(this,"rafIdFlush",null),_d(this,"refCount",0),_d(this,"torndown",!1),_d(this,"resetFrameDedup",null),_d(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});var t=e.sampling,r=void 0===t?"all":t,i=e.win,s=e.blockClass,n=e.blockSelector,o=e.recordCanvas,a=e.dataURLOptions,l=e.resolutionScale,u=e.canvasMasking;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,s,n,a),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,s,n,{dataURLOptions:a,resolutionScale:l,canvasMasking:u})}initCanvasFPSObserver(e,t,r,i,s){var n=this;if("OffscreenCanvas"in t){var o,l="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,u=yh(t,r,i,!0),d=new Map;try{o=new kh}catch(e){return}var c=!1;o.onerror=()=>{var e;c=!0,cancelAnimationFrame(h),null===(e=o.terminate)||void 0===e||e.call(o),this.resetFrameDedup=null},this.resetFrameDedup=()=>{o.postMessage({resetFrameDedup:!0})},o.onmessage=e=>{var t=e.data.id;if(d.set(t,!1),"base64"in e.data){var r=e.data,i=r.displayWidth,s=r.displayHeight;this.mutationCb({id:t,type:xu["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,s]}],displayWidth:i,displayHeight:s})}};var h,p=1e3/e,_=0,g=e=>{var u,v;c||(_&&p>e-_||(_=e,(u=[],v=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Ec(e,r,i,!0)||u.push(e)}),e.querySelectorAll("*").forEach(e=>{e.shadowRoot&&v(e.shadowRoot)})}catch(e){}},v(t.document),u).forEach(function(){var e=a(function*(e){var t=n.mirror.getId(e);if(!d.get(t)&&0!==e.width&&0!==e.height){d.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var r,i,a=e.getContext(e.__context);if(null==a||null===(r=a.isContextLost)||void 0===r?void 0:r.call(a))return void d.set(t,!1);!1===(null==a||null===(i=a.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&a.clear(a.COLOR_BUFFER_BIT)}var u=e.clientWidth||e.width,c=e.clientHeight||e.height,h=Math.max(1,Math.round(u*l)),p=Math.max(1,Math.round(c*l)),_=function(e,t,r,i,s,n){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return oh}if(void 0!==o){if(!Array.isArray(o)||!o.every(ah))return oh;var a=r/s,l=i/n;return o.filter(e=>e.width>0&&e.height>0).map(e=>{var t=Math.floor(e.x*a),r=Math.floor(e.y*l);return{x:t,y:r,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-r}})}}}(s.canvasMasking,e,h,p,u,c);if("skip-frame"===_)return void d.set(t,!1);var g=yield createImageBitmap(e,1>l?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});o.postMessage({id:t,bitmap:g,width:h,height:p,displayWidth:u,displayHeight:c,dataURLOptions:s.dataURLOptions,maskRegions:_},[g])}catch(e){d.set(t,!1)}}});return function(t){return e.apply(this,arguments)}}())),h=requestAnimationFrame(g))};h=requestAnimationFrame(g),this.resetObservers=()=>{var e;u(),cancelAnimationFrame(h),null===(e=o.terminate)||void 0===e||e.call(o),this.resetFrameDedup=null}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var s=yh(e,t,r,!1),n=function(e,t,r,i,s){var n=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=qu(t.CanvasRenderingContext2D.prototype,o,function(n){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return Ec(this.canvas,r,i,!0)||setTimeout(()=>{var r=gh(l,t,this,s);e(this.canvas,{type:xu["2D"],property:o,args:r})},0),n.apply(this,l)}});n.push(a)}catch(s){var l=yc(t.CanvasRenderingContext2D.prototype,o,{set(t){Ec(this.canvas,r,i,!0)||e(this.canvas,{type:xu["2D"],property:o,args:[t],setter:!0})}});n.push(l)}};for(var l of o)if(a(l))continue;return()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,s){var n=[];return void 0!==t.WebGLRenderingContext&&n.push(...bh(t.WebGLRenderingContext.prototype,xu.WebGL,e,r,i,t,s)),void 0!==t.WebGL2RenderingContext&&n.push(...bh(t.WebGL2RenderingContext.prototype,xu.WebGL2,e,r,i,t,s)),()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{s(),n(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,r){if(!this.frozen&&!this.locked){var i=this.pendingCanvasMutations.get(e);if(i&&-1!==r){var n=i.map(e=>s(e,t));this.mutationCb({id:r,type:i[0].type,commands:n}),this.pendingCanvasMutations.delete(e)}}}},Ih=class{constructor(e){var t;_d(this,"trackedLinkElements",new WeakSet),_d(this,"pendingDeferredSheets",new Set),_d(this,"mutationCb",void 0),_d(this,"adoptedStyleSheetCb",void 0),_d(this,"maskAllElementAttributes",void 0),_d(this,"maskAttributeFn",void 0),_d(this,"styleMirror",new Fc),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t){if(-1===t||!e.isConnected)return null;var r=null,i=null;try{(i=e.sheet)&&(r=Id(i))}catch(e){}if(!r||!i)return cd(),null;var s=r,n=!1,o={sheet:i,invalidate(){n=!0}};this.pendingDeferredSheets.add(o);var a=!1;return{advance:r=>{if(a)return!0;var l,u,d=Uu(),c=Vu(),h=!0;try{if(n)return a=!0,cd(),!0;if(!s.advance(r))return h=!1,!1;a=!0;var p=s.text();if(!e.isConnected)return!0;var _=null;try{_=e.sheet}catch(e){}return _!==i?(cd(),!0):p?(this.emitCssTextMutation(e,t,p),!0):(cd(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),ju(l=Uu()-d,null!=(u=c)?u:Wu)||(id.totalMs+=l,l>id.slowestSliceMs&&(id.slowestSliceMs=l))}},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(var t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var r;null===(r=this.beginDeferredLinkInlining(e,t))||void 0===r||r.advance(1/0)}emitCssTextMutation(e,t,r){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:Ld({element:e,name:"_cssText",value:r,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){var r=this;if(0!==e.length){var i={id:t,styleIds:[]},s=[],n=function(e){var t;if(r.styleMirror.has(e))t=r.styleMirror.getId(e);else{var n=r.styleMirror.add(e);t=n;var o=Uu();try{ld(()=>{try{var t=e.rules||e.cssRules;t&&ad(t)}catch(e){}s.push({styleId:n,rules:Array.from(e.rules||CSSRule,(t,r)=>({rule:wd(t,e.href),index:r}))})})}finally{ud(Uu()-o)}}i.styleIds.push(t)};for(var o of e)n(o);s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),sc.forEach(e=>e.abort()),sc.clear()}trackStylesheetInLinkElement(e){}},Rh=class{constructor(){_d(this,"nodeMap",new WeakMap),_d(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},Ph=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var Mh,Fh=document.createElement("iframe");document.body.appendChild(Fh),Array.from=(null===(Mh=Fh.contentWindow)||void 0===Mh?void 0:Mh.Array.from)||Array.from,document.body.removeChild(Fh)}}catch(e){console.debug("Unable to override Array.from",e)}var Lh=new Rd,Ah=new Set([ku.Mutation,ku.MediaInteraction,ku.StyleSheetRule,ku.CanvasMutation,ku.Font,ku.Log,ku.StyleDeclaration,ku.AdoptedStyleSheet]);function Oh(e){var t=window;if("function"==typeof t.requestIdleCallback){var r=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,r)}}}var i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function Dh(e){var t;void 0===e&&(e={});var r=e,i=r.emit,s=r.checkoutEveryNms,o=r.checkoutEveryNth,a=r.blockClass,l=void 0===a?"rr-block":a,u=r.blockSelector,d=void 0===u?null:u,c=r.ignoreClass,h=void 0===c?"rr-ignore":c,p=r.ignoreSelector,_=void 0===p?null:p,g=r.maskTextClass,v=void 0===g?"rr-mask":g,f=r.maskTextSelector,m=void 0===f?null:f,y=r.inlineStylesheet,b=void 0===y||y,S=r.inlineStylesheetBudgetRules,w=r.maskAllInputs,k=r.maskInputOptions,C=r.slimDOMOptions,E=r.maskInputFn,x=r.maskTextFn,T=r.maskAllElementAttributes,I=void 0!==T&&T,R=r.maskAttributeFn,P=r.hooks,M=r.packFn,F=r.sampling,L=void 0===F?{}:F,A=r.dataURLOptions,O=void 0===A?{}:A,D=r.canvasResolutionScale,N=r.canvasMasking,B=r.mousemoveWait,q=r.recordDOM,H=void 0===q||q,U=r.recordCanvas,W=void 0!==U&&U,z=r.recordCrossOriginIframes,V=void 0!==z&&z,j=r.recordAfter,G=void 0===j?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":j,Q=r.userTriggeredOnInput,K=void 0!==Q&&Q,Z=r.collectFonts,Y=void 0!==Z&&Z,J=r.inlineImages,X=void 0!==J&&J,ee=r.plugins,te=r.keepIframeSrcFn,re=void 0===te?()=>!1:te,ie=r.ignoreCSSAttributes,se=void 0===ie?new Set([]):ie,ne=r.attributeFilter;Dc=r.errorHandler;var oe=n({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},O),ae=!V||window.parent===window,le=!1;if(!ae)try{window.parent.document&&(le=!1)}catch(e){le=!0}if(ae&&!i)throw new Error("emit function is required");if(!ae&&!le)return()=>{};void 0!==B&&void 0===L.mousemove&&(L.mousemove=B),Lh.reset();var ue,de=!0===w?{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!==k?k:{password:!0},ce=dc(void 0!==C&&C);!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();var he,pe,_e=0,ge=new Map,ve=e=>{for(var t of ee||[])t.eventProcessor&&(e=t.eventProcessor(e));return M&&!le&&(e=M(e)),e};Ch=(e,t)=>{var r,n=e;if(n.timestamp=bc(),!(null===(r=zc[0])||void 0===r?void 0:r.isFrozen())||n.type===wu.FullSnapshot||n.type===wu.IncrementalSnapshot&&Ah.has(n.data.source)||zc.forEach(e=>e.unfreeze()),ae)null==i||i(ve(n),t);else if(le){var a={type:"rrweb",event:ve(n),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(n.type===wu.FullSnapshot)ue=n,_e=0;else if(n.type===wu.IncrementalSnapshot){if(n.data.source===ku.Mutation&&n.data.isAttachIframe)return;_e++,(o&&_e>=o||s&&n.timestamp-ue.timestamp>s)&&Eh(!0)}};var fe=e=>{if(e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,r=new Set;if(e.adds.length>0)for(var i of e.adds){var s=Lh.getNode(i.node.id);s&&"IFRAME"===s.nodeName&&r.add(s)}e.removes.forEach(e=>{var i=e.id;if(!t||!t.has(i)){var s=Se.getIframeElementById(i);s&&r.has(s)?Se.forgetIframeId(i):(null==he||he(i),Se.removeIframeById(i))}}),null==pe||pe(),Se.cleanupDetachedIframes()}Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Mutation},e)})},me=e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Scroll},e)}),ye=e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.CanvasMutation},e)}),be=new Ih({mutationCb:fe,adoptedStyleSheetCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.AdoptedStyleSheet},e)}),maskAllElementAttributes:I,maskAttributeFn:R}),Se=new sh({mirror:Lh,mutationCb:fe,stylesheetManager:be,recordCrossOriginIframes:V,wrappedEmit:Ch});for(var we of ee||[])we.getMirror&&we.getMirror({nodeMirror:Lh,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});var ke=new Rh,Ce=null==N?void 0:N.configured;xh=new Th({recordCanvas:W,mutationCb:ye,win:window,blockClass:l,blockSelector:d,mirror:Lh,sampling:L.canvas,dataURLOptions:oe,resolutionScale:D,canvasMasking:N});var Ee=new nh({mutationCb:fe,scrollCb:me,bypassOptions:{blockClass:l,blockSelector:d,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskInputOptions:de,dataURLOptions:oe,maskTextFn:x,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:R,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,sampling:L,slimDOMOptions:ce,iframeManager:Se,stylesheetManager:be,canvasManager:xh,keepIframeSrcFn:re,processedNodeManager:ke,attributeFilter:ne},mirror:Lh});Eh=function(e){if(void 0===e&&(e=!1),H){sd(S);try{Ch({type:wu.Meta,data:{href:window.location.href,width:kc(),height:wc()}},e),null==t||t.cancel(),t=void 0,be.reset(),Ee.init(),zc.forEach(e=>e.lock());var r,i=null;try{i=function(e,t){var r=t||{},i=r.mirror,s=void 0===i?new Rd:i,n=r.blockClass,o=void 0===n?"rr-block":n,a=r.blockSelector,l=void 0===a?null:a,u=r.maskTextClass,d=void 0===u?"rr-mask":u,c=r.maskTextSelector,h=void 0===c?null:c,p=r.inlineStylesheet,_=void 0===p||p,g=r.inlineImages,v=void 0!==g&&g,f=r.recordCanvas,m=void 0!==f&&f,y=r.canvasMaskingConfigured,b=r.maskAllInputs,S=void 0!==b&&b,w=r.maskTextFn,k=r.maskInputFn,C=r.maskAllElementAttributes,E=void 0!==C&&C,x=r.maskAttributeFn,T=r.slimDOM,I=r.dataURLOptions,R=r.preserveWhiteSpace,P=r.onSerialize,M=r.onIframeLoad,F=r.iframeLoadTimeout,L=r.onIframeListenerRegistered,A=r.onStylesheetLoad,O=r.stylesheetLoadTimeout,D=r.keepIframeSrcFn,N=void 0===D?()=>!1:D,B=r.maxDepth,q=r.inlineStylesheetBudgetRules,H=!0===S?{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===S?{password:!0}:S,U=dc(void 0!==T&&T);sd(q);try{return uc(e,{doc:e,mirror:s,blockClass:o,blockSelector:l,maskTextClass:d,maskTextSelector:h,skipChild:!1,inlineStylesheet:_,maskInputOptions:H,maskTextFn:w,maskInputFn:k,maskAllElementAttributes:E,maskAttributeFn:x,slimDOMOptions:U,dataURLOptions:I,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:P,onIframeLoad:M,iframeLoadTimeout:F,onIframeListenerRegistered:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:N,newlyAddedElement:!1,maxDepth:B})}finally{nd()}}(document,{mirror:Lh,blockClass:l,blockSelector:d,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskAllInputs:de,inlineStylesheetBudgetRules:S,maskTextFn:x,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:R,slimDOM:ce,dataURLOptions:oe,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,onSerialize(e){Rc(e,Lh)&&Se.addIframe(e),Pc(e,Lh)&&be.trackLinkElement(e),Mc(e)&&Ee.addShadowRoot(Hu.shadowRoot(e),document)},onIframeLoad(e,t){Se.attachIframe(e,t),Ee.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Se.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){be.attachLinkElement(e,t)},keepIframeSrcFn:re})}finally{n=Xu,Xu=[],r=n}if(!i)return console.warn("Failed to snapshot the document");if(Ch({type:wu.FullSnapshot,data:{node:i,initialOffset:Sc(window)}},e),zc.forEach(e=>e.unlock()),xh.onFullSnapshot(),r.length){var s=function(e,t,r){var i=!1,s=null,n=0,o=null,a=()=>null!==o||e.length>n,l=()=>{var r=e[n];e[n]=null,n+=1,r&&_c(()=>{o=t.beginDeferredLinkInlining(r,Lh.getId(r))})},u=()=>{if(o){var e=o,t=!0;_c(()=>{t=e.advance(200)}),t&&(o=null)}},d=()=>{o||l(),u()},c=e=>{if(s=null,!i){var t=0;do{try{d()}catch(e){null==o||o.discard(),o=null,hd(1)}t+=1}while(!i&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));i||(a()?s=Oh(c):r())}};return s=Oh(c),{cancel(){i=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(!i){i=!0,null==s||s.cancel(),s=null;for(var t=0,d=0;a()&&50>t;){o||l();var c=o;if(c)if(Math.floor(c.remainingRules()/200)+1>50-t)c.discard(),o=null,d+=1;else{try{u()}catch(e){null==o||o.discard(),o=null,d+=1}t+=1}}if(a()||d>0){for(var h=d+(null!==o?1:0),p=n;e.length>p;p++)null!==e[p]&&(h+=1);hd(h),null==o||o.discard(),o=null}r()}}}}(r,be,()=>{t===s&&(t=void 0)});t=s}V&&Se.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,Lh.getId(document))}finally{nd()}var n}};try{var xe=[];for(var Te of(xe.push(hc("pagehide",()=>{try{null==t||t.flush()}catch(e){}t=void 0},window)),["visibilitychange","freeze","resume"]))xe.push(hc(Te,zu,document));he=e=>{var t=ge.get(e);t&&(t.forEach(e=>{_c(e);var t=xe.indexOf(e);-1!==t&&xe.splice(t,1)}),ge.delete(e))},pe=()=>{for(var e of ge){var t=e[0],r=Lh.getNode(t);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==he||he(t)}catch(e){null==he||he(t)}else null==he||he(t)}};var Ie=e=>{var t;return Wc(eh)({mutationCb:fe,mousemoveCb:(e,t)=>Ch({type:wu.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.MouseInteraction},e)}),scrollCb:me,viewportResizeCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.ViewportResize},e)}),inputCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Input},e)}),mediaInteractionCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.MediaInteraction},e)}),styleSheetRuleCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.StyleSheetRule},e)}),styleDeclarationCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.StyleDeclaration},e)}),canvasMutationCb:ye,fontCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Font},e)}),selectionCb(e){Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Selection},e)})},customElementCb(e){Ch({type:wu.IncrementalSnapshot,data:n({source:ku.CustomElement},e)})},blockClass:l,ignoreClass:h,ignoreSelector:_,maskTextClass:v,maskTextSelector:m,maskInputOptions:de,inlineStylesheet:b,sampling:L,recordDOM:H,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,userTriggeredOnInput:K,collectFonts:Y,doc:e,maskInputFn:E,maskTextFn:x,maskAllElementAttributes:I,maskAttributeFn:R,keepIframeSrcFn:re,blockSelector:d,slimDOMOptions:ce,dataURLOptions:oe,mirror:Lh,iframeManager:Se,stylesheetManager:be,shadowDomManager:Ee,processedNodeManager:ke,canvasManager:xh,ignoreCSSAttributes:se,attributeFilter:ne,plugins:(null==ee||null===(t=ee.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Ch({type:wu.Plugin,data:{plugin:e.name,payload:t}})})))||[]},P)};Se.addLoadListener(e=>{try{var t=Lh.getId(e),r=Ie(e.contentDocument);if("function"==typeof r&&(xe.push(r),-1!==t)){var i=ge.get(t);i||ge.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}}),Se.addPageHideListener(e=>{var t=Lh.getId(e);null==he||he(t),Qc(e)});var Re=-1,Pe=e=>Ch({type:wu.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),Me=()=>{var e,t,r,i,s=document,n=null!==(e=null!==(t=null!==(r=null!==(i=s.fullscreenElement)&&void 0!==i?i:s.webkitFullscreenElement)&&void 0!==r?r:s.mozFullScreenElement)&&void 0!==t?t:s.msFullscreenElement)&&void 0!==e?e:null,o=n?Lh.getId(n):-1;o!==Re&&(-1!==Re&&Pe({id:Re,enter:!1}),Re=o,-1!==o&&Pe({id:o,enter:!0}))},Fe=()=>{Eh();var e=Ie(document);"function"==typeof e&&xe.push(e),xe.push(hc("fullscreenchange",Me)),xe.push(hc("webkitfullscreenchange",Me)),xe.push(hc("mozfullscreenchange",Me)),xe.push(hc("MSFullscreenChange",Me)),Ph=!0};return["interactive","complete"].includes(document.readyState)?Fe():(xe.push(hc("DOMContentLoaded",()=>{Ch({type:wu.DomContentLoaded,data:{}}),"DOMContentLoaded"===G&&Fe()})),xe.push(hc("load",()=>{Ch({type:wu.Load,data:{}}),"load"===G&&Fe()},window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,gc(xe),ke.destroy(),Se.removeLoadListener(),Se.destroy(),ge.clear(),Ee.reset(),Lh.reset(),Ph=!1,Dc=void 0}}catch(e){console.warn(e)}}Dh.addCustomEvent=(e,t)=>{if(!Ph)throw new Error("please add custom event after start recording");Ch({type:wu.Custom,data:{tag:e,payload:t}})},Dh.freezePage=()=>{zc.forEach(e=>e.freeze())},Dh.takeFullSnapshot=e=>{if(!Ph)throw new Error("please take full snapshot after start recording");Eh(e)},Dh.mirror=Lh,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Nh=Object.create(null);function Bh(e){return Bh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bh(e)}function $h(e,t,r){return(t=function(e){var t=function(e){if("object"!=Bh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Bh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Bh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Nh.Node=Object.create(null),Nh.ShadowRoot=Object.create(null),Nh.MutationObserver=Object.create(null),Nh.Element=Object.create(null);var qh=class{constructor(e){$h(this,"fileName",void 0),$h(this,"functionName",void 0),$h(this,"lineNumber",void 0),$h(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}},Hh=/(^|@)\S+:\d+/,Uh=/^\s*at .*(\S+:\d+|\(native\))/m,Wh=/^(eval@)?(\[native code])?$/,zh={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Uh)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: "+e);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(Uh)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),s=this.extractLocation(r?r[1]:i.pop());return new qh({functionName:i.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(Wh)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new qh({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,s=this.extractLocation(e.replace(t,""));return new qh({functionName:i,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],s=2,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new qh({fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],s=0,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new qh({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(Hh)&&!e.match(/^Error created at/)},this).map(function(e){var t=e.split("@"),r=this.extractLocation(t.pop());return new qh({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function Vh(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var i=e.parentElement,s=[];if(i.children&&i.children.length>0)for(var n=0;i.children.length>n;n++){var o=i.children[n];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&s.push(o)}s.length>1&&(r+=":eq("+s.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function jh(e){return Array.isArray(e)}function Gh(e){return"object"==typeof e&&null!==e&&!jh(e)}function Qh(e,t){if(0===t)return!0;for(var r of Object.keys(e))if(Gh(e[r])&&Qh(e[r],t-1))return!0;return!1}function Kh(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],s=[];return JSON.stringify(e,function(e,t){if(i.length>0){var n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?s.splice(n,1/0,e):s.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+s.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Gh(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Gh(o)&&Qh(o,r.depthOfLimit))return function(e){var t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=t.slice(0,r.stringLengthLimit)+"..."),t}(t);var o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var a={};for(var l in t){var u=t[l];a[l]=jh(u)?Vh(u.length?u[0]:null):u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var Zh={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 Yh(e,t,r){var i,s=r?Object.assign({},Zh,r):Zh,n=s.logger;if(!n)return()=>{};i="string"==typeof n?t[n]:n;var o=0,a=!1,l=[];if(s.level.includes("error")){var u=t=>{var r=t.message;e({level:"error",trace:zh.parse(t.error).map(e=>e.toString()),payload:[Kh(r,s.stringifyOptions)]})};t.addEventListener("error",u),l.push(()=>{t.removeEventListener("error",u)});var d=t=>{var r,i;t.reason instanceof Error?i=[Kh("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,s.stringifyOptions)]:(r=new Error,i=[Kh("Uncaught (in promise)",s.stringifyOptions),Kh(t.reason,s.stringifyOptions)]),e({level:"error",trace:zh.parse(r).map(e=>e.toString()),payload:i})};t.addEventListener("unhandledrejection",d),l.push(()=>{t.removeEventListener("unhandledrejection",d)})}for(var c of s.level)l.push(h(i,c));return()=>{l.forEach(e=>e())};function h(t,r){var i=this;return t[r]?function(t,n){try{if(!(n in t))return()=>{};var l=t[n],u={next:l},d=(t=>function(){for(var n=arguments.length,l=new Array(n),u=0;n>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var d=zh.parse(new Error).map(e=>e.toString()).splice(1),c=("assert"===r?l.slice(1):l).map(e=>Kh(e,s.stringifyOptions));o++,s.lengthThreshold>o?e({level:r,trace:d,payload:c}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[Kh("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})(function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return u.next.apply(this,t)});return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:u}})),t[n]=d,()=>{if(t[n]!==d)for(var e=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0},r=t[n],i=e(r);i;){if(i.next===d)return void(i.next=u.next);i=e(r=i.next)}else t[n]=u.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Jh=e=>({name:"rrweb/console@1",observer:Yh,options:e}),Xh=()=>{},ep=e=>{var t;if(xt(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function tp(e,t,r){try{if(!(t in e))return Xh;var i={next:e[t]},s=r(function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.next.apply(this,t)});return xt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e[t],n=ep(r);n;){if(n.next===s)return void(n.next=i.next);n=ep(r=n.next)}else e[t]=i.next}}catch(e){return Xh}}function rp(e,t){var r,i=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),s={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return s;for(var n of t.payloadHostDenyList)if(i.endsWith(n))return{hostname:i,isHostDenied:!0};return s}var ip=Fs("[Recorder]"),sp=e=>"navigation"===e.entryType,np=e=>"resource"===e.entryType;function op(e,t){return!!t&&(Dt(t)||t[e])}function ap(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}var lp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function up(e){var t=e.type,r=e.recordBody,i=e.headers;function s(e){var t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),r=t&&i[t];return e.some(e=>null==r?void 0:r.toLowerCase().includes(e))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!ap(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(s(lp))return!1;if(Dt(r))return!0;if(Et(r))return s(r);var n=r[t];return Dt(n)?n:s(n)}function dp(e,t,r,i,s,n){return cp.apply(this,arguments)}function cp(){return cp=a(function*(e,t,r,i,s,n){return void 0===n&&(n=0),n>10?(ip.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null):function(e,t){for(var r=e.length-1;r>=0;r-=1)if(t(e[r]))return e[r]}(e.performance.getEntriesByName(r),e=>np(e)&&e.initiatorType===t&&(Rt(i)||e.startTime>=i)&&(Rt(s)||s>=e.startTime))||(yield new Promise(e=>setTimeout(e,50*n)),dp(e,t,r,i,s,n+1))}),cp.apply(this,arguments)}function hp(e){var t=e.body,r=e.options,i=e.url;if(Lt(t))return null;var s=rp(i,r);if(s.isHostDenied)return s.hostname+" is in deny list";if(Pt(t))return t;if((e=>"u">typeof Document&&e instanceof Document)(t))return t.textContent;if(Nt(t))return Qs(t);if(Tt(t))try{return JSON.stringify(t)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}var pp=e=>!Ft(e)&&("navigation"===e.entryType||"resource"===e.entryType);function _p(e){var t=e.entry,r=e.method,i=e.status,s=e.networkRequest,o=e.isInitial,a=e.start,l=e.end,u=e.url,d=e.initiatorType;a=t?t.startTime:a,l=t?t.responseEnd:l;var c=Math.floor(Date.now()-performance.now()),h=Math.floor(c+(a||0)),p=[n({},t?t.toJSON():{name:u},{startTime:Rt(a)?void 0:Math.round(a),endTime:Rt(l)?void 0:Math.round(l),timeOrigin:c,timestamp:h,method:r,initiatorType:d||(t?t.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:o})];if(pp(t))for(var _ of t.serverTiming||[])p.push({timeOrigin:c,timestamp:h,startTime:Math.round(t.startTime),name:_.name,duration:_.duration,entryType:"serverTiming"});return p}var gp=["video/","audio/"];function vp(e){return Tt(e)&&xt(e.getReader)&&xt(e.tee)}var fp="[SessionReplay] Timeout while trying to read body",mp="[SessionReplay] Failed to read body";function yp(e){return mp+": "+e}function bp(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function Sp(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{var r=setTimeout(()=>t(fp),500);try{e.clone().text().then(e=>t(e),e=>t(yp(e))).finally(()=>clearTimeout(r))}catch(e){clearTimeout(r),t(mp)}})}(e);var r=Wn(t);return function(e,t){try{var r,i=null==(r=e.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var s=parseInt(i,10);return Number.isFinite(s)&&s>t}catch(e){return!1}}(e,r)?Promise.resolve(bp(r)):function(e,t){return new Promise(r=>{var i,s=!1;function n(){try{var e;null==(e=i)||e.cancel().catch(()=>{})}catch(e){}}function o(e){s||(s=!0,clearTimeout(l),n(),r(e))}var a,l=setTimeout(()=>o(fp),500);try{a=e.clone()}catch(e){return void o(mp)}var u=a.body;if(vp(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(mp)}var d=[],c=0;!function e(){i.read().then(r=>{var i=r.done,a=r.value;if(s)n();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var s of e)r.set(s,i),i+=s.byteLength;return r}(d,c)));else{if(a){if(c+a.byteLength>t)return void o(bp(t));c+=a.byteLength,d.push(a)}e()}},e=>o(yp(e)))}()}else try{a.text().then(e=>o(e),e=>o(yp(e)))}catch(e){o(mp)}})}(e,r)}function wp(){return wp=a(function*(e){var t=e.r,r=e.options,i=rp(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):Sp(t,r)}),wp.apply(this,arguments)}function kp(){return kp=a(function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,s=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var n=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=gp.some(e=>null==n?void 0:n.startsWith(e));if(n&&o)return"Content-Type "+n+" is not supported";var a=rp(s,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return Ft(i)?Sp(t,r):Promise.resolve(i)}),kp.apply(this,arguments)}var Cp=null;function Ep(e,t,r){if(!("performance"in t))return()=>{};if(Cp)return ip.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},zn,r):zn,s=t=>{var r=[],s=!1;t.requests.forEach(e=>{var t="serverTiming"===e.entryType;if(!t||!s){var n=i.maskRequestFn(e);t||(s=!n||(e=>!!e&&Jn.has(e))(n)),n&&r.push(n)}}),r.length>0&&e(n({},t,{requests:r}))},o=function(e,t,r){r.recordInitialRequests&&e({requests:t.performance.getEntries().filter(e=>sp(e)||np(e)&&r.initiatorTypes.includes(e.initiatorType)).flatMap(e=>_p({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});var i=new t.PerformanceObserver(t=>{e({requests:t.getEntries().filter(e=>sp(e)||np(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>_p({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(e=>r.performanceEntryTypeToObserve.includes(e));return i.observe({entryTypes:s}),()=>{i.disconnect()}}(s,t,i),l=()=>{},u=()=>{};return(i.recordHeaders||i.recordBody)&&(l=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=op("request",r.recordHeaders),s=op("response",r.recordHeaders),n=tp(t.XMLHttpRequest.prototype,"open",n=>function(o,a,l,u,d){void 0===l&&(l=!0);var c=this;try{var h,p,_=new Request(a),g={},v={},f=c.setRequestHeader.bind(c);c.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(g.requestHeaders=v);var m=c.send.bind(c);c.send=e=>(up({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(g.requestBody=hp({body:e,options:r,url:a})),h=t.performance.now(),m(e));var y=()=>{c.removeEventListener("readystatechange",b),c.removeEventListener("error",y),c.removeEventListener("abort",y),c.removeEventListener("timeout",y)},b=()=>{if(c.readyState===c.DONE){y(),p=t.performance.now();var i={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{var t=e.split(": "),r=t.shift(),s=t.join(": ");r&&(i[r]=s)}),s&&(g.responseHeaders=i),up({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(g.responseBody=hp({body:c.response,options:r,url:a})),dp(t,"xmlhttprequest",_.url,h,p).then(t=>{e({requests:_p({entry:t,method:o,status:null==c?void 0:c.status,networkRequest:g,start:h,end:p,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})}};c.addEventListener("readystatechange",b),c.addEventListener("error",y),c.addEventListener("abort",y),c.addEventListener("timeout",y)}catch(e){ip.error("Failed to instrument XHR for network capture",e)}n.call(c,o,a.toString(),l,u,d)});return()=>{n()}}(s,t,i),u=function(e,t,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=op("request",r.recordHeaders),s=op("response",r.recordHeaders),n=tp(t,"fetch",n=>function(){var o=a(function*(o,a){var l,u;try{l=new Request(o,a)}catch(e){return ip.error("Failed to instrument fetch for network capture",e),n(o,a)}var d,c,h={};try{try{var p={};l.headers.forEach((e,t)=>{p[t]=e}),i&&(h.requestHeaders=p),!vp(null==a?void 0:a.body)&&up({type:"request",headers:p,url:o,recordBody:r.recordBody})&&(h.requestBody=yield function(e){return wp.apply(this,arguments)}({r:l,options:r,url:o}))}catch(e){ip.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),u=ap(o)?yield n(l):yield n(o,a),c=t.performance.now();try{var _={};u.headers.forEach((e,t)=>{_[t]=e}),s&&(h.responseHeaders=_),up({type:"response",headers:_,url:o,recordBody:r.recordBody})&&(h.responseBody=yield function(e){return kp.apply(this,arguments)}({r:u,options:r,url:o}))}catch(e){ip.error("Failed to record fetch response for network capture",e)}return u}finally{dp(t,"fetch",l.url,d,c).then(t=>{var r;e({requests:_p({entry:t,method:l.method,status:null==(r=u)?void 0:r.status,networkRequest:h,start:d,end:c,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{n()}}(s,t,i)),Cp=()=>{o(),l(),u(),Cp=null}}var xp,Tp,Ip,Rp,Pp,Mp,Fp,Lp,Ap,Op,Dp,Np,Bp,$p,qp,Hp=e=>({name:"rrweb/network@1",observer:Ep,options:e});b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Jh,getRecordNetworkPlugin:Hp},b.__PosthogExtensions__.rrweb={record:Dh,version:"v2",wasMaxDepthReached:()=>lc,resetMaxDepthState(){lc=!1,ac=!1},getLastSnapshotCost:()=>Yu,getMutationCost:()=>n({},rd),resetSnapshotCostState(){Gu=0,Qu=0,Ku=0,Wu=0,Zu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Yu=null,Ju=null,Xu=[],ed=0,td=0,rd={slowestBatchMs:0},id={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},b.rrweb={record:Dh,version:"v2"},b.rrwebConsoleRecord={getRecordConsolePlugin:Jh},b.getRecordNetworkPlugin=Hp,b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.initSessionRecording=(e,t)=>new Su(e,t);var Up,Wp,zp,Vp,jp={},Gp=[],Qp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Kp=Array.isArray;function Zp(e,t){for(var r in t)e[r]=t[r];return e}function Yp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Jp(e,t,r){var i,s,n,o={};for(n in t)"key"==n?i=t[n]:"ref"==n?s=t[n]:o[n]=t[n];if(arguments.length>2&&(o.children=arguments.length>3?xp.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===o[n]&&(o[n]=e.defaultProps[n]);return Xp(e,o,i,s,null)}function Xp(e,t,r,i,s){var n={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++Ip:s,__i:-1,__u:0};return null==s&&null!=Tp.vnode&&Tp.vnode(n),n}function e_(e){return e.children}function t_(e,t){this.props=e,this.context=t}function r_(e,t){if(null==t)return e.__?r_(e.__,e.__i+1):null;for(var r;e.__k.length>t;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?r_(e):null}function i_(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],s=[],n=Zp({},t);n.__v=t.__v+1,Tp.vnode&&Tp.vnode(n),p_(e.__P,n,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?r_(t):r,!!(32&t.__u),s),n.__v=t.__v,n.__.__k[n.__i]=n,g_(i,n,s),t.__e=t.__=null,n.__e!=r&&s_(n)}}function s_(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),s_(e)}function n_(e){(!e.__d&&(e.__d=!0)&&Rp.push(e)&&!o_.__r++||Pp!=Tp.debounceRendering)&&((Pp=Tp.debounceRendering)||Mp)(o_)}function o_(){try{for(var e,t=1;Rp.length;)Rp.length>t&&Rp.sort(Fp),e=Rp.shift(),t=Rp.length,i_(e)}finally{Rp.length=o_.__r=0}}function a_(e,t,r,i,s,n,o,a,l,u,d){var c,h,p,_,g,v,f,m=i&&i.__k||Gp,y=t.length;for(l=function(e,t,r,i,s){var n,o,a,l,u,d=r.length,c=d,h=0;for(e.__k=new Array(s),n=0;s>n;n++)null!=(o=t[n])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[n]=Xp(null,o,null,null,null):Kp(o)?o=e.__k[n]=Xp(e_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[n]=Xp(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[n]=o,l=n+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=u_(o,r,l,c))&&(c--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>d?h--:d>s&&h++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,o.__u|=4))):e.__k[n]=null;if(c)for(n=0;d>n;n++)null!=(a=r[n])&&!(2&a.__u)&&(a.__e==i&&(i=r_(a)),m_(a,a));return i}(r,t,m,l,y),c=0;y>c;c++)null!=(p=r.__k[c])&&(h=-1!=p.__i&&m[p.__i]||jp,p.__i=c,v=p_(e,p,h,s,n,o,a,l,u,d),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&f_(h.ref,null,p),d.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(f=!!(4&p.__u))||h.__k===p.__k?(l=l_(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==v?l=v:_&&(l=_.nextSibling),p.__u&=-7);return r.__e=g,l}function l_(e,t,r,i){var s,n;if("function"==typeof e.type){for(s=e.__k,n=0;s&&s.length>n;n++)s[n]&&(s[n].__=e,t=l_(s[n],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=r_(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function u_(e,t,r,i){var s,n,o,a=e.key,l=e.type,u=t[r],d=null!=u&&!(2&u.__u);if(null===u&&null==a||d&&a==u.key&&l==u.type)return r;if(i>(d?1:0))for(s=r-1,n=r+1;s>=0||t.length>n;)if(null!=(u=t[o=0>s?n++:s--])&&!(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function d_(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Qp.test(t)?r:r+"px"}function c_(e,t,r,i,s){var n,o;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||d_(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||d_(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])n=t!=(t=t.replace(Dp,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+n]=r,r?i?r[Op]=i[Op]:(r[Op]=Np,e.addEventListener(t,n?$p:Bp,n)):e.removeEventListener(t,n?$p:Bp,n);else{if("http://www.w3.org/2000/svg"==s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function h_(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[Ap])t[Ap]=Np++;else if(r[Op]>t[Ap])return;return r(Tp.event?Tp.event(t):t)}}}function p_(e,t,r,i,s,n,o,a,l,u){var d,c,h,p,_,g,v,f,m,y,$,b,S,w,k,C,E=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),n=[a=t.__e=r.__e]),(d=Tp.__b)&&d(t);e:if("function"==typeof E){c=o.length;try{if(m=t.props,y=E.prototype&&E.prototype.render,$=(d=E.contextType)&&i[d.__c],b=d?$?$.props.value:d.__:i,r.__c?f=(h=t.__c=r.__c).__=h.__E:(y?t.__c=h=new E(m,b):(t.__c=h=new t_(m,b),h.constructor=E,h.render=y_),$&&$.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Zp({},h.__s)),Zp(h.__s,E.getDerivedStateFromProps(m,h.__s))),_=h.props,g=h.state,h.__v=t,p)y&&null==E.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==E.getDerivedStateFromProps&&m!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==r.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=r.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),Gp.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(_,g,v)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=Tp.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),d=h.render(h.props,h.state,h.context),Gp.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),d=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(i=Zp(Zp({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(_,g)),k=null!=d&&d.type===e_&&null==d.key?v_(d.props.children):d,a=a_(e,Kp(k)?k:[k],t,r,i,s,n,o,a,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),f&&(h.__E=h.__=null)}catch(e){if(o.length=c,t.__v=null,l||null!=n)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=n&&(n[n.indexOf(a)]=null),t.__e=a}else{if(null!=n)for(C=n.length;C--;)Yp(n[C]);__(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||__(t);Tp.__e(e,t,r)}}else null==n&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=function(e,t,r,i,s,n,o,a,l){var u,d,c,h,p,_,g,v=r.props||jp,f=t.props,m=t.type;if("svg"==m?s="http://www.w3.org/2000/svg":"math"==m?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=n)for(u=0;n.length>u;u++)if((p=n[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,n[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(s,m,f.is&&f),a&&(Tp.__m&&Tp.__m(t,n),a=!1),n=null}if(null==m)v===f||a&&e.data==f||(e.data=f);else{if(n="textarea"==m&&null!=f.defaultValue?null:n&&xp.call(e.childNodes),!a&&null!=n)for(v={},u=0;e.attributes.length>u;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)p=v[u],"dangerouslySetInnerHTML"==u?c=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||c_(e,u,null,p,s);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?d=p:"value"==u?_=p:"checked"==u?g=p:a&&"function"!=typeof p||v[u]===p||c_(e,u,p,v[u],s);if(d)a||c&&(d.__html==c.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),a_("template"==t.type?e.content:e,Kp(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:r.__k&&r_(r,0),a,l),null!=n)for(u=n.length;u--;)Yp(n[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==m&&!_||"option"==m&&_!=v[u])&&c_(e,u,_,v[u],s),u="checked",null!=g&&g!=e[u]&&c_(e,u,g,v[u],s))}return e}(r.__e,t,r,i,s,n,o,l,u);return(d=Tp.diffed)&&d(t),128&t.__u?void 0:a}function __(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(__))}function g_(e,t,r){for(var i=0;r.length>i;i++)f_(r[i],r[++i],r[++i]);Tp.__c&&Tp.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Tp.__e(e,t.__v)}})}function v_(e){return"object"!=typeof e||null==e||e.__b>0?e:Kp(e)?e.map(v_):void 0!==e.constructor?null:Zp({},e)}function f_(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Tp.__e(e,r)}}function m_(e,t,r){var i,s;if(Tp.unmount&&Tp.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||f_(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Tp.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(s=0;i.length>s;s++)i[s]&&m_(i[s],t,r||"function"!=typeof e.type);r||Yp(e.__e),e.__c=e.__=e.__e=void 0}function y_(e,t,r){return this.constructor(e,r)}function b_(e,t,r){var i,s,n,o;t==document&&(t=document.documentElement),Tp.__&&Tp.__(e,t),s=(i="function"==typeof r)?null:r&&r.__k||t.__k,n=[],o=[],p_(t,e=(!i&&r||t).__k=Jp(e_,null,[e]),s||jp,jp,t.namespaceURI,!i&&r?[r]:s?null:t.firstChild?xp.call(t.childNodes):null,n,!i&&r?r:s?s.__e:t.firstChild,i,o),g_(n,e,o),e.props.children=null}xp=Gp.slice,Tp={__e(e,t,r,i){for(var s,n,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((n=s.constructor)&&null!=n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,i||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},Ip=0,t_.prototype.setState=function(e,t){var r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Zp({},this.state);"function"==typeof e&&(e=e(Zp({},r),this.props)),e&&Zp(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),n_(this))},t_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),n_(this))},t_.prototype.render=e_,Rp=[],Mp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fp=function(e,t){return e.__v.__b-t.__v.__b},o_.__r=0,Lp=Math.random().toString(8),Ap="__d"+Lp,Op="__a"+Lp,Dp=/(PointerCapture)$|Capture$/i,Np=0,Bp=h_(!1),$p=h_(!0),qp=0;var S_=0,w_=[],k_=Tp,C_=k_.__b,E_=k_.__r,x_=k_.diffed,T_=k_.__c,I_=k_.unmount,R_=k_.__;function P_(e,t){k_.__h&&k_.__h(Wp,e,S_||t),S_=0;var r=Wp.__H||(Wp.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function M_(e){return S_=1,function(e,t){var r=P_(Up++,2);if(r.t=e,!r.__c&&(r.__=[U_(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],i=r.t(t,e);t!==i&&(r.__N=[i,r.__[1]],r.__c.setState({}))}],r.__c=Wp,!Wp.__f)){var i=function(e,t,i){if(!r.__c.__H)return!0;var n=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){n=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),s){var a=s.call(this,e,t,i);return n?a||o:a}return!n||o};Wp.__f=!0;var s=Wp.shouldComponentUpdate,n=Wp.componentWillUpdate;Wp.componentWillUpdate=function(e,t,r){if(this.__e){var o=s;s=void 0,i(e,t,r),s=o}n&&n.call(this,e,t,r)},Wp.shouldComponentUpdate=i}return r.__N||r.__}(U_,e)}function F_(e,t){var r=P_(Up++,3);!k_.__s&&H_(r.__H,t)&&(r.__=e,r.u=t,Wp.__H.__h.push(r))}function L_(e){return S_=5,A_(function(){return{current:e}},[])}function A_(e,t){var r=P_(Up++,7);return H_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function O_(e){var t,r=Wp.context[e.__c],i=P_(Up++,9);return i.c=e,r?(null!==(t=i.__)&&void 0!==t||(i.__=!0,r.sub(Wp)),r.props.value):e.__}function D_(){for(var e;e=w_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($_),t.__h.some(q_),t.__h=[]}catch(r){t.__h=[],k_.__e(r,e.__v)}}}k_.__b=function(e){Wp=null,C_&&C_(e)},k_.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),R_&&R_(e,t)},k_.__r=function(e){E_&&E_(e),Up=0;var t=(Wp=e.__c).__H;t&&(zp===Wp?(t.__h=[],Wp.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&D_(),Up=0)),zp=Wp},k_.diffed=function(e){x_&&x_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==w_.push(t)&&Vp===k_.requestAnimationFrame||((Vp=k_.requestAnimationFrame)||B_)(D_)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),zp=Wp=null},k_.__c=function(e,t){t.some(function(e){try{e.__h.some($_),e.__h=e.__h.filter(function(e){return!e.__||q_(e)})}catch(r){t.some(function(e){e.__h&&(e.__h=[])}),t=[],k_.__e(r,e.__v)}}),T_&&T_(e,t)},k_.unmount=function(e){I_&&I_(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some(function(e){try{$_(e)}catch(e){t=e}}),r.__H=void 0,t&&k_.__e(t,r.__v))};var N_="function"==typeof requestAnimationFrame;function B_(e){var t,r=function(){clearTimeout(i),N_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);N_&&(t=requestAnimationFrame(r))}function $_(e){var t=Wp,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),Wp=t}function q_(e){var t=Wp;e.__c=e.__(),Wp=t}function H_(e,t){return!e||e.length!==t.length||t.some(function(t,r){return t!==e[r]})}function U_(e,t){return"function"==typeof t?t(e):t}var W_={GZipJS:"gzip-js",Base64:"base64"},z_={Activation:"events",Cancellation:"cancelEvents"},V_={Button:"button",Tab:"tab",Selector:"selector"},j_={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},G_={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Q_={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},K_={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Z_={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Y_={Once:"once",Recurring:"recurring",Always:"always"},J_={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},X_={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},eg={Popover:"popover",Inline:"inline"};function tg(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&xt(r.then)&&r.then(void 0,()=>{})}}}}var rg=Fs("[Surveys]");function ig(e){return!(!e.start_date||e.end_date)}function sg(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var ng=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),og=e=>ng("seenSurvey_",e),ag=e=>{try{var t=og(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){rg.error("Failed to persist survey seen state",e)}},lg=[Q_.Popover,Q_.Widget,Q_.API],ug={ignoreConditions:!1,ignoreDelay:!1,displayType:eg.Popover},dg="logs",cg=Fs("[Stylesheet Loader]"),hg=l,pg=c,_g="#020617",gg={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:j_.Right,widgetType:V_.Tab,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:_g,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},vg=[j_.Center,j_.Left,j_.Right];function fg(e){if(e.startsWith("#")){var t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")":"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function mg(e){var t;void 0===e&&(e=gg.backgroundColor),"#"===e[0]&&(t=fg(e)),e.startsWith("rgb")&&(t=e);var r={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"}[e.toLowerCase()];if(r&&(t=fg(r)),!t)return _g;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var s=parseInt(i[1]),n=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(s*s*.299+n*n*.587+o*o*.114)>127.5?_g:"white"}return _g}var yg=(e,t,r)=>{var i=Bg(e),s=pg.querySelector("."+i);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var o=pg.createElement("div");((e,t,r)=>{var i=n({},gg,r),s=e.style,o=!vg.includes(i.position)||t===Q_.Widget&&(null==r?void 0:r.widgetType)===V_.Tab;s.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";var t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?e+", "+t:"-apple-system, "+t}(i.fontFamily)),s.setProperty("--ph-survey-box-padding",i.boxPadding),s.setProperty("--ph-survey-max-width",i.maxWidth),s.setProperty("--ph-survey-z-index",i.zIndex),s.setProperty("--ph-survey-border-color",i.borderColor),o?(s.setProperty("--ph-survey-border-radius",i.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",i.borderRadius+" "+i.borderRadius+" 0 0")),s.setProperty("--ph-survey-background-color",i.backgroundColor),s.setProperty("--ph-survey-box-shadow",i.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",i.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",i.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==r?void 0:r.submitButtonTextColor)||mg(i.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",i.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",i.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",mg(i.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==r?void 0:r.textColor)||mg(i.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",i.textSubtleColor),s.setProperty("--ph-widget-color",i.widgetColor),s.setProperty("--ph-widget-text-color",mg(i.widgetColor)),s.setProperty("--ph-widget-z-index",i.zIndex);var a=(null==r?void 0:r.inputBackground)||(null==r?void 0:r.inputBackgroundColor),l=a||i.inputBackground;a||"white"!==i.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);var u=(null==r?void 0:r.inputTextColor)||mg(l);s.setProperty("--ph-survey-input-text-color",u),s.setProperty("--ph-survey-rating-text-color",u),s.setProperty("--ph-survey-scrollbar-thumb-color",i.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",i.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",i.outlineColor)})(o,e.type,e.appearance),o.className=i;var a=o.attachShadow({mode:"open"}),l=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var s=(e=>{var t;return xt(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return s&&(i=s(i)),i||(cg.error("prepare_external_dependency_stylesheet returned null"),null)})(pg,':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)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(l){var u=a.querySelector("style");u&&a.removeChild(u),a.appendChild(l)}return(r||pg.body).appendChild(o),{shadow:a,isNewlyCreated:!0}},bg=e=>{var t=e.responses,r=e.survey,i=e.surveySubmissionId,s=e.posthog,o=e.isSurveyCompleted,a=e.properties,l=e.surveyLanguage,u=e.questionSnapshots;s?(ag(r),s.capture(J_.SENT,n({[X_.SURVEY_NAME]:r.name,[X_.SURVEY_ID]:r.id,[X_.SURVEY_ITERATION]:r.current_iteration,[X_.SURVEY_ITERATION_START_DATE]:r.current_iteration_start_date,[X_.SURVEY_SUBMISSION_ID]:i,[X_.SURVEY_COMPLETED]:o},l&&{[X_.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},Wa(t,r,u),a,{$set:{[za(r,"responded")]:!0}})),o&&(hg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:r.id}})),Ng(r),s.reloadFeatureFlags())):rg.error("[survey sent] event not captured, PostHog instance not found.")},Sg=(e,t,r)=>{return n({[X_.SURVEY_NAME]:e.name,[X_.SURVEY_ID]:e.id,[X_.SURVEY_ITERATION]:e.current_iteration,[X_.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[X_.SURVEY_PARTIALLY_COMPLETED]:(i=null==t?void 0:t.responses,void 0===i&&(i={}),Object.values(i).some(e=>!Lt(e)))},(null==t?void 0:t.surveyLanguage)&&{[X_.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==r.get_session_replay_url?void 0:r.get_session_replay_url(),[X_.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},Wa(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots));var i},wg=(e,t,r,i)=>{if(t){if(!r){var s=Og(e),o=s?s.surveyLanguage:i;t.capture(J_.DISMISSED,n({},Sg(e,s,t),o&&{[X_.SURVEY_LANGUAGE]:o},{$set:{[za(e,"dismissed")]:!0}})),Ng(e),ag(e),hg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else rg.error("[survey dismissed] event not captured, PostHog instance not found.")},kg=(e,t)=>{if(t){var r=(e=>ng("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=Og(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(J_.ABANDONED,Sg(e,i,t),{transport:"sendBeacon"})}}else rg.error("[survey abandoned] event not captured, PostHog instance not found.")},Cg=e=>e.map(e=>({sort:Math.floor(10*Math.random()),value:e})).sort((e,t)=>e.sort-t.sort).map(e=>e.value),Eg=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r])?t.reverse():t,xg=e=>{var t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},Tg=(e,t)=>{var r;return(e=>e.questions.some(e=>{var t;return!(null==(t=e.branching)||!t.type)}))(e)?e.questions:t?null!==(r=((e,t)=>{if(!t||t.length!==e.questions.length)return null;var r=new Map(e.questions.map(e=>[e.id,e])),i=[];for(var s of t){var n=r.get(s);if(!n)return null;i.push(n)}return i})(e,t.questionOrder))&&void 0!==r?r:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Eg(e.questions,Cg(e.questions)):e.questions},Ig=e=>Ya(e)||Dg(e),Rg=function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach(function(e){e.__e=!0,n_(e)})},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+qp++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Pg=()=>O_(Rg),Mg=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,s,n,o,a=Zp({},e.props);for(n in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==n?i=t[n]:"ref"==n?s=t[n]:a[n]=void 0===t[n]&&null!=o?o[n]:t[n];return arguments.length>2&&(a.children=arguments.length>3?xp.call(arguments,2):r),Xp(e.type,a,i||e.key,s||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function Fg(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var s,n=tn(t);return!!n&&el[s=null==(i=e.conditions)?void 0:i.urlMatchType,null!=s?s:"icontains"]([e.conditions.url],[n])}var Lg=e=>ng("inProgressSurvey_",e),Ag=(e,t)=>{try{localStorage.setItem(Lg(e),JSON.stringify(t))}catch(e){rg.error("Error setting in-progress survey state in localStorage",e)}},Og=e=>{try{var t=localStorage.getItem(Lg(e));if(t)return JSON.parse(t)}catch(e){rg.error("Error getting in-progress survey state from localStorage",e)}return null},Dg=e=>{var t=Og(e);return!Lt(null==t?void 0:t.surveySubmissionId)},Ng=e=>{try{localStorage.removeItem(Lg(e))}catch(e){rg.error("Error clearing in-progress survey state from localStorage",e)}};function Bg(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function $g(e,t,r){if(void 0===t&&(t=j_.Right),e===Q_.ExternalSurvey)return{};switch(t){case j_.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case j_.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case j_.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case j_.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case j_.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case j_.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case j_.Left:return{left:"30px"};case j_.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Q_.Widget&&r===V_.Tab?"60px":"30px"}}}var qg=0;function Hg(e,t,r,i,s,n){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--qg,__i:-1,__u:0,__source:s,__self:n};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return Tp.vnode&&Tp.vnode(u),u}var Ug=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),Wg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),zg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),Vg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),jg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),Gg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Hg("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"})}),Qg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Hg("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"})}),Kg=Hg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Hg("g",{"clip-path":"url(#clip0_2415_6911)",children:[Hg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Hg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Hg("g",{mask:"url(#mask0_2415_6911)",children:[Hg("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"}),Hg("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"}),Hg("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"}),Hg("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"}),Hg("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"}),Hg("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"})]})]}),Hg("defs",{children:Hg("clipPath",{id:"clip0_2415_6911",children:Hg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function Zg(e){var t=e.urlParams,r=t?Object.entries(t).map(e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)}).join("&"):"";return Hg("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Kg]})}function Yg(e){var t=e.text,r=e.submitDisabled,i=e.appearance,s=e.onSubmit,n=e.link,o=e.onPreviewSubmit,a=e.skipSubmitButton,u=e.canGoBack,d=e.onBack,c=O_(Rg).isPreviewMode,h=!!u&&!!d,p=!a&&Hg("button",{className:"form-submit",disabled:r,"aria-label":"Submit survey",type:"button",onClick(){n&&(null==l||l.open(n)),c?null==o||o():s()},children:t});return Hg("div",{className:"bottom-section",children:[h?Hg("div",{className:"form-buttons form-buttons-with-back",children:[Hg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:d,children:i.backButtonText||"Back"}),p]}):p,!i.whiteLabel&&Hg(Zg,{urlParams:{utm_source:"survey-footer"}})]})}function Jg(e){var t=e.question,r=e.forceDisableHtml;return Hg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Hg(t.type===K_.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&Mg({component:Jp("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function Xg(e){var t,r,i;return Hg("button",{className:"form-cancel",onClick:e.onClick,disabled:O_(Rg).isPreviewMode,"aria-label":"Close survey",type:"button",children:(t={fill:"black"},r=(void 0===t?{}:t).fill,i=void 0===r?"currentColor":r,Hg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:i,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Hg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Hg("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:i})]}))})}var ev=l;function tv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onClose,a=O_(Rg).isPopup;return F_(()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return Ws(ev,"keydown",e),()=>{ev.removeEventListener("keydown",e)}},[o]),Hg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==n.hideCancelButton&&Hg(Xg,{onClick:()=>o()}),Hg("h3",{className:"thank-you-message-header",children:t}),r&&Mg({component:Jp("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!s&&"text"!==i}),a&&Hg(Yg,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>o()})]})}function rv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onStart,a=O_(Rg),l=a.onPreviewSubmit,u=a.onPopupSurveyDismissed;return Hg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[a.isPopup&&!0!==n.hideCancelButton&&Hg(Xg,{onClick:()=>u()}),t&&Hg("h3",{className:"intro-screen-header",children:t}),r&&Mg({component:Jp("p",{className:"intro-screen-body"}),children:r,renderAsHtml:!s&&"text"!==i}),Hg(Yg,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:o,onPreviewSubmit:()=>l(null)})]})}var iv=e=>Et(e)&&e.every(e=>Pt(e));function sv(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,s=e.onSubmit,n=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,d=Pg().isPreviewMode,c=L_(null),h=M_(()=>Pt(a)?a:""),p=h[0],_=h[1],g=null==i?void 0:i.disableAutofocus;F_(()=>{g||setTimeout(()=>{var e;d||null==(e=c.current)||e.focus()},100)},[d,g]);var v="surveyQuestion"+o,f=A_(()=>function(e,t,r){var i,s,n=e.trim();if(!r&&""===n)return"This field is required";if(""===n)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case mt:if(void 0!==o.value&&o.value>n.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case yt:if(void 0!==o.value&&n.length>o.value)return null!==(s=o.errorMessage)&&void 0!==s?s:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional),[p,t.validation,t.optional]),m=Ts(t.validation,mt),y=Ts(t.validation,yt),b=A_(()=>function(e,t){var r=1===e?void 0:e;return r&&t?"Enter "+r+"-"+t+" characters":r?"Enter at least "+r+" "+(1===r?"character":"characters"):t?"Maximum "+t+" "+(1===t?"character":"characters"):void 0}(m,y),[m,y]),S=()=>{f||s(p.trim())},w=()=>{f||n(p.trim())};return Hg(e_,{children:[Hg("div",{className:"question-container",children:[Hg(Jg,{question:t,forceDisableHtml:r,htmlFor:v}),Hg("textarea",{ref:c,id:v,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){_(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),d?w():S())},value:p}),b&&Hg("div",{className:"validation-hint",children:b})]}),Hg(Yg,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function nv(e){var t=e.question,r=e.appearance,i=e.onSubmit,s=e.onPreviewSubmit,n=e.canGoBack,o=e.onBack;return Hg(e_,{children:[Hg("div",{className:"question-container",children:Hg(Jg,{question:t,forceDisableHtml:e.forceDisableHtml})}),Hg(Yg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:n,onBack:o})]})}function ov(e){var t,r=e.question,i=e.forceDisableHtml,s=e.displayQuestionIndex,n=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,d=e.onBack,c=r.scale,h=10===r.scale?0:1,p=M_(()=>At(l)?l:Et(l)&&l.length>0&&At(parseInt(l[0]))?parseInt(l[0]):Pt(l)&&At(parseInt(l))?parseInt(l):null),_=p[0],g=p[1],v="emoji"===r.display&&2===r.scale,f=Pg().isPreviewMode,m=e=>f?a(e):o(e);return Hg(e_,{children:[Hg("div",{className:"question-container",children:[Hg(Jg,{question:r,forceDisableHtml:i}),Hg("div",{className:"rating-section",children:[Hg("div",{className:"rating-options",children:["emoji"===r.display&&Hg("div",{className:"rating-options-emoji"+(v?" rating-options-emoji-2":""),children:null==(t=hv[r.scale])?void 0:t.map((e,t)=>Hg("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+s+"-rating-"+t+" "+(t+1===_?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;g(e),r.skipSubmitButton&&m(e)},children:e},t))}),"number"===r.display&&Hg("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(c-h+1)+", minmax(0, 1fr))"},children:pv(r.scale).map((e,t)=>Hg(av,{displayQuestionIndex:s,active:_===e,appearance:n,num:e,setActiveNumber(e){g(e),r.skipSubmitButton&&m(e)}},t))})]}),!v&&Hg("div",{className:"rating-text",children:[Hg("div",{children:r.lowerBoundLabel}),Hg("div",{children:r.upperBoundLabel})]})]})]}),Hg(Yg,{text:r.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Ft(_)&&!r.optional,appearance:n,onSubmit:()=>o(_),onPreviewSubmit:()=>a(_),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:d})]})}function av(e){var t=e.num,r=e.setActiveNumber;return Hg("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+e.displayQuestionIndex+"-rating-"+t+" "+(e.active?"rating-active":""),type:"button",onClick(){r(t)},children:t})}function lv(e){var t=e.question,r=e.forceDisableHtml,i=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,d=e.onBack,c=L_(null),h=A_(()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Eg(t,Cg(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t),[t]),p=M_(()=>((e,t)=>Pt(e)||iv(e)?e:t===K_.SingleChoice?null:[])(l,t.type)),_=p[0],g=p[1],v=M_(()=>((e,t)=>{if(Pt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(iv(e)){var r=e.find(e=>!t.includes(e));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(l,h)),f=v[0],m=v[1],y=Pg().isPreviewMode,b=t.type===K_.SingleChoice,S=t.type===K_.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var r=!f.isSelected;return m(e=>n({},e,{isSelected:r,inputValue:r?e.inputValue:""})),b&&g(""),void(r&&setTimeout(()=>{var e;return null==(e=c.current)?void 0:e.focus()},75))}if(b)return g(e),m(e=>n({},e,{isSelected:!1,inputValue:""})),void(w&&(o(e),y&&a(e)));S&&Et(_)&&(_.includes(e)?g(_.filter(t=>t!==e)):g([..._,e]))},C=e=>{e.stopPropagation();var t=e.currentTarget.value;m(e=>n({},e,{inputValue:t})),b&&g(t)},E=e=>{e.stopPropagation(),"Enter"!==e.key||x()||(e.preventDefault(),T()),"Escape"===e.key&&(e.preventDefault(),m(e=>n({},e,{isSelected:!1,inputValue:""})),b&&g(null))},x=()=>!(t.optional||!Ft(_)&&(!Et(_)||f.isSelected||0!==_.length)&&(!f.isSelected||""!==f.inputValue.trim())),T=()=>{f.isSelected&&S?Et(_)&&(y?a([..._,f.inputValue]):o([..._,f.inputValue])):y?a(_):o(_)};return Hg(e_,{children:[Hg("div",{className:"question-container",children:[Hg(Jg,{question:t,forceDisableHtml:r}),Hg("fieldset",{className:"multiple-choice-options limit-height",children:[Hg("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),h.map((e,r)=>{var s=!!t.hasOpenChoice&&r===t.choices.length-1,n="surveyQuestion"+i+"Choice"+r,o=n+"Open",a=s?f.isSelected:b?_===e:Et(_)&&_.includes(e);return Hg("label",{className:s?"choice-option-open":"",children:[Hg("div",{className:"response-choice",children:[Hg("input",{type:b?"radio":"checkbox",name:n,checked:a,onChange:()=>k(e,s),id:n,"aria-controls":o}),Hg("span",{children:s?e+":":e})]}),s&&Hg("input",{type:"text",ref:c,id:o,name:"question"+i+"Open",value:f.inputValue,onKeyDown:E,onInput:C,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)})]})]}),Hg(Yg,{text:t.buttonText||"Submit",submitDisabled:x(),appearance:s,onSubmit:T,onPreviewSubmit:T,skipSubmitButton:w,canGoBack:u,onBack:d})]})}var uv=[1,2,3,4,5],dv=[1,2,3,4,5,6,7],cv=[0,1,2,3,4,5,6,7,8,9,10],hv={2:[Gg,Qg],3:[zg,Wg,Ug],5:[Vg,zg,Wg,Ug,jg]};function pv(e){switch(e){case 5:default:return uv;case 7:return dv;case 10:return cv}}var _v=Fs("[Surveys]");function gv(e,t,r){var i,s=e.questions[t],n=t+1;if(null==(i=s.branching)||!i.type)return t===e.questions.length-1?Z_.End:n;if(s.branching.type===Z_.End)return Z_.End;if(s.branching.type===Z_.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===Z_.ResponseBased){if(s.type===K_.SingleChoice){var o,a=s.choices.indexOf(""+r);if(-1===a&&s.hasOpenChoice&&(a=s.choices.length-1),null!=(o=s.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=s.branching.responseValues[a];return Number.isInteger(l)?l:l===Z_.End?Z_.End:n}}else if(s.type===K_.Rating){var u;if("number"!=typeof r||!Number.isInteger(r))throw new Error("The response type must be an integer");var d=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(r,s.scale);if(null!=(u=s.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(d)){var c=s.branching.responseValues[d];return Number.isInteger(c)?c:c===Z_.End?Z_.End:n}}return n}return _v.warn("Falling back to next question index due to unexpected branching type"),n}var vv=Fs("[SurveyTranslations]");function fv(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,s=Va(e.overrideLanguage);if(s)return null==t||t.info("Using override display language: "+s),s;var n=function(e){return e&&"object"==typeof e&&"language"in e?Va(e.language):null}(r);if(n)return null==t||t.info("Using person property language: "+n),n;var o=Va(i);return o?(null==t||t.info("Using detected locale: "+o),o):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:xt(e.get_property)?e.get_property(pe):void 0,locale:fl()},vv)}(t);if(!r)return vv.info("No user language detected"),{survey:e,language:null};var i=Ka(e,r,vv);return{survey:i.survey,language:i.matchedKey}}var mv=l,yv=c,bv="ph:show_survey_widget",Sv="PHWidgetSurveyClickListener";function wv(e,t){try{var r=e.getBoundingClientRect(),i=mv.innerHeight,s=mv.innerWidth,n=r.left+r.width/2-t/2;n+t>s-20&&(n=s-t-20),20>n&&(n=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:n+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:gg.zIndex}}catch(e){return rg.warn("Failed to calculate trigger position:",e),null}}var kv=class{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this.handlePageUnload=()=>{var e=this._posthog.get_property(ve);if(e)for(var t of e)Dg(t)&&kg(t,this._posthog)},this.handlePopoverSurvey=function(e,r,i){var s,o,a,l,u,d=(void 0===i?{}:i).resumeDelayFromActivation,c=void 0!==d&&d,h=t._translateSurveyForRendering(e),p=h.survey,_=h.language;t._currentLanguage=_,t._surveyPopupProps=null,t._displayOptions=r;var g=t._applyDisplayOverrides(p,r);t._clearSurveyTimeout(g.id);var v=null!=r?r:{},f=v.properties,m=v.initialResponses,y=!(!m||0>=Object.keys(m).length)&&t._handleInitialResponses(g,m,f,_);if(!y||null!=(s=g.appearance)&&s.displayThankYouMessage){t._addSurveyToFocus(g);var b={};if((null==(o=g.appearance)?void 0:o.position)===j_.NextToTrigger&&null!=(a=g.appearance)&&a.widgetSelector){var S,w=yv.querySelector(g.appearance.widgetSelector);w&&(b=wv(w,parseInt((null==(S=g.appearance)?void 0:S.maxWidth)||gg.maxWidth))||{})}var k=(null==(l=g.appearance)?void 0:l.surveyPopupDelaySeconds)||0,C=yg(g,t._posthog).shadow;t._renderedTargets.set(C,C.host);var E={posthog:t._posthog,survey:g,removeSurveyFromFocus:t._removeSurveyFromFocus,properties:f,style:b,isSurveyCompleted:y,skipShownEvent:null==r?void 0:r.skipShownEvent,surveyLanguage:_};if(t._surveyPopupProps=E,0>=k)return t._surveyIsRendered=!0,b_(Hg(Iv,n({},E)),C);var x=()=>{if(!t._shouldDisplaySurvey(g))return rg.info("Survey "+g.id+" no longer eligible when its display delay elapsed; not displaying"),t._removeSurveyFromFocus(g);(()=>{t._surveyIsRendered=!0;var i=t._translateSurveyForRendering(e),s=i.survey,o=i.language;t._currentLanguage=o;var a=t._applyDisplayOverrides(s,r),l=n({},E,{survey:a,surveyLanguage:o});t._surveyPopupProps=l,b_(Hg(Iv,n({},l,{survey:n({},a,{appearance:n({},a.appearance,{surveyPopupDelaySeconds:0})})})),C)})()},T=c?null==(u=t._posthog.surveys)||null==(u=u._surveyEventReceiver)||null==u.getActivationTimestamp?void 0:u.getActivationTimestamp(g.id):void 0,I=At(T)?Math.max(0,Date.now()-T):0,R=Math.max(0,1e3*k-I);if(0>=R)return x();var P=mv.setTimeout(()=>{t._surveyTimeouts.delete(g.id),x()},R);t._surveyTimeouts.set(g.id,P)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,s=yg(r,this._posthog),n=s.shadow,o=s.isNewlyCreated;this._renderedTargets.set(n,n.host),o&&b_(Hg(Pv,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),n)},this._detachWidgetSelectorListener=e=>{var t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Sv),this._widgetSelectorListeners.delete(e),rg.info("Removed click listener for survey "+e))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;return!(null==(t=yv.querySelector(Bg(e,!0)))||null==(t=t.shadowRoot)||!t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{var r=yv.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;rg.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._detachWidgetSelectorListener(e.id)}if(!r.hasAttribute(Sv)){var s=t=>{var r,i;t.stopPropagation();var s=(null==(r=e.appearance)?void 0:r.position)===j_.NextToTrigger?wv(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||gg.maxWidth)):{};mv.dispatchEvent(new CustomEvent(bv,{detail:{surveyId:e.id,position:s}}))};Ws(r,"click",s),r.setAttribute(Sv,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:s,survey:e}),rg.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,s=yg(r,this._posthog).shadow;this._renderedTargets.set(s,s.host),b_(Hg(Iv,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,r)=>{var i,s=this._translateSurveyForRendering(e),n=s.survey,o=s.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(n,o,r)),b_(Hg(Iv,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:a,surveyLanguage:o}),t)},this.getActiveMatchingSurveys=function(e,r){var i;void 0===r&&(r=!1),null==(i=t._posthog)||null==(i=i.surveys)||i.getSurveys(r=>{e(r.filter(e=>t._shouldDisplaySurvey(e)))},r)},this.callSurveysAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getActiveMatchingSurveys(e=>{var r=e.filter(e=>e.type===Q_.Popover||e.type===Q_.Widget),i=new Set(r.map(e=>e.id));for(var s of Array.from(t._surveyTimeouts.keys()))i.has(s)||t.cancelSurvey(s);var n=t._sortSurveysByAppearanceDelay(r),o=new Set;n.forEach(e=>{if(e.type===Q_.Widget){var r,i,s,n;if((null==(r=e.appearance)?void 0:r.widgetType)===V_.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===V_.Selector&&null!=(s=e.appearance)&&s.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(n=e.appearance)?void 0:n.widgetSelector))}Ft(t._surveyInFocus)&&e.type===Q_.Popover&&t.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),t._widgetSelectorListeners.forEach(e=>{var r=e.survey;o.has(r.id)||t._removeWidgetSelectorListener(r)})},e)},this._addSurveyToFocus=e=>{Ft(this._surveyInFocus)||rg.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&rg.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),Ws(mv,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags(()=>this._onLanguageChange())}_onLanguageChange(){var e;if(!Ft(this._surveyInFocus)){var t=null==(e=this._posthog.get_property(ve))?void 0:e.find(e=>e.id===this._surveyInFocus);if(t){var r=this._translateSurveyForRendering(t),i=r.survey,s=r.language;if(s!==this._currentLanguage&&(this._currentLanguage=s,this._surveyIsRendered)){var o=this._applyDisplayOverrides(i,this._displayOptions),a=yg(o,this._posthog).shadow;b_(Hg(Iv,n({},this._surveyPopupProps,{posthog:this._posthog,survey:o,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),a)}}}}get _featureFlags(){var e,t,r;return null!==(e=null==(t=(r=this._posthog).getExtension)?void 0:t.call(r,"featureFlags"))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return null!=t&&t.position||null!=t&&t.selector?n({},e,{appearance:n({},e.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(rg.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null==(e=this._automaticDisplayDispose)||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(mv.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach((e,t)=>this._clearSurveyTimeout(t)),this._widgetSelectorListeners.forEach((e,t)=>this._detachWidgetSelectorListener(t)),this._renderedTargets.forEach((e,t)=>{b_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var r,i,s=Dg(e),n=Dg(t);if(s&&!n)return-1;if(!s&&n)return 1;var o=e.schedule===Y_.Always,a=t.schedule===Y_.Always;return o&&!a?1:!o&&a?-1:((null==(r=e.appearance)?void 0:r.surveyPopupDelaySeconds)||0)-((null==(i=t.appearance)?void 0:i.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return fv(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(){var e={},t=!1,r=mv.location.search.replace(/^\?/,"");if(!r)return{params:e,autoSubmit:t};for(var i of r.split("&")){var s=i.split("="),n=s[0],o=s[1];if(n&&!Rt(o)){var a=decodeURIComponent(n),l=decodeURIComponent(o);if("auto_submit"!==a||"true"!==l){var u=a.match(/^q(\d+)$/);if(u){var d=parseInt(u[1],10);e[d]||(e[d]=[]),e[d].push(l)}}else t=!0}}return{params:e,autoSubmit:t}}().params;if(0===Object.keys(i).length)return!1;rg.info("[Survey Prefill] Detected URL prefill parameters");var s=this._processPrefillData(e,i,t);return!!s&&(this._autoSubmitPrefilledResponses(e,s,r,t),this._prefillHandledSurveys.add(e.id),s.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,r,i){var s=t.responses,n=t.submissionId,o=t.isSurveyCompleted,a=t.skippedResponses;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&bg({responses:o?s:a,survey:e,surveySubmissionId:n,posthog:this._posthog,isSurveyCompleted:o,properties:r,surveyLanguage:i})}_handleInitialResponses(e,t,r,i){var s={};for(var n of Object.entries(t)){var o=n[1];s[parseInt(n[0])]=Et(o)?o.map(String):[String(o)]}rg.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,s,i);return!!a&&(this._autoSubmitPrefilledResponses(e,a,r,i),a.isSurveyCompleted)}_processPrefillData(e,t,r){try{var i=function(e,t){var r={};return e.questions.forEach((e,i)=>{if(t[i]&&e.id){var s=t[i],n=Ha(e.id);try{switch(e.type){case K_.SingleChoice:if(!e.choices||0===e.choices.length)return void Ms.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(s[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void Ms.warn("[Survey Prefill] Invalid choice index for q"+i+": "+s[0]);r[n]=e.choices[o];break;case K_.MultipleChoice:if(!e.choices||0===e.choices.length)return void Ms.warn("[Survey Prefill] Question "+i+" has no choices");var a=s.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===a.length)return void Ms.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map(t=>e.choices[t]))];a.length>l.length&&Ms.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[n]=l;break;case K_.Rating:var u=parseInt(s[0],10),d=e.scale||10;if(isNaN(u)||0>u||u>d)return void Ms.warn("[Survey Prefill] Invalid rating for q"+i+": "+s[0]+" (scale: 0-"+d+")");r[n]=u;break;default:Ms.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){Ms.error("[Survey Prefill] Error converting q"+i+":",e)}}}),r}(e,t);if(0===Object.keys(i).length)return rg.warn("[Survey Prefill] No valid responses after conversion"),null;var s=va(),n=function(e,t,r){for(var i=0,s={},n=[],o=e.questions.length+1,a=0;e.questions.length>i&&o>a&&(a++,t.includes(i));){var l=e.questions[i];if(!l||!("skipSubmitButton"in l)||!l.skipSubmitButton)break;if(l.id){var u=Ha(l.id);Rt(r[u])||(s[u]=r[u])}n.push(i);var d=gv(e,i,l.id?r[Ha(l.id)]:null);if(d===Z_.End)return{startQuestionIndex:e.questions.length,skippedResponses:s,skippedIndices:n};i=d}return{startQuestionIndex:i,skippedResponses:s,skippedIndices:n}}(e,Object.keys(t).map(e=>parseInt(e,10)),i),o=n.startQuestionIndex,a=n.skippedResponses,l=n.skippedIndices,u=o>=e.questions.length;return Ag(e,{surveySubmissionId:s,responses:i,lastQuestionIndex:o,questionOrder:xg(e.questions),visitedIndices:l,surveyLanguage:r}),rg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:s,startQuestionIndex:o,isSurveyCompleted:u,skippedResponses:a}}catch(e){return rg.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){if(void 0===t&&(t=void 0),!e)return!0;var r=this._featureFlags,i=!(null==r||!r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")})),s=!0;return t&&(s=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),i&&s}_isSurveyConditionMatched(e){return!e.conditions||Fg(e,this._posthog)&&function(e){var t,r;return function(e,t){var r,i,s;if(!e||0===e.length)return!0;if(!f)return!1;var n=Zr(f,{userAgentDataPlatform:null==d||null==(r=d.userAgentData)?void 0:r.platform,maxTouchPoints:null==d?void 0:d.maxTouchPoints,screenWidth:null==l||null==(i=l.screen)?void 0:i.width,screenHeight:null==l||null==(s=l.screen)?void 0:s.height,devicePixelRatio:null==l?void 0:l.devicePixelRatio});return el[null!=t?t:"icontains"](e,[n])}(null==(t=e.conditions)?void 0:t.deviceTypes,null==(r=e.conditions)?void 0:r.deviceTypesMatchType)}(e)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==pg||!pg.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){var t;return Ig(e)?{satisfied:!0}:!e.internal_targeting_flag_key||!function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)||null!=(t=this._featureFlags)&&t.hasLoadedFlags?{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}:{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!ig(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!lg.includes(e.type))return i.eligible=!1,i.reason="Surveys of type "+e.type+" are never eligible to be shown in the app",i;var s=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,s))return i.eligible=!1,i.reason=s?"Survey linked feature flag is not enabled for variant "+s:"Survey linked feature flag is not enabled",i;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i;var n,o=this._internalFlagCheckSatisfied(e);return o.satisfied?function(e,t){if(!e||!t)return!0;var r="string"==typeof t?new Date(t):t,i=Math.abs((new Date).getTime()-r.getTime());return Math.ceil(i/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,ka._get("lastSeenSurveyDate"))?(e=>!!ka._get(og(e))&&!Ig(e))(e)?(i.eligible=!1,i.reason="Survey has already been seen and it can't be activated again",i):i:(i.eligible=!1,i.reason="Survey wait period has not passed",i):(i.eligible=!1,i.reason=null!==(n=o.reason)&&void 0!==n?n:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i)}checkSurveyRenderability(e){var t=this.checkSurveyEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;return!Za(e)&&!sg(e)||!(null==(t=this._posthog.surveys)||null==(t=t._surveyEventReceiver)||null==(t=t.getSurveys())||!t.includes(e.id))}_checkFlags(e){var t;return null==(t=e.feature_flag_keys)||!t.length||e.feature_flag_keys.every(e=>{var t=e.value;return!e.key||!t||this._isSurveyFeatureFlagEnabled(t)})}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=yv.querySelector(Bg(e,!0));null!=t&&t.shadowRoot&&(b_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){rg.warn("Failed to remove survey "+e.id+" from DOM:",t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}};function Cv(e,t){if(yv&&mv){var r,i=new kv(e);if(e.config.disable_surveys_automatic_display)return rg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return rg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var s=()=>{Rt(r)&&(r=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},n=()=>{Rt(r)||(clearInterval(r),r=void 0)};s();var o=()=>{yv.hidden?n():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return Ws(yv,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{n(),yv.removeEventListener("visibilitychange",o)}),i}}function Ev(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,s=e.setSurveyVisible,n=e.isPreviewMode,o=void 0!==n&&n,a=e.posthog;F_(()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===Q_.Widget,n=Fg(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===V_.Tab&&r;if(!n)return rg.info("Hiding survey "+t.id+" because URL does not match"),s(!1),i(t);o&&(rg.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),s(!0))};Ws(mv,"popstate",r),Ws(mv,"hashchange",r);var n=mv.history.pushState,l=mv.history.replaceState;return mv.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];n.apply(this,t),r()},mv.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];l.apply(this,t),r()},()=>{mv.removeEventListener("popstate",r),mv.removeEventListener("hashchange",r),mv.history.pushState=n,mv.history.replaceState=l}}},[o,t,i,s,a])}var xv=200;function Tv(e){switch(void 0===e&&(e=G_.Right),e){case G_.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case G_.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case G_.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Iv(e){var t,r,i,s,o,a,l,u,d,c,h,p,_=e.survey,g=e.forceDisableHtml,v=e.posthog,f=e.style,m=void 0===f?{}:f,y=e.previewPageIndex,b=e.removeSurveyFromFocus,S=void 0===b?()=>{}:b,w=e.isPopup,k=void 0===w||w,C=e.onPreviewSubmit,E=void 0===C?()=>{}:C,x=e.onPreviewBack,T=void 0===x?()=>{}:x,I=e.onPopupSurveyDismissed,R=void 0===I?()=>{}:I,P=e.onCloseConfirmationMessage,M=void 0===P?()=>{}:P,F=e.properties,L=e.isSurveyCompleted,A=e.skipShownEvent,O=e.surveyLanguage,D=L_(null),N=Number.isInteger(y),B=function(e,t,r,i,s,o,a,l,u){var d=M_(i||0===r||e.type===Q_.ExternalSurvey),c=d[0],h=d[1],p=M_(!1),_=p[0],g=p[1],v=L_(!1),f=()=>{var t=()=>{o&&s(e),h(!1)};if(!v.current){var r=null==a?void 0:a.current;r?(v.current=!0,r.style.transition="opacity "+xv+"ms ease-out",r.style.opacity="0",setTimeout(()=>{v.current=!1,t()},250)):t()}},m=t=>{t.detail.surveyId===e.id&&f()};return F_(()=>{if(t){if(!i){var s,o=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return f();g(!0),null!=(i=e.appearance)&&i.autoDisappear&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},a=()=>{if(Fg(e,t)){h(!0),mv.dispatchEvent(new Event("PHSurveyShown")),l||t.capture(J_.SHOWN,n({[X_.SURVEY_NAME]:e.name,[X_.SURVEY_ID]:e.id,[X_.SURVEY_ITERATION]:e.current_iteration,[X_.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},u&&{[X_.SURVEY_LANGUAGE]:u},{sessionRecordingUrl:null==t.get_session_replay_url?void 0:t.get_session_replay_url()}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};Ws(mv,"PHSurveyClosed",m),Ws(mv,"PHSurveySent",o);var d=r>0?setTimeout(a,r):void 0;return Rt(d)&&a(),()=>{Rt(d)||clearTimeout(d),Rt(s)||clearTimeout(s),mv.removeEventListener("PHSurveyClosed",m),mv.removeEventListener("PHSurveySent",o)}}}else rg.error("usePopupVisibility hook called without a PostHog instance.")},[]),Ev({survey:e,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:i,posthog:t}),{isPopupVisible:c,isSurveySent:_,setIsPopupVisible:h,hidePopupWithAnimation:f}}(_,v,null!=(t=_.appearance)&&t.surveyPopupDelaySeconds?1e3*_.appearance.surveyPopupDelaySeconds:0,N,S,k,D,A,O),q=B.isPopupVisible,H=B.hidePopupWithAnimation,U=B.isSurveySent||y===_.questions.length||!0===L,W=M_(!1),z=W[0],V=W[1],j=A_(()=>!!Og(_),[_]),G=!!(null!=(r=_.appearance)&&r.introScreenHeader||null!=(i=_.appearance)&&i.introScreenDescription),Q=N?-1===y:!(null==(s=_.appearance)||!s.displayIntroScreen)&&G&&!z&&!j,K=A_(()=>{var e,t=(null==(e=Og(_))?void 0:e.surveySubmissionId)||va();return{isPreviewMode:N,previewPageIndex:y,onPopupSurveyDismissed(){O?wg(_,v,N,O):wg(_,v,N),R()},isPopup:k||!1,surveySubmissionId:t,onPreviewSubmit:E,onPreviewBack:T,posthog:v,properties:F,surveyLanguage:O}},[N,y,k,v,_,R,E,T,F,O]);return q?Hg(Rg.Provider,{value:K,children:Hg("div",{className:"ph-survey",style:n({},$g(_.type,null==(o=_.appearance)?void 0:o.position,null==(a=_.appearance)?void 0:a.widgetType),m),ref:D,children:U?Hg(tv,{header:(null==(l=_.appearance)?void 0:l.thankYouMessageHeader)||"Thank you!",description:(null==(u=_.appearance)?void 0:u.thankYouMessageDescription)||"",forceDisableHtml:!!g,contentType:null==(d=_.appearance)?void 0:d.thankYouMessageDescriptionContentType,appearance:_.appearance||gg,onClose(){H(),M()}}):Q?Hg(rv,{header:(null==(c=_.appearance)?void 0:c.introScreenHeader)||"",description:(null==(h=_.appearance)?void 0:h.introScreenDescription)||"",forceDisableHtml:!!g,contentType:null==(p=_.appearance)?void 0:p.introScreenDescriptionContentType,appearance:_.appearance||gg,onStart:()=>V(!0)}):Hg(Rv,{survey:_,forceDisableHtml:!!g,posthog:v})})}):null}function Rv(e){var t,r,i=e.survey,s=e.forceDisableHtml,o=e.posthog,a=A_(()=>{var e=Og(i);if(!e)return null;var t=At(e.lastQuestionIndex);return!t||t&&e.lastQuestionIndex>=0&&i.questions.length>e.lastQuestionIndex?e:(Ng(i),null)},[i]),l=M_(()=>(null!=a&&a.responses&&rg.info("Survey is already in progress, filling in initial responses"),(null==a?void 0:a.responses)||{})),u=l[0],d=l[1],c=O_(Rg),h=c.previewPageIndex,p=c.onPopupSurveyDismissed,_=c.isPopup,g=c.onPreviewSubmit,v=c.onPreviewBack,f=c.surveySubmissionId,m=c.isPreviewMode,y=c.properties,b=c.surveyLanguage,S=M_(()=>{var e=null==a?void 0:a.lastQuestionIndex,t=At(e)&&e>=0&&i.questions.length>e?e:0;return At(h)&&h>=0?h:t}),w=S[0],k=S[1],C=M_(()=>{var e;return(null!==(e=null==a?void 0:a.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&i.questions.length>e)}),E=C[0],x=C[1],T=M_(()=>{var e,t;return null!==(e=null==(t=Og(i))?void 0:t.questionSnapshots)&&void 0!==e?e:{}}),I=T[0],R=T[1],P=A_(()=>xg(Tg(i,a)),[i.id,a]),M=A_(()=>{if(!P||new Set(P).size!==P.length)return Tg(i,a);var e=new Map(i.questions.map(e=>[e.id,e])),t=P.map(t=>e.get(t)).filter(e=>!!e);return t.length===P.length?t:i.questions},[P,i.questions,i,a]);F_(()=>{!m||Rt(h)||0>h||k(h)},[h,m]);var F=!(null==(t=i.appearance)||!t.allowGoBack)&&(m?(null!=h?h:0)>0:E.length>0),L=M.at(w);return L?Hg("form",{className:"survey-form",name:"surveyForm",children:[_&&!0!==(null==(r=i.appearance)?void 0:r.hideCancelButton)&&Hg(Xg,{onClick(){p()}}),Hg("div",{className:"survey-box","data-question-index":w,children:Mv({question:L,forceDisableHtml:s,displayQuestionIndex:w,appearance:i.appearance||gg,onSubmit:e=>(e=>{var t=e.res,r=e.displayQuestionIndex,s=e.questionId;if(o)if(s){var a=Ha(s),l=n({},u,{[a]:t});d(l);var c=M[r],h=null!=c&&c.id?n({},I,{[c.id]:c.question}):I;R(h);var p=gv(i,r,t),_=p===Z_.End,g=[...E,r];if(_||(x(g),k(p),Ag(i,{surveySubmissionId:f,responses:l,lastQuestionIndex:p,questionOrder:xg(M),visitedIndices:g,surveyLanguage:b,questionSnapshots:h})),i.enable_partial_responses||_){var v=new Set(g.map(e=>{var t;return null==(t=M[e])?void 0:t.id}).filter(e=>!!e).map(e=>Ha(e)));bg({responses:Object.fromEntries(Object.entries(l).filter(e=>v.has(e[0]))),survey:i,surveySubmissionId:f,isSurveyCompleted:_,posthog:o,properties:y,surveyLanguage:b,questionSnapshots:h})}}else rg.error("onNextButtonClick called without a questionId.");else rg.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:w,questionId:L.id}),onPreviewSubmit:g,initialValue:L.id?u[Ha(L.id)]:void 0,canGoBack:F,onBack(){if(m)v();else if(0!==E.length){var e=E[E.length-1],t=E.slice(0,-1);x(t),k(e),Ag(i,{surveySubmissionId:f,responses:u,lastQuestionIndex:e,questionOrder:xg(M),visitedIndices:t,surveyLanguage:b,questionSnapshots:I})}}})})]}):null}function Pv(e){var t,r,i,s,n,o,a,l=e.survey,u=e.forceDisableHtml,d=e.posthog,c=e.readOnly,h=e.surveyLanguage,p=M_(!0),_=p[0],g=p[1],v=M_(!1),f=v[0],m=v[1],y=M_({}),b=y[0],S=y[1],w=L_(void 0),k=()=>{m(!f)};if(F_(()=>{var e;if(d){if(!c){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&S({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(rg.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),k())};return Ws(mv,bv,t),()=>{Rt(w.current)||(clearTimeout(w.current),w.current=void 0),mv.removeEventListener(bv,t)}}}else rg.error("FeedbackWidget called without a PostHog instance.")},[d,c,l.id,null==(t=l.appearance)?void 0:t.widgetType,null==(r=l.appearance)?void 0:r.widgetSelector,null==(i=l.appearance)?void 0:i.borderColor]),Ev({survey:l,setSurveyVisible:g,posthog:d}),!_)return null;var C=()=>{l.schedule!==Y_.Always&&g(!1),Rt(w.current)||clearTimeout(w.current),w.current=setTimeout(()=>{w.current=void 0,m(!1)},200)};return Hg(e_,{children:["tab"===(null==(s=l.appearance)?void 0:s.widgetType)&&Hg("button",{className:"ph-survey-widget-tab "+((null==(n=l.appearance)?void 0:n.tabPosition)===G_.Top?"widget-tab-top":""),onClick:k,disabled:c,style:Tv(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&Hg(Iv,{posthog:d,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:C,onCloseConfirmationMessage:C,surveyLanguage:h})]})}var Mv=e=>{var t=e.question,r=e.displayQuestionIndex,i=e.onSubmit,s=e.onPreviewSubmit,o={forceDisableHtml:e.forceDisableHtml,appearance:e.appearance,onPreviewSubmit(e){s(e)},onSubmit(e){i(e)},initialValue:e.initialValue,displayQuestionIndex:r,canGoBack:e.canGoBack,onBack:e.onBack};switch(t.type){case K_.Open:return Jp(sv,n({},o,{question:t,key:t.id}));case K_.Link:return Jp(nv,n({},o,{question:t,key:t.id}));case K_.Rating:return Jp(ov,n({},o,{question:t,key:t.id}));case K_.SingleChoice:case K_.MultipleChoice:return Jp(lv,n({},o,{question:t,key:t.id}));default:return rg.error("Unsupported question type: "+t.type),null}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.generateSurveys=Cv,b.extendPostHogWithSurveys=Cv;var Fv=e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e},Lv=1e4,Av=(e,t,r)=>r.remaining>0?t.length>r.remaining?(e.push(t.slice(0,r.remaining)),r.remaining=0,r.truncated=!0,!1):(e.push(t),r.remaining-=t.length,!0):(r.truncated=!0,!1),Ov=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return Av(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var s=0,n=Math.min(e.length,r.remaining-2);n>s;){var o=Math.ceil((s+n)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?n=o-1:s=o}return Av(t,JSON.stringify(e.slice(0,s)),r)},Dv=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Nv=(e,t,r)=>{if(!r.truncated){if(r.keysRemaining-=1,r.sizeRemaining-=String(t).length+e.length,0>=r.keysRemaining||0>=r.sizeRemaining)return r.truncated=!0,void(r.result.attributes_truncated=!0);r.result[e]=t}},Bv=(e,t,r)=>{if(!r.truncated)if(Tt(e)){if(r.seen.has(e))return void Nv(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(Bv(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else Nv(t,e,r)},$v=function(e,t,r,i,s,n){if(void 0===s&&(s=!1),!Dv(e))return!s||Av(t,"null",r);if(Ft(e)||(e=>{try{return At(e)||Dt(e)}catch(e){return!1}})(e))return Av(t,JSON.stringify(e),r);if("string"==typeof e)return Ov(e,t,r);if(!Tt(e)&&!Et(e))return Av(t,JSON.stringify(e),r);if(i.has(e))return Ov("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(xt(o))return $v(o.call(e),t,r,i,s)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return Ov(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return Av(t,JSON.stringify(e.valueOf()),r)}catch(e){}if(e instanceof Error){var l={};try{for(var u in e)({}).hasOwnProperty.call(e,u)&&(l[u]=e[u])}catch(e){}try{l.name=e.name}catch(e){}try{l.message=e.message}catch(e){}try{l.stack=e.stack}catch(e){}return $v(l,t,r,i,s,n)}if(Et(e)){if(!Av(t,"[",r))return!1;for(var d=0;e.length>d;d++){if(d>0&&!Av(t,",",r))return!1;var c=void 0;try{c=e[d]}catch(e){c=void 0}if(!$v(c,t,r,i,!0))return!1}return Av(t,"]",r)}if(!Av(t,"{",r))return!1;var h=!0;try{for(var p in e)if({}.hasOwnProperty.call(e,p)){if(0>=r.remaining)return r.truncated=!0,!1;var _=void 0;try{_=e[p]}catch(e){continue}if(n)try{Bv(_,p,n)}catch(e){}if(Dv(_)){var g=(h?"":",")+JSON.stringify(p)+":";if(g.length>=r.remaining)return r.truncated=!0,!1;var v=t.length,f=r.remaining,m=r.truncated;if(!Av(t,g,r))return!1;var y=t.length,b=$v(_,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=v,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return Av(t,"}",r)},qv=(e,t)=>{for(var r=[],i={remaining:t,truncated:!1},s=Tt(e[0])?{result:{},keysRemaining:50,sizeRemaining:Lv,truncated:!1,seen:new WeakSet([e[0]])}:void 0,n=0;e.length>n&&(0>=n||Av(r," ",i))&&$v(e[n],r,i,new WeakSet,!1,0===n?s:void 0);n++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==s?void 0:s.result)||{}}},Hv={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Uv=e=>"canCapture"in e,Wv=e=>Uv(e)?e.canCapture?e.getExtension(dg):void 0:e.is_capturing()?e.logs:void 0;b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.logs={initializeLogs(e){var t=e,r=[],i={host:b.location.host},s=!1,o=function(e){var o=b.console[e];r.push(tp(b.console,e,r=>{var a=(r=>function(){for(var o=!1,a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];try{var d=t;if(l.length>0&&!s&&d){var c=Wv(d);if(c){s=!0,o=!0;var h=qv(l,Lv),p=h.body,_=h.attributes,g=n({},i,h.truncated?{body_truncated:"true"}:{});((e,t,r)=>{if(Uv(e))t.captureConsoleLog(r);else{var i=(e=>{var t=/^1\.(\d+)\.(\d+)$/.exec(e);if(t){var r=Number(t[1]),i=Number(t[2]);if(r>=392&&419>=r)return 410===r?i>4?i>10?void 0:"de":"le":418===r?i>3?i>10?i>14?i>17?void 0:"vi":"ci":"ui":"he":419===r?i>2?void 0:"vi":410>r?"le":"he"}})(e.version),s=i?t[i]:void 0;xt(s)&&s.call(t,r)}})(d,c,{level:Hv[e],body:p,attributes:n({"log.source":"console."+e},g,_)})}}}catch(e){}finally{o&&(s=!1),r.apply(b.console,l)}})(r);return a.__rrweb_original__=Fv(o),a}))};for(var a of Object.keys(Hv))o(a);return()=>{t=void 0,r.forEach(e=>e())}},replayConsoleBuffer(e,t){var r=Wv(e);if(r)for(var i of t)try{var s=qv(i.args,Lv);null==r.captureBufferedConsoleLog||r.captureBufferedConsoleLog({level:Hv[i.level],body:s.body,attributes:n({"log.source":"console."+i.level,host:b.location.host},s.truncated?{body_truncated:"true"}:{},s.attributes)},i.context,i.occurredAtMs)}catch(e){}}};var zv=e=>Ut(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),Vv=Fs("[Error tracking]"),jv="webkit-masked-url:",Gv=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Qv=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",jv],Kv=["__firefox__","__gCrWeb"];function Zv(){return new pi([new Mi,new Hi,new Li,new Fi,new $i,new Bi,new Oi,new qi],function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var s=[],o=t.split("\n"),a=Math.min(o.length,i+1e3),l=[],u=i;a>u;u++){var d=o[u];if(1024>=d.length){var c=ki.test(d)?d.replace(ki,"$1"):d;if(!c.match(/\S*Error: /)){for(var h of r){var p=h(c,e);if(p){s.push(p);var _=Ei(s);if(_){for(var g=l.length-1;g>=0;g--){var v=l[g];if(_.start>=v.start+v.length)break;l.pop()}l.push(_)}break}}if(Ri(s,l)>=50)break}}}var f=[...l].sort((e,t)=>t.start-e.start),m=f[f.length-1];if(m){var y=Ti(s,m);for(var b of(s.splice(m.start-y,y),f))b.start-=y}for(var S of f)xi(s,S);return l.some(e=>0===e.start&&s.length===e.length)&&function(e){for(var t=e.map(e=>e.function+"|"+e.filename+"|"+e.lineno+"|"+e.colno+"|"+e.module),r=0,i=1;t.length>i;i++)Pi(t,i,r)&&(r=i);e.push(...e.splice(0,r))}(s),function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return n({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||"?"});var r})}(s)}}("web:javascript",yi,wi))}var Yv=Fs("[ExceptionAutocapture]"),Jv=Zv(),Xv=(e,t)=>{try{return e()}catch(e){return t}},ef=(e,t)=>Xv(()=>e(t()),void 0),tf=e=>Xv(()=>xt(e)&&xt(e.call),!1),rf=(e,t)=>Xv(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),sf=(e,t,r)=>{Xv(()=>{var r;null==(r=e[t])||delete r.__POSTHOG_INSTRUMENTED__},void 0),Xv(()=>{e[t]=r},void 0)},nf=e=>{var t=l;t||Yv.info("window not available, cannot wrap onerror");var r=Xv(()=>t.onerror,void 0);return t.onerror=function(){for(var t,i=arguments.length,s=new Array(i),n=0;i>n;n++)s[n]=arguments[n];return ef(e,()=>Jv.buildFromUnknown((e=>{var t=e[0],r=e[1],i=e[2],s=e[3],n=e[4];if(null!=n)return n;if(Pt(t)&&Pt(r)&&r.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:r,lineno:i,colno:s})}catch(e){return t}return t})(s),{mechanism:{handled:!1}})),!!tf(r)&&null!==(t=r(...s))&&void 0!==t&&t},rf(t,"onerror"),()=>sf(t,"onerror",r)},of=function(e,t){void 0===t&&(t=!1);var r=l;r||Yv.info("window not available, cannot wrap onUnhandledRejection");var i=Xv(()=>r.onunhandledrejection,void 0);return r.onunhandledrejection=function(r){var s;return ef(e,()=>Jv.buildFromUnknown(r,{mechanism:{handled:!1}})),tf(i)?null!==(s=i(r))&&void 0!==s&&s:t},rf(r,"onunhandledrejection"),()=>sf(r,"onunhandledrejection",i)},af={wrapOnError:nf,wrapUnhandledRejection:of,wrapConsoleError(e){var t=console;t||Yv.info("console not available, cannot wrap console.error");var r=Xv(()=>t.error,void 0);return t.error=function(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];ef(e,()=>{var e;e=1==i.length?i[0]:i.join(" ");var t=i.find(e=>e instanceof Error);return Jv.buildFromUnknown(t||e,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),tf(r)&&r(...i)},rf(t,"error"),()=>sf(t,"error",r)}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.errorWrappingFunctions=af,b.posthogErrorWrappingFunctions=af;var lf=(e,t)=>{if(xt(null==e?void 0:e.capture)){var r=null==t?void 0:t.autocaptureExceptions,i=!Ft(r)&&"object"==typeof r&&Et(r.errors_to_ignore)?r.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){Yv.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],s=t=>{try{null==e.capture||e.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){Yv.error("Failed to capture exception for a legacy client",e)}};nf(e=>{i.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||s(e)}),of(s,!0)}};b.extendPostHogWithExceptionAutoCapture=lf,b.extendPostHogWithExceptionAutocapture=lf;var uf="X-POSTHOG-SESSION-ID",df="X-POSTHOG-WINDOW-ID",cf="X-POSTHOG-DISTINCT-ID",hf=[uf,df,cf],pf=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],_f=(e,t)=>({}.hasOwnProperty.call(e,t)),gf=e=>"object"==typeof e&&!Ft(e)||xt(e),vf=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),ff=e=>{try{var t;return vf(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==l||null==(t=l.location)?void 0:t.href).toString()}catch(e){return}},mf=(e,t,r,i,s)=>{var n;try{n=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(Et(e)&&!e.includes(n))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;s.set(uf,a.sessionId),s.set(df,l),o=!0}var u=(e=>xt(e)?e():e)(t);return u&&"$posthog_cookieless"!==u&&(s.set(cf,u),o=!0),o};b.__PosthogExtensions__=b.__PosthogExtensions__||{};var yf={_patchFetch:(e,t,r)=>tp(l,"fetch",i=>function(s,o){var a=arguments.length>1?[s,o]:[s],l=a;try{var u=ff(s);if(u)if(vf(s)){var d=new Request(s,o);mf(e,t,r,d.url,d.headers),l=[d]}else{var c=new Headers(gf(o)?o.headers:void 0);if(mf(e,t,r,u,c)){var h=((e,t)=>{if(Rt(e)||Ft(e))return{headers:t};if(gf(e)){var r=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){var i=Object.create(r);return Object.defineProperty(i,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),i}return new Proxy({headers:t},{get:(e,t)=>_f(e,t)?Reflect.get(e,t):Reflect.get(r,t,r),has:(e,t)=>_f(e,t)||t in r,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(r).forEach(e=>t.add(e)),pf.forEach(e=>{e in r&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i)return i;if("string"==typeof t&&pf.includes(t)&&t in r)return{configurable:!0,enumerable:!0,get(){return Reflect.get(r,t,r)}};var s=Reflect.getOwnPropertyDescriptor(r,t);return s?n({},s,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}})(o,c);h&&(l=[s,h])}}}catch(e){l=a}return i.apply(this,l)}),_patchXHR:(e,t,r)=>tp(l.XMLHttpRequest.prototype,"open",i=>function(s,n,o,a,l){void 0===o&&(o=!0);var u=this,d=new Headers,c=ff(n);c&&mf(e,t,r,c,d);var h=i.call(u,s,n,o,a,l);return hf.forEach(e=>{var t=d.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}}),h})};b.__PosthogExtensions__.tracingHeadersPatchFns=yf,b.postHogTracingHeadersPatchFns=yf,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){var t=this.length,r=Math.trunc(e)||0;return 0>r&&(r+=t),0>r||r>=t?void 0:this[r]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(var r=this.length-1;r>=0;r--){var i=this[r];if(e.call(t,i,r,this))return i}},writable:!0,enumerable:!1,configurable:!0});var bf=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(!e.hadRecentInput){var r=this.i[0],i=this.i.at(-1);this.o&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null==(t=this.t)||t.call(this,e)}}},Sf=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},wf=e=>{if("loading"===document.readyState)return"loading";var t=Sf();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},kf=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Cf=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i,s=e,n=s.id?"#"+s.id:[kf(s),...Array.from(null!==(i=s.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,s.id)break;e=s.parentNode}}catch(e){}return t},Ef=new WeakMap;function xf(e,t){var r=Ef.get(t);return r||Ef.set(t,r=new WeakMap),r.get(e)||r.set(e,new t),r.get(e)}var Tf,If=-1,Rf=()=>If,Pf=e=>{addEventListener("pageshow",t=>{t.persisted&&(If=t.timeStamp,e(t))},!0)},Mf=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Ff=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Lf=()=>{var e,t;return null!==(e=null==(t=Sf())?void 0:t.activationStart)&&void 0!==e?e:0},Af=-1,Of=new Set,Df=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Nf=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Of)t();isFinite(Af)||(Af="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Nf,!0))}},Bf=function(e){if(void 0===e&&(e=!1),e&&(Af=1/0),0>Af){var t,r,i=Lf();Af=null!==(t=document.prerendering||null==(r=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=i))?void 0:r.startTime)&&void 0!==t?t:Df(),addEventListener("visibilitychange",Nf,!0),addEventListener("prerenderingchange",Nf,!0),Pf(()=>{setTimeout(()=>{Af=Df()})})}return{get firstHiddenTime(){return Af},onHidden(e){Of.add(e)}}},$f=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=Sf(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Rf()?a&&(document.prerendering||Lf()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},qf=function(e,t,r){void 0===r&&(r={});try{var i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){var s=new PerformanceObserver(e=>{queueMicrotask(()=>{var r=e.getEntries();i.length>1&&r.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(r)})});for(var o of i)s.observe(n({type:o,buffered:!0},r));return s}}catch(e){}},Hf=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Uf=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Wf=e=>{var t=!1;return()=>{t||(e(),t=!0)}},zf=class{constructor(){this.u=void 0}},Vf=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},jf=[1800,3e3],Gf=function(e,t){void 0===t&&(t={});var r=Hf(t);Vf(()=>{var i,s=xf(t,zf),n=Bf(),o=$f("FCP"),a=qf(["paint"],e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Lf(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))});a&&(i=Mf(e,o,jf,t.reportAllChanges),Pf(r=>{o=$f("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Rf()),i=Mf(e,o,jf,t.reportAllChanges),Ff(()=>{o.value=performance.now()-r.timeStamp,i(!0)})})),r&&qf(["soft-navigation"],r=>{r.forEach(r=>{s.u&&r.navigationId&&Uf(s.u,r),o=$f("FCP",Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0),"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=Mf(e,o,jf,t.reportAllChanges))(!0)})},t)})},Qf=[.1,.25],Kf=e=>e.find(e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)})||e[0],Zf=function(e,t){void 0===t&&(t={});var r=xf(t=Object.assign({},t),bf),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var s=Kf(e.sources),n=null==s?void 0:s.node;if(n){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(n))&&void 0!==o?o:Cf(n);i.set(s,a)}}},function(e,t){void 0===t&&(t={});var r=Bf();Gf(Wf(()=>{var i,s=$f("CLS",0),n=xf(t,bf),o=(r,o,a,l,u)=>{s=$f("CLS",0,r,o,a,l,u),n.o=0,i=Mf(e,s,Qf,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.o>s.value&&(s.value=n.o,s.entries=n.i),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?n.l(t):l(t);a()},d=["layout-shift"];Hf(t)&&d.push("soft-navigation");var c=qf(d,u);c&&(i=Mf(e,s,Qf,t.reportAllChanges),r.onHidden(()=>{u(c.takeRecords()),i(!0)}),Pf(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Rf()),Ff(i)}),setTimeout(i))}))}(t=>{e((e=>{var t={};if(e.entries.length){var r,s=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null!=s&&null!=(r=s.sources)&&r.length){var n=Kf(s.sources);n&&(t={largestShiftTarget:i.get(n),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:n,largestShiftEntry:s,loadState:wf(s.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Yf=function(e,t){void 0===t&&(t={});var r=xf(t=Object.assign({},t),zf);Hf(t)&&(r.u=new Map),Gf(t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:wf(Rf())};if("soft-navigation"!==e.navigationType){if(e.entries.length){var i=Sf(),s=e.entries.at(-1);if(i){var n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:wf(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}else{var o,a=null==(o=r.u)?void 0:o.get(e.navigationId);a&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:a})}return Object.assign(e,{attribution:t})})(t))},t)},Jf=0,Xf=1/0,em=0,tm=e=>{for(var t of e)t.interactionId&&(Xf=Math.min(Xf,t.interactionId),em=Math.max(em,t.interactionId),Jf=em?(em-Xf)/7+1:0)},rm=()=>{var e;return Tf?Jf:null!==(e=performance.interactionCount)&&void 0!==e?e:0},im=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return rm()-this.h}D(){this.h=rm(),this.v.length=0,this.p.clear()}S(e){var t=this.T(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{k:8,id:-1,entries:[]}}l(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.p.get(e.interactionId);if(i||10>this.v.length||e.duration>r.k){var s;if(i?e.duration>i.k?(i.entries=[e],i.k=e.duration):e.duration===i.k&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.p.set((i={id:e.interactionId,entries:[e],k:e.duration}).id,i),this.v.push(i)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10)for(var n of this.v.splice(10))this.p.delete(n.id);null==(s=this.M)||s.call(this,i)}}}},sm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=Wf(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},nm=[200,500],om=function(e,t){void 0===t&&(t={});var r=xf(t=Object.assign({},t),im),i=[],s=[],o=0,a=new WeakMap,l=new WeakMap,u=!1,d=()=>{u||(sm(c),u=!0)},c=()=>{var e=new Set(r.v.map(e=>a.get(e.entries[0]))),t=s.length-10;s=s.filter((r,i)=>i>=t||e.has(r));var n=new Set;for(var l of s)for(var d of h(l.startTime,l.processingEnd))n.add(d);i=i.filter(e=>e.startTime>o||n.has(e)),u=!1};r.m=e=>{var r,i=e.startTime+e.duration;o=Math.max(o,e.processingEnd);for(var n=s.length-1;n>=0;n--){var l=s[n];if(8>=Math.abs(i-l.renderTime)){(r=l).startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||s.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]}),e.interactionId&&a.set(e,r),d()},r.M=e=>{if(!l.get(e)){var r,i=null==(r=e.entries.find(e=>e.target))?void 0:r.target;if(i){var s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==s?s:Cf(i);l.set(e,n)}else{var o,a=null==(o=e.entries.find(e=>e.targetSelector))?void 0:o.targetSelector;a&&l.set(e,a)}}};var h=(e,t)=>{var r=[];for(var s of i)if(s.startTime+s.duration>=e){if(s.startTime>t)break;r.push(s)}return r};qf(["long-animation-frame"],e=>{i=i.concat(e),d()},t),function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Bf();Vf(()=>{var i;"interactionCount"in performance||Tf||(Tf=qf(["event"],tm,{durationThreshold:0}));var s,o=$f("INP"),a=xf(t,im),l=(r,i,n,l,u)=>{a.D(),o=$f("INP",-1,r,i,n,l,u),s=Mf(e,o,nm,t.reportAllChanges)},u=()=>{var e=a.S(o.navigationType);e&&e.k!==o.value&&(o.value=e.k,o.entries=e.entries,s())},d=e=>{u(),s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),sm(()=>{for(var r of e)"soft-navigation"!==r.entryType?a.l(r):d(r);u(),t&&s(!0)})},h=["event","first-input"];Hf(t)&&h.push("soft-navigation");var p=qf(h,c,n({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=Mf(e,o,nm,t.reportAllChanges),p&&(r.onHidden(()=>{c(p.takeRecords(),!0)}),Pf(()=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Rf())}))})}}(t=>{e((e=>{if(0===e.entries.length){var t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:wf(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}var i=e.entries[0],s=a.get(i),n=Math.max(s.processingStart,i.startTime),o=Math.max(i.startTime+i.duration,n),u=Math.min(s.processingEnd,o),d=s.entries.sort((e,t)=>e.processingStart-t.processingStart),c=h(i.startTime,u),p=r.p.get(i.interactionId),_={interactionTarget:l.get(p),interactionType:i.name.startsWith("key")?"keyboard":"pointer",interactionTime:i.startTime,nextPaintTime:o,processedEventEntries:d,longAnimationFrameEntries:c,inputDelay:n-i.startTime,processingDuration:u-n,presentationDelay:o-u,loadState:wf(i.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return((e,t)=>{var r=e.interactionTime,i=e.nextPaintTime;if(null!=(t=e.longAnimationFrameEntries)&&t.length&&r&&i){var s,n,o=e.inputDelay,a=e.processingDuration,l=0,u=0,d=0,c=0;for(var h of e.longAnimationFrameEntries)for(var p of(u=u+h.startTime+h.duration-h.styleAndLayoutStart,h.scripts)){var _=p.startTime+p.duration;if(_>=r){var g=_-Math.max(r,p.startTime),v=p.duration?g/p.duration*p.forcedStyleAndLayoutDuration:0;l+=g-v,u+=v,g>c&&(n=r+o>p.startTime?"input-delay":r+o+a>p.startTime?"processing-duration":"presentation-delay",s=p,c=g)}}var f=e.longAnimationFrameEntries.at(-1),m=f?f.startTime+f.duration:0;m>=r+o+a&&(d=i-m),s&&n&&(e.longestScript={entry:s,subpart:n,intersectingDuration:c}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=u,e.totalPaintDuration=d,e.totalUnattributedDuration=i-r-l-u-d}})(_),Object.assign(e,{attribution:_})})(t))},t)},am=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null==(t=this.m)||t.call(this,e)}},$=[2500,4e3],lm=50,um=[];qf(["resource"],e=>{for(var t of e)um.push(t),um.length>lm&&um.shift()});var dm=function(e,t){void 0===t&&(t={}),null!=(t=Object.assign({},t)).resourceBufferSize&&(lm=t.resourceBufferSize);var r=xf(t,am),i=new WeakMap;Hf(t)&&(r.u=new Map),r.m=e=>{var r=e.element;if(r){var s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==s?s:Cf(r);i.set(e,n)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={});var r=!1,i=Hf(t);Vf(()=>{var s,n=Bf(),o=$f("LCP"),a=xf(t,am),l=(i,a,l,u,d)=>{o=$f("LCP",-1,i,a,l,u,d),s=Mf(e,o,$,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=Bf(!0))},u=e=>{a.u&&e.navigationId&&Uf(a.u,e),r||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&d([t])},d=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,d=[],c=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-Lf(),0),a.l(r),d=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;c=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(c-r.startTime,0),p.largestContentfulPaint&&(a.l(p.largestContentfulPaint),d=[p.largestContentfulPaint])}n.firstHiddenTime>c&&(o.value=l,o.entries=d,s())}else u(r)},c=["largest-contentful-paint"];i&&c.push("interaction-contentful-paint","soft-navigation");var h=qf(c,d);if(h){s=Mf(e,o,$,t.reportAllChanges);var p=["keydown","click","visibilitychange"],_=e=>{if(e.isTrusted&&!r){var t=o.id;sm(()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,_,{capture:!0});t===o.id&&(r=!0,s(!0))}})}};for(var g of p)addEventListener(g,_,{capture:!0});Pf(i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Rf()),s=Mf(e,o,$,t.reportAllChanges),Ff(()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)})})}})}(t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var s,o,a,l,u,d,c=e.entries.at(-1),h=c.url&&(um.findLast(e=>e.name===c.url)||performance.getEntriesByType("resource").findLast(e=>e.name===c.url));t.target=i.get(c),t.lcpEntry=c,c.url&&(t.url=c.url),h&&(t.lcpResourceEntry=h);var p=0,_=0;if("soft-navigation"!==e.navigationType?(p=null!==(s=null==(o=d=Sf())?void 0:o.activationStart)&&void 0!==s?s:0,_=null!==(a=null==(l=d)?void 0:l.responseStart)&&void 0!==a?a:0):(p=e.navigationStartTime||0,d=null==(u=r.u)?void 0:u.get(e.navigationId)),d){var g=Math.max(0,_-p),v=Math.max(g,h?(h.requestStart||h.startTime)-p:0),f=Math.min(e.value,Math.max(v,h?h.responseEnd-p:0));t=n({},t,{timeToFirstByte:g,resourceLoadDelay:v-g,resourceLoadDuration:f-v,elementRenderDelay:e.value-f,navigationEntry:d})}}return Object.assign(e,{attribution:t})})(t))},t)},cm=-1,hm=()=>cm,pm=e=>{addEventListener("pageshow",t=>{t.persisted&&(cm=t.timeStamp,e(t))},!0)},_m=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},gm=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},vm=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},fm=()=>{var e,t;return null!==(e=null==(t=vm())?void 0:t.activationStart)&&void 0!==e?e:0},mm=-1,ym=new Set,bm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Sm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of ym)t();isFinite(mm)||(mm="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Sm,!0))}},wm=function(e){if(void 0===e&&(e=!1),e&&(mm=1/0),0>mm){var t,r,i=fm();mm=null!==(t=document.prerendering||null==(r=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=i))?void 0:r.startTime)&&void 0!==t?t:bm(),addEventListener("visibilitychange",Sm,!0),addEventListener("prerenderingchange",Sm,!0),pm(()=>{setTimeout(()=>{mm=bm()})})}return{get firstHiddenTime(){return mm},onHidden(e){ym.add(e)}}},km=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=vm(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>hm()?a&&(document.prerendering||fm()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},Cm=new WeakMap;function Em(e,t){var r=Cm.get(t);return r||Cm.set(t,r=new WeakMap),r.get(e)||r.set(e,new t),r.get(e)}var xm,Tm=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}},Im=function(e,t,r){void 0===r&&(r={});try{var i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){var s=new PerformanceObserver(e=>{queueMicrotask(()=>{var r=e.getEntries();i.length>1&&r.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(r)})});for(var o of i)s.observe(n({type:o,buffered:!0},r));return s}}catch(e){}},Rm=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Pm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Mm=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Fm=class{constructor(){this.l=void 0}},Lm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Am=[1800,3e3],Om=function(e,t){void 0===t&&(t={});var r=Rm(t);Lm(()=>{var i,s=Em(t,Fm),n=wm(),o=km("FCP"),a=Im(["paint"],e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-fm(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))});a&&(i=_m(e,o,Am,t.reportAllChanges),pm(r=>{o=km("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,hm()),i=_m(e,o,Am,t.reportAllChanges),gm(()=>{o.value=performance.now()-r.timeStamp,i(!0)})})),r&&Im(["soft-navigation"],r=>{r.forEach(r=>{s.l&&r.navigationId&&Pm(s.l,r),o=km("FCP",Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0),"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=_m(e,o,Am,t.reportAllChanges))(!0)})},t)})},Dm=[.1,.25],Nm=function(e,t){void 0===t&&(t={});var r=wm();Om(Mm(()=>{var i,s=km("CLS",0),n=Em(t,Tm),o=(r,o,a,l,u)=>{s=km("CLS",0,r,o,a,l,u),n.i=0,i=_m(e,s,Dm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.i>s.value&&(s.value=n.i,s.entries=n.o),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?n.h(t):l(t);a()},d=["layout-shift"];Rm(t)&&d.push("soft-navigation");var c=Im(d,u);c&&(i=_m(e,s,Dm,t.reportAllChanges),r.onHidden(()=>{u(c.takeRecords()),i(!0)}),pm(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,hm()),gm(i)}),setTimeout(i))}))},Bm=0,$m=1/0,qm=0,Hm=e=>{for(var t of e)t.interactionId&&($m=Math.min($m,t.interactionId),qm=Math.max(qm,t.interactionId),Bm=qm?(qm-$m)/7+1:0)},Um=()=>{var e;return xm?Bm:null!==(e=performance.interactionCount)&&void 0!==e?e:0},Wm=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Um()-this.u}M(){this.u=Um(),this.v.length=0,this.m.clear()}L(e){var t=this._(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{P:8,id:-1,entries:[]}}h(e){var t;if(null!=(t=this.p)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.m.get(e.interactionId);if(i||10>this.v.length||e.duration>r.P){var s;if(i?e.duration>i.P?(i.entries=[e],i.P=e.duration):e.duration===i.P&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.m.set((i={id:e.interactionId,entries:[e],P:e.duration}).id,i),this.v.push(i)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10)for(var n of this.v.splice(10))this.m.delete(n.id);null==(s=this.T)||s.call(this,i)}}}},zm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=Mm(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},Vm=[200,500],jm=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=wm();Lm(()=>{var i;"interactionCount"in performance||xm||(xm=Im(["event"],Hm,{durationThreshold:0}));var s,o=km("INP"),a=Em(t,Wm),l=(r,i,n,l,u)=>{a.M(),o=km("INP",-1,r,i,n,l,u),s=_m(e,o,Vm,t.reportAllChanges)},u=()=>{var e=a.L(o.navigationType);e&&e.P!==o.value&&(o.value=e.P,o.entries=e.entries,s())},d=e=>{u(),s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),zm(()=>{for(var r of e)"soft-navigation"!==r.entryType?a.h(r):d(r);u(),t&&s(!0)})},h=["event","first-input"];Rm(t)&&h.push("soft-navigation");var p=Im(h,c,n({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=_m(e,o,Vm,t.reportAllChanges),p&&(r.onHidden(()=>{c(p.takeRecords(),!0)}),pm(()=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,hm())}))})}},Gm=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null==(t=this.p)||t.call(this,e)}},Qm=[2500,4e3],Km=function(e,t){void 0===t&&(t={});var r=!1,i=Rm(t);Lm(()=>{var s,n=wm(),o=km("LCP"),a=Em(t,Gm),l=(i,a,l,u,d)=>{o=km("LCP",-1,i,a,l,u,d),s=_m(e,o,Qm,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=wm(!0))},u=e=>{a.l&&e.navigationId&&Pm(a.l,e),r||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&d([t])},d=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,d=[],c=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-fm(),0),a.h(r),d=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;c=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(c-r.startTime,0),p.largestContentfulPaint&&(a.h(p.largestContentfulPaint),d=[p.largestContentfulPaint])}n.firstHiddenTime>c&&(o.value=l,o.entries=d,s())}else u(r)},c=["largest-contentful-paint"];i&&c.push("interaction-contentful-paint","soft-navigation");var h=Im(c,d);if(h){s=_m(e,o,Qm,t.reportAllChanges);var p=["keydown","click","visibilitychange"],_=e=>{if(e.isTrusted&&!r){var t=o.id;zm(()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,_,{capture:!0});t===o.id&&(r=!0,s(!0))}})}};for(var g of p)addEventListener(g,_,{capture:!0});pm(i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,hm()),s=_m(e,o,Qm,t.reportAllChanges),gm(()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)})})}})},Zm={onLCP:dm,onCLS:Zf,onFCP:Yf,onINP:om,withoutAttribution:{onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=Zm,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Zm,b.postHogWebVitalsCallbacks=Zm;var Ym={onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Ym,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Ym,b.postHogWebVitalsCallbacks=Ym,b.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Ym;var Jm={onLCP:dm,onCLS:Zf,onFCP:Yf,onINP:om,withoutAttribution:{onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Jm,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Jm,b.postHogWebVitalsCallbacks=Jm;var Xm={onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=Xm,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Xm,b.postHogWebVitalsCallbacks=Xm,b.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Xm;var ey=class{constructor(e){this.disabled=!1===e;var t=Tt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},ty="$copy_autocapture",ry=Fs("[AutoCapture]");function iy(e,t){return t.length>e?t.slice(0,e)+"...":t}function sy(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!sn(t));return t}function ny(e,t){var r,i,s=t.e,o=t.maskAllElementAttributes,a=t.maskAllText,u=t.elementAttributeIgnoreList,d=t.elementsChainAsString,c=t.disableCaptureUrlHashes;if(!sn(e))return{props:{}};for(var h=[e],p=new Set([e]),_=e;_.parentNode&&!nn(_,"body")&&1e3>h.length;)if(an(_.parentNode)){var g=_.parentNode.host;if(p.has(g))break;p.add(g),h.push(g),_=g}else{if(!sn(_.parentNode))break;if(p.has(_.parentNode))break;p.add(_.parentNode),h.push(_.parentNode),_=_.parentNode}var v="click"===s.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(e=>nn(e,"button")||nn(e,"a")):-1;v>0&&(a=a||h.slice(0,v+1).some(e=>!In(e)||Rn(e)));var f,m,y,b=[],S={},w=!1,k=!1;if(As(h,e=>{var t=In(e);if(nn(e,"a")){var r=e.getAttribute("href");w=!!(t&&r&&Nn(r))&&(c?li(r):r)}ht(dn(e),"ph-no-capture")&&(k=!0),b.push(function(e,t,r,i,s){void 0===s&&(s=!1);var n=e.tagName.toLowerCase(),o={tag_name:n};_n.indexOf(n)>-1&&!r&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?iy(1024,Bn(e)):iy(1024,hn(e)));var a=dn(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),As(e.attributes,function(r){var n;if((!Rn(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Nn(r.value)&&(!Pt(n=r.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=r.value;"class"===r.name&&(a=ln(a).join(" ")),o["attr__"+r.name]=iy(1024,"href"===r.name&&s?li(a):a)}});for(var l=1,u=1,d=e;d=sy(d);)l++,d.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,o,a,u,c)),As(function(e){if(!In(e))return{};var t={};return As(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&Nn(i)&&(t[r]=i)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(S,t)||(S[t]=e)})}),k)return{props:{},explicitNoCapture:k};if(v>0&&(e=h[v],b.splice(0,v)),a||(b[0].$el_text=nn(e,"a")||nn(e,"button")?Bn(e):hn(e)),w){var C,E;b[0].attr__href=w;var x=null==(C=Gs(w))?void 0:C.host,T=null==l||null==(E=l.location)?void 0:E.host;x&&T&&x!==T&&(f=w)}return{props:Os((m=s.type,{$event_type:m,$ce_version:1}),d?{}:{$elements:b},{$elements_chain:(y=b,Et(y)?function(e){return e.map(e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))i+="."+s.replace(/"/g,"");var o=n({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return Ds(o).sort((e,t)=>function(e,t){return t>e?-1:e>t?1:0}(e[0],t[0])).forEach(e=>{var t=e[1];return a[qn(e[0].toString())]=qn(t.toString())}),(i+=":")+Ds(a).map(e=>e[0]+'="'+e[1]+'"').join("")}).join(";")}(function(e){return e.map(e=>{var t,r,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(r=e.attr__href)?void 0:r.slice(0,2048),attr_class:Hn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Ds(e).filter(e=>0===e[0].indexOf("attr__")).forEach(e=>i.attributes[e[0]]=e[1]),i})}(y)):"")},null!=(r=b[0])&&r.$el_text?{$el_text:null==(i=b[0])?void 0:i.$el_text}:{},f&&"click"===s.type?{$external_click_url:f}:{},S),target:e}}var oy=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!In(e))return!0;for(var r,i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:mn,s=new Set,n=e,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var e=n,t=dn(e);if(ht(t,"ph-no-capture")||ht(t,"ph-sensitive")||Rn(e)||i.some(t=>gn(e,t)))return{v:!0};var r=n.parentNode;n=an(r)?r.host:r&&sn(r)?r:null};n;)if(r=o())return r.v;return!1}_trackPointer(e){if(this.isEnabled&&"pointercancel"!==e.type)if("pointerdown"!==e.type){var t=this._pointerDown;t&&(e.pointerId!==t.id||Math.abs(e.clientX-t.x)>5||Math.abs(e.clientY-t.y)>5?this._clearPointer():"pointerup"===e.type&&(t.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}else{var r;this._clearPointer();var i=pn(e);e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&sn(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null==(r=this._client)?void 0:r.distinctId})}else this._clearPointer()}_recoverClickTarget(e){var t,r=this._pointerDown;this._clearPointer();var i=pn(e);if(null!=r&&r.released&&r.target.isConnected&&r.distinctId===(null==(t=this._client)?void 0:t.distinctId)&&e.pointerId===r.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-r.x)&&5>=Math.abs(e.clientY-r.y)&&i&&(nn(i,"html")||nn(i,"body"))){var s;if(r.excluded)return null;var n=null!==(s=this._refreshConfig().css_selector_ignorelist)&&void 0!==s?s:mn;return[i,null==c?void 0:c.documentElement,null==c?void 0:c.body].some(e=>{if(!e)return!1;var t=dn(e);return ht(t,"ph-no-capture")||ht(t,"ph-sensitive")||!In(e)||Rn(e)||n.some(t=>gn(e,t))})?null:r.target}}constructor(e){this._configSource=e,this.name="autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource.refresh(this._config),this.rageclicks=new ey(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null==(e=this._config.url_allowlist)?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null==(t=this._config.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){if(this.isBrowserSupported()){if(l&&c){var e=this._domEventHandler=e=>{e=e||(null==l?void 0:l.event);try{if("blur"===e.type)return void this._clearPointer();if(0===e.type.indexOf("pointer"))return void this._trackPointer(e);var t="click"===e.type?this._recoverClickTarget(e):void 0;if(Ft(t))return;this._captureEvent(e,"$autocapture",t)}catch(e){ry.error("Failed to capture event",e)}};if(Ws(l,"blur",e),Ws(c,"submit",e,{capture:!0}),Ws(c,"change",e,{capture:!0}),Ws(c,"click",e,{capture:!0}),As(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Ws(c,t,e,{capture:!0})}),this._refreshConfig().capture_copied_text){var t=this._copiedTextHandler=e=>{e=e||(null==l?void 0:l.event);try{this._captureEvent(e,ty)}catch(e){ry.error("Failed to capture clipboard event",e)}};Ws(c,"copy",t,{capture:!0}),Ws(c,"cut",t,{capture:!0}),Ws(c,"paste",t,{capture:!0})}}}else ry.info("Disabling Automatic Event Collection because this browser is not supported")}_removeDomEventHandlers(){this._clearPointer(),this._domEventHandler&&(null==l||l.removeEventListener("blur",this._domEventHandler),As(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==c||c.removeEventListener(e,this._domEventHandler,!0)}),null==c||c.removeEventListener("submit",this._domEventHandler,!0),null==c||c.removeEventListener("change",this._domEventHandler,!0),null==c||c.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==c||c.removeEventListener("copy",this._copiedTextHandler,!0),null==c||c.removeEventListener("cut",this._copiedTextHandler,!0),null==c||c.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._initialized=!1}startIfEnabled(){this.isEnabled||this._clearPointer(),!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(!this._disposed)if(this._hasReceivedConfigResponse=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);var r,i=t.autocapture_opt_out;Dt(i)&&(null==(r=this._client)||r.kv.set(P,i),this._isDisabledServerSide=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e,t){var r,i=[];return null==(r=this._elementSelectors)||r.forEach(r=>{var s;null==c||null==(s=c.querySelectorAll(r))||s.forEach(s=>{e!==s&&t!==s||ht(i,r)||i.push(r)})}),i}get isEnabled(){var e,t;if(this._disposed)return!1;var r=null==(e=this._client)?void 0:e.kv.get(P),i=this._isDisabledServerSide,s=this._refreshConfig();if(!s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;var n=s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(Ft(i)&&!Dt(r)&&!n)return!1;var o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!s.enabled&&!o}_captureEvent(e,t,r){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i=r||pn(e);on(i)&&(i=i.parentNode||null);var s,o=this._compileUrlPatterns();"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&o.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&En(i,o.rageclick)&&this._captureEvent(e,"$rageclick",r);var a=t===ty,u=a?n({},o,{dom_event_allowlist:void 0}):o;if(i&&function(e,t,r,i,s,n){var o;if(!l||xn(e))return!1;if(null!=r&&r.url_allowlist&&!un(r.url_allowlist,n))return!1;if(null!=r&&r.url_ignorelist&&un(r.url_ignorelist,n))return!1;if(null!=r&&r.dom_event_allowlist){var a=r.dom_event_allowlist;if(a&&!a.some(e=>t.type===e))return!1}var u=Tn(e,i),d=u.parentIsUsefulElement,c=u.targetElementList;if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(Rt(r))return!0;var i,s=function(e){if(r.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(i=s(n))return i.v;return!1}(c,r))return!1;if(!vn(c,null==r?void 0:r.css_selector_allowlist))return!1;if(vn(c,null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:mn))return!1;try{var h=l.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return d?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(_n.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,u,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var d,c=ny(i,{e:e,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),h=c.props;if(c.explicitNoCapture)return!1;var p=this.getElementSelectors(i,c.target);if(p&&p.length>0&&(h.$element_selectors=p),t===ty){var _=e.type||"clipboard";if("paste"!==_){var g,v,f=null==l||null==(g=l.getSelection())?void 0:g.toString(),m=cn(f);if(!m)return!1;h.$selected_content=m,h.$clipboard_text_length=null!==(v=null==f?void 0:f.length)&&void 0!==v?v:0}h.$copy_type=_}return null==(d=this._client)||d.capture(t,h).catch(e=>ry.error("Failed to capture event",e)),!0}}else this._clearPointer()}isBrowserSupported(){return xt(null==c?void 0:c.querySelectorAll)}},ay={};function ly(e,t){var r=pn(e);return r?n({node:r,originalEvent:e,timestamp:Date.now()},t):null}function uy(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function dy(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var cy="canvas,video,audio,embed,object";function hy(e,t){return At(e)&&e>=t}function py(e){return e>=0&&1e3>e?e:void 0}function _y(e,t){return t?py(e-t):void 0}var gy=class{_asRequiredConfig(e){var t,r,i,s,n,o,a,l,u=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==e?void 0:e.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(n=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==n?n:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(e,t){this.instance=e,this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({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:e}),this._onClick=e=>{var t=ly(e,{type:"click"});Ft(t)||this._ignore(t)||this._queueCandidate(t),this._scheduleCheck()},this._onScroll=()=>{var e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{Rt(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{var e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{var e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{var t=e.touches,r=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=r?{x:r.clientX,y:r.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t,r=this._touchStart;if(this._touchStart=void 0,!Rt(r)&&this._config.max_dead_swipes_per_page_load>this._deadSwipesCaptured){var i=e,s=null==(t=i.changedTouches)?void 0:t[0];if(s){var n=s.clientX-r.x,o=s.clientY-r.y,a=n*n+o*o,l=this._config.swipe_threshold_px;if(a>=l*l&&![this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>At(e)&&e>=r.timestamp)){var u;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==c||null==c.elementsFromPoint?void 0:c.elementsFromPoint(r.x,r.y))&&void 0!==u?u:[]).some(e=>null==e.matches?void 0:e.matches(cy)))return;var d=ly(i,{type:"swipe",swipeDirection:uy(n,o),swipeDistancePx:Math.round(Math.sqrt(a))});Ft(d)||this._ignore(d)||this._queueCandidate(d),this._scheduleCheck()}}}},this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(e){if(!this._mutationObserver){var t=function(e){return function(e,t){var r=ay[e];if(r)return r;var i=t[e];if((e=>xt(e)&&-1!==e.toString().indexOf("[native code]"))(i)&&(null==l||!l.Zone))return ay[e]=i.bind(t);var s=t.document;if(s&&xt(s.createElement)){var n,o=!1;try{(n=s.createElement("iframe")).hidden=!0,s.head.appendChild(n);var a,u,d=n.contentWindow;d&&d[e]&&(i=d[e],"MutationObserver"===e&&function(e){return ht(e,"AppleWebKit")&&!ht(e,"Chrome")}(null!==(a=null==(u=t.navigator)?void 0:u.userAgent)&&void 0!==a?a:"")&&(n.classList.add("rr-block","ph-no-capture"),o=!0))}catch(t){Ms.warn("Could not create sandbox iframe for "+e+" check, bailing to assignableWindow."+e+": ",t)}finally{var c;!o&&null!=(c=n)&&c.parentNode&&n.parentNode.removeChild(n)}}return i&&xt(i)?ay[e]=i.bind(t):i}("MutationObserver",e)}(b);this._mutationObserver=new t(e=>{this._onMutation(e)}),this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null==(e=this._mutationObserver)||e.disconnect(),this._mutationObserver=void 0,b.removeEventListener("click",this._onClick),b.removeEventListener("scroll",this._onScroll,{capture:!0}),b.removeEventListener("selectionchange",this._onSelectionChange),b.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),b.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),b.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==c||c.removeEventListener("visibilitychange",this._onVisibilityChange),b.removeEventListener("blur",this._onFocusChange),b.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){Ws(b,"click",this._onClick)}_queueCandidate(e){e.visibilityChangedDelayMs=_y(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=_y(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Rt(this._checkClickTimer)&&(this._checkClickTimer=b.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){Ws(b,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){Ws(b,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){Ws(c,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){Ws(b,"blur",this._onFocusChange),Ws(b,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(r=>{var i=py(t-r.timestamp);At(i)&&(Rt(r[e])||r[e]>i)&&(r[e]=i)})}_startSwipeObserver(){Ws(b,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Ws(b,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Ws(b,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){var e=Rt(this._surfacesCheckedAt)||At(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Rt(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!(null==c||!c.querySelector(cy))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(e){return!(!rn(e.node)&&!this._clicks.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!nn(e.node,"html")&&sn(e.node)&&function(e,t){var r;if(!l||xn(e))return!1;var i=Dt(t)?wn:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:wn;return!vn(Tn(e,!1).targetElementList,i)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(e){return!(this._config.capture_clicks_with_modifier_keys||(t=e.originalEvent,!(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)))||!!this._ignoreCommon(e)||(r=e.node,!(!l||xn(r))&&Tn(r,!1).targetElementList.some(e=>nn(e,"a")));var t,r}_checkClicks(){if(this._clicks.length){clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;var e=this._clicks;for(var t of(this._clicks=[],e)){var r;t.mutationDelayMs=null!==(r=t.mutationDelayMs)&&void 0!==r?r:this._lastMutation&&this._lastMutation>=t.timestamp?this._lastMutation-t.timestamp:void 0,t.absoluteDelayMs=Date.now()-t.timestamp,t.selectionChangedDelayMs=this._lastSelectionChanged&&this._lastSelectionChanged>=t.timestamp?this._lastSelectionChanged-t.timestamp:void 0;var i=hy(t.scrollDelayMs,this._config.scroll_threshold_ms),s=hy(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=hy(t.mutationDelayMs,this._config.mutation_threshold_ms),o=hy(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=At(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=At(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=At(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,d=At(t.visibilityChangedDelayMs),c=At(t.focusChangedDelayMs);if(!(a||l||u||d||c))if(i||n||o||s){var h=dy(t);if("$dead_swipe"===h){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(t,{[h+"_last_mutation_timestamp"]:this._lastMutation,[h+"_event_timestamp"]:t.timestamp,[h+"_scroll_timeout"]:i,[h+"_mutation_timeout"]:n,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:s,[h+"_visibility_changed_timeout"]:!1})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}this._scheduleCheck()}}_captureDeadClick(e,t){var r=dy(e);this.instance.capture(r,n({},t,ny(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props,{[r+"_scroll_delay_ms"]:e.scrollDelayMs,[r+"_mutation_delay_ms"]:e.mutationDelayMs,[r+"_absolute_delay_ms"]:e.absoluteDelayMs,[r+"_selection_changed_delay_ms"]:e.selectionChangedDelayMs,[r+"_visibility_changed_delay_ms"]:e.visibilityChangedDelayMs,[r+"_focus_changed_delay_ms"]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new gy(e,t);var vy=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return jt(e)?1:ht(Gt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?ka:Sa,r=t._is_supported()?t:Oa;if(!this._persistentStore||this._persistentStore!==r){this._persistentStore=r;var i="localStorage"===e?Sa:ka;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(jt(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==d?void 0:d.doNotTrack,null==d?void 0:d.msDoNotTrack,b.doNotTrack,null==d?void 0:d.globalPrivacyControl].some(e=>jt(e))}},fy=Fs("[Dead Clicks]"),my=()=>!0,yy=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(D)),i=e.instance.config.capture_dead_clicks;return Dt(i)?i:!!Tt(i)||r},by=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[D]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?fy.error("failed to load script",t):e()})}_start(){var e;if(c){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=b.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Tt(this.instance.config.capture_dead_clicks)?n({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=b.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(c),fy.info("starting...")}}else fy.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,fy.info("stopping..."))}},Sy=Fs("[SegmentIntegration]");function wy(e,t,r){void 0===r&&(r=!0);var i=e.config.segment;if(!i)return t();!function(e,t,r){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||va();e.config.get_device_id=s,r&&i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(Fe,rt)),t(r?void 0:i.anonymousId()||void 0)},n=i.user();"then"in n&&xt(n.then)?n.then(s):s(n)}(e,r=>{i.register(((e,t)=>{"undefined"!=typeof Promise&&Promise.resolve||Sy.warn("This browser does not have Promise support, and can not use the segment integration");var r=(r,i)=>{if(!i)return r;var s=!!t&&r.event.anonymousId===t&&!r.event.userId;s||r.event.userId||r.event.anonymousId===e.get_distinct_id()||(Sy.info("No userId set, resetting PostHog"),e.reset()),s||(t=void 0),r.event.userId&&r.event.userId!==e.get_distinct_id()&&(Sy.info("UserId set, identifying with PostHog"),e.identify(r.event.userId));var n=e.calculateEventProperties(i,r.event.properties);return r.event.properties=Object.assign({},n,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return r(e,e.event.event)},page(e){return r(e,ot)},identify(e){return r(e,lt)},screen(e){return r(e,"$screen")}}})(e,r)).then(()=>{t()},e=>{Sy.error("Failed to register the Segment integration",e),t()})},r)}var ky="posthog-js";function Cy(e,t){var r=void 0===t?{}:t,i=r.organization,s=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,u=r.sendExceptionsToPostHog,d=void 0===u||u;return t=>{var r,a,u,c,h,p;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var _=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=_,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=(null==(r=t.exception)?void 0:r.values)||[],v=g.map(e=>n({},e,{stacktrace:e.stacktrace?n({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>n({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=g[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=g[0])?void 0:h.type,$sentry_tags:t.tags};return i&&s&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),d&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}var Ey=class{constructor(e,t,r,i,s,n){this.name=ky,this.setupOnce=function(o){o(Cy(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},xy=class{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(Ms.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var r,i=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(r=null==l?void 0:l.location.pathname)&&void 0!==r?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var r=this._currentPageview;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,u=s.lastContentY,d=s.maxContentY;if(!(Rt(n)||Rt(o)||Rt(a)||Rt(l)||Rt(u)||Rt(d))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d);var c=n>1?Qt(o/n,0,1,Ms):1,h=n>1?Qt(a/n,0,1,Ms):1,p=l>1?Qt(u/l,0,1,Ms):1,_=l>1?Qt(d/l,0,1,Ms):1;i=Os(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:c,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}},Ty=["flags","surveys"],Iy={[S]:{exposure:"hidden"},[E]:{exposure:"hidden"},[x]:{exposure:"hidden"},[R]:{exposure:"hidden"},[I]:{exposure:"hidden"},[P]:{exposure:"event"},[M]:{exposure:"hidden"},[B]:{exposure:"hidden"},[F]:{exposure:"event"},[L]:{exposure:"hidden"},[A]:{exposure:"event"},[O]:{exposure:"event"},[D]:{exposure:"event"},[N]:{exposure:"hidden"},[q]:{exposure:"event"},[H]:{exposure:"hidden"},[U]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[K]:{exposure:"event"},[W]:{exposure:"event",shouldSkipFromEventProperties:e=>Ft(e)},[Z]:{exposure:"event"},[Y]:{exposure:"event"},[J]:{exposure:"event"},[re]:{exposure:"event"},[ie]:{exposure:"hidden"},[se]:{exposure:"hidden",storageGroup:"flags"},[ne]:{exposure:"hidden",storageGroup:"flags"},[oe]:{exposure:"hidden"},[ae]:{exposure:"hidden",storageGroup:"flags"},[le]:{exposure:"hidden",storageGroup:"flags"},[ue]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[de]:{exposure:"hidden",storageGroup:"flags"},[ce]:{exposure:"hidden"},[he]:{exposure:"hidden"},[pe]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[ve]:{exposure:"hidden",storageGroup:"surveys"},[fe]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[me]:{exposure:"event"},[ye]:{exposure:"hidden"},[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[we]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[Ce]:{exposure:"event"},[Ee]:{exposure:"event"},[xe]:{exposure:"event"},[Te]:{exposure:"event"},[Ie]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[ge]:{exposure:"event"},[Pe]:{exposure:"hidden"},[Me]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Ne]:{exposure:"hidden"},[Be]:{exposure:"hidden"},[z]:{exposure:"event"},[V]:{exposure:"event"},[j]:{exposure:"event"},[G]:{exposure:"event"},[He]:{exposure:"event"},[Ue]:{exposure:"event"},[We]:{exposure:"event"},[ze]:{exposure:"event"},[Ve]:{exposure:"event"},[je]:{exposure:"event"},[Ge]:{exposure:"event"},[Qe]:{exposure:"event"},[Ke]:{exposure:"event"},[Ze]:{exposure:"event"},[Xe]:{exposure:"event"}},Ry=[[X,{exposure:"hidden"}],[ee,{exposure:"hidden"}],[te,{exposure:"hidden"}]],Py=e=>{var t=Iy[e];if(t)return t;for(var r of Ry){var i=r[1];if(0===e.indexOf(r[0]))return i}},My={flags:Me,surveys:fe},Fy=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ly=e=>e+"_cookie_identity_change_pending",Ay=e=>{var t="",r=0;for(var i of e){var s=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(r+s>1e3)break;t+=i,r+=s}return t},Oy="main",Dy=[se,ne,ae,le,ue,Me,de,pe],Ny=e=>-1!==Dy.indexOf(e),By=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return e===t}},$y=e=>{if(!e)return{};var t=JSON.parse(e);return Tt(t)?t:{}},qy=(e,t)=>{As(e,(r,i)=>{var s=Py(i);s&&"event"!==s.exposure||{}.hasOwnProperty.call(t,i)||delete e[i]})},Hy=class{constructor(e,t,r){if(void 0===r&&(r=!0),this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._facebookClickIdChangePending=!1,this._crossTabFeatureFlagHandlers=new Set,this._config=e,this._ownsSplitStorage=r,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),e.debug&&Ms.info("Persistence loaded",e.persistence,n({},this.props)),this.update_config(e,e,t),this.save(),l){var i=()=>this.flush();Ws(l,"beforeunload",i,{capture:!1}),Ws(l,"pagehide",i,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==l?void 0:l.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=Ty.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,Oy)},Ws(l,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],r=e[1],i=this._pendingCrossTabFeatureFlagChanges.get(t);if(Ny(t)&&!0!==i)if(!0!==r){var s=new Set(i||[]);r.forEach(e=>s.add(e)),s.size&&this._setCrossTabFeatureFlagChangesPending(t,s)}else this._setCrossTabFeatureFlagChangesPending(t,!0)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&l&&(l.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,r){if(void 0===r&&(r=!0),this._disabled)return!1;var i,s;try{if(s=ka._get(e),Ft(s)){var n=this._slotWriteState(t);return n.storageValue=null,t!==Oy&&(n.persisted=!1),!1}i=$y(s)}catch(e){return!1}var o=t===Oy?i:ka._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(i,t,r);return t===Oy&&this._splitStorage&&!By(this._partitionProps().main,i)||this._rememberCrossTabStorageFingerprint(i,t,!0,s),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[w],r=e[w];return!Rt(t)&&!Rt(r)&&t!==r}_rememberCrossTabStorageFingerprint(e,t,r,i){var s=this._slotWriteState(t);s.storageValue=i,t!==Oy&&(s.persisted=r);try{s.fingerprint=this._entryFingerprint(e,t)}catch(e){s.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,r){var i=!1;return Dy.forEach(r=>{var s,n=null==(s=Py(r))?void 0:s.storageGroup;if(!(t===Oy&&this._splitStorage&&n||t!==Oy&&n!==t)){var o=r in e,a=this._mergePendingCrossTabFeatureFlagChanges(r,o?e[r]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(r)?r in this.props:o;l===r in this.props&&By(a,this.props[r])||(l?this._setProp(r,a,!1):this._deleteProp(r,!1),i=!0)}}),i&&r&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),i}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;var e,t=ka._get(this._name),r=this._slotWriteState(Oy),i=!1,s=!1;if(t!==r.storageValue)if(Ft(t))r.storageValue=null;else{if(e=$y(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;s=this._mergeCrossTabFeatureFlagProperties(e,Oy,!1),!this._splitStorage||By(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,Oy,!0,t):r.storageValue=t,i=!0}return this._splitStorage&&Ty.forEach(t=>{var r=ka._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=i&&Dy.some(e=>{var r;return(null==(r=Py(e))?void 0:r.storageGroup)===t&&e in o});if(r!==n.storageValue||a){if(Ft(r))return n.storageValue=null,n.persisted=!1,void(a&&(s=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||s));var l=$y(r);s=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||s,this._rememberCrossTabStorageFingerprint(l,t,!0,r)}}),s}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var r=Py(e);null!=r&&r.volatile||(this._slotWriteState((this._splitStorage?null==r?void 0:r.storageGroup:void 0)||Oy).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Dy.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=ka._get(this._name),t=$y(e);this._slotWriteState(Oy).storageValue=e,Dy.forEach(e=>{var r,i=this._splitStorage?null==(r=Py(e))?void 0:r.storageGroup:void 0,s=i?ka._get(this._groupEntryName(i)):null;if(i){var n=this._slotWriteState(i);n.storageValue=s,n.persisted=!Ft(s)}var o=i&&!Ft(s)?$y(s):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var r=this._pendingCrossTabFeatureFlagChanges.get(e);if(!r)return t;if(!0===r)return this.props[e];if("$active_feature_flags"===e){var i=new Set(Et(t)?t:[]),s=new Set(Et(this.props[e])?this.props[e]:[]);return r.forEach(e=>s.has(e)?i.add(e):i.delete(e)),Array.from(i)}var o=Tt(t)?n({},t):{},a=Tt(this.props[e])?this.props[e]:{};return r.forEach(e=>{e in a?o[e]=a[e]:delete o[e]}),o}_markPendingCrossTabFeatureFlagChanges(e,t,r){if(Ny(e)){var i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==i){var s=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Py(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;s=$y(ka._get(a))[e]}catch(e){}var l=new Set(i||[]);if("$active_feature_flags"===e){if(!Rt(t)&&!Et(t)||!Rt(s)&&!Et(s)||!Et(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var u=new Set(t||[]),d=new Set(s||[]),c=new Set(r);new Set([...u,...c]).forEach(e=>{u.has(e)!==c.has(e)&&l.add(e)}),l.forEach(e=>{d.has(e)===c.has(e)&&l.delete(e)})}else{if(!Tt(r))return void(By(s,r)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!Rt(t)&&!Tt(t)||Rt(t)&&It(r)&&Rt(s))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var h=Tt(t)?t:{},p=Tt(s)?s:{};new Set([...Object.keys(h),...Object.keys(r)]).forEach(e=>{e in h==e in r&&By(h[e],r[e])||l.add(e)}),l.forEach(e=>{e in p==e in r&&By(p[e],r[e])&&l.delete(e)})}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return At(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=Ra(e,this._config.cookie_persisted_properties||[]),r=Ma(t,this._config.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(r),s=Sa._get(this._name)||void 0;s&&La(this._name,s)===i&&(this._lastSeenCookiePropertiesFingerprint=i,this._lastSeenMainCookieValue=s)}catch(e){}else try{var n=Sa._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?La(this._name,n):void 0,this._lastSeenMainCookieValue=n}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var r;try{r=Sa._get(this._name)||void 0}catch(e){}if(!r||r===this._lastSeenMainCookieValue)return!1;var i,s=La(this._name,r);try{i=Ia(JSON.parse(r))}catch(e){return!1}if((Sa._get(this._name)||void 0)!==r)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r;var n=Fa(this._name,r),o=[...Ea,...n.properties],a={};if(Object.keys(i).forEach(e=>{var t=i[e];(Rt(t)||Ft(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete i[e])}),It(i))return!1;var l="distinct_id"in i||"anonymous"===i.$user_state||"identified"===i.$user_state,u=this.props,d=u[w],c=u[Fe],h=Os({},u);[...Ea,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in i)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=h[e];(n.isValid||-1===Ea.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=Os(h,i),Dy.forEach(e=>{var t=e in this.props;e in u===t&&By(u[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,u[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in i||"$user_state"in this.props||this._setProp(Fe,tt);var p=this.props[w],_=this.props[Fe];return!l||p===d&&_===c||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Na._set(Ly(this._name),!0),this._deleteProp(pe),this._deleteProp(ne),this._deleteProp(se),this._deleteProp(ae),this._deleteProp(le),this._deleteProp(ue),this._deleteProp(Me),this._deleteProp(Pe),this._deleteProp(Ie),"anonymous"!==_||"identified"!==c&&"anonymous"!==i.$user_state&&(Rt(d)||p===d)||(qy(this.props,i),this._deleteProp(_e)),"identified"===_?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(E)),!0}consumeCookieIdentityChange(){var e=Ly(this._name),t=this._cookieIdentityChangePending||!!Na._get(e);return this._cookieIdentityChangePending=!1,t&&Na._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Oy],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Fy.indexOf(e.persistence.toLowerCase())&&(Ms.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,r=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var r=[...Ea,...e];return n({},ka,{_parse(e){try{var i,s={};try{i=Sa._get(e)||void 0,s=i?Ia(JSON.parse(i)):{}}catch(e){}var n,o=JSON.parse(ka._get(e)||"{}");if(t){var a=Fa(e,i),l=[...Ea,...a.properties],u={};Object.keys(s).forEach(e=>{var t=s[e];Ft(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});var d="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var c,h=o[w],p=null!==(c=o.$user_state)&&void 0!==c?c:"anonymous";r.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in s)&&(d||"distinct_id"!==e&&"$user_state"!==e)){var t=o[e];(a.isValid||-1===Ea.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!d||"$user_state"in s||"$user_state"in o||(o[Fe]=tt),!d||("distinct_id"in u?u[w]:o[w])===h&&("$user_state"in u?u[Fe]:o[Fe])===p||(Ca.forEach(e=>delete o[e]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[w]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[ge],delete o[_e]),delete o.__alias)}n=Os(o,u)}else n=Os(s,o);return ka._set(e,n),n}catch(e){}return null},_set(r,i,s,n,o,a){var l=ka._set(r,i,void 0,void 0,a);try{var u=Ra(i,e);if(Object.keys(u).length){if(t){var d=xa(r),c=Ma(u,e);if(Sa._set(d,c,s,n,o,a),Sa._get(d)!==JSON.stringify(c)){Sa._remove(d,n);var h=Ra(i);return Sa._set(r,h,s,n,o,a),l}}Sa._set(r,u,s,n,o,a)}}catch(e){ka._error(e)}return l},_remove(e,t){try{null==l||l.localStorage.removeItem(e),Sa._remove(e,t),Sa._remove(xa(e),t)}catch(e){ka._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i=!1,s=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&ka._is_supported()?(t=ka,s=!0):"localstorage+cookie"===o&&r._is_supported()?(t=r,s=!0,i=!0):"sessionstorage"===o&&Na._is_supported()?t=Na:"memory"===o?t=Oa:"cookie"===o&&Sa._is_supported()?(t=Sa,i=!0):r._is_supported()?(t=r,s=!0,i=!0):Sa._is_supported()?(t=Sa,i=!0):t=Oa,this._splitStorageEligible=s,this._storesIdentityInCookie=i,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return As(this.props,(t,r)=>{var i=Py(r);if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t))return;e[r]=t}}),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),r=t?ka._parse(this._name):null,i={};if(t)try{As(i=Ia(Sa._parse(this._name)),(e,t)=>{(Rt(e)||Ft(e)||""===e)&&delete i[t]})}catch(e){}var s=this._storage._parse(this._name);if(s&&(this.props=Os({},s)),this._splitStorage&&this._loadGroupEntries(),t&&s){var n,o,a=null==r?void 0:r[w],l=null!==(n=null==r?void 0:r.$user_state)&&void 0!==n?n:"anonymous",u=s[w],d=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(u!==a||d!==l){this._cookieIdentityChangePending=!0,Na._set(Ly(this._name),!0);var c=Os({},this.props);Ca.forEach(e=>delete c[e]),"anonymous"!==d||"identified"!==l&&"anonymous"!==i.$user_state&&(Rt(a)||u===a)||(qy(c,i),delete c[_e]),this.props=c;var h=new Set;Ca.forEach(e=>{var t,r=null==(t=Py(e))?void 0:t.storageGroup;r&&h.add(r)}),h.forEach(e=>{var t={};As(this.props,(r,i)=>{var s;(null==(s=Py(i))?void 0:s.storageGroup)===e&&(t[i]=r)}),It(t)?(ka._remove(this._groupEntryName(e)),this._slotState[e]={}):ka._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Na._get(Ly(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Ty){var t=ka._parse(this._groupEntryName(e));if(t&&!It(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Os(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var r;return(null==(r=Py(t))?void 0:r.storageGroup)===e})}_groupEntryIsStale(e,t){var r=My[e];if(!r)return!1;var i=t[r],s=this.props[r];return At(i)&&At(s)&&s>i}refreshKey(e){var t;if(!(this._disabled||"$fbc_persistence"===e&&this._facebookClickIdChangePending)){var r=this._splitStorage?null==(t=Py(e))?void 0:t.storageGroup:void 0,i=r?ka._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e],!1);else{if(r){var s=this._storage._parse(this._name);if(s&&e in s)return void this._setProp(e,s[e],!1)}this._deleteProp(e,!1)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Rt(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}}flush(){Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||(this.syncCookieProperties(),this._facebookClickIdChangePending||this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshKey(I));var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var r=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&Ms.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this._splitStorage)return this._writeNowSplit(),void(r&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));var i=this._writeEntry(this._storage,this._name,this.props,Oy);"written"===i&&this._rememberCurrentCookieProperties(this.props),"failed"!==i&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1),r&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}}}_writeNowSplit(){var e=this,t=this._partitionProps(),r=t.main,i=t.groups,s=this._writeEntry(this._storage,this._name,r,Oy);"written"===s&&this._rememberCurrentCookieProperties(r),"failed"!==s&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,Dy.forEach(e=>{var t;null!=(t=Py(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)}));var n=function(t){var r,s=i[t];if(It(s)&&(null==(r=e._slotState[t])||!r.persisted))return Dy.forEach(r=>{var i;(null==(i=Py(r))?void 0:i.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(r)}),1;var n=e._writeEntry(ka,e._groupEntryName(t),s,t);"failed"!==n&&Dy.forEach(r=>{var i=Py(r);(null==i?void 0:i.storageGroup)!==t||"written"!==n&&i.volatile||e._pendingCrossTabFeatureFlagChanges.delete(r)})};for(var o of Ty)if(n(o))continue}_partitionProps(){var e={},t={flags:{},surveys:{}};return As(this.props,(r,i)=>{var s,n=null==(s=Py(i))?void 0:s.storageGroup;n?t[n][i]=r:e[i]=r}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Oy)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return As(e,(e,t)=>{var i;r[t]=null!=(i=Py(t))&&i.volatile?"__volatile__":e}),JSON.stringify(r)}_writeEntry(e,t,r,i){var s,n=this._slotWriteState(i);if(i!==Oy&&!n.dirty&&!Rt(n.fingerprint))return"skipped";try{if((s=this._entryFingerprint(r,i))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){s=void 0}return e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,i!==Oy&&(n.persisted=!0),Rt(s)||(n.fingerprint=s),this._splitStorageEligible&&(n.storageValue=ka._get(t)),"written"):(this._config.debug&&Ms.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!r&&this._ownsSplitStorage)for(var i of Ty)ka._remove(this._groupEntryName(i));r?delete this._slotState[Oy]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Tt(e)){this.syncCookieProperties(),Rt(t)&&(t="None"),this._expire_days=Rt(r)?this._default_expiry:r;var i=!1;if(As(e,(e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this._setProp(r,e),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(Tt(e)){this.syncCookieProperties(),this._expire_days=Rt(t)?this._default_expiry:t;var r=!1;if(As(e,(t,i)=>{e.hasOwnProperty(i)&&(this.props[i]!==t||Tt(t)||Et(t))&&(this._setProp(i,t),r=!0)}),r)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,r=!1;for(var i of t)i in this.props&&(this._deleteProp(i),r=!0);r&&this.save()}update_campaign_params(){var e=null==c?void 0:c.URL;if(e!==this._campaign_params_url){var t=_l(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),r=!It($s(t));return r&&this.register(t),this._campaign_params_url=e,r?t:void 0}}update_search_keyword(){var e;this.register((e=null==c?void 0:c.referrer)?vl(e):{})}update_referrer_info(){var e;this.register_once({$referrer:yl(),$referring_domain:null!=c&&c.referrer&&(null==(e=Gs(c.referrer))?void 0:e.host)||ml},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var e=bl(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Ne]:this._storesIdentityInCookie?{r:Ay(e.r),u:e.u?Ay(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};As([De,Oe],t=>{var r=this.props[t];r&&As(r,function(t,r){e["$initial_"+_t(r)]=t})});var t=this.props[Ne];return t&&Os(e,function(e,t){void 0===t&&(t=!1);var r=Sl(e,t),i={};return As(r,function(e,t){i["$initial_"+_t(t)]=e}),i}(t,this._config.disable_capture_url_hashes)),e}safe_merge(e){return As(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t,r){var i=e.persistence!==t.persistence,s=!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every((e,t)=>e===i[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=i||s,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!r,u=!!this._disabled&&!l;l||this._syncCookieProperties(t,u),this._config=e,!l&&(i||s||a)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(n({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),u));var d=o||a?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();var c=this._resolveSplitStorage(e),h=o||c!==this._splitStorage,p=!l&&(h||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(u);this._storageMigrationInProgress=h;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){var _=this.props;this.clear(),this._storage=d,this._splitStorage=c,this.props=_,this.save()}else a&&(this._storage=d,l||(delete this._slotState[Oy],this._writeNow()))}finally{this._storageMigrationInProgress=!1,p&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[Ne];if(this._storesIdentityInCookie&&Tt(e)&&"string"==typeof e.r){var t=Ay(e.r),r="string"==typeof e.u?Ay(e.u):e.u;t===e.r&&r===e.u||this._setProp(Ne,n({},e,{r:t,u:r}))}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props.__timers||{};r[e]=t,this._setProp(R,r),this.save()}remove_event_timer(e){var t=this.props.__timers||{},r=t[e];return Rt(r)||(delete t[e],this._setProp(R,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,r){var i;void 0===r&&(r=!0);var s=this.props[e];this.props[e]=t,r&&("distinct_id"!==e&&"$user_state"!==e||s===t||(this._localIdentityChangePending=!0),"$fbc_persistence"!==e||By(s,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,s,t),null!=(i=Py(e))&&i.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(Ny(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),"$fbc_persistence"===e&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,r=null==(t=Py(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}},Uy={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Wy={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},zy={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Vy=Fs("[RateLimiter]"),jy=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Vy.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Vy.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,i;void 0===e&&(e=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){var u=(At(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this._captureWarning(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(Ae,a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!Et(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=h&&h.pathname)return""+(null!==(e=h.origin)&&void 0!==e?e:"")+h.pathname}_captureWarning(e){var t,r,i=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(r=this.instance).get_session_id)?void 0:t.call(r):void 0,a=[e+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},Gy=Fs("[RemoteConfig]"),Qy=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=b._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return Gy.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Gy.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Gy.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){Gy.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Gy.warn("Failed to fetch remote config from PostHog."):Gy.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Gy.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;null==(r=this._instance.featureFlags)||r.ensureFlagsLoaded()}catch(e){Gy.error("Error loading feature flags",e)}}},Ky=["fatal","error","warning","log","info","debug"],Zy=!!_||!!p,Yy="text/plain",Jy=!1,Xy=(e,t)=>{var r=e.split("#"),i=r[1],s=r[0].split("?"),n=s[0],o=s[1];if(!o)return e;var a=o.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(a?"?"+a:"")+(i?"#"+i:"")},eb=function(e,t,r){var i;void 0===r&&(r=!0);var s=e.split("?"),o=s[0],a=s[1],l=n({},t),u=null!==(i=null==a?void 0:a.split("&").map(e=>{var t,i=e.split("="),s=i[0],n=r&&null!==(t=l[s])&&void 0!==t?t:i[1];return delete l[s],s+"="+n}))&&void 0!==i?i:[],d=Qs(l);return d&&u.push(d),u.length>0?o+"?"+u.join("&"):o},tb=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===W_.GZipJS){var i=oa(aa(js(t)),{mtime:0});return{contentType:Yy,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===W_.Base64){var s=(e=>"data="+encodeURIComponent("string"==typeof e?e:js(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(js(t)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=js(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},rb=e=>{var t,r,i=()=>"sendBeacon"===e.transport?{url:eb(e.url,{compression:W_.Base64}),encodedBody:tb(n({},e,{compression:W_.Base64,_encodedBody:void 0}))}:{url:Xy(e.url,"compression"),encodedBody:tb(n({},e,{compression:void 0,_encodedBody:void 0}))};try{t=tb(e)}catch(t){if(rs(e.compression,Ks(e.url,"compression")))return Ms.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return t&&rs(e.compression,Ks(e.url,"compression"))&&!((r=t.body)instanceof ArrayBuffer?ts(new Uint8Array(r)):ArrayBuffer.isView(r)&&ts(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Jy=!0,i()):{url:e.url,encodedBody:t}},ib=e=>{try{return rb(e)}catch(t){return Ms.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},sb=function(){var e=a(function*(e){var t=yield as(js(e.data),Ba.DEBUG,{rethrow:!0});if(!t)return e;var r=yield t.arrayBuffer();return n({},e,{_encodedBody:{contentType:Yy,body:r,estimatedSize:r.byteLength}})});return function(t){return e.apply(this,arguments)}}(),nb=/Failed to fetch|NetworkError|Load failed/i,ob=e=>"TypeError"===(null==e?void 0:e.name)&&nb.test((null==e?void 0:e.message)||""),ab=e=>{var t=ib(e);if(t){var r=new _,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var s=null!=i?i:{},n=s.contentType,o=s.body;As(e.headers,function(e,t){r.setRequestHeader(t,e)}),n&&r.setRequestHeader("Content-Type",n),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(o)}},lb=e=>{var t=ib(e);if(t){var r=t.url,i=t.encodedBody,s=null!=i?i:{},o=s.contentType,a=s.body,l=s.estimatedSize,u=new Headers;As(e.headers,function(e,t){u.append(t,e)}),o&&u.append("Content-Type",o);var d=null,c=!1;if(g){var h=new g;d={signal:h.signal,timeout:setTimeout(()=>{var t;c=!0,h.abort(ai("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))},e.timeout)}}var _=t=>{c&&"AbortError"===(null==t?void 0:t.name)||ob(t)?Ms.warn(t):Ms.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var v;p(r,n({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(v=d)?void 0:v.signal},e.fetchOptions)).then(t=>t.text().then(r=>{var i={statusCode:t.status,text:r};if(200===t.status)try{i.json=JSON.parse(r)}catch(e){Ms.error(e)}null==e.callback||e.callback(i)})).catch(_).finally(()=>d?clearTimeout(d.timeout):null)}catch(e){d&&clearTimeout(d.timeout),_(e)}}},ub=e=>{try{var t,r=rb(e),i=r.url,s=r.encodedBody,o=null!=s?s:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(d.sendBeacon(i,u))return;var c=Et(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(Et(c)&&c.length>1&&(null!=l?l:0)>16384){var h=Math.ceil(c.length/2),_=t=>Et(e.data)?t:n({},e.data,{batch:t});return ub(n({},e,{data:_(c.slice(0,h))})),void ub(n({},e,{data:_(c.slice(h))}))}Ms.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(p?"fetch":"XHR")),p?lb(n({},e,{_keepaliveDisabled:!0})):ab(e)}catch(e){Ms.warn("Beacon send failed",e)}},db=(e,t,r,i)=>{var s="query"===i?"POST"===t?"sent_at":"_":void 0;return eb(r===W_.GZipJS?Xy(e,"compression"):e,n({},s?{[s]:Date.now().toString()}:{},r===W_.GZipJS?{}:{compression:r}))},cb=[];p&&cb.push({transport:"fetch",method:lb}),_&&cb.push({transport:"XHR",method:ab}),null!=d&&d.sendBeacon&&cb.push({transport:"sendBeacon",method:ub});var hb=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Qt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Ms.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(n({},e,{transport:"sendBeacon"}))})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),r=function(){var r=t[i],s=(new Date).getTime();r.data&&Et(r.data)&&As(r.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e._sendRequestSafely(r)};for(var i in t)r()}},this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Ms.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return As(this._queue,t=>{var r,i=t,s=(i?i.batchKey:null)||i.url;Rt(e[s])&&(e[s]=n({},i,{data:[]})),null==(r=e[s].data)||r.push(i.data)}),this._queue=[],e}},pb=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!Rt(l)&&"onLine"in l.navigator){if(this._areWeOnline=l.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Ws(l,"online",this._onlineListener),Ws(l,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,i=s(e,r);Ot(t)&&(i.url=eb(i.url,{retry_count:t})),this._instance._send_request(n({},i,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(n({retriesPerformedSoFar:t},i));0===e.statusCode&&Ms.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!=t?t:0)+" retries.")}null==i.callback||i.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(e){var t=3e3*Math.pow(2,e),r=t/2,i=Math.min(18e5,t),s=(Math.random()-.5)*(i-r);return Math.ceil(i+s)}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),Ms.warn(s),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],r=this._queue.filter(r=>e>r.retryAt||(t.push(r),!1));if(this._queue=t,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Rt(l)||(this._onlineListener&&(l.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(l.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(n({},t,{transport:"sendBeacon"}))}catch(e){Ms.error(e)}}this._queue=[]}},_b=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(r=this._context.maxContentY)&&void 0!==r?r:0),this._context.maxContentHeight=Math.max(l,null!==(i=this._context.maxContentHeight)&&void 0!==i?i:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Ws(l,"scroll",this._updateScrollData,{capture:!0}),Ws(l,"scrollend",this._updateScrollData,{capture:!0}),Ws(l,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==l||null==(e=l.document)?void 0:e.documentElement;for(var t of Et(this._scrollRoot)?this._scrollRoot:[this._scrollRoot]){var r,i=null==l||null==(r=l.document)?void 0:r.querySelector(t);if(i)return i}}_scrollPosition(e){var t,r,i="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var s=this.scrollElement();return s&&s[i]||0}return l?"y"===e?l.scrollY||l.pageYOffset||(null==(t=l.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:l.scrollX||l.pageXOffset||(null==(r=l.document)||null==(r=r.documentElement)?void 0:r.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}},gb=e=>bl(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes),vb=class{constructor(e,t,r,i){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var r={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Le]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||gb,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Le]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Sl(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return As($s(this.getSetOnceProps()),(t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+_t(r)]=t}),e}},fb=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(var r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}},mb=Fs("[SessionId]"),yb=864e5,bb=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,r){var i;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new fb,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Ot(e)||!Ot(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||va,this._windowIdGenerator=r||va;var s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Qt(this._config.session_idle_timeout_seconds||1800,60,36e3,mb.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var n=Na._parse(this._window_id_storage_key),o=Na._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Na._remove(this._window_id_storage_key),Na._set(this._primary_window_exists_storage_key,!0)}null!=(i=this._config.bootstrap)&&i.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Rt(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Na._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Na._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Na._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Ft(t)&&!Ft(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,r){var i=t!==this._sessionActivityTimestamp,s=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,s&&!i||s&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Q]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ot(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(Q):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Ft(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[Q]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=Ot(e)?e:0,r=Ot(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[Q];return Et(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var r=function(e,t){void 0===t&&(t=(new Date).getTime());try{var r=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return r>t+6e4?void mb.error("Bootstrap sessionID cannot be in the future"):r}catch(e){return void mb.error("Invalid sessionID in bootstrap",e)}}(e);return!Rt(r)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:r}:this._setSessionId(e,(new Date).getTime(),r),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&l&&(l.removeEventListener(nt,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Na._remove(this._primary_window_exists_storage_key)},Ws(l,nt,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,r){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===r&&(r=!1),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this._sessionId;if(r)this._lastCookieSyncTimestamp=i;else if(Ft(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>i||i-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=i}var a=this._getSessionId(),l=a[1],u=a[2],d=!Rt(s)&&l!==s,c=this._freshestActivityTimestamp(),h=this._getWindowId(),p=this._pendingBootstrapSession,_=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>yb),g=p?_:Ot(u)&&Math.abs(i-u)>yb,v=!1,f=d,m=!l||!!p,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(i,c);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(i))||mb.info("cross-tab refresh kept the session alive",{sessionId:l});var S=this._getSessionId();l=S[1],u=S[2]}if(m||b||g){f=!1;var w=p&&!_;l=w?p.sessionId:this._sessionIdGenerator(),h=this._windowIdGenerator(),mb.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!w,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),u=w?p.sessionStartTimestamp:i,this._pendingBootstrapSession=void 0,v=!0}else h||(h=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(mb.info("adopted cross-tab session id",{sessionId:l,windowId:h}),v=!0);var k=Ot(c)&&e&&!g?c:i,C=Ot(u)?u:(new Date).getTime();this._setWindowId(h),this._setSessionId(l,k,C),e||this._resetIdleTimer();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach(e=>e(l,h,E)),{sessionId:l,windowId:h,sessionStartTimestamp:C,changeReason:v?E:void 0,lastActivityTimestamp:c}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}},Sb=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&ct(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(e=>ct(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function wb(){return wb=a(function*(){var e=null==d?void 0:d.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t,r=null==(t=yield e.getHighEntropyValues(["model"]))?void 0:t.model;return Pt(r)&&r.length>0?r:void 0}catch(e){return void Ms.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),wb.apply(this,arguments)}var kb="custom",Cb="i.posthog.com",Eb=/^\/static\//,xb=["/s/","/e/","/i/"],Tb=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Cb,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":kb),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Eb.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=Gs(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,r){if("ui"===e)return r;var i=r,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Gs(r))?void 0:n.href)||r;i=s(new URL(o)).toString()}if(s&&"api"===e&&xb.some(e=>0===t.indexOf(e))){var a=this._urlKey(i);if(a){var l,u=this.apiHost,d=this._ingestionEndpoints;(null==(l=d)?void 0:l.apiHost)===u&&d.rewriteRequestPath===s||(this._ingestionEndpoints=d={apiHost:u,rewriteRequestPath:s,urls:new Set}),d.urls.add(a)}}return i}isIngestionEndpoint(e){var t=this._ingestionEndpoints,r=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&t.urls.has(r)}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var r=this._staticAssetHostOverride(t);if(r)return this._prepareEndpoint(e,t,""+r+t)}if(this.region===kb)return this._prepareEndpoint(e,t,this.apiHost+t);var i=Cb+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+i);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+i)}}},Ib=Fs("[PostHog ExternalIntegrations]"),Rb={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Pb=class{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,e=>{if(e)return Ib.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(){var t,i,s,n=r[0],o=r[1];!o||null!=(t=b.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(Rb[n],()=>{var t;null==(t=b.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(i=b.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]&&(null==(s=b.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}},Mb=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return a(function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t._extensions.set(e.name,e);try{var r=e.setup(t._client);r&&(yield r)}catch(r){var i=t._extensions.get(e.name)===e;i&&t._extensions.delete(e.name),t._logger.error('Failed to set up browser extension "'+e.name+'"',r),i&&t._disposeExtension(e)}})()}getExtension(e){return this._extensions.get(e)}dispose(){if(!this._disposed){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&xt(t.then)&&t.then(void 0,t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)})}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}},Fb=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var r={};for(var i of e){var s=null==t?void 0:t.get_property(i);Rt(s)||(r[i]=s)}return r}set(e,t){var r;null==(r=this._instance.persistence)||r.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}},Lb="extensionsRemoteConfig",Ab=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=Ms,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new Fb(e),this.onEvent=e=>tg(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this._disposed)return tg(()=>{});var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(Lb,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),tg(r)},this._runtime=new Mb(Ms.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(k);return"string"==typeof e?e:void 0}get library(){return{name:Ba.LIB_NAME,version:Ba.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,i,s=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==s?void 0:s.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==s?void 0:s.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==s?void 0:s.sessionStartTimestamp)&&void 0!==i?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}getExtension(e){return this._runtime.getExtension(e)}capture(e,t,r){var i=this;return a(function*(){r?i.instance.capture(e,t,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):i.instance.capture(e,t)})()}registerDynamicEventProperties(e){return tg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(Lb,e))}sendRequest(e,t){var r=this;return a(function*(){var i;void 0===t&&(t={});var s=r.instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",e),n={method:t.method,url:t.query?eb(s,t.query):s,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?ft.Base64:void 0,timestampMode:t.sentAt};return"sendBeacon"===t.transport?(r.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,r.instance._send_request(n)})})()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}},Ob={},Db=0,Nb=()=>{},Bb='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$b="Surveys module not available",qb="sanitize_properties is deprecated. Use before_send instead",Hb="Invalid value for property_denylist config: ",Ub=/^[A-Za-z0-9_-]{1,400}$/,Wb=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,zb=["token","distinct_id",qe],Vb="posthog",jb=!Zy&&-1===(null==f?void 0:f.indexOf("MSIE"))&&-1===(null==f?void 0:f.indexOf("Mozilla")),Gb=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},Qb=e=>{var t;return n({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Us(null==c?void 0:c.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Nb,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:h&&Pt(null==h?void 0:h.search)&&-1!==h.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==l||null==(t=l.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Ms.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:it,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Nb},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:bn,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:Gb(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},Kb=[["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"]],Zb=e=>{var t={};for(var r of Kb){var i=r[0],s=r[1];Rt(e[i])||(t[s]=e[i])}var n=Os({},t,e),o=e.__preview_external_dependency_versioned_paths;return Rt(o)||(Rt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),Pt(o)&&Rt(e.asset_host)&&(n.asset_host=o)),Et(e.property_blacklist)&&(Rt(e.property_denylist)?n.property_denylist=e.property_blacklist:Et(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ms.error(Hb+e.property_denylist)),n},Yb=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Ms.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Jb=(e=class e{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(!(this._hasWarnedAboutVolatileIdentity||this.config.reuseAnonymousId||this.config.segment||this._inCookielessMode())){var e,t,r,i="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(i||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(i?(e="persistence is set to '"+this.config.persistence+"'",t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",r="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)",t="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", 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. "+r)))}}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&"$posthog_cookieless"===this.get_distinct_id()){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){var r=this.config.get_device_id(va());this.register({distinct_id:r,$device_id:r}),e.set_property(Fe,tt)}this._sync_opt_out_with_persistence()}}}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new Yb,this._personProcessingSetOncePropertiesSent=!1,this.version=Ba.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new fb,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qb(),this.SentryIntegration=Ey,this.sentryIntegration=e=>function(e,t){var r=Cy(e,t);return{name:ky,processEvent:e=>r(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new _b(this),this.pageViewManager=new xy(this),this.rateLimiter=new jy(this),this.requestRouter=new Tb(this),this.consent=new vy(this),this.externalIntegrations=new Pb(this);var r=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(e,t,r)=>{var i=Pt(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=Pt(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",e=>Ms.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,r,i){if(i&&i!==Vb){var s,n=null!==(s=Ob[i])&&void 0!==s?s:new e;return n._init(t,r,i),Ob[i]=n,Ob[Vb][i]=n,n}return this._init(t,r,i)}_init(e,t,r){var i,s,o;void 0===t&&(t={});var a,u=Pt(e)?e.trim():"";if(!u)return Ms.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return u!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Qb(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var d=Qb(t.defaults),c=Zb(t),h=Os({},d,c,{name:r,token:u});Tt(d.rageclick)&&Tt(c.rageclick)&&(h.rageclick=Os({},d.rageclick,c.rageclick)),Tt(d.session_recording)&&Tt(c.session_recording)&&(h.session_recording=Os({},d.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Ms.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:W_.GZipJS;var p=this._is_persistence_disabled();if(this.persistence=new Hy(this.config,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hy(n({},this.config,{persistence:"sessionStorage"}),p,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!p&&Na._is_supported()){var _=Na._parse(this._sessionRegisteredPropertiesStorageKey);Et(_)&&_.forEach(e=>{Pt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Na._remove(this._sessionRegisteredPropertiesStorageKey);var g=n({},this.persistence.props),v=n({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new hb(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new pb(this),this.__request_queue=[];var f=this._inCookielessMode();f||(this.sessionManager=new bb(this),this.sessionPropsManager=new vb(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,r)=>{(null!=r&&r.activityTimeout||null!=r&&r.sessionPastMaximumLength||null!=r&&r.crossTabAdoption)&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Ms.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(f)},0)):(Ms.info("Initializing extensions synchronously"),this._initExtensions(f)),Ba.DEBUG=Ba.DEBUG||this.config.debug,Ba.DEBUG&&Ms.info("Starting in debug mode",{this:this,config:t,thisC:n({},this.config),p:g,s:v}),!this.config.identity_distinct_id||null!=(i=t.bootstrap)&&i.distinctID||(t.bootstrap=n({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(s=t.bootstrap)?void 0:s.distinctID;if(this._hasStableInitialDistinctId=!!m&&!Mt(m),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var y=t.bootstrap.distinctID,b=this.get_distinct_id(),S=this.persistence.get_property(Fe);if(t.bootstrap.isIdentifiedID&&null!=b&&b!==y&&"anonymous"===S)this.identify(y);else if(t.bootstrap.isIdentifiedID&&null!=b&&b!==y&&"identified"===S)Ms.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var w=this.config.get_device_id(va()),k=t.bootstrap.isIdentifiedID?w:y;this.persistence.set_property(Fe,t.bootstrap.isIdentifiedID?rt:tt),this.register({distinct_id:y,$device_id:k})}}if(f)this.register_once({distinct_id:$e,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(va());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Fe,tt)}return Ws(l,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Ws(l,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null==(e=this._retryQueue)||e.resume()}),t.segment?wy(this,()=>this._loaded()):this._loaded(),xt(this.config._onCapture)&&this.config._onCapture!==Nb&&(Ms.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Ms.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 wb.apply(this,arguments)}().then(e=>{e&&this.register({[C]:e})}).catch(Nb),this}_isSharedExtension(e){var t=e;return Pt(t.name)&&xt(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>null==e.dispose?void 0:e.dispose()).catch(t=>{Ms.error('Failed to dispose browser extension "'+e.name+'"',t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var t,r,i,s,n,o,a=null!==(t=null==(r=this.config.__extensionClasses)?void 0:r.featureFlags)&&void 0!==t?t:null==(i=e.__defaultExtensionClasses)?void 0:i.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this._featureFlagsReloadingUnsubscribe)||o.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new a(this)),xt(this.featureFlags.onReloading)&&xt(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}_initExtensions(t){var r,i,s,o,a,l,u,d=performance.now(),c=n({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this._enrollExtension(this.autocapture=new c.autocapture(this),h),c.surveys&&this._enrollExtension(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new c.surveys(this),h),c.logs&&this._enrollExtension(this.logs=null!==(s=this.logs)&&void 0!==s?s:new c.logs(this),h),c.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new c.metrics(this)),c.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,yy)),c.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new c.experiments(this)),this._extensions.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this._processInitTaskQueue(h,d)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);var r=e.shift();if(r)try{r()}catch(e){Ms.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[He]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ue]:i}),this.config.__preview_deferred_init_extensions&&Ms.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!c||!c.body)return Ms.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var r,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ht(i.supportedCompression,W_.GZipJS)?W_.GZipJS:ht(i.supportedCompression,W_.Base64)?W_.Base64:void 0),null!=(r=i.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:it}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}_loaded(){try{this.config.loaded(this)}catch(e){Ms.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=h&&h.hostname){var e=h.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Qy(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Ls(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,r,i,s;this._isPageUnloading=!0,null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(at),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(at,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?jb?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=n({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(Rt(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,r,i,s=n({},e);s.timeout=s.timeout||6e4;var o,a,l,u,d,c=null!==(t=s.transport)&&void 0!==t?t:"fetch";"sendBeacon"===c&&Rt(s.compression)&&s.data&&(s.compression=W_.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(a=null==(d=(u=(Et(o=s.data)?o:[o]).map(e=>n({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0])||null==(l=d.properties)?void 0:l.token)&&void 0!==a?a:null==d?void 0:d.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),Et(e)?e.map(e=>n({},e,{sent_at:t})):n({},e,{sent_at:t})}(s.data))),s.url=db(s.url,s.method,s.compression,s.timestampMode);var h=cb.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),p=null!==(r=null==(i=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(h,e=>e.transport===c))?void 0:i.method)&&void 0!==r?r:h[0].method;if(!p)throw new Error("No available transport method");var _=e=>{try{p(e)}catch(e){ob(e)?Ms.warn(e):Ms.error(e),null==s.callback||s.callback({statusCode:0,error:e})}};"sendBeacon"!==c&&s.data&&s.compression===W_.GZipJS&&v&&"undefined"!=typeof Promise&&!Jy?sb(s).then(e=>{_(e)}).catch(t=>{if(is(t))return Jy=!0,void _(n({},s,{compression:void 0,url:db(e.url,e.method,void 0,e.timestampMode)}));ss(t)&&(Jy=!0),_(s)}):p(s)})(n({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Db++;try{var t,r=[],i=[],s=[];Ls(e,e=>{if(e)if(Et(t=e[0]))s.push(e);else if(xt(e))try{e.call(this)}catch(t){Ms.error("Error executing queued PostHog call",e,t)}else Et(e)&&"alias"===t?r.push(e):Et(e)&&-1!==t.indexOf("capture")&&xt(this[t])?s.push(e):i.push(e)});var n=function(e,t){Ls(e,function(e){try{if(Et(e[0])){var r=t;As(e,function(e){r=r[e[0]].apply(r,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Ms.error("Error executing queued PostHog call",e,t)}})};n(r,this),n(i,this),n(s,this)}finally{Db--}}push(t){if(Db>0&&Et(t)&&Pt(t[0])){var r=e.prototype[t[0]];xt(r)&&r.apply(this,t.slice(1))}else this._execute_array([t])}_getPersistedFacebookClickId(){var e,t=null==(e=this.persistence)?void 0:e.get_property(I);return Pt(t)&&Wb.test(t)?{value:t,delivered:!1}:Tt(t)&&Pt(t.value)&&Wb.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,r,i){if(this.persistence){this.persistence.refreshKey(I);var s=this._getPersistedFacebookClickId();if(!i){if(r)return Pt(t)&&Wb.test(t)?(t!==(null==s?void 0:s.value)&&this.persistence.register({[I]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(I);if(Pt(e)&&Ub.test(e)){if((null==s?void 0:s.value.split(".")[3])===e)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+e;return this.persistence.register({[I]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(I)}}_markFacebookClickIdDelivered(e){if(this.persistence){this.persistence.refreshKey(I);var t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[I]:{value:e,delivered:!0}})}}capture(e,t,r){var i,s,o,a,l,u,d,c,h,p;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Rt(e)&&Pt(e)){this._healCookielessSentinelDistinctId();var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var g=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==g||!g.isRateLimited){var v;null!=t&&t.$current_url&&!Pt(null==t?void 0:t.$current_url)&&(Ms.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=r&&r._originatedFromCaptureException||Ms.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&&(v=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var f=new Date,m=(null==r?void 0:r.timestamp)||f,y=oi(null==r?void 0:r.uuid,va),b={uuid:y,event:e,properties:this.calculateEventProperties(e,t||{},m,y)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&_&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),g&&(b.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens);var S="$feature_flag_called"===e&&!1===b.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!S&&(b.$set=null==r?void 0:r.$set);var w=Tt(null==t?void 0:t.$set)?t.$set:void 0,k=!(null==r||!r.$set)&&"$fbc"in r.$set,C=k||!!w&&"$fbc"in w,E=k?null==r||null==(i=r.$set)?void 0:i[T]:null==w?void 0:w[T],x=Et(null==t?void 0:t.$unset)?t.$unset:[],I=(null==r?void 0:r.$unset)||[],R=-1!==x.indexOf("$fbc")||-1!==I.indexOf("$fbc"),P=this._updateFacebookClickId(null==(s=v)?void 0:s.fbclid,E,C,R);P&&!0===b.properties.$process_person_profile&&P.pending&&!C&&!S&&(b.$set=n({[T]:P.value},b.$set));var M=null==r?void 0:r.$unset;M&&(b.$unset=M);var F=S?void 0:this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==ut,e===lt);if(F&&(b.$set_once=F),null!=r&&r._noTruncate||(d=this.config.properties_string_max_length,c=b,h=e=>Pt(e)?e.slice(0,d):e,p=new Set,b=function e(t,r){if(t!==Object(t))return h?h(t):t;if(!p.has(t)){var i;if(p.add(t),Et(t))i=[],Ls(t,t=>{i.push(e(t))});else{var s={};As(Ut(t)?qs(t):t,(t,r)=>{p.has(t)||(s[r]=e(t,r))}),i=s}return i}}(c)),b.timestamp=m,Rt(null==r?void 0:r.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=f),S&&(b.properties=function(e,t){void 0===t&&(t=[]);var r={},i=t=>{void 0!==e[t]&&(r[t]=e[t])};return Xi.forEach(i),t.forEach(i),r}(b.properties,zb)),e===J_.DISMISSED||e===J_.SENT){var L=null==t?void 0:t[X_.SURVEY_ID],A=null==t?void 0:t[X_.SURVEY_ITERATION];ag({id:L,current_iteration:A}),b.$set=n({},b.$set,{[za({id:L,current_iteration:A},e===J_.SENT?"responded":"dismissed")]:!0})}else e===J_.SHOWN&&(b.$set=n({},b.$set,{[X_.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Wy.SHOWN){var O=null==t?void 0:t[zy.TOUR_TYPE];O&&(b.$set=n({},b.$set,{[zy.TOUR_LAST_SEEN_DATE+"/"+O]:(new Date).toISOString()}))}var D=n({},b.properties.$set,b.$set);if(It(D)||this.setPersonPropertiesForFlags(D),!Lt(this.config.before_send)){var N=this._runBeforeSend(b);if(!N)return;(b=N).uuid=oi(b.uuid,va)}var B=null!==(o=null==(a=b.$set)?void 0:a.$fbc)&&void 0!==o?o:Tt(null==(l=b.properties)?void 0:l.$set)?b.properties.$set.$fbc:void 0,q=null!=P&&P.pending&&B===P.value?P.value:void 0;this._internalEventEmitter.emit("eventCaptured",b);var H,U=null!==(u=null==r?void 0:r._url)&&void 0!==u?u:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),W=n({method:"POST",url:U,data:b,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(U)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},null!=r&&r.transport?{transport:r.transport}:{},q?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markFacebookClickIdDelivered(q)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||q?(!W.transport&&!W.callback&&It(null!==(H=this.config.request_headers)&&void 0!==H?H:{})&&this._isPageUnloading&&(W.transport="sendBeacon"),this._send_retriable_request(W)):this._requestQueue.enqueue(W),b}Ms.critical("This capture call is ignored due to client rate limiting.")}}else Ms.error("No event name provided to posthog.capture")}else Ms.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new Ab(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var r=this._extensionEventPropertyProducers.indexOf(e);-1!==r&&this._extensionEventPropertyProducers.splice(r,1)}}}_processCookieIdentityChange(e){var t,r,i;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(i=this.sessionPersistence)||i.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(r=this.featureFlags)||r.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var o=s?void 0:this.persistence.remove_event_timer(e),a=n({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this._inCookielessMode()&&(a[qe]=!0),"$snapshot"===e){var u=n({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!Pt(a.distinct_id)&&!At(a.distinct_id)||Mt(a.distinct_id))&&Ms.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var d,p=function(e,t,r,i){var s,n,o,a;if(void 0===i&&(i=!1),!f)return{};var u,d=e?[...dl,...t||[]]:[],c=Qr(f),p=c[0],_=c[1],g=function(e){for(var t=0;Jr.length>t;t++){var r,i=Jr[t],s=i[1],n=i[2],o=e.match(i[0]);if(o)return[s,(null==(r=n&&e.match(n)||o)?void 0:r[1])||""]}return["",""]}(f),v=g[0],m=g[1],y=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},b={};Rt(r)||(b.detectGoogleSearchApp=r);var S={},w=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,k=null==(n=navigator)?void 0:n.maxTouchPoints,C=null==l||null==(o=l.screen)?void 0:o.width,E=null==l||null==(a=l.screen)?void 0:a.height,x=null==l?void 0:l.devicePixelRatio;Rt(w)||(S.userAgentDataPlatform=w),Rt(k)||(S.maxTouchPoints=k),Rt(C)||(S.screenWidth=C),Rt(E)||(S.screenHeight=E),Rt(x)||(S.devicePixelRatio=x);var T,I=Os($s({$os:p,$os_version:_,$browser:zr(f,navigator.vendor,y,b),$webview_app:v,$webview_app_version:m,$device:Kr(f),$device_type:Zr(f,S),$timezone:wl(),$timezone_offset:kl()}),{$current_url:Zs(i?li(null==h?void 0:h.href):null==h?void 0:h.href,d,hl),$host:null==h?void 0:h.host,$pathname:null==h?void 0:h.pathname,$raw_user_agent:f.length>1e3?f.substring(0,997)+"...":f,$browser_version:jr(f,navigator.vendor,y,b),$browser_language:fl(),$browser_language_prefix:(T=fl(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==l?void 0:l.screen.height,$screen_width:null==l?void 0:l.screen.width,$viewport_height:null==l?void 0:l.innerHeight,$viewport_width:null==l?void 0:l.innerWidth,$lib:Rs.LIB_NAME,$lib_version:Rs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Rs.SDK_DIST_CHANNEL&&(I.$sdk_dist_channel=Rs.SDK_DIST_CHANNEL),I}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var _=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime(),!0),g=_.windowId;a.$session_id=_.sessionId,a.$window_id=g}this.sessionPropsManager&&Os(a,this.sessionPropsManager.getSessionProps());try{var v;this.sessionRecording&&Os(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(v=this._retryQueue)?void 0:v.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===kb&&(a.$lib_custom_api_host=this.config.api_host),d="$pageview"!==e||s?"$pageleave"!==e||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=Os(a,d),"$pageview"===e&&c&&(a.title=c.title),!Rt(o)){var m=r.getTime()-o;a.$duration=parseFloat((m/1e3).toFixed(3))}f&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties(),S=a.$groups,w=y.$groups;Tt(S)&&!It(S)&&(a.$groups=n({},Tt(w)?w:{},S)),As(["$referrer","$referring_domain"],e=>{e in y&&delete b[e]});var k={};if(this._extensionEventPropertyProducers.length>0)for(var C of this._extensionEventPropertyProducers.slice())try{Os(k,C())}catch(e){Ms.error("Failed to produce browser extension event properties",e)}(a=Os({},p,y,b,n({},k,a))).$is_identified=this._isIdentified(),Et(this.config.property_denylist)?As(this.config.property_denylist,function(e){delete a[e]}):Ms.error(Hb+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(Ms.error(qb),a=E(a,e));var x=this._hasPersonProcessing();return a.$process_person_profile=x,x&&!s&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!r)return e;var s=Os({},this.persistence.get_initial_props(),(null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(Ms.error(qb),s=n(s,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),It(s)?void 0:s}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t,r;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(r=this.sessionPersistence)||r.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!Na._is_supported())Na._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Na._set(this._sessionRegisteredPropertiesStorageKey,t):Na._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var r,i;return null!==(r=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))&&void 0!==r?r:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:$b}),()=>{})}onSessionId(e){var t,r;return null!==(t=null==(r=this.sessionManager)?void 0:r.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:$b})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:$b})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=ug),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!==(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:$b}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!==(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==r?r:Promise.resolve({visible:!1,disabledReason:$b})}_validateIdentifyId(e){return!e||Mt(e)?(Ms.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Ms.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Ms.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return Ms.uninitializedWarning("posthog.identify");if(At(e)&&(e=e.toString(),Ms.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._healCookielessSentinelDistinctId();var i=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(E),this.register({distinct_id:e}));var u=(this.persistence.get_property("$user_state")||"anonymous")===tt,d=e!==l,c=!d&&u;if(d&&u){var h,p=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(Fe,rt),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(lt,p,{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=rl(e,t,r),null==(h=this.featureFlags)||h.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(c){this.persistence.set_property(Fe,rt);var _=t||{},g=r||{};this.setPersonPropertiesForFlags({$set:_,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:_,$set_once:g}),this._cachedPersonProperties=rl(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ie)):c&&(t||r)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=rl(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):Ms.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(Et(e)?e:[e]).filter(e=>Pt(e)&&e.length>0);0!==r.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this._cachedPersonProperties=null)}group(e,t,r){var i;if(e&&t){null==(i=this.persistence)||i.syncCookieProperties(),this._processCookieIdentityChange();var s=this.getGroups(),o=s[e]!==t;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:n({},s,{[e]:t})}),(o||r)&&this._hasPersonProcessing()){var a={$group_type:e,$group_key:t};r&&(a.$group_set=r),this.capture(ut,a)}r&&this.setGroupPropertiesForFlags({[e]:r}),o&&!r&&this.reloadFeatureFlags()}else Ms.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=Dt(e)?e:null==e?void 0:e.resetDeviceID,r=Dt(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,r)}_reset(e,t,r){var i,s,o,a;if(void 0===t&&(t=!1),Ms.info("reset"),!this.__loaded)return Ms.uninitializedWarning("posthog.reset");var l=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(i=this._originalUserConfig)?void 0:i.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var u=this.get_property(k),d=this.get_property(C),c=this.get_property(H);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var h=this.is_capturing();this.consent.reset(),t||!h||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var p=null==(a=this.persistence)||null==a._beginCookieSyncSuppression?void 0:a._beginCookieSyncSuppression(),_=!1;try{var g,v,f,m,y,b,S,w,E,x,T,I,R;if(null==(g=this.persistence)||g.clear(),null==(v=this.sessionPersistence)||v.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Rt(c)||null==(f=this.persistence)||f.register({[H]:c}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(b=this.conversations)||b.reset(),null==(S=this.logs)||S.reset(),null==(w=this.metrics)||w.reset(),null==(E=this.persistence)||E.set_property(Fe,tt),null==(x=this.sessionManager)||x.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:$e,$device_id:null},"");else{var P=this.config.get_device_id(va());this.register_once({distinct_id:P,$device_id:e?P:u},""),e||Rt(d)||this.register({[C]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this._inCookielessMode()||(null==(R=this.persistence)||R.set_property(Fe,r.isIdentifiedID?rt:tt),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(Rt(l)||null!=(I=this.sessionManager)&&I.setBootstrapSessionId(l,!0))){var M=n({},r);delete M.sessionID,this.config.bootstrap=M}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var F;p&&(null==(F=this.persistence)||null==F._endCookieSyncSuppression||F._endCookieSyncSuppression(_))}this.reloadFeatureFlags()}shutdown(e){var t=this;return a(function*(){var e,r,i,s,n,o,a;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(r=t.logs)||r.flushLogs("sendBeacon"),null==(i=t.metrics)||i.flush("sendBeacon"),null==(s=t._requestQueue)||s.unload(),null==(n=t._retryQueue)||n.unload();try{var l;null==(l=t.featureFlags)||l.destroy()}catch(e){Ms.error("Error while destroying feature flags",e)}null==(o=t.persistence)||o.destroy(),null==(a=t.sessionPersistence)||a.destroy()}else Ms.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var r;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&r){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-n,0)}return i}alias(e,t){return e===this.get_property("$people_distinct_id")?(Ms.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Rt(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(E,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Ms.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=n({},this.config);if(Tt(e)){var r,i,s,o,a,l,u,d,c,h,p,_,g;Os(this.config,Zb(e));var v=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hy(n({},this.config,{persistence:"sessionStorage"}),v,!1);var f=this._checkLocalStorageForDebug(this.config.debug);Dt(f)&&(this.config.debug=f),Dt(this.config.debug)&&(this.config.debug?(Ba.DEBUG=!0,ka._is_supported()&&ka._set("ph_debug",!0),Ms.info("set_config",{config:e,oldConfig:t,newConfig:n({},this.config)})):(Ba.DEBUG=!1,ka._is_supported()&&ka._remove("ph_debug"))),null==(i=this.featureFlags)||null==i.updateConfig||i.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(c=this.historyAutocapture)||c.startIfEnabledOrStop()),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(p=this.deadClicksAutocapture)||p.startIfEnabledOrStop(),null==(_=this.surveys)||_.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(g=this.externalIntegrations)||g.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&wy(this,Nb,!1)}}_overrideSDKInfo(e,t){Ba.LIB_NAME=e,Ba.LIB_VERSION=t}startSessionRecording(e){var t,r,i,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){try{if(!this.exceptions)return;var r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(n({},r,t))}catch(e){return}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,r;return null!==(t=null==(r=this.logs)?void 0:r.logger)&&void 0!==t?t:e._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!==(t=null==(r=this.toolbar)?void 0:r.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Vb;return t!==Vb&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&It(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e.__alias)&&(null==(t=this.persistence)||null==(t=t.props)||!t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Ms.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Be,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t,r,i,s,n=this._is_persistence_disabled();return this.is_capturing()||null==(e=this.logs)||e._onOptOut(),(null==(t=this.persistence)?void 0:t._disabled)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(i=this.sessionPersistence)?void 0:i._disabled)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(t){var r,i,s;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var n,o,a,l,u,d;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new bb(this),this.pageViewManager=new xy(this),this.persistence&&(this.sessionPropsManager=new vb(this,this.sessionManager,this.persistence));var c,h=null!==(l=null==(u=this.config.__extensionClasses)?void 0:u.sessionRecording)&&void 0!==l?l:null==(d=e.__defaultExtensionClasses)?void 0:d.sessionRecording;h&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new h(this)),this._lastRemoteConfig&&(null==(c=this.sessionRecording)||null==c.onRemoteConfig||c.onRemoteConfig(this._lastRemoteConfig)))}this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(i=this.surveys)||i.loadIfEnabled()),(Rt(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(s=null==t?void 0:t.captureEventName)&&void 0!==s?s:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Ms.warn(Bb)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var e,t,r="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==r||r.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:$e,$device_id:null}),this._removeExtension(r),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}else Ms.warn(Bb)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"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._sync_opt_out_with_persistence()}_is_bot(){return d?Sb(d,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){c&&("visible"===c.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(ot,{title:c.title},{send_instantly:!0}),this._visibilityStateListener&&(c.removeEventListener(st,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Ws(c,st,this._visibilityStateListener)))}debug(e){!1===e?(null==l||l.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==l||l.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}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ms.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(e,t,r,i,s){var n=t in e&&!Lt(e[t]),o=r in e&&!Lt(e[r]);return n?e[t]:!!o&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r])}(e,"advanced_disable_flags","advanced_disable_decide",0,Ms)}_runBeforeSend(e){var t;if(Lt(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter($t),i=Et(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var n of i)try{if(s=n(s),Lt(s)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Bt(e.event)?Ms.warn(o+". This can cause unexpected behavior."):Ms.info(o),null}s.properties&&!It(s.properties)||Ms.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Ms.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of r)if(s.properties&&Lt(s.properties[a]))return Ms.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}_checkLocalStorageForDebug(e){var t=Dt(e)&&!e,r=ka._is_supported()&&"true"===ka._get("ph_debug");return!t&&(!!r||e)}},e.__defaultExtensionClasses={},e._noopLogger=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),e);!function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=Bs(e.prototype[t[r]])}(Jb,["identify"]);var Xb=class{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,r=Tt(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==r?void 0:r.url_allowlist,e.url_ignorelist=null==r?void 0:r.url_ignorelist,e.dom_event_allowlist=null==r?void 0:r.dom_event_allowlist,e.element_allowlist=null==r?void 0:r.element_allowlist,e.css_selector_allowlist=null==r?void 0:r.css_selector_allowlist,e.css_selector_ignorelist=null==r?void 0:r.css_selector_ignorelist,e.element_attribute_ignorelist=null==r?void 0:r.element_attribute_ignorelist,e.capture_copied_text=null==r?void 0:r.capture_copied_text}},eS=Fs("[ExceptionAutocapture]"),tS=Fs("[TracingHeaders]"),rS=Fs("[Web Vitals]"),iS=9e5,sS=["CLS","FCP","INP","LCP"],nS=["INP","LCP"],oS=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],aS=Fs("[SessionRecording]"),lS=Fs("[Heatmaps]");function uS(e){return Tt(e)&&"clientX"in e&&"clientY"in e&&At(e.clientX)&&At(e.clientY)}var dS=Fs("[Product Tours]"),cS=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(N))},hS=Fs("[SiteApps]"),pS="Error while initializing PostHog app with config id ",_S=(e,t)=>null!=e&&e.then?e.then(t):t(e),gS="SDK is not enabled or survey functionality is not yet loaded",vS="Disabled. Not loading surveys.",fS=class{constructor(e,t){this._configSource=e,this._initialClientState=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(!this._disposed&&!this._config.disableSurveys){if(!e.ok)return rg.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(Lt(t))return rg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=Dt(t)?t:t.length>0,rg.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}}setup(e){if(!this._disposed)return this._initializingClient=e,_S(e.kv.initialize(),()=>{if(this._initializingClient===e&&!this._disposed){this._initializingClient=void 0,this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())}})}dispose(){var e,t,r;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(r=this._surveyManager)||null==r.dispose||r.dispose(),this._surveyManager=null,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach(e=>clearTimeout(e)),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(null!=i&&i.startsWith("seenSurvey_")||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(!this._disposed&&this._client){var e=this._config;if(!this._surveyManager)if(this._isInitializingSurveys)rg.info("Already initializing surveys, skipping...");else if(e.disableSurveys)rg.info(vS);else if(e.cookielessMode&&this._configSource.isOptedOut())rg.info("Not loading surveys in cookieless mode without consent.");else{var t=this._configSource.getExtensions();if(t){if(!Rt(this._isSurveysEnabled)||e.advancedEnableSurveys){var r=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{var i=t.generateSurveys;if(i)return this._completeSurveyInitialization(i,r),void(this._isInitializingSurveys=!1);var s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(et),void(this._isInitializingSurveys=!1);s(e=>{try{if(this._disposed)return;var t=this._configSource.getExtensions();e||null==t||!t.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,r)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}}else rg.error("PostHog Extensions not found.")}}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),rg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){rg.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e,t){var r;void 0===t&&(t=!1);var i=null!==(r=this._client)&&void 0!==r?r:this._initialClientState;if(i&&!this._disposed){if(this._config.disableSurveys)return rg.info(vS),e([]);var s=i.kv.get(ve);if(s&&!t)return e(s,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)this._getSurveysInFlightPromise.then(t=>{this._disposed||e(t.surveys,t.context)}).catch(e=>rg.error("Error in survey callback",e));else{var n=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(i,e)}catch(e){return rg.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(i,{statusCode:0,error:e}));this._getSurveysInFlightPromise=n;var o=()=>{this._getSurveysInFlightPromise===n&&(this._getSurveysInFlightPromise=null)};n.then(t=>{o(),this._disposed||e(t.surveys,t.context)},o).catch(e=>rg.error("Error in survey callback",e))}}}_sendSurveysRequest(e,t){var r=this._client;return r?r.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:new Error(gS)}))}_handleSurveyResponse(e,t){var r;if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:gS}};var i=t.statusCode;if(200!==i||!t.json){var s="Surveys API could not be loaded, status: "+i;return 0!==i?rg.error(s):t.error||rg.warn(s),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this._lastSurveyRefreshFailedAt=null;var n=t.json.surveys||[],o=n.filter(e=>ig(e)&&(Za(e)||sg(e)));return o.length>0&&(null==(r=this._surveyEventReceiver)||r.register(o)),e.kv.set({[ve]:n,[fe]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t,r=null==(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)?void 0:e.kv.get(fe);return At(r)&&Date.now()-r>3e5}_isSurveyRefreshBackingOff(){return At(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var r;ag({id:e,current_iteration:null!==(r=null==t?void 0:t.iteration)&&void 0!==r?r:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){rg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Lt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);rg.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys(r=>{var i;t=null!==(i=r.find(t=>t.id===e))&&void 0!==i?i:null}),t}_checkSurveyEligibility(e){if(Lt(this._surveyManager))return{eligible:!1,reason:gS};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(Lt(this._surveyManager))return{eligible:!1,reason:gS};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Lt(this._surveyManager))return rg.warn("init was not called"),{visible:!1,disabledReason:gS};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Lt(this._surveyManager)?(rg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:gS})):new Promise(r=>{this.getSurveys(t=>{var i,s=null!==(i=t.find(t=>t.id===e))&&void 0!==i?i:null;if(s){var n=this._checkSurveyRenderability(s);r({visible:n.eligible,disabledReason:n.reason})}else r({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,r){var i;if(Lt(this._surveyManager))rg.warn("init was not called");else{var s="string"==typeof e?this._getSurveyById(e):e;if(null!=s&&s.id)if(lg.includes(s.type)){var n=null==c?void 0:c.querySelector(t);if(n)if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds){rg.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var e,t;this._renderTimeouts.delete(o),this._disposed||(rg.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,n,r),rg.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this._renderTimeouts.add(o)}else this._surveyManager.renderSurvey(s,n,r);else rg.warn("Survey element not found")}else rg.warn("Surveys of type "+s.type+" cannot be rendered in the app");else rg.warn("Survey not found")}}displaySurvey(e,t){var r;if(Lt(this._surveyManager))rg.warn("init was not called");else{var i=this._getSurveyById(e);if(i){var s=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=n({},i,{appearance:n({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==eg.Popover&&t.initialResponses&&rg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this._checkSurveyEligibility(i);if(!o.eligible)return void rg.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==eg.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else rg.warn("Survey not found")}}cancelPendingSurvey(e){Lt(this._surveyManager)?rg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}};function mS(e,t,r){if(Lt(e))return!1;switch(r){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var yS=class{constructor(e){this._instance=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new fb,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;Rt(null==(e=this._instance)?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null==(t=this._instance)?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null==(e=this._captureHookUnsubscribe)||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new fb}register(e){var t,r;if(!Rt(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null==(t=e.steps)||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null!=(r=this._instance)&&r.autocapture)){var i=new Set;this._actionRegistry.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&i.add(e.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach(e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var r of t.steps)if(this._checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i)return!1;if(!mS(i,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var r;if(null==t||!t.href)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some(e=>mS(e.href,t.href,t.href_matching||"exact"));var s,n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!n&&mS((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var r;if(null==t||!t.text)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some(e=>mS(e.text,t.text,t.text_matching||"exact")||mS(e.$el_text,t.text,t.text_matching||"exact"));var s,n,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(s=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!Lt(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),n=t.text,o=t.text_matching||"exact",s.some(e=>mS(e,n,o)))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;if(null!=e&&null!=(r=e.properties)&&null!=(r=r.$element_selectors)&&r.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||tl(t.properties.reduce((e,t)=>{var r=Et(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},bS=class{constructor(e){var t;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null==(t=this._instance)||null==t.onSessionId?void 0:t.onSessionId(e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&tl(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var r=new Map;return e.forEach(e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}})}),r}_getMatchingItems(e,t,r){var i=(r===z_.Activation?this._eventToItems:this._cancelEventToItems).get(e),s=[];return this._getItems(e=>{s=e.filter(e=>null==i?void 0:i.includes(e.id))}),s.filter(i=>{var s,n=null==(s=i.conditions)||null==(s=s[r])||null==(s=s.values)?void 0:s.find(t=>t.name===e);return this._doesEventMatchFilter(n,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var r;Rt(null==(r=this._instance)?void 0:r._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){var r=e.filter(e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length});if(t&&this._actionToItems.clear(),0!==r.length){this._actionMatcher||(this._actionMatcher=new yS(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));var i=[];r.forEach(e=>{var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach(t=>{if(i.push(t),t.name){var r,s=null!==(r=this._actionToItems.get(t.name))&&void 0!==r?r:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}})}),t?this._actionMatcher.replace(i):this._actionMatcher.register(i)}else{var s;t&&(null==(s=this._actionMatcher)||s.replace([]))}}_mergeItemMaps(e,t){t.forEach((t,r)=>{var i,s=null!==(i=e.get(r))&&void 0!==i?i:[];t.forEach(e=>{s.includes(e)||s.push(e)}),e.set(r,s)})}_setupEventBasedItems(e,t){var r,i,s=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0}),n=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0}),o=this._buildEventToItemMap(e,z_.Activation),a=this._buildEventToItemMap(e,z_.Cancellation);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==s.length||0!==n.length)&&(null!==(r=this._captureHookUnsubscribe)&&void 0!==r||(this._captureHookUnsubscribe=null==(i=this._instance)?void 0:i._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var r,i,s=this._getLogger(),n=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this._activationOutcome(e,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:e,itemId:n}),void this._deactivateItems([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:e,itemId:n}),this._persistActivation(n),void this._clearActivationTimestamps([n])}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,z_.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(e=>e.id)}),this._deactivateItems(a.map(e=>e.id)),a.forEach(e=>this._cancelPendingItem(e.id)))}if(this._eventToItems.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,z_.Activation);this._activateItems(l.map(e=>e.id))}}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t;if(0!==e.length){var r=!(null==(t=this._instance)||null==t.get_session_id||!t.get_session_id()),i=[];for(var s of e)r&&this._shouldPersistArmedActivation(s)?this._persistActivation(s)&&this._recordActivationTimestamp(s):i.push(s);i.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...i])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);var t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));var r=this._getRawPersistedActivatedIds(),i=r.filter(e=>!t.has(e));i.length!==r.length&&(this._setActivatedItems(i),0===i.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e,t=this._getActivationTimestampsKey();if(!t)return{};var r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return r&&"object"==typeof r?r:{}}_recordActivationTimestamp(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps();this._writeActivationTimestamps(n({},t,{[e]:Date.now()}))}}_clearActivationTimestamps(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps(),r={},i=!1;for(var s of Object.entries(t)){var n=s[0],o=s[1];e.includes(n)?i=!0:r[n]=o}i&&(It(r)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(r))}}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(this._getPersistedActivatedIds().includes(e)){var t=this._getRawActivationTimestamps()[e];return At(t)?t:void 0}}_getRawPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,r=this._getRawPersistedActivatedIds();if(0===r.length)return[];var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._getActivatedSessionKey()],s=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return s&&i===s?r:[]}_stampActivationSession(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this._setActivatedSession(t)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t,r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._getActivatedSessionKey()];if(r&&r!==e){var i=this._getRawPersistedActivatedIds(),s=this._getRawActivationTimestamps();i.length>0&&(this._setActivatedItems([]),i.filter(e=>At(s[e])).forEach(e=>this._cancelPendingItem(e))),this._clearActivationSession(),this._clearAllActivationTimestamps()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter(e=>!this._isItemPermanentlyIneligible(e))}dispose(){var e,t,r;null==(e=this._sessionIdUnsubscribe)||e.call(this),this._sessionIdUnsubscribe=void 0,null==(t=this._captureHookUnsubscribe)||t.call(this),this._captureHookUnsubscribe=void 0,null==(r=this._actionMatcher)||r.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}},SS=class extends bS{constructor(e){super(e)}_getActivatedKey(){return me}_getActivatedSessionKey(){return ye}_getActivationTimestampsKey(){return be}_writeActivationTimestamps(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[be]:e})}_clearActivationTimestampsStore(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(be)}_shouldPersistArmedActivation(e){var t,r;this._getItems(t=>{r=t.find(t=>t.id===e)});var i=null==(t=r)||null==(t=t.appearance)?void 0:t.surveyPopupDelaySeconds;return At(i)&&i>0}_getShownEventName(){return J_.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return rg}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[me]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ye]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(ye)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems(e=>{r=e.find(e=>e.id===t)}),!r||Ya(r)?e===J_.SHOWN?"consume":"ignore":e===J_.SHOWN?"persist":e===J_.DISMISSED||e===J_.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},wS=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);var t={};for(var r of e){var i=this._instance.get_property(r);Rt(i)||(t[r]=i)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}},kS=class{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=null==b?void 0:b.__PosthogExtensions__;if(e){var t=e.generateSurveys,r=e.loadExternalDependency;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:r?e=>r(this._instance,"surveys",e):void 0}}}createEventReceiver(){return new SS(this._instance)}},CS=null!=l&&l.location?Ys(l.location.hash,"__posthog")||Ys(location.hash,"state"):null,ES="_postHogToolbarParams",xS=Fs("[Toolbar]"),TS=Fs("[FeatureFlags]"),IS=class{constructor(e,t){void 0===t&&(t=!1),this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var r,i,s,n,o;return{bootstrap:{featureFlags:null==(r=e.bootstrap)?void 0:r.featureFlags,featureFlagPayloads:null==(i=e.bootstrap)?void 0:i.featureFlagPayloads},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=e.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=e.evaluation_contexts)&&void 0!==o?o:e.evaluation_environments)&&void 0!==n?n:[],flagKeys:Et(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(TS.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),Rt(e.flag_keys)||Et(e.flag_keys)||TS.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}},RS=Fs("[FeatureFlags]"),PS=Fs("[FeatureFlags]",{debugEnabled:!0}),MS="\" failed. Feature flags didn't load in time.",FS="connection_error",LS=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},AS=e=>{var t={};for(var r of Ds(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},OS="Refusing to render web experiment since the viewer is a likely bot",DS={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>Ja(t,e),not_regex:(e,t)=>!Ja(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},NS=Fs("[Conversations]"),BS="Conversations not available yet.";function $S(e,t){var r,i,s,o,a,l,u,c=null!==(r=null==e?void 0:e.flushIntervalMs)&&void 0!==r?r:3e3,h=null!==(i=null==e?void 0:e.maxBufferSize)&&void 0!==i?i:100,p=null!=t&&t.consoleCapture?void 0:null!==(s=null==e?void 0:e.maxLogsPerInterval)&&void 0!==s?s:1e3,_=Rt(p)?Math.max(h,2048):Math.max(h,p),g=n({},function(){var e="",t="";try{var r=null==d?void 0:d.userAgent;if(r){var i=Qr(r);e=i[0],t=i[1]}}catch(e){}return function(e,t){var r=function(e){if(e)return{}.hasOwnProperty.call(gs,e)?gs[e]:e}(e);return n({},r?{"os.name":r}:{},t?{"os.version":t}:{})}(e,t)}(),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==g?void 0:g["service.name"])&&void 0!==a?a:null==e?void 0:e.serviceName)&&void 0!==o?o:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(l=null==g?void 0:g["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(u=null==g?void 0:g["deployment.environment"])&&void 0!==u?u:null==e?void 0:e.environment,resourceAttributes:g,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:h,maxQueueSize:_,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:p,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var qS=["debug","log","warn","error","info"],HS="console",US="__posthogHandledLogsRequestError",WS=(e,t)=>{var r=e instanceof Error?e:new Error(t);return r[US]=!0,r},zS=e=>!!e&&"object"==typeof e&&!0===e[US],VS={featureFlags:class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=RS,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._onOnline=()=>{var e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t=this._refreshIntervalMs;Rt(t)||this._config.remoteRequestsDisabled||!c||"hidden"===c.visibilityState||Date.now()-(null!==(e=this._lastRefreshAt)&&void 0!==e?e:0)<t||(this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onVisibilityChange=()=>{"visible"===(null==c?void 0:c.visibilityState)&&this._refreshIfDue()},"get"in e?this._configSource=e:(this._instance=e,this._mutableConfigSource=new IS(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var r;null==(r=this._mutableConfigSource)||r.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),_S(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(e){var t;if(this._client===e)return l&&Ws(l,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=e.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_syncAutomaticRefresh(){var e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&c&&!Rt(e)&&e>0?e:void 0;t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),Rt(t)||(this._refreshIntervalMs=t,this._scheduleNextRefresh(),null!=c&&c.addEventListener&&Ws(c,st,this._onVisibilityChange)))}_scheduleNextRefresh(){Rt(this._refreshIntervalMs)||(Rt(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){Rt(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==c||null==c.removeEventListener||c.removeEventListener(st,this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var e,t;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null==(e=this._dynamicProperties)||e.dispose(),this._dynamicProperties=void 0,null==(t=this._crossTabPersistenceUnsubscribe)||t.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null==l||l.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return this._bootstrapState&&e in this._bootstrapState?this._bootstrapState[e]:null==(t=this._client)?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!Rt(null==(e=this._client)?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null==(t=this._client)?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,r){var i;if(null!=(i=this._instance)&&i.persistence&&e.$enabled_feature_flags){var s=this._prop("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(e=>{var t=e[1];return!(null!=t&&t.failed)}).map(e=>e[0]):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:r&&!Et(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),d=this._prop("$feature_flag_payloads")||{},c=e.$feature_flag_payloads||{},h=l||r?u:Array.from(new Set([...Object.keys(d),...Object.keys(c)])),p=!l&&!r,_=!!p||u,g=!!p||h,v={[ne]:_,[se]:_,[le]:g};for(var f of(e.$feature_flag_details&&(v[ae]=_),[ue,Me,de]))Rt(e[f])||(v[f]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}}_remove(e){this._persist(()=>{var t;return null==(t=this._client)?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){var e={};for(var t of[ne,le,ue,ce]){var r=this._prop(t);Rt(r)||(e[t]=r)}this._baseEventProperties=e;var i=n({},e),s=this._prop(se);if(s)for(var o of Object.entries(s))i["$feature/"+o[0]]=o[1];this._eventPropertiesWithFlagValues=i}_isCacheStale(){var e=this._config.cacheTtlMs;if(!e||0>=e)return!1;var t=this._prop(Me);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e=this._config.evaluationContexts;return null!=e&&e.length?e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}_getValidFlagKeys(){var e=this._config.flagKeys;if(!Rt(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t,r=this._config,i=null!==(e=null==(t=r.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var s,n,o=null!==(s=null==(n=r.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(i).filter(e=>!Rt(i[e])).reduce((e,t)=>(e[t]=i[t],e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(e[t]=o[t],e),{});return this._receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,r){var i,s,o=null!=r&&r.merge&&null!==(i=this._prop("$enabled_feature_flags"))&&void 0!==i?i:{},a=null!=r&&r.merge&&null!==(s=this._prop("$feature_flag_payloads"))&&void 0!==s?s:{},l=n({},o,e),u=n({},a,t),d={};for(var c of Object.entries(l)){var h=c[0],p=c[1];d[h]={key:h,enabled:Zi(p),variant:Yi(p),reason:void 0,metadata:Rt(null==u?void 0:u[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this._receivedFeatureFlags({flags:d})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(ae),t=this._prop(ce),r=this._prop(he);if(!r&&!t)return e||{};var i=Os({},e||{});for(var s of[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])]){var o,a,l=i[s],u=null==t?void 0:t[s],d=Rt(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,c=Rt(u)?null==l?void 0:l.variant:"string"==typeof u?u:void 0,h=null==r?void 0:r[s],p=n({},l,{enabled:d,variant:d?null!=c?c:null==l?void 0:l.variant:void 0});d!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),c!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),h&&(p.metadata=n({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),i[s]=p}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(r=>{var i=e[r];return{key:r,enabled:Zi(i),variant:Yi(i),payload:Ki(t[r])}})}getFlagVariants(){var e=this._prop(se),t=this._prop(ce);if(!t)return e||{};for(var r=Os({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(le),t=this._prop(he);if(!t)return e||{};for(var r=Os({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||(this._requestInFlight&&(this._additionalReloadRequested=!0),this._reloadDebouncer||(this._reloadingHandlers.slice().forEach(e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}}),this._reloadDebouncer=setTimeout(()=>{this._callFlagsEndpoint()},5)))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter(t=>t!==e)}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(Ie)}_callFlagsEndpoint(e){this._clearDebouncer();var t=this._client;if(t&&!this._config.remoteRequestsDisabled&&!this._hasStatusZeroCircuitBreakerTripped())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:n({},t.initialPersonProperties,this._prop("$stored_person_properties")||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(_e),timezone:wl()};Rt(t.deviceId)||(r.$device_id=t.deviceId),(null!=e&&e.disableFlags||this._config.featureFlagsDisabled)&&(r.disable_flags=!0);var i=this._getValidEvaluationEnvironments();i.length&&(r.evaluation_contexts=i);var s=this._getValidFlagKeys();Rt(s)||(r.flag_keys=s);var o=this._config.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this._requestGeneration;this._requestInFlight=!0;var u=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},d=e=>{this._requestInFlight=!1,l===this._requestGeneration?(this._set({[Pe]:[FS]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),u()):u()};try{t.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(e=>{var t,i,s=null!==(t=e.json)&&void 0!==t?t:{},n=200!==e.statusCode;if(this._requestInFlight=!1,l===this._requestGeneration){if(this._trackStatusZeroReachability(e.statusCode),n||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),!r.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!n;var a=[];e.error?a.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?FS:"unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var d=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));d&&a.push("quota_limited"),this._set({[Pe]:a}),d?this._logger.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."):r.disable_flags||this._receivedFeatureFlags(s,n,{partialResponse:o}),u()}}else u()}).catch(d)}catch(e){d(e)}}}_hasStatusZeroCircuitBreakerTripped(){return Js(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=Xs(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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(e,t){var r;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFeatureFlagResult(e,t);return null!==(r=null==i?void 0:i.variant)&&void 0!==r?r:null==i?void 0:i.enabled}}else this._logger.warn('getFeatureFlag for key "'+e+MS)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t;return null==(t=this.getFeatureFlagResult(e,{send_event:!1}))?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var r,i=this.getFlagVariants(),s=e in i,o=i[e],a=this.getFlagPayloads()[e],l=String(o),u=this._prop("$feature_flag_request_id")||void 0,d=this._prop("$feature_flag_evaluated_at")||void 0,c=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var h,p=null==(h=this._client)?void 0:h.session.sessionId,_=this._prop(Re);p&&p!==_&&(c={},r=p)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(l))r&&this._set({[Ie]:c,[Re]:r});else{var g,v,f,m,y,b,S,w,k,C,E,x,T;Et(c[e])?c[e].push(l):c[e]=[l],this._set(n({[Ie]:c},r?{[Re]:r}:{}));var I=this.getFeatureFlagDetails(e),R=[...null!==(g=this._prop("$feature_flag_errors"))&&void 0!==g?g:[]];Rt(o)&&R.push("flag_missing");var P={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:u,$feature_flag_evaluated_at:d,$feature_flag_bootstrapped_response:null!==(v=null==(f=this._config.bootstrap)||null==(f=f.featureFlags)?void 0:f[e])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this._config.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])&&void 0!==m?m:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Rt(null==I||null==(b=I.metadata)?void 0:b.has_experiment)||(P.$feature_flag_has_experiment=I.metadata.has_experiment),Rt(null==I||null==(S=I.metadata)?void 0:S.version)||(P.$feature_flag_version=I.metadata.version);var M=null!==(w=null==I||null==(k=I.reason)?void 0:k.description)&&void 0!==w?w:null==I||null==(C=I.reason)?void 0:C.code;M&&(P.$feature_flag_reason=M),null!=I&&null!=(E=I.metadata)&&E.id&&(P.$feature_flag_id=I.metadata.id),Rt(null==I?void 0:I.original_variant)&&Rt(null==I?void 0:I.original_enabled)||(P.$feature_flag_original_response=Rt(I.original_variant)?I.original_enabled:I.original_variant),null!=I&&null!=(x=I.metadata)&&x.original_payload&&(P.$feature_flag_original_payload=null==I||null==(T=I.metadata)?void 0:T.original_payload),R.length&&(P.$feature_flag_error=R.join(",")),this._captureFeatureFlagCalled(P)}else r&&this._set({[Ie]:c,[Re]:r});if(s)return{key:e,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Ki(a)}}}else this._logger.warn('getFeatureFlagResult for key "'+e+MS)}_captureFeatureFlagCalled(e){try{var t;null==(t=this._client)||t.capture("$feature_flag_called",e).catch(e=>{this._logger.error("Failed to capture feature flag call",e)})}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var r=this;return a(function*(){var i=r._client;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r._getValidEvaluationEnvironments();n.length&&(s.evaluation_contexts=n);var o,a=r._getValidFlagKeys();Rt(a)||(s.flag_keys=a);try{var l;o=(null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r._config.compression,sentAt:"body",timeoutMs:r._config.requestTimeoutMs})).json)||null==(l=l.featureFlagPayloads)?void 0:l[e])||void 0}catch(e){return void r._logger.error("Remote config feature flag request failed",e)}try{t(o)}catch(e){r._logger.error("Remote config feature flag callback failed",e)}}})()}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+MS),t.defaultValue;var r=this.getFeatureFlag(e,t);return Rt(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,r){this._receivedFeatureFlags(e,t,r)}_receivedFeatureFlags(e,t,r){if(this._client){this._hasLoadedFlags=!0;var i=function(e,t,r,i,s,o){void 0===t&&(t={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o=RS);var a=((e,t)=>{var r=e.flags;return r?n({},e,{featureFlags:Object.fromEntries(Object.keys(r).map(e=>{var t;return[e,null!==(t=r[e].variant)&&void 0!==t?t:r[e].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter(e=>r[e].enabled).filter(e=>{var t;return!Rt(null==(t=r[e].metadata)?void 0:t.payload)}).map(e=>{var t;return[e,null==(t=r[e].metadata)?void 0:t.payload]}))}):(e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e)})(e,o),l=a.flags,u=a.featureFlags,d=a.featureFlagPayloads;if(u){var c=e.requestId,h=e.evaluatedAt;if(Et(u)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var _=0;u.length>_;_++)p[u[_]]=!0;return{[ne]:u,[se]:p,[de]:!1}}var g=u,v=d,f=l;if(null!=s&&s.partialResponse){var m=Object.keys(g),y=v||{};g=n({},t,g),v=n({},r,y),m.forEach(e=>{var t;e in y||null==(t=v)||delete t[e]}),f=n({},i,f)}else if(e.errorsWhileComputingFlags)if(l){var b=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));g=n({},t,Object.fromEntries(Object.entries(g).filter(e=>b.has(e[0]))));var S=Object.fromEntries(Object.entries(v||{}).filter(e=>b.has(e[0])));v=n({},r,S),b.forEach(e=>{var t;e in S||null==(t=v)||delete t[e]}),f=n({},i,Object.fromEntries(Object.entries(f||{}).filter(e=>b.has(e[0]))))}else g=n({},t,g),v=n({},r,v),f=n({},i,f);return n({[ne]:Object.keys(AS(g)),[se]:g||{},[le]:v||{},[ae]:f||{},[de]:!0===e.minimalFlagCalledEvents},c?{[ue]:c}:{},h?{[Me]:h}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this._logger);if(i)if(!1===(null==r?void 0:r.persist)){var s=!Rt(this._client.kv.get(se));this._bootstrapState=i,s||this._set(i)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(i,e,!(null==r||!r.partialResponse)),this._set(i);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([ce,he]),this._fireFeatureFlagsCallbacks(),void PS.info("All overrides cleared");if(Et(e))return this._set({[ce]:LS(e)}),this._fireFeatureFlagsCallbacks(),void PS.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,r=e;this._override_warning=Boolean(null!==(t=r.suppressWarning)&&void 0!==t&&t);var i={},s=r.flags,n=r.payloads;return s&&(i[ce]=Et(s)?LS(s):s),n&&(i[he]=n),Object.keys(i).length&&this._set(i),!1===s&&!1===n?this._remove([ce,he]):!1===s?this._remove(ce):!1===n&&this._remove(he),this._fireFeatureFlagsCallbacks(),!1===s?PS.info("Flag overrides cleared"):s&&PS.info("Flag overrides set",{flags:s}),void(!1===n?PS.info("Payload overrides cleared"):n&&PS.info("Payload overrides set",{payloads:n}))}if(e&&"object"==typeof e)return this._set({[ce]:e}),this._fireFeatureFlagsCallbacks(),void PS.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;try{e(r,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i,s=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r);var l=n({},this.getFlagVariants(),{[e]:t});null==(i=this._instance)||null==(i=i.persistence)||i.markCrossTabFeatureFlagChanges({[ne]:[e],[se]:[e],[pe]:Object.keys(o)}),this._set({[ne]:Object.keys(AS(l)),[se]:l,[pe]:n({},this._prop("$stored_person_properties")||{},o)}),this._fireFeatureFlagsCallbacks();try{var u;null==(u=this._client)||u.capture("$feature_enrollment_update",a).catch(e=>{this._logger.error("Failed to capture early access feature enrollment",e)})}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(oe);!i||t?this._getEarlyAccessFeatures(e,r):e(i)}_getEarlyAccessFeatures(e,t){var r=this;return a(function*(){var i=r._client;if(i){var s,n=t?"&"+t.map(e=>"stage="+e).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;s=o.json.earlyAccessFeatures,r._set({[oe]:s})}catch(e){return void r._logger.error("Early access feature request failed",e)}try{e(s)}catch(e){r._logger.error("Early access feature callback failed",e)}}})()}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,r)=>(e[r]=t[r],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach(t=>{try{t(r,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop("$stored_person_properties")||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,o={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in r||(o[a]=s[a]));this._set({[pe]:n({},r,o,i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=n({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete r[e]}),this._set({[pe]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._remove(pe),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop("$stored_group_properties")||{},i=n({},r);for(var s of Object.keys(e))i[s]=n({},r[s],e[s]);this._set({[_e]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop("$stored_group_properties")||{};this._set({[_e]:n({},t,{[e]:{}})})}else this._remove(_e)}reset(){this._requestGeneration++,this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._bootstrapState=void 0,this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},jS={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return"awaiting_config"===this._recordingStatus||"missing_config"===this._recordingStatus?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=Xn,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var e;if(null==c||!c.visibilityState||"visible"===c.visibilityState)return!0;var t=null==l||null==(e=l.performance)||null==e.getEntriesByType?void 0:e.getEntriesByType("visibility-state");return!(null!=t&&t.length)||t.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e;"visible"===(null==c?void 0:c.visibilityState)&&(this._documentWasEverVisible=!0,null==(e=this._lazyLoadedSessionRecording)||null==e.setDocumentWasEverVisible||e.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw aS.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._config.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=c&&c.addEventListener&&Ws(c,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(void 0===e?{}:e).discardBufferedEvents,r=void 0!==t&&t;this._sessionRecordingDisposed=!0,null==c||null==c.removeEventListener||c.removeEventListener("visibilitychange",this._onVisibilityChange),r?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(H))||!e.enabled),r=!this._config.disable_session_recording,i=this._config.disable_session_recording||this._instance.consent.isOptedOut();return l&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!(this._sessionRecordingDisposed||this._isRecordingEnabled&&null!=(t=this._lazyLoadedSessionRecording)&&t.isStarted)){var r=!Rt(Object.assign)&&!Rt(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),aS.info("starting")):(this._recordingStatus=Xn,this.stopRecording())}}_lazyLoadAndStart(e){var t,r;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=so),null!=b&&null!=(t=b.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=b.__PosthogExtensions__)&&r.initSessionRecording)this._onScriptLoaded(e);else{var i,s=this._instance.sessionManager;null==(i=b.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,t=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===s)return t?(this._instance.register_for_session({[We]:!0}),aS.error("could not load recorder",t)):void this._onScriptLoaded(e);this._recordingStatus=Xn})}}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(e){var t,r;void 0===e&&(e=!1),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=void 0,null==(r=this._lazyLoadedSessionRecording)||r.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(K),null==(t=this._persistence)||t.unregister(W)}_validateSampleRate(e,t){if(Lt(e))return null;var r,i=At(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(aS.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}_persistRemoteConfig(e){if(this._persistence){var t,r,i=this._persistence,s=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=s?s:o;Lt(a)&&this._resetSampling();var l=null==r?void 0:r.minimumDurationMilliseconds;i.register({[H]:n({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:n({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Rt(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};s(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(s)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):("awaiting_config"===this._recordingStatus&&(this._recordingStatus="missing_config",aS.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this._lazyLoadedSessionRecording)&&r.log?this._lazyLoadedSessionRecording.log(e,t):aS.warn("log called before recorder was ready")}get _scriptName(){var e;return(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.get_property("$session_recording_remote_config"))||null==(e=e.scriptConfig)?void 0:e.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(H);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return aS.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Lt(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}_onScriptLoaded(e){var t,r,i;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(null==(t=b.__PosthogExtensions__)||!t.initSessionRecording)return aS.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[We]:!0});var s;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(s=b.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if("missing_config"===this._recordingStatus||"awaiting_config"===this._recordingStatus)return;return this._recordingStatus="awaiting_config",aS.info("persisted remote config is stale, requesting fresh config before starting"),void new Qy(this._instance).load()}this._recordingStatus=so,null==(r=(i=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||r.call(i,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=Xn}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(e=this._persistence)||e.register({[V]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(e=this._persistence)||e.register({[z]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({["url"===e?j:G]:!0}),null==(r=this._lazyLoadedSessionRecording)||r.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this._lazyLoadedSessionRecording)||!r.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e;null==(e=this._lazyLoadedSessionRecording)||null==e.flushBeforeIdentityReset||e.flushBeforeIdentityReset()}}},GS={autocapture:class extends oy{constructor(e){super(new Xb(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(Ms.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,Ms.info("History API monitoring stopped")}monitorHistoryChanges(){l&&l.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(e){var t;if(l&&(null==(t=l.history[e])||!t.__posthog_wrapped__)){var r=this;tp(l.history,e,t=>function(i,s,n){t.call(this,i,s,n),r._capturePageview(e)})}}_getCurrentLocation(){var e=null==l?void 0:l.location;if(null!=e&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}_getCaptureOptions(){var e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:Tt(e)?e:{}}_shouldCaptureHashChanges(e){return void 0===e&&(e=this._getCaptureOptions()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){var t=this._getCaptureOptions(),r=this._lastLocation;return!(!r||!(t.path&&e.pathname!==r.pathname||t.search&&e.search!==r.search||this._shouldCaptureHashChanges(t)&&e.hash!==r.hash))}_capturePageview(e){try{var t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(ot,{navigation_type:e}),this._lastLocation=t}catch(t){Ms.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};Ws(l,"popstate",e),this._popstateListener=()=>{l&&l.removeEventListener("popstate",e)}}}_setupHashchangeListener(){if(!this._hashchangeListener){var e=()=>{this._capturePageview("hashchange")};Ws(l,"hashchange",e),this._hashchangeListener=()=>{l&&l.removeEventListener("hashchange",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[M]),this.rageclicks=new ey(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Tt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Lt(this._config.capture_heatmaps)?Lt(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;lS.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[M]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){uS(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==c?void 0:c.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){l&&c&&(this._flushHandler=this._flush.bind(this),Ws(l,nt,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==l?void 0:l.event)),Ws(c,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==l?void 0:l.event)),Ws(c,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new by(this.instance,my,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Ws(c,st,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;l&&c&&(this._flushHandler&&l.removeEventListener(nt,this._flushHandler),this._onClickHandler&&c.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&c.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&c.removeEventListener(st,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,r){for(var i=e;i&&sn(i)&&!nn(i,"body");){if(i===r)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=i.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:l)?void 0:n.getComputedStyle(i).position}catch(e){return!1}if(ht(t,s))return!0;i=fn(i)}return!1}(pn(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:i),y:e.clientY+(n?0:r),target_fixed:n,type:t}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!rn(e.target)&&uS(e)){var i=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&En(pn(e),this.instance.config.rageclick)&&this._capture(n({},i,{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){!rn(e.target)&&uS(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(l){var t=this._config.disable_capture_url_hashes?li(l.location.href):l.location.href,r=this._config.custom_personal_data_properties,i=Zs(t,this._config.mask_personal_data_properties?[...dl,...r||[]]:[],hl);this._buffer=this._buffer||{},this._buffer[i]||(this._buffer[i]=[]),this._buffer[i].push(e)}}_flush(){this._buffer&&!It(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:by,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",n({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>n({},e,{["$web_vitals_"+t.name+"_event"]:n({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{}))),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Lt(null==e?void 0:e.name)||Lt(null==e?void 0:e.value))rS.error("Invalid metric received",e);else{var r="string"==typeof e.navigationURL?e.navigationURL:void 0,i=this._maskedURL(r);if(!Rt(i)){var s=At(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+i;if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.navigationKey!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Rt(this._buffer.navigationKey)&&(this._buffer.navigationKey=s,this._buffer.url=i),this._buffer.firstMetricTimestamp=Rt(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;var o=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),a=n({},e,r?{navigationURL:i}:{},{$current_url:i,timestamp:Date.now()});if(delete a.entries,Tt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){var l={};for(var u of oS){var d="url"===u&&"string"==typeof e.attribution[u]?this._maskedURL(e.attribution[u]):e.attribution[u];Rt(d)||(l[u]=d)}a.attribution=l}else delete a.attribution;Rt(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this._buffer.metrics.push(a),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else rS.error("Ignoring metric with value >= "+this._maxAllowedValue,e)}}},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,s=!1,o=b.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Rt(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Rt(l)){var u=l.withoutAttribution,d=this.attributionMetrics;s=!Rt(u),e=d.indexOf("LCP")>-1?l.onLCP:(null==u?void 0:u.onLCP)||l.onLCP,t=d.indexOf("CLS")>-1?l.onCLS:(null==u?void 0:u.onCLS)||l.onCLS,r=d.indexOf("FCP")>-1?l.onFCP:(null==u?void 0:u.onFCP)||l.onFCP,i=d.indexOf("INP")>-1?l.onINP:(null==u?void 0:u.onINP)||l.onINP}if(e&&t&&r&&i){var c={reportSoftNavs:this.useSoftNavs},h=s&&this.attributionMetrics.indexOf("INP")>-1?n({},c,{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&i(this._addToBuffer.bind(this),h),this._initialized=!0}else rS.error("web vitals callbacks not loaded - not starting")}},this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[O]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=Tt(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Lt(r)?(null==(t=this._instance.persistence)?void 0:t.props.$web_vitals_allowed_metrics)||sS:r}get flushToCaptureTimeoutMs(){return(Tt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=Tt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return Dt(e)?e?sS:[]:Et(e)?e:nS}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e;return null!==(e=Tt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0)&&void 0!==e&&e}get _maxAllowedValue(){var e=Tt(this._perfConfig)&&At(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:iS;return e>0&&6e4>=e?iS:e}get isEnabled(){var e=null==h?void 0:h.protocol;if("http:"!==e&&"https:"!==e)return rS.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Tt(this._perfConfig)?this._perfConfig.web_vitals:Dt(this._perfConfig)?this._perfConfig:void 0;return Dt(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(rS.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var r=Tt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Tt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[O]:r}),this._instance.persistence.register({[q]:i})),this._enabledServerSide=r,this.startIfEnabled()}}}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t=b.__PosthogExtensions__,r=this._callbackFlavor,i=null==t?void 0:t.postHogWebVitalsCallbacksByFlavor;null!=i&&i[r]||"web-vitals"===r&&Rt(i)&&null!=t&&t.postHogWebVitalsCallbacks?e():null==t||null==t.loadExternalDependency||t.loadExternalDependency(this._instance,r,t=>{t?rS.error("failed to load script",t):e()})}_maskedURL(e){var t=e||(null==l?void 0:l.location.href);if(t){var r=this._instance.config.disable_capture_url_hashes?li(t):t,i=this._instance.config.custom_personal_data_properties;return Zs(r,this._instance.config.mask_personal_data_properties?[...dl,...i||[]]:[],hl)}rS.error("Could not determine current URL")}}},QS={exceptionObserver:class{constructor(e){var t;this._startCapturing=()=>{var e;if(l&&this.isEnabled&&null!=(e=b.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=b.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=b.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=b.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=r(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=i(this.captureException.bind(this)))}catch(e){eS.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[F]),this._rateLimiter=new Kt(n({},function(e){var t,r,i,s;return void 0===e&&(e={}),{refillRate:null!==(t=null!==(r=e.exceptionRateLimiterRefillRate)&&void 0!==r?r:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(i=null!==(s=e.exceptionRateLimiterBucketSize)&&void 0!==s?s:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:eS})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Tt(e)?t=n({},t,e):(Rt(e)?this._remoteEnabled:e)&&(t=n({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(eS.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return eS.error("failed to load script",t);e()})}_stopCapturing(){var e,t,r;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(r=this._unwrapConsoleError)||r.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[F]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,r,i,s=null!==(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(s))return void eS.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=Zv(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=ji(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Gi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=ji(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var s=e.config;if("errorTracking"in s){var n=null!==(t=null==(r=s.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=s.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=n,this._instance.persistence&&this._instance.persistence.register({[L]:this._suppressionRules,[A]:o})}}}get _captureExtensionExceptions(){var e,t,r=!!this._instance.get_property(A);return null!==(e=null!==(t=this._instance.config.error_tracking.captureExtensionExceptions)&&void 0!==t?t:r)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Pt(e)||0===e.trim().length)return void Vv.warn("Ignoring exception step because message must be a non-empty string");var r=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((r,i)=>zi.has(i)?(t.push(i),r):(r[i]=e[i],r),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),i=r.sanitizedProperties,s=r.droppedKeys;s.length>0&&Vv.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(n({[Ui]:e,[Wi]:(new Date).toISOString()},i))}catch(e){Vv.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void Vv.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void Vv.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void Vv.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void Vv.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&Lt(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,i="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;i&&(r.$release_id=i);try{var s=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this._exceptionStepsBuffer.clear(),s}catch(e){return zv(e)||Vv.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void(zv(e)||Vv.error("Failed to process exception event. Ignoring this exception.",e))}var n}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:n({},e,{$exception_steps:t})}catch(t){return Vv.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Ui]:e,[Wi]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Tt(e)?n({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{var t=e.reduce((e,t)=>{var r=t.type,i=t.value;return Pt(r)&&r.length>0&&e.$exception_types.push(r),Pt(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{var r=e.values.map(e=>{var r=el[e.operator],i=t[e.key];if(!r||!i)return!1;var s=Et(e.value)?e.value:[e.value];return s.length>0&&r(s,i)});return"OR"===e.type?r.some(Boolean):r.every(Boolean)})}catch(e){return Vv.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){var t=e.flatMap(e=>{var t,r;return null!==(t=null==(r=e.stacktrace)?void 0:r.frames)&&void 0!==t?t:[]}),r=t.filter(e=>{var t=e.filename;return!!t&&Qv.some(e=>t.startsWith(e))});return 0!==r.length&&(!r.every(e=>{var t=e.filename;return!!t&&t.startsWith(jv)})||e.some(e=>{var t=e.value;return"NoResponse"===e.type||Pt(t)&&Gv.some(e=>{var r=e.value;return e.exact?t===r:t.includes(r)})})&&!t.some(e=>{var t=e.filename;return e.in_app&&!(null!=t&&t.startsWith(jv))}))}_isInjectedBrowserScriptException(e){return e.some(e=>{var t=e.value;return Pt(t)&&Kv.some(e=>t.includes(e))})}_isPostHogException(e){if(e.length>0){var t,r,i,s,n=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[];return null!==(i=null==(s=n[n.length-1])||null==(s=s.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!Lt(e)&&Et(e)}}},KS=n({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var r,i;if(this._persistence&&this._persistence.register({[N]:!!t.productTours}),!cS(this._instance))return!this._productTourManager&&Lt(null==(r=this._persistence)?void 0:r.props.ph_product_tours)||dS.info("product tours disabled; stopping and clearing cached tours"),null==(i=this._productTourManager)||i.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this._productTourManager&&cS(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",t=>{t?dS.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&null!=(e=b.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=b.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Et(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[Se];if(Et(i)&&!t)return this._cachedTours=i,void e(i,{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:t=>{if(cS(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var s="Product Tours API could not be loaded, status: "+i;return 0===i?t.error||dS.warn(s):dS.error(s),void e([],{isLoaded:!1,error:s})}var n=Et(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,r&&r.register({[Se]:n}),e(n,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Lt(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(Se)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},VS),ZS={siteApps:class{constructor(e){this._instance=e,this._siteAppElementPatchCount=0,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this._bufferedInvocations.push(r),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=b._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,o,a,l,u,d;if(!e)throw new Error("Event payload is required");var c={},h=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var _ of Object.entries(p)){var g=_[0];c[g]={id:h[g],type:g,properties:_[1]}}var v=e.$set_once,f=e.$set;return{event:n({},s(e,i),{properties:n({},e.properties,f?{$set:n({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},f)}:{},v?{$set_once:n({},null!==(o=null==(a=e.properties)?void 0:a.$set_once)&&void 0!==o?o:{},v)}:{}),elements_chain:null!==(l=null==(u=e.properties)?void 0:u.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(d=e.properties)?void 0:d.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}_prepareElementForSiteApp(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(hS.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(hS.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,i,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==c?void 0:c.defaultView,u=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();var d=[],h=this,p=new WeakSet,_=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),d.push(()=>{e[t]=i})}},g=e=>{if(p.has(e))return e;var t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},v=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!Ft(e));return _(u,"appendChild",e=>function(t){var r=g(t);return r?e.call(this,r):t}),_(u,"insertBefore",e=>function(t,r){var i=g(t);return i?e.call(this,i,r):t}),_(u,"replaceChild",e=>function(t,r){var i=g(t);return i?e.call(this,i,r):r}),[null==(t=l.Element)?void 0:t.prototype,null==(r=l.Document)?void 0:r.prototype,null==(i=l.DocumentFragment)?void 0:i.prototype].forEach(e=>{_(e,"append",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))}),_(e,"prepend",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(e=>{_(e,"before",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))}),_(e,"after",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))}),_(e,"replaceWith",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var s=v(r);return r.length&&!s.length?void 0:e.apply(this,s)})}),_(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",e=>function(t,r){var i=g(r);return i?e.call(this,t,i):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){var e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null==(t=this._restoreSiteAppElementPatches)||t.call(this)))}}_runWithPreparedSiteAppElements(e,t){void 0===t&&(t=!0);var r=this._patchSiteAppElementInsertionMethods();try{var i=e(r);return t&&r(),i}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this._bufferedInvocations.length&&(hS.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(r=this._stopBuffering)||r.call(this))},i=!1,s=s=>{t.errored=!s,t.loaded=!0,hS.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),i&&r()};try{var n=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),s(e)}}),!1).processEvent;n&&(t.processEvent=n),i=!0}catch(t){hS.error(pS+e.id,t),s(!1)}if(i&&t.loaded)try{r()}catch(r){hS.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}_onCapturedEvent(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),i=function(i){try{t._runWithPreparedSiteAppElements(()=>null==i.processEvent?void 0:i.processEvent(r))}catch(t){hS.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var s of Object.values(this.apps))i(s)}}onRemoteConfig(e){var t,r,i,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void hS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),e.ok){var n=e.config;if(null!=(i=n.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;b["__$$ph_site_app_"+t]=s._instance,null==(e=b.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,r,e=>{if(e)return hS.error(pS+t,e)})};for(var a of n.siteApps)o()}else hS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},YS={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,r=this._syncHostnamesForPatch();r?(Rt(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=b.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Rt(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=b.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return tS.error("failed to load script",t);e()})}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return Et(e)?(Et(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Et(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},JS=n({surveys:class extends fS{constructor(e){var t;super(new kS(e),(t=e,{get projectToken(){return t.config.token},kv:new wS(t)})),this._instance=e}_sendSurveysRequest(e,t){var r=t.query?eb(e,t.query):e;return new Promise(e=>{var i;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",r),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},VS),XS={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){b.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=b.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,r){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),zs(this.instance.config))return!1;if(!l||!c)return!1;e=null!=e?e:l.location,r=null!=r?r:l.history;try{if(!t){try{l.localStorage.setItem("test","test"),l.localStorage.removeItem("test")}catch(e){return!1}t=null==l?void 0:l.localStorage}var i,s=CS||Ys(e.hash,"__posthog")||Ys(e.hash,"state"),n=s?Ns(()=>JSON.parse(atob(decodeURIComponent(s))))||Ns(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((i=n).source="url",i&&Object.keys(i).length>0&&(n.desiredHash?e.hash=n.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(ES)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}_callLoadToolbar(e){var t=b.ph_load_toolbar||b.ph_load_editor;!Lt(t)&&xt(t)?t(e,this.instance):xS.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==c||!c.getElementById("__POSTHOG_TOOLBAR__"));if(!l||t)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,i=n({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(l.localStorage.setItem(ES,JSON.stringify(n({},i,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(i);else if(0===this._getToolbarState()){var s;this._setToolbarState(1),null==(s=b.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return xS.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(i)}),Ws(l,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(i)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},ew=n({experiments:class e{get _config(){return this._instance.config}constructor(t){var r=this;this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),r.getWebExperiments(t=>{e._logInfo("retrieved web experiments from the server"),r._flagToExperiments=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;r._flagToExperiments&&(e._logInfo("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=r._flagToExperiments)||i.set(t.feature_flag_key,t));var s=r._instance.getFeatureFlag(t.feature_flag_key);Pt(s)&&t.variants[s]&&r._applyTransforms(t.name,s,t.variants[s].transforms)}else if(t.variants)for(var n in t.variants){var o=t.variants[n];e._matchesTestVariant(o,r._instance)&&r._applyTransforms(t.name,n,o.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e._logInfo(OS);else if(!this._config.disable_web_experiments){if(Lt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e._logInfo("applying feature flags",t),t.forEach(e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),s=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=s&&s.variants[i]&&this._applyTransforms(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){var t=e.getWindowLocation();if(null!=t&&t.search){var r=Ks(null==t?void 0:t.search,"__experiment_id"),i=Ks(null==t?void 0:t.search,"__experiment_variant");r&&i&&(e._logInfo("previewing web experiments "+r+" && "+i),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(r),i,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(t,r,i){var s=i.filter(e=>e.id===t);s&&s.length>0&&(e._logInfo("Previewing web experiment ["+s[0].name+"] with variant ["+r+"]"),this._applyTransforms(s[0].name,r,s[0].variants[r].transforms))}static _matchesTestVariant(t,r){return!Lt(t.conditions)&&e._matchUrlConditions(t,r)&&e._matchUTMConditions(t)}static _matchUrlConditions(t,r){var i;if(Lt(t.conditions)||Lt(null==(i=t.conditions)?void 0:i.url))return!0;var s=e.getWindowLocation();if(s){var n,o,a,l=en(r,s.href);return null==(n=t.conditions)||!n.url||DS[null!==(o=null==(a=t.conditions)?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return null==l?void 0:l.location}static _matchUTMConditions(e){var t;if(Lt(e.conditions)||Lt(null==(t=e.conditions)?void 0:t.utm))return!0;var r=_l();if(r.utm_source){var i,s,n,o,a,l,u,d,c=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==r.utm_campaign,h=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==r.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==r.utm_medium,_=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(d=e.conditions)||null==(d=d.utm)?void 0:d.utm_term)==r.utm_term;return c&&p&&_&&h}return!1}static _logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];Ms.info("[WebExperiments] "+e,r)}_applyTransforms(t,r,i){this._is_bot()?e._logInfo(OS):"control"!==r?i.forEach(i=>{var s;i.selector&&(e._logInfo("applying transform of variant "+r+" for experiment "+t+" ",i),null==(s=document)||null==(s=s.querySelectorAll(i.selector))||s.forEach(e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}):e._logInfo("Control variants leave the page unmodified.")}_is_bot(){return d&&this._instance?Sb(d,this._config.custom_blocked_useragents):void 0}}},VS),tw=n({},VS,jS,GS,QS,KS,ZS,JS,YS,XS,ew,{conversations:class{constructor(e){this._instance=e,this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this._remoteConfigSuccessful=e.ok,e.ok)){var t=e.config.conversations;Lt(t)||(Dt(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||zs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==b?void 0:b.__PosthogExtensions__;if(e&&!Rt(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var r=e.loadExternalDependency;if(!r)return void this._handleLoadError(et);r(this._instance,"conversations",t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1})}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else NS.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,NS.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else NS.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){NS.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():NS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ft(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":zs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":Rt(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Lt(this._remoteConfig)||!this._remoteConfig.token?"missing_token":null!=b&&b.__PosthogExtensions__?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,r){var i=this;return a(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(NS.warn(BS),null)})()}getMessages(e,t){var r=this;return a(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(NS.warn(BS),null)})()}markAsRead(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(NS.warn(BS),null)})()}getTickets(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(NS.warn(BS),null)})()}requestRestoreLink(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(NS.warn(BS),null)})()}restoreFromToken(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(NS.warn(BS),null)})()}restoreFromUrlToken(){var e=this;return a(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(NS.warn(BS),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t,r=this;this._instance=e,this.name=dg,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Fs("[logs]"),this._coreLogger=n({},this._logger,{error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];t.some(zS)||r._logger.error(...t)}}),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null==(e=this._core)||e.onReconnect(),null==(t=this._consoleCore)||t.onReconnect())},this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),l&&Ws(l,"online",this._onReconnect)}_buildCore(e,t,r,i){var s,n=$S(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,r);return[new ws(this._createHost(e,t),n,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,i),n]}_getCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._core||this._resolvedFrom!==t){var r;null==(r=this._core)||r.reset(),this._resolvedFrom=t;var i=this._buildCore(()=>this._queue,e=>{this._queue=e});this._core=i[0],this._resolvedConfig=i[1]}return this._core}_getConsoleCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._consoleCore||this._consoleResolvedFrom!==t){var r;null==(r=this._consoleCore)||r.reset(),this._consoleResolvedFrom=t;var i=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},HS);this._consoleCore=i[0],this._consoleResolvedConfig=i[1]}return this._consoleCore}setup(e){var t;if(!this._disposed){this._client=e,null!=(t=this._instance)&&null!=(t=t.config)&&null!=(t=t.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();var r=!1,i=e.onRemoteConfig(e=>{var t;r=e.ok&&!0===(null==(t=e.config.logs)?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?i.dispose():(this._remoteConfigSubscription=i,r||this.loadIfEnabled())}}dispose(){var e,t,r,i;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==l||l.removeEventListener("online",this._onReconnect),null==(t=this._consoleLogsDispose)||t.call(this),this._consoleLogsDispose=void 0,null==(r=this._core)||r.reset(),null==(i=this._consoleCore)||i.reset())}onRemoteConfig(e){var t,r;if(!this._disposed){var i=e.ok?null==(t=e.config.logs)?void 0:t.captureConsoleLogs:void 0;Lt(i)?this._stopRecorderStartedByPersistedHint():(null==(r=this._instance)||null==(r=r.persistence)||r.register({[B]:!!i}),i?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}}reset(){var e,t,r,i;this._stopConsoleRecorder(),null==(e=this._core)||e.clearQueue(),this._queue=[],null==(t=this._core)||t.reset(),null==(r=this._consoleCore)||r.clearQueue(),this._consoleQueue=[],null==(i=this._consoleCore)||i.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,r){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:r})}_persistedCaptureHint(){var e;return!(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.props)||!e[B])}_remoteConfigWillArrive(){var e,t;return null==(e=this._instance)||null==e._shouldDisableFlags||!e._shouldDisableFlags()||!(null==(t=b._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])||!t.config)}_onOptOut(){var e;this._stopConsoleRecorder(),null==(e=this._consoleCore)||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e,t=this;if(!this._isRecordingConsole&&null!=b&&b.console){var r=$S(null==(e=this._instance)||null==(e=e.config)?void 0:e.logs).maxBufferSize,i=function(e){var i;try{i=Fv(b.console[e])}catch(e){return 0}if(!i)return 0;t._consoleRecorderUnpatchers.push(tp(b.console,e,s=>{var n=function(){for(var i=arguments.length,n=new Array(i),o=0;i>o;o++)n[o]=arguments[o];try{t._recordConsoleEntry(e,n,r)}catch(e){}return s.apply(b.console,n)};return n.__rrweb_original__=i,n}))};for(var s of qS)i(s);this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}}_recordConsoleEntry(e,t,r){var i;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null!=(i=this._instance)&&i.is_capturing()){if(r>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){for(var e of(this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0),this._consoleRecorderUnpatchers))e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){var e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch(e=>this._logFlushError(e)),this._consoleCore&&this._consoleCore.flush().catch(e=>this._logFlushError(e)))}_logFlushError(e){zS(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this._disposed&&this._isLogsEnabled&&!this._isLoaded&&!this._isLoading){var e=null==b?void 0:b.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();var t=e.loadExternalDependency;if(!t)return this._logger.error(et),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",t=>{if(this._isLoading=!1,!this._disposed&&this._isLogsEnabled){var r=e.logs;if(t||null==r||!r.initializeLogs)this._logger.error("Could not load logs script",t),this._stopConsoleRecorder();else{var i,s,n=this._takeConsoleBuffer();this._consoleLogsDispose=r.initializeLogs(null!==(i=this._client)&&void 0!==i?i:this._instance),this._isLoaded=!0,n.length>0&&(null==r.replayConsoleBuffer||r.replayConsoleBuffer(null!==(s=this._client)&&void 0!==s?s:this._instance,n))}}})}catch(e){throw this._isLoading=!1,e}}}_createHost(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===vt.LogsQueue?e():void 0,setPersistedProperty(e,r){e===vt.LogsQueue&&t(null!=r?r:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>Ba.LIB_NAME,getLibraryVersion:()=>Ba.LIB_VERSION}}_sendLogsBatch(e){return new Promise(t=>{if(Js(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:WS(void 0,"logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(s),t(e))},s=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:WS(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)i({kind:"ok"});else if(413===t)i({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)i({kind:"fatal",error:new Error("logs request failed with status "+t)});else{var r;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:WS(e.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("logs request failed with status "+t)})}}})}})}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=Xs(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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.")))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,Ba.LIB_NAME,e=>{this._queue=e}),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,HS,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,r,i,s){if(0!==t.length){var n=t.map(e=>e.record);s([]);var o=Ss(n,bs(r,Ba.LIB_NAME,Ba.LIB_VERSION),i,Ba.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,s=r.sessionStartTimestamp,n=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,Lt(s)||(t.sessionStartTimestamp=s),Lt(n)||(t.lastActivityTimestamp=n)}if(null!=b&&null!=(e=b.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?li(b.location.href):b.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},{metrics:class{constructor(e){this._instance=e,this._logger=Fs("[metrics]")}initialize(){}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,this._core=new xs(this._createHost(),function(e){var t,r,i,s,n,o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(r=null==o?void 0:o["service.version"])&&void 0!==r?r:null==e?void 0:e.serviceVersion,environment:null!==(i=null==o?void 0:o["deployment.environment"])&&void 0!==i?i:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(r),this._logger)),this._core}count(e,t,r){void 0===t&&(t=1),this._getCore().count(e,t,r)}gauge(e,t,r){this._getCore().gauge(e,t,r)}histogram(e,t,r){this._getCore().histogram(e,t,r)}flush(e){if(!this._core)return Promise.resolve();if(e){var t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch(e=>this._logger.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this._core)||e.reset()}_createHost(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>Ba.LIB_NAME,getLibraryVersion:()=>Ba.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise(r=>{var i=!1,s=e=>{i||(i=!0,clearTimeout(o),r(e))},o=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(n({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t,r=e.statusCode;s(r>=200&&300>r?{kind:"ok"}:413===r?{kind:"too-large"}:0!==r&&408!==r&&429!==r&&500>r?{kind:"fatal",error:new Error("metrics request failed with status "+r)}:{kind:"retry-later",error:null!==(t=e.error)&&void 0!==t?t:new Error("metrics request failed with status "+r)})}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});Jb.__defaultExtensionClasses=n({},tw);var rw=function(){Ba.SDK_DIST_CHANNEL="npm";var e=Ob[Vb]=new Jb;return function(){function e(){e.done||(e.done=!0,jb=!1,As(Ob,function(e){e._dom_loaded()}))}null!=c&&c.addEventListener?"complete"===c.readyState?e():Ws(c,"DOMContentLoaded",e,{capture:!1}):l&&Ms.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),iw=rw;export{W_ as Compression,Uy as DEFAULT_PRODUCT_TOUR_APPEARANCE,eg as DisplaySurveyType,Jb as PostHog,Wy as ProductTourEventName,zy as ProductTourEventProperties,J_ as SurveyEventName,X_ as SurveyEventProperties,z_ as SurveyEventType,j_ as SurveyPosition,Z_ as SurveyQuestionBranchingType,K_ as SurveyQuestionType,Y_ as SurveySchedule,G_ as SurveyTabPosition,Q_ as SurveyType,V_ as SurveyWidgetType,iw as default,rw as posthog,Ky as severityLevels};
|
|
1
|
+
var e,t=["type"],r=["retriesPerformedSoFar"],i=["$set_once","$set"];function s(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},n.apply(null,arguments)}function o(e,t,r,i,s,n,o){try{var a=e[n](o),l=a.value}catch(e){return void r(e)}a.done?t(l):Promise.resolve(l).then(i,s)}function a(e){return function(){var t=this,r=arguments;return new Promise(function(i,s){var n=e.apply(t,r);function a(e){o(n,i,s,a,l,"next",e)}function l(e){o(n,i,s,a,l,"throw",e)}a(void 0)})}}var l="u">typeof window?window:void 0,u="u">typeof globalThis?globalThis:l,d=null==u?void 0:u.navigator,c=null==u?void 0:u.document,h=null==u?void 0:u.location,p=null==u?void 0:u.fetch,_=null!=u&&u.XMLHttpRequest&&"withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:void 0,g=null==u?void 0:u.AbortController,v=null==u?void 0:u.CompressionStream,f=null==d?void 0:d.userAgent;function m(){return!(!l||!1===l.navigator.onLine)}var y="undefined"!=typeof globalThis?globalThis:l;y&&"undefined"==typeof self&&(y.self=y),y&&"undefined"==typeof File&&(y.File=function(){});var b=null!=l?l:{},S="$people_distinct_id",w="distinct_id",k="$device_id",C="$device_model",E="__alias",x="__cmpns",T="$fbc",I="$fbc_persistence",R="__timers",P="$autocapture_disabled_server_side",M="$heatmaps_enabled_server_side",F="$exception_capture_enabled_server_side",L="$error_tracking_suppression_rules",A="$error_tracking_capture_extension_exceptions",O="$web_vitals_enabled_server_side",D="$dead_clicks_enabled_server_side",N="$product_tours_enabled_server_side",B="$logs_capture_enabled_server_side",q="$web_vitals_allowed_metrics",H="$session_recording_remote_config",U="$session_recording_enabled_server_side",W="$replay_sample_rate",z="$replay_override_sampling",V="$replay_override_linked_flag",j="$replay_override_url_trigger",G="$replay_override_event_trigger",Q="$sesid",K="$session_is_sampled",Z="$session_past_minimum_duration",Y="$session_recording_url_trigger_activated_session",J="$session_recording_event_trigger_activated_session",X="$posthog_sr_group_event_trigger_",ee="$posthog_sr_group_url_trigger_",te="$posthog_sr_group_sampling_",re="$debug_first_full_snapshot_timestamp",ie="$sess_rec_flush_size",se="$enabled_feature_flags",ne="$active_feature_flags",oe="$early_access_features",ae="$feature_flag_details",le="$feature_flag_payloads",ue="$feature_flag_request_id",de="$minimal_flag_called_events",ce="$override_feature_flags",he="$override_feature_flag_payloads",pe="$stored_person_properties",_e="$stored_group_properties",ge="$groups",ve="$surveys",fe="$surveys_loaded_at",me="$surveys_activated",ye="$surveys_activated_session",be="$surveys_activated_timestamps",Se="ph_product_tours",we="$product_tours_activated",ke="$product_tours_activated_session",Ce="$conversations_widget_session_id",Ee="$conversations_ticket_id",xe="$conversations_widget_state",Te="$conversations_user_traits",Ie="$flag_call_reported",Re="$flag_call_reported_session_id",Pe="$feature_flag_errors",Me="$feature_flag_evaluated_at",Fe="$user_state",Le="$client_session_props",Ae="$capture_rate_limit",Oe="$initial_campaign_params",De="$initial_referrer_info",Ne="$initial_person_info",Be="$epp",$e="$posthog_cookieless",qe="$cookieless_mode",He="$sdk_debug_extensions_init_method",Ue="$sdk_debug_extensions_init_time_ms",We="$sdk_debug_recording_script_not_loaded",ze="$sdk_debug_replay_event_trigger_status",Ve="$sdk_debug_replay_linked_flag_trigger_status",je="$sdk_debug_replay_matched_recording_trigger_groups",Ge="$sdk_debug_replay_pending_trigger_conditions",Qe="$sdk_debug_replay_remote_trigger_matching_config",Ke="$sdk_debug_replay_trigger_groups_count",Ze="$sdk_debug_replay_url_trigger_status",Ye="$sdk_debug_rrweb_attached",Je="$sdk_debug_rrweb_start_attempted",Xe="$session_recording_start_reason",et="PostHog loadExternalDependency extension not found.",tt="anonymous",rt="identified",it="identified_only",st="visibilitychange",nt="beforeunload",ot="$pageview",at="$pageleave",lt="$identify",ut="$groupidentify",dt=["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"],ct=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return dt.concat(t).some(e=>{var t=e.toLowerCase();return-1!==r.indexOf(t)})};function ht(e,t){return-1!==e.indexOf(t)}var pt=function(e){return e.trim()},_t=function(e){return e.replace(/^\$/,"")};function gt(e){var t,r=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}}))&&void 0!==t?t:"null"}var vt=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),ft=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),mt="min_length",yt="max_length",bt=["$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"],St=["token"],wt=Object.prototype,kt=wt.hasOwnProperty,Ct=wt.toString,Et=Array.isArray||function(e){return"[object Array]"===Ct.call(e)},xt=e=>"function"==typeof e,Tt=e=>e===Object(e)&&!Et(e),It=e=>{if(Tt(e)){for(var t in e)if(kt.call(e,t))return!1;return!0}return!1},Rt=e=>void 0===e,Pt=e=>"[object String]"==Ct.call(e),Mt=e=>Pt(e)&&0===e.trim().length,Ft=e=>null===e,Lt=e=>Rt(e)||Ft(e),At=e=>"[object Number]"==Ct.call(e)&&e==e,Ot=e=>At(e)&&e>0,Dt=e=>"[object Boolean]"===Ct.call(e),Nt=e=>e instanceof FormData,Bt=e=>ht(bt,e),$t=e=>ht(St,e);function qt(e){return null===e||"object"!=typeof e}function Ht(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Ut(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return zt(e,Error)}}function Wt(e){return"u">typeof Event&&zt(e,Event)}function zt(e,t){try{return e instanceof t}catch(e){return!1}}var Vt=[!0,"true",1,"1","yes"],jt=e=>ht(Vt,e),Gt=[!1,"false",0,"0","no"];function Qt(e,t,r,i,s){return t>r&&(i.warn("min cannot be greater than max."),t=r),At(e)?e>r?(i.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),Qt(null!=s?s:r,t,r,i))}var Kt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Qt(e.bucketSize,0,100,e._logger),this._refillRate=Qt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Qt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var r=Math.floor((t-e.lastAccess)/this._refillInterval);r>0&&(e.tokens=Math.min(e.tokens+r*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval)}consumeRateLimit(e){var t,r=Date.now(),i=String(e),s=this._buckets[i];return s?this._applyRefill(s,r):this._buckets[i]=s={tokens:this._bucketSize,lastAccess:r},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===s.tokens)}stop(){this._buckets={}}},Zt="Mobile",Yt="Android",Jt="Tablet",Xt="Android Tablet",er="iPad",tr="Apple Watch",rr="Safari",ir="BlackBerry",sr="Samsung Internet",nr="Chrome",or="Chrome iOS",ar="Internet Explorer",lr="Internet Explorer Mobile",ur="Opera",dr="Microsoft Edge",cr="Firefox",hr="Firefox iOS",pr="Nintendo",_r="PlayStation",gr="Xbox",vr="Android Mobile",fr="Mobile Safari",mr="Windows",yr="Windows Phone",br="Nokia",Sr="Ouya",wr="Generic "+Zt.toLowerCase(),kr="Generic "+Jt.toLowerCase(),Cr="Konqueror",Er="Oculus Browser",xr="Vivaldi",Tr="Yandex",Ir="Whale",Rr="DuckDuckGo",Pr="Pale Moon",Mr="Waterfox",Fr="Brave",Lr="Claude",Ar="Codex",Or="ChatGPT",Dr="Google Search App",Nr=new RegExp("Version/(\\d+(\\.\\d+)?)"),Br=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),$r=new RegExp(gr,"i"),qr=new RegExp("PlayStation \\w+","i"),Hr=new RegExp("Nintendo \\w+","i"),Ur=new RegExp("BlackBerry|PlayBook|BB10","i"),Wr={"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"},zr=function(e,t,r,i){t=t||"";var s=function(e){return null!=e&&e.brave?Fr:null}(r);return s||(null!=i&&i.detectGoogleSearchApp&&ht(e,"GSA/")?Dr:ht(e," OPR/")&&ht(e,"Mini")?"Opera Mini":ht(e," OPR/")?ur:Ur.test(e)?ir:ht(e,"IEMobile")||ht(e,"WPDesktop")?lr:ht(e,"OculusBrowser")?Er:ht(e,"SamsungBrowser")?sr:ht(e,"Edge")||ht(e,"Edg/")?dr:ht(e,"Vivaldi/")?xr:ht(e,"YaBrowser/")?Tr:ht(e,"Whale/")?Ir:ht(e,"DuckDuckGo/")||ht(e,"Ddg/")?Rr:ht(e,"Claude/")?Lr:ht(e,"Codex/")?Ar:ht(e,"ChatGPT/")?Or:ht(e,"FBIOS")?"Facebook Mobile":ht(e,"UCWEB")||ht(e,"UCBrowser")?"UC Browser":ht(e,"CriOS")?or:ht(e,"CrMo")||ht(e,nr)?nr:ht(e,Yt)&&ht(e,rr)?vr:ht(e,"FxiOS")?hr:ht(e.toLowerCase(),Cr.toLowerCase())?Cr:ht(e,"Brave/")?Fr:((e,t)=>t&&ht(t,"Apple")||function(e){return ht(e,rr)&&!ht(e,nr)&&!ht(e,Yt)}(e))(e,t)?ht(e,Zt)?fr:rr:ht(e,"PaleMoon/")?Pr:ht(e,"Waterfox/")?Mr:ht(e,cr)?cr:ht(e,"MSIE")||ht(e,"Trident/")?ar:ht(e,"Gecko")?cr:"")},Vr={[lr]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[dr]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[nr]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[or]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[rr]:[Nr],[fr]:[Nr],[ur]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[cr]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[hr]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Cr]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ir]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Nr],[vr]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[sr]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Er]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[xr]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Tr]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ir]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Fr]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Lr]:[Br],[Ar]:[Br],[Or]:[Br],[Rr]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Pr]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Mr]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Dr]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ar]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},jr=function(e,t,r,i){var s=Vr[zr(e,t,r,i)];if(Rt(s))return null;for(var n=0;s.length>n;n++){var o=e.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},Gr=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[gr,e&&e[1]||""]],[new RegExp(pr,"i"),[pr,""]],[new RegExp(_r,"i"),[_r,""]],[Ur,[ir,""]],[new RegExp(mr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[yr,""];if(new RegExp(Zt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var i=Wr[r[1]]||"";return/arm/i.test(t)&&(i="RT"),[mr,i]}return[mr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Rt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Yt,[e[2],e[3],e[4]||"0"].join(".")]:[Yt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Qr=function(e){for(var t=0;Gr.length>t;t++){var r=Gr[t],i=r[1],s=r[0].exec(e),n=s&&(xt(i)?i(s,e):i);if(n)return n}return["",""]},Kr=function(e){return Hr.test(e)?pr:qr.test(e)?_r:$r.test(e)?gr:new RegExp(Sr,"i").test(e)?Sr:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?yr:/iPad/.test(e)?er:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?tr:Ur.test(e)?ir:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(br,"i").test(e)?br:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Zt).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Yt:Xt:new RegExp("(pda|Mobile)","i").test(e)?wr:new RegExp(Jt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?kr:""},Zr=function(e,t){var r,i,s,n,o=Kr(e);return o===er||o===Xt||"Kobo"===o||"Kindle Fire"===o||o===kr?Jt:o===pr||o===gr||o===_r||o===Sr?"Console":o===tr?"Wearable":o?Zt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(r=null==t?void 0:t.maxTouchPoints)&&void 0!==r?r:0)>0?600>Math.min(null!==(i=null==t?void 0:t.screenWidth)&&void 0!==i?i:0,null!==(s=null==t?void 0:t.screenHeight)&&void 0!==s?s:0)/(null!==(n=null==t?void 0:t.devicePixelRatio)&&void 0!==n?n:1)?Zt:Jt:"Desktop"},Yr=/\bFBAV\/(\d+(?:\.\d+)*)/i,Jr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Yr],[/\bFBAN\/EMA\b/i,"Facebook Lite",Yr],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Yr],[/\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"]],Xr="[Truncated]",ei="[Unserializable]";function ti(e){for(var t="",r=0;e.length>r;r++){var i=e.charCodeAt(r);if(55296>i||i>56319)t+=56320>i||i>57343?e[r]:"�";else{var s=e.charCodeAt(r+1);56320>s||s>57343?t+="�":(t+=e[r]+e[r+1],r++)}}return t}Date,Date;var ri,ii,si,ni=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function oi(e,t){return"string"==typeof(r=e)&&ni.test(r)?e:t();var r}function ai(e,t){var r=new Error(t);try{Object.defineProperty(r,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return r}function li(e){return e?e.split("#")[0]:e}function ui(e,t){var r=setTimeout(e,t);return null!=r&&r.unref&&(null==r||r.unref()),r}function di(e,t,r){return ci.apply(this,arguments)}function ci(){return(ci=a(function*(e,t,r){var i;try{return yield Promise.race([e,new Promise((e,s)=>{i=ui(()=>{try{null==r||r(),e()}catch(e){s(e)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}function hi(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return si&&r.length===ii?si:(ii=r.length,si=r.reduce((r,i)=>{ri||(ri={});var s=ri[i];if(s)r[s[0]]=s[1];else for(var n=e(i),o=n.length-1;o>=0;o--){var a,l=null==(a=n[o])?void 0:a.filename,u=t[i];if(l&&u){r[l]=u,ri[i]=[l,u];break}}return r},{}))}}var pi=class{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(n,r),$exception_level:"error"}}modifyFrames(e){var t=this;return a(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Et(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),n({},e,{cause:r,stack:i})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return a(function*(){var r=e;for(var i of t.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,t){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:null!==(r=t.type)&&void 0!==r?r:"generic",handled:null===(i=t.handled)||void 0===i||i,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,n({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:hi(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var i=(r,i)=>{if(4>=i){var s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return n({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)})}};function _i(e,t,r,i,s){var n={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!!t&&!t.startsWith("webkit-masked-url://")&&"<anonymous>"!==t};return Rt(i)||(n.lineno=i),Rt(s)||(n.colno=s),n}var gi=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},vi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,fi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,mi=/\((\S*)(?::(\d+))(?::(\d+))\)/,yi=(e,t)=>{var r=vi.exec(e);if(r)return _i(t,r[1],"?",+r[2],+r[3]);var i=fi.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){var s=mi.exec(i[2]);s&&(i[2]=s[1],i[3]=s[2],i[4]=s[3])}var n=gi(i[1]||"?",i[2]);return _i(t,n[1],n[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},bi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Si=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wi=(e,t)=>{var r=bi.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var i=Si.exec(r[3]);i&&(r[1]=r[1]||"eval",r[3]=i[1],r[4]=i[2],r[5]="")}var s=r[3],n=r[1]||"?",o=gi(n,s);return _i(t,s=o[1],n=o[0],r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},ki=/\(error: (.*)\)/;function Ci(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Ei(e){for(var t=1;10>=t;t++){var r=e.length-2*t;if(0>r)break;for(var i=!0,s=0;t>s;s++)if(!Ci(e[r+s],e[r+t+s])){i=!1;break}if(i){for(var n=0;t>n;n++)e[r+n]=e[r+t+n];return e.length=r+t,{start:r,length:t}}}}function xi(e,t){var r=t.start+t.length,i=Ii(e,t);i&&e.splice(r+i===e.length?r:t.start,i)}function Ti(e,t){for(var r=t.start;r>0&&Ci(e[r-1],e[r-1+t.length]);)r--;return t.start-r}function Ii(e,t){for(var r=t.start+t.length,i=r;e.length>i&&Ci(e[i],e[i-t.length]);)i++;return i-r}function Ri(e,t){var r=t[0],i=e.length-(r?Ti(e,r):0);for(var s of t)i-=Ii(e,s);return i}function Pi(e,t,r){for(var i=0;e.length>i;i++){var s=e[(t+i)%e.length],n=e[(r+i)%e.length];if(s!==n)return n>s}return!1}var Mi=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=Pt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Ht(e,"DOMException")}isDOMError(e){return Ht(e,"DOMError")}},Fi=class{match(e){return Ut(e)}coerce(e,t){var r,i=this.getStack(e),s=void 0===i;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=i?i:null==(r=t.syntheticException)?void 0:r.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}},Li=class{match(e){return!!Ht(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var r;if(null!=e.error)return t.apply(e.error);var i=t.apply(e.message);return n({},i,{stack:null!==(r=this._buildLocationStack(e))&&void 0!==r?r:i.stack,synthetic:!0})}_hasUsableMessage(e){return Pt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,r,i=e,s=null!==(t=i.lineno)&&void 0!==t?t:0,n=null!==(r=i.colno)&&void 0!==r?r:0;if(Pt(i.filename)&&0!==i.filename.length&&0!==s)return"Error\n at "+i.filename+":"+s+":"+n}},Ai=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Oi=class{match(e){return"string"==typeof e}coerce(e,t){var r,i=this.getInfos(e),s=i[0],n=i[1];return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,i=e.match(Ai);return i&&(t=i[1],r=i[2]),[t,r]}},Di=["fatal","error","warning","log","info","debug"];function Ni(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var i=r.length;i>0;i--){var s=r.slice(0,i).join(", ");if(t>=s.length)return i===r.length?s:s.length>t?s.slice(0,t)+"...":s}return""}var Bi=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null!==(r=this.getStack(e))&&void 0!==r?r:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Wt(e))return e.constructor.name;var t="name"in e?e.name:void 0;return Pt(t)&&!Mt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+Ni(e)}isSeverityLevel(e){return Pt(e)&&!Mt(e)&&Di.indexOf(e)>=0}getStack(e){try{return Pt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Pt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var r=e[t];if(Ut(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},$i=class{match(e){return Wt(e)}coerce(e,t){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+Ni(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}},qi=class{match(e){return qt(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}},Hi=class{match(e){return Ht(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Wt(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,i=this.getUnhandledRejectionReason(e);return qt(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}},Ui="$message",Wi="$timestamp",zi=new Set([Ui,Wi]),Vi={enabled:!0,max_bytes:32768};function ji(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Vi.enabled,max_bytes:Qi(e.max_bytes,Vi.max_bytes)}:n({},Vi)}var Gi=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=ji(e)}setConfig(e){this._config=ji(e),this._trimToMaxBytes()}add(e){var t=function(e){var t;try{t=gt(e)}catch(e){return}try{var r=JSON.parse(t);if(!Tt(r))return;var i=r,s=i[Ui],n=i[Wi];if(!Pt(s)||0===s.trim().length)return;if(!Pt(n)&&!At(n))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,i=0;t.length>i;i++)"%"===t[i]?(r+=1,i+=2):r+=1;return r}(t.json);r>this._config.max_bytes||(this._entries.push({step:t.step,bytes:r}),this._totalBytes+=r,this._trimToMaxBytes())}}getAttachable(){return this._entries.map(e=>e.step)}clear(){this._entries=[],this._totalBytes=0}size(){return this._entries.length}_trimToMaxBytes(){for(;this._totalBytes>this._config.max_bytes&&this._entries.length>0;){var e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function Qi(e,t){if(!At(e)||1/0===e||-1/0===e)return t;var r=Math.floor(e);return 0>r?t:r}var Ki=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function Zi(e){return"string"==typeof e||e}function Yi(e){return"string"==typeof e?e:void 0}var Ji,Xi=["$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"],es="NativeGzipValidationError",ts=e=>e.length>=2&&31===e[0]&&139===e[1],rs=(e,t)=>e===ft.GZipJS||t===ft.GZipJS||"gzip"===t,is=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),ss=e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return is(e)||t===es},ns=e=>{throw ai(es,"Native gzip produced invalid output: "+e)},os=function(){var e=a(function*(e,t){18>e.size&&ns("too-short");var r=new Uint8Array(yield e.slice(0,10).arrayBuffer());ts(r)&&8===r[2]||ns("invalid-header");var i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Ji)return Ji;Ji=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?3988292384^t>>>1:t>>>1;Ji[e]=t>>>0}return Ji})(),r=4294967295,i=0;e.length>i;i++)r=t[255&(r^e[i])]^r>>>8;return(4294967295^r)>>>0})(t)&&ns("invalid-crc");var s=t.length>>>0;i.getUint32(4,!0)!==s&&ns("invalid-size")});return function(t,r){return e.apply(this,arguments)}}();function as(e,t,r){return ls.apply(this,arguments)}function ls(){return ls=a(function*(e,t,r){void 0===t&&(t=!0);try{var i=(new TextEncoder).encode(e),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(i).then(()=>n.close()).catch(function(){var e=a(function*(e){try{yield n.abort(e)}catch(e){}throw e});return function(t){return e.apply(this,arguments)}}()),l=new Response(s.readable).blob(),u=(yield Promise.all([l,o]))[0];return yield os(u,i),u}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}}),ls.apply(this,arguments)}var us={}.propertyIsEnumerable;function ds(e,t){try{return ps(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function cs(e,t,r,i){if(0>=r.remainingNodes)return{stringValue:Xr};if(r.remainingNodes--,Dt(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){var r=e.toString(),i=BigInt("9223372036854775808");return e>=i||-i>e?(null==t||t.debug("Attribute "+r+" is outside the int64 range; encoding it as a string"),{stringValue:r}):{intValue:r}}(e,t);if("number"==typeof e){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};var s=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:ti(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(r.ancestors.has(e))return{stringValue:"[Circular]"};if(i>=20)return{stringValue:Xr};if(e instanceof Date){var n=e.getTime(),o=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:"string"==typeof o?ti(o):String(o)}}r.ancestors.add(e);try{try{var a=e.toJSON;if("function"==typeof a)return cs(a.call(e),t,r,i+1)}catch(e){}return Et(e)?{arrayValue:{values:hs(e,t,r,i+1)}}:{kvlistValue:{values:ps(e,t,r,i+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:ti(String(e))}}function hs(e,t,r,i){for(var s=[],n=Math.min(e.length,1e3),o=0;n>o&&r.remainingNodes>0;o++)try{var a=o in e?e[o]:void 0;if(Lt(a))continue;s.push(cs(a,t,r,i))}catch(e){s.push({stringValue:ei})}return e.length>o&&s.push({stringValue:Xr}),s}function ps(e,t,r,i){var s=[];for(var n in e)if(us.call(e,n)){if(!n){null==t||t.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=r.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[n];if(Ft(o)||Rt(o))continue;s.push({key:ti(n),value:cs(o,t,r,i)})}catch(e){s.push({key:ti(n),value:{stringValue:ei}})}}return s}function _s(e,t,r){return n({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":r})}var gs={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var vs={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}},fs=vs.info;function ms(e){try{return ti(String(e))}catch(e){return ei}}function ys(e,t,r,i){var s,o=vs[e.level||"info"]||fs,a=o.text,l=o.number,u=(void 0===(s=At(i)?i:void 0)&&(s=Date.now()),String(s)+"000000"),d={};t.distinctId&&(d.posthogDistinctId=t.distinctId),t.sessionId&&(d.sessionId=t.sessionId),t.windowId&&(d["window.id"]=t.windowId),Lt(t.sessionStartTimestamp)||(d.sessionStartTimestamp=String(t.sessionStartTimestamp)),Lt(t.lastActivityTimestamp)||(d.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(d["url.full"]=t.currentUrl),t.screenName&&(d["screen.name"]=t.screenName),t.appState&&(d["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(d.feature_flags=t.activeFeatureFlags);var c=n({},d),h=e.attributes;if(h){var p=[];try{p=Object.keys(h)}catch(e){p=[]}for(var _ of p){var g=void 0;try{g=h[_]}catch(e){g=ei}Object.defineProperty(c,_,{value:g,enumerable:!0,writable:!0,configurable:!0})}}var v={timeUnixNano:u,observedTimeUnixNano:u,severityNumber:l,severityText:a,body:{stringValue:ms(e.body)},attributes:ds(c,r)};return e.trace_id&&(v.traceId=e.trace_id),e.span_id&&(v.spanId=e.span_id),Rt(e.trace_flags)||(v.flags=e.trace_flags),v}function bs(e,t,r){return _s(e,t,r)}function Ss(e,t,r,i){return{resourceLogs:[{resource:{attributes:ds(t)},scopeLogs:[{scope:{name:r,version:i},logRecords:e}]}]}}var ws=class{constructor(e,t,r,i,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=e,this._config=t,this._logger=r,this._getContext=i,this._onReady=s,this._waitForStoragePersist=n,this._scopeName=o,this._flushPromise=null,this._evictedSinceAdvance=0,this._queueGeneration=0,this._consecutiveFlushFailures=0,this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._maxBufferSize=t.maxBufferSize,this._maxQueueSize=Math.max(null!==(a=t.maxQueueSize)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this._flushIntervalMs=t.flushIntervalMs,this._maxBatchRecordsPerPost=t.maxBatchRecordsPerPost,this._rateCapWindowMs=t.rateCapWindowMs,this._maxLogsPerInterval=t.maxLogsPerInterval}clearQueue(){this._queueGeneration++,this._instance.setPersistedProperty(vt.LogsQueue,[])}reset(){this._clearFlushTimer(),this._intervalWindowStart=0,this._intervalLogCount=0,this._droppedWarned=!1,this._consecutiveFlushFailures=0,this._maxBatchRecordsPerPost=this._config.maxBatchRecordsPerPost}onReconnect(){this._consecutiveFlushFailures=0,this._flushInBackground()}captureLog(e,t){var r;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var i=this._runBeforeSend(e);if(null!==i)if(i.body){if(this._checkRateLimit()){var s={record:ys(i,null!==(r=null==t?void 0:t.context)&&void 0!==r?r:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(s))}}else this._logger.info("Log was rejected in beforeSend function")}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Et(t)?t:[t],i=e;for(var s of r)try{var n=s(i);if(!n)return this._logger.info("Log was rejected in beforeSend function"),null;i=n}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return i}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;var e=Date.now(),t=e-this._intervalWindowStart;return this._rateCapWindowMs>t&&t>=0||(this._intervalWindowStart=e,this._intervalLogCount=0,this._droppedWarned=!1),this._maxLogsPerInterval>this._intervalLogCount?(this._intervalLogCount++,!0):(this._droppedWarned||(this._logger.warn("captureLog dropping logs: exceeded "+this._maxLogsPerInterval+" logs per "+this._rateCapWindowMs+"ms"),this._droppedWarned=!0),!1)}flush(){var e=this;return a(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return a(function*(){var t;e._clearFlushTimer();var r=null!==(t=e._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==t?t:[];if(0!==r.length)for(var i=r.length,s=0;r.length>0&&i>s;){var n,o,a=e._queueGeneration;e._evictedSinceAdvance=0;var l=Math.min(r.length,e._maxBatchRecordsPerPost),u=r.slice(0,l),d=Ss(u.map(e=>e.record),e._buildResourceAttributes(),null!==(n=e._scopeName)&&void 0!==n?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(d);if(e._queueGeneration!==a)return;if("too-large"===c.kind&&u.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(u.length/2)),e._logger.warn("Received 413 when sending logs batch of size "+u.length+", reducing batch size to "+e._maxBatchRecordsPerPost);else{if("retry-later"===c.kind)throw c.error;if("too-large"===c.kind?e._logger.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e._config.maxBatchRecordsPerPost>e._maxBatchRecordsPerPost&&(e._maxBatchRecordsPerPost=Math.min(e._config.maxBatchRecordsPerPost,e._maxBatchRecordsPerPost+1)),yield e._persistQueueAdvance(u.length),r=null!==(o=e._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==o?o:[],s+=u.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return a(function*(){var r,i=Math.max(0,e-t._evictedSinceAdvance),s=null!==(r=t._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==r?r:[];t._instance.setPersistedProperty(vt.LogsQueue,s.slice(i)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return bs(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(!this._instance.optedOut){var r=null!==(t=this._instance.getPersistedProperty(vt.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>r.length||(r.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(vt.LogsQueue,r),this._maxBufferSize>r.length?this._armFlushTimer():this._flushInBackground()}}_armFlushTimer(e){void 0===e&&(e=this._flushIntervalMs),this._flushTimer||(this._flushTimer=ui(()=>{this._flushTimer=void 0,this._flushInBackground()},e))}_nextFlushDelay(){var e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){var e=this._instance.getPersistedProperty(vt.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return a(function*(){t._clearFlushTimer();var r=t.flush().catch(()=>{});void 0!==e?yield di(r,e):yield r})()}flushWithTimeout(e){var t=this;return a(function*(){var r=t.flush();yield di(r,e,()=>{r.catch(()=>{})})})()}_flushInBackground(){this.flush().then(()=>{this._consecutiveFlushFailures=0},e=>{this._consecutiveFlushFailures++,this._logger.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this._hasQueuedRecords()&&this._armFlushTimer(this._nextFlushDelay())})}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}},ks=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Cs(e){return String(e)+"000000"}function Es(e,t,r,i){var s="";return i&&(s=Object.keys(i).sort().map(e=>JSON.stringify(e)+":"+JSON.stringify(i[e])).join(",")),e+"\0"+t+"\0"+(null!=r?r:"")+"\0"+s}var xs=class{constructor(e,t,r){this._instance=e,this._config=t,this._logger=r,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t,r){void 0===t&&(t=1),this._capture({name:e,type:"count",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}gauge(e,t,r){this._capture({name:e,type:"gauge",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}histogram(e,t,r){this._capture({name:e,type:"histogram",value:t,unit:null==r?void 0:r.unit,attributes:null==r?void 0:r.attributes})}flush(){var e=this,t=this._flushPromise,r=function(){var r=a(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return r.apply(this,arguments)}}()().finally(()=>{this._flushPromise===r&&(this._flushPromise=null)});return this._flushPromise=r,r}drainWindow(){if(0===this._series.size)return null;var e=this._series;return this._series=new Map,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._buildPayload(e)}reset(){this._generation++,this._clearFlushTimer(),this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set}_capture(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this._runBeforeSend(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this._logger.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var r,i;try{r=t.attributes?n({},t.attributes):void 0,i=Es(t.type,t.name,t.unit,r)}catch(e){return void this._logger.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var s=this._series.get(i);if(!s){if(!this._admitNewSeries())return;s={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this._series.set(i,s)}var o=this._typeByName.get(t.name);void 0===o?this._typeByName.set(t.name,t.type):o===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this._fold(s,t.value),this._armFlushTimer()}else this._logger.warn("Dropping metric '"+t.name+"': value must be a finite number");else this._logger.warn("Dropping metric with empty name")}}_admitNewSeries(){return this._config.maxSeriesPerFlush>this._series.size||(this._seriesCapWarned||(this._seriesCapWarned=!0,this._logger.warn("Metric series cap reached ("+this._config.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}_fold(e,t){var r;switch(e.type){case"count":e.total=(null!==(r=e.total)&&void 0!==r?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(ks.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(var r=0;t.length>r;r++)if(t[r]>=e)return r;return t.length}(t,ks)]+=1}}_runBeforeSend(e){var t=this._config.beforeSend;if(!t)return e;var r=Et(t)?t:[t],i=e;for(var s of r)try{var n=s(i);if(!n)return this._logger.info("Metric was rejected in beforeSend function"),null;i=n}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return i}_armFlushTimer(){this._flushTimer||(this._flushTimer=ui(()=>{this._flushTimer=void 0,this.flush().catch(e=>{this._logger.error("Metrics flush failed:",e)})},this._config.flushIntervalMs))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_doFlush(){var e=this;return a(function*(){if(0!==e._series.size){var t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;var r=e._generation,i=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(r===e._generation)switch(i.kind){case"ok":return;case"retry-later":return e._mergeWindowBack(t),void e._armFlushTimer();case"too-large":return void e._logger.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e._logger.error("Failed to send metrics batch:",i.error)}}})()}_buildPayload(e){return t=this._buildMetrics(e),r=function(e,t,r){return _s(e,t,r)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ds(r)},scopeMetrics:[{scope:{name:i,version:s},metrics:t}]}]};var t,r,i,s}_buildMetrics(e){var t=Cs(Date.now()),r=new Map;for(var i of e.values()){var s,o=Es(i.type,i.name,i.unit,void 0),a=r.get(o);a||(a=n({name:i.name},i.unit&&{unit:i.unit}),"count"===i.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===i.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=ds(null!==(s=i.attributes)&&void 0!==s?s:{},this._logger),u=Cs(i.windowStartMs);if("count"===i.type){var d,c={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:null!==(d=i.total)&&void 0!==d?d:0};a.sum.dataPoints.push(c)}else if("gauge"===i.type){var h,p={attributes:l,timeUnixNano:t,asDouble:null!==(h=i.last)&&void 0!==h?h:0};a.gauge.dataPoints.push(p)}else i.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:ks})}return Array.from(r.values())}_mergeWindowBack(e){var t,r;for(var i of e){var s=i[0],n=i[1],o=this._series.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(t=o.total)&&void 0!==t?t:0)+(null!==(r=n.total)&&void 0!==r?r:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function Ts(e,t){var r;if(e)return null==(r=e.find(e=>e.type===t))?void 0:r.value}var Is="0.8.2",Rs={DEBUG:!1,LIB_VERSION:Is,LIB_NAME:"browser-common",JS_SDK_VERSION:Is},Ps=function(e,t){var r=(void 0===t?{}:t).debugEnabled,i={_log(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),n=1;i>n;n++)s[n-1]=arguments[n];l&&(Rs.DEBUG||l.POSTHOG_DEBUG||r)&&!Rt(l.console)&&l.console&&("__rrweb_original__"in l.console[t]?l.console[t].__rrweb_original__:l.console[t])(e,...s)},debug(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];i._log("error",...t)},critical(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning(e){i.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>Ps(e+" "+t,r)};return i},Ms=Ps("[PostHog.js]"),Fs=Ms.createLogger;function Ls(e,t){Et(e)&&e.forEach(t)}function As(e,t){if(!Lt(e))if(Et(e))e.forEach(t);else if(Nt(e))e.forEach((e,r)=>t(e,r));else for(var r in e)kt.call(e,r)&&t(e[r],r)}var Os=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];for(var s of r)for(var n in s)void 0!==s[n]&&(e[n]=s[n]);return e};function Ds(e){for(var t=Object.keys(e),r=t.length,i=new Array(r);r--;)i[r]=[t[r],e[t[r]]];return i}var Ns=function(e){try{return e()}catch(e){return}},Bs=function(e){return function(){try{for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,r)}catch(e){Ms.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ms.critical(e)}}},$s=function(e){var t={};return As(e,function(e,r){(Pt(e)&&e.length>0||At(e))&&(t[r]=e)}),t};function qs(e){var t=n({},e);for(var r of["name","message","stack","cause","errors"])try{r in e&&(t[r]=e[r])}catch(e){}return t}var Hs=["herokuapp.com","vercel.app","netlify.app"];function Us(e){var t=null==e?void 0:e.hostname;if(!Pt(t))return!1;var r=t.split(".").slice(-2).join(".");for(var i of Hs)if(r===i)return!1;return!0}function Ws(e,t,r,i){var s=null!=i?i:{},n=s.capture,o=s.passive;null==e||e.addEventListener(t,r,{capture:void 0!==n&&n,passive:void 0===o||o})}function zs(e){return"ph_toolbar_internal"===e.name}var Vs=["localhost","127.0.0.1"],js=(e,t)=>{try{var r;return JSON.stringify(e,(e,t)=>Ut(t)?(null!=r||(r=new WeakMap),r.has(t)||r.set(t,qs(t)),r.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return gt(e)}},Gs=e=>{var t=null==c?void 0:c.createElement("a");return Rt(t)?null:(t.href=e,t)},Qs=function(e,t){var r,i;void 0===t&&(t="&");var s=[];return As(e,function(e,t){Rt(e)||Rt(t)||"undefined"===t||(r=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+r)}),s.join(t)},Ks=function(e,t){for(var r,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;i.length>s;s++){var n=i[s].split("=");if(n[0]===t){r=n;break}}if(!Et(r)||2>r.length)return"";var o=r[1];try{o=decodeURIComponent(o)}catch(e){Ms.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Zs=function(e,t,r){if(!e||!t||!t.length)return e;for(var i=e.split("#"),s=i[1],n=(i[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],d=0;l.length>d;d++){var c=l[d].split("=");Et(c)&&(t.includes(c[0])?u.push(c[0]+"="+r):u.push(l[d]))}var h=a;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},Ys=function(e,t){var r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},Js=(e,t)=>e>=t&&m(),Xs=(e,t,r,i)=>{if(0===e){if(m()){var s=t+1;return s===r&&i(),s}return t}return 0};function en(e,t){var r,i=null==e||null==(r=e.config)?void 0:r.get_current_url;if(!xt(i))return t;try{var s=i(t);return Pt(s)&&s?s:t}catch(e){return Ms.error("Error in get_current_url, falling back to window.location.href",e),t}}function tn(e){var t,r=null==l||null==(t=l.location)?void 0:t.href;return Rt(r)?void 0:en(e,r)}function rn(e){return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function sn(e){return!!e&&1===e.nodeType}function nn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function on(e){return!!e&&3===e.nodeType}function an(e){return!!e&&11===e.nodeType&&sn(e.host)}function ln(e){return e?pt(e).split(/\s+/):[]}function un(e,t){var r=tn(t);return!!(r&&e&&e.some(e=>r.match(e)))}function dn(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return ln(t)}function cn(e){return Lt(e)?null:pt(e).split(/(\s+)/).filter(e=>Nn(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function hn(e){var t="";return In(e)&&!Rn(e)&&e.childNodes&&e.childNodes.length&&As(e.childNodes,function(e){var r;on(e)&&e.textContent&&(t+=null!==(r=cn(e.textContent))&&void 0!==r?r:"")}),pt(t)}function pn(e){var t;return Rt(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var _n=["a","button","form","input","select","textarea","label"];function gn(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}}function vn(e,t){if(Rt(t))return!0;var r,i=function(e){if(t.some(t=>gn(e,t)))return{v:!0}};for(var s of e)if(r=i(s))return r.v;return!1}function fn(e){var t=e.parentNode;return!(!t||!sn(t))&&t}var mn=[".ph-no-autocapture","[data-ph-no-autocapture]"],yn=["next","previous","prev",">","<"],bn=[...yn,"+","-","−","–"],Sn=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,wn=[".ph-no-deadclick",".ph-no-capture"],kn=[".ph-no-rageclick",".ph-no-capture"],Cn=["","text","search","email","password","url","tel","number"];function En(e,t){if(!l||xn(e))return!1;var r,i,s,n,o;if(Dt(t)?(r=!!t&&kn,i=void 0,s=!1):(r=null!==(n=null==t?void 0:t.css_selector_ignorelist)&&void 0!==n?n:kn,i=null==t?void 0:t.content_ignorelist,s=null!==(o=null==t?void 0:t.ignore_text_selection)&&void 0!==o&&o),!1===r)return!1;if(s&&function(e){return!(!e||!sn(e))&&(!!nn(e,"textarea")||(nn(e,"input")?ht(Cn,(e.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(e)))}(e))return!1;var a=Tn(e,!1).targetElementList;return!function(e,t){if(!1===e||Rt(e))return!1;var r;if(!0===e)r=yn;else{if(!Et(e))return!1;if(e.length>10)return Ms.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map(e=>e.toLowerCase())}return t.some(e=>{var t=e.safeText,i=e.ariaLabel;return r.some(e=>Sn(t,e)||Sn(i,e))})}(i,a.map(e=>{var t;return{safeText:hn(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!vn(a,r)}var xn=e=>!e||nn(e,"html")||!sn(e),Tn=(e,t)=>{if(!l||xn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,i=[e],s=e;s.parentNode&&!nn(s,"body");)if(an(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=fn(s);if(!n)break;if(t||_n.indexOf(n.tagName.toLowerCase())>-1)r=!0;else try{var o=l.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}catch(e){}i.push(n),s=n}return{parentIsUsefulElement:r,targetElementList:i}};function In(e){for(var t=new Set,r=0,i=e;i.parentNode&&!nn(i,"body");i=i.parentNode){if(r++>=1e3||t.has(i))return!1;t.add(i);var s=dn(i);if(ht(s,"ph-sensitive")||ht(s,"ph-no-capture"))return!1}if(ht(dn(e),"ph-include"))return!0;var n=e.type||"";if(Pt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=e.name||e.id||"";return!Pt(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function Rn(e){return!!(nn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||nn(e,"select")||nn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Pn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Mn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Fn=[16,15,14,13],Ln=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),An=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),On=/[0-9A-Za-z_]/;function Dn(e){for(var t=0,r=!1,i=e.length-1;i>=0;i--){var s=e.charCodeAt(i)-48;r&&(s*=2)>9&&(s-=9),t+=s,r=!r}return t%10==0}function Nn(e,t){if(void 0===t&&(t=!0),Lt(e))return!1;if(Pt(e)){if(e=pt(e),t?Pn.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(Mn.lastIndex=0;t=Mn.exec(e);){var r=t[2];if(r)for(var i=r.replace(/[- ]/g,""),s=0;i.length>s;s++)for(var n of Fn){var o=s+n;if(i.length>=o){var a=i.slice(s,o);if(Pn.test(a)&&Dn(a))return!0}}}return!1}(e))return!1;if(t?Ln.test(e):function(e){var t;for(An.lastIndex=0;t=An.exec(e);){var r=t[1],i=t[3];if(!(r&&i&&On.test(r)&&On.test(i)))return!0}return!1}(e))return!1}return!0}function Bn(e){var t=hn(e);return Nn(t=(t+" "+$n(e)).trim())?t:""}function $n(e){var t="";return e&&e.childNodes&&e.childNodes.length&&As(e.childNodes,function(e){var r;if(e&&"span"===(null==(r=e.tagName)?void 0:r.toLowerCase()))try{var i=hn(e);t=(t+" "+i).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+$n(e)).trim())}catch(e){Ms.error("[AutoCapture]",e)}}),t}function qn(e){return e.replace(/"|\\"/g,'\\"')}function Hn(e){var t=e.attr__class;if(t)return Et(t)?t:ln(t)}var Un=1e6;function Wn(e){var t;return Math.min(Un,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:1e6)}var zn={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:Un,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},Vn=["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"],jn=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Gn=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Qn=e=>{Lt(e)||As(Object.keys(e),t=>{(e=>{var t=e.toLowerCase();return Vn.includes(t)||Gn.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},Kn=["/s/","/e/","/i/"];function Zn(e,t,r,i){if(Lt(e))return e;var s=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return Pt(s)&&(s=parseInt(s)),s>r?"[SessionRecording] "+i+" body too large to record ("+s+" bytes)":e}function Yn(e,t){if(Lt(e))return e;var r=e;return Nn(r,!1)||(r="[SessionRecording] "+t+" body redacted"),As(jn,e=>{var i,s;null!=(i=r)&&i.length&&-1!==(null==(s=r)?void 0:s.indexOf(e))&&(r="[SessionRecording] "+t+" body redacted as might contain: "+e)}),r}var Jn=new WeakSet,Xn="disabled",eo="sampled",to="active",ro="buffering",io="paused",so="lazy_loading",no="rrweb_error",oo="trigger_activated",ao="trigger_pending",lo="trigger_disabled";function uo(e,t,r,i,s,n){return 0===t?lo:(null==e?void 0:e.get_property(r?i+r:s))===n?oo:ao}function co(e,t,r){return t.some(t=>{var i;return"regex"===t.matching&&(null!==(i=null==r?void 0:r.get(t.url))&&void 0!==i?i:new RegExp(t.url)).test(e)})}function ho(e){return e.includes("trigger_activated")?oo:e.includes("trigger_pending")?ao:lo}function po(e){var t=new Set(e);switch(t.delete(lo),t.size){case 0:return lo;case 1:return Array.from(t)[0];default:return ao}}var _o=class{constructor(e){this._matchers=e}triggerStatus(e){return ho(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return ho(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},go=class{constructor(e){this._matchers=e}triggerStatus(e){return po(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return po(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},vo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return oo}stop(){}},fo=e=>"sessionRecording"in e,mo=class{constructor(e,t){this._instance=e,this._urlTriggers=[],this._urlBlocklist=[],this._compiledTriggerRegexes=new Map,this._compiledBlocklistRegexes=new Map,this._lastCheckedUrl="",this.urlBlocked=!1,this._groupId=t}onConfig(e){var t,r;this._urlTriggers=(fo(e)?Tt(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(fo(e)?Tt(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){for(var e of(this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear(),this._urlTriggers))if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){Ms.error("Invalid URL trigger regex pattern:",e.url,t)}for(var t of this._urlBlocklist)if("regex"===t.matching&&!this._compiledBlocklistRegexes.has(t.url))try{this._compiledBlocklistRegexes.set(t.url,new RegExp(t.url))}catch(e){Ms.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return uo(this._instance,this._urlTriggers.length,this._groupId,ee,Y,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ze]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){var e=tn(this._instance);if(!e)return!1;try{return co(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){var r=tn(this._instance);if(r&&r!==this._lastCheckedUrl){this._lastCheckedUrl=r;var i=this.urlBlocked,s=co(r,this._urlBlocklist,this._compiledBlocklistRegexes);i&&s||(s&&!i?e():!s&&i&&t())}}checkUrlTriggerConditions(e,t,r,i){var s=tn(this._instance);if(s&&s!==this._lastCheckedUrl){this._lastCheckedUrl=s;var n=this.urlBlocked,o=co(s,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!n?e():!o&&n&&t();var a=this._urlTriggerStatus(i)===oo,l=co(s,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&r("url",s)}}stop(){this._lastCheckedUrl=""}},yo=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){var e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[Ve]:e}),e}triggerStatusNoSideEffects(){var e=ao;return Lt(this.linkedFlag)&&(e=lo),this.linkedFlagSeen&&(e=oo),e}onConfig(e,t){var r;if(this.linkedFlag=(fo(e)?Tt(e.sessionRecording)?null==(r=e.sessionRecording)?void 0:r.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Lt(this.linkedFlag)&&!this.linkedFlagSeen){var i=Pt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=Pt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((e,r)=>{var n=!1;if(Tt(r)&&i in r){var o=r[i];n=Dt(o)?!0===o:s?o===s:!!o}var a=n&&!this.linkedFlagSeen;this.linkedFlagSeen=n,a&&t(i,s)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},bo=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(fo(e)?Tt(e.sessionRecording)?null==(t=e.sessionRecording)?void 0:t.eventTriggers:[]:null==e?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}_eventTriggerStatus(e){return uo(this._instance,this._eventTriggers.length,this._groupId,X,J,e)}triggerStatus(e){var t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[ze]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,r){if(0!==this._eventTriggers.length){var i=this._eventTriggerStatus(r)===oo,s=this._eventTriggers.includes(e);!i&&s&&t("event",e)}}stop(){}},So=class{constructor(e,t,r){if(this._instance=e,this.group=t,this._urlTriggerMatching=new mo(e,t.id),this._eventTriggerMatching=new bo(e,t.id),this._linkedFlagMatching=new yo(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){var i=(t.conditions.events||[]).map(e=>e.name),s={urlTriggers:t.conditions.urls||[],eventTriggers:i,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,r);var n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new _o(n):new go(n)}else this._combinedMatching=new vo}triggerStatus(e){return this._combinedMatching.triggerStatus(e)}triggerStatusNoSideEffects(e){return this._combinedMatching.triggerStatusNoSideEffects(e)}getPendingTriggerConditions(e){return"trigger_pending"!==this.triggerStatusNoSideEffects(e)?[]:[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(e=>e.status===ao).map(e=>e.label)}checkEventTriggerConditions(e,t,r){this._eventTriggerMatching.checkEventTriggerConditions(e,t,r)}checkUrlTriggerConditions(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,r,i)}activateTrigger(e,t){var r,i="url"===e?ee+this.group.id:X+this.group.id;null==(r=this._instance.persistence)||r.register({[i]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function wo(e){if(e.rrwebError)return no;if(!e.receivedFlags)return ro;if(!e.isRecordingEnabled)return Xn;if(e.urlTriggerMatching.urlBlocked)return io;var t=!0===e.isSampled,r=new _o([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?eo:"trigger_activated"===r?to:"trigger_pending"===r?ro:!1===e.isSampled?Xn:to}function ko(e){if(e.rrwebError)return no;if(!e.receivedFlags)return ro;if(!e.isRecordingEnabled)return Xn;if(e.urlTriggerMatching.urlBlocked)return io;var t=new go([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),r=t!==lo,i=Dt(e.isSampled);return r&&"trigger_pending"===t?ro:r&&"trigger_disabled"===t||i&&!e.isSampled?Xn:!0===e.isSampled?eo:to}function Co(){var e=[];return function(t,r){if(Tt(r)||Et(r)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(r)?"[Circular]":(e.push(r),r)}return r}}function Eo(e){var t=JSON.stringify(e,Co());return t?new Blob([t]).size:0}function xo(e){if(Ft(e))return 4;if(Rt(e))return 0;switch(typeof e){case"string":return e.length+2;case"number":return String(e).length;case"boolean":return e?4:5;case"object":if(Et(e)){for(var t=2,r=0;e.length>r;r++){r>0&&(t+=1);var i=e[r];t+=Rt(i)||Ft(i)?4:xo(i)}return t}var s=e,n=2,o=!0;for(var a in s)if({}.hasOwnProperty.call(s,a)){var l=s[a];Rt(l)||(o||(n+=1),o=!1,n+=a.length+3+xo(l))}return n;default:return 0}}function To(e,t){if(void 0===t&&(t=6606028.8),e.size>=t&&e.data.length>1){var r=Math.floor(e.data.length/2),i=e.sizes.slice(0,r),s=e.sizes.slice(r);return[To({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,r),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),To({size:s.reduce((e,t)=>e+t,0),data:e.data.slice(r),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Io=Uint8Array,Ro=Uint16Array,Po=Uint32Array,Mo=new Io([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]),Fo=new Io([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]),Lo=new Io([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ao=function(e,t){for(var r=new Ro(31),i=0;31>i;++i)r[i]=t+=1<<e[i-1];var s=new Po(r[30]);for(i=1;30>i;++i)for(var n=r[i];r[i+1]>n;++n)s[n]=n-r[i]<<5|i;return[r,s]},Oo=Ao(Mo,2),Do=Oo[1];Oo[0][28]=258,Do[258]=28;for(var No=Ao(Fo,0)[1],Bo=new Ro(32768),$o=0;32768>$o;++$o){var qo=(43690&$o)>>>1|(21845&$o)<<1;Bo[$o]=((65280&(qo=(61680&(qo=(52428&qo)>>>2|(13107&qo)<<2))>>>4|(3855&qo)<<4))>>>8|(255&qo)<<8)>>>1}var Ho=function(e,t,r){for(var i=e.length,s=0,n=new Ro(t);i>s;++s)++n[e[s]-1];var o,a=new Ro(t);for(s=0;t>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(r){o=new Ro(1<<t);var l=15-t;for(s=0;i>s;++s)if(e[s])for(var u=s<<4|e[s],d=t-e[s],c=a[e[s]-1]++<<d,h=c|(1<<d)-1;h>=c;++c)o[Bo[c]>>>l]=u}else for(o=new Ro(i),s=0;i>s;++s)o[s]=Bo[a[e[s]-1]++]>>>15-e[s];return o},Uo=new Io(288);for($o=0;144>$o;++$o)Uo[$o]=8;for($o=144;256>$o;++$o)Uo[$o]=9;for($o=256;280>$o;++$o)Uo[$o]=7;for($o=280;288>$o;++$o)Uo[$o]=8;var Wo=new Io(32);for($o=0;32>$o;++$o)Wo[$o]=5;var zo=Ho(Uo,9,0),Vo=Ho(Wo,5,0),jo=function(e){return(e/8|0)+(7&e&&1)},Go=function(e,t,r){(null==t||0>t)&&(t=0),(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof Ro?Ro:e instanceof Po?Po:Io)(r-t);return i.set(e.subarray(t,r)),i},Qo=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8},Ko=function(e,t,r){var i=t/8|0;e[i]|=r<<=7&t,e[i+1]|=r>>>8,e[i+2]|=r>>>16},Zo=function(e,t){for(var r=[],i=0;e.length>i;++i)e[i]&&r.push({s:i,f:e[i]});var s=r.length,n=r.slice();if(!s)return[new Io(0),0];if(1==s){var o=new Io(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var a=r[0],l=r[1],u=0,d=1,c=2;for(r[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=s-1;)a=r[r[c].f>r[u].f?u++:c++],l=r[u!=d&&r[c].f>r[u].f?u++:c++],r[d++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(i=1;s>i;++i)n[i].s>h&&(h=n[i].s);var p=new Ro(h+1),_=Yo(r[d-1],p,0);if(_>t){i=0;var g=0,v=_-t,f=1<<v;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});s>i;++i){var m=n[i].s;if(t>=p[m])break;g+=f-(1<<_-p[m]),p[m]=t}for(g>>>=v;g>0;){var y=n[i].s;t>p[y]?g-=1<<t-p[y]++-1:++i}for(;i>=0&&g;--i){var b=n[i].s;p[b]==t&&(--p[b],++g)}_=t}return[new Io(p),_]},Yo=function(e,t,r){return-1==e.s?Math.max(Yo(e.l,t,r+1),Yo(e.r,t,r+1)):t[e.s]=r},Jo=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Ro(++t),i=0,s=e[0],n=1,o=function(e){r[i++]=e},a=1;t>=a;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[r.subarray(0,i),t]},Xo=function(e,t){for(var r=0,i=0;t.length>i;++i)r+=e[i]*t[i];return r},ea=function(e,t,r){var i=r.length,s=jo(t+2);e[s]=255&i,e[s+1]=i>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;i>n;++n)e[s+n+4]=r[n];return 8*(s+4+i)},ta=function(e,t,r,i,s,n,o,a,l,u,d){Qo(t,d++,r),++s[256];for(var c=Zo(s,15),h=c[0],p=c[1],_=Zo(n,15),g=_[0],v=_[1],f=Jo(h),m=f[0],y=f[1],b=Jo(g),S=b[0],w=b[1],k=new Ro(19),C=0;m.length>C;++C)k[31&m[C]]++;for(C=0;S.length>C;++C)k[31&S[C]]++;for(var E=Zo(k,7),x=E[0],T=E[1],I=19;I>4&&!x[Lo[I-1]];--I);var R,P,M,F,L=u+5<<3,A=Xo(s,Uo)+Xo(n,Wo)+o,O=Xo(s,h)+Xo(n,g)+o+14+3*I+Xo(k,x)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return ea(t,d,e.subarray(l,l+u));if(Qo(t,d,1+(A>O)),d+=2,A>O){R=Ho(h,p,0),P=h,M=Ho(g,v,0),F=g;var D=Ho(x,T,0);for(Qo(t,d,y-257),Qo(t,d+5,w-1),Qo(t,d+10,I-4),d+=14,C=0;I>C;++C)Qo(t,d+3*C,x[Lo[C]]);d+=3*I;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)Qo(t,d,D[H=31&q[C]]),d+=x[H],H>15&&(Qo(t,d,q[C]>>>5&127),d+=q[C]>>>12)}}else R=zo,P=Uo,M=Vo,F=Wo;for(C=0;a>C;++C)if(i[C]>255){var H;Ko(t,d,R[257+(H=i[C]>>>18&31)]),d+=P[H+257],H>7&&(Qo(t,d,i[C]>>>23&31),d+=Mo[H]);var U=31&i[C];Ko(t,d,M[U]),d+=F[U],U>3&&(Ko(t,d,i[C]>>>5&8191),d+=Fo[U])}else Ko(t,d,R[i[C]]),d+=P[i[C]];return Ko(t,d,R[256]),d+P[256]},ra=new Po([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ia=new Io(0),sa=function(){for(var e=new Po(256),t=0;256>t;++t){for(var r=t,i=9;--i;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),na=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function oa(e,t){void 0===t&&(t={});var r=function(){var e=4294967295;return{p(t){for(var r=e,i=0;t.length>i;++i)r=sa[255&r^t[i]]^r>>>8;e=r},d(){return 4294967295^e}}}(),i=e.length;r.p(e);var s,n,o,a,l,u=(s=e,n=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,r,i,s,n){var o=e.length,a=new Io(i+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(i,a.length-s),u=0;if(!t||8>o)for(var d=0;o>=d;d+=65535){var c=d+65535;o>c?u=ea(l,u,e.subarray(d,c)):(l[d]=n,u=ea(l,u,e.subarray(d,o)))}else{for(var h=ra[t-1],p=h>>>13,_=8191&h,g=(1<<r)-1,v=new Ro(32768),f=new Ro(g+1),m=Math.ceil(r/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new Po(25e3),w=new Ro(288),k=new Ro(32),C=0,E=0,x=(d=0,0),T=0,I=0;o>d;++d){var R=b(d),P=32767&d,M=f[R];if(v[P]=M,f[R]=P,d>=T){var F=o-d;if((C>7e3||x>24576)&&F>423){u=ta(e,l,0,S,w,k,E,x,I,d-I,u),x=C=E=0,I=d;for(var L=0;286>L;++L)w[L]=0;for(L=0;30>L;++L)k[L]=0}var A=2,O=0,D=_,N=P-M&32767;if(F>2&&R==b(d-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,d),H=Math.min(258,F);q>=N&&--D&&P!=M;){if(e[d+A]==e[d+A-N]){for(var U=0;H>U&&e[d+U]==e[d+U-N];++U);if(U>A){if(A=U,O=N,U>B)break;var W=Math.min(N,U-2),z=0;for(L=0;W>L;++L){var V=d-N+L+32768&32767,j=V-v[V]+32768&32767;j>z&&(z=j,M=V)}}}N+=(P=M)-(M=v[P])+32768&32767}if(O){S[x++]=268435456|Do[A]<<18|No[O];var G=31&Do[A],Q=31&No[O];E+=Mo[G]+Fo[Q],++w[257+G],++k[Q],T=d+A,++C}else S[x++]=e[d],++w[e[d]]}}u=ta(e,l,n,S,w,k,E,x,I,d-I,u),n||(u=ea(l,u,ia))}return Go(a,0,i+jo(u)+s)}(s,null==n.level?6:n.level,null==n.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+n.mem,o,a,!l)),d=u.length;return function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&na(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;r.length>=i;++i)e[i+10]=r.charCodeAt(i)}}(u,t),na(u,d-8,r.d()),na(u,d-4,i),u}function aa(e,t){var r=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Io(e.length+(e.length>>>1)),s=0,n=function(e){i[s++]=e},o=0;r>o;++o){if(s+5>i.length){var a=new Io(s+8+(r-o<<1));a.set(i),i=a}var l=e.charCodeAt(o);128>l||t?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Go(i,0,s)}function la(e,t){var r="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var i=0;e.length>i;){var s=e[i++];128>s||t?r+=String.fromCharCode(s):224>s?r+=String.fromCharCode((31&s)<<6|63&e[i++]):240>s?r+=String.fromCharCode((15&s)<<12|(63&e[i++])<<6|63&e[i++]):(s=((15&s)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,r+=String.fromCharCode(55296|s>>10,56320|1023&s))}return r}var ua=class{constructor(e,t){var r,i,s,n;void 0===t&&(t={}),this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{var e=Date.now(),t=e-this._lastByteRefill;t>0?(this._byteTokens=Math.min(this._bytesBucketSize,this._byteTokens+t/1e3*this._bytesRefillRate),this._lastByteRefill=e):this._lastByteRefill=e},this._onNodeRateLimited=e=>{if(!this._loggedTracker[e]){var t,r;this._loggedTracker[e]=!0;var i=this._getNode(e);null==(t=(r=this._options).onBlockedNode)||t.call(r,e,i)}},this._getNodeOrRelevantParent=e=>{var t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){var r=t.closest("svg");if(r)return[this._rrweb.mirror.getId(r),r]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,r,i,s,n,o,a,l;return(null!==(t=null==(r=e.removes)?void 0:r.length)&&void 0!==t?t:0)+(null!==(i=null==(s=e.attributes)?void 0:s.length)&&void 0!==i?i:0)+(null!==(n=null==(o=e.texts)?void 0:o.length)&&void 0!==n?n:0)+(null!==(a=null==(l=e.adds)?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;var t=e.data,r=this._numberOfChanges(t);if(t.attributes){var i,s,n=t.attributes.length;t.attributes=t.attributes.filter(e=>{var t=this._getNodeOrRelevantParent(e.id)[0];return!this._rateLimiter.consumeRateLimit(t)&&e});var o=n-t.attributes.length;o>0&&(null==(i=(s=this._options).onDroppedAttributeMutations)||i.call(s,o))}var a=this._numberOfChanges(t);if(0!==a||r===a){if(this._byteBudgetDisabled)return e;this._refillByteBudget();var l,u,d=xo(e);return d>this._byteTokens?(null==(l=(u=this._options).onDroppedOversizedMutation)||l.call(u,d),void this._scheduleResync()):(this._byteTokens-=d,e)}},this._scheduleResync=()=>{if(!this._resyncTimer){var e=Math.max(0,this._resyncIntervalMs-(Date.now()-this._lastResyncAt));this._resyncTimer=setTimeout(()=>{var e,t;this._resyncTimer=void 0,this._lastResyncAt=Date.now(),null==(e=(t=this._options).requestFullSnapshot)||e.call(t)},e)}},this._rateLimiter=new Kt({bucketSize:null!==(r=this._options.bucketSize)&&void 0!==r?r:100,refillRate:null!==(i=this._options.refillRate)&&void 0!==i?i:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:Ms}),this._bytesBucketSize=null!==(s=this._options.bytesBucketSize)&&void 0!==s?s:0,this._bytesRefillRate=null!==(n=this._options.bytesRefillRate)&&void 0!==n?n:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;var o=this._options.resyncIntervalMs;this._resyncIntervalMs=At(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this._loggedTracker={},this._resyncTimer&&(clearTimeout(this._resyncTimer),this._resyncTimer=void 0),this._lastResyncAt=Date.now()}stop(){this._rateLimiter.stop(),this.reset(),this._byteTokens=this._bytesBucketSize,this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0}},da=e=>{if(c){try{for(var t=e+"=",r=c.cookie.split(";").filter(e=>e.length),i=0;r.length>i;i++){for(var s=r[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return At(e)&&isFinite(e)&&Math.floor(e)===e});var ca=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,i,s){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(s)||0>t||0>r||0>i||0>s||t>0xffffffffffff||r>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}},ha=class{generate(){var e=this.generateOrAbort();if(!Rt(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(Rt(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e,t=(e=Date.now(),At(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0);if(t>this._timestamp)this._timestamp=t,this._resetCounter();else{if(this._timestamp>=t+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ca.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}constructor(){this._timestamp=0,this._counter=0,this._random=new ga}},pa=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};l&&!Rt(l.crypto)&&crypto.getRandomValues&&(pa=e=>crypto.getRandomValues(e));var _a,ga=class{nextUint32(){return this._buffer.length>this._cursor||(pa(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}},va=()=>fa().toString(),fa=()=>(_a||(_a=new ha)).generate(),ma="",ya=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ba=null,Sa={_is_supported(){if(!Ft(ba))return ba;if(ba=!1,c)try{var e="__ph_cookie_support_"+va();Sa._set(e,"xyz"),ba='"xyz"'===da(e),Sa._remove(e)}catch(e){ba=!1}return ba},_error(e){Ms.error("cookieStore error: "+e)},_get:da,_parse(e){var t;try{t=JSON.parse(Sa._get(e))||{}}catch(e){}return t},_set(e,t,r,i,s){if(!c)return!1;try{var n="",o="",a=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=c),ma)return ma;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),i=Math.min(r.length,8),s="dmn_chk_"+va();!ma&&i--;){var n=r.slice(i).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",ma=n)}return ma}(e);if(!r){var i=(e=>{var t=e.match(ya);return t?t[0]:""})(e);i!==r&&Ms.info("Warning: cookie subdomain discovery mismatch",i,r),r=i}return r?"; domain=."+r:""}return""}(c.location.hostname,i);if(r){var l=new Date;l.setTime(l.getTime()+864e5*r),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Ms.warn("cookieStore warning: large cookie, len="+u.length),c.cookie=u,!0}catch(e){return!1}},_remove(e,t){if(null!=c&&c.cookie)try{Sa._set(e,"",-1,t)}catch(e){return}}},wa=null,ka={_is_supported(){if(!Ft(wa))return wa;var e=!0;if(Rt(l))e=!1;else try{var t="__mplssupport__";ka._set(t,"xyz"),'"xyz"'!==ka._get(t)&&(e=!1),ka._remove(t)}catch(t){e=!1}return e||Ms.error("localStorage unsupported; falling back to cookie store"),wa=e,e},_error(e){Ms.error("localStorage error: "+e)},_get(e){try{return null==l?void 0:l.localStorage.getItem(e)}catch(e){ka._error(e)}return null},_parse(e){try{return JSON.parse(ka._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==l||l.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){ka._error(e)}return!1},_remove(e){try{null==l||l.localStorage.removeItem(e)}catch(e){ka._error(e)}}},Ca=[pe,ne,se,ae,le,ue,Me,Pe,Ie],Ea=[k,w,Q,K,Be,Ne,I,Fe],xa=e=>e+"_cpm",Ta=["__proto__","constructor","prototype"],Ia=e=>{if(!Tt(e))return{};var t={};return Object.keys(e).forEach(r=>{-1===Ta.indexOf(r)&&(t[r]=e[r])}),t},Ra=function(e,t){void 0===t&&(t=[]);var r={};return[...Ea,...t].forEach(t=>{var i=e[t];Rt(i)||Ft(i)||""===i||(r[t]=i)}),r},Pa=e=>{for(var t=5381,r=2166136261,i=0;e.length>i;i++){var s=e.charCodeAt(i);t=33*t^s,r=Math.imul(r^s,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},Ma=(e,t)=>({p:t,f:Pa(JSON.stringify(e))}),Fa=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var r=Sa._parse(xa(e)),i=(null==r?void 0:r.f)===Pa(t)&&Et(r.p);return{properties:i?r.p:[],isValid:i}}catch(e){return{properties:[],isValid:!1}}},La=(e,t)=>t+"|"+(Sa._get(xa(e))||""),Aa={},Oa={_is_supported:()=>!0,_error(e){Ms.error("memoryStorage error: "+e)},_get:e=>e in Aa?Aa[e]:null,_parse:e=>e in Aa?Aa[e]:null,_set:(e,t)=>(Aa[e]=t,!0),_remove(e){delete Aa[e]}},Da=null,Na={_is_supported(){if(!Ft(Da))return Da;if(Da=!0,Rt(l))Da=!1;else try{var e="__support__";Na._set(e,"xyz"),'"xyz"'!==Na._get(e)&&(Da=!1),Na._remove(e)}catch(e){Da=!1}return Da},_error(e){Ms.error("sessionStorage error: ",e)},_get(e){try{return null==l?void 0:l.sessionStorage.getItem(e)}catch(e){Na._error(e)}return null},_parse(e){try{return JSON.parse(Na._get(e))||null}catch(e){}return null},_set(e,t){try{return null==l||l.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Na._error(e)}return!1},_remove(e){try{null==l||l.sessionStorage.removeItem(e)}catch(e){Na._error(e)}}};Rs.DEBUG=!1,Rs.LIB_VERSION="1.428.9",Rs.LIB_NAME="web";var Ba=Rs,$a=class{constructor(e){if(!e.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this._getProperty=e.get_property.bind(e),this._setProperty=e.persistence.set_property.bind(e.persistence)}trackSize(e,t){this._setProperty(ie,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){var t,r=this._getProperty(ie);return Tt(t=r)&&Pt(t.sessionId)&&At(t.size)&&r.sessionId===e?r.size:0}};function qa(e,t){return function(e){for(var t=0,r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t)}(e)%100<Qt(100*t,0,100,Ms)}function Ha(e){return"$survey_response_"+e}function Ua(e,t){if(!t)return null;var r=e[Ha(t)];return Et(r)?[...r]:r}function Wa(e,t,r){void 0===e&&(e={});var i={};return t.questions.forEach(t=>{if(!Rt(t.originalQuestionIndex)){var r,s=0===(r=t.originalQuestionIndex)?"$survey_response":"$survey_response_"+r,n=Ua(e,t.id);Rt(n)||(i[s]=n)}}),n({$survey_questions:t.questions.map(t=>{var i,s;return{id:t.id,question:null!==(i=null==r?void 0:r[null!==(s=t.id)&&void 0!==s?s:""])&&void 0!==i?i:t.question,response:Ua(e,t.id)}})},e,i)}function za(e,t){var r="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(r="$survey_"+t+"/"+e.id+"/"+e.current_iteration),r}function Va(e){return"string"==typeof e&&e.trim()?e.trim():null}function ja(e){return e.toLowerCase()}function Ga(e,t,r){if(!e||!t)return null;var i=ja(t),s=Object.keys(e).find(e=>ja(e)===i);if(s)return null==r||r.debug("Found exact translation match: "+s),s;if(i.includes("-")){var n=i.split("-")[0],o=Object.keys(e).find(e=>ja(e)===n);if(o)return null==r||r.debug("Found base language translation match: "+o+" (from "+t+")"),o}return null}var Qa=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Ka(e,t,r){var i,s=Ga(e.translations,t,r),o=n({},e),a=!1;if(s){var l,u=null==(l=e.translations)?void 0:l[s];if(u)if(null==r||r.info("Applying survey-level translation for language: "+s),Rt(u.name)||(o.name=u.name,a=!0),o.appearance){var d=n({},o.appearance);for(var c of Qa){var h=u[c];Rt(h)||(d[c]=h,a=!0)}o.appearance=d}else(function(e){return Qa.some(t=>!Rt(e[t]))})(u)&&(a=!0)}var p=e.questions.map(e=>function(e,t,r){var i,s=Ga(e.translations,t,r);if(!s)return{question:e,matchedKey:null,hasChanges:!1};var o=null==(i=e.translations)?void 0:i[s];if(!o)return{question:e,matchedKey:null,hasChanges:!1};var a=n({},e),l=!1;return Rt(o.question)||(a.question=o.question,l=!0),Rt(o.description)||(a.description=o.description,l=!0),Rt(o.buttonText)||(a.buttonText=o.buttonText,l=!0),"link"in a&&!Rt(o.link)&&(a.link=o.link,l=!0),"lowerBoundLabel"in a&&!Rt(o.lowerBoundLabel)&&(a.lowerBoundLabel=o.lowerBoundLabel,l=!0),"upperBoundLabel"in a&&!Rt(o.upperBoundLabel)&&(a.upperBoundLabel=o.upperBoundLabel,l=!0),"choices"in a&&function(e){return Et(e.choices)}(o)&&(a.choices=o.choices,l=!0),{question:l?a:e,matchedKey:l?s:null,hasChanges:l}}(e,t,r)),_=p.map(e=>e.question),g=p.some(e=>e.hasChanges),v=null;return s||(v=(null==(i=p.find(e=>e.matchedKey))?void 0:i.matchedKey)||null),g&&(o.questions=_,a=!0,null==r||r.info("Applied question-level translations for language: "+t)),{survey:o,matchedKey:a?s||v:null}}function Za(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}function Ya(e){var t;return Za(e)&&!(null==(t=e.conditions)||null==(t=t.events)||!t.repeatedActivation)||"always"===e.schedule}var Ja=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},Xa=e=>e.toLowerCase(),el={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Ja(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Ja(t,e))),icontains:(e,t)=>t.map(Xa).some(t=>e.map(Xa).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(Xa).every(t=>e.map(Xa).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r<parseFloat(e))})};function tl(e,t){return!e||Object.entries(e).every(e=>{var r=e[1],i=null==t?void 0:t[e[0]];if(null==i)return!1;var s=el[r.operator];return!!s&&s(r.values,[String(i)])})}function rl(e,t,r){return js({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var il=new Set(["is_not","not_icontains","not_regex"]);function sl(e,t,r){return!e||0===e.length||e.every(e=>{var i,s=null==(i="person"===e.type?r:t)?void 0:i[e.key],n=e.operator||"exact";if(Rt(s)||Ft(s))return il.has(n);var o=el[n];return!!o&&!Rt(e.value)&&!Ft(e.value)&&o(Et(e.value)?e.value.map(String):[String(e.value)],Et(s)?s.map(String):[String(s)])})}var nl=Fs("[SessionRecording]");function ol(e,t){return t?e:"!"+e}function al(e,t){return e===t||e!=="!"+t&&null}var ll=class{constructor(e,t,r,i,s,n,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=r,this._linkedFlagMatching=i,this._reportStarted=s,this._tryTakeFullSnapshot=n,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=ko}onRemoteConfig(e){this._sampleRate=At(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new _o([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=wo):(this._triggerStatusMatcher=new go([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=ko),this._instance.register_for_session({[Qe]:e.triggerMatchType}),this._urlTriggerMatching.onConfig(e),this._eventTriggerMatching.onConfig(e),this._linkedFlagMatching.onConfig(e,(e,t)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:t}),this._onTriggerActivated()})}getStatus(e){return this._recordingStatusFunction({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId})}getMinimumDuration(e){var t,r=null==(t=this._instance.get_property("$session_recording_remote_config"))?void 0:t.minimumDurationMilliseconds;return At(r)?r:null}checkUrlTriggers(e,t,r,i){this._urlTriggerMatching.checkUrlTriggerConditions(t,r,i,e)}setupEventTriggerListeners(e,t,r){if(0!==this._eventTriggerMatching._eventTriggers.length&&Lt(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,r,t)}catch(e){nl.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t,r,i,s=this._sampleRate;if(!At(s))return null==(r=this._instance.persistence)||r.unregister(K),void(null==(i=this._instance.persistence)||i.unregister(W));var n=this._instance.get_property(K),o=this._instance.get_property(W),a=al(n,e),l=At(o)&&o!==s,u=Rt(o)&&n===e,d=l||u||!Dt(a),c=d?qa(e,s):a;d&&(c?this._reportStarted("sampled"):nl.warn("Sample rate ("+s+") has determined that this sessionId ("+e+") will not be sent to the server.")),null==(t=this._instance.persistence)||t.register({[K]:ol(e,c),[W]:Ft(o)&&n===e?null:s})}ensureSamplingDecision(e){At(this._sampleRate)&&(Dt(al(this._instance.get_property(K),e))||this.makeSamplingDecisions(e))}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,r,i,s;null==(e=this._instance.persistence)||e.unregister(J),null==(t=this._instance.persistence)||t.unregister(Y),null==(r=this._instance.persistence)||r.unregister(K),null==(i=this._instance.persistence)||i.unregister(W),null==(s=this._instance.persistence)||s.unregister(Z)}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null==(t=this._triggerStatusMatcher)?void 0:t.triggerStatus(e))===ao}getPendingTriggerConditions(e){return[{label:"URL condition not matched",status:this._urlTriggerMatching.triggerStatusNoSideEffects(e)},{label:"event condition not matched",status:this._eventTriggerMatching.triggerStatusNoSideEffects(e)},{label:"linked flag condition not matched",status:this._linkedFlagMatching.triggerStatusNoSideEffects()}].filter(e=>e.status===ao).map(e=>e.label)}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},ul=class{constructor(e,t,r,i,s){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=r,this._tryAddCustomEvent=i,this._onTriggerActivated=s,this._triggerGroupMatchers=[],this._triggerGroupSamplingResults=new Map,this._hasCompletedInitialFlush=!1}onRemoteConfig(e){e.triggerGroups&&0!==e.triggerGroups.length?(this._setupTriggerGroups(e.triggerGroups),this._instance.register_for_session({[Qe]:"v2_trigger_groups",[Ke]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):nl.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return no;if(!e.receivedFlags)return ro;if(!e.isRecordingEnabled)return Xn;if(e.urlTriggerMatching.urlBlocked)return io;var t=e.triggerGroupMatchers,r=e.triggerGroupSamplingResults;if(0===t.length)return Xn;var i=!1,s=!1;for(var n of t){var o=n.triggerStatus(e.sessionId);if("trigger_activated"===o){var a=n.group.id,l=r.get(a);Rt(l)?Ms.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:a}):!0===l&&(s=!0)}else"trigger_pending"===o&&(i=!0)}return s?eo:i?ro:Xn}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:e.isSampled,rrwebError:e.rrwebError,urlTriggerMatching:e.urlTriggerMatching,eventTriggerMatching:e.eventTriggerMatching,linkedFlagMatching:e.linkedFlagMatching,sessionId:e.sessionId,triggerGroupMatchers:this._triggerGroupMatchers,triggerGroupSamplingResults:this._triggerGroupSamplingResults,minimumDuration:this.getMinimumDuration(e.sessionId)})}getMinimumDuration(e){var t=null;for(var r of this._triggerGroupMatchers)if("trigger_activated"===r.triggerStatus(e)){var i=r.group.minDurationMs;At(i)&&(Ft(t)||t>i)&&(t=i)}return t}checkUrlTriggers(e,t,r,i){var s=this;this._urlTriggerMatching.checkUrlBlocklist(t,r);var n=function(i){i.checkUrlTriggerConditions(t,r,t=>{s._checkGroupLevelProperties(i,void 0)&&(i.activateTrigger(t,e),s.updateActiveTriggers(e),s._onTriggerActivated(t))},e)};for(var o of this._triggerGroupMatchers)n(o)}setupEventTriggerListeners(e,t,r){var i=this;return this._removeEventTriggerCaptureHook=e(e=>{var r;if(this._hasCompletedInitialFlush)return nl.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{var s=function(r){r.checkEventTriggerConditions(e.event,s=>{if(i._checkGroupLevelProperties(r,e.properties)){var n=(r.group.conditions.events||[]).filter(t=>t.name===e.event),o=i._instance.get_property(pe);n.some(t=>!t.properties||0===t.properties.length||sl(t.properties,e.properties,o))&&(r.activateTrigger(s,t),i.updateActiveTriggers(t),i._onTriggerActivated(s))}},t)};for(var n of this._triggerGroupMatchers)s(n)}catch(e){nl.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(var t of this._triggerGroupMatchers){var r,i=t.group,s=i.id,n=i.sampleRate,o=te+s,a=this._instance.get_property(o),l=null,u=!1,d=!1,c=!1;if(Tt(a)){var h=a.sessionId,p=a.sampleRate,_=a.sampled;u="string"==typeof h&&h!==e,d=At(p)&&p!==n,l=h===e&&At(p)&&p===n&&Dt(_)?_:null}else l=a===e||null,u="string"==typeof a&&a!==e,c=a===e;var g=u||d||c||!Dt(l),v=g?qa(e+s,n):l;g&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:s,group_name:i.name,sampleRate:n,isSampled:v}),this._triggerGroupSamplingResults.set(s,v),null==(r=this._instance.persistence)||r.register({[o]:{sessionId:e,sampleRate:n,sampled:v}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,r;for(var i of(null==(e=this._instance.persistence)||e.unregister(K),null==(t=this._instance.persistence)||t.unregister(W),null==(r=this._instance.persistence)||r.unregister(Z),this._triggerGroupMatchers)){var s,n,o,a=i.group.id;null==(s=this._instance.persistence)||s.unregister(X+a),null==(n=this._instance.persistence)||n.unregister(ee+a),null==(o=this._instance.persistence)||o.unregister(te+a)}}updateActiveTriggers(e){var t=[];for(var r of this._triggerGroupMatchers){var i=r.group,s=i.id,n="trigger_activated"===r.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(s);n&&t.push({id:s,name:i.name,matched:!0,sampled:o})}this._instance.register_for_session({[je]:t})}hasPendingTriggers(e){for(var t of this._triggerGroupMatchers)if("trigger_pending"===t.triggerStatus(e))return!0;return!1}getPendingTriggerConditions(e){return this._triggerGroupMatchers.flatMap(t=>"trigger_pending"!==t.triggerStatusNoSideEffects(e)?[]:t.getPendingTriggerConditions(e).map(e=>'trigger group "'+t.group.name+'": '+e))}stop(){var e;null==(e=this._removeEventTriggerCaptureHook)||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){var r=e.group.conditions.properties;return!r||0===r.length||sl(r,t,this._instance.get_property(pe))}_setupTriggerGroups(e){var t=this;this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();var r=function(e){var r=new So(t._instance,e,(r,i)=>{t._reportStarted("linked_flag_matched",{flag:r,variant:i,group_id:e.id,group_name:e.name}),t._onTriggerActivated()});t._triggerGroupMatchers.push(r)};for(var i of e)r(i)}},dl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],cl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...dl],hl="<masked>",pl=["li_fat_id"];function _l(e,t,r){if(!c)return{};var i,s=t?[...dl,...r||[]]:[],n=gl(Zs(c.URL,s,hl),e);return Os((i={},As(pl,function(e){var t=da(e);i[e]=t||null}),i),n)}function gl(e,t){var r=cl.concat(t||[]),i={};return As(r,function(t){var r=Ks(e,t);i[t]=r||null}),i}function vl(e){var t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),r="yahoo"!=t?"q":"p",i={};if(!Ft(t)){i.$search_engine=t;var s=c?Ks(c.referrer,r):"";s.length&&(i.ph_keyword=s)}return i}function fl(){return navigator.language||navigator.userLanguage}var ml="$direct";function yl(){return(null==c?void 0:c.referrer)||ml}function bl(e,t,r){var i;void 0===r&&(r=!1);var s=e?[...dl,...t||[]]:[],n=null==(i=r?li(null==h?void 0:h.href):null==h?void 0:h.href)?void 0:i.substring(0,1e3);return{r:yl().substring(0,1e3),u:n?Zs(n,s,hl):void 0}}function Sl(e,t){var r;void 0===t&&(t=!1);var i=e.r,s=e.u,n=t?li(s):s,o={$referrer:i,$referring_domain:null==i?void 0:i==ml?ml:null==(r=Gs(i))?void 0:r.host};if(n){o.$current_url=n;var a=Gs(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,Os(o,gl(n))}return i&&Os(o,vl(i)),o}function wl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function kl(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var Cl=1e5,El=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,xl=[],Tl=()=>!1,Il="@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(" "),Rl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Pl="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(" "),Ml="Accommodation AdministrativeArea Country Place State".split(" "),Fl={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:Rl,publisher:Pl},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:xl},Offer:{seller:Pl},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:Pl,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Pl,areaServed:Ml,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:xl}},Ll=[["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(" "),Fl.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Fl.Event],[Pl,Fl.Organization],[Ml,Fl.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Fl.Product]];function Al(e,t){return kt.call(e,t)?e[t]:void 0}function Ol(e){var t=typeof e;return Ft(e)||"string"===t||"number"===t||"boolean"===t}function Dl(e){return Ol(e)||Et(e)&&e.every(Ol)?e:void 0}function Nl(e,t){if("string"==typeof e){var r=e.trim(),i=r.indexOf("#"),s=0>i?r:r.slice(i+1);if(!(!s||0>i&&(/^[a-z][a-z\d+.-]*:/i.test(r)||r.includes("/")||r.includes("?"))))try{return t(s)?s:void 0}catch(e){return}}}function Bl(e){if(kt.call(Fl,e))return Fl[e];for(var t of Ll){var r=t[1];if(t[0].includes(e))return r}}function $l(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function ql(e,t,r,i){if(Et(e)){var s=e.map(e=>ql(e,t,r,i)).filter(e=>!Rt(e));return s.length?s:void 0}return Hl(e,t,r,i)||void 0}function Hl(e,t,r,i){if(!Tt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(r))return null;var s=Al(e,"@type"),n=function(e){var t=new Set,r="string"==typeof e?[e]:Et(e)?e:[],i=[];for(var s of r)if("string"==typeof s){var n=s.replace(/^https?:\/\/schema\.org\//,"");if(100>=n.length&&El.test(n)&&!t.has(n)&&(t.add(n),i.push(n),20===i.length))break}return i}(s),o=n.filter(e=>!!Bl(e)&&(!i||!i.length||i.includes(e))),a={};for(var l of Il){var u="@type"===l?n.length?"string"==typeof s?n[0]:n:void 0:"@id"===l?Nl(Al(e,l),t):Dl(Al(e,l));Rt(u)||$l(a,l,u)}for(var d of o){var c=Bl(d);for(var h of Object.keys(c)){var p=Al(e,h),_=c[h];if(!0===_){var g=Dl(p);Rt(g)||$l(a,h,g)}else{var v=ql(p,t,r,_);Rt(v)||$l(a,h,v)}}}var f=ql(Al(e,"@graph"),t,r);return Rt(f)||$l(a,"@graph",f),Object.keys(a).length?a:null}function Ul(e,t,r){if(!Tt(e))return null;var i=Al(e,"@context");if("string"!=typeof i||!/^https?:\/\/schema\.org\/?$/.test(i))return null;var s=Hl(e,t,r);return s?n({"@context":"https://schema.org"},s):null}function Wl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null==(t=e.getAttribute("type"))?void 0:t.trim().toLowerCase())}function zl(e,t,r){if("string"==typeof t?e.classList.contains(t):t&&Array.from(e.classList).some(e=>(t.lastIndex=0,t.test(e))))return!0;try{return!!r&&e.matches(r)}catch(e){return!1}}function Vl(e,t,r){for(var i=e;i;){if(zl(i,t,r))return!0;var s=i.parentNode;i=i.parentElement||(s&&s.nodeType===s.DOCUMENT_FRAGMENT_NODE?s.host:null)}return!1}function jl(e){return Wl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(Wl)}function Gl(e){return Rt(e)?void 0:Math.round(e)}function Ql(e){return Tt(e)?e.network_timing:e}var Kl,Zl,Yl=Fs("[SessionRecording]"),Jl=[1,2,3,4,5,6,7,12],Xl=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function eu(){var e;return null==b||null==(e=b.__PosthogExtensions__)?void 0:e.rrweb}function tu(){var e;return null==(e=eu())?void 0:e.record}function ru(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,Co())}}function iu(e){return la(oa(aa(ru(e))),!0)}function su(e){return nu.apply(this,arguments)}function nu(){return(nu=a(function*(e){var t=yield as(ru(e),Ba.DEBUG,{rethrow:!0});return la(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}var ou="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob,au=!1;function lu(e){return Et(e)&&0===e.length?Kl=null!=Kl?Kl:iu([]):iu(e)}function uu(e){return du.apply(this,arguments)}function du(){return(du=a(function*(e){return Et(e)&&0===e.length?Kl||(Zl=null!=Zl?Zl:su([]).then(e=>(Kl=e,e)).catch(e=>{throw Kl=void 0,Zl=void 0,e})):su(e)})).apply(this,arguments)}function cu(e){return ou&&!au&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function hu(e){return{event:e,size:xo(e)}}function pu(e,t){return n({},e,{data:t,cv:"2024-10"})}function _u(e,t){return n({},e,{cv:"2024-10",data:n({},e.data,t)})}function gu(e){try{if(2===e.type)return hu(pu(e,iu(e.data)));if(3===e.type&&0===e.data.source)return hu(_u(e,{texts:lu(e.data.texts),attributes:lu(e.data.attributes),removes:lu(e.data.removes),adds:lu(e.data.adds)}));if(3===e.type&&8===e.data.source)return hu(_u(e,{adds:e.data.adds?iu(e.data.adds):void 0,removes:e.data.removes?iu(e.data.removes):void 0}))}catch(e){Yl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:Eo(e)}}function vu(){return vu=a(function*(e){try{if(2===e.type)return hu(pu(e,yield su(e.data)));if(3===e.type&&0===e.data.source){var t=yield Promise.all([uu(e.data.texts),uu(e.data.attributes),uu(e.data.removes),uu(e.data.adds)]);return hu(_u(e,{texts:t[0],attributes:t[1],removes:t[2],adds:t[3]}))}if(3===e.type&&8===e.data.source){var r=yield Promise.all([e.data.adds?su(e.data.adds):void 0,e.data.removes?su(e.data.removes):void 0]);return hu(_u(e,{adds:r[0],removes:r[1]}))}}catch(t){return ss(t)&&(au=!0),Yl.error("could not compress event asynchronously - trying synchronous compression",t),gu(e)}return{event:e,size:Eo(e)}}),vu.apply(this,arguments)}function fu(e,t){return 5===e.type&&e.data.tag===t}function mu(e){return fu(e,"sessionIdle")}function yu(e){return fu(e,"$session_ending")}function bu(e){return fu(e,"$session_starting")}var Su=class{get sessionId(){return this._sessionId}get _sessionManager(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get _sessionIdleThresholdMilliseconds(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get _isSampled(){return al(this._instance.get_property(K),this.sessionId)}get _sampleRate(){var e,t=null==(e=this._remoteConfig)?void 0:e.sampleRate;return At(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getMinimumDuration(this.sessionId))&&void 0!==e?e:null}constructor(e,t){this._instance=e,this._endpoint="/s/",this._forceAllowLocalhostNetworkCapture=!1,this._stopRrweb=void 0,this._jsonLdCaptureReady=!1,this._lastActivityTimestamp=Date.now(),this._isActivatingTrigger=!1,this._queuedRRWebEvents=[],this._isIdle="unknown",this._eventsDroppedWhileIdle=0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,this._holdFlushUntilInteraction=!1,this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed=!1,this._suppressNextFreshStartHold=!1,this._rrwebError=!1,this._rrwebStartAttempted=!1,this._maxDepthExceeded=!1,this._snapshotCostErrorLogged=!1,this._hasWarnedClientMaskingOverride=!1,this._hasWarnedExclusiveAttributeMasking=!1,this._maskRegionsFnFailed=!1,this._hasLoggedRecorderCallbackError=!1,this._fullSnapshotTimestamps=[],this._lastFullSnapshotSessionId=void 0,this._fullSnapshotHealAttemptedFor=void 0,this._pendingBufferRestored=!1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueueGeneration=0,this._isStoppingAfterCompression=!1,this._removePageViewCaptureHook=void 0,this._removeEventTriggerCaptureHook=void 0,this._onSessionIdListener=void 0,this._onSessionIdleResetForcedListener=void 0,this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback=(e,t,r)=>{var i,s,n,o;if(r&&(e!==this._sessionId||t!==this._windowId)){var a=!r.noSessionId&&(r.activityTimeout||r.sessionPastMaximumLength),l=this._sessionId,u=this._windowId;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null==(i=this._flushedSizeTracker)?void 0:i.currentTrackedSize(l)}),null==(s=this._instance.persistence)||s.unregister(re),this._maxDepthExceeded=!1,null==(n=eu())||null==n.resetMaxDepthState||n.resetMaxDepthState(),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:r}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){var d=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(d)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:e,nextWindowId:t,changeReason:r,lastActivityTimestamp:this._lastActivityTimestamp}),null==(o=this._strategy)||o.makeSamplingDecisions(e)}},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null==(e=this._instance.persistence)?void 0:e.props[Z])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;var r=null==(e=this._buffer.data[0])?void 0:e.timestamp,i=null==(t=this._buffer.data[this._buffer.data.length-1])?void 0:t.timestamp;return At(r)&&At(i)?i-r:null},this._isBelowMinimumDuration=()=>{var e,t,r=this._minimumDuration;if(!At(r))return!1;if(null===(e=null==(t=this._instance.config.session_recording)?void 0:t.strictMinimumDuration)||void 0===e||!e){var i=this._sessionDuration;return At(i)&&i>=0&&r>i}if(this._hasPassedMinimumDuration())return!1;var s,n=this._getBufferDuration();return!!Ft(n)||r>n||(null==(s=this._instance.persistence)||s.register({[Z]:this._sessionId}),!1)},this._onBeforeUnload=()=>{"buffering"!==this.status?(this._holdFlushUntilInteraction&&this._heldEpochShipsOnUnload&&this._documentWasEverVisible&&!this._heldBufferOverflowed&&this._setFlushHold(void 0),this._drainCompressionQueueSync(),this._flushBuffer(!0)):this._clearBuffer()},this._onPageHide=()=>{this._onBeforeUnload()},this._onOffline=()=>{this._tryAddCustomEvent("browser offline",{})},this._onOnline=()=>{this._tryAddCustomEvent("browser online",{})},this._onVisibilityChange=()=>{null!=c&&c.visibilityState&&("visible"===c.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+c.visibilityState,{}))},this._documentWasEverVisible=null==t||t;var r=this._sessionManager.checkAndGetSessionAndWindowId(),i=r.windowId,s=r.sessionStartTimestamp;this._sessionId=r.sessionId,this._windowId=i,this._sessionStartTimestamp=s,this._linkedFlagMatching=new yo(this._instance),this._urlTriggerMatching=new mo(this._instance),this._eventTriggerMatching=new bo(this._instance),this._buffer=this._clearBuffer(),this._pendingBufferStorageKey="ph_"+(this._instance.config.persistence_name||this._instance.config.token)+"_replay_pending_buffer",this._sessionManager.sessionTimeoutMs>this._sessionIdleThresholdMilliseconds||Yl.warn("session_idle_threshold_ms ("+this._sessionIdleThresholdMilliseconds+") is greater than the session timeout ("+this._sessionManager.sessionTimeoutMs+"). Session will never be detected as idle"),this._flushedSizeTracker=new $a(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,r,i,s,n,o,a,l,u=null==(e=this._remoteConfig)?void 0:e.masking,d={maskAllInputs:null==(t=this._instance.config.session_recording)?void 0:t.maskAllInputs,maskTextSelector:null==(r=this._instance.config.session_recording)?void 0:r.maskTextSelector,blockSelector:null==(i=this._instance.config.session_recording)?void 0:i.blockSelector,maskAllElementAttributes:null==(s=this._instance.config.session_recording)?void 0:s.maskAllElementAttributes},c=null!==(n=null==d?void 0:d.maskAllInputs)&&void 0!==n?n:null==u?void 0:u.maskAllInputs,h=null!==(o=null==d?void 0:d.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,p=null!==(a=null==d?void 0:d.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,_=null!==(l=null==d?void 0:d.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return Rt(c)&&Rt(h)&&Rt(p)&&Rt(_)?void 0:{maskAllInputs:null==c||c,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(!this._hasWarnedClientMaskingOverride){var t=null==(e=this._remoteConfig)?void 0:e.masking;if(!Lt(t)){var r=this._instance.config.session_recording,i=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{var i=null==r?void 0:r[e],s=t[e];return!Rt(i)&&i!==s});0!==i.length&&(this._hasWarnedClientMaskingOverride=!0,Yl.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: '+i.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==r?void 0:r.maskAllInputs,maskTextSelector:null==r?void 0:r.maskTextSelector,blockSelector:null==r?void 0:r.blockSelector,maskAllElementAttributes:null==r?void 0:r.maskAllElementAttributes},project:t}))}}}get _canvasResolutionScale(){var e;return Qt(null==(e=this._instance.config.session_recording.canvasCapture)?void 0:e.resolutionScale,.1,1,Fs("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,r,i,s,n,o,a=this._instance.config.session_recording.captureCanvas,l=null==(e=this._remoteConfig)?void 0:e.canvasRecording,u=null!==(t=null!==(r=null==a?void 0:a.recordCanvas)&&void 0!==r?r:null==l?void 0:l.enabled)&&void 0!==t&&t,d=null!==(i=null!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==i?i:4,c=null!==(n=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==n?n:.4;if("string"==typeof c){var h=parseFloat(c);c=isNaN(h)?.4:h}return{enabled:u,fps:Qt(d,0,12,Fs("canvas recording fps"),4),quality:Qt(c,0,1,Fs("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e,t,r=!(null==(e=this._remoteConfig)||!e.consoleLogRecordingEnabled);return null!==(t=this._instance.config.enable_recording_console_log)&&void 0!==t?t:r}get _networkPayloadCapture(){var e,t,r,i=null==(e=this._remoteConfig)?void 0:e.networkPayloadCapture,s={recordHeaders:null==(t=this._instance.config.session_recording)?void 0:t.recordHeaders,recordBody:null==(r=this._instance.config.session_recording)?void 0:r.recordBody},n=(null==s?void 0:s.recordHeaders)||(null==i?void 0:i.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==i?void 0:i.recordBody),a=Ql(this._instance.config.capture_performance),l=Ql(null==i?void 0:i.capturePerformance),u=!!(Dt(a)?a:l);return n||o||u?{recordHeaders:n,recordBody:o,recordPerformance:u}:void 0}_gatherRRWebPlugins(){var e,t,r=[],i=null==(e=b.__PosthogExtensions__)||null==(e=e.rrwebPlugins)?void 0:e.getRecordConsolePlugin;i&&this._isConsoleLogCaptureEnabled&&r.push(i());var s=null==(t=b.__PosthogExtensions__)||null==(t=t.rrwebPlugins)?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&xt(s))if(!Vs.includes(h.hostname)||this._forceAllowLocalhostNetworkCapture){var o=xt(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;r.push(s(((e,t,r)=>{var i,s={payloadSizeLimitBytes:zn.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...zn.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...zn.payloadHostDenyList]},o=!1!==e.session_recording.recordHeaders&&t.recordHeaders,a=!1!==e.session_recording.recordBody&&t.recordBody,l=!1!==e.capture_performance&&t.recordPerformance,u=(i=Wn(s),e=>(null!=e&&e.requestBody&&(e.requestBody=Zn(e.requestBody,e.requestHeaders,i,"Request")),null!=e&&e.responseBody&&(e.responseBody=Zn(e.responseBody,e.responseHeaders,i,"Response")),e)),d=t=>{return u(((e,t,r)=>{var i;if(null==r||!r(e.name)){var s=Gs(e.name),n=0===t.indexOf("http")?null==(i=Gs(t))?void 0:i.pathname:t;"/"===n&&(n="");var o=null==s?void 0:s.pathname.replace(n||"","");if(!(s&&o&&Kn.some(e=>0===o.indexOf(e))))return e}})((Qn((i=t).requestHeaders),Qn(i.responseHeaders),i),e.api_host,r));var i},c=xt(e.session_recording.maskNetworkRequestFn);return c&&xt(e.session_recording.maskCapturedNetworkRequestFn)&&Ms.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{var r=e.session_recording.maskNetworkRequestFn({url:t.name});return!r&&t.isInitial?r:n({},t,{name:null==r?void 0:r.url})}),s.maskRequestFn=xt(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var r=d(t);if(r){var i=r.isInitial?{name:"",entryType:r.entryType,startTime:r.startTime,duration:r.duration,endTime:r.endTime,timeOrigin:r.timeOrigin,timestamp:r.timestamp,isInitial:!0}:void 0,s=null==e.session_recording.maskCapturedNetworkRequestFn?void 0:e.session_recording.maskCapturedNetworkRequestFn(r);return Lt(s)&&i?(Jn.add(i),i):null!=s?s:void 0}}:e=>function(e){if(!Rt(e))return e.requestBody=Yn(e.requestBody,"Request"),e.responseBody=Yn(e.responseBody,"Response"),e}(d(e)),n({},zn,s,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,o)))}else Yl.info("NetworkCapture not started because we are on localhost.");return r}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?li(e):e}_maskReplayUrl(e,t){void 0===t&&(t=!1);var r=t?li(e):this._stripUrlHash(e),i=this._instance.config.mask_personal_data_properties?[...dl,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(Zs(r,i,hl))}_maskUrl(e){var t,r=this._instance.config.session_recording;if(r.maskCapturedNetworkRequestFn){var i,s=r.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==s?void 0:s.name)&&void 0!==i?i:null==s?void 0:s.url}return r.maskNetworkRequestFn?null==(t=r.maskNetworkRequestFn({url:e}))?void 0:t.url:e}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return 10>this._queuedRRWebEvents.length?this._queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt+1,rrwebMethod:e.rrwebMethod}):Yl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(Xl(()=>tu().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{var t=tu();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e){void 0===e&&(e=!1),Promise.resolve().then(()=>{var t;return null==(t=this._jsonLdCapture)?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!l)return;var e=new URL(l.location.href),t=this._maskReplayUrl(e.origin+e.pathname+e.search);this._lastHref!==t&&(this._lastHref=t,this._tryAddCustomEvent("$url_changed",{href:t}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){var e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Xl(()=>tu().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,r;if(null!=(e=this._strategy)&&e.hasPendingTriggers(this.sessionId)&&!["sampled","active"].includes(this.status)){var i,s=null==(i=this._instance.config.session_recording)?void 0:i.trigger_pending_buffer_interval_millis;return At(s)&&Number.isFinite(s)&&s>=1e3&&36e5>=s?s:6e4}return null!==(t=null==(r=this._instance.config.session_recording)?void 0:r.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0!==this._isIdle){var e=this._fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}}_onTriggerActivated(e){"event"===e&&this._releaseHoldAndFlush(),!this._urlTriggerMatching.urlBlocked&&["sampled","active"].includes(this.status)&&this._scheduleFullSnapshot()}_pauseRecording(){var e;this._urlTriggerMatching.urlBlocked||(this._urlTriggerMatching.urlBlocked=!0,null==(e=this._jsonLdCapture)||e.scan(),clearInterval(this._fullSnapshotTimer),Yl.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null==(e=this._jsonLdCapture)||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Yl.info("recording resumed"))}_activateTrigger(e,t){var r;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&null!=(r=this._strategy)&&r.hasPendingTriggers(this.sessionId)){this._isActivatingTrigger=!0;try{var i,s,n="url"===e?Y:J;null==(i=this._instance.persistence)||i.register({[n]:this.sessionId}),null==(s=this._strategy)||s.updateActiveTriggers(this.sessionId),this._onTriggerActivated(),this._flushBuffer(),this._reportStarted(e+"_trigger_matched",{["url"===e?"matchedUrl":"matchedEvent"]:t})}finally{this._isActivatingTrigger=!1}}}get isStarted(){return!!this._stopRrweb}get _remoteConfig(){var e=this._instance.get_property(H);if(e){var t;try{t=Tt(e)?e:JSON.parse(e)}catch(e){return void Yl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var r,i,s=null!==(r=t.cache_timestamp)&&void 0!==r?r:Date.now();if(Date.now()-s>36e5)return Yl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:s,persistedConfig:e}),void(null==(i=this._instance.persistence)||i.unregister(H))}return t}}_checkOverride(e,t,r){this._instance.get_property(e)&&(t(),r())}start(e){var t,r,i=this._remoteConfig;if(i){if(!this.isStarted){var s=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(s?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=s,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());var n=this._sessionManager.checkAndGetSessionAndWindowId(),o=n.windowId,a=n.sessionStartTimestamp;this._sessionId=n.sessionId,this._windowId=o,this._sessionStartTimestamp=a,this._restorePendingBuffer(),null==(t=this._instance.persistence)||t.unregister(re),null!=i&&i.endpoint&&(this._endpoint=null==i?void 0:i.endpoint),this._strategy=2===(null==i?void 0:i.version)&&null!=i&&i.triggerGroups&&i.triggerGroups.length>0?new ul(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new ll(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(i),null==(r=this._removeEventTriggerCaptureHook)||r.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(z,()=>{this.overrideSampling()},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(z)}),this._checkOverride(V,()=>{this.overrideLinkedFlag()},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(V)}),this._checkOverride(G,()=>{this.overrideTrigger("event")},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(G)}),this._checkOverride(j,()=>{this.overrideTrigger("url")},()=>{var e;return null==(e=this._instance.persistence)?void 0:e.unregister(j)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(Ws(l,"beforeunload",this._onBeforeUnload),Ws(l,"pagehide",this._onPageHide),Ws(l,"offline",this._onOffline),Ws(l,"online",this._onOnline),Ws(c,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&xt(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&xt(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,r)=>{var i;null==(i=this._forceIdleSessionIdListener)||i.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,r)})}):xt(this._sessionManager.on)||Yl.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Lt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){var t=null!=e&&e.properties.$current_url?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){Yl.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(e||"recording_initialized"))}else Yl.info("remote config must be stored in persistence before recording can start")}_teardown(){var e,t,r,i,s,n;null==l||l.removeEventListener("beforeunload",this._onBeforeUnload),null==l||l.removeEventListener("pagehide",this._onPageHide),null==l||l.removeEventListener("offline",this._onOffline),null==l||l.removeEventListener("online",this._onOnline),null==c||c.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null==(e=this._removePageViewCaptureHook)||e.call(this),this._removePageViewCaptureHook=void 0,null==(t=this._removeEventTriggerCaptureHook)||t.call(this),this._removeEventTriggerCaptureHook=void 0,null==(r=this._onSessionIdListener)||r.call(this),this._onSessionIdListener=void 0,null==(i=this._onSessionIdleResetForcedListener)||i.call(this),this._onSessionIdleResetForcedListener=void 0,null==(s=this._forceIdleSessionIdListener)||s.call(this),this._forceIdleSessionIdListener=void 0,null==(n=this._strategy)||n.stop(),this._stopRecordingProducers(),this._invalidateCompressionQueue()}_invalidateCompressionQueue(){this._compressionQueueGeneration+=1,this._pendingCompressionEvents=[],this._queuedCompressionEvents=0,this._compressionQueue=void 0,this._isStoppingAfterCompression=!1}_stopRecordingProducers(){var e,t;null==(e=this._mutationThrottler)||e.stop(),this._queuedRRWebEvents=[],null==(t=this._jsonLdCapture)||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var r;null==(r=this._stopRrweb)||r.call(this)}catch(e){Yl.warn("could not stop rrweb",e)}this._stopRrweb=void 0}_stopAfterCompressionQueueDrains(){if(!this._compressionQueue||0===this._queuedCompressionEvents)return!1;if(this._isStoppingAfterCompression)return!0;this._isStoppingAfterCompression=!0,this._flushHoldReason=void 0;var e=this._compressionQueueGeneration;return this._clearFlushBufferTimer(),this._stopRecordingProducers(),this._compressionQueue.catch(()=>{}).then(()=>{e===this._compressionQueueGeneration&&(this._isStoppingAfterCompression=!1,this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),Yl.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),Yl.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),Yl.info("stopped")}_releaseHoldAfterStop(){this._setFlushHold(void 0,{preserveLogDedup:this._isRestartingForSessionIdChange}),this._heldEpochShipsOnUnload=!1}flushBeforeIdentityReset(){(this.isStarted||this._isStoppingAfterCompression)&&(this._drainCompressionQueueSync(),this._flushBuffer())}_restartForSessionIdChange(e){this._isRestartingForSessionIdChange=!0,this._lastActivityTimestamp=Date.now();try{var t;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null==(t=eu())||null==t.resetSnapshotCostState||t.resetSnapshotCostState(),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,t){var r=(void 0===t?{}:t).preserveLogDedup,i=void 0!==r&&r;if(this._holdFlushUntilInteraction=!Rt(e),this._flushHoldReason=e,Rt(e))i||(this._lastLoggedFlushHold=void 0);else if(!this._isRestartingForSessionIdChange){var s=this.sessionId+":"+e;s!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=s,Yl.info("holding buffer: "+e+". nothing is uploaded until the user interacts with the page"))}}_releaseHoldAndFlush(){this.isStarted||(this._suppressNextFreshStartHold=!0),this._holdFlushUntilInteraction&&(this._setFlushHold(void 0),this._heldEpochShipsOnUnload=!1,this._heldBufferOverflowed&&(this._heldBufferOverflowed=!1,this._tryTakeFullSnapshot()),this._scheduleFlushBuffer())}discard(e){var t=(void 0===e?{}:e).discardProducerEvents,r=void 0!==t&&t;this._holdFlushUntilInteraction=!0,r&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),Yl.info("discarded")}_captureProcessedEvent(e,t,r,i,s){var n={$snapshot_bytes:r,$snapshot_data:t,$session_id:i,$window_id:s};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,i),this._captureSnapshotBuffered(n)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,Yl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t=null==(e=eu())||null==e.getLastSnapshotCost?void 0:e.getLastSnapshotCost();t&&t!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=t,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=t.durationMs||(this._slowestFullSnapshot=t),500>t.durationMs||Yl.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(t.durationMs),stylesheetMs:Math.round(t.stylesheetMs),nodeCount:t.nodeCount,cssRuleCount:t.cssRuleCount,nonDeferrableCssRuleCount:t.nonDeferrableCssRuleCount,deferredStylesheetCount:t.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(Rt(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,Yl.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:t}),this._tryTakeFullSnapshot())):this._lastFullSnapshotSessionId=t}_finishQueuedCompressionEvent(e){e.counted&&e.generation===this._compressionQueueGeneration&&(this._queuedCompressionEvents=Math.max(0,this._queuedCompressionEvents-1)),e.counted=!1,this._pendingCompressionEvents=this._pendingCompressionEvents.filter(t=>t!==e)}_captureQueuedCompressionEvent(e,t,r){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,r,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{var t=e.event,r=Eo(e.event);if(e.compressionEnabled)try{var i=gu(e.event);t=i.event,r=i.size}catch(e){Yl.error("could not process queued compression event - will use uncompressed event",e)}try{this._captureQueuedCompressionEvent(e,t,r)}catch(e){Yl.error("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{this._processQueuedCompressionEventSync(e)})}_enqueueCompression(e,t,r,i){var s=this,n={event:e,compressionEnabled:t,targetSessionId:r,targetWindowId:i,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(n),this._queuedCompressionEvents+=1;var o=function(){var r=a(function*(){try{if(n.processed)return;var r,i;try{var o=t?cu(e)?yield function(e){return vu.apply(this,arguments)}(e):gu(e):{event:e,size:Eo(e)};r=o.event,i=o.size}catch(t){Yl.error("could not process queued compression event - will use uncompressed event",t),r=e,i=Eo(e)}s._captureQueuedCompressionEvent(n,r,i)}finally{s._finishQueuedCompressionEvent(n)}});return function(){return r.apply(this,arguments)}}();this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(e){var t,r,i,s,n,o,a,u,d;if(this._instance.sessionManager&&(this._processQueuedEvents(),e&&Tt(e))){if(4===e.type){var c=this._maskReplayUrl(e.data.href);if(this._lastHref=c,!c)return;e.data.href=c}else this._pageViewFallBack();if(null==(t=this._strategy)||t.checkUrlTriggers(this.sessionId,()=>this._pauseRecording(),()=>this._resumeRecording(),(e,t)=>this._activateTrigger(e,t)),!this._urlTriggerMatching.urlBlocked||function(e){return 5===e.type&&"recording paused"===e.data.tag}(e)){var h,p,_;2===e.type&&(null!=(h=eu())&&null!=h.wasMaxDepthReached&&h.wasMaxDepthReached()&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null==(p=this._mutationThrottler)||p.reset(),null==(_=this._instance.persistence)||_.register_once({[re]:e.timestamp},void 0));var g=2===e.type&&(null==(r=this._strategy)?void 0:r.hasPendingTriggers(this.sessionId));g&&this._clearBufferBeforeMostRecentMeta();var v=this._mutationThrottler?this._mutationThrottler.throttleMutations(e):e;if(v){var f=function(e){var t=e;if(t&&Tt(t)&&6===t.type&&Tt(t.data)&&"rrweb/console@1"===t.data.plugin){t.data.payload.payload.length>10&&(t.data.payload.payload=t.data.payload.payload.slice(0,10),t.data.payload.payload.push("...[truncated]"));for(var r=[],i=0;t.data.payload.payload.length>i;i++)r.push(t.data.payload.payload[i]&&t.data.payload.payload[i].length>2e3?t.data.payload.payload[i].slice(0,2e3)+"...[truncated]":t.data.payload.payload[i]);return t.data.payload.payload=r,e}return e}(v),m=function(e){return yu(e)?e.data.payload:null}(f),y=function(e){return bu(e)?e.data.payload:null}(f),b=function(e){return mu(e)?e.data.payload:null}(f);m||y?null!=m&&m.lastActivityTimestamp&&(f.timestamp=m.lastActivityTimestamp):null!=b&&b.sessionId||this._updateWindowAndSessionIds(f),2===e.type&&(this._fullSnapshotTimestamps.push([this._sessionId,e.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));var S=null!==(i=null!==(s=null!==(n=null==m?void 0:m.currentSessionId)&&void 0!==n?n:null==y?void 0:y.nextSessionId)&&void 0!==s?s:null==b?void 0:b.sessionId)&&void 0!==i?i:this._sessionId,w=null!==(o=null!==(a=null!==(u=null==m?void 0:m.currentWindowId)&&void 0!==u?u:null==y?void 0:y.nextWindowId)&&void 0!==a?a:null==b?void 0:b.windowId)&&void 0!==o?o:this._windowId;if(!0!==this._isIdle||function(e){return mu(e)||yu(e)||bu(e)}(f)){2===f.type&&(this._eventsDroppedWhileIdle=0),b&&(f.timestamp=b.lastActivityTimestamp+b.threshold);var k=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,g?this._scheduleJsonLdScan(!0):k||this._scheduleJsonLdScan();var C=null===(d=this._instance.config.session_recording.compress_events)||void 0===d||d;if(5===f.type&&"$json_ld"===f.data.tag){var E;try{E=l?this._maskReplayUrl(l.location.href):void 0}catch(e){}f.data.href=E}if(this._queuedCompressionEvents>0||C&&cu(f))this._enqueueCompression(f,C,S,w);else{var x=C?gu(f):{event:f,size:Eo(f)};this._captureProcessedEvent(f,x.event,x.size,S,w)}}else(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source})(f)&&this._eventsDroppedWhileIdle++}else!0===this._isIdle&&this._eventsDroppedWhileIdle++}}}get status(){return this._strategy?this._strategy.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this._isSampled,rrwebError:this._rrwebError,urlTriggerMatching:this._urlTriggerMatching,eventTriggerMatching:this._eventTriggerMatching,linkedFlagMatching:this._linkedFlagMatching,remoteConfig:this._remoteConfig}):Xn}log(e,t){var r;void 0===t&&(t="log"),null==(r=this._instance.sessionRecording)||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}overrideLinkedFlag(){this._linkedFlagMatching.linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;null==(e=this._instance.persistence)||e.register({[K]:this.sessionId,[W]:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var e,t=null==l||null==(e=l.location)?void 0:e.href;if(!t)return;var r=this._maskReplayUrl(t);if(!r)return;return new URL(r).hostname||void 0}catch(e){return}}_clearFlushBufferTimer(){this._flushBufferTimer&&(clearTimeout(this._flushBufferTimer),this._flushBufferTimer=void 0)}_scheduleFlushBuffer(){this._flushBufferTimer||(this._flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_wouldOpenRecordingWithMarkersOnly(){return this._lastFullSnapshotSessionId!==this._buffer.sessionId&&0!==this._buffer.data.length&&this._buffer.data.every(e=>5===(null==e?void 0:e.type)&&!yu(e)&&!bu(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null==(t=this._strategy)?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return Rt(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ge]:[]}),void(this._lastLoggedBufferingReason=void 0);var t=this._describePendingTriggerConditions();if(0===t.length)return Rt(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Ge]:[]}),void(this._lastLoggedBufferingReason=void 0);var r=t.join(", "),i=this.sessionId+":"+r;i!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=i,this._instance.register_for_session({[Ge]:t}),Yl.info("buffering: "+r))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null==(e=this._instance.persistence)?void 0:e._disabled)&&Na._is_supported()}_parkBufferForNextPage(){0!==this._buffer.data.length&&this._buffer.size!==this._lastParkedBufferSize&&943718.4>=this._buffer.size&&this._canParkPendingBuffer()&&(this._lastParkedBufferSize=this._buffer.size,Na._set(this._pendingBufferStorageKey,this._buffer))}_restorePendingBuffer(){if(!this._pendingBufferRestored&&this._canParkPendingBuffer()){this._pendingBufferRestored=!0;var e=Na._parse(this._pendingBufferStorageKey);Na._remove(this._pendingBufferStorageKey),Tt(e)&&Et(e.data)&&0!==e.data.length&&Et(e.sizes)&&e.sizes.length===e.data.length&&At(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}}_flushBuffer(e){var t;if(void 0===e&&(e=!1),this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);var r=this._buffer;null==(t=this._strategy)||t.ensureSamplingDecision(this.sessionId);var i=this._isBelowMinimumDuration(),s=this.status;if(this._maybeLogBufferingReason(s),"buffering"===s||"paused"===s||"disabled"===s||i)return!e||"active"!==s&&"sampled"!==s||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==r)return this._buffer;if(r.data.length>0){var n,o=this._currentMaskedHostname();To(r).forEach(e=>{try{var t;null==(t=this._flushedSizeTracker)||t.trackSize(e.sessionId,e.size),this._captureSnapshot({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Ba.LIB_NAME,$lib_version:Ba.LIB_VERSION,$snapshot_host:o})}catch(e){Yl.warn("could not capture snapshot chunk - skipping it",e)}}),Rt(this._lastParkedBufferSize)||(Na._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null==(n=this._strategy)||n.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t,r=2+((null==(t=this._buffer)?void 0:t.data.length)||0),i=e.$session_id,s=this._buffer.sessionId!==i;if(s||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+r>943718.4){var n=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==n)return;s&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=i,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+r>943718.4)?this._heldBufferOverflowed||(this._heldBufferOverflowed=!0,this._buffer=this._clearBuffer()):(this._buffer.size+=e.$snapshot_bytes,this._buffer.data.push(e.$snapshot_data),this._buffer.sizes.push(e.$snapshot_bytes),!0===this._isIdle||this._holdFlushUntilInteraction||this._scheduleFlushBuffer())}_captureSnapshot(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get _sessionDuration(){var e,t,r=null==(e=this._buffer)?void 0:e.data[(null==(t=this._buffer)?void 0:t.data.length)-1];return r?r.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();for(var e=-1,t=this._buffer.data.length-1;t>=0;t--)if(4===this._buffer.data[t].type){e=t;break}return 0>e?this._clearBuffer():(this._buffer.data=this._buffer.data.slice(e),this._buffer.sizes=this._buffer.sizes.slice(e),this._buffer.size=this._buffer.sizes.reduce((e,t)=>e+t,0),this._buffer)}_clearBuffer(){return this._buffer={size:0,data:[],sizes:[],sessionId:this._sessionId,windowId:this._windowId},this._buffer}_reportStarted(e,t){this._instance.register_for_session({[Xe]:e}),Yl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",n({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==Jl.indexOf(null==(t=e.data)?void 0:t.source)}_updateWindowAndSessionIds(e){var t=this._isInteractiveEvent(e);t||!0===this._isIdle||e.timestamp-this._lastActivityTimestamp>this._sessionIdleThresholdMilliseconds&&(this._isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this._sessionIdleThresholdMilliseconds,bufferLength:this._buffer.data.length,bufferSize:this._buffer.size,sessionId:this._sessionId,windowId:this._windowId}),this._flushBuffer());var r=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),i=r.windowId,s=r.sessionId,n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){var o="unknown"===this._isIdle;this._isIdle=!1,o||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}var a=this._sessionId!==s,l=this._windowId!==i;if(this._windowId=i,this._sessionId=s,a||l){var u=a&&!1!==this._isIdle;u&&(this._isIdle="unknown"),this._restartForSessionIdChange(u)}else if(t&&this._releaseHoldAndFlush(),n){var d,c=["sampled","active"].includes(this.status)||(null==(d=this._strategy)?void 0:d.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&c&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null==(e=this._strategy)||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,r,i,s,n,o,a,l,u=null==(e=eu())||null==e.getDeferredStylesheetStats?void 0:e.getDeferredStylesheetStats();return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this._flushHoldReason,$sdk_debug_replay_internal_buffer_length:this._buffer.data.length,$sdk_debug_replay_internal_buffer_size:this._buffer.size,$sdk_debug_current_session_duration:this._sessionDuration,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null==(t=this._flushedSizeTracker)?void 0:t.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:Gl(null==(r=this._slowestFullSnapshot)?void 0:r.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Gl(null==(i=this._slowestFullSnapshot)?void 0:i.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null==(s=this._slowestFullSnapshot)?void 0:s.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null==(n=this._slowestFullSnapshot)?void 0:n.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null==(o=this._slowestFullSnapshot)?void 0:o.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==u?void 0:u.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==u?void 0:u.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==u?void 0:u.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Gl(null==u?void 0:u.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Gl(null==u?void 0:u.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Gl(null==(a=eu())||null==a.getMutationCost||null==(a=a.getMutationCost())?void 0:a.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null==(l=eu())||null==l.getDiscardedDurationSamples?void 0:l.getDiscardedDurationSamples(),$sdk_debug_replay_throttled_mutations_dropped:this._throttledMutationsDropped,$sdk_debug_replay_oversized_mutations_dropped:this._oversizedMutationsDropped,$sdk_debug_replay_oversized_mutation_bytes_dropped:this._oversizedMutationBytesDropped,$sdk_debug_replay_rrweb_error:this._rrwebError,[Ye]:!!this._stopRrweb,[Je]:this._rrwebStartAttempted}}_startRecorder(){var e;if(!this._stopRrweb){this._rrwebStartAttempted=!0;var t,r,i,s,o={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},a=this._instance.config.session_recording;for(var u of Object.entries(a||{})){var d=u[0],h=u[1];if(d in o)if("maskInputOptions"===d)o.maskInputOptions=n({password:!0},h);else if("sampling"===d){var p=null!=h?h:{},_={};Rt(p.mousemove)||(_.mousemove=p.mousemove),Rt(p.mouseInteraction)||(_.mouseInteraction=p.mouseInteraction),o.sampling=_}else o[d]=h}!0===(null==a?void 0:a.captureJsonLd)&&!0!==o.slimDOMOptions&&"all"!==o.slimDOMOptions&&(o.slimDOMOptions=n({},o.slimDOMOptions,{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(o.recordCanvas=!0,o.sampling=n({},o.sampling,{canvas:this._canvasRecording.fps}),o.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},o.canvasResolutionScale=this._canvasResolutionScale,o.canvasMasking={configured:()=>{var e;return xt(null==(e=this._instance.config.session_recording)||null==(e=e.canvasCapture)?void 0:e.maskRegionsFn)},regionsFn:e=>{var t,r=null==(t=this._instance.config.session_recording)||null==(t=t.canvasCapture)?void 0:t.maskRegionsFn;if(xt(r))try{var i;return null!==(i=r(e))&&void 0!==i?i:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,Yl.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(o.maskAllInputs=null===(t=this._masking.maskAllInputs)||void 0===t||t,o.maskTextSelector=null!==(r=this._masking.maskTextSelector)&&void 0!==r?r:void 0,o.blockSelector=null!==(i=this._masking.blockSelector)&&void 0!==i?i:void 0,o.maskAllElementAttributes=null!==(s=this._masking.maskAllElementAttributes)&&void 0!==s&&s),o.maskAllElementAttributes&&o.maskAttributeFn&&(o.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,Yl.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._warnIfClientMaskingShadowsServer();var g=tu();if(g){this._mutationThrottler=null!==(e=this._mutationThrottler)&&void 0!==e?e:new ua(g,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{var r="Too many mutations on node '"+e+"'. Rate limiting. This could be due to SVG animations or something similar";Yl.info(r,{node:t}),this.log("[SessionRecording] "+r,"warn")},onDroppedAttributeMutations:e=>this._throttledMutationsDropped+=e,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this._fullSnapshotIntervalMillis,onDroppedOversizedMutation:e=>{0===this._oversizedMutationsDropped&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this._oversizedMutationsDropped+=1,this._oversizedMutationBytesDropped+=e},requestFullSnapshot:()=>this._tryTakeFullSnapshot()});var v=this._gatherRRWebPlugins();if(this._stopRrweb=g(n({emit:e=>{this.onRRwebEmit(e)},plugins:v,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,Yl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},o)),!this._stopRrweb)return this._rrwebError=!0,void Yl.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==a?void 0:a.captureJsonLd)&&c&&null!=l&&l.MutationObserver&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,r){var i=new WeakMap,s=r.getCaptureState||(()=>!0),n=Cl,o=function(e,t){var r=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||null!=r&&r.length&&!r.includes("id")?Tl:r=>{var i=e.getElementById(r);return!!i&&"SCRIPT"!==i.nodeName&&(!t.isRecordedElement||t.isRecordedElement(i))&&!Vl(i,t.blockClass,t.blockSelector)}}(e,r),a=t=>{try{var a=s();if(!n||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return Vl(e,t.blockClass,t.blockSelector)||Vl(e,t.maskTextClass,t.maskTextSelector)}(t,r))return;var l=function(e,t){if(void 0===t&&(t=Tl),!e||e.length>Cl)return null;try{var r=JSON.parse(e),i={remainingNodes:2048,exceeded:!1},s=Et(r)?r.map(e=>Ul(e,t,i)):Ul(r,t,i);if(i.exceeded||Ft(s)||Et(s)&&(!s.length||s.some(Ft)))return null;var n=JSON.stringify(s);return n.length>2e4?null:[s,n]}catch(e){return null}}(t.text,o);if(!l)return void i.delete(t);var u=l[0],d=l[1];if(Ft(a))return void i.set(t,d);if(i.get(t)!==d){if(d.length>n)return void(n=0);r.emit(u)&&(i.set(t,d),n-=d.length)}}catch(e){return}};try{var l=new t(e=>{try{if(!n||!1===s())return;var t=e=>{for(var t of jl(e))a(t)};for(var r of e)if("childList"===r.type)Wl(r.target)&&a(r.target),r.addedNodes.forEach(t);else if("characterData"===r.type){var i=r.target.parentNode;i&&Wl(i)&&a(i)}else"attributes"===r.type&&Wl(r.target)&&a(r.target)}catch(e){return}});return l.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t){void 0===t&&(t=!1),n&&!1!==s()&&jl(e.documentElement).forEach(e=>{t&&i.delete(e),a(e)})},stop(){return l.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(c,l.MutationObserver,{attributeFilter:o.attributeFilter,blockClass:o.blockClass,blockSelector:o.blockSelector,isRecordedElement:e=>g.mirror.getId(e)>0,maskAllElementAttributes:o.maskAllElementAttributes,maskAttributeFn:o.maskAttributeFn,maskTextClass:o.maskTextClass,maskTextSelector:o.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null==(e=this._instance.config.session_recording)?void 0:e.captureJsonLd)||this._urlTriggerMatching.urlBlocked||this._urlTriggerMatching.isCurrentUrlBlocked()?null:this._canCaptureJsonLd()},emit:e=>this._tryAddJsonLdEvent(e)}),this._urlTriggerMatching.isCurrentUrlBlocked()&&this._jsonLdCapture.scan()),this._lastActivityTimestamp=Date.now(),this._isIdle=Dt(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:o,activePlugins:v.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else Yl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.")}}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}},wu=function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e}({}),ku=function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e}({}),Cu=function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e}({}),Eu=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),xu=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),Tu=function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e}({}),Iu=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}({});function Ru(e,t){return-1!==e.indexOf(t)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Pu={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Mu={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Fu={};function Lu(e){if(Fu[e])return Fu[e];var t=function(e){var t,r,i=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(r=t.__symbol__)||void 0===r?void 0:r.call(t,e);return i&&globalThis[i]?globalThis[i]:void 0}(e)||globalThis[e],r=t.prototype,i=e in Pu?Pu[e]:void 0,s=Boolean(i&&i.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(r,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),n=e in Mu?Mu[e]:void 0,o=Boolean(n&&n.every(e=>{var t;return"function"==typeof r[e]&&(null===(t=r[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(s&&o)return Fu[e]=t.prototype,t.prototype;var a=document.createElement("iframe");a.style.display="none";var l=!1;try{document.body.appendChild(a);var u=a.contentWindow;if(!u)return t.prototype;var d=u[e].prototype;return d?(function(e){return Ru(e,"AppleWebKit")&&!Ru(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Fu[e]=d):r}catch(e){return r}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Au=Object.create(null);function Ou(e,t,r){var i,s=Au[e],n=s[r];if(n)return n.call(t);var o=Lu(e),a=null===(i=Object.getOwnPropertyDescriptor(o,r))||void 0===i?void 0:i.get;return a?(s[r]=a,a.call(t)):t[r]}Au.Node=Object.create(null),Au.ShadowRoot=Object.create(null),Au.MutationObserver=Object.create(null),Au.Element=Object.create(null);var Du,Nu={};function Bu(e,t,r){var i=e+"."+String(r);if(Nu[i])return Nu[i].bind(t);var s=Lu(e)[r];return"function"!=typeof s?t[r]:(Nu[i]=s,s.bind(t))}function $u(){return Lu("MutationObserver").constructor}function qu(e,t,r){try{if(!(t in e))return()=>{};var i=e[t],s={next:i},n=r(function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return s.next.apply(this,t)});return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i},__rrweb_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]!==n)for(var r=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0},i=e[t],o=r(i);o;){if(o.next===n)return void(o.next=s.next);o=r(i=o.next)}else e[t]=s.next}}catch(e){return()=>{}}}var Hu={childNodes:e=>Ou("Node",e,"childNodes"),parentNode:e=>Ou("Node",e,"parentNode"),parentElement:e=>Ou("Node",e,"parentElement"),textContent:e=>Ou("Node",e,"textContent"),isConnected(e){if(void 0===Du){var t,r=null===(t=Object.getOwnPropertyDescriptor(Lu("Node"),"isConnected"))||void 0===t?void 0:t.get;Du=(null==r?void 0:r.toString().includes("[native code]"))?r:null}return null==Du?void 0:Du.call(e)},contains:(e,t)=>Bu("Node",e,"contains")(t),getRootNode:e=>Bu("Node",e,"getRootNode")(),host:e=>e&&"host"in e?Ou("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?Ou("Element",e,"shadowRoot"):null,querySelector:(e,t)=>Bu("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>Bu("Element",e,"querySelectorAll")(t),mutationObserver:$u,patch:qu};function Uu(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var Wu=0;function zu(){Wu+=1}function Vu(){return Wu}function ju(e,t){return(t!==Wu||e>6e4)&&!0}var Gu=0,Qu=0,Ku=0,Zu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Yu=null,Ju=null,Xu=[],ed=0,td=0,rd={slowestBatchMs:0},id={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function sd(e){(Gu+=1)>1||(Zu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Xu=[],ed=0,Ju=(e=>e&&e>0?e:null)(e),Qu=Uu(),Ku=Wu)}function nd(){return 0===Gu?Yu||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Gu-=1)>0?Zu:(Zu.durationMs=Uu()-Qu,Zu.deferredStylesheetCount=ed,id.deferredCount+=ed,Ju=null,ju(Zu.durationMs,Ku)?Zu:Yu=Zu)}function od(e,t,r){var i=e.length;if(r>=32)return i;for(var s=0;e.length>s;s++){var n=e[s];try{var o=n.cssRules;if(o&&o.length)i+=od(o,t,r+1);else if(t&&n.styleSheet){var a=n.styleSheet;if(!t.has(a)){t.add(a);var l=a.rules||a.cssRules;l&&(i+=od(l,t,r+1))}}}catch(e){}}return i}function ad(e){if(0!==Gu){var t=od(e,null,0);Zu.cssRuleCount+=t,td>0&&(Zu.nonDeferrableCssRuleCount+=t)}}function ld(e){td+=1;try{return e()}finally{td-=1}}function ud(e){Gu>0&&(Zu.stylesheetMs+=e)}function dd(e){if(0===Gu||null===Ju)return!1;var t=Zu.cssRuleCount-Zu.nonDeferrableCssRuleCount;return t>=Ju||t+function(e){try{var t=e&&(e.rules||e.cssRules);if(!t)return 0;var r=new WeakSet;return r.add(e),od(t,r,0)}catch(e){return 0}}(e)>Ju}function cd(){id.failedCount+=1}function hd(e){e>0&&(id.abandonedCount+=e)}function pd(e){return pd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pd(e)}function _d(e,t,r){return(t=function(e){var t=function(e){if("object"!=pd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=pd(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gd(e){return e.nodeType===e.ELEMENT_NODE}function vd(e){var t=e&&"host"in e&&"mode"in e&&Hu.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Hu.shadowRoot(t)===e)}function fd(e){return"[object ShadowRoot]"==={}.toString.call(e)}function md(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function yd(e){var t=e.cssText;if(3>t.split('"').length)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return""===e.layerName?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}var bd=0;function Sd(e){var t=0===bd,r=t?Uu():0;bd+=1;try{var i=e.rules||e.cssRules;if(!i)return null;ad(i);var s=e.href;return!s&&e.ownerNode&&(s=e.ownerNode.baseURI),md(Array.from(i,e=>wd(e,s)).join(""))}catch(e){return null}finally{bd-=1,t&&ud(Uu()-r)}}function wd(e,t){if(Cd(e)){var r;try{r=Sd(e.styleSheet)||yd(e)}catch(t){r=e.cssText}try{var i;if(r&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return qd(r,e.styleSheet.href)}catch(e){}return r}var s=e.cssText;return Ed(e)&&e.selectorText.includes(":")&&(s=kd(s)),t?qd(s,t):s}function kd(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Cd(e){return"styleSheet"in e}function Ed(e){return"selectorText"in e}var xd=/^-?[A-Za-z_][\w-]*$/,Td=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Id(e){var t=[],r=!1,i=null,s=new Map;function n(e){var s=t.pop();if("group"===s.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void n(null)}var a=t[t.length-1];return a.parts.push(e),void(a.index+=1)}if(!s.importRule)return r=!0,void(i=e);o(t[t.length-1],s.importRule,e)}function o(e,t,r){try{var i;try{i=r||yd(t)}catch(e){i=t.cssText}try{var s;i&&(null===(s=t.styleSheet)||void 0===s?void 0:s.href)&&(i=qd(i,t.styleSheet.href))}catch(e){}i&&e.parts.push(i),e.index+=1}catch(e){n(null)}}function a(e){var r=e.rules[e.index];if("sheet"===e.kind&&Cd(r)){var i=s.get(r);return null===i?(e.parts.push(r.cssText),void(e.index+=1)):i?void t.push({kind:"sheet",sheet:i.sheet,rules:i.rules,sheetHref:i.sheetHref,index:0,parts:[],importRule:r}):void o(e,r,null)}if(!function(e,r){try{var i=function(e){var t=e;if(!t.cssRules||0===t.cssRules.length)return null;if(t.media&&"string"==typeof t.media.mediaText)return"@media "+t.media.mediaText+" {";if(Ed(e)){if("number"==typeof t.type&&1!==t.type)return null;var r=t.style?t.style.cssText:"";return e.selectorText+" {"+(r?" "+r:"")}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!xd.test(t.containerName)?null:"@container "+(t.containerName?t.containerName+" ":"")+t.containerQuery+" {";if("string"==typeof t.conditionText){var i="";try{var s;i=(null===(s=e.constructor)||void 0===s?void 0:s.name)||""}catch(e){return null}return""===i||"Object"===i||"CSSSupportsRule"===i?"@supports "+t.conditionText+" {":null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?xd.test(t.name)?"@keyframes "+t.name+" {":null:""===t.name?"@layer {":Td.test(t.name)?"@layer "+t.name+" {":null:null}(e);if(null===i)return!1;var s=r.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:s,index:0,parts:[],prelude:s?qd(i,s):i,fixColons:"sheet"===r.kind&&Ed(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(r,e)){var n=r.cssText;"sheet"===e.kind&&Ed(r)&&r.selectorText.includes(":")&&(n=kd(n)),e.parts.push(e.sheetHref?qd(n,e.sheetHref):n),e.index+=1}}return function(e){try{var r=e.rules||e.cssRules;if(!r)return!1;ad(r);var i=e.href;!i&&e.ownerNode&&(i=e.ownerNode.baseURI);var n=Array.from(r);return t.push({kind:"sheet",sheet:e,rules:n,sheetHref:i,index:0,parts:[],importRule:null}),function(e,t){for(var r=[{sheet:t,rules:e,index:0}],i=function(){var e=r[r.length-1];if(e.index>=e.rules.length)return r.pop(),0;var t=e.rules[e.index];if(e.index+=1,!Cd(t)||s.has(t))return 0;var i=null;try{i=t.styleSheet}catch(e){return s.set(t,null),0}if(!i||r.some(e=>e.sheet===i))return 0;try{var n=i.rules||i.cssRules;if(!n)return 0;ad(n);var o=i.href;!o&&i.ownerNode&&(o=i.ownerNode.baseURI);var a=Array.from(n);s.set(t,{sheet:i,rules:a,sheetHref:o}),r.push({sheet:i,rules:a,index:0})}catch(e){}};r.length>0;)i()}(n,e),!0}catch(e){return!1}}(e)||(r=!0),{advance(e){if(r)return!0;var s=Uu(),o=e>0?e:1;try{for(;!r&&o>0;){var l=t[t.length-1];if(l.rules.length>l.index){o-=1;try{a(l)}catch(e){n(null)}}else{var u=null;try{if("group"===l.kind){var d=l.prelude+l.parts.join("")+"}";u=l.fixColons?kd(d):d}else u=md(l.parts.join(""))}catch(e){}n(u)}}}catch(e){r=!0,i=null}finally{ud(Uu()-s)}return r},text:()=>r?i:null,remainingRules(){if(r)return 0;var e=0;for(var i of t)e+=i.rules.length-i.index;return e}}}var Rd=class{constructor(){_d(this,"idNodeMap",new Map),_d(this,"nodeMetaMap",new WeakMap)}getId(e){var t,r;return e&&null!==(t=null===(r=this.getMeta(e))||void 0===r?void 0:r.id)&&void 0!==t?t:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){var t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),gd(e)){var r=Hu.shadowRoot(e);r&&this.removeNodeFromMap(r),"IFRAME"===e.nodeName&&e.contentDocument&&this.removeNodeFromMap(e.contentDocument)}}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){this.idNodeMap.set(t.id,e),this.nodeMetaMap.set(e,t)}replace(e,t){var r=this.getNode(e);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Pd(e){var t=e.element,r=e.maskInputOptions,i=e.tagName,s=e.type,n=e.maskInputFn,o=e.value||"",a=s&&Md(s);return(r[i.toLowerCase()]||a&&r[a])&&(o=n?n(o,t):"*".repeat(o.length)),o}function Md(e){return e.toLowerCase()}var Fd=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 Ld(e){var t=e.element,r=e.name,i=e.value,s=e.maskAttributeFn,n=e.isGenerated;return i?e.maskAllElementAttributes?void 0!==n&&n&&Fd.has(Md(r))?i:"*".repeat(i.length):s?s(r,i,t):i:i}var Ad="__rrweb_original__";function Od(e){try{var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Md(t):null}catch(e){return null}}var Dd=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Nd=/^(?:[a-z+]+:)?\/\//i,Bd=/^www\..*/i,$d=/^(data:)([^,]*),(.*)/i;function qd(e,t){return(e||"").replace(Dd,(e,r,i,s,n,o)=>{var a,l=i||n||o,u=r||s||"";if(!l)return e;if(Nd.test(l)||Bd.test(l))return"url("+u+l+u+")";if($d.test(l))return"url("+u+l+u+")";if("/"===l[0])return"url("+u+(((a=t).indexOf("//")>-1?a.split("/").slice(0,3).join("/"):a.split("/")[0]).split("?")[0]+l)+u+")";var d=t.split("/"),c=l.split("/");for(var h of(d.pop(),c))"."!==h&&(".."===h?d.pop():d.push(h));return"url("+u+d.join("/")+u+")"})}var Hd,Ud,Wd=new Map,zd=1,Vd=new RegExp("[^a-z0-9-_:]");function jd(){return zd++}var Gd=/^[^ \t\n\r\u000c]+/,Qd=/^[, \t\n\r\u000c]+/,Kd=new WeakMap;function Zd(e,t){return t&&""!==t.trim()?Yd(e,t):t}function Yd(e,t){var r=Kd.get(e);if(r||(r=e.createElement("a"),Kd.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Jd(e,t){return(null==t?void 0:t.maxBase64ImageLength)?function(e,t){return t&&e.length>t?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":e}(e,t.maxBase64ImageLength):e}function Xd(e,t,r,i,s,n){if(!i)return i;if("src"===r||"href"===r&&("use"!==t||"#"!==i[0])){if("link"===t&&s){var o,a=null===(o=s.sheet)||void 0===o?void 0:o.href;if(a)return a}var l=Zd(e,i);if(l.startsWith("data:")){if("img"===t&&s){var u=l;return((null==n?void 0:n.type)||void 0!==(null==n?void 0:n.quality))&&(u=function(e,t,r,i){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;var s=Wd.get(t);if(s&&s.type===r&&s.quality===i)return s.result;try{var n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;var o=n.getContext("2d");if(!o)return t;o.drawImage(e,0,0);var a=n.toDataURL(r||"image/webp",null!=i?i:.4),l=t.length>a.length?a:t;if(Wd.size>=10){var u=Wd.keys().next().value;void 0!==u&&Wd.delete(u)}return Wd.set(t,{type:r,quality:i,result:l}),l}catch(e){return t}}(s,l,n.type,n.quality)),Jd(u,n)}if("image"===t)return Jd(l,n)}return l}if("xlink:href"===r&&"#"!==i[0]){var d=Zd(e,i);return"image"===t&&d.startsWith("data:")?Jd(d,n):d}return"background"!==r||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===r?function(e,t){if(""===t.trim())return t;var r=0;function i(e){var i,s=e.exec(t.substring(r));return s?(r+=(i=s[0]).length,i):""}for(var s=[];i(Qd),t.length>r;){var n=i(Gd);if(","===n.slice(-1))n=Zd(e,n.substring(0,n.length-1)),s.push(n);else{var o="";n=Zd(e,n);for(var a=!1;;){var l=t.charAt(r);if(""===l){s.push((n+o).trim());break}if(a)")"===l&&(a=!1);else{if(","===l){r+=1,s.push((n+o).trim());break}"("===l&&(a=!0)}o+=l,r+=1}}}return s.join(", ")}(e,i):"style"===r?qd(i,Yd(e)):"object"===t&&"data"===r?Zd(e,i):i:Zd(e,i)}function ec(e,t,r){return("video"===e||"audio"===e)&&"autoplay"===t}function tc(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&tc(Hu.parentNode(e),t,r);for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!r&&tc(Hu.parentNode(e),t,r)}function rc(e,t,r,i){var s;if(gd(e)){if(!Hu.childNodes(s=e).length)return!1}else{if(null===Hu.parentElement(e))return!1;s=Hu.parentElement(e)}try{if("string"==typeof t){if(i){if(s.closest("."+t))return!0}else if(s.classList.contains(t))return!0}else if(tc(s,t,i))return!0;if(r)if(i){if(s.closest(r))return!0}else if(s.matches(r))return!0}catch(e){}return!1}function ic(e,t,r){var i=e.removeEventListener;"function"==typeof i&&i.call(e,t,r)}var sc=new Map;function nc(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function oc(e){return null==e?"":e.toLowerCase()}var ac=!1,lc=!1;function uc(e,t){var r=t.doc,i=t.mirror,s=t.blockClass,n=t.blockSelector,o=t.maskTextClass,a=t.maskTextSelector,l=t.skipChild,u=void 0!==l&&l,d=t.inlineStylesheet,c=void 0===d||d,h=t.maskInputOptions,p=void 0===h?{}:h,_=t.maskTextFn,g=t.maskInputFn,v=t.maskAllElementAttributes,f=void 0!==v&&v,m=t.maskAttributeFn,y=t.slimDOMOptions,b=t.dataURLOptions,S=void 0===b?{}:b,w=t.inlineImages,k=void 0!==w&&w,C=t.recordCanvas,E=void 0!==C&&C,x=t.canvasMaskingConfigured,T=t.onSerialize,I=t.onIframeLoad,R=t.iframeLoadTimeout,P=void 0===R?5e3:R,M=t.onIframeListenerRegistered,F=t.onStylesheetLoad,L=t.stylesheetLoadTimeout,A=void 0===L?5e3:L,O=t.keepIframeSrcFn,D=void 0===O?()=>!1:O,N=t.newlyAddedElement,B=void 0!==N&&N,q=t.depth,H=void 0===q?0:q,U=t.maxDepth,W=void 0===U?50:U,z=t.needsMask,V=t.preserveWhiteSpace,j=void 0===V||V;if(H>=W)return lc=!0,ac||(ac=!0,console.warn("[rrweb-snapshot] DOM tree depth exceeded max depth of "+W+". Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.")),null;z||(z=rc(e,o,a,void 0===z)),Gu>0&&(Zu.nodeCount+=1);var G,Q=function(e,t){var r=t.doc,i=t.blockClass,s=t.blockSelector,n=t.needsMask,o=t.inlineStylesheet,a=t.maskInputOptions,l=void 0===a?{}:a,u=t.maskTextFn,d=t.maskInputFn,c=t.maskAllElementAttributes,h=void 0!==c&&c,p=t.maskAttributeFn,_=t.dataURLOptions,g=void 0===_?{}:_,v=t.inlineImages,f=t.recordCanvas,m=t.canvasMaskingConfigured,y=t.keepIframeSrcFn,b=t.newlyAddedElement,S=void 0!==b&&b,w=function(e,t){if(t.hasNode(e)){var r=t.getId(e);return 1===r?void 0:r}}(r,t.mirror);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Iu.Document,childNodes:[],compatMode:e.compatMode}:{type:Iu.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Iu.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return function(e,t){for(var r=t.doc,i=t.inlineStylesheet,s=t.maskInputOptions,n=void 0===s?{}:s,o=t.maskInputFn,a=t.maskAllElementAttributes,l=void 0!==a&&a,u=t.maskAttributeFn,d=t.dataURLOptions,c=void 0===d?{}:d,h=t.inlineImages,p=t.recordCanvas,_=t.canvasMaskingConfigured,g=t.keepIframeSrcFn,v=t.newlyAddedElement,f=void 0!==v&&v,m=t.rootId,y=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(r)return e.matches(r)}catch(e){}return!1}(e,t.blockClass,t.blockSelector),b=function(e){if(e instanceof HTMLFormElement)return"form";var t=Md(e.tagName);return Vd.test(t)?"div":t}(e),S=new Set,w={},k=e.attributes.length,C=0;k>C;C++){var E=e.attributes[C];ec(b,E.name)||(w[E.name]=Xd(r,b,Md(E.name),E.value,e,c))}if("link"===b&&i&&!y){var x=e.sheet;if(!x){var T=function(e){return e.href}(e);T&&!(x=nc(r,T))&&T.includes(".css")&&(x=nc(r,window.location.origin+"/"+T.replace(window.location.href,"")))}var I=null;x&&(dd(x)?Gu>0&&(Xu.push(e),ed+=1):I=Sd(x)),I&&(delete w.rel,delete w.href,w._cssText=I)}if("style"===b&&e.sheet&&!(e.innerText||Hu.textContent(e)||"").trim().length){var R=ld(()=>Sd(e.sheet));R&&(w._cssText=R)}if("input"===b||"textarea"===b||"select"===b){var P=e.value,M=e.checked;"radio"!==w.type&&"checkbox"!==w.type&&"submit"!==w.type&&"button"!==w.type&&P?w.value=Pd({element:e,type:Od(e),tagName:b,value:P,maskInputOptions:n,maskInputFn:o}):M&&(w.checked=M)}if("option"===b&&(e.selected&&!n.select?w.selected=!0:delete w.selected),"dialog"===b&&e.open){try{w.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){w.rr_open_mode="modal",w.ph_rr_could_not_detect_modal=!0}S.add("rr_open_mode")}if("canvas"===b&&p&&!(null==_?void 0:_()))if("2d"===e.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var r=0;e.width>r;r+=50)for(var i=0;e.height>i;i+=50){var s=t.getImageData;if(new Uint32Array((Ad in s?s[Ad]:s).call(t,r,i,Math.min(50,e.width-r),Math.min(50,e.height-i)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(w.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var F=e.toDataURL(c.type,c.quality),L=r.createElement("canvas");L.width=e.width,L.height=e.height,F!==L.toDataURL(c.type,c.quality)&&(w.rr_dataURL=F)}var A,O,D=!1;if("img"===b&&h){Hd||(Hd=r.createElement("canvas"),Ud=Hd.getContext("2d"));var N=e,B=N.currentSrc||N.getAttribute("src")||"<unknown-src>",q=N.crossOrigin,H=(t,r)=>D?Ld({element:e,name:t,value:r,maskAllElementAttributes:l,maskAttributeFn:u}):r,U=()=>{ic(N,"load",U);try{Hd.width=N.naturalWidth,Hd.height=N.naturalHeight,Ud.drawImage(N,0,0);var e=Hd.toDataURL(c.type,c.quality);w.rr_dataURL=H("rr_dataURL",e)}catch(e){if("anonymous"!==N.crossOrigin)return N.crossOrigin="anonymous",void(N.complete&&0!==N.naturalWidth?U():N.addEventListener("load",U));console.warn("Cannot inline img src="+B+"! Error: "+e)}"anonymous"===N.crossOrigin&&(q?w.crossOrigin=H("crossOrigin",q):N.removeAttribute("crossorigin"))};N.complete&&0!==N.naturalWidth?U():N.addEventListener("load",U)}if("audio"===b||"video"===b){var W=w;W.rr_mediaState=e.paused?"paused":"played",S.add("rr_mediaState"),W.rr_mediaCurrentTime=e.currentTime,W.rr_mediaPlaybackRate=e.playbackRate,W.rr_mediaMuted=e.muted,W.rr_mediaLoop=e.loop,W.rr_mediaVolume=e.volume}if(f||(e.scrollLeft&&(w.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(w.rr_scrollTop=e.scrollTop)),y){var z,V,j,G=e.getBoundingClientRect(),Q=G.width,K=G.height,Z=G.left,Y=G.top,J=null===(z=r.defaultView)||void 0===z?void 0:z.getComputedStyle(e);w={class:w.class,rr_width:Q+"px",rr_height:K+"px",rr_left:Math.floor(Z+((null===(V=r.defaultView)||void 0===V?void 0:V.scrollX)||0))+"px",rr_top:Math.floor(Y+((null===(j=r.defaultView)||void 0===j?void 0:j.scrollY)||0))+"px"},S.add("rr_width"),S.add("rr_height"),S.add("rr_left"),S.add("rr_top"),J&&(w.rr_position=J.position||"static",S.add("rr_position"),J.transform&&"none"!==J.transform&&(w.rr_transform=J.transform,S.add("rr_transform")),J.display&&J.display.startsWith("inline")&&(w.rr_display=J.display,S.add("rr_display")))}if("iframe"!==b||g(w.src)||(e.contentDocument||(w.rr_src=w.src),delete w.src),l||u)for(var X of Object.entries(w)){var ee=X[0],te=X[1];"string"!=typeof te&&null!==te||(w[ee]=Ld({element:e,name:ee,value:te,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:S.has(ee)}))}D=!0;try{customElements.get(b)&&(A=!0)}catch(e){}return{type:Iu.Element,tagName:b,attributes:w,childNodes:[],isSVG:(O=e,Boolean("svg"===O.tagName||O.ownerSVGElement)||void 0),needBlock:y,rootId:m,isCustom:A}}(e,{doc:r,blockClass:i,blockSelector:s,inlineStylesheet:o,maskInputOptions:l,maskInputFn:d,maskAllElementAttributes:h,maskAttributeFn:p,dataURLOptions:g,inlineImages:v,recordCanvas:f,canvasMaskingConfigured:m,keepIframeSrcFn:y,newlyAddedElement:S,rootId:w});case e.TEXT_NODE:return function(e,t){var r=t.needsMask,i=t.maskTextFn,s=t.rootId,n=Hu.parentNode(e),o=n&&n.tagName,a=Hu.textContent(e),l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var d;if(e.nextSibling||e.previousSibling);else if(dd(n.sheet));else if(null===(d=n.sheet)||void 0===d?void 0:d.cssRules){var c=Sd(n.sheet);c&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(c)&&(a=c)}}catch(t){console.warn("Cannot get CSS styles from text's parentNode. Error: "+t,e)}a=qd(a,Yd(t.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&r&&(a=i?i(a,Hu.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Iu.Text,textContent:a||"",isStyle:l,rootId:s}}(e,{doc:r,needsMask:n,maskTextFn:u,rootId:w});case e.CDATA_SECTION_NODE:return{type:Iu.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:Iu.Comment,textContent:Hu.textContent(e)||"",rootId:w};default:return!1}}(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,keepIframeSrcFn:D,newlyAddedElement:B});if(!Q)return console.warn(e,"not serialized"),null;G=i.hasNode(e)?i.getId(e):function(e,t){if(t.comment&&e.type===Iu.Comment)return!0;if(e.type===Iu.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===function(e){var t,r;try{r=new URL(e,window.location.href)}catch(e){return null}var i=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==i?void 0:i[1])&&void 0!==t?t:null}(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(oc(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===oc(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(oc(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&oc(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(oc(e.attributes.property).match(/^(og|twitter|fb):/)||oc(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===oc(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(oc(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(oc(e.attributes.name))||oc(e.attributes.property).match(/^article:/)||oc(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(oc(e.attributes.name)))return!0}}return!1}(Q,y)||!j&&Q.type===Iu.Text&&!Q.isStyle&&!Q.textContent.replace(/^\s+|\s+$/gm,"").length?-2:jd();var K=Object.assign(Q,{id:G});if(i.add(e,K),-2===G)return null;T&&T(e);var Z=!u;if(K.type===Iu.Element){Z=Z&&!K.needBlock,delete K.needBlock;var Y=Hu.shadowRoot(e);Y&&fd(Y)&&(K.isShadowHost=!0)}if((K.type===Iu.Document||K.type===Iu.Element)&&Z){y.headWhitespace&&K.type===Iu.Element&&"head"===K.tagName&&(j=!1);var J={doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:u,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,preserveWhiteSpace:j,onSerialize:T,onIframeLoad:I,iframeLoadTimeout:P,onIframeListenerRegistered:M,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W};if(K.type===Iu.Element&&"textarea"===K.tagName&&void 0!==K.attributes.value);else for(var X of Array.from(Hu.childNodes(e))){var ee=uc(X,J);ee&&K.childNodes.push(ee)}var te=null;if(gd(e)&&(te=Hu.shadowRoot(e)))for(var re of Array.from(Hu.childNodes(te))){var ie=uc(re,J);ie&&(fd(te)&&(ie.isShadow=!0),K.childNodes.push(ie))}}var se=Hu.parentNode(e);if(se&&vd(se)&&fd(se)&&(K.isShadow=!0),K.type===Iu.Element&&"iframe"===K.tagName){var ne=function(e,t,r){var i,s=()=>{},n=e.contentWindow;if(!n)return s;try{i=n.document.readyState}catch(e){return s}var o=()=>t();if("complete"!==i){var a=!1,l=null,u=()=>{a||(a=!0,null!==l&&(clearTimeout(l),l=null),ic(e,"load",d),e.addEventListener("load",o),t())},d=()=>u();return l=setTimeout(u,r),e.addEventListener("load",d),()=>{null!==l&&(clearTimeout(l),l=null),a?ic(e,"load",o):(a=!0,ic(e,"load",d))}}var c,h="about:blank";try{c=n.location.href}catch(e){return s}if(c!==h||e.src===h||""===e.src){var p=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(p),ic(e,"load",o)}}return e.addEventListener("load",o),()=>{ic(e,"load",o)}}(e,()=>{var t=e.contentDocument;if(t&&I){var r=uc(t,{doc:t,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,preserveWhiteSpace:j,onSerialize:T,onIframeLoad:I,iframeLoadTimeout:P,onIframeListenerRegistered:M,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H+1,maxDepth:W});r&&I(e,r)}},P);null==M||M(e,ne)}return K.type===Iu.Element&&"link"===K.tagName&&"stylesheet"===K.attributes.rel&&function(t,l,u){if(!sc.has(t)){var d;try{d=t.sheet}catch(e){return}if(!d){var h=new AbortController,v=!1,b=()=>{if(!v){v=!0;try{(()=>{if(F){var t=uc(e,{doc:r,mirror:i,blockClass:s,blockSelector:n,needsMask:z,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:p,maskTextFn:_,maskInputFn:g,maskAllElementAttributes:f,maskAttributeFn:m,slimDOMOptions:y,dataURLOptions:S,inlineImages:k,recordCanvas:E,canvasMaskingConfigured:x,preserveWhiteSpace:j,onSerialize:T,onIframeLoad:I,iframeLoadTimeout:P,onStylesheetLoad:F,stylesheetLoadTimeout:A,keepIframeSrcFn:D,depth:H,maxDepth:W});t&&F(e,t)}})()}finally{sc.delete(t),h.abort()}}},w=setTimeout(b,u);h.signal.addEventListener("abort",()=>clearTimeout(w),{once:!0}),t.addEventListener("load",b,{signal:h.signal,once:!0}),sc.set(t,h)}}}(e,0,A),K}function dc(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:!1===e?{}:e}var cc=class e{constructor(){_d(this,"parentElement",null),_d(this,"parentNode",null),_d(this,"ownerDocument",void 0),_d(this,"firstChild",null),_d(this,"lastChild",null),_d(this,"previousSibling",null),_d(this,"nextSibling",null),_d(this,"ELEMENT_NODE",1),_d(this,"TEXT_NODE",3),_d(this,"nodeType",void 0),_d(this,"nodeName",void 0),_d(this,"RRNodeType",void 0)}get childNodes(){for(var e=[],t=this.firstChild;t;)e.push(t),t=t.nextSibling;return e}contains(t){if(!(t instanceof e))return!1;if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function hc(e,t,r){void 0===r&&(r=document);var i={capture:!0,passive:!0};return r.addEventListener(e,t,i),()=>pc(r,e,t,i)}function pc(e,t,r,i){_c(()=>{var s=e.removeEventListener;"function"==typeof s&&(void 0!==i?s.call(e,t,r,i):s.call(e,t,r))})}function _c(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function gc(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var vc="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.",fc={map:{},getId(){return console.error(vc),-1},getNode(){return console.error(vc),null},removeNodeFromMap(){console.error(vc)},has(){return console.error(vc),!1},reset(){console.error(vc)}};function mc(e,t,r){void 0===r&&(r={});var i=null,s=0;return function(){for(var n=arguments.length,o=new Array(n),a=0;n>a;a++)o[a]=arguments[a];var l=Date.now();s||!1!==r.leading||(s=l);var u=t-(l-s),d=this;0>=u||u>t?(i&&(clearTimeout(i),i=null),s=l,e.apply(d,o)):i||!1===r.trailing||(i=setTimeout(()=>{s=!1===r.leading?0:Date.now(),i=null,e.apply(d,o)},u))}}function yc(e,t,r,i,s){void 0===s&&(s=window);var n=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?r:{set(e){if(setTimeout(()=>{try{r.set.call(this,e)}catch(e){}},0),n&&n.set){if(n.get)try{n.get.call(this)}catch(e){return}n.set.call(this,e)}}}),()=>yc(e,t,n||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(fc=new Proxy(fc,{get(e,t,r){return"map"===t&&console.error(vc),Reflect.get(e,t,r)}}));var bc=Date.now;function Sc(e){var t,r,i,s,n=e.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:n.documentElement.scrollLeft||(null==n?void 0:n.body)&&(null===(t=Hu.parentElement(n.body))||void 0===t?void 0:t.scrollLeft)||(null==n||null===(r=n.body)||void 0===r?void 0:r.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==n?void 0:n.documentElement.scrollTop)||(null==n?void 0:n.body)&&(null===(i=Hu.parentElement(n.body))||void 0===i?void 0:i.scrollTop)||(null==n||null===(s=n.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 kc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Cc(e){return e?e.nodeType===e.ELEMENT_NODE?e:Hu.parentElement(e):null}function Ec(e,t,r,i){if(!e)return!1;var s=Cc(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(tc(s,t,i))return!0}catch(e){}if(r){if(s.matches(r))return!0;if(i&&null!==s.closest(r))return!0}return!1}function xc(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function Tc(e,t){if(vd(e))return!1;var r=t.getId(e);if(!t.has(r))return!0;var i=Hu.parentNode(e);return(!i||i.nodeType!==e.DOCUMENT_NODE)&&(!i||Tc(i,t))}function Ic(e){return Boolean(e.changedTouches)}function Rc(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Pc(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Mc(e){return!!e&&(e instanceof cc&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Hu.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(bc=()=>(new Date).getTime());var Fc=class{constructor(){_d(this,"id",1),_d(this,"styleIDMap",new WeakMap),_d(this,"idStyleMap",new Map)}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){return this.has(e)?this.getId(e):(r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r);var r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Lc(e){var t,r=null;return"getRootNode"in e&&(null===(t=Hu.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Hu.host(Hu.getRootNode(e))&&(r=Hu.host(Hu.getRootNode(e))),r}function Ac(e){var t=e.ownerDocument;if(!t)return!1;if(Hu.contains(t,e))return!0;var r=Hu.isConnected(e);return"boolean"==typeof r?r:function(e){var t=e.ownerDocument;if(!t)return!1;var r=function(e){for(var t,r=e;t=Lc(r);)r=t;return r}(e);return Hu.contains(t,r)}(e)}function Oc(e){return"__ln"in e}var Dc,Nc=class{constructor(){_d(this,"length",0),_d(this,"head",null),_d(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,r=0;e>r;r++)t=(null==t?void 0:t.next)||null;return t}addNode(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Oc(e.previousSibling)){var r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&Oc(e.nextSibling)&&e.nextSibling.__ln.previous){var i=e.nextSibling.__ln.previous;t.previous=i,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,i&&(i.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){var t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}},Bc=(e,t)=>e+"@"+t,$c=class{constructor(){_d(this,"frozen",!1),_d(this,"locked",!1),_d(this,"texts",[]),_d(this,"attributes",[]),_d(this,"attributeMap",new WeakMap),_d(this,"generatedAttributes",new WeakMap),_d(this,"removes",[]),_d(this,"mapRemoves",new Set),_d(this,"movedMap",{}),_d(this,"addedSet",new Set),_d(this,"movedSet",new Set),_d(this,"droppedSet",new Set),_d(this,"removesSubTreeCache",new Set),_d(this,"mutationCb",void 0),_d(this,"blockClass",void 0),_d(this,"blockSelector",void 0),_d(this,"maskTextClass",void 0),_d(this,"maskTextSelector",void 0),_d(this,"inlineStylesheet",void 0),_d(this,"maskInputOptions",void 0),_d(this,"maskTextFn",void 0),_d(this,"maskInputFn",void 0),_d(this,"maskAllElementAttributes",void 0),_d(this,"maskAttributeFn",void 0),_d(this,"keepIframeSrcFn",void 0),_d(this,"recordCanvas",void 0),_d(this,"canvasMaskingConfigured",void 0),_d(this,"inlineImages",void 0),_d(this,"slimDOMOptions",void 0),_d(this,"dataURLOptions",void 0),_d(this,"doc",void 0),_d(this,"mirror",void 0),_d(this,"iframeManager",void 0),_d(this,"stylesheetManager",void 0),_d(this,"shadowDomManager",void 0),_d(this,"canvasManager",void 0),_d(this,"processedNodeManager",void 0),_d(this,"unattachedDoc",void 0),_d(this,"canvasManagerReleased",!1),_d(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),_d(this,"emit",()=>{if(!this.frozen&&!this.locked){var e,t,r=Uu(),i=Vu();try{this.processBufferedMutations()}finally{e=Uu()-r,t=i,Gu>0||ju(e,null!=t?t:Wu)||e>rd.slowestBatchMs&&(rd.slowestBatchMs=e)}}}),_d(this,"processBufferedMutations",()=>{var e,t=[],r=new Set,i=new Nc,s=e=>{for(var t=e,r=-2;-2===r;)r=(t=t&&t.nextSibling)&&this.mirror.getId(t);return r},n=n=>{var o=Hu.parentNode(n);if(o&&Ac(n)&&"TEXTAREA"!==o.tagName&&!this.isBlockedAtEmission(o)){var a=vd(o)?this.mirror.getId(Lc(n)):this.mirror.getId(o),l=s(n);if(-1===a||-1===l)return i.addNode(n);null!=e||(e={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:e=>{Rc(e,this.mirror)&&this.iframeManager.addIframe(e),Pc(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Mc(e)&&!Ec(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Hu.shadowRoot(e),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onIframeListenerRegistered:(e,t)=>{this.iframeManager.registerLoadListenerDisposer(e,t)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});var u=uc(n,e);u&&(t.push({parentId:a,nextId:l,node:u}),r.add(u.id))}};for(var o of this.mapRemoves)this.mapRemoves.delete(o),this.mirror.removeNodeFromMap(o);for(var a of this.movedSet)Hc(this.removesSubTreeCache,a)&&!this.movedSet.has(Hu.parentNode(a))||n(a);for(var l of this.addedSet)Uc(this.droppedSet,l)||Hc(this.removesSubTreeCache,l)?Uc(this.movedSet,l)?n(l):this.droppedSet.add(l):n(l);for(var u=null;i.length;){var d=null;if(u){var c=this.mirror.getId(Hu.parentNode(u.value)),h=s(u.value);-1!==c&&-1!==h&&(d=u)}if(!d)for(var p=i.tail;p;){var _=p;if(p=p.previous,_){var g=this.mirror.getId(Hu.parentNode(_.value));if(-1===s(_.value))continue;if(-1!==g){d=_;break}var v=Hu.parentNode(_.value);if(v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var f=Hu.host(v);if(-1!==this.mirror.getId(f)){d=_;break}}}}if(!d){for(;i.head;)i.removeNode(i.head.value);break}u=d.previous,i.removeNode(d.value),n(d.value)}var m={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{var t=e.node,r=Hu.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!r.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{var t=e.attributes;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){var r=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);t.style.length>r.length&&(r+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(var s of Object.entries(t)){var n,o=s[0],a=s[1];"string"!=typeof a&&null!==a||(t[o]=Ld({element:e.node,name:o,value:a,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(n=this.generatedAttributes.get(e.node))||void 0===n?void 0:n.has(o)}))}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!r.has(e.id)).filter(e=>this.mirror.has(e.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={},(m.texts.length||m.attributes.length||m.removes.length||m.adds.length)&&this.mutationCb(m)}),_d(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),_d(this,"genTextAreaValueMutation",e=>{var t=this.attributeMap.get(e);t||(this.attributes.push(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e,t));var r=Array.from(Hu.childNodes(e),e=>Hu.textContent(e)||"").join("");t.attributes.value=Pd({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Od(e),value:r,maskInputFn:this.maskInputFn})}),_d(this,"processMutation",e=>{if(!xc(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":var t=Hu.textContent(e.target);Ec(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:rc(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Cc(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break;case"attributes":var r,i=e.target,s=e.attributeName,n=null!==(r=e.attributeNamespace)&&void 0!==r?r:null,o=function(e,t,r){if(!r)return t;var i=e.getAttributeNodeNS(r,t);if(i)return i.name;if("http://www.w3.org/1999/xlink"===r)return"xlink:"+t;if("http://www.w3.org/XML/1998/namespace"===r)return"xml:"+t;if("http://www.w3.org/2000/xmlns/"===r)return"xmlns"===t?t:"xmlns:"+t;var s=e.lookupPrefix(r);return s?s+":"+t:t}(i,s,n),a=n?i.getAttributeNS(n,s):e.target.getAttribute(s);if("value"===o){var l=i,u=Od(l);a=Pd({element:l,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:u,value:a,maskInputFn:this.maskInputFn})}if(Ec(e.target,this.blockClass,this.blockSelector,!1)||a===e.oldValue)return;var d=this.attributeMap.get(e.target),c="IFRAME"===i.tagName&&"src"===o;if(c&&!this.keepIframeSrcFn(a)&&i.contentDocument)return;if(d||(this.attributes.push(d={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}}),this.attributeMap.set(e.target,d)),"type"===o&&"INPUT"===i.tagName&&"password"===(e.oldValue||"").toLowerCase()&&i.setAttribute("data-rr-is-password","true"),!ec(i.tagName,o)){var h,p=Xd(this.doc,Md(i.tagName),Md(o),a,i,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(a)&&(o="rr_src"),d.attributes[o]=p,null===(h=this.generatedAttributes.get(e.target))||void 0===h||h.delete(o),"style"===o){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}var _=this.unattachedDoc.createElement("span"),g=i.style;for(var v of(e.oldValue&&(_.style.cssText=e.oldValue),Array.from(g))){var f=g.getPropertyValue(v),m=g.getPropertyPriority(v);f!==_.style.getPropertyValue(v)||m!==_.style.getPropertyPriority(v)?d.styleDiff[v]=""===m?f:[f,m]:d._unchangedStyles[v]=[f,m]}for(var y of Array.from(_.style))""===g.getPropertyValue(y)&&(d.styleDiff[y]=!1)}else if("open"===o&&"DIALOG"===i.tagName){d.attributes.rr_open_mode=i.matches("dialog:modal")?"modal":"non-modal";var b=this.generatedAttributes.get(e.target);b||this.generatedAttributes.set(e.target,b=new Set),b.add("rr_open_mode")}}break;case"childList":if(Ec(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{var r=this.mirror.getId(t),i=vd(e.target)?this.mirror.getId(Hu.host(e.target)):this.mirror.getId(e.target);Ec(e.target,this.blockClass,this.blockSelector,!1)||xc(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(qc(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||Tc(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Bc(r,i)]?qc(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:!(!vd(e.target)||!fd(e.target))||void 0}),function(e,t){for(var r=[e];r.length;){var i=r.pop();t.has(i)||(t.add(i),Hu.childNodes(i).forEach(e=>r.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),_d(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)){if(this.addedSet.has(e))return this.addedSet.delete(e),void this.addedSet.add(e);if(!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(xc(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);var r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[Bc(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!Ec(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;for(var i=Hu.childNodes(e),s=0,n=i.length;n>s;s++){var o=i[s];o&&this.genAdds(o)}if(Mc(e))for(var a=Hu.childNodes(Hu.shadowRoot(e)),l=0,u=a.length;u>l;l++){var d=a[l];d&&(this.processedNodeManager.add(d,this),this.genAdds(d,e))}}}}})}init(e){["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(t=>{this[t]=e[t]}),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(var e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){for(var t=this.blockClass,r=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;e;){if(r&&(r.lastIndex=0),Ec(e,r||t,this.blockSelector,!0))return!0;var i="getRootNode"in e?Hu.getRootNode(e):null;e=(null==i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Hu.host(i):null}return!1}};function qc(e,t){for(var r=[t];r.length;){var i=r.pop();if(e.delete(i),i.nodeType!==i.TEXT_NODE)for(var s=Hu.childNodes(i),n=0,o=s.length;o>n;n++){var a=s[n];a&&r.push(a)}}}function Hc(e,t,r){return 0!==e.size&&function(e,t){var r=Hu.parentNode(t);return!!r&&e.has(r)}(e,t)}function Uc(e,t){if(0===e.size)return!1;for(var r=Hu.parentNode(t);r;){if(e.has(r))return!0;r=Hu.parentNode(r)}return!1}var Wc=function(e,t){return void 0===t&&(t="rrweb"),Dc?function(){try{return e(...arguments)}catch(e){if(Dc&&!0===Dc(e,t))return;throw e}}:e},zc=[];function Vc(e){try{if("composedPath"in e){var t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function jc(e,t){var r,i=new $c;i.init(e);try{r=new($u())(Wc(i.processMutations.bind(i)));var s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(s.attributeFilter=e.attributeFilter),r.observe(t,s),zc.push(i),{observer:r,buffer:i}}catch(e){try{null==r||r.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function Gc(e){var t=e.scrollCb,r=e.doc,i=e.mirror,s=e.blockClass,n=e.blockSelector,o=e.sampling,a=new Map,l=e=>{var o=Vc(e);if(o&&!Ec(o,s,n,!0)){var l,u,d=i.getId(o);if(o===r&&r.defaultView){var c=Sc(r.defaultView);l=c.left,u=c.top}else l=o.scrollLeft,u=o.scrollTop;var h=l+","+u;a.get(d)!==h&&(a.set(d,h),t({id:d,x:l,y:u}))}},u=[hc("scroll",Wc(mc(Wc(e=>l(e)),o.scroll||100)),r)];return"onscrollend"in r&&u.push(hc("scrollend",Wc(l),r)),()=>u.forEach(e=>e())}function Qc(e,t){for(var r=zc.length-1;r>=0;r--){var i=zc[r];if(i){var s=i.bufferBelongsToIframe(e);!s&&t&&t.has(i.bufferDoc())&&(s=!0),s&&(i.reset(),zc.splice(r,1))}}}var Kc=["INPUT","TEXTAREA","SELECT"],Zc=new WeakMap;function Yc(e){return function e(t,r){if(th("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||th("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||th("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||th("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){var i=Array.from(t.parentRule.cssRules).indexOf(t);return r.unshift(i),e(t.parentRule,r)}if(t.parentStyleSheet){var s=Array.from(t.parentStyleSheet.cssRules).indexOf(t);r.unshift(s)}return r}(e,[])}function Jc(e,t,r){var i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:i}):{}}function Xc(e,t){var r,i,s,n=e.stylesheetManager;s=e.mirror.getId("#document"===t.nodeName?t:Hu.host(t));var o="#document"===t.nodeName?null===(r=t.defaultView)||void 0===r?void 0:r.Document:null===(i=t.ownerDocument)||void 0===i||null===(i=i.defaultView)||void 0===i?void 0:i.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&o&&a?(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){var t;try{var r;t=null===(r=a.set)||void 0===r?void 0:r.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==s&&-1!==s)try{n.adoptStyleSheets(e,s)}catch(e){}return t}}),Wc(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}function eh(e,t){void 0===t&&(t={});var r,i,s=e.doc.defaultView;if(!s)return()=>{};!function(e,t){var r=e.mutationCb,i=e.mousemoveCb,s=e.mouseInteractionCb,n=e.scrollCb,o=e.viewportResizeCb,a=e.inputCb,l=e.mediaInteractionCb,u=e.styleSheetRuleCb,d=e.styleDeclarationCb,c=e.canvasMutationCb,h=e.fontCb,p=e.selectionCb,_=e.customElementCb;e.mutationCb=function(){t.mutation&&t.mutation(...arguments),r(...arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove(...arguments),i(...arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction(...arguments),s(...arguments)},e.scrollCb=function(){t.scroll&&t.scroll(...arguments),n(...arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize(...arguments),o(...arguments)},e.inputCb=function(){t.input&&t.input(...arguments),a(...arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction(...arguments),l(...arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule(...arguments),u(...arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration(...arguments),d(...arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation(...arguments),c(...arguments)},e.fontCb=function(){t.font&&t.font(...arguments),h(...arguments)},e.selectionCb=function(){t.selection&&t.selection(...arguments),p(...arguments)},e.customElementCb=function(){t.customElement&&t.customElement(...arguments),_(...arguments)}}(e,t);var o=[],a=Wc(()=>{try{if(i)try{i.destroy(),i.reset()}finally{var t=zc.indexOf(i);-1!==t&&zc.splice(t,1)}e.shadowDomManager.resetForDoc(e.doc),null==r||r.disconnect()}finally{gc(o)}});try{if(e.recordDOM){var l=jc(e,e.doc);r=l.observer,i=l.buffer}if(o.push(function(e){var t=e.mousemoveCb,r=e.sampling,i=e.doc,s=e.mirror;if(!1===r.mousemove)return()=>{};var n,o="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500,l=[],u=mc(Wc(e=>{var r=Date.now()-n;t(l.map(e=>(e.timeOffset-=r,e)),e),l=[],n=null}),a),d=Wc(mc(Wc(e=>{var t=Vc(e),r=Ic(e)?e.changedTouches[0]:e,i=r.clientX,o=r.clientY;n||(n=bc()),l.push({x:i,y:o,id:s.getId(t),timeOffset:bc()-n}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?ku.Drag:e instanceof MouseEvent?ku.MouseMove:ku.TouchMove)}),o,{trailing:!1})),c=[hc("mousemove",d,i),hc("touchmove",d,i),hc("drag",d,i)];return Wc(()=>{c.forEach(e=>e())})}(e)),o.push(function(e){var t=e.mouseInteractionCb,r=e.doc,i=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.sampling;if(!1===a.mouseInteraction)return()=>{};var l=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,u=[],d=null;return Object.keys(Cu).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e]).forEach(e=>{var a=Md(e),l=(e=>r=>{var a=Vc(r);if(!Ec(a,s,o,!0)){var l=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":l=Eu.Mouse;break;case"touch":l=Eu.Touch;break;case"pen":l=Eu.Pen}l===Eu.Touch&&(Cu[e]===Cu.MouseDown?u="TouchStart":Cu[e]===Cu.MouseUp&&(u="TouchEnd"))}else Ic(r)&&(l=Eu.Touch);null!==l?(d=l,(u.startsWith("Touch")&&l===Eu.Touch||u.startsWith("Mouse")&&l===Eu.Mouse)&&(l=null)):Cu[e]===Cu.Click&&(l=d,d=null);var c=Ic(r)?r.changedTouches[0]:r;if(c){var h=i.getId(a),p=c.clientX,_=c.clientY;Wc(t)(n({type:Cu[u],id:h,x:p,y:_},null!==l&&{pointerType:l}))}}})(e);if(window.PointerEvent)switch(Cu[e]){case Cu.MouseDown:case Cu.MouseUp:a=a.replace("mouse","pointer");break;case Cu.TouchStart:case Cu.TouchEnd:return}u.push(hc(a,l,r))}),Wc(()=>{u.forEach(e=>e())})}(e)),o.push(Gc(e)),o.push(function(e,t){var r=e.viewportResizeCb,i=t.win,s=-1,n=-1;return hc("resize",Wc(mc(Wc(()=>{var e=wc(),t=kc();s===e&&n===t||(r({width:Number(t),height:Number(e)}),s=e,n=t)}),200)),i)}(e,{win:s})),o.push(function(e){var t=e.inputCb,r=e.doc,i=e.mirror,s=e.blockClass,o=e.blockSelector,a=e.ignoreClass,l=e.ignoreSelector,u=e.maskInputOptions,d=e.maskInputFn,c=e.userTriggeredOnInput;function h(e){var t=Vc(e),i=e.isTrusted,n=r.defaultView;if(!t||!n||t instanceof n.HTMLElement){var h=t&&t.tagName;if(t&&"OPTION"===h&&(t=Hu.parentElement(t)),t&&h&&Kc.indexOf(h)>=0&&!Ec(t,s,o,!0)&&!(t.classList.contains(a)||l&&t.matches(l))){var _=t.value,g=!1,v=Od(t)||"";"radio"===v||"checkbox"===v?g=t.checked:(u[h.toLowerCase()]||u[v])&&(_=Pd({element:t,maskInputOptions:u,tagName:h,type:v,value:_,maskInputFn:d})),p(t,c?{text:_,isChecked:g,userTriggered:i}:{text:_,isChecked:g});var f=t.name;"radio"===v&&f&&g&&r.querySelectorAll('input[type="radio"][name="'+f+'"]').forEach(e=>{if(e!==t){var r=e.value;p(e,c?{text:r,isChecked:!g,userTriggered:!1}:{text:r,isChecked:!g})}})}}}function p(e,r){var s=Zc.get(e);if(!s||s.text!==r.text||s.isChecked!==r.isChecked){Zc.set(e,r);var o=i.getId(e);Wc(t)(n({},r,{id:o}))}}var _=("last"===e.sampling.input?["change"]:["input","change"]).map(e=>hc(e,Wc(h),r)),g=r.defaultView;if(!g)return()=>{_.forEach(e=>e())};var v=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value");return v&&v.set&&_.push(...[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]].map(e=>yc(e[0],e[1],{set(){Wc(h)({target:this,isTrusted:!1})}},!1,g))),Wc(()=>{gc(_)})}(e)),o.push(function(e){var t=e.mediaInteractionCb,r=e.blockClass,i=e.blockSelector,s=e.mirror,n=e.sampling,o=e.doc,a=Wc(e=>mc(Wc(n=>{var o=Vc(n);if(o&&!Ec(o,r,i,!0)){var a=o.currentTime,l=o.volume,u=o.muted,d=o.playbackRate,c=o.loop;t({type:e,id:s.getId(o),currentTime:a,volume:l,muted:u,playbackRate:d,loop:c})}}),n.media||500)),l=[hc("play",a(Tu.Play),o),hc("pause",a(Tu.Pause),o),hc("seeked",a(Tu.Seeked),o),hc("volumechange",a(Tu.VolumeChange),o),hc("ratechange",a(Tu.RateChange),o)];return Wc(()=>{l.forEach(e=>e())})}(e)),e.recordDOM){var u=function(e){var t=new Map,r=new Set,i=!0,s=e=>{if(i)try{e()}catch(e){}},n=e=>{var r,i=t.get(e);if(i){for(;null===(r=i[0])||void 0===r?void 0:r.ready;){var n=i.shift();(null==n?void 0:n.emit)&&s(n.emit)}0===i.length&&t.delete(e)}};return{queueMutation(e,r){if(e){var i=t.get(e);i?(i.push({emit:r,ready:!0}),n(e)):s(r)}else s(r)},queuePendingMutation(o,a,l){if(!i)return()=>{};var u=t.get(o);u||t.set(o,u=[]);var d={emit:a,ready:!1};u.push(d);var c,h=!1,p=!1,_=()=>{h||p||(h=!0,void 0!==c&&r.delete(c),d.ready=!0,d.emit=void 0,n(o))};try{c=e.setTimeout(_,5e3),h||p?e.clearTimeout(c):r.add(c)}catch(e){_()}return t=>{!p&&i&&(p=!0,void 0!==c&&(e.clearTimeout(c),r.delete(c)),h?t&&s(l):(d.ready=!0,t||(d.emit=void 0),n(o)))}},reset(){i=!1,r.forEach(t=>e.clearTimeout(t)),r.clear(),t.clear()}}}(s);o.push(u.reset),o.push(function(e,t){var r=e.styleSheetRuleCb,i=e.mirror,s=e.stylesheetManager,n=t.win,o=t.mutationQueue;if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};var a=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Jc(t,i,s.styleMirror),d=u.id,c=u.styleId;return(d&&-1!==d||c&&-1!==c)&&o.queueMutation(t,()=>r({id:d,styleId:c,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(e,t,r){return void 0===r&&(r=this.cssRules.length),n.CSSStyleSheet.prototype.insertRule.apply(this,[e+" { "+t+" }",r])};var l,u,d=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(d,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Jc(t,i,s.styleMirror),d=u.id,c=u.styleId;return(d&&-1!==d||c&&-1!==c)&&o.queueMutation(t,()=>r({id:d,styleId:c,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(l=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(l,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);try{var u=null==l?void 0:l.then;if(t.ownerNode||!l||"function"!=typeof u)return l;s.onCssomSheetMutation(t);var d=Jc(t,i,s.styleMirror),c=d.id,h=d.styleId;if(!(c&&-1!==c||h&&-1!==h))return l;var p=o.queuePendingMutation(t,()=>r({id:c,styleId:h,replace:a}),()=>{var e=Sd(t);null!==e&&r({id:c,styleId:h,replace:e})});try{u.call(l,()=>p(!0),()=>p(!1))}catch(e){p(!1)}}catch(e){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(u=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t);var u=Jc(t,i,s.styleMirror),d=u.id,c=u.styleId;return(d&&-1!==d||c&&-1!==c)&&o.queueMutation(t,()=>r({id:d,styleId:c,replaceSync:a})),l},"host")}));var c={};rh("CSSGroupingRule")?c.CSSGroupingRule=n.CSSGroupingRule:(rh("CSSMediaRule")&&(c.CSSMediaRule=n.CSSMediaRule),rh("CSSConditionRule")&&(c.CSSConditionRule=n.CSSConditionRule),rh("CSSSupportsRule")&&(c.CSSSupportsRule=n.CSSSupportsRule));var h={};return Object.entries(c).forEach(e=>{var t=e[0],n=e[1];h[t]={insertRule:n.prototype.insertRule,deleteRule:n.prototype.deleteRule},n.prototype.insertRule=new Proxy(h[t].insertRule,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Jc(t.parentStyleSheet,i,s.styleMirror),d=u.id,c=u.styleId;if(t.parentStyleSheet&&(d&&-1!==d||c&&-1!==c)){var h=[...Yc(t),l];o.queueMutation(t.parentStyleSheet,()=>r({id:d,styleId:c,adds:[{rule:a,index:h}]}))}return l},"host")}),n.prototype.deleteRule=new Proxy(h[t].deleteRule,{apply:Wc((e,t,n)=>{var a=n[0],l=e.apply(t,n);s.onCssomSheetMutation(t.parentStyleSheet);var u=Jc(t.parentStyleSheet,i,s.styleMirror),d=u.id,c=u.styleId;if(t.parentStyleSheet&&(d&&-1!==d||c&&-1!==c)){var h=[...Yc(t),a];o.queueMutation(t.parentStyleSheet,()=>r({id:d,styleId:c,removes:[{index:h}]}))}return l},"host")})}),Wc(()=>{n.CSSStyleSheet.prototype.insertRule=a,n.CSSStyleSheet.prototype.deleteRule=d,l&&(n.CSSStyleSheet.prototype.replace=l),u&&(n.CSSStyleSheet.prototype.replaceSync=u),Object.entries(c).forEach(e=>{var t=e[0],r=e[1];r.prototype.insertRule=h[t].insertRule,r.prototype.deleteRule=h[t].deleteRule})})}(e,{win:s,mutationQueue:u})),o.push(Xc(e,e.doc)),o.push(function(e,t){var r=e.styleDeclarationCb,i=e.mirror,s=e.ignoreCSSAttributes,n=e.stylesheetManager,o=t.win,a=t.mutationQueue,l=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(l,{apply:Wc((e,t,o)=>{var l,u=o[0],d=o[1],c=o[2],h=e.apply(t,o);if(s.has(u))return h;var p=null===(l=t.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(p);var _=Jc(p,i,n.styleMirror),g=_.id,v=_.styleId;if(g&&-1!==g||v&&-1!==v){var f=Yc(t.parentRule);a.queueMutation(p,()=>r({id:g,styleId:v,set:{property:u,value:d,priority:c},index:f}))}return h},"host")});var u=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(u,{apply:Wc((e,t,o)=>{var l,u=o[0],d=e.apply(t,o);if(s.has(u))return d;var c=null===(l=t.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(c);var h=Jc(c,i,n.styleMirror),p=h.id,_=h.styleId;if(p&&-1!==p||_&&-1!==_){var g=Yc(t.parentRule);a.queueMutation(c,()=>r({id:p,styleId:_,remove:{property:u},index:g}))}return d},"host")}),Wc(()=>{o.CSSStyleDeclaration.prototype.setProperty=l,o.CSSStyleDeclaration.prototype.removeProperty=u})}(e,{win:s,mutationQueue:u})),e.collectFonts&&o.push(function(e){var t=e.fontCb,r=e.doc,i=r.defaultView;if(!i)return()=>{};var s=[],n=new WeakMap,o=i.FontFace;i.FontFace=function(e,t,r){var i=new o(e,t,r);return n.set(i,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};var a=qu(r.fonts,"add",function(e){return function(r){return setTimeout(Wc(()=>{var e=n.get(r);e&&(t(e),n.delete(r))}),0),e.apply(this,[r])}});return s.push(()=>{i.FontFace=o}),s.push(a),Wc(()=>{s.forEach(e=>e())})}(e))}for(var d of(o.push(function(e){var t=e.doc,r=e.mirror,i=e.blockClass,s=e.blockSelector,n=e.selectionCb,o=!0,a=Wc(()=>{var e=t.getSelection();if(!(!e||o&&(null==e?void 0:e.isCollapsed))){o=e.isCollapsed||!1;for(var a=[],l=e.rangeCount||0,u=0;l>u;u++){var d=e.getRangeAt(u),c=d.startContainer,h=d.startOffset,p=d.endContainer,_=d.endOffset;Ec(c,i,s,!0)||Ec(p,i,s,!0)||a.push({start:r.getId(c),startOffset:h,end:r.getId(p),endOffset:_})}n({ranges:a})}});return a(),hc("selectionchange",a)}(e)),o.push(function(e){var t=e.customElementCb,r=e.doc.defaultView;return r&&r.customElements?qu(r.customElements,"define",function(e){return function(r,i,s){try{t({define:{name:r}})}catch(e){console.warn("Custom element callback failed for "+r)}return e.apply(this,[r,i,s])}}):()=>{}}(e)),e.plugins))o.push(d.observer(d.callback,s,d.options))}catch(e){try{a()}catch(e){}throw e}return a}function th(e){return void 0!==window[e]}function rh(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ih=class{constructor(e){_d(this,"generateIdFn",void 0),_d(this,"iframeRemoteIdToLocalIdMap",new WeakMap),_d(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){if(0>t)return t;var s=r||this.getRemoteIdToLocalIdMap(e),n=i||this.getLocalIdToRemoteIdMap(e),o=s.get(t);return void 0===o&&(o=this.generateIdFn(),s.set(t,o),n.set(o,t)),o}getIds(e,t){var r=this.getRemoteIdToLocalIdMap(e),i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,r,i))}getRemoteId(e,t,r){var i;return"number"!=typeof t||0>t?t:null!==(i=(r||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==i?i:-1}getRemoteIds(e,t){var r=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){var t=this.iframeRemoteIdToLocalIdMap.get(e);return t||this.iframeRemoteIdToLocalIdMap.set(e,t=new Map),t}getLocalIdToRemoteIdMap(e){var t=this.iframeLocalIdToRemoteIdMap.get(e);return t||this.iframeLocalIdToRemoteIdMap.set(e,t=new Map),t}},sh=class{constructor(e){_d(this,"iframes",new WeakMap),_d(this,"crossOriginIframeMap",new WeakMap),_d(this,"crossOriginIframeMirror",new ih(jd)),_d(this,"crossOriginIframeStyleMirror",void 0),_d(this,"crossOriginIframeRootIdMap",new WeakMap),_d(this,"mirror",void 0),_d(this,"mutationCb",void 0),_d(this,"wrappedEmit",void 0),_d(this,"loadListener",void 0),_d(this,"pageHideListener",void 0),_d(this,"stylesheetManager",void 0),_d(this,"recordCrossOriginIframes",void 0),_d(this,"messageHandler",void 0),_d(this,"nestedIframeListeners",new Map),_d(this,"attachedWindows",new WeakMap),_d(this,"attachedDocuments",new WeakMap),_d(this,"attachedIframes",new Map),_d(this,"loadListenerDisposers",new WeakMap),_d(this,"iframeElementsById",new Map),_d(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ih(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}registerLoadListenerDisposer(e,t){var r=this.loadListenerDisposers.get(e);r||this.loadListenerDisposers.set(e,r=new Set),r.add(t);var i=this.mirror.getId(e);-1!==i&&this.iframeElementsById.set(i,e)}getIframeElementById(e){var t,r,i;return null!==(t=null!==(r=null===(i=this.attachedIframes.get(e))||void 0===i?void 0:i.element)&&void 0!==r?r:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){var t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>_c(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){var t=this.pageHideHandlers.get(e);t&&(t.forEach(e=>{pc(e.win,"pagehide",e.handler)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){var r=this.mirror.getId(e);return this.attachedIframes.set(r,{element:e,content:t}),r}attachIframe(e,t){var r,i=this.trackIframeContent(e,t);if(e.contentDocument){var s=this.attachedDocuments.get(e);s||this.attachedDocuments.set(e,s=new Set),s.add(e.contentDocument)}this.mutationCb({adds:[{parentId:i,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});var n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){var o=this.handleMessage.bind(this);_c(()=>{n.addEventListener("message",o),this.nestedIframeListeners.set(n,o);var t=this.attachedWindows.get(e);t||this.attachedWindows.set(e,t=new Set),t.add(n)})}_c(()=>{var t=e.contentWindow;if(t){var r=this.pageHideHandlers.get(e);if(r)for(var i of r)if(i.win===t)return;var s=()=>{var t;null===(t=this.pageHideListener)||void 0===t||t.call(this,e),e.contentDocument&&this.mirror.removeNodeFromMap(e.contentDocument)};t.addEventListener("pagehide",s),r||this.pageHideHandlers.set(e,r=new Set),r.add({win:t,handler:s})}}),null===(r=this.loadListener)||void 0===r||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var r=this.crossOriginIframeMap.get(e.source);if(r){var i=this.transformCrossOriginEvent(r,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}}}transformCrossOriginEvent(e,t){switch(t.type){case wu.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:wu.IncrementalSnapshot,data:{source:ku.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case wu.Meta:case wu.Load:case wu.DomContentLoaded:return!1;case wu.Plugin:return t;case wu.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case wu.IncrementalSnapshot:switch(t.data.source){case ku.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);var r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)}),t.data.removes.forEach(t=>{this.replaceIds(t,e,["parentId","id"])}),t.data.attributes.forEach(t=>{this.replaceIds(t,e,["id"])}),t.data.texts.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ku.Drag:case ku.TouchMove:case ku.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case ku.ViewportResize:return!1;case ku.MediaInteraction:case ku.MouseInteraction:case ku.Scroll:case ku.CanvasMutation:case ku.Input:return this.replaceIds(t.data,e,["id"]),t;case ku.StyleSheetRule:case ku.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ku.Font:return t;case ku.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case ku.AdoptedStyleSheet:var i;return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(i=t.data.styles)||void 0===i||i.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(var s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(t[s]=Array.isArray(t[s])?e.getIds(r,t[s]):e.getId(r,t[s]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(e=>{this.replaceIdOnNode(e,t)})}patchRootIdOnNode(e,t){e.type===Iu.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){var t=this.attachedIframes.get(e),r=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),r){var i=r.contentWindow,s=this.attachedWindows.get(r);s&&(s.forEach(e=>{var t=this.nestedIframeListeners.get(e);t&&(pc(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(r)),i&&this.nestedIframeListeners.has(i)&&(pc(i,"message",this.nestedIframeListeners.get(i)),this.nestedIframeListeners.delete(i)),i&&this.crossOriginIframeMap.delete(i),this.iframes.delete(r),this.disposeLoadListeners(r),this.removePageHideListener(r);var n=this.attachedDocuments.get(r);n&&(n.forEach(e=>{_c(()=>this.mirror.removeNodeFromMap(e))}),_c(()=>Qc(r,n)),this.attachedDocuments.delete(r))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0!==this.attachedIframes.size){var e=[];this.attachedIframes.forEach((t,r)=>{this.mirror.has(r)||e.push(r)}),e.forEach(e=>this.removeIframeById(e))}}reattachIframes(){this.attachedIframes.forEach((e,t)=>{var r=e.content;this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&pc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{pc(t,"message",e)}),this.nestedIframeListeners.clear();var e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(t=>e.add(t.element)),e.forEach(e=>{this.disposeLoadListeners(e),this.removePageHideListener(e)}),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}},nh=class{constructor(e){_d(this,"shadowDoms",new WeakSet),_d(this,"mutationCb",void 0),_d(this,"scrollCb",void 0),_d(this,"bypassOptions",void 0),_d(this,"mirror",void 0),_d(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){var r,i;if(fd(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var s=null!==(r=null===(i=Hu.host(e))||void 0===i?void 0:i.ownerDocument)&&void 0!==r?r:t,o=jc(n({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),a=o.observer,l=o.buffer;this.restoreHandlers.push({doc:s,handler(){a.disconnect(),l.destroy(),l.releaseCanvasManager();var e=zc.indexOf(l);-1!==e&&zc.splice(e,1)}}),this.restoreHandlers.push({doc:s,handler:Gc(n({},this.bypassOptions,{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(Hu.host(e))),this.restoreHandlers.push({doc:s,handler:Xc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)})},0)}}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){var r=this;this.restoreHandlers.push({doc:t,handler:qu(e.prototype,"attachShadow",function(e){return function(i){var s=e.call(this,i),n=Hu.shadowRoot(this);return n&&Ac(this)&&r.addShadowRoot(n,t),s}})})}reset(){this.restoreHandlers.forEach(e=>{var t=e.handler;try{t()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){var t=[];for(var r of this.restoreHandlers)if(r.doc===e)try{r.handler()}catch(e){}else t.push(r);this.restoreHandlers=t}},oh="skip-frame";function ah(e){if("object"!=typeof e||null===e)return!1;var t=e.y,r=e.width,i=e.height;return Number.isFinite(e.x)&&Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i)&&r>=0&&i>=0}for(var lh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",uh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),dh=0;64>dh;dh++)uh[lh.charCodeAt(dh)]=dh;var ch=function(e){var t,r=new Uint8Array(e),i=r.length,s="";for(t=0;i>t;t+=3)s+=lh[r[t]>>2],s+=lh[(3&r[t])<<4|r[t+1]>>4],s+=lh[(15&r[t+1])<<2|r[t+2]>>6],s+=lh[63&r[t+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s},hh=new Map,ph=(e,t,r)=>{if(e&&(vh(e,t)||"object"==typeof e)){var i=function(e,t){var r=hh.get(e);return r||hh.set(e,r=new Map),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name),s=i.indexOf(e);return-1===s&&(s=i.length,i.push(e)),s}};function _h(e,t,r,i){return e instanceof Array?e.map(e=>_h(e,t,r,i)):null===e?e:e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray?{rr_type:e.constructor.name,args:[Object.values(e)]}:e instanceof ArrayBuffer?{rr_type:e.constructor.name,base64:ch(e)}:e instanceof DataView?{rr_type:e.constructor.name,args:[_h(e.buffer,t,r,i),e.byteOffset,e.byteLength]}:e instanceof HTMLImageElement?{rr_type:e.constructor.name,src:e.src}:e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(i.type,i.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[_h(e.data,t,r,i),e.width,e.height]}:vh(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:ph(e,t,r)}:e}var gh=(e,t,r,i)=>e.map(e=>_h(e,t,r,i)),vh=(e,t)=>{var r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))},fh=["webgl","webgl2"];function mh(e){return"nodeType"in e}function yh(e,t,r,i){var s=[];try{if(i){var o=function(e,t,r){var i=e.GPUCanvasContext;if((null==i?void 0:i.prototype)&&"function"==typeof i.prototype.configure)return qu(i.prototype,"configure",function(i){return function(s){var o=function(e){var t=e.canvas;return t&&"object"==typeof t?t:null}(this);if(!o||mh(o)&&Ec(o,t,r,!0))return i.call(this,s);mh(o)&&!("__context"in o)&&(o.__context="webgpu");var a=function(e){var t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return i.call(this,null!==a&&s?n({},s,{usage:"number"==typeof s.usage?s.usage|a:a}):s)}})}(e,t,r);o&&s.push(o)}var a=qu(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(s){for(var n=function(e){return"experimental-webgl"===e?"webgl":e}(s),o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];if(!Ec(this,t,r,!0)&&("__context"in this||(this.__context=n),i&&fh.includes(n)))if(a[0]&&"object"==typeof a[0]){var u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[s,...a])}});s.push(a)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(e=>e())}}function bh(e,t,r,i,s,n,o){var a=[],l=Object.getOwnPropertyNames(e),u=function(l){if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))return 0;try{if("function"!=typeof e[l])return 0;var u=qu(e,l,function(e){return function(){for(var a=arguments.length,u=new Array(a),d=0;a>d;d++)u[d]=arguments[d];var c=e.apply(this,u);if(ph(c,n,this),this.canvas&&"tagName"in this.canvas&&!Ec(this.canvas,i,s,!0)){var h={type:t,property:l,args:gh(u,n,this,o)};r(this.canvas,h)}return c}});a.push(u)}catch(n){var d=yc(e,l,{set(e){this.canvas&&"tagName"in this.canvas&&!Ec(this.canvas,i,s,!0)&&r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});a.push(d)}};for(var d of l)u(d);return a}var Sh='(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',wh="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Sh],{type:"text/javascript;charset=utf-8"});function kh(e){var t;try{if(!(t=wh&&(self.URL||self.webkitURL).createObjectURL(wh)))throw"";var r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Sh),{name:null==e?void 0:e.name})}}var Ch,Eh,xh,Th=class{onFullSnapshot(){var e;null===(e=this.resetFrameDedup)||void 0===e||e.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(e){_d(this,"pendingCanvasMutations",new Map),_d(this,"rafStamps",{latestId:0,invokeId:null}),_d(this,"mirror",void 0),_d(this,"mutationCb",void 0),_d(this,"resetObservers",void 0),_d(this,"frozen",!1),_d(this,"locked",!1),_d(this,"rafIdTimestamp",null),_d(this,"rafIdFlush",null),_d(this,"refCount",0),_d(this,"torndown",!1),_d(this,"resetFrameDedup",null),_d(this,"processMutation",(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)});var t=e.sampling,r=void 0===t?"all":t,i=e.win,s=e.blockClass,n=e.blockSelector,o=e.recordCanvas,a=e.dataURLOptions,l=e.resolutionScale,u=e.canvasMasking;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===r&&this.initCanvasMutationObserver(i,s,n,a),o&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,s,n,{dataURLOptions:a,resolutionScale:l,canvasMasking:u})}initCanvasFPSObserver(e,t,r,i,s){var n=this;if("OffscreenCanvas"in t){var o,l="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,u=yh(t,r,i,!0),d=new Map;try{o=new kh}catch(e){return}var c=!1;o.onerror=()=>{var e;c=!0,cancelAnimationFrame(h),null===(e=o.terminate)||void 0===e||e.call(o),this.resetFrameDedup=null},this.resetFrameDedup=()=>{o.postMessage({resetFrameDedup:!0})},o.onmessage=e=>{var t=e.data.id;if(d.set(t,!1),"base64"in e.data){var r=e.data,i=r.displayWidth,s=r.displayHeight;this.mutationCb({id:t,type:xu["2D"],commands:[{property:"clearRect",args:[0,0,i,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r.base64}],type:r.type}]},0,0,i,s]}],displayWidth:i,displayHeight:s})}};var h,p=1e3/e,_=0,g=e=>{var u,v;c||(_&&p>e-_||(_=e,(u=[],v=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Ec(e,r,i,!0)||u.push(e)}),e.querySelectorAll("*").forEach(e=>{e.shadowRoot&&v(e.shadowRoot)})}catch(e){}},v(t.document),u).forEach(function(){var e=a(function*(e){var t=n.mirror.getId(e);if(!d.get(t)&&0!==e.width&&0!==e.height){d.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var r,i,a=e.getContext(e.__context);if(null==a||null===(r=a.isContextLost)||void 0===r?void 0:r.call(a))return void d.set(t,!1);!1===(null==a||null===(i=a.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&a.clear(a.COLOR_BUFFER_BIT)}var u=e.clientWidth||e.width,c=e.clientHeight||e.height,h=Math.max(1,Math.round(u*l)),p=Math.max(1,Math.round(c*l)),_=function(e,t,r,i,s,n){if(e&&"function"==typeof e.regionsFn){var o;try{o=e.regionsFn(t)}catch(e){return oh}if(void 0!==o){if(!Array.isArray(o)||!o.every(ah))return oh;var a=r/s,l=i/n;return o.filter(e=>e.width>0&&e.height>0).map(e=>{var t=Math.floor(e.x*a),r=Math.floor(e.y*l);return{x:t,y:r,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-r}})}}}(s.canvasMasking,e,h,p,u,c);if("skip-frame"===_)return void d.set(t,!1);var g=yield createImageBitmap(e,1>l?{resizeWidth:h,resizeHeight:p,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:p});o.postMessage({id:t,bitmap:g,width:h,height:p,displayWidth:u,displayHeight:c,dataURLOptions:s.dataURLOptions,maskRegions:_},[g])}catch(e){d.set(t,!1)}}});return function(t){return e.apply(this,arguments)}}())),h=requestAnimationFrame(g))};h=requestAnimationFrame(g),this.resetObservers=()=>{var e;u(),cancelAnimationFrame(h),null===(e=o.terminate)||void 0===e||e.call(o),this.resetFrameDedup=null}}}initCanvasMutationObserver(e,t,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var s=yh(e,t,r,!1),n=function(e,t,r,i,s){var n=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype),a=function(o){try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[o])return 1;var a=qu(t.CanvasRenderingContext2D.prototype,o,function(n){return function(){for(var a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];return Ec(this.canvas,r,i,!0)||setTimeout(()=>{var r=gh(l,t,this,s);e(this.canvas,{type:xu["2D"],property:o,args:r})},0),n.apply(this,l)}});n.push(a)}catch(s){var l=yc(t.CanvasRenderingContext2D.prototype,o,{set(t){Ec(this.canvas,r,i,!0)||e(this.canvas,{type:xu["2D"],property:o,args:[t],setter:!0})}});n.push(l)}};for(var l of o)if(a(l))continue;return()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,i),o=function(e,t,r,i,s){var n=[];return void 0!==t.WebGLRenderingContext&&n.push(...bh(t.WebGLRenderingContext.prototype,xu.WebGL,e,r,i,t,s)),void 0!==t.WebGL2RenderingContext&&n.push(...bh(t.WebGL2RenderingContext.prototype,xu.WebGL2,e,r,i,t,s)),()=>{n.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r,i);this.resetObservers=()=>{s(),n(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){var e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{var r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,r){if(!this.frozen&&!this.locked){var i=this.pendingCanvasMutations.get(e);if(i&&-1!==r){var n=i.map(e=>s(e,t));this.mutationCb({id:r,type:i[0].type,commands:n}),this.pendingCanvasMutations.delete(e)}}}},Ih=class{constructor(e){var t;_d(this,"trackedLinkElements",new WeakSet),_d(this,"pendingDeferredSheets",new Set),_d(this,"mutationCb",void 0),_d(this,"adoptedStyleSheetCb",void 0),_d(this,"maskAllElementAttributes",void 0),_d(this,"maskAttributeFn",void 0),_d(this,"styleMirror",new Fc),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(t=e.maskAllElementAttributes)&&void 0!==t&&t,this.maskAttributeFn=e.maskAttributeFn}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}beginDeferredLinkInlining(e,t){if(-1===t||!e.isConnected)return null;var r=null,i=null;try{(i=e.sheet)&&(r=Id(i))}catch(e){}if(!r||!i)return cd(),null;var s=r,n=!1,o={sheet:i,invalidate(){n=!0}};this.pendingDeferredSheets.add(o);var a=!1;return{advance:r=>{if(a)return!0;var l,u,d=Uu(),c=Vu(),h=!0;try{if(n)return a=!0,cd(),!0;if(!s.advance(r))return h=!1,!1;a=!0;var p=s.text();if(!e.isConnected)return!0;var _=null;try{_=e.sheet}catch(e){}return _!==i?(cd(),!0):p?(this.emitCssTextMutation(e,t,p),!0):(cd(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),ju(l=Uu()-d,null!=(u=c)?u:Wu)||(id.totalMs+=l,l>id.slowestSliceMs&&(id.slowestSliceMs=l))}},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(var t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var r;null===(r=this.beginDeferredLinkInlining(e,t))||void 0===r||r.advance(1/0)}emitCssTextMutation(e,t,r){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:Ld({element:e,name:"_cssText",value:r,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){var r=this;if(0!==e.length){var i={id:t,styleIds:[]},s=[],n=function(e){var t;if(r.styleMirror.has(e))t=r.styleMirror.getId(e);else{var n=r.styleMirror.add(e);t=n;var o=Uu();try{ld(()=>{try{var t=e.rules||e.cssRules;t&&ad(t)}catch(e){}s.push({styleId:n,rules:Array.from(e.rules||CSSRule,(t,r)=>({rule:wd(t,e.href),index:r}))})})}finally{ud(Uu()-o)}}i.styleIds.push(t)};for(var o of e)n(o);s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),sc.forEach(e=>e.abort()),sc.clear()}trackStylesheetInLinkElement(e){}},Rh=class{constructor(){_d(this,"nodeMap",new WeakMap),_d(this,"active",!1)}inOtherBuffer(e,t){var r=this.nodeMap.get(e);return r&&Array.from(r).some(e=>e!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},Ph=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var Mh,Fh=document.createElement("iframe");document.body.appendChild(Fh),Array.from=(null===(Mh=Fh.contentWindow)||void 0===Mh?void 0:Mh.Array.from)||Array.from,document.body.removeChild(Fh)}}catch(e){console.debug("Unable to override Array.from",e)}var Lh=new Rd,Ah=new Set([ku.Mutation,ku.MediaInteraction,ku.StyleSheetRule,ku.CanvasMutation,ku.Font,ku.Log,ku.StyleDeclaration,ku.AdoptedStyleSheet]);function Oh(e){var t=window;if("function"==typeof t.requestIdleCallback){var r=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,r)}}}var i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function Dh(e){var t;void 0===e&&(e={});var r=e,i=r.emit,s=r.checkoutEveryNms,o=r.checkoutEveryNth,a=r.blockClass,l=void 0===a?"rr-block":a,u=r.blockSelector,d=void 0===u?null:u,c=r.ignoreClass,h=void 0===c?"rr-ignore":c,p=r.ignoreSelector,_=void 0===p?null:p,g=r.maskTextClass,v=void 0===g?"rr-mask":g,f=r.maskTextSelector,m=void 0===f?null:f,y=r.inlineStylesheet,b=void 0===y||y,S=r.inlineStylesheetBudgetRules,w=r.maskAllInputs,k=r.maskInputOptions,C=r.slimDOMOptions,E=r.maskInputFn,x=r.maskTextFn,T=r.maskAllElementAttributes,I=void 0!==T&&T,R=r.maskAttributeFn,P=r.hooks,M=r.packFn,F=r.sampling,L=void 0===F?{}:F,A=r.dataURLOptions,O=void 0===A?{}:A,D=r.canvasResolutionScale,N=r.canvasMasking,B=r.mousemoveWait,q=r.recordDOM,H=void 0===q||q,U=r.recordCanvas,W=void 0!==U&&U,z=r.recordCrossOriginIframes,V=void 0!==z&&z,j=r.recordAfter,G=void 0===j?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":j,Q=r.userTriggeredOnInput,K=void 0!==Q&&Q,Z=r.collectFonts,Y=void 0!==Z&&Z,J=r.inlineImages,X=void 0!==J&&J,ee=r.plugins,te=r.keepIframeSrcFn,re=void 0===te?()=>!1:te,ie=r.ignoreCSSAttributes,se=void 0===ie?new Set([]):ie,ne=r.attributeFilter;Dc=r.errorHandler;var oe=n({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},O),ae=!V||window.parent===window,le=!1;if(!ae)try{window.parent.document&&(le=!1)}catch(e){le=!0}if(ae&&!i)throw new Error("emit function is required");if(!ae&&!le)return()=>{};void 0!==B&&void 0===L.mousemove&&(L.mousemove=B),Lh.reset();var ue,de=!0===w?{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!==k?k:{password:!0},ce=dc(void 0!==C&&C);!function(e){void 0===e&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=[].forEach)}();var he,pe,_e=0,ge=new Map,ve=e=>{for(var t of ee||[])t.eventProcessor&&(e=t.eventProcessor(e));return M&&!le&&(e=M(e)),e};Ch=(e,t)=>{var r,n=e;if(n.timestamp=bc(),!(null===(r=zc[0])||void 0===r?void 0:r.isFrozen())||n.type===wu.FullSnapshot||n.type===wu.IncrementalSnapshot&&Ah.has(n.data.source)||zc.forEach(e=>e.unfreeze()),ae)null==i||i(ve(n),t);else if(le){var a={type:"rrweb",event:ve(n),origin:window.location.origin,isCheckout:t};window.parent.postMessage(a,"*")}if(n.type===wu.FullSnapshot)ue=n,_e=0;else if(n.type===wu.IncrementalSnapshot){if(n.data.source===ku.Mutation&&n.data.isAttachIframe)return;_e++,(o&&_e>=o||s&&n.timestamp-ue.timestamp>s)&&Eh(!0)}};var fe=e=>{if(e.removes&&e.removes.length>0){var t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,r=new Set;if(e.adds.length>0)for(var i of e.adds){var s=Lh.getNode(i.node.id);s&&"IFRAME"===s.nodeName&&r.add(s)}e.removes.forEach(e=>{var i=e.id;if(!t||!t.has(i)){var s=Se.getIframeElementById(i);s&&r.has(s)?Se.forgetIframeId(i):(null==he||he(i),Se.removeIframeById(i))}}),null==pe||pe(),Se.cleanupDetachedIframes()}Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Mutation},e)})},me=e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Scroll},e)}),ye=e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.CanvasMutation},e)}),be=new Ih({mutationCb:fe,adoptedStyleSheetCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.AdoptedStyleSheet},e)}),maskAllElementAttributes:I,maskAttributeFn:R}),Se=new sh({mirror:Lh,mutationCb:fe,stylesheetManager:be,recordCrossOriginIframes:V,wrappedEmit:Ch});for(var we of ee||[])we.getMirror&&we.getMirror({nodeMirror:Lh,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});var ke=new Rh,Ce=null==N?void 0:N.configured;xh=new Th({recordCanvas:W,mutationCb:ye,win:window,blockClass:l,blockSelector:d,mirror:Lh,sampling:L.canvas,dataURLOptions:oe,resolutionScale:D,canvasMasking:N});var Ee=new nh({mutationCb:fe,scrollCb:me,bypassOptions:{blockClass:l,blockSelector:d,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskInputOptions:de,dataURLOptions:oe,maskTextFn:x,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:R,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,sampling:L,slimDOMOptions:ce,iframeManager:Se,stylesheetManager:be,canvasManager:xh,keepIframeSrcFn:re,processedNodeManager:ke,attributeFilter:ne},mirror:Lh});Eh=function(e){if(void 0===e&&(e=!1),H){sd(S);try{Ch({type:wu.Meta,data:{href:window.location.href,width:kc(),height:wc()}},e),null==t||t.cancel(),t=void 0,be.reset(),Ee.init(),zc.forEach(e=>e.lock());var r,i=null;try{i=function(e,t){var r=t||{},i=r.mirror,s=void 0===i?new Rd:i,n=r.blockClass,o=void 0===n?"rr-block":n,a=r.blockSelector,l=void 0===a?null:a,u=r.maskTextClass,d=void 0===u?"rr-mask":u,c=r.maskTextSelector,h=void 0===c?null:c,p=r.inlineStylesheet,_=void 0===p||p,g=r.inlineImages,v=void 0!==g&&g,f=r.recordCanvas,m=void 0!==f&&f,y=r.canvasMaskingConfigured,b=r.maskAllInputs,S=void 0!==b&&b,w=r.maskTextFn,k=r.maskInputFn,C=r.maskAllElementAttributes,E=void 0!==C&&C,x=r.maskAttributeFn,T=r.slimDOM,I=r.dataURLOptions,R=r.preserveWhiteSpace,P=r.onSerialize,M=r.onIframeLoad,F=r.iframeLoadTimeout,L=r.onIframeListenerRegistered,A=r.onStylesheetLoad,O=r.stylesheetLoadTimeout,D=r.keepIframeSrcFn,N=void 0===D?()=>!1:D,B=r.maxDepth,q=r.inlineStylesheetBudgetRules,H=!0===S?{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===S?{password:!0}:S,U=dc(void 0!==T&&T);sd(q);try{return uc(e,{doc:e,mirror:s,blockClass:o,blockSelector:l,maskTextClass:d,maskTextSelector:h,skipChild:!1,inlineStylesheet:_,maskInputOptions:H,maskTextFn:w,maskInputFn:k,maskAllElementAttributes:E,maskAttributeFn:x,slimDOMOptions:U,dataURLOptions:I,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:R,onSerialize:P,onIframeLoad:M,iframeLoadTimeout:F,onIframeListenerRegistered:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:N,newlyAddedElement:!1,maxDepth:B})}finally{nd()}}(document,{mirror:Lh,blockClass:l,blockSelector:d,maskTextClass:v,maskTextSelector:m,inlineStylesheet:b,maskAllInputs:de,inlineStylesheetBudgetRules:S,maskTextFn:x,maskInputFn:E,maskAllElementAttributes:I,maskAttributeFn:R,slimDOM:ce,dataURLOptions:oe,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,onSerialize(e){Rc(e,Lh)&&Se.addIframe(e),Pc(e,Lh)&&be.trackLinkElement(e),Mc(e)&&Ee.addShadowRoot(Hu.shadowRoot(e),document)},onIframeLoad(e,t){Se.attachIframe(e,t),Ee.observeAttachShadow(e)},onIframeListenerRegistered(e,t){Se.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){be.attachLinkElement(e,t)},keepIframeSrcFn:re})}finally{n=Xu,Xu=[],r=n}if(!i)return console.warn("Failed to snapshot the document");if(Ch({type:wu.FullSnapshot,data:{node:i,initialOffset:Sc(window)}},e),zc.forEach(e=>e.unlock()),xh.onFullSnapshot(),r.length){var s=function(e,t,r){var i=!1,s=null,n=0,o=null,a=()=>null!==o||e.length>n,l=()=>{var r=e[n];e[n]=null,n+=1,r&&_c(()=>{o=t.beginDeferredLinkInlining(r,Lh.getId(r))})},u=()=>{if(o){var e=o,t=!0;_c(()=>{t=e.advance(200)}),t&&(o=null)}},d=()=>{o||l(),u()},c=e=>{if(s=null,!i){var t=0;do{try{d()}catch(e){null==o||o.discard(),o=null,hd(1)}t+=1}while(!i&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));i||(a()?s=Oh(c):r())}};return s=Oh(c),{cancel(){i=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(!i){i=!0,null==s||s.cancel(),s=null;for(var t=0,d=0;a()&&50>t;){o||l();var c=o;if(c)if(Math.floor(c.remainingRules()/200)+1>50-t)c.discard(),o=null,d+=1;else{try{u()}catch(e){null==o||o.discard(),o=null,d+=1}t+=1}}if(a()||d>0){for(var h=d+(null!==o?1:0),p=n;e.length>p;p++)null!==e[p]&&(h+=1);hd(h),null==o||o.discard(),o=null}r()}}}}(r,be,()=>{t===s&&(t=void 0)});t=s}V&&Se.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&be.adoptStyleSheets(document.adoptedStyleSheets,Lh.getId(document))}finally{nd()}var n}};try{var xe=[];for(var Te of(xe.push(hc("pagehide",()=>{try{null==t||t.flush()}catch(e){}t=void 0},window)),["visibilitychange","freeze","resume"]))xe.push(hc(Te,zu,document));he=e=>{var t=ge.get(e);t&&(t.forEach(e=>{_c(e);var t=xe.indexOf(e);-1!==t&&xe.splice(t,1)}),ge.delete(e))},pe=()=>{for(var e of ge){var t=e[0],r=Lh.getNode(t);if(r)try{r.contentDocument&&r.contentDocument.defaultView||null==he||he(t)}catch(e){null==he||he(t)}else null==he||he(t)}};var Ie=e=>{var t;return Wc(eh)({mutationCb:fe,mousemoveCb:(e,t)=>Ch({type:wu.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.MouseInteraction},e)}),scrollCb:me,viewportResizeCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.ViewportResize},e)}),inputCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Input},e)}),mediaInteractionCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.MediaInteraction},e)}),styleSheetRuleCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.StyleSheetRule},e)}),styleDeclarationCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.StyleDeclaration},e)}),canvasMutationCb:ye,fontCb:e=>Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Font},e)}),selectionCb(e){Ch({type:wu.IncrementalSnapshot,data:n({source:ku.Selection},e)})},customElementCb(e){Ch({type:wu.IncrementalSnapshot,data:n({source:ku.CustomElement},e)})},blockClass:l,ignoreClass:h,ignoreSelector:_,maskTextClass:v,maskTextSelector:m,maskInputOptions:de,inlineStylesheet:b,sampling:L,recordDOM:H,recordCanvas:W,canvasMaskingConfigured:Ce,inlineImages:X,userTriggeredOnInput:K,collectFonts:Y,doc:e,maskInputFn:E,maskTextFn:x,maskAllElementAttributes:I,maskAttributeFn:R,keepIframeSrcFn:re,blockSelector:d,slimDOMOptions:ce,dataURLOptions:oe,mirror:Lh,iframeManager:Se,stylesheetManager:be,shadowDomManager:Ee,processedNodeManager:ke,canvasManager:xh,ignoreCSSAttributes:se,attributeFilter:ne,plugins:(null==ee||null===(t=ee.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Ch({type:wu.Plugin,data:{plugin:e.name,payload:t}})})))||[]},P)};Se.addLoadListener(e=>{try{var t=Lh.getId(e),r=Ie(e.contentDocument);if("function"==typeof r&&(xe.push(r),-1!==t)){var i=ge.get(t);i||ge.set(t,i=new Set),i.add(r)}}catch(e){console.warn(e)}}),Se.addPageHideListener(e=>{var t=Lh.getId(e);null==he||he(t),Qc(e)});var Re=-1,Pe=e=>Ch({type:wu.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),Me=()=>{var e,t,r,i,s=document,n=null!==(e=null!==(t=null!==(r=null!==(i=s.fullscreenElement)&&void 0!==i?i:s.webkitFullscreenElement)&&void 0!==r?r:s.mozFullScreenElement)&&void 0!==t?t:s.msFullscreenElement)&&void 0!==e?e:null,o=n?Lh.getId(n):-1;o!==Re&&(-1!==Re&&Pe({id:Re,enter:!1}),Re=o,-1!==o&&Pe({id:o,enter:!0}))},Fe=()=>{Eh();var e=Ie(document);"function"==typeof e&&xe.push(e),xe.push(hc("fullscreenchange",Me)),xe.push(hc("webkitfullscreenchange",Me)),xe.push(hc("mozfullscreenchange",Me)),xe.push(hc("MSFullscreenChange",Me)),Ph=!0};return["interactive","complete"].includes(document.readyState)?Fe():(xe.push(hc("DOMContentLoaded",()=>{Ch({type:wu.DomContentLoaded,data:{}}),"DOMContentLoaded"===G&&Fe()})),xe.push(hc("load",()=>{Ch({type:wu.Load,data:{}}),"load"===G&&Fe()},window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,gc(xe),ke.destroy(),Se.removeLoadListener(),Se.destroy(),ge.clear(),Ee.reset(),Lh.reset(),Ph=!1,Dc=void 0}}catch(e){console.warn(e)}}Dh.addCustomEvent=(e,t)=>{if(!Ph)throw new Error("please add custom event after start recording");Ch({type:wu.Custom,data:{tag:e,payload:t}})},Dh.freezePage=()=>{zc.forEach(e=>e.freeze())},Dh.takeFullSnapshot=e=>{if(!Ph)throw new Error("please take full snapshot after start recording");Eh(e)},Dh.mirror=Lh,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var Nh=Object.create(null);function Bh(e){return Bh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bh(e)}function $h(e,t,r){return(t=function(e){var t=function(e){if("object"!=Bh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Bh(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Bh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Nh.Node=Object.create(null),Nh.ShadowRoot=Object.create(null),Nh.MutationObserver=Object.create(null),Nh.Element=Object.create(null);var qh=class{constructor(e){$h(this,"fileName",void 0),$h(this,"functionName",void 0),$h(this,"lineNumber",void 0),$h(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+e+":"+t+")":this.fileName+":"+e+":"+t}},Hh=/(^|@)\S+:\d+/,Uh=/^\s*at .*(\S+:\d+|\(native\))/m,Wh=/^(eval@)?(\[native code])?$/,zh={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Uh)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: "+e);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE(e){return e.stack.split("\n").filter(function(e){return!!e.match(Uh)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),r=t.match(/ (\((.+):(\d+):(\d+)\)$)/),i=(t=r?t.replace(r[0],""):t).split(/\s+/).slice(1),s=this.extractLocation(r?r[1]:i.pop());return new qh({functionName:i.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(Wh)},this).map(function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new qh({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,r=e.match(t),i=r&&r[1]?r[1]:void 0,s=this.extractLocation(e.replace(t,""));return new qh({functionName:i,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseOpera(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split("\n"),i=[],s=2,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new qh({fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera10(e){for(var t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split("\n"),i=[],s=0,n=r.length;n>s;s+=2){var o=t.exec(r[s]);o&&i.push(new qh({functionName:o[3]||void 0,fileName:o[2],lineNumber:parseFloat(o[1])}))}return i},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(Hh)&&!e.match(/^Error created at/)},this).map(function(e){var t=e.split("@"),r=this.extractLocation(t.pop());return new qh({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})},this)}};function Vh(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var r=e.localName;if(!r)break;r=r.toLowerCase();var i=e.parentElement,s=[];if(i.children&&i.children.length>0)for(var n=0;i.children.length>n;n++){var o=i.children[n];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===r&&s.push(o)}s.length>1&&(r+=":eq("+s.indexOf(e)+")"),t=r+(t?">"+t:""),e=i}return t}function jh(e){return Array.isArray(e)}function Gh(e){return"object"==typeof e&&null!==e&&!jh(e)}function Qh(e,t){if(0===t)return!0;for(var r of Object.keys(e))if(Gh(e[r])&&Qh(e[r],t-1))return!0;return!1}function Kh(e,t){var r={numOfKeysLimit:50,depthOfLimit:4};Object.assign(r,t);var i=[],s=[];return JSON.stringify(e,function(e,t){if(i.length>0){var n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?s.splice(n,1/0,e):s.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+s.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(Gh(o=t)&&Object.keys(o).length>r.numOfKeysLimit||"function"==typeof o||Gh(o)&&Qh(o,r.depthOfLimit))return function(e){var t=e.toString();return r.stringLengthLimit&&t.length>r.stringLengthLimit&&(t=t.slice(0,r.stringLengthLimit)+"..."),t}(t);var o;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){var a={};for(var l in t){var u=t[l];a[l]=jh(u)?Vh(u.length?u[0]:null):u}return a}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t})}var Zh={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 Yh(e,t,r){var i,s=r?Object.assign({},Zh,r):Zh,n=s.logger;if(!n)return()=>{};i="string"==typeof n?t[n]:n;var o=0,a=!1,l=[];if(s.level.includes("error")){var u=t=>{var r=t.message;e({level:"error",trace:zh.parse(t.error).map(e=>e.toString()),payload:[Kh(r,s.stringifyOptions)]})};t.addEventListener("error",u),l.push(()=>{t.removeEventListener("error",u)});var d=t=>{var r,i;t.reason instanceof Error?i=[Kh("Uncaught (in promise) "+(r=t.reason).name+": "+r.message,s.stringifyOptions)]:(r=new Error,i=[Kh("Uncaught (in promise)",s.stringifyOptions),Kh(t.reason,s.stringifyOptions)]),e({level:"error",trace:zh.parse(r).map(e=>e.toString()),payload:i})};t.addEventListener("unhandledrejection",d),l.push(()=>{t.removeEventListener("unhandledrejection",d)})}for(var c of s.level)l.push(h(i,c));return()=>{l.forEach(e=>e())};function h(t,r){var i=this;return t[r]?function(t,n){try{if(!(n in t))return()=>{};var l=t[n],u={next:l},d=(t=>function(){for(var n=arguments.length,l=new Array(n),u=0;n>u;u++)l[u]=arguments[u];if(t.apply(i,l),!("assert"===r&&l[0]||a)){a=!0;try{var d=zh.parse(new Error).map(e=>e.toString()).splice(1),c=("assert"===r?l.slice(1):l).map(e=>Kh(e,s.stringifyOptions));o++,s.lengthThreshold>o?e({level:r,trace:d,payload:c}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[Kh("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...l)}finally{a=!1}}})(function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return u.next.apply(this,t)});return"function"==typeof d&&(d.prototype=d.prototype||{},Object.defineProperties(d,{__rrweb_original__:{enumerable:!1,value:l},__rrweb_layer__:{enumerable:!1,value:u}})),t[n]=d,()=>{if(t[n]!==d)for(var e=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0},r=t[n],i=e(r);i;){if(i.next===d)return void(i.next=u.next);i=e(r=i.next)}else t[n]=u.next}}catch(e){return()=>{}}}(t,r):()=>{}}}var Jh=e=>({name:"rrweb/console@1",observer:Yh,options:e}),Xh=()=>{},ep=e=>{var t;if(xt(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function tp(e,t,r){try{if(!(t in e))return Xh;var i={next:e[t]},s=r(function(){for(var e=arguments.length,t=new Array(e),r=0;e>r;r++)t[r]=arguments[r];return i.next.apply(this,t)});return xt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=s,()=>{if(e[t]!==s)for(var r=e[t],n=ep(r);n;){if(n.next===s)return void(n.next=i.next);n=ep(r=n.next)}else e[t]=i.next}}catch(e){return Xh}}function rp(e,t){var r,i=function(e){try{return"string"==typeof e?new URL(e).hostname:"url"in e?new URL(e.url).hostname:e.hostname}catch(e){return null}}(e),s={hostname:i,isHostDenied:!1};if(null==(r=t.payloadHostDenyList)||!r.length||null==i||!i.trim().length)return s;for(var n of t.payloadHostDenyList)if(i.endsWith(n))return{hostname:i,isHostDenied:!0};return s}var ip=Fs("[Recorder]"),sp=e=>"navigation"===e.entryType,np=e=>"resource"===e.entryType;function op(e,t){return!!t&&(Dt(t)||t[e])}function ap(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}var lp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function up(e){var t=e.type,r=e.recordBody,i=e.headers;function s(e){var t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),r=t&&i[t];return e.some(e=>null==r?void 0:r.toLowerCase().includes(e))}if(!r)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!ap(t)&&e(t.url)}catch(e){return!1}}(e.url))return!1;if(s(lp))return!1;if(Dt(r))return!0;if(Et(r))return s(r);var n=r[t];return Dt(n)?n:s(n)}function dp(e,t,r,i,s,n){return cp.apply(this,arguments)}function cp(){return cp=a(function*(e,t,r,i,s,n){return void 0===n&&(n=0),n>10?(ip.warn("Failed to get performance entry for request",{url:r,initiatorType:t}),null):function(e,t){for(var r=e.length-1;r>=0;r-=1)if(t(e[r]))return e[r]}(e.performance.getEntriesByName(r),e=>np(e)&&e.initiatorType===t&&(Rt(i)||e.startTime>=i)&&(Rt(s)||s>=e.startTime))||(yield new Promise(e=>setTimeout(e,50*n)),dp(e,t,r,i,s,n+1))}),cp.apply(this,arguments)}function hp(e){var t=e.body,r=e.options,i=e.url;if(Lt(t))return null;var s=rp(i,r);if(s.isHostDenied)return s.hostname+" is in deny list";if(Pt(t))return t;if((e=>"u">typeof Document&&e instanceof Document)(t))return t.textContent;if(Nt(t))return Qs(t);if(Tt(t))try{return JSON.stringify(t)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}var pp=e=>!Ft(e)&&("navigation"===e.entryType||"resource"===e.entryType);function _p(e){var t=e.entry,r=e.method,i=e.status,s=e.networkRequest,o=e.isInitial,a=e.start,l=e.end,u=e.url,d=e.initiatorType;a=t?t.startTime:a,l=t?t.responseEnd:l;var c=Math.floor(Date.now()-performance.now()),h=Math.floor(c+(a||0)),p=[n({},t?t.toJSON():{name:u},{startTime:Rt(a)?void 0:Math.round(a),endTime:Rt(l)?void 0:Math.round(l),timeOrigin:c,timestamp:h,method:r,initiatorType:d||(t?t.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:o})];if(pp(t))for(var _ of t.serverTiming||[])p.push({timeOrigin:c,timestamp:h,startTime:Math.round(t.startTime),name:_.name,duration:_.duration,entryType:"serverTiming"});return p}var gp=["video/","audio/"];function vp(e){return Tt(e)&&xt(e.getReader)&&xt(e.tee)}var fp="[SessionReplay] Timeout while trying to read body",mp="[SessionReplay] Failed to read body";function yp(e){return mp+": "+e}function bp(e){return"[SessionReplay] Body too large to record (> "+e+" bytes)"}function Sp(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{var r=setTimeout(()=>t(fp),500);try{e.clone().text().then(e=>t(e),e=>t(yp(e))).finally(()=>clearTimeout(r))}catch(e){clearTimeout(r),t(mp)}})}(e);var r=Wn(t);return function(e,t){try{var r,i=null==(r=e.headers)||null==r.get?void 0:r.get("content-length");if(!i)return!1;var s=parseInt(i,10);return Number.isFinite(s)&&s>t}catch(e){return!1}}(e,r)?Promise.resolve(bp(r)):function(e,t){return new Promise(r=>{var i,s=!1;function n(){try{var e;null==(e=i)||e.cancel().catch(()=>{})}catch(e){}}function o(e){s||(s=!0,clearTimeout(l),n(),r(e))}var a,l=setTimeout(()=>o(fp),500);try{a=e.clone()}catch(e){return void o(mp)}var u=a.body;if(vp(u)&&"undefined"!=typeof TextDecoder){try{i=u.getReader()}catch(e){return void o(mp)}var d=[],c=0;!function e(){i.read().then(r=>{var i=r.done,a=r.value;if(s)n();else if(i)o((new TextDecoder).decode(function(e,t){var r=new Uint8Array(t),i=0;for(var s of e)r.set(s,i),i+=s.byteLength;return r}(d,c)));else{if(a){if(c+a.byteLength>t)return void o(bp(t));c+=a.byteLength,d.push(a)}e()}},e=>o(yp(e)))}()}else try{a.text().then(e=>o(e),e=>o(yp(e)))}catch(e){o(mp)}})}(e,r)}function wp(){return wp=a(function*(e){var t=e.r,r=e.options,i=rp(e.url,r);return i.isHostDenied?Promise.resolve(i.hostname+" is in deny list"):Sp(t,r)}),wp.apply(this,arguments)}function kp(){return kp=a(function*(e){var t=e.r,r=e.options,i=function(e){var t,r=e.r,i=e.options,s=e.url;if("chunked"===r.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";var n=null==(t=r.headers.get("Content-Type"))?void 0:t.toLowerCase(),o=gp.some(e=>null==n?void 0:n.startsWith(e));if(n&&o)return"Content-Type "+n+" is not supported";var a=rp(s,i);return a.isHostDenied?a.hostname+" is in deny list":null}({r:t,options:r,url:e.url});return Ft(i)?Sp(t,r):Promise.resolve(i)}),kp.apply(this,arguments)}var Cp=null;function Ep(e,t,r){if(!("performance"in t))return()=>{};if(Cp)return ip.warn("Network observer already initialised, doing nothing"),()=>{};var i=r?Object.assign({},zn,r):zn,s=t=>{var r=[],s=!1;t.requests.forEach(e=>{var t="serverTiming"===e.entryType;if(!t||!s){var n=i.maskRequestFn(e);t||(s=!n||(e=>!!e&&Jn.has(e))(n)),n&&r.push(n)}}),r.length>0&&e(n({},t,{requests:r}))},o=function(e,t,r){r.recordInitialRequests&&e({requests:t.performance.getEntries().filter(e=>sp(e)||np(e)&&r.initiatorTypes.includes(e.initiatorType)).flatMap(e=>_p({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});var i=new t.PerformanceObserver(t=>{e({requests:t.getEntries().filter(e=>sp(e)||np(e)&&r.initiatorTypes.includes(e.initiatorType)&&(e=>!r.recordBody&&!r.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>_p({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),s=PerformanceObserver.supportedEntryTypes.filter(e=>r.performanceEntryTypeToObserve.includes(e));return i.observe({entryTypes:s}),()=>{i.disconnect()}}(s,t,i),l=()=>{},u=()=>{};return(i.recordHeaders||i.recordBody)&&(l=function(e,t,r){if(!r.initiatorTypes.includes("xmlhttprequest"))return()=>{};var i=op("request",r.recordHeaders),s=op("response",r.recordHeaders),n=tp(t.XMLHttpRequest.prototype,"open",n=>function(o,a,l,u,d){void 0===l&&(l=!0);var c=this;try{var h,p,_=new Request(a),g={},v={},f=c.setRequestHeader.bind(c);c.setRequestHeader=(e,t)=>(v[e]=t,f(e,t)),i&&(g.requestHeaders=v);var m=c.send.bind(c);c.send=e=>(up({type:"request",headers:v,url:a,recordBody:r.recordBody})&&(g.requestBody=hp({body:e,options:r,url:a})),h=t.performance.now(),m(e));var y=()=>{c.removeEventListener("readystatechange",b),c.removeEventListener("error",y),c.removeEventListener("abort",y),c.removeEventListener("timeout",y)},b=()=>{if(c.readyState===c.DONE){y(),p=t.performance.now();var i={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{var t=e.split(": "),r=t.shift(),s=t.join(": ");r&&(i[r]=s)}),s&&(g.responseHeaders=i),up({type:"response",headers:i,url:a,recordBody:r.recordBody})&&(g.responseBody=hp({body:c.response,options:r,url:a})),dp(t,"xmlhttprequest",_.url,h,p).then(t=>{e({requests:_p({entry:t,method:o,status:null==c?void 0:c.status,networkRequest:g,start:h,end:p,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})}};c.addEventListener("readystatechange",b),c.addEventListener("error",y),c.addEventListener("abort",y),c.addEventListener("timeout",y)}catch(e){ip.error("Failed to instrument XHR for network capture",e)}n.call(c,o,a.toString(),l,u,d)});return()=>{n()}}(s,t,i),u=function(e,t,r){if(!r.initiatorTypes.includes("fetch"))return()=>{};var i=op("request",r.recordHeaders),s=op("response",r.recordHeaders),n=tp(t,"fetch",n=>function(){var o=a(function*(o,a){var l,u;try{l=new Request(o,a)}catch(e){return ip.error("Failed to instrument fetch for network capture",e),n(o,a)}var d,c,h={};try{try{var p={};l.headers.forEach((e,t)=>{p[t]=e}),i&&(h.requestHeaders=p),!vp(null==a?void 0:a.body)&&up({type:"request",headers:p,url:o,recordBody:r.recordBody})&&(h.requestBody=yield function(e){return wp.apply(this,arguments)}({r:l,options:r,url:o}))}catch(e){ip.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),u=ap(o)?yield n(l):yield n(o,a),c=t.performance.now();try{var _={};u.headers.forEach((e,t)=>{_[t]=e}),s&&(h.responseHeaders=_),up({type:"response",headers:_,url:o,recordBody:r.recordBody})&&(h.responseBody=yield function(e){return kp.apply(this,arguments)}({r:u,options:r,url:o}))}catch(e){ip.error("Failed to record fetch response for network capture",e)}return u}finally{dp(t,"fetch",l.url,d,c).then(t=>{var r;e({requests:_p({entry:t,method:l.method,status:null==(r=u)?void 0:r.status,networkRequest:h,start:d,end:c,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{n()}}(s,t,i)),Cp=()=>{o(),l(),u(),Cp=null}}var xp,Tp,Ip,Rp,Pp,Mp,Fp,Lp,Ap,Op,Dp,Np,Bp,$p,qp,Hp=e=>({name:"rrweb/network@1",observer:Ep,options:e});b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:Jh,getRecordNetworkPlugin:Hp},b.__PosthogExtensions__.rrweb={record:Dh,version:"v2",wasMaxDepthReached:()=>lc,resetMaxDepthState(){lc=!1,ac=!1},getLastSnapshotCost:()=>Yu,getMutationCost:()=>n({},rd),resetSnapshotCostState(){Gu=0,Qu=0,Ku=0,Wu=0,Zu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},Yu=null,Ju=null,Xu=[],ed=0,td=0,rd={slowestBatchMs:0},id={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},b.rrweb={record:Dh,version:"v2"},b.rrwebConsoleRecord={getRecordConsolePlugin:Jh},b.getRecordNetworkPlugin=Hp,b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.initSessionRecording=(e,t)=>new Su(e,t);var Up,Wp,zp,Vp,jp={},Gp=[],Qp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Kp=Array.isArray;function Zp(e,t){for(var r in t)e[r]=t[r];return e}function Yp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Jp(e,t,r){var i,s,n,o={};for(n in t)"key"==n?i=t[n]:"ref"==n?s=t[n]:o[n]=t[n];if(arguments.length>2&&(o.children=arguments.length>3?xp.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(n in e.defaultProps)void 0===o[n]&&(o[n]=e.defaultProps[n]);return Xp(e,o,i,s,null)}function Xp(e,t,r,i,s){var n={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++Ip:s,__i:-1,__u:0};return null==s&&null!=Tp.vnode&&Tp.vnode(n),n}function e_(e){return e.children}function t_(e,t){this.props=e,this.context=t}function r_(e,t){if(null==t)return e.__?r_(e.__,e.__i+1):null;for(var r;e.__k.length>t;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?r_(e):null}function i_(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,i=[],s=[],n=Zp({},t);n.__v=t.__v+1,Tp.vnode&&Tp.vnode(n),p_(e.__P,n,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,i,null==r?r_(t):r,!!(32&t.__u),s),n.__v=t.__v,n.__.__k[n.__i]=n,g_(i,n,s),t.__e=t.__=null,n.__e!=r&&s_(n)}}function s_(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),s_(e)}function n_(e){(!e.__d&&(e.__d=!0)&&Rp.push(e)&&!o_.__r++||Pp!=Tp.debounceRendering)&&((Pp=Tp.debounceRendering)||Mp)(o_)}function o_(){try{for(var e,t=1;Rp.length;)Rp.length>t&&Rp.sort(Fp),e=Rp.shift(),t=Rp.length,i_(e)}finally{Rp.length=o_.__r=0}}function a_(e,t,r,i,s,n,o,a,l,u,d){var c,h,p,_,g,v,f,m=i&&i.__k||Gp,y=t.length;for(l=function(e,t,r,i,s){var n,o,a,l,u,d=r.length,c=d,h=0;for(e.__k=new Array(s),n=0;s>n;n++)null!=(o=t[n])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[n]=Xp(null,o,null,null,null):Kp(o)?o=e.__k[n]=Xp(e_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[n]=Xp(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[n]=o,l=n+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(u=o.__i=u_(o,r,l,c))&&(c--,(a=r[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>d?h--:d>s&&h++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?h--:u==l+1?h++:(u>l?h--:h++,o.__u|=4))):e.__k[n]=null;if(c)for(n=0;d>n;n++)null!=(a=r[n])&&!(2&a.__u)&&(a.__e==i&&(i=r_(a)),m_(a,a));return i}(r,t,m,l,y),c=0;y>c;c++)null!=(p=r.__k[c])&&(h=-1!=p.__i&&m[p.__i]||jp,p.__i=c,v=p_(e,p,h,s,n,o,a,l,u,d),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&f_(h.ref,null,p),d.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(f=!!(4&p.__u))||h.__k===p.__k?(l=l_(p,l,e,f),f&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==v?l=v:_&&(l=_.nextSibling),p.__u&=-7);return r.__e=g,l}function l_(e,t,r,i){var s,n;if("function"==typeof e.type){for(s=e.__k,n=0;s&&s.length>n;n++)s[n]&&(s[n].__=e,t=l_(s[n],t,r,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=r_(e)),r.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function u_(e,t,r,i){var s,n,o,a=e.key,l=e.type,u=t[r],d=null!=u&&!(2&u.__u);if(null===u&&null==a||d&&a==u.key&&l==u.type)return r;if(i>(d?1:0))for(s=r-1,n=r+1;s>=0||t.length>n;)if(null!=(u=t[o=0>s?n++:s--])&&!(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function d_(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||Qp.test(t)?r:r+"px"}function c_(e,t,r,i,s){var n,o;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)r&&t in r||d_(e.style,t,"");if(r)for(t in r)i&&r[t]==i[t]||d_(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])n=t!=(t=t.replace(Dp,"$1")),o=t.toLowerCase(),t=o in e||"onFocusOut"==t||"onFocusIn"==t?o.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+n]=r,r?i?r[Op]=i[Op]:(r[Op]=Np,e.addEventListener(t,n?$p:Bp,n)):e.removeEventListener(t,n?$p:Bp,n);else{if("http://www.w3.org/2000/svg"==s)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function h_(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[Ap])t[Ap]=Np++;else if(r[Op]>t[Ap])return;return r(Tp.event?Tp.event(t):t)}}}function p_(e,t,r,i,s,n,o,a,l,u){var d,c,h,p,_,g,v,f,m,y,$,b,S,w,k,C,E=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),n=[a=t.__e=r.__e]),(d=Tp.__b)&&d(t);e:if("function"==typeof E){c=o.length;try{if(m=t.props,y=E.prototype&&E.prototype.render,$=(d=E.contextType)&&i[d.__c],b=d?$?$.props.value:d.__:i,r.__c?f=(h=t.__c=r.__c).__=h.__E:(y?t.__c=h=new E(m,b):(t.__c=h=new t_(m,b),h.constructor=E,h.render=y_),$&&$.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),y&&null==h.__s&&(h.__s=h.state),y&&null!=E.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=Zp({},h.__s)),Zp(h.__s,E.getDerivedStateFromProps(m,h.__s))),_=h.props,g=h.state,h.__v=t,p)y&&null==E.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),y&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(y&&null==E.getDerivedStateFromProps&&m!==_&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,b),t.__v==r.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=r.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),Gp.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&o.push(h);break e}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,b),y&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(_,g,v)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=Tp.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),d=h.render(h.props,h.state,h.context),Gp.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),d=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(i=Zp(Zp({},i),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(_,g)),k=null!=d&&d.type===e_&&null==d.key?v_(d.props.children):d,a=a_(e,Kp(k)?k:[k],t,r,i,s,n,o,a,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),f&&(h.__E=h.__=null)}catch(e){if(o.length=c,t.__v=null,l||null!=n)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=n&&(n[n.indexOf(a)]=null),t.__e=a}else{if(null!=n)for(C=n.length;C--;)Yp(n[C]);__(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||__(t);Tp.__e(e,t,r)}}else null==n&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=function(e,t,r,i,s,n,o,a,l){var u,d,c,h,p,_,g,v=r.props||jp,f=t.props,m=t.type;if("svg"==m?s="http://www.w3.org/2000/svg":"math"==m?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=n)for(u=0;n.length>u;u++)if((p=n[u])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,n[u]=null;break}if(null==e){if(null==m)return document.createTextNode(f);e=document.createElementNS(s,m,f.is&&f),a&&(Tp.__m&&Tp.__m(t,n),a=!1),n=null}if(null==m)v===f||a&&e.data==f||(e.data=f);else{if(n="textarea"==m&&null!=f.defaultValue?null:n&&xp.call(e.childNodes),!a&&null!=n)for(v={},u=0;e.attributes.length>u;u++)v[(p=e.attributes[u]).name]=p.value;for(u in v)p=v[u],"dangerouslySetInnerHTML"==u?c=p:"children"==u||u in f||"value"==u&&"defaultValue"in f||"checked"==u&&"defaultChecked"in f||c_(e,u,null,p,s);for(u in f)p=f[u],"children"==u?h=p:"dangerouslySetInnerHTML"==u?d=p:"value"==u?_=p:"checked"==u?g=p:a&&"function"!=typeof p||v[u]===p||c_(e,u,p,v[u],s);if(d)a||c&&(d.__html==c.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),a_("template"==t.type?e.content:e,Kp(h)?h:[h],t,r,i,"foreignObject"==m?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:r.__k&&r_(r,0),a,l),null!=n)for(u=n.length;u--;)Yp(n[u]);a&&"textarea"!=m||(u="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[u]||"progress"==m&&!_||"option"==m&&_!=v[u])&&c_(e,u,_,v[u],s),u="checked",null!=g&&g!=e[u]&&c_(e,u,g,v[u],s))}return e}(r.__e,t,r,i,s,n,o,l,u);return(d=Tp.diffed)&&d(t),128&t.__u?void 0:a}function __(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(__))}function g_(e,t,r){for(var i=0;r.length>i;i++)f_(r[i],r[++i],r[++i]);Tp.__c&&Tp.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Tp.__e(e,t.__v)}})}function v_(e){return"object"!=typeof e||null==e||e.__b>0?e:Kp(e)?e.map(v_):void 0!==e.constructor?null:Zp({},e)}function f_(e,t,r){try{if("function"==typeof e){var i="function"==typeof e.__u;i&&e.__u(),i&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Tp.__e(e,r)}}function m_(e,t,r){var i,s;if(Tp.unmount&&Tp.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||f_(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Tp.__e(e,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(s=0;i.length>s;s++)i[s]&&m_(i[s],t,r||"function"!=typeof e.type);r||Yp(e.__e),e.__c=e.__=e.__e=void 0}function y_(e,t,r){return this.constructor(e,r)}function b_(e,t,r){var i,s,n,o;t==document&&(t=document.documentElement),Tp.__&&Tp.__(e,t),s=(i="function"==typeof r)?null:r&&r.__k||t.__k,n=[],o=[],p_(t,e=(!i&&r||t).__k=Jp(e_,null,[e]),s||jp,jp,t.namespaceURI,!i&&r?[r]:s?null:t.firstChild?xp.call(t.childNodes):null,n,!i&&r?r:s?s.__e:t.firstChild,i,o),g_(n,e,o),e.props.children=null}xp=Gp.slice,Tp={__e(e,t,r,i){for(var s,n,o;t=t.__;)if((s=t.__c)&&!s.__)try{if((n=s.constructor)&&null!=n.getDerivedStateFromError&&(s.setState(n.getDerivedStateFromError(e)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(e,i||{}),o=s.__d),o)return s.__E=s}catch(t){e=t}throw e}},Ip=0,t_.prototype.setState=function(e,t){var r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=Zp({},this.state);"function"==typeof e&&(e=e(Zp({},r),this.props)),e&&Zp(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),n_(this))},t_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),n_(this))},t_.prototype.render=e_,Rp=[],Mp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Fp=function(e,t){return e.__v.__b-t.__v.__b},o_.__r=0,Lp=Math.random().toString(8),Ap="__d"+Lp,Op="__a"+Lp,Dp=/(PointerCapture)$|Capture$/i,Np=0,Bp=h_(!1),$p=h_(!0),qp=0;var S_=0,w_=[],k_=Tp,C_=k_.__b,E_=k_.__r,x_=k_.diffed,T_=k_.__c,I_=k_.unmount,R_=k_.__;function P_(e,t){k_.__h&&k_.__h(Wp,e,S_||t),S_=0;var r=Wp.__H||(Wp.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function M_(e){return S_=1,function(e,t){var r=P_(Up++,2);if(r.t=e,!r.__c&&(r.__=[U_(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],i=r.t(t,e);t!==i&&(r.__N=[i,r.__[1]],r.__c.setState({}))}],r.__c=Wp,!Wp.__f)){var i=function(e,t,i){if(!r.__c.__H)return!0;var n=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){n=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),s){var a=s.call(this,e,t,i);return n?a||o:a}return!n||o};Wp.__f=!0;var s=Wp.shouldComponentUpdate,n=Wp.componentWillUpdate;Wp.componentWillUpdate=function(e,t,r){if(this.__e){var o=s;s=void 0,i(e,t,r),s=o}n&&n.call(this,e,t,r)},Wp.shouldComponentUpdate=i}return r.__N||r.__}(U_,e)}function F_(e,t){var r=P_(Up++,3);!k_.__s&&H_(r.__H,t)&&(r.__=e,r.u=t,Wp.__H.__h.push(r))}function L_(e){return S_=5,A_(function(){return{current:e}},[])}function A_(e,t){var r=P_(Up++,7);return H_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function O_(e){var t,r=Wp.context[e.__c],i=P_(Up++,9);return i.c=e,r?(null!==(t=i.__)&&void 0!==t||(i.__=!0,r.sub(Wp)),r.props.value):e.__}function D_(){for(var e;e=w_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some($_),t.__h.some(q_),t.__h=[]}catch(r){t.__h=[],k_.__e(r,e.__v)}}}k_.__b=function(e){Wp=null,C_&&C_(e)},k_.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),R_&&R_(e,t)},k_.__r=function(e){E_&&E_(e),Up=0;var t=(Wp=e.__c).__H;t&&(zp===Wp?(t.__h=[],Wp.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&D_(),Up=0)),zp=Wp},k_.diffed=function(e){x_&&x_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==w_.push(t)&&Vp===k_.requestAnimationFrame||((Vp=k_.requestAnimationFrame)||B_)(D_)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),zp=Wp=null},k_.__c=function(e,t){t.some(function(e){try{e.__h.some($_),e.__h=e.__h.filter(function(e){return!e.__||q_(e)})}catch(r){t.some(function(e){e.__h&&(e.__h=[])}),t=[],k_.__e(r,e.__v)}}),T_&&T_(e,t)},k_.unmount=function(e){I_&&I_(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some(function(e){try{$_(e)}catch(e){t=e}}),r.__H=void 0,t&&k_.__e(t,r.__v))};var N_="function"==typeof requestAnimationFrame;function B_(e){var t,r=function(){clearTimeout(i),N_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,35);N_&&(t=requestAnimationFrame(r))}function $_(e){var t=Wp,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),Wp=t}function q_(e){var t=Wp;e.__c=e.__(),Wp=t}function H_(e,t){return!e||e.length!==t.length||t.some(function(t,r){return t!==e[r]})}function U_(e,t){return"function"==typeof t?t(e):t}var W_={GZipJS:"gzip-js",Base64:"base64"},z_={Activation:"events",Cancellation:"cancelEvents"},V_={Button:"button",Tab:"tab",Selector:"selector"},j_={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},G_={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Q_={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},K_={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Z_={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Y_={Once:"once",Recurring:"recurring",Always:"always"},J_={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},X_={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},eg={Popover:"popover",Inline:"inline"};function tg(e){var t=!0;return{dispose(){if(t){t=!1;var r=e();r&&xt(r.then)&&r.then(void 0,()=>{})}}}}var rg=Fs("[Surveys]");function ig(e){return!(!e.start_date||e.end_date)}function sg(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}var ng=(e,t)=>""+e+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t),og=e=>ng("seenSurvey_",e),ag=e=>{try{var t=og(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){rg.error("Failed to persist survey seen state",e)}},lg=[Q_.Popover,Q_.Widget,Q_.API],ug={ignoreConditions:!1,ignoreDelay:!1,displayType:eg.Popover},dg="logs",cg=Fs("[Stylesheet Loader]"),hg=l,pg=c,_g="#020617",gg={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:j_.Right,widgetType:V_.Tab,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:_g,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},vg=[j_.Center,j_.Left,j_.Right];function fg(e){if(e.startsWith("#")){var t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?"rgb("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+")":"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function mg(e){var t;void 0===e&&(e=gg.backgroundColor),"#"===e[0]&&(t=fg(e)),e.startsWith("rgb")&&(t=e);var r={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"}[e.toLowerCase()];if(r&&(t=fg(r)),!t)return _g;var i=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(i){var s=parseInt(i[1]),n=parseInt(i[2]),o=parseInt(i[3]);return Math.sqrt(s*s*.299+n*n*.587+o*o*.114)>127.5?_g:"white"}return _g}var yg=(e,t,r)=>{var i=Bg(e),s=pg.querySelector("."+i);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};var o=pg.createElement("div");((e,t,r)=>{var i=n({},gg,r),s=e.style,o=!vg.includes(i.position)||t===Q_.Widget&&(null==r?void 0:r.widgetType)===V_.Tab;s.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";var t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?e+", "+t:"-apple-system, "+t}(i.fontFamily)),s.setProperty("--ph-survey-box-padding",i.boxPadding),s.setProperty("--ph-survey-max-width",i.maxWidth),s.setProperty("--ph-survey-z-index",i.zIndex),s.setProperty("--ph-survey-border-color",i.borderColor),o?(s.setProperty("--ph-survey-border-radius",i.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",i.borderRadius+" "+i.borderRadius+" 0 0")),s.setProperty("--ph-survey-background-color",i.backgroundColor),s.setProperty("--ph-survey-box-shadow",i.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",i.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",i.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==r?void 0:r.submitButtonTextColor)||mg(i.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",i.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",i.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",mg(i.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==r?void 0:r.textColor)||mg(i.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",i.textSubtleColor),s.setProperty("--ph-widget-color",i.widgetColor),s.setProperty("--ph-widget-text-color",mg(i.widgetColor)),s.setProperty("--ph-widget-z-index",i.zIndex);var a=(null==r?void 0:r.inputBackground)||(null==r?void 0:r.inputBackgroundColor),l=a||i.inputBackground;a||"white"!==i.backgroundColor||(l="#f8f8f8"),s.setProperty("--ph-survey-input-background",l);var u=(null==r?void 0:r.inputTextColor)||mg(l);s.setProperty("--ph-survey-input-text-color",u),s.setProperty("--ph-survey-rating-text-color",u),s.setProperty("--ph-survey-scrollbar-thumb-color",i.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",i.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",i.outlineColor)})(o,e.type,e.appearance),o.className=i;var a=o.attachShadow({mode:"open"}),l=function(e){var t=((e,t,r)=>{var i=e.createElement("style");i.innerText=t;var s=(e=>{var t;return xt(e)?e:null==e||null==(t=e.config)?void 0:t.prepare_external_dependency_stylesheet})(r);return s&&(i=s(i)),i||(cg.error("prepare_external_dependency_stylesheet returned null"),null)})(pg,':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)}}',e);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(l){var u=a.querySelector("style");u&&a.removeChild(u),a.appendChild(l)}return(r||pg.body).appendChild(o),{shadow:a,isNewlyCreated:!0}},bg=e=>{var t=e.responses,r=e.survey,i=e.surveySubmissionId,s=e.posthog,o=e.isSurveyCompleted,a=e.properties,l=e.surveyLanguage,u=e.questionSnapshots;s?(ag(r),s.capture(J_.SENT,n({[X_.SURVEY_NAME]:r.name,[X_.SURVEY_ID]:r.id,[X_.SURVEY_ITERATION]:r.current_iteration,[X_.SURVEY_ITERATION_START_DATE]:r.current_iteration_start_date,[X_.SURVEY_SUBMISSION_ID]:i,[X_.SURVEY_COMPLETED]:o},l&&{[X_.SURVEY_LANGUAGE]:l},{sessionRecordingUrl:null==s.get_session_replay_url?void 0:s.get_session_replay_url()},Wa(t,r,u),a,{$set:{[za(r,"responded")]:!0}})),o&&(hg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:r.id}})),Ng(r),s.reloadFeatureFlags())):rg.error("[survey sent] event not captured, PostHog instance not found.")},Sg=(e,t,r)=>{return n({[X_.SURVEY_NAME]:e.name,[X_.SURVEY_ID]:e.id,[X_.SURVEY_ITERATION]:e.current_iteration,[X_.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[X_.SURVEY_PARTIALLY_COMPLETED]:(i=null==t?void 0:t.responses,void 0===i&&(i={}),Object.values(i).some(e=>!Lt(e)))},(null==t?void 0:t.surveyLanguage)&&{[X_.SURVEY_LANGUAGE]:t.surveyLanguage},{sessionRecordingUrl:null==r.get_session_replay_url?void 0:r.get_session_replay_url(),[X_.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},Wa(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots));var i},wg=(e,t,r,i)=>{if(t){if(!r){var s=Og(e),o=s?s.surveyLanguage:i;t.capture(J_.DISMISSED,n({},Sg(e,s,t),o&&{[X_.SURVEY_LANGUAGE]:o},{$set:{[za(e,"dismissed")]:!0}})),Ng(e),ag(e),hg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))}}else rg.error("[survey dismissed] event not captured, PostHog instance not found.")},kg=(e,t)=>{if(t){var r=(e=>ng("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(r))return}catch(e){return}var i=Og(e);if(i){try{localStorage.setItem(r,"true")}catch(e){}t.capture(J_.ABANDONED,Sg(e,i,t),{transport:"sendBeacon"})}}else rg.error("[survey abandoned] event not captured, PostHog instance not found.")},Cg=e=>e.map(e=>({sort:Math.floor(10*Math.random()),value:e})).sort((e,t)=>e.sort-t.sort).map(e=>e.value),Eg=(e,t)=>e.length===t.length&&e.every((e,r)=>e===t[r])?t.reverse():t,xg=e=>{var t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},Tg=(e,t)=>{var r;return(e=>e.questions.some(e=>{var t;return!(null==(t=e.branching)||!t.type)}))(e)?e.questions:t?null!==(r=((e,t)=>{if(!t||t.length!==e.questions.length)return null;var r=new Map(e.questions.map(e=>[e.id,e])),i=[];for(var s of t){var n=r.get(s);if(!n)return null;i.push(n)}return i})(e,t.questionOrder))&&void 0!==r?r:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Eg(e.questions,Cg(e.questions)):e.questions},Ig=e=>Ya(e)||Dg(e),Rg=function(e){function t(e){var r,i;return this.getChildContext||(r=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&r.forEach(function(e){e.__e=!0,n_(e)})},this.sub=function(e){r.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r&&r.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+qp++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),Pg=()=>O_(Rg),Mg=e=>{var t=e.children,r=e.style;return function(e,t,r){var i,s,n,o,a=Zp({},e.props);for(n in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==n?i=t[n]:"ref"==n?s=t[n]:a[n]=void 0===t[n]&&null!=o?o[n]:t[n];return arguments.length>2&&(a.children=arguments.length>3?xp.call(arguments,2):r),Xp(e.type,a,i||e.key,s||e.ref,null)}(e.component,e.renderAsHtml?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})};function Fg(e,t){var r,i;if(null==(r=e.conditions)||!r.url)return!0;var s,n=tn(t);return!!n&&el[s=null==(i=e.conditions)?void 0:i.urlMatchType,null!=s?s:"icontains"]([e.conditions.url],[n])}var Lg=e=>ng("inProgressSurvey_",e),Ag=(e,t)=>{try{localStorage.setItem(Lg(e),JSON.stringify(t))}catch(e){rg.error("Error setting in-progress survey state in localStorage",e)}},Og=e=>{try{var t=localStorage.getItem(Lg(e));if(t)return JSON.parse(t)}catch(e){rg.error("Error getting in-progress survey state from localStorage",e)}return null},Dg=e=>{var t=Og(e);return!Lt(null==t?void 0:t.surveySubmissionId)},Ng=e=>{try{localStorage.removeItem(Lg(e))}catch(e){rg.error("Error clearing in-progress survey state from localStorage",e)}};function Bg(e,t){void 0===t&&(t=!1);var r="PostHogSurvey-"+e.id;return t?"."+r:r}function $g(e,t,r){if(void 0===t&&(t=j_.Right),e===Q_.ExternalSurvey)return{};switch(t){case j_.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case j_.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case j_.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case j_.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case j_.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case j_.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case j_.Left:return{left:"30px"};case j_.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===Q_.Widget&&r===V_.Tab?"60px":"30px"}}}var qg=0;function Hg(e,t,r,i,s,n){t||(t={});var o,a,l=t;if("ref"in l)for(a in l={},t)"ref"==a?o=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--qg,__i:-1,__u:0,__source:s,__self:n};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return Tp.vnode&&Tp.vnode(u),u}var Ug=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),Wg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),zg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),Vg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),jg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Hg("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"})}),Gg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Hg("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"})}),Qg=Hg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Hg("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"})}),Kg=Hg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Hg("g",{"clip-path":"url(#clip0_2415_6911)",children:[Hg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Hg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Hg("g",{mask:"url(#mask0_2415_6911)",children:[Hg("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"}),Hg("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"}),Hg("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"}),Hg("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"}),Hg("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"}),Hg("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"})]})]}),Hg("defs",{children:Hg("clipPath",{id:"clip0_2415_6911",children:Hg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function Zg(e){var t=e.urlParams,r=t?Object.entries(t).map(e=>{var t=e[1];return encodeURIComponent(e[0])+"="+encodeURIComponent(t)}).join("&"):"";return Hg("a",{href:"https://posthog.com/surveys"+(r?"?"+r:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Kg]})}function Yg(e){var t=e.text,r=e.submitDisabled,i=e.appearance,s=e.onSubmit,n=e.link,o=e.onPreviewSubmit,a=e.skipSubmitButton,u=e.canGoBack,d=e.onBack,c=O_(Rg).isPreviewMode,h=!!u&&!!d,p=!a&&Hg("button",{className:"form-submit",disabled:r,"aria-label":"Submit survey",type:"button",onClick(){n&&(null==l||l.open(n)),c?null==o||o():s()},children:t});return Hg("div",{className:"bottom-section",children:[h?Hg("div",{className:"form-buttons form-buttons-with-back",children:[Hg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:d,children:i.backButtonText||"Back"}),p]}):p,!i.whiteLabel&&Hg(Zg,{urlParams:{utm_source:"survey-footer"}})]})}function Jg(e){var t=e.question,r=e.forceDisableHtml;return Hg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Hg(t.type===K_.Open?"label":"h3",{className:"survey-question",htmlFor:e.htmlFor,children:t.question}),t.description&&Mg({component:Jp("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!r&&"text"!==t.descriptionContentType})]})}function Xg(e){var t,r,i;return Hg("button",{className:"form-cancel",onClick:e.onClick,disabled:O_(Rg).isPreviewMode,"aria-label":"Close survey",type:"button",children:(t={fill:"black"},r=(void 0===t?{}:t).fill,i=void 0===r?"currentColor":r,Hg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:i,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Hg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Hg("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:i})]}))})}var ev=l;function tv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onClose,a=O_(Rg).isPopup;return F_(()=>{var e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),o())};return Ws(ev,"keydown",e),()=>{ev.removeEventListener("keydown",e)}},[o]),Hg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[a&&!0!==n.hideCancelButton&&Hg(Xg,{onClick:()=>o()}),Hg("h3",{className:"thank-you-message-header",children:t}),r&&Mg({component:Jp("p",{className:"thank-you-message-body"}),children:r,renderAsHtml:!s&&"text"!==i}),a&&Hg(Yg,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>o()})]})}function rv(e){var t=e.header,r=e.description,i=e.contentType,s=e.forceDisableHtml,n=e.appearance,o=e.onStart,a=O_(Rg),l=a.onPreviewSubmit,u=a.onPopupSurveyDismissed;return Hg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[a.isPopup&&!0!==n.hideCancelButton&&Hg(Xg,{onClick:()=>u()}),t&&Hg("h3",{className:"intro-screen-header",children:t}),r&&Mg({component:Jp("p",{className:"intro-screen-body"}),children:r,renderAsHtml:!s&&"text"!==i}),Hg(Yg,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:o,onPreviewSubmit:()=>l(null)})]})}var iv=e=>Et(e)&&e.every(e=>Pt(e));function sv(e){var t=e.question,r=e.forceDisableHtml,i=e.appearance,s=e.onSubmit,n=e.onPreviewSubmit,o=e.displayQuestionIndex,a=e.initialValue,l=e.canGoBack,u=e.onBack,d=Pg().isPreviewMode,c=L_(null),h=M_(()=>Pt(a)?a:""),p=h[0],_=h[1],g=null==i?void 0:i.disableAutofocus;F_(()=>{g||setTimeout(()=>{var e;d||null==(e=c.current)||e.focus()},100)},[d,g]);var v="surveyQuestion"+o,f=A_(()=>function(e,t,r){var i,s,n=e.trim();if(!r&&""===n)return"This field is required";if(""===n)return!1;if(t&&t.length>0)for(var o of t)switch(o.type){case mt:if(void 0!==o.value&&o.value>n.length)return null!==(i=o.errorMessage)&&void 0!==i?i:"Please enter at least "+o.value+" characters";break;case yt:if(void 0!==o.value&&n.length>o.value)return null!==(s=o.errorMessage)&&void 0!==s?s:"Please enter no more than "+o.value+" characters"}return!1}(p,t.validation,t.optional),[p,t.validation,t.optional]),m=Ts(t.validation,mt),y=Ts(t.validation,yt),b=A_(()=>function(e,t){var r=1===e?void 0:e;return r&&t?"Enter "+r+"-"+t+" characters":r?"Enter at least "+r+" "+(1===r?"character":"characters"):t?"Maximum "+t+" "+(1===t?"character":"characters"):void 0}(m,y),[m,y]),S=()=>{f||s(p.trim())},w=()=>{f||n(p.trim())};return Hg(e_,{children:[Hg("div",{className:"question-container",children:[Hg(Jg,{question:t,forceDisableHtml:r,htmlFor:v}),Hg("textarea",{ref:c,id:v,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:m,maxLength:y,onInput(e){_(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),d?w():S())},value:p}),b&&Hg("div",{className:"validation-hint",children:b})]}),Hg(Yg,{text:t.buttonText||"Submit",submitDisabled:!!f,appearance:i,onSubmit:S,onPreviewSubmit:w,canGoBack:l,onBack:u})]})}function nv(e){var t=e.question,r=e.appearance,i=e.onSubmit,s=e.onPreviewSubmit,n=e.canGoBack,o=e.onBack;return Hg(e_,{children:[Hg("div",{className:"question-container",children:Hg(Jg,{question:t,forceDisableHtml:e.forceDisableHtml})}),Hg(Yg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:r,onSubmit:()=>i("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:n,onBack:o})]})}function ov(e){var t,r=e.question,i=e.forceDisableHtml,s=e.displayQuestionIndex,n=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,d=e.onBack,c=r.scale,h=10===r.scale?0:1,p=M_(()=>At(l)?l:Et(l)&&l.length>0&&At(parseInt(l[0]))?parseInt(l[0]):Pt(l)&&At(parseInt(l))?parseInt(l):null),_=p[0],g=p[1],v="emoji"===r.display&&2===r.scale,f=Pg().isPreviewMode,m=e=>f?a(e):o(e);return Hg(e_,{children:[Hg("div",{className:"question-container",children:[Hg(Jg,{question:r,forceDisableHtml:i}),Hg("div",{className:"rating-section",children:[Hg("div",{className:"rating-options",children:["emoji"===r.display&&Hg("div",{className:"rating-options-emoji"+(v?" rating-options-emoji-2":""),children:null==(t=hv[r.scale])?void 0:t.map((e,t)=>Hg("button",{"aria-label":"Rate "+(t+1),className:"ratings-emoji question-"+s+"-rating-"+t+" "+(t+1===_?"rating-active":""),value:t+1,type:"button",onClick(){var e=t+1;g(e),r.skipSubmitButton&&m(e)},children:e},t))}),"number"===r.display&&Hg("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat("+(c-h+1)+", minmax(0, 1fr))"},children:pv(r.scale).map((e,t)=>Hg(av,{displayQuestionIndex:s,active:_===e,appearance:n,num:e,setActiveNumber(e){g(e),r.skipSubmitButton&&m(e)}},t))})]}),!v&&Hg("div",{className:"rating-text",children:[Hg("div",{children:r.lowerBoundLabel}),Hg("div",{children:r.upperBoundLabel})]})]})]}),Hg(Yg,{text:r.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Ft(_)&&!r.optional,appearance:n,onSubmit:()=>o(_),onPreviewSubmit:()=>a(_),skipSubmitButton:r.skipSubmitButton,canGoBack:u,onBack:d})]})}function av(e){var t=e.num,r=e.setActiveNumber;return Hg("button",{"aria-label":"Rate "+t,className:"ratings-number question-"+e.displayQuestionIndex+"-rating-"+t+" "+(e.active?"rating-active":""),type:"button",onClick(){r(t)},children:t})}function lv(e){var t=e.question,r=e.forceDisableHtml,i=e.displayQuestionIndex,s=e.appearance,o=e.onSubmit,a=e.onPreviewSubmit,l=e.initialValue,u=e.canGoBack,d=e.onBack,c=L_(null),h=A_(()=>(e=>{if(!e.shuffleOptions)return e.choices;var t=e.choices,r="";e.hasOpenChoice&&(r=t.pop());var i=Eg(t,Cg(t));return e.hasOpenChoice&&(e.choices.push(r),i.push(r)),i})(t),[t]),p=M_(()=>((e,t)=>Pt(e)||iv(e)?e:t===K_.SingleChoice?null:[])(l,t.type)),_=p[0],g=p[1],v=M_(()=>((e,t)=>{if(Pt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(iv(e)){var r=e.find(e=>!t.includes(e));if(r)return{isSelected:!0,inputValue:r}}return{isSelected:!1,inputValue:""}})(l,h)),f=v[0],m=v[1],y=Pg().isPreviewMode,b=t.type===K_.SingleChoice,S=t.type===K_.MultipleChoice,w=t.skipSubmitButton&&b&&!t.hasOpenChoice,k=(e,t)=>{if(t){var r=!f.isSelected;return m(e=>n({},e,{isSelected:r,inputValue:r?e.inputValue:""})),b&&g(""),void(r&&setTimeout(()=>{var e;return null==(e=c.current)?void 0:e.focus()},75))}if(b)return g(e),m(e=>n({},e,{isSelected:!1,inputValue:""})),void(w&&(o(e),y&&a(e)));S&&Et(_)&&(_.includes(e)?g(_.filter(t=>t!==e)):g([..._,e]))},C=e=>{e.stopPropagation();var t=e.currentTarget.value;m(e=>n({},e,{inputValue:t})),b&&g(t)},E=e=>{e.stopPropagation(),"Enter"!==e.key||x()||(e.preventDefault(),T()),"Escape"===e.key&&(e.preventDefault(),m(e=>n({},e,{isSelected:!1,inputValue:""})),b&&g(null))},x=()=>!(t.optional||!Ft(_)&&(!Et(_)||f.isSelected||0!==_.length)&&(!f.isSelected||""!==f.inputValue.trim())),T=()=>{f.isSelected&&S?Et(_)&&(y?a([..._,f.inputValue]):o([..._,f.inputValue])):y?a(_):o(_)};return Hg(e_,{children:[Hg("div",{className:"question-container",children:[Hg(Jg,{question:t,forceDisableHtml:r}),Hg("fieldset",{className:"multiple-choice-options limit-height",children:[Hg("legend",{className:"sr-only",children:S?" Select all that apply":" Select one"}),h.map((e,r)=>{var s=!!t.hasOpenChoice&&r===t.choices.length-1,n="surveyQuestion"+i+"Choice"+r,o=n+"Open",a=s?f.isSelected:b?_===e:Et(_)&&_.includes(e);return Hg("label",{className:s?"choice-option-open":"",children:[Hg("div",{className:"response-choice",children:[Hg("input",{type:b?"radio":"checkbox",name:n,checked:a,onChange:()=>k(e,s),id:n,"aria-controls":o}),Hg("span",{children:s?e+":":e})]}),s&&Hg("input",{type:"text",ref:c,id:o,name:"question"+i+"Open",value:f.inputValue,onKeyDown:E,onInput:C,onClick(t){f.isSelected||k(e,!0),t.stopPropagation()},"aria-label":e+" - please specify"})]},r)})]})]}),Hg(Yg,{text:t.buttonText||"Submit",submitDisabled:x(),appearance:s,onSubmit:T,onPreviewSubmit:T,skipSubmitButton:w,canGoBack:u,onBack:d})]})}var uv=[1,2,3,4,5],dv=[1,2,3,4,5,6,7],cv=[0,1,2,3,4,5,6,7,8,9,10],hv={2:[Gg,Qg],3:[zg,Wg,Ug],5:[Vg,zg,Wg,Ug,jg]};function pv(e){switch(e){case 5:default:return uv;case 7:return dv;case 10:return cv}}var _v=Fs("[Surveys]");function gv(e,t,r){var i,s=e.questions[t],n=t+1;if(null==(i=s.branching)||!i.type)return t===e.questions.length-1?Z_.End:n;if(s.branching.type===Z_.End)return Z_.End;if(s.branching.type===Z_.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===Z_.ResponseBased){if(s.type===K_.SingleChoice){var o,a=s.choices.indexOf(""+r);if(-1===a&&s.hasOpenChoice&&(a=s.choices.length-1),null!=(o=s.branching)&&null!=(o=o.responseValues)&&o.hasOwnProperty(a)){var l=s.branching.responseValues[a];return Number.isInteger(l)?l:l===Z_.End?Z_.End:n}}else if(s.type===K_.Rating){var u;if("number"!=typeof r||!Number.isInteger(r))throw new Error("The response type must be an integer");var d=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(r,s.scale);if(null!=(u=s.branching)&&null!=(u=u.responseValues)&&u.hasOwnProperty(d)){var c=s.branching.responseValues[d];return Number.isInteger(c)?c:c===Z_.End?Z_.End:n}}return n}return _v.warn("Falling back to next question index due to unexpected branching type"),n}var vv=Fs("[SurveyTranslations]");function fv(e,t){var r=function(e){return function(e,t){var r=e.storedPersonProperties,i=e.locale,s=Va(e.overrideLanguage);if(s)return null==t||t.info("Using override display language: "+s),s;var n=function(e){return e&&"object"==typeof e&&"language"in e?Va(e.language):null}(r);if(n)return null==t||t.info("Using person property language: "+n),n;var o=Va(i);return o?(null==t||t.info("Using detected locale: "+o),o):(null==t||t.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:xt(e.get_property)?e.get_property(pe):void 0,locale:fl()},vv)}(t);if(!r)return vv.info("No user language detected"),{survey:e,language:null};var i=Ka(e,r,vv);return{survey:i.survey,language:i.matchedKey}}var mv=l,yv=c,bv="ph:show_survey_widget",Sv="PHWidgetSurveyClickListener";function wv(e,t){try{var r=e.getBoundingClientRect(),i=mv.innerHeight,s=mv.innerWidth,n=r.left+r.width/2-t/2;n+t>s-20&&(n=s-t-20),20>n&&(n=20);var o=i-r.bottom,a=250>o&&r.top>o;return{position:"fixed",top:a?"auto":r.bottom+12+"px",left:n+"px",right:"auto",bottom:a?i-r.top+12+"px":"auto",zIndex:gg.zIndex}}catch(e){return rg.warn("Failed to calculate trigger position:",e),null}}var kv=class{constructor(e){var t=this;this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTargets=new Map,this._prefillHandledSurveys=new Set,this._currentLanguage=null,this._surveyIsRendered=!1,this._languageChangeListener=null,this._unsubscribeFeatureFlags=null,this._surveyPopupProps=null,this.handlePageUnload=()=>{var e=this._posthog.get_property(ve);if(e)for(var t of e)Dg(t)&&kg(t,this._posthog)},this.handlePopoverSurvey=function(e,r,i){var s,o,a,l,u,d=(void 0===i?{}:i).resumeDelayFromActivation,c=void 0!==d&&d,h=t._translateSurveyForRendering(e),p=h.survey,_=h.language;t._currentLanguage=_,t._surveyPopupProps=null,t._displayOptions=r;var g=t._applyDisplayOverrides(p,r);t._clearSurveyTimeout(g.id);var v=null!=r?r:{},f=v.properties,m=v.initialResponses,y=!(!m||0>=Object.keys(m).length)&&t._handleInitialResponses(g,m,f,_);if(!y||null!=(s=g.appearance)&&s.displayThankYouMessage){t._addSurveyToFocus(g);var b={};if((null==(o=g.appearance)?void 0:o.position)===j_.NextToTrigger&&null!=(a=g.appearance)&&a.widgetSelector){var S,w=yv.querySelector(g.appearance.widgetSelector);w&&(b=wv(w,parseInt((null==(S=g.appearance)?void 0:S.maxWidth)||gg.maxWidth))||{})}var k=(null==(l=g.appearance)?void 0:l.surveyPopupDelaySeconds)||0,C=yg(g,t._posthog).shadow;t._renderedTargets.set(C,C.host);var E={posthog:t._posthog,survey:g,removeSurveyFromFocus:t._removeSurveyFromFocus,properties:f,style:b,isSurveyCompleted:y,skipShownEvent:null==r?void 0:r.skipShownEvent,surveyLanguage:_};if(t._surveyPopupProps=E,0>=k)return t._surveyIsRendered=!0,b_(Hg(Iv,n({},E)),C);var x=()=>{if(!t._shouldDisplaySurvey(g))return rg.info("Survey "+g.id+" no longer eligible when its display delay elapsed; not displaying"),t._removeSurveyFromFocus(g);(()=>{t._surveyIsRendered=!0;var i=t._translateSurveyForRendering(e),s=i.survey,o=i.language;t._currentLanguage=o;var a=t._applyDisplayOverrides(s,r),l=n({},E,{survey:a,surveyLanguage:o});t._surveyPopupProps=l,b_(Hg(Iv,n({},l,{survey:n({},a,{appearance:n({},a.appearance,{surveyPopupDelaySeconds:0})})})),C)})()},T=c?null==(u=t._posthog.surveys)||null==(u=u._surveyEventReceiver)||null==u.getActivationTimestamp?void 0:u.getActivationTimestamp(g.id):void 0,I=At(T)?Math.max(0,Date.now()-T):0,R=Math.max(0,1e3*k-I);if(0>=R)return x();var P=mv.setTimeout(()=>{t._surveyTimeouts.delete(g.id),x()},R);t._surveyTimeouts.set(g.id,P)}},this._handleWidget=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,s=yg(r,this._posthog),n=s.shadow,o=s.isNewlyCreated;this._renderedTargets.set(n,n.host),o&&b_(Hg(Pv,{posthog:this._posthog,survey:r,surveyLanguage:i},e.id),n)},this._detachWidgetSelectorListener=e=>{var t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Sv),this._widgetSelectorListeners.delete(e),rg.info("Removed click listener for survey "+e))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;return!(null==(t=yv.querySelector(Bg(e,!0)))||null==(t=t.shadowRoot)||!t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{var r=yv.querySelector(t),i=this._widgetSelectorListeners.get(e.id);if(r){if(this._handleWidget(e),i){if(r===i.element)return;rg.info("Selector element changed for survey "+e.id+". Re-attaching listener."),this._detachWidgetSelectorListener(e.id)}if(!r.hasAttribute(Sv)){var s=t=>{var r,i;t.stopPropagation();var s=(null==(r=e.appearance)?void 0:r.position)===j_.NextToTrigger?wv(t.currentTarget,parseInt((null==(i=e.appearance)?void 0:i.maxWidth)||gg.maxWidth)):{};mv.dispatchEvent(new CustomEvent(bv,{detail:{surveyId:e.id,position:s}}))};Ws(r,"click",s),r.setAttribute(Sv,"true"),this._widgetSelectorListeners.set(e.id,{element:r,listener:s,survey:e}),rg.info("Attached click listener for feedback button survey "+e.id)}}else i&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{var t=this._translateSurveyForRendering(e),r=t.survey,i=t.language,s=yg(r,this._posthog).shadow;this._renderedTargets.set(s,s.host),b_(Hg(Iv,{posthog:this._posthog,survey:r,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,r)=>{var i,s=this._translateSurveyForRendering(e),n=s.survey,o=s.language,a=!1;null!=(i=this._posthog.config)&&null!=(i=i.surveys)&&i.prefillFromUrl&&(a=this._handleUrlPrefill(n,o,r)),b_(Hg(Iv,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:r,isSurveyCompleted:a,surveyLanguage:o}),t)},this.getActiveMatchingSurveys=function(e,r){var i;void 0===r&&(r=!1),null==(i=t._posthog)||null==(i=i.surveys)||i.getSurveys(r=>{e(r.filter(e=>t._shouldDisplaySurvey(e)))},r)},this.callSurveysAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getActiveMatchingSurveys(e=>{var r=e.filter(e=>e.type===Q_.Popover||e.type===Q_.Widget),i=new Set(r.map(e=>e.id));for(var s of Array.from(t._surveyTimeouts.keys()))i.has(s)||t.cancelSurvey(s);var n=t._sortSurveysByAppearanceDelay(r),o=new Set;n.forEach(e=>{if(e.type===Q_.Widget){var r,i,s,n;if((null==(r=e.appearance)?void 0:r.widgetType)===V_.Tab)return void t._handleWidget(e);(null==(i=e.appearance)?void 0:i.widgetType)===V_.Selector&&null!=(s=e.appearance)&&s.widgetSelector&&(o.add(e.id),t._manageWidgetSelectorListener(e,null==(n=e.appearance)?void 0:n.widgetSelector))}Ft(t._surveyInFocus)&&e.type===Q_.Popover&&t.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),t._widgetSelectorListeners.forEach(e=>{var r=e.survey;o.has(r.id)||t._removeWidgetSelectorListener(r)})},e)},this._addSurveyToFocus=e=>{Ft(this._surveyInFocus)||rg.error("Survey "+this._surveyInFocus+" already in focus. Cannot add survey "+e.id+"."),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&rg.error("Survey "+e.id+" is not in focus. Cannot remove survey "+e.id+"."),this._clearSurveyTimeout(e.id),this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0,this._removeSurveyFromDom(e)},this._posthog=e,this._surveyInFocus=null,this._languageChangeListener=()=>this._onLanguageChange(),Ws(mv,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags(()=>this._onLanguageChange())}_onLanguageChange(){var e;if(!Ft(this._surveyInFocus)){var t=null==(e=this._posthog.get_property(ve))?void 0:e.find(e=>e.id===this._surveyInFocus);if(t){var r=this._translateSurveyForRendering(t),i=r.survey,s=r.language;if(s!==this._currentLanguage&&(this._currentLanguage=s,this._surveyIsRendered)){var o=this._applyDisplayOverrides(i,this._displayOptions),a=yg(o,this._posthog).shadow;b_(Hg(Iv,n({},this._surveyPopupProps,{posthog:this._posthog,survey:o,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),a)}}}}get _featureFlags(){var e,t,r;return null!==(e=null==(t=(r=this._posthog).getExtension)?void 0:t.call(r,"featureFlags"))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return null!=t&&t.position||null!=t&&t.selector?n({},e,{appearance:n({},e.appearance,t.position&&{position:t.position},t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){var t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(rg.info("Cancelled pending survey "+e),this._clearSurveyTimeout(e),this._surveyInFocus===e&&(this._surveyInFocus=null,this._currentLanguage=null,this._surveyIsRendered=!1,this._surveyPopupProps=null,this._displayOptions=void 0))}setAutomaticDisplayDispose(e){this._automaticDisplayDispose=e}dispose(){var e;null==(e=this._automaticDisplayDispose)||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(mv.removeEventListener("languagechange",this._languageChangeListener),this._languageChangeListener=null),this._unsubscribeFeatureFlags&&(this._unsubscribeFeatureFlags(),this._unsubscribeFeatureFlags=null),this._surveyTimeouts.forEach((e,t)=>this._clearSurveyTimeout(t)),this._widgetSelectorListeners.forEach((e,t)=>this._detachWidgetSelectorListener(t)),this._renderedTargets.forEach((e,t)=>{b_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var r,i,s=Dg(e),n=Dg(t);if(s&&!n)return-1;if(!s&&n)return 1;var o=e.schedule===Y_.Always,a=t.schedule===Y_.Always;return o&&!a?1:!o&&a?-1:((null==(r=e.appearance)?void 0:r.surveyPopupDelaySeconds)||0)-((null==(i=t.appearance)?void 0:i.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return fv(e,this._posthog)}_handleUrlPrefill(e,t,r){if(this._prefillHandledSurveys.has(e.id))return!1;var i=function(){var e={},t=!1,r=mv.location.search.replace(/^\?/,"");if(!r)return{params:e,autoSubmit:t};for(var i of r.split("&")){var s=i.split("="),n=s[0],o=s[1];if(n&&!Rt(o)){var a=decodeURIComponent(n),l=decodeURIComponent(o);if("auto_submit"!==a||"true"!==l){var u=a.match(/^q(\d+)$/);if(u){var d=parseInt(u[1],10);e[d]||(e[d]=[]),e[d].push(l)}}else t=!0}}return{params:e,autoSubmit:t}}().params;if(0===Object.keys(i).length)return!1;rg.info("[Survey Prefill] Detected URL prefill parameters");var s=this._processPrefillData(e,i,t);return!!s&&(this._autoSubmitPrefilledResponses(e,s,r,t),this._prefillHandledSurveys.add(e.id),s.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,r,i){var s=t.responses,n=t.submissionId,o=t.isSurveyCompleted,a=t.skippedResponses;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&bg({responses:o?s:a,survey:e,surveySubmissionId:n,posthog:this._posthog,isSurveyCompleted:o,properties:r,surveyLanguage:i})}_handleInitialResponses(e,t,r,i){var s={};for(var n of Object.entries(t)){var o=n[1];s[parseInt(n[0])]=Et(o)?o.map(String):[String(o)]}rg.info("[Survey] Processing initial responses");var a=this._processPrefillData(e,s,i);return!!a&&(this._autoSubmitPrefilledResponses(e,a,r,i),a.isSurveyCompleted)}_processPrefillData(e,t,r){try{var i=function(e,t){var r={};return e.questions.forEach((e,i)=>{if(t[i]&&e.id){var s=t[i],n=Ha(e.id);try{switch(e.type){case K_.SingleChoice:if(!e.choices||0===e.choices.length)return void Ms.warn("[Survey Prefill] Question "+i+" has no choices");var o=parseInt(s[0],10);if(isNaN(o)||0>o||o>=e.choices.length)return void Ms.warn("[Survey Prefill] Invalid choice index for q"+i+": "+s[0]);r[n]=e.choices[o];break;case K_.MultipleChoice:if(!e.choices||0===e.choices.length)return void Ms.warn("[Survey Prefill] Question "+i+" has no choices");var a=s.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===a.length)return void Ms.warn("[Survey Prefill] No valid choices for q"+i);var l=[...new Set(a.map(t=>e.choices[t]))];a.length>l.length&&Ms.warn("[Survey Prefill] Removed duplicate choices for q"+i),r[n]=l;break;case K_.Rating:var u=parseInt(s[0],10),d=e.scale||10;if(isNaN(u)||0>u||u>d)return void Ms.warn("[Survey Prefill] Invalid rating for q"+i+": "+s[0]+" (scale: 0-"+d+")");r[n]=u;break;default:Ms.info("[Survey Prefill] Question type "+e.type+" does not support prefill")}}catch(e){Ms.error("[Survey Prefill] Error converting q"+i+":",e)}}}),r}(e,t);if(0===Object.keys(i).length)return rg.warn("[Survey Prefill] No valid responses after conversion"),null;var s=va(),n=function(e,t,r){for(var i=0,s={},n=[],o=e.questions.length+1,a=0;e.questions.length>i&&o>a&&(a++,t.includes(i));){var l=e.questions[i];if(!l||!("skipSubmitButton"in l)||!l.skipSubmitButton)break;if(l.id){var u=Ha(l.id);Rt(r[u])||(s[u]=r[u])}n.push(i);var d=gv(e,i,l.id?r[Ha(l.id)]:null);if(d===Z_.End)return{startQuestionIndex:e.questions.length,skippedResponses:s,skippedIndices:n};i=d}return{startQuestionIndex:i,skippedResponses:s,skippedIndices:n}}(e,Object.keys(t).map(e=>parseInt(e,10)),i),o=n.startQuestionIndex,a=n.skippedResponses,l=n.skippedIndices,u=o>=e.questions.length;return Ag(e,{surveySubmissionId:s,responses:i,lastQuestionIndex:o,questionOrder:xg(e.questions),visitedIndices:l,surveyLanguage:r}),rg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:i,submissionId:s,startQuestionIndex:o,isSurveyCompleted:u,skippedResponses:a}}catch(e){return rg.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t){if(void 0===t&&(t=void 0),!e)return!0;var r=this._featureFlags,i=!(null==r||!r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")})),s=!0;return t&&(s=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),i&&s}_isSurveyConditionMatched(e){return!e.conditions||Fg(e,this._posthog)&&function(e){var t,r;return function(e,t){var r,i,s;if(!e||0===e.length)return!0;if(!f)return!1;var n=Zr(f,{userAgentDataPlatform:null==d||null==(r=d.userAgentData)?void 0:r.platform,maxTouchPoints:null==d?void 0:d.maxTouchPoints,screenWidth:null==l||null==(i=l.screen)?void 0:i.width,screenHeight:null==l||null==(s=l.screen)?void 0:s.height,devicePixelRatio:null==l?void 0:l.devicePixelRatio});return el[null!=t?t:"icontains"](e,[n])}(null==(t=e.conditions)?void 0:t.deviceTypes,null==(r=e.conditions)?void 0:r.deviceTypesMatchType)}(e)&&function(e){var t;return null==(t=e.conditions)||!t.selector||!(null==pg||!pg.querySelector(e.conditions.selector))}(e)}_internalFlagCheckSatisfied(e){var t;return Ig(e)?{satisfied:!0}:!e.internal_targeting_flag_key||!function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)||null!=(t=this._featureFlags)&&t.hasLoadedFlags?{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}:{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}}checkSurveyEligibility(e){var t,r,i={eligible:!0,reason:void 0};if(!ig(e))return i.eligible=!1,i.reason="Survey is not running. It was completed on "+e.end_date,i;if(!lg.includes(e.type))return i.eligible=!1,i.reason="Surveys of type "+e.type+" are never eligible to be shown in the app",i;var s=null==(t=e.conditions)?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,s))return i.eligible=!1,i.reason=s?"Survey linked feature flag is not enabled for variant "+s:"Survey linked feature flag is not enabled",i;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return i.eligible=!1,i.reason="Survey targeting feature flag is not enabled",i;var n,o=this._internalFlagCheckSatisfied(e);return o.satisfied?function(e,t){if(!e||!t)return!0;var r="string"==typeof t?new Date(t):t,i=Math.abs((new Date).getTime()-r.getTime());return Math.ceil(i/864e5)>e}(null==(r=e.conditions)?void 0:r.seenSurveyWaitPeriodInDays,ka._get("lastSeenSurveyDate"))?(e=>!!ka._get(og(e))&&!Ig(e))(e)?(i.eligible=!1,i.reason="Survey has already been seen and it can't be activated again",i):i:(i.eligible=!1,i.reason="Survey wait period has not passed",i):(i.eligible=!1,i.reason=null!==(n=o.reason)&&void 0!==n?n:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",i)}checkSurveyRenderability(e){var t=this.checkSurveyEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;return!Za(e)&&!sg(e)||!(null==(t=this._posthog.surveys)||null==(t=t._surveyEventReceiver)||null==(t=t.getSurveys())||!t.includes(e.id))}_checkFlags(e){var t;return null==(t=e.feature_flag_keys)||!t.length||e.feature_flag_keys.every(e=>{var t=e.value;return!e.key||!t||this._isSurveyFeatureFlagEnabled(t)})}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{var t=yv.querySelector(Bg(e,!0));null!=t&&t.shadowRoot&&(b_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){rg.warn("Failed to remove survey "+e.id+" from DOM:",t)}}getTestAPI(){return{addSurveyToFocus:this._addSurveyToFocus,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyInFocus:this._surveyInFocus,surveyTimeouts:this._surveyTimeouts,handleWidget:this._handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this._manageWidgetSelectorListener,sortSurveysByAppearanceDelay:this._sortSurveysByAppearanceDelay,checkFlags:this._checkFlags.bind(this),isSurveyFeatureFlagEnabled:this._isSurveyFeatureFlagEnabled.bind(this),onLanguageChange:this._onLanguageChange.bind(this),currentLanguage:this._currentLanguage,surveyIsRendered:this._surveyIsRendered}}};function Cv(e,t){if(yv&&mv){var r,i=new kv(e);if(e.config.disable_surveys_automatic_display)return rg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return rg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;i.callSurveysAndEvaluateDisplayLogic(!0);var s=()=>{Rt(r)&&(r=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},n=()=>{Rt(r)||(clearInterval(r),r=void 0)};s();var o=()=>{yv.hidden?n():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return Ws(yv,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{n(),yv.removeEventListener("visibilitychange",o)}),i}}function Ev(e){var t=e.survey,r=e.removeSurveyFromFocus,i=void 0===r?()=>{}:r,s=e.setSurveyVisible,n=e.isPreviewMode,o=void 0!==n&&n,a=e.posthog;F_(()=>{var e;if(!o&&null!=(e=t.conditions)&&e.url){var r=()=>{var e,r=t.type===Q_.Widget,n=Fg(t,a),o=(null==(e=t.appearance)?void 0:e.widgetType)===V_.Tab&&r;if(!n)return rg.info("Hiding survey "+t.id+" because URL does not match"),s(!1),i(t);o&&(rg.info("Showing survey "+t.id+" because it is a feedback button tab and URL matches"),s(!0))};Ws(mv,"popstate",r),Ws(mv,"hashchange",r);var n=mv.history.pushState,l=mv.history.replaceState;return mv.history.pushState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];n.apply(this,t),r()},mv.history.replaceState=function(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];l.apply(this,t),r()},()=>{mv.removeEventListener("popstate",r),mv.removeEventListener("hashchange",r),mv.history.pushState=n,mv.history.replaceState=l}}},[o,t,i,s,a])}var xv=200;function Tv(e){switch(void 0===e&&(e=G_.Right),e){case G_.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case G_.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case G_.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Iv(e){var t,r,i,s,o,a,l,u,d,c,h,p,_=e.survey,g=e.forceDisableHtml,v=e.posthog,f=e.style,m=void 0===f?{}:f,y=e.previewPageIndex,b=e.removeSurveyFromFocus,S=void 0===b?()=>{}:b,w=e.isPopup,k=void 0===w||w,C=e.onPreviewSubmit,E=void 0===C?()=>{}:C,x=e.onPreviewBack,T=void 0===x?()=>{}:x,I=e.onPopupSurveyDismissed,R=void 0===I?()=>{}:I,P=e.onCloseConfirmationMessage,M=void 0===P?()=>{}:P,F=e.properties,L=e.isSurveyCompleted,A=e.skipShownEvent,O=e.surveyLanguage,D=L_(null),N=Number.isInteger(y),B=function(e,t,r,i,s,o,a,l,u){var d=M_(i||0===r||e.type===Q_.ExternalSurvey),c=d[0],h=d[1],p=M_(!1),_=p[0],g=p[1],v=L_(!1),f=()=>{var t=()=>{o&&s(e),h(!1)};if(!v.current){var r=null==a?void 0:a.current;r?(v.current=!0,r.style.transition="opacity "+xv+"ms ease-out",r.style.opacity="0",setTimeout(()=>{v.current=!1,t()},250)):t()}},m=t=>{t.detail.surveyId===e.id&&f()};return F_(()=>{if(t){if(!i){var s,o=t=>{var r,i;if(t.detail.surveyId===e.id){if(null==(r=e.appearance)||!r.displayThankYouMessage)return f();g(!0),null!=(i=e.appearance)&&i.autoDisappear&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},a=()=>{if(Fg(e,t)){h(!0),mv.dispatchEvent(new Event("PHSurveyShown")),l||t.capture(J_.SHOWN,n({[X_.SURVEY_NAME]:e.name,[X_.SURVEY_ID]:e.id,[X_.SURVEY_ITERATION]:e.current_iteration,[X_.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},u&&{[X_.SURVEY_LANGUAGE]:u},{sessionRecordingUrl:null==t.get_session_replay_url?void 0:t.get_session_replay_url()}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};Ws(mv,"PHSurveyClosed",m),Ws(mv,"PHSurveySent",o);var d=r>0?setTimeout(a,r):void 0;return Rt(d)&&a(),()=>{Rt(d)||clearTimeout(d),Rt(s)||clearTimeout(s),mv.removeEventListener("PHSurveyClosed",m),mv.removeEventListener("PHSurveySent",o)}}}else rg.error("usePopupVisibility hook called without a PostHog instance.")},[]),Ev({survey:e,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:i,posthog:t}),{isPopupVisible:c,isSurveySent:_,setIsPopupVisible:h,hidePopupWithAnimation:f}}(_,v,null!=(t=_.appearance)&&t.surveyPopupDelaySeconds?1e3*_.appearance.surveyPopupDelaySeconds:0,N,S,k,D,A,O),q=B.isPopupVisible,H=B.hidePopupWithAnimation,U=B.isSurveySent||y===_.questions.length||!0===L,W=M_(!1),z=W[0],V=W[1],j=A_(()=>!!Og(_),[_]),G=!!(null!=(r=_.appearance)&&r.introScreenHeader||null!=(i=_.appearance)&&i.introScreenDescription),Q=N?-1===y:!(null==(s=_.appearance)||!s.displayIntroScreen)&&G&&!z&&!j,K=A_(()=>{var e,t=(null==(e=Og(_))?void 0:e.surveySubmissionId)||va();return{isPreviewMode:N,previewPageIndex:y,onPopupSurveyDismissed(){O?wg(_,v,N,O):wg(_,v,N),R()},isPopup:k||!1,surveySubmissionId:t,onPreviewSubmit:E,onPreviewBack:T,posthog:v,properties:F,surveyLanguage:O}},[N,y,k,v,_,R,E,T,F,O]);return q?Hg(Rg.Provider,{value:K,children:Hg("div",{className:"ph-survey",style:n({},$g(_.type,null==(o=_.appearance)?void 0:o.position,null==(a=_.appearance)?void 0:a.widgetType),m),ref:D,children:U?Hg(tv,{header:(null==(l=_.appearance)?void 0:l.thankYouMessageHeader)||"Thank you!",description:(null==(u=_.appearance)?void 0:u.thankYouMessageDescription)||"",forceDisableHtml:!!g,contentType:null==(d=_.appearance)?void 0:d.thankYouMessageDescriptionContentType,appearance:_.appearance||gg,onClose(){H(),M()}}):Q?Hg(rv,{header:(null==(c=_.appearance)?void 0:c.introScreenHeader)||"",description:(null==(h=_.appearance)?void 0:h.introScreenDescription)||"",forceDisableHtml:!!g,contentType:null==(p=_.appearance)?void 0:p.introScreenDescriptionContentType,appearance:_.appearance||gg,onStart:()=>V(!0)}):Hg(Rv,{survey:_,forceDisableHtml:!!g,posthog:v})})}):null}function Rv(e){var t,r,i=e.survey,s=e.forceDisableHtml,o=e.posthog,a=A_(()=>{var e=Og(i);if(!e)return null;var t=At(e.lastQuestionIndex);return!t||t&&e.lastQuestionIndex>=0&&i.questions.length>e.lastQuestionIndex?e:(Ng(i),null)},[i]),l=M_(()=>(null!=a&&a.responses&&rg.info("Survey is already in progress, filling in initial responses"),(null==a?void 0:a.responses)||{})),u=l[0],d=l[1],c=O_(Rg),h=c.previewPageIndex,p=c.onPopupSurveyDismissed,_=c.isPopup,g=c.onPreviewSubmit,v=c.onPreviewBack,f=c.surveySubmissionId,m=c.isPreviewMode,y=c.properties,b=c.surveyLanguage,S=M_(()=>{var e=null==a?void 0:a.lastQuestionIndex,t=At(e)&&e>=0&&i.questions.length>e?e:0;return At(h)&&h>=0?h:t}),w=S[0],k=S[1],C=M_(()=>{var e;return(null!==(e=null==a?void 0:a.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&i.questions.length>e)}),E=C[0],x=C[1],T=M_(()=>{var e,t;return null!==(e=null==(t=Og(i))?void 0:t.questionSnapshots)&&void 0!==e?e:{}}),I=T[0],R=T[1],P=A_(()=>xg(Tg(i,a)),[i.id,a]),M=A_(()=>{if(!P||new Set(P).size!==P.length)return Tg(i,a);var e=new Map(i.questions.map(e=>[e.id,e])),t=P.map(t=>e.get(t)).filter(e=>!!e);return t.length===P.length?t:i.questions},[P,i.questions,i,a]);F_(()=>{!m||Rt(h)||0>h||k(h)},[h,m]);var F=!(null==(t=i.appearance)||!t.allowGoBack)&&(m?(null!=h?h:0)>0:E.length>0),L=M.at(w);return L?Hg("form",{className:"survey-form",name:"surveyForm",children:[_&&!0!==(null==(r=i.appearance)?void 0:r.hideCancelButton)&&Hg(Xg,{onClick(){p()}}),Hg("div",{className:"survey-box","data-question-index":w,children:Mv({question:L,forceDisableHtml:s,displayQuestionIndex:w,appearance:i.appearance||gg,onSubmit:e=>(e=>{var t=e.res,r=e.displayQuestionIndex,s=e.questionId;if(o)if(s){var a=Ha(s),l=n({},u,{[a]:t});d(l);var c=M[r],h=null!=c&&c.id?n({},I,{[c.id]:c.question}):I;R(h);var p=gv(i,r,t),_=p===Z_.End,g=[...E,r];if(_||(x(g),k(p),Ag(i,{surveySubmissionId:f,responses:l,lastQuestionIndex:p,questionOrder:xg(M),visitedIndices:g,surveyLanguage:b,questionSnapshots:h})),i.enable_partial_responses||_){var v=new Set(g.map(e=>{var t;return null==(t=M[e])?void 0:t.id}).filter(e=>!!e).map(e=>Ha(e)));bg({responses:Object.fromEntries(Object.entries(l).filter(e=>v.has(e[0]))),survey:i,surveySubmissionId:f,isSurveyCompleted:_,posthog:o,properties:y,surveyLanguage:b,questionSnapshots:h})}}else rg.error("onNextButtonClick called without a questionId.");else rg.error("onNextButtonClick called without a PostHog instance.")})({res:e,displayQuestionIndex:w,questionId:L.id}),onPreviewSubmit:g,initialValue:L.id?u[Ha(L.id)]:void 0,canGoBack:F,onBack(){if(m)v();else if(0!==E.length){var e=E[E.length-1],t=E.slice(0,-1);x(t),k(e),Ag(i,{surveySubmissionId:f,responses:u,lastQuestionIndex:e,questionOrder:xg(M),visitedIndices:t,surveyLanguage:b,questionSnapshots:I})}}})})]}):null}function Pv(e){var t,r,i,s,n,o,a,l=e.survey,u=e.forceDisableHtml,d=e.posthog,c=e.readOnly,h=e.surveyLanguage,p=M_(!0),_=p[0],g=p[1],v=M_(!1),f=v[0],m=v[1],y=M_({}),b=y[0],S=y[1],w=L_(void 0),k=()=>{m(!f)};if(F_(()=>{var e;if(d){if(!c){"tab"===(null==(e=l.appearance)?void 0:e.widgetType)&&S({top:"50%",bottom:"auto"});var t=e=>{var t,r=e;(null==(t=r.detail)?void 0:t.surveyId)===l.id&&(rg.info("Received show event for feedback button survey "+l.id),S(r.detail.position||{}),k())};return Ws(mv,bv,t),()=>{Rt(w.current)||(clearTimeout(w.current),w.current=void 0),mv.removeEventListener(bv,t)}}}else rg.error("FeedbackWidget called without a PostHog instance.")},[d,c,l.id,null==(t=l.appearance)?void 0:t.widgetType,null==(r=l.appearance)?void 0:r.widgetSelector,null==(i=l.appearance)?void 0:i.borderColor]),Ev({survey:l,setSurveyVisible:g,posthog:d}),!_)return null;var C=()=>{l.schedule!==Y_.Always&&g(!1),Rt(w.current)||clearTimeout(w.current),w.current=setTimeout(()=>{w.current=void 0,m(!1)},200)};return Hg(e_,{children:["tab"===(null==(s=l.appearance)?void 0:s.widgetType)&&Hg("button",{className:"ph-survey-widget-tab "+((null==(n=l.appearance)?void 0:n.tabPosition)===G_.Top?"widget-tab-top":""),onClick:k,disabled:c,style:Tv(null==(o=l.appearance)?void 0:o.tabPosition),children:(null==(a=l.appearance)?void 0:a.widgetLabel)||""}),f&&Hg(Iv,{posthog:d,survey:l,forceDisableHtml:u,style:b,onPopupSurveyDismissed:C,onCloseConfirmationMessage:C,surveyLanguage:h})]})}var Mv=e=>{var t=e.question,r=e.displayQuestionIndex,i=e.onSubmit,s=e.onPreviewSubmit,o={forceDisableHtml:e.forceDisableHtml,appearance:e.appearance,onPreviewSubmit(e){s(e)},onSubmit(e){i(e)},initialValue:e.initialValue,displayQuestionIndex:r,canGoBack:e.canGoBack,onBack:e.onBack};switch(t.type){case K_.Open:return Jp(sv,n({},o,{question:t,key:t.id}));case K_.Link:return Jp(nv,n({},o,{question:t,key:t.id}));case K_.Rating:return Jp(ov,n({},o,{question:t,key:t.id}));case K_.SingleChoice:case K_.MultipleChoice:return Jp(lv,n({},o,{question:t,key:t.id}));default:return rg.error("Unsupported question type: "+t.type),null}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.generateSurveys=Cv,b.extendPostHogWithSurveys=Cv;var Fv=e=>{for(;null!=(t=e)&&t.__rrweb_original__;){var t;e=e.__rrweb_original__}return e},Lv=1e4,Av=(e,t,r)=>r.remaining>0?t.length>r.remaining?(e.push(t.slice(0,r.remaining)),r.remaining=0,r.truncated=!0,!1):(e.push(t),r.remaining-=t.length,!0):(r.truncated=!0,!1),Ov=(e,t,r)=>{var i=JSON.stringify(e);if(r.remaining>=i.length)return Av(t,i,r);if(r.truncated=!0,2>r.remaining)return!1;for(var s=0,n=Math.min(e.length,r.remaining-2);n>s;){var o=Math.ceil((s+n)/2);JSON.stringify(e.slice(0,o)).length>r.remaining?n=o-1:s=o}return Av(t,JSON.stringify(e.slice(0,s)),r)},Dv=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Nv=(e,t,r)=>{if(!r.truncated){if(r.keysRemaining-=1,r.sizeRemaining-=String(t).length+e.length,0>=r.keysRemaining||0>=r.sizeRemaining)return r.truncated=!0,void(r.result.attributes_truncated=!0);r.result[e]=t}},Bv=(e,t,r)=>{if(!r.truncated)if(Tt(e)){if(r.seen.has(e))return void Nv(t||"circular","[Circular]",r);r.seen.add(e);try{for(var i in e)try{if(!{}.hasOwnProperty.call(e,i))continue;if(Bv(e[i],t?t+"."+i:i,r),r.truncated)return}catch(e){continue}}catch(e){}}else Nv(t,e,r)},$v=function(e,t,r,i,s,n){if(void 0===s&&(s=!1),!Dv(e))return!s||Av(t,"null",r);if(Ft(e)||(e=>{try{return At(e)||Dt(e)}catch(e){return!1}})(e))return Av(t,JSON.stringify(e),r);if("string"==typeof e)return Ov(e,t,r);if(!Tt(e)&&!Et(e))return Av(t,JSON.stringify(e),r);if(i.has(e))return Ov("[Circular]",t,r);i.add(e);try{var o=e.toJSON;if(xt(o))return $v(o.call(e),t,r,i,s)}catch(e){}try{var a={}.toString.call(e);if("[object String]"===a)return Ov(String(e.valueOf()),t,r);if("[object Number]"===a||"[object Boolean]"===a)return Av(t,JSON.stringify(e.valueOf()),r)}catch(e){}if(e instanceof Error){var l={};try{for(var u in e)({}).hasOwnProperty.call(e,u)&&(l[u]=e[u])}catch(e){}try{l.name=e.name}catch(e){}try{l.message=e.message}catch(e){}try{l.stack=e.stack}catch(e){}return $v(l,t,r,i,s,n)}if(Et(e)){if(!Av(t,"[",r))return!1;for(var d=0;e.length>d;d++){if(d>0&&!Av(t,",",r))return!1;var c=void 0;try{c=e[d]}catch(e){c=void 0}if(!$v(c,t,r,i,!0))return!1}return Av(t,"]",r)}if(!Av(t,"{",r))return!1;var h=!0;try{for(var p in e)if({}.hasOwnProperty.call(e,p)){if(0>=r.remaining)return r.truncated=!0,!1;var _=void 0;try{_=e[p]}catch(e){continue}if(n)try{Bv(_,p,n)}catch(e){}if(Dv(_)){var g=(h?"":",")+JSON.stringify(p)+":";if(g.length>=r.remaining)return r.truncated=!0,!1;var v=t.length,f=r.remaining,m=r.truncated;if(!Av(t,g,r))return!1;var y=t.length,b=$v(_,t,r,i,!1),S=r.truncated;if(t.length!==y){if(h=!1,!b)return!1}else if(t.length=v,r.remaining=f,r.truncated=b?m:S,!b)return!1}}}catch(e){}return Av(t,"}",r)},qv=(e,t)=>{for(var r=[],i={remaining:t,truncated:!1},s=Tt(e[0])?{result:{},keysRemaining:50,sizeRemaining:Lv,truncated:!1,seen:new WeakSet([e[0]])}:void 0,n=0;e.length>n&&(0>=n||Av(r," ",i))&&$v(e[n],r,i,new WeakSet,!1,0===n?s:void 0);n++);return{body:r.join("")+(i.truncated?"...":""),truncated:i.truncated,attributes:(null==s?void 0:s.result)||{}}},Hv={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Uv=e=>"canCapture"in e,Wv=e=>Uv(e)?e.canCapture?e.getExtension(dg):void 0:e.is_capturing()?e.logs:void 0;b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.logs={initializeLogs(e){var t=e,r=[],i={host:b.location.host},s=!1,o=function(e){var o=b.console[e];r.push(tp(b.console,e,r=>{var a=(r=>function(){for(var o=!1,a=arguments.length,l=new Array(a),u=0;a>u;u++)l[u]=arguments[u];try{var d=t;if(l.length>0&&!s&&d){var c=Wv(d);if(c){s=!0,o=!0;var h=qv(l,Lv),p=h.body,_=h.attributes,g=n({},i,h.truncated?{body_truncated:"true"}:{});((e,t,r)=>{if(Uv(e))t.captureConsoleLog(r);else{var i=(e=>{var t=/^1\.(\d+)\.(\d+)$/.exec(e);if(t){var r=Number(t[1]),i=Number(t[2]);if(r>=392&&419>=r)return 410===r?i>4?i>10?void 0:"de":"le":418===r?i>3?i>10?i>14?i>17?void 0:"vi":"ci":"ui":"he":419===r?i>2?void 0:"vi":410>r?"le":"he"}})(e.version),s=i?t[i]:void 0;xt(s)&&s.call(t,r)}})(d,c,{level:Hv[e],body:p,attributes:n({"log.source":"console."+e},g,_)})}}}catch(e){}finally{o&&(s=!1),r.apply(b.console,l)}})(r);return a.__rrweb_original__=Fv(o),a}))};for(var a of Object.keys(Hv))o(a);return()=>{t=void 0,r.forEach(e=>e())}},replayConsoleBuffer(e,t){var r=Wv(e);if(r)for(var i of t)try{var s=qv(i.args,Lv);null==r.captureBufferedConsoleLog||r.captureBufferedConsoleLog({level:Hv[i.level],body:s.body,attributes:n({"log.source":"console."+i.level,host:b.location.host},s.truncated?{body_truncated:"true"}:{},s.attributes)},i.context,i.occurredAtMs)}catch(e){}}};var zv=e=>Ut(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),Vv=Fs("[Error tracking]"),jv="webkit-masked-url:",Gv=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Qv=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",jv],Kv=["__firefox__","__gCrWeb"];function Zv(){return new pi([new Mi,new Hi,new Li,new Fi,new $i,new Bi,new Oi,new qi],function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];return function(t,i){void 0===i&&(i=0);for(var s=[],o=t.split("\n"),a=Math.min(o.length,i+1e3),l=[],u=i;a>u;u++){var d=o[u];if(1024>=d.length){var c=ki.test(d)?d.replace(ki,"$1"):d;if(!c.match(/\S*Error: /)){for(var h of r){var p=h(c,e);if(p){s.push(p);var _=Ei(s);if(_){for(var g=l.length-1;g>=0;g--){var v=l[g];if(_.start>=v.start+v.length)break;l.pop()}l.push(_)}break}}if(Ri(s,l)>=50)break}}}var f=[...l].sort((e,t)=>t.start-e.start),m=f[f.length-1];if(m){var y=Ti(s,m);for(var b of(s.splice(m.start-y,y),f))b.start-=y}for(var S of f)xi(s,S);return l.some(e=>0===e.start&&s.length===e.length)&&function(e){for(var t=e.map(e=>e.function+"|"+e.filename+"|"+e.lineno+"|"+e.colno+"|"+e.module),r=0,i=1;t.length>i;i++)Pi(t,i,r)&&(r=i);e.push(...e.splice(0,r))}(s),function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return n({},e,{filename:e.filename||(r=t,r[r.length-1]||{}).filename,function:e.function||"?"});var r})}(s)}}("web:javascript",yi,wi))}var Yv=Fs("[ExceptionAutocapture]"),Jv=Zv(),Xv=(e,t)=>{try{return e()}catch(e){return t}},ef=(e,t)=>Xv(()=>e(t()),void 0),tf=e=>Xv(()=>xt(e)&&xt(e.call),!1),rf=(e,t)=>Xv(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),sf=(e,t,r)=>{Xv(()=>{var r;null==(r=e[t])||delete r.__POSTHOG_INSTRUMENTED__},void 0),Xv(()=>{e[t]=r},void 0)},nf=e=>{var t=l;t||Yv.info("window not available, cannot wrap onerror");var r=Xv(()=>t.onerror,void 0);return t.onerror=function(){for(var t,i=arguments.length,s=new Array(i),n=0;i>n;n++)s[n]=arguments[n];return ef(e,()=>Jv.buildFromUnknown((e=>{var t=e[0],r=e[1],i=e[2],s=e[3],n=e[4];if(null!=n)return n;if(Pt(t)&&Pt(r)&&r.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:r,lineno:i,colno:s})}catch(e){return t}return t})(s),{mechanism:{handled:!1}})),!!tf(r)&&null!==(t=r(...s))&&void 0!==t&&t},rf(t,"onerror"),()=>sf(t,"onerror",r)},of=function(e,t){void 0===t&&(t=!1);var r=l;r||Yv.info("window not available, cannot wrap onUnhandledRejection");var i=Xv(()=>r.onunhandledrejection,void 0);return r.onunhandledrejection=function(r){var s;return ef(e,()=>Jv.buildFromUnknown(r,{mechanism:{handled:!1}})),tf(i)?null!==(s=i(r))&&void 0!==s&&s:t},rf(r,"onunhandledrejection"),()=>sf(r,"onunhandledrejection",i)},af={wrapOnError:nf,wrapUnhandledRejection:of,wrapConsoleError(e){var t=console;t||Yv.info("console not available, cannot wrap console.error");var r=Xv(()=>t.error,void 0);return t.error=function(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];ef(e,()=>{var e;e=1==i.length?i[0]:i.join(" ");var t=i.find(e=>e instanceof Error);return Jv.buildFromUnknown(t||e,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),tf(r)&&r(...i)},rf(t,"error"),()=>sf(t,"error",r)}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.errorWrappingFunctions=af,b.posthogErrorWrappingFunctions=af;var lf=(e,t)=>{if(xt(null==e?void 0:e.capture)){var r=null==t?void 0:t.autocaptureExceptions,i=!Ft(r)&&"object"==typeof r&&Et(r.errors_to_ignore)?r.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){Yv.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],s=t=>{try{null==e.capture||e.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){Yv.error("Failed to capture exception for a legacy client",e)}};nf(e=>{i.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||s(e)}),of(s,!0)}};b.extendPostHogWithExceptionAutoCapture=lf,b.extendPostHogWithExceptionAutocapture=lf;var uf="X-POSTHOG-SESSION-ID",df="X-POSTHOG-WINDOW-ID",cf="X-POSTHOG-DISTINCT-ID",hf=[uf,df,cf],pf=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],_f=(e,t)=>({}.hasOwnProperty.call(e,t)),gf=e=>"object"==typeof e&&!Ft(e)||xt(e),vf=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),ff=e=>{try{var t;return vf(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==l||null==(t=l.location)?void 0:t.href).toString()}catch(e){return}},mf=(e,t,r,i,s)=>{var n;try{n=new URL(i).hostname}catch(e){return!1}if(!e)return!1;if(Et(e)&&!e.includes(n))return!1;var o=!1;if(r){var a=r.checkAndGetSessionAndWindowId(!0),l=a.windowId;s.set(uf,a.sessionId),s.set(df,l),o=!0}var u=(e=>xt(e)?e():e)(t);return u&&"$posthog_cookieless"!==u&&(s.set(cf,u),o=!0),o};b.__PosthogExtensions__=b.__PosthogExtensions__||{};var yf={_patchFetch:(e,t,r)=>tp(l,"fetch",i=>function(s,o){var a=arguments.length>1?[s,o]:[s],l=a;try{var u=ff(s);if(u)if(vf(s)){var d=new Request(s,o);mf(e,t,r,d.url,d.headers),l=[d]}else{var c=new Headers(gf(o)?o.headers:void 0);if(mf(e,t,r,u,c)){var h=((e,t)=>{if(Rt(e)||Ft(e))return{headers:t};if(gf(e)){var r=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){var i=Object.create(r);return Object.defineProperty(i,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),i}return new Proxy({headers:t},{get:(e,t)=>_f(e,t)?Reflect.get(e,t):Reflect.get(r,t,r),has:(e,t)=>_f(e,t)||t in r,ownKeys(e){var t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(r).forEach(e=>t.add(e)),pf.forEach(e=>{e in r&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){var i=Reflect.getOwnPropertyDescriptor(e,t);if(i)return i;if("string"==typeof t&&pf.includes(t)&&t in r)return{configurable:!0,enumerable:!0,get(){return Reflect.get(r,t,r)}};var s=Reflect.getOwnPropertyDescriptor(r,t);return s?n({},s,{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(r)})}})(o,c);h&&(l=[s,h])}}}catch(e){l=a}return i.apply(this,l)}),_patchXHR:(e,t,r)=>tp(l.XMLHttpRequest.prototype,"open",i=>function(s,n,o,a,l){void 0===o&&(o=!0);var u=this,d=new Headers,c=ff(n);c&&mf(e,t,r,c,d);var h=i.call(u,s,n,o,a,l);return hf.forEach(e=>{var t=d.get(e);if(t)try{u.setRequestHeader(e,t)}catch(e){}}),h})};b.__PosthogExtensions__.tracingHeadersPatchFns=yf,b.postHogTracingHeadersPatchFns=yf,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){var t=this.length,r=Math.trunc(e)||0;return 0>r&&(r+=t),0>r||r>=t?void 0:this[r]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(var r=this.length-1;r>=0;r--){var i=this[r];if(e.call(t,i,r,this))return i}},writable:!0,enumerable:!1,configurable:!0});var bf=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(!e.hadRecentInput){var r=this.i[0],i=this.i.at(-1);this.o&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null==(t=this.t)||t.call(this,e)}}},Sf=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},wf=e=>{if("loading"===document.readyState)return"loading";var t=Sf();if(t){if(t.domInteractive>e)return"loading";if(0===t.domContentLoadedEventStart||t.domContentLoadedEventStart>e)return"dom-interactive";if(0===t.domComplete||t.domComplete>e)return"dom-content-loaded"}return"complete"},kf=e=>{var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Cf=e=>{var t="";try{for(;9!==(null==(r=e)?void 0:r.nodeType);){var r,i,s=e,n=s.id?"#"+s.id:[kf(s),...Array.from(null!==(i=s.classList)&&void 0!==i?i:[]).sort()].join(".");if(t.length+n.length>99)return t||n;if(t=t?n+">"+t:n,s.id)break;e=s.parentNode}}catch(e){}return t},Ef=new WeakMap;function xf(e,t){var r=Ef.get(t);return r||Ef.set(t,r=new WeakMap),r.get(e)||r.set(e,new t),r.get(e)}var Tf,If=-1,Rf=()=>If,Pf=e=>{addEventListener("pageshow",t=>{t.persisted&&(If=t.timeStamp,e(t))},!0)},Mf=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},Ff=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Lf=()=>{var e,t;return null!==(e=null==(t=Sf())?void 0:t.activationStart)&&void 0!==e?e:0},Af=-1,Of=new Set,Df=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Nf=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of Of)t();isFinite(Af)||(Af="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Nf,!0))}},Bf=function(e){if(void 0===e&&(e=!1),e&&(Af=1/0),0>Af){var t,r,i=Lf();Af=null!==(t=document.prerendering||null==(r=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=i))?void 0:r.startTime)&&void 0!==t?t:Df(),addEventListener("visibilitychange",Nf,!0),addEventListener("prerenderingchange",Nf,!0),Pf(()=>{setTimeout(()=>{Af=Df()})})}return{get firstHiddenTime(){return Af},onHidden(e){Of.add(e)}}},$f=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=Sf(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>Rf()?a&&(document.prerendering||Lf()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},qf=function(e,t,r){void 0===r&&(r={});try{var i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){var s=new PerformanceObserver(e=>{queueMicrotask(()=>{var r=e.getEntries();i.length>1&&r.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(r)})});for(var o of i)s.observe(n({type:o,buffered:!0},r));return s}}catch(e){}},Hf=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Uf=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Wf=e=>{var t=!1;return()=>{t||(e(),t=!0)}},zf=class{constructor(){this.u=void 0}},Vf=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},jf=[1800,3e3],Gf=function(e,t){void 0===t&&(t={});var r=Hf(t);Vf(()=>{var i,s=xf(t,zf),n=Bf(),o=$f("FCP"),a=qf(["paint"],e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Lf(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))});a&&(i=Mf(e,o,jf,t.reportAllChanges),Pf(r=>{o=$f("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Rf()),i=Mf(e,o,jf,t.reportAllChanges),Ff(()=>{o.value=performance.now()-r.timeStamp,i(!0)})})),r&&qf(["soft-navigation"],r=>{r.forEach(r=>{s.u&&r.navigationId&&Uf(s.u,r),o=$f("FCP",Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0),"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=Mf(e,o,jf,t.reportAllChanges))(!0)})},t)})},Qf=[.1,.25],Kf=e=>e.find(e=>{var t;return 1===(null==(t=e.node)?void 0:t.nodeType)})||e[0],Zf=function(e,t){void 0===t&&(t={});var r=xf(t=Object.assign({},t),bf),i=new WeakMap;r.t=e=>{var r;if(null!=e&&null!=(r=e.sources)&&r.length){var s=Kf(e.sources),n=null==s?void 0:s.node;if(n){var o,a=null!==(o=null==t.generateTarget?void 0:t.generateTarget(n))&&void 0!==o?o:Cf(n);i.set(s,a)}}},function(e,t){void 0===t&&(t={});var r=Bf();Gf(Wf(()=>{var i,s=$f("CLS",0),n=xf(t,bf),o=(r,o,a,l,u)=>{s=$f("CLS",0,r,o,a,l,u),n.o=0,i=Mf(e,s,Qf,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.o>s.value&&(s.value=n.o,s.entries=n.i),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?n.l(t):l(t);a()},d=["layout-shift"];Hf(t)&&d.push("soft-navigation");var c=qf(d,u);c&&(i=Mf(e,s,Qf,t.reportAllChanges),r.onHidden(()=>{u(c.takeRecords()),i(!0)}),Pf(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,Rf()),Ff(i)}),setTimeout(i))}))}(t=>{e((e=>{var t={};if(e.entries.length){var r,s=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null!=s&&null!=(r=s.sources)&&r.length){var n=Kf(s.sources);n&&(t={largestShiftTarget:i.get(n),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:n,largestShiftEntry:s,loadState:wf(s.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},Yf=function(e,t){void 0===t&&(t={});var r=xf(t=Object.assign({},t),zf);Hf(t)&&(r.u=new Map),Gf(t=>{e((e=>{var t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:wf(Rf())};if("soft-navigation"!==e.navigationType){if(e.entries.length){var i=Sf(),s=e.entries.at(-1);if(i){var n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:wf(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}else{var o,a=null==(o=r.u)?void 0:o.get(e.navigationId);a&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:a})}return Object.assign(e,{attribution:t})})(t))},t)},Jf=0,Xf=1/0,em=0,tm=e=>{for(var t of e)t.interactionId&&(Xf=Math.min(Xf,t.interactionId),em=Math.max(em,t.interactionId),Jf=em?(em-Xf)/7+1:0)},rm=()=>{var e;return Tf?Jf:null!==(e=performance.interactionCount)&&void 0!==e?e:0},im=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return rm()-this.h}D(){this.h=rm(),this.v.length=0,this.p.clear()}S(e){var t=this.T(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{k:8,id:-1,entries:[]}}l(e){var t;if(null!=(t=this.m)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.p.get(e.interactionId);if(i||10>this.v.length||e.duration>r.k){var s;if(i?e.duration>i.k?(i.entries=[e],i.k=e.duration):e.duration===i.k&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.p.set((i={id:e.interactionId,entries:[e],k:e.duration}).id,i),this.v.push(i)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10)for(var n of this.v.splice(10))this.p.delete(n.id);null==(s=this.M)||s.call(this,i)}}}},sm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=Wf(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},nm=[200,500],om=function(e,t){void 0===t&&(t={});var r=xf(t=Object.assign({},t),im),i=[],s=[],o=0,a=new WeakMap,l=new WeakMap,u=!1,d=()=>{u||(sm(c),u=!0)},c=()=>{var e=new Set(r.v.map(e=>a.get(e.entries[0]))),t=s.length-10;s=s.filter((r,i)=>i>=t||e.has(r));var n=new Set;for(var l of s)for(var d of h(l.startTime,l.processingEnd))n.add(d);i=i.filter(e=>e.startTime>o||n.has(e)),u=!1};r.m=e=>{var r,i=e.startTime+e.duration;o=Math.max(o,e.processingEnd);for(var n=s.length-1;n>=0;n--){var l=s[n];if(8>=Math.abs(i-l.renderTime)){(r=l).startTime=Math.min(e.startTime,r.startTime),r.processingStart=Math.min(e.processingStart,r.processingStart),r.processingEnd=Math.max(e.processingEnd,r.processingEnd),t.includeProcessedEventEntries&&r.entries.push(e);break}}r||s.push(r={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]}),e.interactionId&&a.set(e,r),d()},r.M=e=>{if(!l.get(e)){var r,i=null==(r=e.entries.find(e=>e.target))?void 0:r.target;if(i){var s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(i))&&void 0!==s?s:Cf(i);l.set(e,n)}else{var o,a=null==(o=e.entries.find(e=>e.targetSelector))?void 0:o.targetSelector;a&&l.set(e,a)}}};var h=(e,t)=>{var r=[];for(var s of i)if(s.startTime+s.duration>=e){if(s.startTime>t)break;r.push(s)}return r};qf(["long-animation-frame"],e=>{i=i.concat(e),d()},t),function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=Bf();Vf(()=>{var i;"interactionCount"in performance||Tf||(Tf=qf(["event"],tm,{durationThreshold:0}));var s,o=$f("INP"),a=xf(t,im),l=(r,i,n,l,u)=>{a.D(),o=$f("INP",-1,r,i,n,l,u),s=Mf(e,o,nm,t.reportAllChanges)},u=()=>{var e=a.S(o.navigationType);e&&e.k!==o.value&&(o.value=e.k,o.entries=e.entries,s())},d=e=>{u(),s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),sm(()=>{for(var r of e)"soft-navigation"!==r.entryType?a.l(r):d(r);u(),t&&s(!0)})},h=["event","first-input"];Hf(t)&&h.push("soft-navigation");var p=qf(h,c,n({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=Mf(e,o,nm,t.reportAllChanges),p&&(r.onHidden(()=>{c(p.takeRecords(),!0)}),Pf(()=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Rf())}))})}}(t=>{e((e=>{if(0===e.entries.length){var t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:wf(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}var i=e.entries[0],s=a.get(i),n=Math.max(s.processingStart,i.startTime),o=Math.max(i.startTime+i.duration,n),u=Math.min(s.processingEnd,o),d=s.entries.sort((e,t)=>e.processingStart-t.processingStart),c=h(i.startTime,u),p=r.p.get(i.interactionId),_={interactionTarget:l.get(p),interactionType:i.name.startsWith("key")?"keyboard":"pointer",interactionTime:i.startTime,nextPaintTime:o,processedEventEntries:d,longAnimationFrameEntries:c,inputDelay:n-i.startTime,processingDuration:u-n,presentationDelay:o-u,loadState:wf(i.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return((e,t)=>{var r=e.interactionTime,i=e.nextPaintTime;if(null!=(t=e.longAnimationFrameEntries)&&t.length&&r&&i){var s,n,o=e.inputDelay,a=e.processingDuration,l=0,u=0,d=0,c=0;for(var h of e.longAnimationFrameEntries)for(var p of(u=u+h.startTime+h.duration-h.styleAndLayoutStart,h.scripts)){var _=p.startTime+p.duration;if(_>=r){var g=_-Math.max(r,p.startTime),v=p.duration?g/p.duration*p.forcedStyleAndLayoutDuration:0;l+=g-v,u+=v,g>c&&(n=r+o>p.startTime?"input-delay":r+o+a>p.startTime?"processing-duration":"presentation-delay",s=p,c=g)}}var f=e.longAnimationFrameEntries.at(-1),m=f?f.startTime+f.duration:0;m>=r+o+a&&(d=i-m),s&&n&&(e.longestScript={entry:s,subpart:n,intersectingDuration:c}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=u,e.totalPaintDuration=d,e.totalUnattributedDuration=i-r-l-u-d}})(_),Object.assign(e,{attribution:_})})(t))},t)},am=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null==(t=this.m)||t.call(this,e)}},$=[2500,4e3],lm=50,um=[];qf(["resource"],e=>{for(var t of e)um.push(t),um.length>lm&&um.shift()});var dm=function(e,t){void 0===t&&(t={}),null!=(t=Object.assign({},t)).resourceBufferSize&&(lm=t.resourceBufferSize);var r=xf(t,am),i=new WeakMap;Hf(t)&&(r.u=new Map),r.m=e=>{var r=e.element;if(r){var s,n=null!==(s=null==t.generateTarget?void 0:t.generateTarget(r))&&void 0!==s?s:Cf(r);i.set(e,n)}else e.id&&i.set(e,"#"+e.id)},function(e,t){void 0===t&&(t={});var r=!1,i=Hf(t);Vf(()=>{var s,n=Bf(),o=$f("LCP"),a=xf(t,am),l=(i,a,l,u,d)=>{o=$f("LCP",-1,i,a,l,u,d),s=Mf(e,o,$,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=Bf(!0))},u=e=>{a.u&&e.navigationId&&Uf(a.u,e),r||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&d([t])},d=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,d=[],c=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-Lf(),0),a.l(r),d=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;c=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(c-r.startTime,0),p.largestContentfulPaint&&(a.l(p.largestContentfulPaint),d=[p.largestContentfulPaint])}n.firstHiddenTime>c&&(o.value=l,o.entries=d,s())}else u(r)},c=["largest-contentful-paint"];i&&c.push("interaction-contentful-paint","soft-navigation");var h=qf(c,d);if(h){s=Mf(e,o,$,t.reportAllChanges);var p=["keydown","click","visibilitychange"],_=e=>{if(e.isTrusted&&!r){var t=o.id;sm(()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,_,{capture:!0});t===o.id&&(r=!0,s(!0))}})}};for(var g of p)addEventListener(g,_,{capture:!0});Pf(i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Rf()),s=Mf(e,o,$,t.reportAllChanges),Ff(()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)})})}})}(t=>{e((e=>{var t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var s,o,a,l,u,d,c=e.entries.at(-1),h=c.url&&(um.findLast(e=>e.name===c.url)||performance.getEntriesByType("resource").findLast(e=>e.name===c.url));t.target=i.get(c),t.lcpEntry=c,c.url&&(t.url=c.url),h&&(t.lcpResourceEntry=h);var p=0,_=0;if("soft-navigation"!==e.navigationType?(p=null!==(s=null==(o=d=Sf())?void 0:o.activationStart)&&void 0!==s?s:0,_=null!==(a=null==(l=d)?void 0:l.responseStart)&&void 0!==a?a:0):(p=e.navigationStartTime||0,d=null==(u=r.u)?void 0:u.get(e.navigationId)),d){var g=Math.max(0,_-p),v=Math.max(g,h?(h.requestStart||h.startTime)-p:0),f=Math.min(e.value,Math.max(v,h?h.responseEnd-p:0));t=n({},t,{timeToFirstByte:g,resourceLoadDelay:v-g,resourceLoadDuration:f-v,elementRenderDelay:e.value-f,navigationEntry:d})}}return Object.assign(e,{attribution:t})})(t))},t)},cm=-1,hm=()=>cm,pm=e=>{addEventListener("pageshow",t=>{t.persisted&&(cm=t.timeStamp,e(t))},!0)},_m=(e,t,r,i)=>{var s,n;return o=>{t.value>=0&&(o||i)&&((n=t.value-(null!=s?s:0))||void 0===s)&&(s=t.value,t.delta=n,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,r),e(t))}},gm=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},vm=()=>{var e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},fm=()=>{var e,t;return null!==(e=null==(t=vm())?void 0:t.activationStart)&&void 0!==e?e:0},mm=-1,ym=new Set,bm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Sm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(var t of ym)t();isFinite(mm)||(mm="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Sm,!0))}},wm=function(e){if(void 0===e&&(e=!1),e&&(mm=1/0),0>mm){var t,r,i=fm();mm=null!==(t=document.prerendering||null==(r=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=i))?void 0:r.startTime)&&void 0!==t?t:bm(),addEventListener("visibilitychange",Sm,!0),addEventListener("prerenderingchange",Sm,!0),pm(()=>{setTimeout(()=>{mm=bm()})})}return{get firstHiddenTime(){return mm},onHidden(e){ym.add(e)}}},km=function(e,t,r,i,s,n,o){void 0===t&&(t=-1),void 0===i&&(i=0);var a=vm(),l=(null==a?void 0:a.navigationId)||0,u="navigate";return r?u=r:0>hm()?a&&(document.prerendering||fm()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:"v6-"+Date.now()+"-"+(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:i||l,navigationInteractionId:s,navigationURL:n||(null==a?void 0:a.name),navigationStartTime:o||0}},Cm=new WeakMap;function Em(e,t){var r=Cm.get(t);return r||Cm.set(t,r=new WeakMap),r.get(e)||r.set(e,new t),r.get(e)}var xm,Tm=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(!e.hadRecentInput){var r=this.o[0],i=this.o.at(-1);this.i&&r&&i&&1e3>e.startTime-i.startTime&&5e3>e.startTime-r.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null==(t=this.t)||t.call(this,e)}}},Im=function(e,t,r){void 0===r&&(r={});try{var i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){var s=new PerformanceObserver(e=>{queueMicrotask(()=>{var r=e.getEntries();i.length>1&&r.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(r)})});for(var o of i)s.observe(n({type:o,buffered:!0},r));return s}}catch(e){}},Rm=e=>{var t,r;return(null==(t=globalThis.PerformanceObserver)||null==(t=t.supportedEntryTypes)?void 0:t.includes("soft-navigation"))&&"function"==typeof(null==(r=globalThis.PerformanceSoftNavigation)||null==(r=r.prototype)?void 0:r.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Pm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){var r=e.keys().next().value;void 0!==r&&e.delete(r)}},Mm=e=>{var t=!1;return()=>{t||(e(),t=!0)}},Fm=class{constructor(){this.l=void 0}},Lm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Am=[1800,3e3],Om=function(e,t){void 0===t&&(t={});var r=Rm(t);Lm(()=>{var i,s=Em(t,Fm),n=wm(),o=km("FCP"),a=Im(["paint"],e=>{for(var t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-fm(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,i(!0)))});a&&(i=_m(e,o,Am,t.reportAllChanges),pm(r=>{o=km("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,hm()),i=_m(e,o,Am,t.reportAllChanges),gm(()=>{o.value=performance.now()-r.timeStamp,i(!0)})})),r&&Im(["soft-navigation"],r=>{r.forEach(r=>{s.l&&r.navigationId&&Pm(s.l,r),o=km("FCP",Math.max((r.presentationTime||r.paintTime||0)-r.startTime,0),"soft-navigation",r.navigationId,r.interactionId,r.name,r.startTime),(i=_m(e,o,Am,t.reportAllChanges))(!0)})},t)})},Dm=[.1,.25],Nm=function(e,t){void 0===t&&(t={});var r=wm();Om(Mm(()=>{var i,s=km("CLS",0),n=Em(t,Tm),o=(r,o,a,l,u)=>{s=km("CLS",0,r,o,a,l,u),n.i=0,i=_m(e,s,Dm,t.reportAllChanges)},a=function(e){void 0===e&&(e=!1),n.i>s.value&&(s.value=n.i,s.entries=n.o),i(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(var t of e)"soft-navigation"!==t.entryType?n.h(t):l(t);a()},d=["layout-shift"];Rm(t)&&d.push("soft-navigation");var c=Im(d,u);c&&(i=_m(e,s,Dm,t.reportAllChanges),r.onHidden(()=>{u(c.takeRecords()),i(!0)}),pm(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,hm()),gm(i)}),setTimeout(i))}))},Bm=0,$m=1/0,qm=0,Hm=e=>{for(var t of e)t.interactionId&&($m=Math.min($m,t.interactionId),qm=Math.max(qm,t.interactionId),Bm=qm?(qm-$m)/7+1:0)},Um=()=>{var e;return xm?Bm:null!==(e=performance.interactionCount)&&void 0!==e?e:0},Wm=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Um()-this.u}M(){this.u=Um(),this.v.length=0,this.m.clear()}L(e){var t=this._(),r=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==r||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[r]:{P:8,id:-1,entries:[]}}h(e){var t;if(null!=(t=this.p)&&t.call(this,e),e.interactionId){var r=this.v.at(-1),i=this.m.get(e.interactionId);if(i||10>this.v.length||e.duration>r.P){var s;if(i?e.duration>i.P?(i.entries=[e],i.P=e.duration):e.duration===i.P&&e.startTime===i.entries[0].startTime&&i.entries.push(e):(this.m.set((i={id:e.interactionId,entries:[e],P:e.duration}).id,i),this.v.push(i)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10)for(var n of this.v.splice(10))this.m.delete(n.id);null==(s=this.T)||s.call(this,i)}}}},zm=e=>{var t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{var s=Mm(e),n=-1,o=()=>{i(n),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),n=r(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:t})}},Vm=[200,500],jm=function(e,t){if(void 0===t&&(t={}),globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype){var r=wm();Lm(()=>{var i;"interactionCount"in performance||xm||(xm=Im(["event"],Hm,{durationThreshold:0}));var s,o=km("INP"),a=Em(t,Wm),l=(r,i,n,l,u)=>{a.M(),o=km("INP",-1,r,i,n,l,u),s=_m(e,o,Vm,t.reportAllChanges)},u=()=>{var e=a.L(o.navigationType);e&&e.P!==o.value&&(o.value=e.P,o.entries=e.entries,s())},d=e=>{u(),s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=function(e,t){void 0===t&&(t=!1),zm(()=>{for(var r of e)"soft-navigation"!==r.entryType?a.h(r):d(r);u(),t&&s(!0)})},h=["event","first-input"];Rm(t)&&h.push("soft-navigation");var p=Im(h,c,n({},t,{durationThreshold:null!==(i=t.durationThreshold)&&void 0!==i?i:40}));s=_m(e,o,Vm,t.reportAllChanges),p&&(r.onHidden(()=>{c(p.takeRecords(),!0)}),pm(()=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,hm())}))})}},Gm=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null==(t=this.p)||t.call(this,e)}},Qm=[2500,4e3],Km=function(e,t){void 0===t&&(t={});var r=!1,i=Rm(t);Lm(()=>{var s,n=wm(),o=km("LCP"),a=Em(t,Gm),l=(i,a,l,u,d)=>{o=km("LCP",-1,i,a,l,u,d),s=_m(e,o,Qm,t.reportAllChanges),r=!1,"soft-navigation"===i&&(n=wm(!0))},u=e=>{a.l&&e.navigationId&&Pm(a.l,e),r||s(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);var t=null==e.getLargestInteractionContentfulPaint?void 0:e.getLargestInteractionContentfulPaint();t&&d([t])},d=e=>{for(var r of(t.reportAllChanges||i||(e=e.slice(-1)),e))if(r)if("soft-navigation"!==r.entryType){var l=0,d=[],c=r.startTime;if("largest-contentful-paint"===r.entryType)l=Math.max(r.startTime-fm(),0),a.h(r),d=[r];else if("interaction-contentful-paint"===r.entryType){var h,p=r;if(!o.navigationId)continue;if("interactionId"in p&&p.interactionId!=o.navigationInteractionId)continue;c=(null==(h=p.largestContentfulPaint)?void 0:h.renderTime)||0,l=Math.max(c-r.startTime,0),p.largestContentfulPaint&&(a.h(p.largestContentfulPaint),d=[p.largestContentfulPaint])}n.firstHiddenTime>c&&(o.value=l,o.entries=d,s())}else u(r)},c=["largest-contentful-paint"];i&&c.push("interaction-contentful-paint","soft-navigation");var h=Im(c,d);if(h){s=_m(e,o,Qm,t.reportAllChanges);var p=["keydown","click","visibilitychange"],_=e=>{if(e.isTrusted&&!r){var t=o.id;zm(()=>{if(!r){if(!i)for(var e of(h.disconnect(),p))removeEventListener(e,_,{capture:!0});t===o.id&&(r=!0,s(!0))}})}};for(var g of p)addEventListener(g,_,{capture:!0});pm(i=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,hm()),s=_m(e,o,Qm,t.reportAllChanges),gm(()=>{o.value=performance.now()-i.timeStamp,r=!0,s(!0)})})}})},Zm={onLCP:dm,onCLS:Zf,onFCP:Yf,onINP:om,withoutAttribution:{onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=Zm,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Zm,b.postHogWebVitalsCallbacks=Zm;var Ym={onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Ym,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Ym,b.postHogWebVitalsCallbacks=Ym,b.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Ym;var Jm={onLCP:dm,onCLS:Zf,onFCP:Yf,onINP:om,withoutAttribution:{onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Jm,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Jm,b.postHogWebVitalsCallbacks=Jm;var Xm={onLCP:Km,onCLS:Nm,onFCP:Om,onINP:jm};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},b.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=Xm,b.__PosthogExtensions__.postHogWebVitalsCallbacks=Xm,b.postHogWebVitalsCallbacks=Xm,b.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Xm;var ey=class{constructor(e){this.disabled=!1===e;var t=Tt(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},ty="$copy_autocapture",ry=Fs("[AutoCapture]");function iy(e,t){return t.length>e?t.slice(0,e)+"...":t}function sy(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!sn(t));return t}function ny(e,t){var r,i,s=t.e,o=t.maskAllElementAttributes,a=t.maskAllText,u=t.elementAttributeIgnoreList,d=t.elementsChainAsString,c=t.disableCaptureUrlHashes;if(!sn(e))return{props:{}};for(var h=[e],p=new Set([e]),_=e;_.parentNode&&!nn(_,"body")&&1e3>h.length;)if(an(_.parentNode)){var g=_.parentNode.host;if(p.has(g))break;p.add(g),h.push(g),_=g}else{if(!sn(_.parentNode))break;if(p.has(_.parentNode))break;p.add(_.parentNode),h.push(_.parentNode),_=_.parentNode}var v="click"===s.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(e=>nn(e,"button")||nn(e,"a")):-1;v>0&&(a=a||h.slice(0,v+1).some(e=>!In(e)||Rn(e)));var f,m,y,b=[],S={},w=!1,k=!1;if(As(h,e=>{var t=In(e);if(nn(e,"a")){var r=e.getAttribute("href");w=!!(t&&r&&Nn(r))&&(c?li(r):r)}ht(dn(e),"ph-no-capture")&&(k=!0),b.push(function(e,t,r,i,s){void 0===s&&(s=!1);var n=e.tagName.toLowerCase(),o={tag_name:n};_n.indexOf(n)>-1&&!r&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?iy(1024,Bn(e)):iy(1024,hn(e)));var a=dn(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),As(e.attributes,function(r){var n;if((!Rn(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==i||!i.includes(r.name))&&!t&&Nn(r.value)&&(!Pt(n=r.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=r.value;"class"===r.name&&(a=ln(a).join(" ")),o["attr__"+r.name]=iy(1024,"href"===r.name&&s?li(a):a)}});for(var l=1,u=1,d=e;d=sy(d);)l++,d.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,o,a,u,c)),As(function(e){if(!In(e))return{};var t={};return As(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),i=e.value;r&&i&&Nn(i)&&(t[r]=i)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(S,t)||(S[t]=e)})}),k)return{props:{},explicitNoCapture:k};if(v>0&&(e=h[v],b.splice(0,v)),a||(b[0].$el_text=nn(e,"a")||nn(e,"button")?Bn(e):hn(e)),w){var C,E;b[0].attr__href=w;var x=null==(C=Gs(w))?void 0:C.host,T=null==l||null==(E=l.location)?void 0:E.host;x&&T&&x!==T&&(f=w)}return{props:Os((m=s.type,{$event_type:m,$ce_version:1}),d?{}:{$elements:b},{$elements_chain:(y=b,Et(y)?function(e){return e.map(e=>{var t,r,i="";if(e.tag_name&&(i+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))i+="."+s.replace(/"/g,"");var o=n({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return Ds(o).sort((e,t)=>function(e,t){return t>e?-1:e>t?1:0}(e[0],t[0])).forEach(e=>{var t=e[1];return a[qn(e[0].toString())]=qn(t.toString())}),(i+=":")+Ds(a).map(e=>e[0]+'="'+e[1]+'"').join("")}).join(";")}(function(e){return e.map(e=>{var t,r,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(r=e.attr__href)?void 0:r.slice(0,2048),attr_class:Hn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Ds(e).filter(e=>0===e[0].indexOf("attr__")).forEach(e=>i.attributes[e[0]]=e[1]),i})}(y)):"")},null!=(r=b[0])&&r.$el_text?{$el_text:null==(i=b[0])?void 0:i.$el_text}:{},f&&"click"===s.type?{$external_click_url:f}:{},S),target:e}}var oy=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!In(e))return!0;for(var r,i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:mn,s=new Set,n=e,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var e=n,t=dn(e);if(ht(t,"ph-no-capture")||ht(t,"ph-sensitive")||Rn(e)||i.some(t=>gn(e,t)))return{v:!0};var r=n.parentNode;n=an(r)?r.host:r&&sn(r)?r:null};n;)if(r=o())return r.v;return!1}_trackPointer(e){if(this.isEnabled&&"pointercancel"!==e.type)if("pointerdown"!==e.type){var t=this._pointerDown;t&&(e.pointerId!==t.id||Math.abs(e.clientX-t.x)>5||Math.abs(e.clientY-t.y)>5?this._clearPointer():"pointerup"===e.type&&(t.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}else{var r;this._clearPointer();var i=pn(e);e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&sn(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null==(r=this._client)?void 0:r.distinctId})}else this._clearPointer()}_recoverClickTarget(e){var t,r=this._pointerDown;this._clearPointer();var i=pn(e);if(null!=r&&r.released&&r.target.isConnected&&r.distinctId===(null==(t=this._client)?void 0:t.distinctId)&&e.pointerId===r.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-r.x)&&5>=Math.abs(e.clientY-r.y)&&i&&(nn(i,"html")||nn(i,"body"))){var s;if(r.excluded)return null;var n=null!==(s=this._refreshConfig().css_selector_ignorelist)&&void 0!==s?s:mn;return[i,null==c?void 0:c.documentElement,null==c?void 0:c.body].some(e=>{if(!e)return!1;var t=dn(e);return ht(t,"ph-no-capture")||ht(t,"ph-sensitive")||!In(e)||Rn(e)||n.some(t=>gn(e,t))})?null:r.target}}constructor(e){this._configSource=e,this.name="autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._hasReceivedConfigResponse=!1,this._elementsChainAsString=!1,this._config={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this._disposed=!1,this._configSource.refresh(this._config),this.rageclicks=new ey(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.startIfEnabled())}dispose(){var e;this._disposed||(this._disposed=!0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,this._removeDomEventHandlers())}_refreshConfig(){return this._configSource.refresh(this._config),this._config}_compileUrlPatterns(){var e,t;return this._refreshConfig(),this._config.url_allowlist=null==(e=this._config.url_allowlist)?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null==(t=this._config.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){if(this.isBrowserSupported()){if(l&&c){var e=this._domEventHandler=e=>{e=e||(null==l?void 0:l.event);try{if("blur"===e.type)return void this._clearPointer();if(0===e.type.indexOf("pointer"))return void this._trackPointer(e);var t="click"===e.type?this._recoverClickTarget(e):void 0;if(Ft(t))return;this._captureEvent(e,"$autocapture",t)}catch(e){ry.error("Failed to capture event",e)}};if(Ws(l,"blur",e),Ws(c,"submit",e,{capture:!0}),Ws(c,"change",e,{capture:!0}),Ws(c,"click",e,{capture:!0}),As(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Ws(c,t,e,{capture:!0})}),this._refreshConfig().capture_copied_text){var t=this._copiedTextHandler=e=>{e=e||(null==l?void 0:l.event);try{this._captureEvent(e,ty)}catch(e){ry.error("Failed to capture clipboard event",e)}};Ws(c,"copy",t,{capture:!0}),Ws(c,"cut",t,{capture:!0}),Ws(c,"paste",t,{capture:!0})}}}else ry.info("Disabling Automatic Event Collection because this browser is not supported")}_removeDomEventHandlers(){this._clearPointer(),this._domEventHandler&&(null==l||l.removeEventListener("blur",this._domEventHandler),As(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==c||c.removeEventListener(e,this._domEventHandler,!0)}),null==c||c.removeEventListener("submit",this._domEventHandler,!0),null==c||c.removeEventListener("change",this._domEventHandler,!0),null==c||c.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==c||c.removeEventListener("copy",this._copiedTextHandler,!0),null==c||c.removeEventListener("cut",this._copiedTextHandler,!0),null==c||c.removeEventListener("paste",this._copiedTextHandler,!0),this._copiedTextHandler=void 0),this._initialized=!1}startIfEnabled(){this.isEnabled||this._clearPointer(),!this._disposed&&this._client&&this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){if(!this._disposed)if(this._hasReceivedConfigResponse=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);var r,i=t.autocapture_opt_out;Dt(i)&&(null==(r=this._client)||r.kv.set(P,i),this._isDisabledServerSide=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e,t){var r,i=[];return null==(r=this._elementSelectors)||r.forEach(r=>{var s;null==c||null==(s=c.querySelectorAll(r))||s.forEach(s=>{e!==s&&t!==s||ht(i,r)||i.push(r)})}),i}get isEnabled(){var e,t;if(this._disposed)return!1;var r=null==(e=this._client)?void 0:e.kv.get(P),i=this._isDisabledServerSide,s=this._refreshConfig();if(!s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;var n=s.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(Ft(i)&&!Dt(r)&&!n)return!1;var o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!r;return!!s.enabled&&!o}_captureEvent(e,t,r){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i=r||pn(e);on(i)&&(i=i.parentNode||null);var s,o=this._compileUrlPatterns();"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&o.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&En(i,o.rageclick)&&this._captureEvent(e,"$rageclick",r);var a=t===ty,u=a?n({},o,{dom_event_allowlist:void 0}):o;if(i&&function(e,t,r,i,s,n){var o;if(!l||xn(e))return!1;if(null!=r&&r.url_allowlist&&!un(r.url_allowlist,n))return!1;if(null!=r&&r.url_ignorelist&&un(r.url_ignorelist,n))return!1;if(null!=r&&r.dom_event_allowlist){var a=r.dom_event_allowlist;if(a&&!a.some(e=>t.type===e))return!1}var u=Tn(e,i),d=u.parentIsUsefulElement,c=u.targetElementList;if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(Rt(r))return!0;var i,s=function(e){if(r.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(i=s(n))return i.v;return!1}(c,r))return!1;if(!vn(c,null==r?void 0:r.css_selector_allowlist))return!1;if(vn(c,null!==(o=null==r?void 0:r.css_selector_ignorelist)&&void 0!==o?o:mn))return!1;try{var h=l.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return d?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(_n.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,u,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var d,c=ny(i,{e:e,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),h=c.props;if(c.explicitNoCapture)return!1;var p=this.getElementSelectors(i,c.target);if(p&&p.length>0&&(h.$element_selectors=p),t===ty){var _=e.type||"clipboard";if("paste"!==_){var g,v,f=null==l||null==(g=l.getSelection())?void 0:g.toString(),m=cn(f);if(!m)return!1;h.$selected_content=m,h.$clipboard_text_length=null!==(v=null==f?void 0:f.length)&&void 0!==v?v:0}h.$copy_type=_}return null==(d=this._client)||d.capture(t,h).catch(e=>ry.error("Failed to capture event",e)),!0}}else this._clearPointer()}isBrowserSupported(){return xt(null==c?void 0:c.querySelectorAll)}},ay={};function ly(e,t){var r=pn(e);return r?n({node:r,originalEvent:e,timestamp:Date.now()},t):null}function uy(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function dy(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}var cy="canvas,video,audio,embed,object";function hy(e,t){return At(e)&&e>=t}function py(e){return e>=0&&1e3>e?e:void 0}function _y(e,t){return t?py(e-t):void 0}var gy=class{_asRequiredConfig(e){var t,r,i,s,n,o,a,l,u=this._defaultConfig((null==e?void 0:e.__onCapture)||this._captureDeadClick.bind(this));return{element_attribute_ignorelist:null!==(t=null==e?void 0:e.element_attribute_ignorelist)&&void 0!==t?t:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(r=null==e?void 0:e.scroll_threshold_ms)&&void 0!==r?r:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(i=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==i?i:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==e?void 0:e.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(n=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==n?n:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==e?void 0:e.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(e,t){this.instance=e,this._clicks=[],this._deadSwipesCaptured=0,this._defaultConfig=e=>({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:e}),this._onClick=e=>{var t=ly(e,{type:"click"});Ft(t)||this._ignore(t)||this._queueCandidate(t),this._scheduleCheck()},this._onScroll=()=>{var e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{Rt(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=()=>{this._lastSelectionChanged=Date.now()},this._onVisibilityChange=()=>{var e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{var e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{var t=e.touches,r=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=r?{x:r.clientX,y:r.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t,r=this._touchStart;if(this._touchStart=void 0,!Rt(r)&&this._config.max_dead_swipes_per_page_load>this._deadSwipesCaptured){var i=e,s=null==(t=i.changedTouches)?void 0:t[0];if(s){var n=s.clientX-r.x,o=s.clientY-r.y,a=n*n+o*o,l=this._config.swipe_threshold_px;if(a>=l*l&&![this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>At(e)&&e>=r.timestamp)){var u;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==c||null==c.elementsFromPoint?void 0:c.elementsFromPoint(r.x,r.y))&&void 0!==u?u:[]).some(e=>null==e.matches?void 0:e.matches(cy)))return;var d=ly(i,{type:"swipe",swipeDirection:uy(n,o),swipeDistancePx:Math.round(Math.sqrt(a))});Ft(d)||this._ignore(d)||this._queueCandidate(d),this._scheduleCheck()}}}},this._config=this._asRequiredConfig(t),this._onCapture=this._config.__onCapture}start(e){this._startClickObserver(),this._startScrollObserver(),this._startSelectionChangedObserver(),this._startVisibilityChangeObserver(),this._startFocusChangeObserver(),this._startMutationObserver(e),this._config.capture_dead_swipes&&this._startSwipeObserver()}_startMutationObserver(e){if(!this._mutationObserver){var t=function(e){return function(e,t){var r=ay[e];if(r)return r;var i=t[e];if((e=>xt(e)&&-1!==e.toString().indexOf("[native code]"))(i)&&(null==l||!l.Zone))return ay[e]=i.bind(t);var s=t.document;if(s&&xt(s.createElement)){var n,o=!1;try{(n=s.createElement("iframe")).hidden=!0,s.head.appendChild(n);var a,u,d=n.contentWindow;d&&d[e]&&(i=d[e],"MutationObserver"===e&&function(e){return ht(e,"AppleWebKit")&&!ht(e,"Chrome")}(null!==(a=null==(u=t.navigator)?void 0:u.userAgent)&&void 0!==a?a:"")&&(n.classList.add("rr-block","ph-no-capture"),o=!0))}catch(t){Ms.warn("Could not create sandbox iframe for "+e+" check, bailing to assignableWindow."+e+": ",t)}finally{var c;!o&&null!=(c=n)&&c.parentNode&&n.parentNode.removeChild(n)}}return i&&xt(i)?ay[e]=i.bind(t):i}("MutationObserver",e)}(b);this._mutationObserver=new t(e=>{this._onMutation(e)}),this._mutationObserver.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null==(e=this._mutationObserver)||e.disconnect(),this._mutationObserver=void 0,b.removeEventListener("click",this._onClick),b.removeEventListener("scroll",this._onScroll,{capture:!0}),b.removeEventListener("selectionchange",this._onSelectionChange),b.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),b.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),b.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==c||c.removeEventListener("visibilitychange",this._onVisibilityChange),b.removeEventListener("blur",this._onFocusChange),b.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){Ws(b,"click",this._onClick)}_queueCandidate(e){e.visibilityChangedDelayMs=_y(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=_y(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Rt(this._checkClickTimer)&&(this._checkClickTimer=b.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){Ws(b,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){Ws(b,"selectionchange",this._onSelectionChange)}_startVisibilityChangeObserver(){Ws(c,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){Ws(b,"blur",this._onFocusChange),Ws(b,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(r=>{var i=py(t-r.timestamp);At(i)&&(Rt(r[e])||r[e]>i)&&(r[e]=i)})}_startSwipeObserver(){Ws(b,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),Ws(b,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),Ws(b,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){var e=Rt(this._surfacesCheckedAt)||At(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Rt(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!(null==c||!c.querySelector(cy))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(e){return!(!rn(e.node)&&!this._clicks.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!nn(e.node,"html")&&sn(e.node)&&function(e,t){var r;if(!l||xn(e))return!1;var i=Dt(t)?wn:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:wn;return!vn(Tn(e,!1).targetElementList,i)}(e.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(e){return!(this._config.capture_clicks_with_modifier_keys||(t=e.originalEvent,!(t.ctrlKey||t.metaKey||t.altKey||t.shiftKey)))||!!this._ignoreCommon(e)||(r=e.node,!(!l||xn(r))&&Tn(r,!1).targetElementList.some(e=>nn(e,"a")));var t,r}_checkClicks(){if(this._clicks.length){clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;var e=this._clicks;for(var t of(this._clicks=[],e)){var r;t.mutationDelayMs=null!==(r=t.mutationDelayMs)&&void 0!==r?r:this._lastMutation&&this._lastMutation>=t.timestamp?this._lastMutation-t.timestamp:void 0,t.absoluteDelayMs=Date.now()-t.timestamp,t.selectionChangedDelayMs=this._lastSelectionChanged&&this._lastSelectionChanged>=t.timestamp?this._lastSelectionChanged-t.timestamp:void 0;var i=hy(t.scrollDelayMs,this._config.scroll_threshold_ms),s=hy(t.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=hy(t.mutationDelayMs,this._config.mutation_threshold_ms),o=hy(t.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),a=At(t.scrollDelayMs)&&this._config.scroll_threshold_ms>t.scrollDelayMs,l=At(t.mutationDelayMs)&&this._config.mutation_threshold_ms>t.mutationDelayMs,u=At(t.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>t.selectionChangedDelayMs,d=At(t.visibilityChangedDelayMs),c=At(t.focusChangedDelayMs);if(!(a||l||u||d||c))if(i||n||o||s){var h=dy(t);if("$dead_swipe"===h){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(t,{[h+"_last_mutation_timestamp"]:this._lastMutation,[h+"_event_timestamp"]:t.timestamp,[h+"_scroll_timeout"]:i,[h+"_mutation_timeout"]:n,[h+"_absolute_timeout"]:o,[h+"_selection_changed_timeout"]:s,[h+"_visibility_changed_timeout"]:!1})}else this._config.mutation_threshold_ms>t.absoluteDelayMs&&this._clicks.push(t)}this._scheduleCheck()}}_captureDeadClick(e,t){var r=dy(e);this.instance.capture(r,n({},t,ny(e.node,{e:e.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props,{[r+"_scroll_delay_ms"]:e.scrollDelayMs,[r+"_mutation_delay_ms"]:e.mutationDelayMs,[r+"_absolute_delay_ms"]:e.absoluteDelayMs,[r+"_selection_changed_delay_ms"]:e.selectionChangedDelayMs,[r+"_visibility_changed_delay_ms"]:e.visibilityChangedDelayMs,[r+"_focus_changed_delay_ms"]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new gy(e,t);var vy=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,r=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(r?r+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return jt(e)?1:ht(Gt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?ka:Sa,r=t._is_supported()?t:Oa;if(!this._persistentStore||this._persistentStore!==r){this._persistentStore=r;var i="localStorage"===e?Sa:ka;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(jt(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==d?void 0:d.doNotTrack,null==d?void 0:d.msDoNotTrack,b.doNotTrack,null==d?void 0:d.globalPrivacyControl].some(e=>jt(e))}},fy=Fs("[Dead Clicks]"),my=()=>!0,yy=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(D)),i=e.instance.config.capture_dead_clicks;return Dt(i)?i:!!Tt(i)||r},by=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[D]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?fy.error("failed to load script",t):e()})}_start(){var e;if(c){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=b.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=Tt(this.instance.config.capture_dead_clicks)?n({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=b.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(c),fy.info("starting...")}}else fy.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,fy.info("stopping..."))}},Sy=Fs("[SegmentIntegration]");function wy(e,t,r){void 0===r&&(r=!0);var i=e.config.segment;if(!i)return t();!function(e,t,r){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||va();e.config.get_device_id=s,r&&i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(Fe,rt)),t(r?void 0:i.anonymousId()||void 0)},n=i.user();"then"in n&&xt(n.then)?n.then(s):s(n)}(e,r=>{i.register(((e,t)=>{"undefined"!=typeof Promise&&Promise.resolve||Sy.warn("This browser does not have Promise support, and can not use the segment integration");var r=(r,i)=>{if(!i)return r;var s=!!t&&r.event.anonymousId===t&&!r.event.userId;s||r.event.userId||r.event.anonymousId===e.get_distinct_id()||(Sy.info("No userId set, resetting PostHog"),e.reset()),s||(t=void 0),r.event.userId&&r.event.userId!==e.get_distinct_id()&&(Sy.info("UserId set, identifying with PostHog"),e.identify(r.event.userId));var n=e.calculateEventProperties(i,r.event.properties);return r.event.properties=Object.assign({},n,r.event.properties),r};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return r(e,e.event.event)},page(e){return r(e,ot)},identify(e){return r(e,lt)},screen(e){return r(e,"$screen")}}})(e,r)).then(()=>{t()},e=>{Sy.error("Failed to register the Segment integration",e),t()})},r)}var ky="posthog-js";function Cy(e,t){var r=void 0===t?{}:t,i=r.organization,s=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,u=r.sendExceptionsToPostHog,d=void 0===u||u;return t=>{var r,a,u,c,h,p;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var _=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=_,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=(null==(r=t.exception)?void 0:r.values)||[],v=g.map(e=>n({},e,{stacktrace:e.stacktrace?n({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>n({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(u=g[0])?void 0:u.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=g[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=g[0])?void 0:h.type,$sentry_tags:t.tags};return i&&s&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),d&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}var Ey=class{constructor(e,t,r,i,s,n){this.name=ky,this.setupOnce=function(o){o(Cy(e,{organization:t,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},xy=class{constructor(e){this._onSessionIdChange=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(Ms.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var r,i=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(r=null==l?void 0:l.location.pathname)&&void 0!==r?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var r=this._currentPageview;if(!r)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,u=s.lastContentY,d=s.maxContentY;if(!(Rt(n)||Rt(o)||Rt(a)||Rt(l)||Rt(u)||Rt(d))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d);var c=n>1?Qt(o/n,0,1,Ms):1,h=n>1?Qt(a/n,0,1,Ms):1,p=l>1?Qt(u/l,0,1,Ms):1,_=l>1?Qt(d/l,0,1,Ms):1;i=Os(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:c,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}},Ty=["flags","surveys"],Iy={[S]:{exposure:"hidden"},[E]:{exposure:"hidden"},[x]:{exposure:"hidden"},[R]:{exposure:"hidden"},[I]:{exposure:"hidden"},[P]:{exposure:"event"},[M]:{exposure:"hidden"},[B]:{exposure:"hidden"},[F]:{exposure:"event"},[L]:{exposure:"hidden"},[A]:{exposure:"event"},[O]:{exposure:"event"},[D]:{exposure:"event"},[N]:{exposure:"hidden"},[q]:{exposure:"event"},[H]:{exposure:"hidden"},[U]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[K]:{exposure:"event"},[W]:{exposure:"event",shouldSkipFromEventProperties:e=>Ft(e)},[Z]:{exposure:"event"},[Y]:{exposure:"event"},[J]:{exposure:"event"},[re]:{exposure:"event"},[ie]:{exposure:"hidden"},[se]:{exposure:"hidden",storageGroup:"flags"},[ne]:{exposure:"hidden",storageGroup:"flags"},[oe]:{exposure:"hidden"},[ae]:{exposure:"hidden",storageGroup:"flags"},[le]:{exposure:"hidden",storageGroup:"flags"},[ue]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[de]:{exposure:"hidden",storageGroup:"flags"},[ce]:{exposure:"hidden"},[he]:{exposure:"hidden"},[pe]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[ve]:{exposure:"hidden",storageGroup:"surveys"},[fe]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[me]:{exposure:"event"},[ye]:{exposure:"hidden"},[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[we]:{exposure:"hidden"},[ke]:{exposure:"hidden"},[Ce]:{exposure:"event"},[Ee]:{exposure:"event"},[xe]:{exposure:"event"},[Te]:{exposure:"event"},[Ie]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[ge]:{exposure:"event"},[Pe]:{exposure:"hidden"},[Me]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Fe]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[Ae]:{exposure:"hidden"},[Oe]:{exposure:"hidden"},[De]:{exposure:"hidden"},[Ne]:{exposure:"hidden"},[Be]:{exposure:"hidden"},[z]:{exposure:"event"},[V]:{exposure:"event"},[j]:{exposure:"event"},[G]:{exposure:"event"},[He]:{exposure:"event"},[Ue]:{exposure:"event"},[We]:{exposure:"event"},[ze]:{exposure:"event"},[Ve]:{exposure:"event"},[je]:{exposure:"event"},[Ge]:{exposure:"event"},[Qe]:{exposure:"event"},[Ke]:{exposure:"event"},[Ze]:{exposure:"event"},[Xe]:{exposure:"event"}},Ry=[[X,{exposure:"hidden"}],[ee,{exposure:"hidden"}],[te,{exposure:"hidden"}]],Py=e=>{var t=Iy[e];if(t)return t;for(var r of Ry){var i=r[1];if(0===e.indexOf(r[0]))return i}},My={flags:Me,surveys:fe},Fy=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ly=e=>e+"_cookie_identity_change_pending",Ay=e=>{var t="",r=0;for(var i of e){var s=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(r+s>1e3)break;t+=i,r+=s}return t},Oy="main",Dy=[se,ne,ae,le,ue,Me,de,pe],Ny=e=>-1!==Dy.indexOf(e),By=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return e===t}},$y=e=>{if(!e)return{};var t=JSON.parse(e);return Tt(t)?t:{}},qy=(e,t)=>{As(e,(r,i)=>{var s=Py(i);s&&"event"!==s.exposure||{}.hasOwnProperty.call(t,i)||delete e[i]})},Hy=class{constructor(e,t,r){if(void 0===r&&(r=!0),this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._facebookClickIdChangePending=!1,this._crossTabFeatureFlagHandlers=new Set,this._config=e,this._ownsSplitStorage=r,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),e.debug&&Ms.info("Persistence loaded",e.persistence,n({},this.props)),this.update_config(e,e,t),this.save(),l){var i=()=>this.flush();Ws(l,"beforeunload",i,{capture:!1}),Ws(l,"pagehide",i,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==l?void 0:l.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=Ty.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,Oy)},Ws(l,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],r=e[1],i=this._pendingCrossTabFeatureFlagChanges.get(t);if(Ny(t)&&!0!==i)if(!0!==r){var s=new Set(i||[]);r.forEach(e=>s.add(e)),s.size&&this._setCrossTabFeatureFlagChangesPending(t,s)}else this._setCrossTabFeatureFlagChangesPending(t,!0)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&l&&(l.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,r){if(void 0===r&&(r=!0),this._disabled)return!1;var i,s;try{if(s=ka._get(e),Ft(s)){var n=this._slotWriteState(t);return n.storageValue=null,t!==Oy&&(n.persisted=!1),!1}i=$y(s)}catch(e){return!1}var o=t===Oy?i:ka._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(i,t,r);return t===Oy&&this._splitStorage&&!By(this._partitionProps().main,i)||this._rememberCrossTabStorageFingerprint(i,t,!0,s),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[w],r=e[w];return!Rt(t)&&!Rt(r)&&t!==r}_rememberCrossTabStorageFingerprint(e,t,r,i){var s=this._slotWriteState(t);s.storageValue=i,t!==Oy&&(s.persisted=r);try{s.fingerprint=this._entryFingerprint(e,t)}catch(e){s.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,r){var i=!1;return Dy.forEach(r=>{var s,n=null==(s=Py(r))?void 0:s.storageGroup;if(!(t===Oy&&this._splitStorage&&n||t!==Oy&&n!==t)){var o=r in e,a=this._mergePendingCrossTabFeatureFlagChanges(r,o?e[r]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(r)?r in this.props:o;l===r in this.props&&By(a,this.props[r])||(l?this._setProp(r,a,!1):this._deleteProp(r,!1),i=!0)}}),i&&r&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),i}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;var e,t=ka._get(this._name),r=this._slotWriteState(Oy),i=!1,s=!1;if(t!==r.storageValue)if(Ft(t))r.storageValue=null;else{if(e=$y(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;s=this._mergeCrossTabFeatureFlagProperties(e,Oy,!1),!this._splitStorage||By(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,Oy,!0,t):r.storageValue=t,i=!0}return this._splitStorage&&Ty.forEach(t=>{var r=ka._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=i&&Dy.some(e=>{var r;return(null==(r=Py(e))?void 0:r.storageGroup)===t&&e in o});if(r!==n.storageValue||a){if(Ft(r))return n.storageValue=null,n.persisted=!1,void(a&&(s=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||s));var l=$y(r);s=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||s,this._rememberCrossTabStorageFingerprint(l,t,!0,r)}}),s}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var r=Py(e);null!=r&&r.volatile||(this._slotWriteState((this._splitStorage?null==r?void 0:r.storageGroup:void 0)||Oy).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Dy.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=ka._get(this._name),t=$y(e);this._slotWriteState(Oy).storageValue=e,Dy.forEach(e=>{var r,i=this._splitStorage?null==(r=Py(e))?void 0:r.storageGroup:void 0,s=i?ka._get(this._groupEntryName(i)):null;if(i){var n=this._slotWriteState(i);n.storageValue=s,n.persisted=!Ft(s)}var o=i&&!Ft(s)?$y(s):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var r=this._pendingCrossTabFeatureFlagChanges.get(e);if(!r)return t;if(!0===r)return this.props[e];if("$active_feature_flags"===e){var i=new Set(Et(t)?t:[]),s=new Set(Et(this.props[e])?this.props[e]:[]);return r.forEach(e=>s.has(e)?i.add(e):i.delete(e)),Array.from(i)}var o=Tt(t)?n({},t):{},a=Tt(this.props[e])?this.props[e]:{};return r.forEach(e=>{e in a?o[e]=a[e]:delete o[e]}),o}_markPendingCrossTabFeatureFlagChanges(e,t,r){if(Ny(e)){var i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==i){var s=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Py(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;s=$y(ka._get(a))[e]}catch(e){}var l=new Set(i||[]);if("$active_feature_flags"===e){if(!Rt(t)&&!Et(t)||!Rt(s)&&!Et(s)||!Et(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var u=new Set(t||[]),d=new Set(s||[]),c=new Set(r);new Set([...u,...c]).forEach(e=>{u.has(e)!==c.has(e)&&l.add(e)}),l.forEach(e=>{d.has(e)===c.has(e)&&l.delete(e)})}else{if(!Tt(r))return void(By(s,r)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!Rt(t)&&!Tt(t)||Rt(t)&&It(r)&&Rt(s))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var h=Tt(t)?t:{},p=Tt(s)?s:{};new Set([...Object.keys(h),...Object.keys(r)]).forEach(e=>{e in h==e in r&&By(h[e],r[e])||l.add(e)}),l.forEach(e=>{e in p==e in r&&By(p[e],r[e])&&l.delete(e)})}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return At(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=Ra(e,this._config.cookie_persisted_properties||[]),r=Ma(t,this._config.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(r),s=Sa._get(this._name)||void 0;s&&La(this._name,s)===i&&(this._lastSeenCookiePropertiesFingerprint=i,this._lastSeenMainCookieValue=s)}catch(e){}else try{var n=Sa._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?La(this._name,n):void 0,this._lastSeenMainCookieValue=n}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var r;try{r=Sa._get(this._name)||void 0}catch(e){}if(!r||r===this._lastSeenMainCookieValue)return!1;var i,s=La(this._name,r);try{i=Ia(JSON.parse(r))}catch(e){return!1}if((Sa._get(this._name)||void 0)!==r)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r;var n=Fa(this._name,r),o=[...Ea,...n.properties],a={};if(Object.keys(i).forEach(e=>{var t=i[e];(Rt(t)||Ft(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete i[e])}),It(i))return!1;var l="distinct_id"in i||"anonymous"===i.$user_state||"identified"===i.$user_state,u=this.props,d=u[w],c=u[Fe],h=Os({},u);[...Ea,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in i)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=h[e];(n.isValid||-1===Ea.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=Os(h,i),Dy.forEach(e=>{var t=e in this.props;e in u===t&&By(u[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,u[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in i||"$user_state"in this.props||this._setProp(Fe,tt);var p=this.props[w],_=this.props[Fe];return!l||p===d&&_===c||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Na._set(Ly(this._name),!0),this._deleteProp(pe),this._deleteProp(ne),this._deleteProp(se),this._deleteProp(ae),this._deleteProp(le),this._deleteProp(ue),this._deleteProp(Me),this._deleteProp(Pe),this._deleteProp(Ie),"anonymous"!==_||"identified"!==c&&"anonymous"!==i.$user_state&&(Rt(d)||p===d)||(qy(this.props,i),this._deleteProp(_e)),"identified"===_?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(E)),!0}consumeCookieIdentityChange(){var e=Ly(this._name),t=this._cookieIdentityChangePending||!!Na._get(e);return this._cookieIdentityChangePending=!1,t&&Na._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Oy],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(e){-1===Fy.indexOf(e.persistence.toLowerCase())&&(Ms.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,r=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var r=[...Ea,...e];return n({},ka,{_parse(e){try{var i,s={};try{i=Sa._get(e)||void 0,s=i?Ia(JSON.parse(i)):{}}catch(e){}var n,o=JSON.parse(ka._get(e)||"{}");if(t){var a=Fa(e,i),l=[...Ea,...a.properties],u={};Object.keys(s).forEach(e=>{var t=s[e];Ft(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});var d="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var c,h=o[w],p=null!==(c=o.$user_state)&&void 0!==c?c:"anonymous";r.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in s)&&(d||"distinct_id"!==e&&"$user_state"!==e)){var t=o[e];(a.isValid||-1===Ea.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!d||"$user_state"in s||"$user_state"in o||(o[Fe]=tt),!d||("distinct_id"in u?u[w]:o[w])===h&&("$user_state"in u?u[Fe]:o[Fe])===p||(Ca.forEach(e=>delete o[e]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[w]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[ge],delete o[_e]),delete o.__alias)}n=Os(o,u)}else n=Os(s,o);return ka._set(e,n),n}catch(e){}return null},_set(r,i,s,n,o,a){var l=ka._set(r,i,void 0,void 0,a);try{var u=Ra(i,e);if(Object.keys(u).length){if(t){var d=xa(r),c=Ma(u,e);if(Sa._set(d,c,s,n,o,a),Sa._get(d)!==JSON.stringify(c)){Sa._remove(d,n);var h=Ra(i);return Sa._set(r,h,s,n,o,a),l}}Sa._set(r,u,s,n,o,a)}}catch(e){ka._error(e)}return l},_remove(e,t){try{null==l||l.localStorage.removeItem(e),Sa._remove(e,t),Sa._remove(xa(e),t)}catch(e){ka._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i=!1,s=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&ka._is_supported()?(t=ka,s=!0):"localstorage+cookie"===o&&r._is_supported()?(t=r,s=!0,i=!0):"sessionstorage"===o&&Na._is_supported()?t=Na:"memory"===o?t=Oa:"cookie"===o&&Sa._is_supported()?(t=Sa,i=!0):r._is_supported()?(t=r,s=!0,i=!0):Sa._is_supported()?(t=Sa,i=!0):t=Oa,this._splitStorageEligible=s,this._storesIdentityInCookie=i,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return As(this.props,(t,r)=>{var i=Py(r);if(!i||"event"===i.exposure){if(null!=i&&null!=i.shouldSkipFromEventProperties&&i.shouldSkipFromEventProperties(t))return;e[r]=t}}),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),r=t?ka._parse(this._name):null,i={};if(t)try{As(i=Ia(Sa._parse(this._name)),(e,t)=>{(Rt(e)||Ft(e)||""===e)&&delete i[t]})}catch(e){}var s=this._storage._parse(this._name);if(s&&(this.props=Os({},s)),this._splitStorage&&this._loadGroupEntries(),t&&s){var n,o,a=null==r?void 0:r[w],l=null!==(n=null==r?void 0:r.$user_state)&&void 0!==n?n:"anonymous",u=s[w],d=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(u!==a||d!==l){this._cookieIdentityChangePending=!0,Na._set(Ly(this._name),!0);var c=Os({},this.props);Ca.forEach(e=>delete c[e]),"anonymous"!==d||"identified"!==l&&"anonymous"!==i.$user_state&&(Rt(a)||u===a)||(qy(c,i),delete c[_e]),this.props=c;var h=new Set;Ca.forEach(e=>{var t,r=null==(t=Py(e))?void 0:t.storageGroup;r&&h.add(r)}),h.forEach(e=>{var t={};As(this.props,(r,i)=>{var s;(null==(s=Py(i))?void 0:s.storageGroup)===e&&(t[i]=r)}),It(t)?(ka._remove(this._groupEntryName(e)),this._slotState[e]={}):ka._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Na._get(Ly(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Ty){var t=ka._parse(this._groupEntryName(e));if(t&&!It(t)){var r=this._slotWriteState(e);r.persisted=!0,this._mainCarriesGroupKey(e)||(r.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Os(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var r;return(null==(r=Py(t))?void 0:r.storageGroup)===e})}_groupEntryIsStale(e,t){var r=My[e];if(!r)return!1;var i=t[r],s=this.props[r];return At(i)&&At(s)&&s>i}refreshKey(e){var t;if(!(this._disabled||"$fbc_persistence"===e&&this._facebookClickIdChangePending)){var r=this._splitStorage?null==(t=Py(e))?void 0:t.storageGroup:void 0,i=r?ka._parse(this._groupEntryName(r)):this._storage._parse(this._name);if(i&&e in i)this._setProp(e,i[e],!1);else{if(r){var s=this._storage._parse(this._name);if(s&&e in s)return void this._setProp(e,s[e],!1)}this._deleteProp(e,!1)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?Rt(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}}flush(){Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||(this.syncCookieProperties(),this._facebookClickIdChangePending||this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshKey(I));var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var r=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&Ms.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this._splitStorage)return this._writeNowSplit(),void(r&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));var i=this._writeEntry(this._storage,this._name,this.props,Oy);"written"===i&&this._rememberCurrentCookieProperties(this.props),"failed"!==i&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1),r&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}}}_writeNowSplit(){var e=this,t=this._partitionProps(),r=t.main,i=t.groups,s=this._writeEntry(this._storage,this._name,r,Oy);"written"===s&&this._rememberCurrentCookieProperties(r),"failed"!==s&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,Dy.forEach(e=>{var t;null!=(t=Py(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)}));var n=function(t){var r,s=i[t];if(It(s)&&(null==(r=e._slotState[t])||!r.persisted))return Dy.forEach(r=>{var i;(null==(i=Py(r))?void 0:i.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(r)}),1;var n=e._writeEntry(ka,e._groupEntryName(t),s,t);"failed"!==n&&Dy.forEach(r=>{var i=Py(r);(null==i?void 0:i.storageGroup)!==t||"written"!==n&&i.volatile||e._pendingCrossTabFeatureFlagChanges.delete(r)})};for(var o of Ty)if(n(o))continue}_partitionProps(){var e={},t={flags:{},surveys:{}};return As(this.props,(r,i)=>{var s,n=null==(s=Py(i))?void 0:s.storageGroup;n?t[n][i]=r:e[i]=r}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Oy)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var r={};return As(e,(e,t)=>{var i;r[t]=null!=(i=Py(t))&&i.volatile?"__volatile__":e}),JSON.stringify(r)}_writeEntry(e,t,r,i){var s,n=this._slotWriteState(i);if(i!==Oy&&!n.dirty&&!Rt(n.fingerprint))return"skipped";try{if((s=this._entryFingerprint(r,i))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){s=void 0}return e._set(t,r,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,i!==Oy&&(n.persisted=!0),Rt(s)||(n.fingerprint=s),this._splitStorageEligible&&(n.storageValue=ka._get(t)),"written"):(this._config.debug&&Ms.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,r=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),Rt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!r&&this._ownsSplitStorage)for(var i of Ty)ka._remove(this._groupEntryName(i));r?delete this._slotState[Oy]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,r){if(Tt(e)){this.syncCookieProperties(),Rt(t)&&(t="None"),this._expire_days=Rt(r)?this._default_expiry:r;var i=!1;if(As(e,(e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this._setProp(r,e),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(Tt(e)){this.syncCookieProperties(),this._expire_days=Rt(t)?this._default_expiry:t;var r=!1;if(As(e,(t,i)=>{e.hasOwnProperty(i)&&(this.props[i]!==t||Tt(t)||Et(t))&&(this._setProp(i,t),r=!0)}),r)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,r=!1;for(var i of t)i in this.props&&(this._deleteProp(i),r=!0);r&&this.save()}update_campaign_params(){var e=null==c?void 0:c.URL;if(e!==this._campaign_params_url){var t=_l(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),r=!It($s(t));return r&&this.register(t),this._campaign_params_url=e,r?t:void 0}}update_search_keyword(){var e;this.register((e=null==c?void 0:c.referrer)?vl(e):{})}update_referrer_info(){var e;this.register_once({$referrer:yl(),$referring_domain:null!=c&&c.referrer&&(null==(e=Gs(c.referrer))?void 0:e.host)||ml},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var e=bl(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Ne]:this._storesIdentityInCookie?{r:Ay(e.r),u:e.u?Ay(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};As([De,Oe],t=>{var r=this.props[t];r&&As(r,function(t,r){e["$initial_"+_t(r)]=t})});var t=this.props[Ne];return t&&Os(e,function(e,t){void 0===t&&(t=!1);var r=Sl(e,t),i={};return As(r,function(e,t){i["$initial_"+_t(t)]=e}),i}(t,this._config.disable_capture_url_hashes)),e}safe_merge(e){return As(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t,r){var i=e.persistence!==t.persistence,s=!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),i=[...t].sort();return r.every((e,t)=>e===i[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=i||s,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!r,u=!!this._disabled&&!l;l||this._syncCookieProperties(t,u),this._config=e,!l&&(i||s||a)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(n({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),u));var d=o||a?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();var c=this._resolveSplitStorage(e),h=o||c!==this._splitStorage,p=!l&&(h||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(u);this._storageMigrationInProgress=h;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){var _=this.props;this.clear(),this._storage=d,this._splitStorage=c,this.props=_,this.save()}else a&&(this._storage=d,l||(delete this._slotState[Oy],this._writeNow()))}finally{this._storageMigrationInProgress=!1,p&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[Ne];if(this._storesIdentityInCookie&&Tt(e)&&"string"==typeof e.r){var t=Ay(e.r),r="string"==typeof e.u?Ay(e.u):e.u;t===e.r&&r===e.u||this._setProp(Ne,n({},e,{r:t,u:r}))}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props.__timers||{};r[e]=t,this._setProp(R,r),this.save()}remove_event_timer(e){var t=this.props.__timers||{},r=t[e];return Rt(r)||(delete t[e],this._setProp(R,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,r){var i;void 0===r&&(r=!0);var s=this.props[e];this.props[e]=t,r&&("distinct_id"!==e&&"$user_state"!==e||s===t||(this._localIdentityChangePending=!0),"$fbc_persistence"!==e||By(s,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,s,t),null!=(i=Py(e))&&i.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(Ny(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),"$fbc_persistence"===e&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,r=null==(t=Py(e))?void 0:t.storageGroup;r&&(this._slotWriteState(r).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}},Uy={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Wy={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},zy={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Vy=Fs("[RateLimiter]"),jy=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Vy.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Vy.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,i;void 0===e&&(e=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(r=this.instance.persistence)?void 0:r.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){var u=(At(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this._captureWarning(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property(Ae,a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!Et(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=h&&h.pathname)return""+(null!==(e=h.origin)&&void 0!==e?e:"")+h.pathname}_captureWarning(e){var t,r,i=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(r=this.instance).get_session_id)?void 0:t.call(r):void 0,a=[e+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},Gy=Fs("[RemoteConfig]"),Qy=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=b._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return Gy.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Gy.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Gy.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(e=>{this._onRemoteConfig(e.json,e)});this._onRemoteConfig(e)})}catch(e){Gy.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Gy.warn("Failed to fetch remote config from PostHog."):Gy.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Gy.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;null==(r=this._instance.featureFlags)||r.ensureFlagsLoaded()}catch(e){Gy.error("Error loading feature flags",e)}}},Ky=["fatal","error","warning","log","info","debug"],Zy=!!_||!!p,Yy="text/plain",Jy=!1,Xy=(e,t)=>{var r=e.split("#"),i=r[1],s=r[0].split("?"),n=s[0],o=s[1];if(!o)return e;var a=o.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(a?"?"+a:"")+(i?"#"+i:"")},eb=function(e,t,r){var i;void 0===r&&(r=!0);var s=e.split("?"),o=s[0],a=s[1],l=n({},t),u=null!==(i=null==a?void 0:a.split("&").map(e=>{var t,i=e.split("="),s=i[0],n=r&&null!==(t=l[s])&&void 0!==t?t:i[1];return delete l[s],s+"="+n}))&&void 0!==i?i:[],d=Qs(l);return d&&u.push(d),u.length>0?o+"?"+u.join("&"):o},tb=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,r=e.compression;if(t){if(r===W_.GZipJS){var i=oa(aa(js(t)),{mtime:0});return{contentType:Yy,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===W_.Base64){var s=(e=>"data="+encodeURIComponent("string"==typeof e?e:js(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(js(t)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=js(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},rb=e=>{var t,r,i=()=>"sendBeacon"===e.transport?{url:eb(e.url,{compression:W_.Base64}),encodedBody:tb(n({},e,{compression:W_.Base64,_encodedBody:void 0}))}:{url:Xy(e.url,"compression"),encodedBody:tb(n({},e,{compression:void 0,_encodedBody:void 0}))};try{t=tb(e)}catch(t){if(rs(e.compression,Ks(e.url,"compression")))return Ms.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return t&&rs(e.compression,Ks(e.url,"compression"))&&!((r=t.body)instanceof ArrayBuffer?ts(new Uint8Array(r)):ArrayBuffer.isView(r)&&ts(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(Jy=!0,i()):{url:e.url,encodedBody:t}},ib=e=>{try{return rb(e)}catch(t){return Ms.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},sb=function(){var e=a(function*(e){var t=yield as(js(e.data),Ba.DEBUG,{rethrow:!0});if(!t)return e;var r=yield t.arrayBuffer();return n({},e,{_encodedBody:{contentType:Yy,body:r,estimatedSize:r.byteLength}})});return function(t){return e.apply(this,arguments)}}(),nb=/Failed to fetch|NetworkError|Load failed/i,ob=e=>"TypeError"===(null==e?void 0:e.name)&&nb.test((null==e?void 0:e.message)||""),ab=e=>{var t=ib(e);if(t){var r=new _,i=t.encodedBody;r.open(e.method||"GET",t.url,!0);var s=null!=i?i:{},n=s.contentType,o=s.body;As(e.headers,function(e,t){r.setRequestHeader(t,e)}),n&&r.setRequestHeader("Content-Type",n),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(4===r.readyState){var t={statusCode:r.status,text:r.responseText};if(200===r.status)try{t.json=JSON.parse(r.responseText)}catch(e){}null==e.callback||e.callback(t)}},r.send(o)}},lb=e=>{var t=ib(e);if(t){var r=t.url,i=t.encodedBody,s=null!=i?i:{},o=s.contentType,a=s.body,l=s.estimatedSize,u=new Headers;As(e.headers,function(e,t){u.append(t,e)}),o&&u.append("Content-Type",o);var d=null,c=!1;if(g){var h=new g;d={signal:h.signal,timeout:setTimeout(()=>{var t;c=!0,h.abort(ai("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))},e.timeout)}}var _=t=>{c&&"AbortError"===(null==t?void 0:t.name)||ob(t)?Ms.warn(t):Ms.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var v;p(r,n({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(v=d)?void 0:v.signal},e.fetchOptions)).then(t=>t.text().then(r=>{var i={statusCode:t.status,text:r};if(200===t.status)try{i.json=JSON.parse(r)}catch(e){Ms.error(e)}null==e.callback||e.callback(i)})).catch(_).finally(()=>d?clearTimeout(d.timeout):null)}catch(e){d&&clearTimeout(d.timeout),_(e)}}},ub=e=>{try{var t,r=rb(e),i=r.url,s=r.encodedBody,o=null!=s?s:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(d.sendBeacon(i,u))return;var c=Et(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(Et(c)&&c.length>1&&(null!=l?l:0)>16384){var h=Math.ceil(c.length/2),_=t=>Et(e.data)?t:n({},e.data,{batch:t});return ub(n({},e,{data:_(c.slice(0,h))})),void ub(n({},e,{data:_(c.slice(h))}))}Ms.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(p?"fetch":"XHR")),p?lb(n({},e,{_keepaliveDisabled:!0})):ab(e)}catch(e){Ms.warn("Beacon send failed",e)}},db=(e,t,r,i)=>{var s="query"===i?"POST"===t?"sent_at":"_":void 0;return eb(r===W_.GZipJS?Xy(e,"compression"):e,n({},s?{[s]:Date.now().toString()}:{},r===W_.GZipJS?{}:{compression:r}))},cb=[];p&&cb.push({transport:"fetch",method:lb}),_&&cb.push({transport:"XHR",method:ab}),null!=d&&d.sendBeacon&&cb.push({transport:"sendBeacon",method:ub});var hb=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Qt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Ms.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(n({},e,{transport:"sendBeacon"}))})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),r=function(){var r=t[i],s=(new Date).getTime();r.data&&Et(r.data)&&As(r.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e._sendRequestSafely(r)};for(var i in t)r()}},this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Ms.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return As(this._queue,t=>{var r,i=t,s=(i?i.batchKey:null)||i.url;Rt(e[s])&&(e[s]=n({},i,{data:[]})),null==(r=e[s].data)||r.push(i.data)}),this._queue=[],e}},pb=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!Rt(l)&&"onLine"in l.navigator){if(this._areWeOnline=l.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},Ws(l,"online",this._onlineListener),Ws(l,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,i=s(e,r);Ot(t)&&(i.url=eb(i.url,{retry_count:t})),this._instance._send_request(n({},i,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(n({retriesPerformedSoFar:t},i));0===e.statusCode&&Ms.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!=t?t:0)+" retries.")}null==i.callback||i.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(e){var t=3e3*Math.pow(2,e),r=t/2,i=Math.min(18e5,t),s=(Math.random()-.5)*(i-r);return Math.ceil(i+s)}(t),i=Date.now()+r;this._queue.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),Ms.warn(s),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],r=this._queue.filter(r=>e>r.retryAt||(t.push(r),!1));if(this._queue=t,r.length>0)for(var i of r)this.retriableRequest(i.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Rt(l)||(this._onlineListener&&(l.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(l.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(n({},t,{transport:"sendBeacon"}))}catch(e){Ms.error(e)}}this._queue=[]}},_b=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,r,i;this._context||(this._context={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(r=this._context.maxContentY)&&void 0!==r?r:0),this._context.maxContentHeight=Math.max(l,null!==(i=this._context.maxContentHeight)&&void 0!==i?i:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){Ws(l,"scroll",this._updateScrollData,{capture:!0}),Ws(l,"scrollend",this._updateScrollData,{capture:!0}),Ws(l,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==l||null==(e=l.document)?void 0:e.documentElement;for(var t of Et(this._scrollRoot)?this._scrollRoot:[this._scrollRoot]){var r,i=null==l||null==(r=l.document)?void 0:r.querySelector(t);if(i)return i}}_scrollPosition(e){var t,r,i="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var s=this.scrollElement();return s&&s[i]||0}return l?"y"===e?l.scrollY||l.pageYOffset||(null==(t=l.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:l.scrollX||l.pageXOffset||(null==(r=l.document)||null==(r=r.documentElement)?void 0:r.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}},gb=e=>bl(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes),vb=class{constructor(e,t,r,i){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var r={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Le]:r})}},this._instance=e,this._sessionIdManager=t,this._persistence=r,this._sessionSourceParamGenerator=i||gb,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Le]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?Sl(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return As($s(this.getSetOnceProps()),(t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+_t(r)]=t}),e}},fb=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(var r of this._events[e]||[])r(t);for(var i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}},mb=Fs("[SessionId]"),yb=864e5,bb=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,r){var i;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new fb,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Ot(e)||!Ot(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._pendingBootstrapSession=void 0,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||va,this._windowIdGenerator=r||va;var s=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Qt(this._config.session_idle_timeout_seconds||1800,60,36e3,mb.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var n=Na._parse(this._window_id_storage_key),o=Na._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Na._remove(this._window_id_storage_key),Na._set(this._primary_window_exists_storage_key,!0)}null!=(i=this._config.bootstrap)&&i.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Rt(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&Na._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Na._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Na._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!Ft(t)&&!Ft(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,r){var i=t!==this._sessionActivityTimestamp,s=!(e!==this._sessionId||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,s&&!i||s&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[Q]:[t,e,r]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return Ot(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(Q):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!Ft(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[Q]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=Ot(e)?e:0,r=Ot(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[Q];return Et(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var r=function(e,t){void 0===t&&(t=(new Date).getTime());try{var r=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return r>t+6e4?void mb.error("Bootstrap sessionID cannot be in the future"):r}catch(e){return void mb.error("Invalid sessionID in bootstrap",e)}}(e);return!Rt(r)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:r}:this._setSessionId(e,(new Date).getTime(),r),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&l&&(l.removeEventListener(nt,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Na._remove(this._primary_window_exists_storage_key)},Ws(l,nt,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,r){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===r&&(r=!1),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this._sessionId;if(r)this._lastCookieSyncTimestamp=i;else if(Ft(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>i||i-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=i}var a=this._getSessionId(),l=a[1],u=a[2],d=!Rt(s)&&l!==s,c=this._freshestActivityTimestamp(),h=this._getWindowId(),p=this._pendingBootstrapSession,_=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>yb),g=p?_:Ot(u)&&Math.abs(i-u)>yb,v=!1,f=d,m=!l||!!p,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(i,c);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(i))||mb.info("cross-tab refresh kept the session alive",{sessionId:l});var S=this._getSessionId();l=S[1],u=S[2]}if(m||b||g){f=!1;var w=p&&!_;l=w?p.sessionId:this._sessionIdGenerator(),h=this._windowIdGenerator(),mb.info("new session ID assigned",{sessionId:l,windowId:h,bootstrapped:!!w,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),u=w?p.sessionStartTimestamp:i,this._pendingBootstrapSession=void 0,v=!0}else h||(h=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(mb.info("adopted cross-tab session id",{sessionId:l,windowId:h}),v=!0);var k=Ot(c)&&e&&!g?c:i,C=Ot(u)?u:(new Date).getTime();this._setWindowId(h),this._setSessionId(l,k,C),e||this._resetIdleTimer();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach(e=>e(l,h,E)),{sessionId:l,windowId:h,sessionStartTimestamp:C,changeReason:v?E:void 0,lastActivityTimestamp:c}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}},Sb=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&ct(r,t))return!0;try{var i=null==e?void 0:e.userAgentData;if(null!=i&&i.brands&&i.brands.some(e=>ct(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function wb(){return wb=a(function*(){var e=null==d?void 0:d.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t,r=null==(t=yield e.getHighEntropyValues(["model"]))?void 0:t.model;return Pt(r)&&r.length>0?r:void 0}catch(e){return void Ms.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),wb.apply(this,arguments)}var kb="custom",Cb="i.posthog.com",Eb=/^\/static\//,xb=["/s/","/e/","/i/"],Tb=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Cb,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":kb),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Eb.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=Gs(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,r){if("ui"===e)return r;var i=r,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Gs(r))?void 0:n.href)||r;i=s(new URL(o)).toString()}if(s&&"api"===e&&xb.some(e=>0===t.indexOf(e))){var a=this._urlKey(i);if(a){var l,u=this.apiHost,d=this._ingestionEndpoints;(null==(l=d)?void 0:l.apiHost)===u&&d.rewriteRequestPath===s||(this._ingestionEndpoints=d={apiHost:u,rewriteRequestPath:s,urls:new Set}),d.urls.add(a)}}return i}isIngestionEndpoint(e){var t=this._ingestionEndpoints,r=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&t.urls.has(r)}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var r=this._staticAssetHostOverride(t);if(r)return this._prepareEndpoint(e,t,""+r+t)}if(this.region===kb)return this._prepareEndpoint(e,t,this.apiHost+t);var i=Cb+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+i);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+i)}}},Ib=Fs("[PostHog ExternalIntegrations]"),Rb={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Pb=class{constructor(e){this._instance=e}_loadScript(e,t){var r;null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,e=>{if(e)return Ib.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(){var t,i,s,n=r[0],o=r[1];!o||null!=(t=b.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(Rb[n],()=>{var t;null==(t=b.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(i=b.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]&&(null==(s=b.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var r of Object.entries(null!==(i=this._instance.config.integrations)&&void 0!==i?i:{})){var i;t()}}},Mb=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return a(function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t._extensions.set(e.name,e);try{var r=e.setup(t._client);r&&(yield r)}catch(r){var i=t._extensions.get(e.name)===e;i&&t._extensions.delete(e.name),t._logger.error('Failed to set up browser extension "'+e.name+'"',r),i&&t._disposeExtension(e)}})()}getExtension(e){return this._extensions.get(e)}dispose(){if(!this._disposed){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&xt(t.then)&&t.then(void 0,t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)})}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}},Fb=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var r={};for(var i of e){var s=null==t?void 0:t.get_property(i);Rt(s)||(r[i]=s)}return r}set(e,t){var r;null==(r=this._instance.persistence)||r.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}},Lb="extensionsRemoteConfig",Ab=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=Ms,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new Fb(e),this.onEvent=e=>tg(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this._logger.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this._disposed)return tg(()=>{});var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},r=this.instance._internalEventEmitter.on(Lb,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),tg(r)},this._runtime=new Mb(Ms.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(k);return"string"==typeof e?e:void 0}get library(){return{name:Ba.LIB_NAME,version:Ba.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,i,s=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==s?void 0:s.sessionId)&&void 0!==t?t:"",windowId:null!==(r=null==s?void 0:s.windowId)&&void 0!==r?r:"",sessionStartTimestamp:null!==(i=null==s?void 0:s.sessionStartTimestamp)&&void 0!==i?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this._runtime.add(e)}getExtension(e){return this._runtime.getExtension(e)}capture(e,t,r){var i=this;return a(function*(){r?i.instance.capture(e,t,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):i.instance.capture(e,t)})()}registerDynamicEventProperties(e){return tg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(Lb,e))}sendRequest(e,t){var r=this;return a(function*(){var i;void 0===t&&(t={});var s=r.instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",e),n={method:t.method,url:t.query?eb(s,t.query):s,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?ft.Base64:void 0,timestampMode:t.sentAt};return"sendBeacon"===t.transport?(r.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,r.instance._send_request(n)})})()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}},Ob={},Db=0,Nb=()=>{},Bb='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$b="Surveys module not available",qb="sanitize_properties is deprecated. Use before_send instead",Hb="Invalid value for property_denylist config: ",Ub=/^[A-Za-z0-9_-]{1,400}$/,Wb=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,zb=["token","distinct_id",qe],Vb="posthog",jb=!Zy&&-1===(null==f?void 0:f.indexOf("MSIE"))&&-1===(null==f?void 0:f.indexOf("Mozilla")),Gb=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},Qb=e=>{var t;return n({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Us(null==c?void 0:c.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Nb,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:h&&Pt(null==h?void 0:h.search)&&-1!==h.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==l||null==(t=l.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Ms.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:it,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Nb},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:bn,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:Gb(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},Kb=[["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"]],Zb=e=>{var t={};for(var r of Kb){var i=r[0],s=r[1];Rt(e[i])||(t[s]=e[i])}var n=Os({},t,e),o=e.__preview_external_dependency_versioned_paths;return Rt(o)||(Rt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),Pt(o)&&Rt(e.asset_host)&&(n.asset_host=o)),Et(e.property_blacklist)&&(Rt(e.property_denylist)?n.property_denylist=e.property_blacklist:Et(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Ms.error(Hb+e.property_denylist)),n},Yb=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Ms.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Jb=(e=class e{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(!(this._hasWarnedAboutVolatileIdentity||this.config.reuseAnonymousId||this.config.segment||this._inCookielessMode())){var e,t,r,i="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(i||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(i?(e="persistence is set to '"+this.config.persistence+"'",t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",r="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)",t="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", 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. "+r)))}}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&"$posthog_cookieless"===this.get_distinct_id()){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){var r=this.config.get_device_id(va());this.register({distinct_id:r,$device_id:r}),e.set_property(Fe,tt)}this._sync_opt_out_with_persistence()}}}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new Yb,this._personProcessingSetOncePropertiesSent=!1,this.version=Ba.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new fb,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qb(),this.SentryIntegration=Ey,this.sentryIntegration=e=>function(e,t){var r=Cy(e,t);return{name:ky,processEvent:e=>r(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new _b(this),this.pageViewManager=new xy(this),this.rateLimiter=new jy(this),this.requestRouter=new Tb(this),this.consent=new vy(this),this.externalIntegrations=new Pb(this);var r=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(e,t,r)=>{var i=Pt(e)?{[e]:t}:e;this.setPersonProperties(i),null==r||r({})},set_once:(e,t,r)=>{var i=Pt(e)?{[e]:t}:e;this.setPersonProperties(void 0,i),null==r||r({})}},this.on("eventCaptured",e=>Ms.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,r,i){if(i&&i!==Vb){var s,n=null!==(s=Ob[i])&&void 0!==s?s:new e;return n._init(t,r,i),Ob[i]=n,Ob[Vb][i]=n,n}return this._init(t,r,i)}_init(e,t,r){var i,s,o;void 0===t&&(t={});var a,u=Pt(e)?e.trim():"";if(!u)return Ms.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return u!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Qb(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var d=Qb(t.defaults),c=Zb(t),h=Os({},d,c,{name:r,token:u});Tt(d.rageclick)&&Tt(c.rageclick)&&(h.rageclick=Os({},d.rageclick,c.rageclick)),Tt(d.session_recording)&&Tt(c.session_recording)&&(h.session_recording=Os({},d.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Ms.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:W_.GZipJS;var p=this._is_persistence_disabled();if(this.persistence=new Hy(this.config,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hy(n({},this.config,{persistence:"sessionStorage"}),p,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!p&&Na._is_supported()){var _=Na._parse(this._sessionRegisteredPropertiesStorageKey);Et(_)&&_.forEach(e=>{Pt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Na._remove(this._sessionRegisteredPropertiesStorageKey);var g=n({},this.persistence.props),v=n({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new hb(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new pb(this),this.__request_queue=[];var f=this._inCookielessMode();f||(this.sessionManager=new bb(this),this.sessionPropsManager=new vb(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,r)=>{(null!=r&&r.activityTimeout||null!=r&&r.sessionPastMaximumLength||null!=r&&r.crossTabAdoption)&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Ms.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(f)},0)):(Ms.info("Initializing extensions synchronously"),this._initExtensions(f)),Ba.DEBUG=Ba.DEBUG||this.config.debug,Ba.DEBUG&&Ms.info("Starting in debug mode",{this:this,config:t,thisC:n({},this.config),p:g,s:v}),!this.config.identity_distinct_id||null!=(i=t.bootstrap)&&i.distinctID||(t.bootstrap=n({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(s=t.bootstrap)?void 0:s.distinctID;if(this._hasStableInitialDistinctId=!!m&&!Mt(m),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var y=t.bootstrap.distinctID,b=this.get_distinct_id(),S=this.persistence.get_property(Fe);if(t.bootstrap.isIdentifiedID&&null!=b&&b!==y&&"anonymous"===S)this.identify(y);else if(t.bootstrap.isIdentifiedID&&null!=b&&b!==y&&"identified"===S)Ms.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var w=this.config.get_device_id(va()),k=t.bootstrap.isIdentifiedID?w:y;this.persistence.set_property(Fe,t.bootstrap.isIdentifiedID?rt:tt),this.register({distinct_id:y,$device_id:k})}}if(f)this.register_once({distinct_id:$e,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(va());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Fe,tt)}return Ws(l,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Ws(l,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null==(e=this._retryQueue)||e.resume()}),t.segment?wy(this,()=>this._loaded()):this._loaded(),xt(this.config._onCapture)&&this.config._onCapture!==Nb&&(Ms.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Ms.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 wb.apply(this,arguments)}().then(e=>{e&&this.register({[C]:e})}).catch(Nb),this}_isSharedExtension(e){var t=e;return Pt(t.name)&&xt(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>null==e.dispose?void 0:e.dispose()).catch(t=>{Ms.error('Failed to dispose browser extension "'+e.name+'"',t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var t,r,i,s,n,o,a=null!==(t=null==(r=this.config.__extensionClasses)?void 0:r.featureFlags)&&void 0!==t?t:null==(i=e.__defaultExtensionClasses)?void 0:i.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this._featureFlagsReloadingUnsubscribe)||o.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new a(this)),xt(this.featureFlags.onReloading)&&xt(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}_initExtensions(t){var r,i,s,o,a,l,u,d=performance.now(),c=n({},e.__defaultExtensionClasses,this.config.__extensionClasses),h=[];c.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(this.tracingHeaders=new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!t&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this._enrollExtension(this.autocapture=new c.autocapture(this),h),c.surveys&&this._enrollExtension(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new c.surveys(this),h),c.logs&&this._enrollExtension(this.logs=null!==(s=this.logs)&&void 0!==s?s:new c.logs(this),h),c.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new c.metrics(this)),c.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,yy)),c.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(u=this.experiments)&&void 0!==u?u:new c.experiments(this)),this._extensions.forEach(e=>{e.initialize&&h.push(()=>{null==e.initialize||e.initialize()})}),h.push(()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this._processInitTaskQueue(h,d)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);var r=e.shift();if(r)try{r()}catch(e){Ms.error("Error initializing extension:",e)}}var i=Math.round(performance.now()-t);this.register_for_session({[He]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ue]:i}),this.config.__preview_deferred_init_extensions&&Ms.info("PostHog extensions initialized ("+i+"ms)")}_onRemoteConfig(e){var t;if(!c||!c.body)return Ms.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);if(this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this._lastRemoteConfig=e,this.compression=void 0,e.ok){var r,i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ht(i.supportedCompression,W_.GZipJS)?W_.GZipJS:ht(i.supportedCompression,W_.Base64)?W_.Base64:void 0),null!=(r=i.analytics)&&r.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:it}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}_loaded(){try{this.config.loaded(this)}catch(e){Ms.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=h&&h.hostname){var e=h.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this._inCookielessMode())&&this._captureInitialPageview()},1),this._remoteConfigLoader=new Qy(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Ls(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,r,i,s;this._isPageUnloading=!0,null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(at),null==(r=this.logs)||r.flushLogs("sendBeacon"),null==(i=this._requestQueue)||i.unload(),null==(s=this._retryQueue)||s.unload()):this._shouldCapturePageleave()&&this.capture(at,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?jb?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=n({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(Rt(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,r,i,s=n({},e);s.timeout=s.timeout||6e4;var o,a,l,u,d,c=null!==(t=s.transport)&&void 0!==t?t:"fetch";"sendBeacon"===c&&Rt(s.compression)&&s.data&&(s.compression=W_.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(a=null==(d=(u=(Et(o=s.data)?o:[o]).map(e=>n({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0])||null==(l=d.properties)?void 0:l.token)&&void 0!==a?a:null==d?void 0:d.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),Et(e)?e.map(e=>n({},e,{sent_at:t})):n({},e,{sent_at:t})}(s.data))),s.url=db(s.url,s.method,s.compression,s.timestampMode);var h=cb.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),p=null!==(r=null==(i=function(e,t){for(var r=0;e.length>r;r++)if(t(e[r]))return e[r]}(h,e=>e.transport===c))?void 0:i.method)&&void 0!==r?r:h[0].method;if(!p)throw new Error("No available transport method");var _=e=>{try{p(e)}catch(e){ob(e)?Ms.warn(e):Ms.error(e),null==s.callback||s.callback({statusCode:0,error:e})}};"sendBeacon"!==c&&s.data&&s.compression===W_.GZipJS&&v&&"undefined"!=typeof Promise&&!Jy?sb(s).then(e=>{_(e)}).catch(t=>{if(is(t))return Jy=!0,void _(n({},s,{compression:void 0,url:db(e.url,e.method,void 0,e.timestampMode)}));ss(t)&&(Jy=!0),_(s)}):p(s)})(n({},e,{callback:t=>{var r,i;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(i=this.config).on_request_error)||r.call(i,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Db++;try{var t,r=[],i=[],s=[];Ls(e,e=>{if(e)if(Et(t=e[0]))s.push(e);else if(xt(e))try{e.call(this)}catch(t){Ms.error("Error executing queued PostHog call",e,t)}else Et(e)&&"alias"===t?r.push(e):Et(e)&&-1!==t.indexOf("capture")&&xt(this[t])?s.push(e):i.push(e)});var n=function(e,t){Ls(e,function(e){try{if(Et(e[0])){var r=t;As(e,function(e){r=r[e[0]].apply(r,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Ms.error("Error executing queued PostHog call",e,t)}})};n(r,this),n(i,this),n(s,this)}finally{Db--}}push(t){if(Db>0&&Et(t)&&Pt(t[0])){var r=e.prototype[t[0]];xt(r)&&r.apply(this,t.slice(1))}else this._execute_array([t])}_getPersistedFacebookClickId(){var e,t=null==(e=this.persistence)?void 0:e.get_property(I);return Pt(t)&&Wb.test(t)?{value:t,delivered:!1}:Tt(t)&&Pt(t.value)&&Wb.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,r,i){if(this.persistence){this.persistence.refreshKey(I);var s=this._getPersistedFacebookClickId();if(!i){if(r)return Pt(t)&&Wb.test(t)?(t!==(null==s?void 0:s.value)&&this.persistence.register({[I]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(I);if(Pt(e)&&Ub.test(e)){if((null==s?void 0:s.value.split(".")[3])===e)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+e;return this.persistence.register({[I]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(I)}}_markFacebookClickIdDelivered(e){if(this.persistence){this.persistence.refreshKey(I);var t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[I]:{value:e,delivered:!0}})}}capture(e,t,r){var i,s,o,a,l,u,d,c,h,p;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Rt(e)&&Pt(e)){this._healCookielessSentinelDistinctId();var _=!this.config.opt_out_useragent_filter&&this._is_bot();if(!_||this.config.__preview_capture_bot_pageviews){var g=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==g||!g.isRateLimited){var v;null!=t&&t.$current_url&&!Pt(null==t?void 0:t.$current_url)&&(Ms.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=r&&r._originatedFromCaptureException||Ms.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&&(v=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var f=new Date,m=(null==r?void 0:r.timestamp)||f,y=oi(null==r?void 0:r.uuid,va),b={uuid:y,event:e,properties:this.calculateEventProperties(e,t||{},m,y)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&_&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),g&&(b.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens);var S="$feature_flag_called"===e&&!1===b.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=r&&r.$set&&!S&&(b.$set=null==r?void 0:r.$set);var w=Tt(null==t?void 0:t.$set)?t.$set:void 0,k=!(null==r||!r.$set)&&"$fbc"in r.$set,C=k||!!w&&"$fbc"in w,E=k?null==r||null==(i=r.$set)?void 0:i[T]:null==w?void 0:w[T],x=Et(null==t?void 0:t.$unset)?t.$unset:[],I=(null==r?void 0:r.$unset)||[],R=-1!==x.indexOf("$fbc")||-1!==I.indexOf("$fbc"),P=this._updateFacebookClickId(null==(s=v)?void 0:s.fbclid,E,C,R);P&&!0===b.properties.$process_person_profile&&P.pending&&!C&&!S&&(b.$set=n({[T]:P.value},b.$set));var M=null==r?void 0:r.$unset;M&&(b.$unset=M);var F=S?void 0:this._calculate_set_once_properties(null==r?void 0:r.$set_once,e!==ut,e===lt);if(F&&(b.$set_once=F),null!=r&&r._noTruncate||(d=this.config.properties_string_max_length,c=b,h=e=>Pt(e)?e.slice(0,d):e,p=new Set,b=function e(t,r){if(t!==Object(t))return h?h(t):t;if(!p.has(t)){var i;if(p.add(t),Et(t))i=[],Ls(t,t=>{i.push(e(t))});else{var s={};As(Ut(t)?qs(t):t,(t,r)=>{p.has(t)||(s[r]=e(t,r))}),i=s}return i}}(c)),b.timestamp=m,Rt(null==r?void 0:r.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=f),S&&(b.properties=function(e,t){void 0===t&&(t=[]);var r={},i=t=>{void 0!==e[t]&&(r[t]=e[t])};return Xi.forEach(i),t.forEach(i),r}(b.properties,zb)),e===J_.DISMISSED||e===J_.SENT){var L=null==t?void 0:t[X_.SURVEY_ID],A=null==t?void 0:t[X_.SURVEY_ITERATION];ag({id:L,current_iteration:A}),b.$set=n({},b.$set,{[za({id:L,current_iteration:A},e===J_.SENT?"responded":"dismissed")]:!0})}else e===J_.SHOWN&&(b.$set=n({},b.$set,{[X_.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Wy.SHOWN){var O=null==t?void 0:t[zy.TOUR_TYPE];O&&(b.$set=n({},b.$set,{[zy.TOUR_LAST_SEEN_DATE+"/"+O]:(new Date).toISOString()}))}var D=n({},b.properties.$set,b.$set);if(It(D)||this.setPersonPropertiesForFlags(D),!Lt(this.config.before_send)){var N=this._runBeforeSend(b);if(!N)return;(b=N).uuid=oi(b.uuid,va)}var B=null!==(o=null==(a=b.$set)?void 0:a.$fbc)&&void 0!==o?o:Tt(null==(l=b.properties)?void 0:l.$set)?b.properties.$set.$fbc:void 0,q=null!=P&&P.pending&&B===P.value?P.value:void 0;this._internalEventEmitter.emit("eventCaptured",b);var H,U=null!==(u=null==r?void 0:r._url)&&void 0!==u?u:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),W=n({method:"POST",url:U,data:b,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(U)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey},null!=r&&r.transport?{transport:r.transport}:{},q?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markFacebookClickIdDelivered(q)}}:{});return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly||q?(!W.transport&&!W.callback&&It(null!==(H=this.config.request_headers)&&void 0!==H?H:{})&&this._isPageUnloading&&(W.transport="sendBeacon"),this._send_retriable_request(W)):this._requestQueue.enqueue(W),b}Ms.critical("This capture call is ignored due to client rate limiting.")}}else Ms.error("No event name provided to posthog.capture")}else Ms.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new Ab(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var r=this._extensionEventPropertyProducers.indexOf(e);-1!==r&&this._extensionEventPropertyProducers.splice(r,1)}}}_processCookieIdentityChange(e){var t,r,i;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(i=this.sessionPersistence)||i.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(r=this.featureFlags)||r.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var o=s?void 0:this.persistence.remove_event_timer(e),a=n({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this._inCookielessMode()&&(a[qe]=!0),"$snapshot"===e){var u=n({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!Pt(a.distinct_id)&&!At(a.distinct_id)||Mt(a.distinct_id))&&Ms.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var d,p=function(e,t,r,i){var s,n,o,a;if(void 0===i&&(i=!1),!f)return{};var u,d=e?[...dl,...t||[]]:[],c=Qr(f),p=c[0],_=c[1],g=function(e){for(var t=0;Jr.length>t;t++){var r,i=Jr[t],s=i[1],n=i[2],o=e.match(i[0]);if(o)return[s,(null==(r=n&&e.match(n)||o)?void 0:r[1])||""]}return["",""]}(f),v=g[0],m=g[1],y=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},b={};Rt(r)||(b.detectGoogleSearchApp=r);var S={},w=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,k=null==(n=navigator)?void 0:n.maxTouchPoints,C=null==l||null==(o=l.screen)?void 0:o.width,E=null==l||null==(a=l.screen)?void 0:a.height,x=null==l?void 0:l.devicePixelRatio;Rt(w)||(S.userAgentDataPlatform=w),Rt(k)||(S.maxTouchPoints=k),Rt(C)||(S.screenWidth=C),Rt(E)||(S.screenHeight=E),Rt(x)||(S.devicePixelRatio=x);var T,I=Os($s({$os:p,$os_version:_,$browser:zr(f,navigator.vendor,y,b),$webview_app:v,$webview_app_version:m,$device:Kr(f),$device_type:Zr(f,S),$timezone:wl(),$timezone_offset:kl()}),{$current_url:Zs(i?li(null==h?void 0:h.href):null==h?void 0:h.href,d,hl),$host:null==h?void 0:h.host,$pathname:null==h?void 0:h.pathname,$raw_user_agent:f.length>1e3?f.substring(0,997)+"...":f,$browser_version:jr(f,navigator.vendor,y,b),$browser_language:fl(),$browser_language_prefix:(T=fl(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==l?void 0:l.screen.height,$screen_width:null==l?void 0:l.screen.width,$viewport_height:null==l?void 0:l.innerHeight,$viewport_width:null==l?void 0:l.innerWidth,$lib:Rs.LIB_NAME,$lib_version:Rs.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Rs.SDK_DIST_CHANNEL&&(I.$sdk_dist_channel=Rs.SDK_DIST_CHANNEL),I}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var _=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime(),!0),g=_.windowId;a.$session_id=_.sessionId,a.$window_id=g}this.sessionPropsManager&&Os(a,this.sessionPropsManager.getSessionProps());try{var v;this.sessionRecording&&Os(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(v=this._retryQueue)?void 0:v.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===kb&&(a.$lib_custom_api_host=this.config.api_host),d="$pageview"!==e||s?"$pageleave"!==e||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=Os(a,d),"$pageview"===e&&c&&(a.title=c.title),!Rt(o)){var m=r.getTime()-o;a.$duration=parseFloat((m/1e3).toFixed(3))}f&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),b=this.sessionPersistence.properties(),S=a.$groups,w=y.$groups;Tt(S)&&!It(S)&&(a.$groups=n({},Tt(w)?w:{},S)),As(["$referrer","$referring_domain"],e=>{e in y&&delete b[e]});var k={};if(this._extensionEventPropertyProducers.length>0)for(var C of this._extensionEventPropertyProducers.slice())try{Os(k,C())}catch(e){Ms.error("Failed to produce browser extension event properties",e)}(a=Os({},p,y,b,n({},k,a))).$is_identified=this._isIdentified(),Et(this.config.property_denylist)?As(this.config.property_denylist,function(e){delete a[e]}):Ms.error(Hb+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(Ms.error(qb),a=E(a,e));var x=this._hasPersonProcessing();return a.$process_person_profile=x,x&&!s&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(e,t,r){var i;if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!r)return e;var s=Os({},this.persistence.get_initial_props(),(null==(i=this.sessionPropsManager)?void 0:i.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(Ms.error(qb),s=n(s,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),It(s)?void 0:s}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var i;null==(i=this.persistence)||i.register_once(e,t,r)}register_for_session(e){var t,r;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(r=this.sessionPersistence)||r.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!Na._is_supported())Na._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Na._set(this._sessionRegisteredPropertiesStorageKey,t):Na._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var r,i;return null!==(r=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))&&void 0!==r?r:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var i;null==(i=this.featureFlags)||i.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var i;return void 0===t&&(t=!1),null==(i=this.featureFlags)?void 0:i.getEarlyAccessFeatures(e,t,r)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:$b}),()=>{})}onSessionId(e){var t,r;return null!==(t=null==(r=this.sessionManager)?void 0:r.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:$b})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:$b})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=ug),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!==(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:$b}}canRenderSurveyAsync(e,t){var r,i;return void 0===t&&(t=!1),null!==(r=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,t))&&void 0!==r?r:Promise.resolve({visible:!1,disabledReason:$b})}_validateIdentifyId(e){return!e||Mt(e)?(Ms.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Ms.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(Ms.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return Ms.uninitializedWarning("posthog.identify");if(At(e)&&(e=e.toString(),Ms.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._healCookielessSentinelDistinctId();var i=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(E),this.register({distinct_id:e}));var u=(this.persistence.get_property("$user_state")||"anonymous")===tt,d=e!==l,c=!d&&u;if(d&&u){var h,p=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(Fe,rt),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(lt,p,{$set:t||{},$set_once:r||{}}),this._cachedPersonProperties=rl(e,t,r),null==(h=this.featureFlags)||h.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(c){this.persistence.set_property(Fe,rt);var _=t||{},g=r||{};this.setPersonPropertiesForFlags({$set:_,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:_,$set_once:g}),this._cachedPersonProperties=rl(e,t,r)}else(t||r)&&this.setPersonProperties(t,r);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Ie)):c&&(t||r)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=rl(this.get_distinct_id(),e,t);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=r):Ms.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(Et(e)?e:[e]).filter(e=>Pt(e)&&e.length>0);0!==r.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this._cachedPersonProperties=null)}group(e,t,r){var i;if(e&&t){null==(i=this.persistence)||i.syncCookieProperties(),this._processCookieIdentityChange();var s=this.getGroups(),o=s[e]!==t;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:n({},s,{[e]:t})}),(o||r)&&this._hasPersonProcessing()){var a={$group_type:e,$group_key:t};r&&(a.$group_set=r),this.capture(ut,a)}r&&this.setGroupPropertiesForFlags({[e]:r}),o&&!r&&this.reloadFeatureFlags()}else Ms.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=Dt(e)?e:null==e?void 0:e.resetDeviceID,r=Dt(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,r)}_reset(e,t,r){var i,s,o,a;if(void 0===t&&(t=!1),Ms.info("reset"),!this.__loaded)return Ms.uninitializedWarning("posthog.reset");var l=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(i=this._originalUserConfig)?void 0:i.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this._shouldDisableFlags());var u=this.get_property(k),d=this.get_property(C),c=this.get_property(H);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var h=this.is_capturing();this.consent.reset(),t||!h||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var p=null==(a=this.persistence)||null==a._beginCookieSyncSuppression?void 0:a._beginCookieSyncSuppression(),_=!1;try{var g,v,f,m,y,b,S,w,E,x,T,I,R;if(null==(g=this.persistence)||g.clear(),null==(v=this.sessionPersistence)||v.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Rt(c)||null==(f=this.persistence)||f.register({[H]:c}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(b=this.conversations)||b.reset(),null==(S=this.logs)||S.reset(),null==(w=this.metrics)||w.reset(),null==(E=this.persistence)||E.set_property(Fe,tt),null==(x=this.sessionManager)||x.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:$e,$device_id:null},"");else{var P=this.config.get_device_id(va());this.register_once({distinct_id:P,$device_id:e?P:u},""),e||Rt(d)||this.register({[C]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this._inCookielessMode()||(null==(R=this.persistence)||R.set_property(Fe,r.isIdentifiedID?rt:tt),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(Rt(l)||null!=(I=this.sessionManager)&&I.setBootstrapSessionId(l,!0))){var M=n({},r);delete M.sessionID,this.config.bootstrap=M}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var F;p&&(null==(F=this.persistence)||null==F._endCookieSyncSuppression||F._endCookieSyncSuppression(_))}this.reloadFeatureFlags()}shutdown(e){var t=this;return a(function*(){var e,r,i,s,n,o,a;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(r=t.logs)||r.flushLogs("sendBeacon"),null==(i=t.metrics)||i.flush("sendBeacon"),null==(s=t._requestQueue)||s.unload(),null==(n=t._retryQueue)||n.unload();try{var l;null==(l=t.featureFlags)||l.destroy()}catch(e){Ms.error("Error while destroying feature flags",e)}null==(o=t.persistence)||o.destroy(),null==(a=t.sessionPersistence)||a.destroy()}else Ms.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var r;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(e=this.conversations)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=t.sessionStartTimestamp,i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&r){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-n,0)}return i}alias(e,t){return e===this.get_property("$people_distinct_id")?(Ms.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Rt(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(E,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Ms.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=n({},this.config);if(Tt(e)){var r,i,s,o,a,l,u,d,c,h,p,_,g;Os(this.config,Zb(e));var v=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Hy(n({},this.config,{persistence:"sessionStorage"}),v,!1);var f=this._checkLocalStorageForDebug(this.config.debug);Dt(f)&&(this.config.debug=f),Dt(this.config.debug)&&(this.config.debug?(Ba.DEBUG=!0,ka._is_supported()&&ka._set("ph_debug",!0),Ms.info("set_config",{config:e,oldConfig:t,newConfig:n({},this.config)})):(Ba.DEBUG=!1,ka._is_supported()&&ka._remove("ph_debug"))),null==(i=this.featureFlags)||null==i.updateConfig||i.updateConfig(this.config,this._shouldDisableFlags()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(c=this.historyAutocapture)||c.startIfEnabledOrStop()),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(p=this.deadClicksAutocapture)||p.startIfEnabledOrStop(),null==(_=this.surveys)||_.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(g=this.externalIntegrations)||g.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&wy(this,Nb,!1)}}_overrideSDKInfo(e,t){Ba.LIB_NAME=e,Ba.LIB_VERSION=t}startSessionRecording(e){var t,r,i,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){try{if(!this.exceptions)return;var r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(n({},r,t))}catch(e){return}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,r;return null!==(t=null==(r=this.logs)?void 0:r.logger)&&void 0!==t?t:e._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!==(t=null==(r=this.toolbar)?void 0:r.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:Vb;return t!==Vb&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&It(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e.__alias)&&(null==(t=this.persistence)||null==(t=t.props)||!t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(Ms.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Be,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t,r,i,s,n=this._is_persistence_disabled();return this.is_capturing()||null==(e=this.logs)||e._onOptOut(),(null==(t=this.persistence)?void 0:t._disabled)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(i=this.sessionPersistence)?void 0:i._disabled)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(t){var r,i,s;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var n,o,a,l,u,d;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new bb(this),this.pageViewManager=new xy(this),this.persistence&&(this.sessionPropsManager=new vb(this,this.sessionManager,this.persistence));var c,h=null!==(l=null==(u=this.config.__extensionClasses)?void 0:u.sessionRecording)&&void 0!==l?l:null==(d=e.__defaultExtensionClasses)?void 0:d.sessionRecording;h&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new h(this)),this._lastRemoteConfig&&(null==(c=this.sessionRecording)||null==c.onRemoteConfig||c.onRemoteConfig(this._lastRemoteConfig)))}this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(i=this.surveys)||i.loadIfEnabled()),(Rt(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(s=null==t?void 0:t.captureEventName)&&void 0!==s?s:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Ms.warn(Bb)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var e,t,r="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==r||r.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:$e,$device_id:null}),this._removeExtension(r),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}else Ms.warn(Bb)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"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._sync_opt_out_with_persistence()}_is_bot(){return d?Sb(d,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){c&&("visible"===c.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(ot,{title:c.title},{send_instantly:!0}),this._visibilityStateListener&&(c.removeEventListener(st,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),Ws(c,st,this._visibilityStateListener)))}debug(e){!1===e?(null==l||l.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==l||l.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}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ms.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(e,t,r,i,s){var n=t in e&&!Lt(e[t]),o=r in e&&!Lt(e[r]);return n?e[t]:!!o&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r])}(e,"advanced_disable_flags","advanced_disable_decide",0,Ms)}_runBeforeSend(e){var t;if(Lt(this.config.before_send))return e;var r=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter($t),i=Et(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var n of i)try{if(s=n(s),Lt(s)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Bt(e.event)?Ms.warn(o+". This can cause unexpected behavior."):Ms.info(o),null}s.properties&&!It(s.properties)||Ms.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Ms.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of r)if(s.properties&&Lt(s.properties[a]))return Ms.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}_checkLocalStorageForDebug(e){var t=Dt(e)&&!e,r=ka._is_supported()&&"true"===ka._get("ph_debug");return!t&&(!!r||e)}},e.__defaultExtensionClasses={},e._noopLogger=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),e);!function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=Bs(e.prototype[t[r]])}(Jb,["identify"]);var Xb=class{constructor(e){this._instance=e}refresh(e){var t=this._instance.config,r=Tt(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance._shouldDisableFlags(),e.url_allowlist=null==r?void 0:r.url_allowlist,e.url_ignorelist=null==r?void 0:r.url_ignorelist,e.dom_event_allowlist=null==r?void 0:r.dom_event_allowlist,e.element_allowlist=null==r?void 0:r.element_allowlist,e.css_selector_allowlist=null==r?void 0:r.css_selector_allowlist,e.css_selector_ignorelist=null==r?void 0:r.css_selector_ignorelist,e.element_attribute_ignorelist=null==r?void 0:r.element_attribute_ignorelist,e.capture_copied_text=null==r?void 0:r.capture_copied_text}},eS=Fs("[ExceptionAutocapture]"),tS=Fs("[TracingHeaders]"),rS=Fs("[Web Vitals]"),iS=9e5,sS=["CLS","FCP","INP","LCP"],nS=["INP","LCP"],oS=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],aS=Fs("[SessionRecording]"),lS=Fs("[Heatmaps]");function uS(e){return Tt(e)&&"clientX"in e&&"clientY"in e&&At(e.clientX)&&At(e.clientY)}var dS=Fs("[Product Tours]"),cS=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(N))},hS=Fs("[SiteApps]"),pS="Error while initializing PostHog app with config id ",_S=(e,t)=>null!=e&&e.then?e.then(t):t(e),gS="SDK is not enabled or survey functionality is not yet loaded",vS="Disabled. Not loading surveys.",fS=class{constructor(e,t){this._configSource=e,this._initialClientState=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._lastSurveyRefreshFailedAt=null,this._disposed=!1,this._renderTimeouts=new Set,this.onRemoteConfig=e=>{if(!this._disposed&&!this._config.disableSurveys){if(!e.ok)return rg.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(Lt(t))return rg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=Dt(t)?t:t.length>0,rg.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}}setup(e){if(!this._disposed)return this._initializingClient=e,_S(e.kv.initialize(),()=>{if(this._initializingClient===e&&!this._disposed){this._initializingClient=void 0,this._client=e;var t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())}})}dispose(){var e,t,r;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(r=this._surveyManager)||null==r.dispose||r.dispose(),this._surveyManager=null,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._renderTimeouts.forEach(e=>clearTimeout(e)),this._renderTimeouts.clear())}get _config(){return this._configSource.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);(null!=i&&i.startsWith("seenSurvey_")||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(!this._disposed&&this._client){var e=this._config;if(!this._surveyManager)if(this._isInitializingSurveys)rg.info("Already initializing surveys, skipping...");else if(e.disableSurveys)rg.info(vS);else if(e.cookielessMode&&this._configSource.isOptedOut())rg.info("Not loading surveys in cookieless mode without consent.");else{var t=this._configSource.getExtensions();if(t){if(!Rt(this._isSurveysEnabled)||e.advancedEnableSurveys){var r=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{var i=t.generateSurveys;if(i)return this._completeSurveyInitialization(i,r),void(this._isInitializingSurveys=!1);var s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(et),void(this._isInitializingSurveys=!1);s(e=>{try{if(this._disposed)return;var t=this._configSource.getExtensions();e||null==t||!t.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,r)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}}else rg.error("PostHog Extensions not found.")}}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),rg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){rg.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(t=>t!==e)}}getSurveys(e,t){var r;void 0===t&&(t=!1);var i=null!==(r=this._client)&&void 0!==r?r:this._initialClientState;if(i&&!this._disposed){if(this._config.disableSurveys)return rg.info(vS),e([]);var s=i.kv.get(ve);if(s&&!t)return e(s,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)this._getSurveysInFlightPromise.then(t=>{this._disposed||e(t.surveys,t.context)}).catch(e=>rg.error("Error in survey callback",e));else{var n=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(i,e)}catch(e){return rg.error("Error processing surveys response",e),this._handleSurveyResponse(i,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(i,{statusCode:0,error:e}));this._getSurveysInFlightPromise=n;var o=()=>{this._getSurveysInFlightPromise===n&&(this._getSurveysInFlightPromise=null)};n.then(t=>{o(),this._disposed||e(t.surveys,t.context)},o).catch(e=>rg.error("Error in survey callback",e))}}}_sendSurveysRequest(e,t){var r=this._client;return r?r.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:new Error(gS)}))}_handleSurveyResponse(e,t){var r;if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:gS}};var i=t.statusCode;if(200!==i||!t.json){var s="Surveys API could not be loaded, status: "+i;return 0!==i?rg.error(s):t.error||rg.warn(s),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this._lastSurveyRefreshFailedAt=null;var n=t.json.surveys||[],o=n.filter(e=>ig(e)&&(Za(e)||sg(e)));return o.length>0&&(null==(r=this._surveyEventReceiver)||r.register(o)),e.kv.set({[ve]:n,[fe]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t,r=null==(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)?void 0:e.kv.get(fe);return At(r)&&Date.now()-r>3e5}_isSurveyRefreshBackingOff(){return At(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var r;ag({id:e,current_iteration:null!==(r=null==t?void 0:t.iteration)&&void 0!==r?r:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){rg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Lt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);rg.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys(r=>{var i;t=null!==(i=r.find(t=>t.id===e))&&void 0!==i?i:null}),t}_checkSurveyEligibility(e){if(Lt(this._surveyManager))return{eligible:!1,reason:gS};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(Lt(this._surveyManager))return{eligible:!1,reason:gS};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Lt(this._surveyManager))return rg.warn("init was not called"),{visible:!1,disabledReason:gS};var t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Lt(this._surveyManager)?(rg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:gS})):new Promise(r=>{this.getSurveys(t=>{var i,s=null!==(i=t.find(t=>t.id===e))&&void 0!==i?i:null;if(s){var n=this._checkSurveyRenderability(s);r({visible:n.eligible,disabledReason:n.reason})}else r({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,r){var i;if(Lt(this._surveyManager))rg.warn("init was not called");else{var s="string"==typeof e?this._getSurveyById(e):e;if(null!=s&&s.id)if(lg.includes(s.type)){var n=null==c?void 0:c.querySelector(t);if(n)if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds){rg.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var e,t;this._renderTimeouts.delete(o),this._disposed||(rg.info("Rendering survey "+s.id+" with delay of "+(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(s,n,r),rg.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this._renderTimeouts.add(o)}else this._surveyManager.renderSurvey(s,n,r);else rg.warn("Survey element not found")}else rg.warn("Surveys of type "+s.type+" cannot be rendered in the app");else rg.warn("Survey not found")}}displaySurvey(e,t){var r;if(Lt(this._surveyManager))rg.warn("init was not called");else{var i=this._getSurveyById(e);if(i){var s=i;if(null!=(r=i.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=n({},i,{appearance:n({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==eg.Popover&&t.initialResponses&&rg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this._checkSurveyEligibility(i);if(!o.eligible)return void rg.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==eg.Inline?this._surveyManager.handlePopoverSurvey(s,t):this.renderSurvey(s,t.selector,t.properties)}else rg.warn("Survey not found")}}cancelPendingSurvey(e){Lt(this._surveyManager)?rg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}};function mS(e,t,r){if(Lt(e))return!1;switch(r){case"exact":return e===t;case"contains":var i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var yS=class{constructor(e){this._instance=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new fb,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;Rt(null==(e=this._instance)?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null==(t=this._instance)?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null==(e=this._captureHookUnsubscribe)||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new fb}register(e){var t,r;if(!Rt(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null==(t=e.steps)||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null!=(r=this._instance)&&r.autocapture)){var i=new Set;this._actionRegistry.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&i.add(e.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this._actionRegistry.clear(),this._actionEvents.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this._actionEvents.has(e)||this._actionEvents.has(t.event))&&this._actionRegistry.forEach(e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var r of t.steps)if(this._checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null!=t&&t.url){var r,i=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!i||"string"!=typeof i)return!1;if(!mS(i,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var r;if(null==t||!t.href)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some(e=>mS(e.href,t.href,t.href_matching||"exact"));var s,n=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!n&&mS((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var r;if(null==t||!t.text)return!0;var i=this._getElementsList(e);if(i.length>0)return i.some(e=>mS(e.text,t.text,t.text_matching||"exact")||mS(e.$el_text,t.text,t.text_matching||"exact"));var s,n,o,a=(null==e||null==(r=e.properties)?void 0:r.$elements_chain)||"";return!!a&&(s=function(e){for(var t,r=[],i=/(?::|")text="(.*?)"/g;!Lt(t=i.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(a),n=t.text,o=t.text_matching||"exact",s.some(e=>mS(e,n,o)))}_checkStepSelector(e,t){var r,i;if(null==t||!t.selector)return!0;if(null!=e&&null!=(r=e.properties)&&null!=(r=r.$element_selectors)&&r.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||tl(t.properties.reduce((e,t)=>{var r=Et(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},bS=class{constructor(e){var t;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null==(t=this._instance)||null==t.onSessionId?void 0:t.onSessionId(e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&tl(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){var r=new Map;return e.forEach(e=>{var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEach(t=>{if(null!=t&&t.name){var i=r.get(t.name)||[];i.push(e.id),r.set(t.name,i)}})}),r}_getMatchingItems(e,t,r){var i=(r===z_.Activation?this._eventToItems:this._cancelEventToItems).get(e),s=[];return this._getItems(e=>{s=e.filter(e=>null==i?void 0:i.includes(e.id))}),s.filter(i=>{var s,n=null==(s=i.conditions)||null==(s=s[r])||null==(s=s.values)?void 0:s.find(t=>t.name===e);return this._doesEventMatchFilter(n,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var r;Rt(null==(r=this._instance)?void 0:r._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){var r=e.filter(e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length});if(t&&this._actionToItems.clear(),0!==r.length){this._actionMatcher||(this._actionMatcher=new yS(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));var i=[];r.forEach(e=>{var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach(t=>{if(i.push(t),t.name){var r,s=null!==(r=this._actionToItems.get(t.name))&&void 0!==r?r:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}})}),t?this._actionMatcher.replace(i):this._actionMatcher.register(i)}else{var s;t&&(null==(s=this._actionMatcher)||s.replace([]))}}_mergeItemMaps(e,t){t.forEach((t,r)=>{var i,s=null!==(i=e.get(r))&&void 0!==i?i:[];t.forEach(e=>{s.includes(e)||s.push(e)}),e.set(r,s)})}_setupEventBasedItems(e,t){var r,i,s=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0}),n=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0}),o=this._buildEventToItemMap(e,z_.Activation),a=this._buildEventToItemMap(e,z_.Cancellation);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==s.length||0!==n.length)&&(null!==(r=this._captureHookUnsubscribe)&&void 0!==r||(this._captureHookUnsubscribe=null==(i=this._instance)?void 0:i._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var r,i,s=this._getLogger(),n=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this._activationOutcome(e,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:e,itemId:n}),void this._deactivateItems([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:e,itemId:n}),this._persistActivation(n),void this._clearActivationTimestamps([n])}if(this._cancelEventToItems.has(e)){var a=this._getMatchingItems(e,t,z_.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(e=>e.id)}),this._deactivateItems(a.map(e=>e.id)),a.forEach(e=>this._cancelPendingItem(e.id)))}if(this._eventToItems.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var l=this._getMatchingItems(e,t,z_.Activation);this._activateItems(l.map(e=>e.id))}}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t;if(0!==e.length){var r=!(null==(t=this._instance)||null==t.get_session_id||!t.get_session_id()),i=[];for(var s of e)r&&this._shouldPersistArmedActivation(s)?this._persistActivation(s)&&this._recordActivationTimestamp(s):i.push(s);i.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...i])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);var t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){var t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));var r=this._getRawPersistedActivatedIds(),i=r.filter(e=>!t.has(e));i.length!==r.length&&(this._setActivatedItems(i),0===i.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e,t=this._getActivationTimestampsKey();if(!t)return{};var r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return r&&"object"==typeof r?r:{}}_recordActivationTimestamp(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps();this._writeActivationTimestamps(n({},t,{[e]:Date.now()}))}}_clearActivationTimestamps(e){if(this._getActivationTimestampsKey()){var t=this._getRawActivationTimestamps(),r={},i=!1;for(var s of Object.entries(t)){var n=s[0],o=s[1];e.includes(n)?i=!0:r[n]=o}i&&(It(r)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(r))}}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(this._getPersistedActivatedIds().includes(e)){var t=this._getRawActivationTimestamps()[e];return At(t)?t:void 0}}_getRawPersistedActivatedIds(){var e,t=this._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,r=this._getRawPersistedActivatedIds();if(0===r.length)return[];var i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._getActivatedSessionKey()],s=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return s&&i===s?r:[]}_stampActivationSession(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this._setActivatedSession(t)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t,r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._getActivatedSessionKey()];if(r&&r!==e){var i=this._getRawPersistedActivatedIds(),s=this._getRawActivationTimestamps();i.length>0&&(this._setActivatedItems([]),i.filter(e=>At(s[e])).forEach(e=>this._cancelPendingItem(e))),this._clearActivationSession(),this._clearAllActivationTimestamps()}}getActivatedIds(){return[...new Set([...this._getPersistedActivatedIds(),...this._pendingActivatedItems])].filter(e=>!this._isItemPermanentlyIneligible(e))}dispose(){var e,t,r;null==(e=this._sessionIdUnsubscribe)||e.call(this),this._sessionIdUnsubscribe=void 0,null==(t=this._captureHookUnsubscribe)||t.call(this),this._captureHookUnsubscribe=void 0,null==(r=this._actionMatcher)||r.dispose(),this._actionMatcher=void 0}reset(){this._pendingActivatedItems=[],this._getRawPersistedActivatedIds().length>0&&this._setActivatedItems([]),this._clearActivationSession(),this._clearAllActivationTimestamps()}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}},SS=class extends bS{constructor(e){super(e)}_getActivatedKey(){return me}_getActivatedSessionKey(){return ye}_getActivationTimestampsKey(){return be}_writeActivationTimestamps(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[be]:e})}_clearActivationTimestampsStore(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(be)}_shouldPersistArmedActivation(e){var t,r;this._getItems(t=>{r=t.find(t=>t.id===e)});var i=null==(t=r)||null==(t=t.appearance)?void 0:t.surveyPopupDelaySeconds;return At(i)&&i>0}_getShownEventName(){return J_.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return rg}_setActivatedItems(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[me]:e})}_setActivatedSession(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[ye]:e})}_clearActivatedSession(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(ye)}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){var r;return this._getItems(e=>{r=e.find(e=>e.id===t)}),!r||Ya(r)?e===J_.SHOWN?"consume":"ignore":e===J_.SHOWN?"persist":e===J_.DISMISSED||e===J_.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},wS=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);var t={};for(var r of e){var i=this._instance.get_property(r);Rt(i)||(t[r]=i)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}},kS=class{constructor(e){this._instance=e}get(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var e=null==b?void 0:b.__PosthogExtensions__;if(e){var t=e.generateSurveys,r=e.loadExternalDependency;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:r?e=>r(this._instance,"surveys",e):void 0}}}createEventReceiver(){return new SS(this._instance)}},CS=null!=l&&l.location?Ys(l.location.hash,"__posthog")||Ys(location.hash,"state"):null,ES="_postHogToolbarParams",xS=Fs("[Toolbar]"),TS=Fs("[FeatureFlags]"),IS=class{constructor(e,t){void 0===t&&(t=!1),this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var r,i,s,n,o;return{bootstrap:{featureFlags:null==(r=e.bootstrap)?void 0:r.featureFlags,featureFlagPayloads:null==(i=e.bootstrap)?void 0:i.featureFlagPayloads},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=e.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=e.evaluation_contexts)&&void 0!==o?o:e.evaluation_environments)&&void 0!==n?n:[],flagKeys:Et(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(TS.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),Rt(e.flag_keys)||Et(e.flag_keys)||TS.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}},RS=Fs("[FeatureFlags]"),PS=Fs("[FeatureFlags]",{debugEnabled:!0}),MS="\" failed. Feature flags didn't load in time.",FS="connection_error",LS=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},AS=e=>{var t={};for(var r of Ds(e||{})){var i=r[1];i&&(t[r[0]]=i)}return t},OS="Refusing to render web experiment since the viewer is a likely bot",DS={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>Ja(t,e),not_regex:(e,t)=>!Ja(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},NS=Fs("[Conversations]"),BS="Conversations not available yet.";function $S(e,t){var r,i,s,o,a,l,u,c=null!==(r=null==e?void 0:e.flushIntervalMs)&&void 0!==r?r:3e3,h=null!==(i=null==e?void 0:e.maxBufferSize)&&void 0!==i?i:100,p=null!=t&&t.consoleCapture?void 0:null!==(s=null==e?void 0:e.maxLogsPerInterval)&&void 0!==s?s:1e3,_=Rt(p)?Math.max(h,2048):Math.max(h,p),g=n({},function(){var e="",t="";try{var r=null==d?void 0:d.userAgent;if(r){var i=Qr(r);e=i[0],t=i[1]}}catch(e){}return function(e,t){var r=function(e){if(e)return{}.hasOwnProperty.call(gs,e)?gs[e]:e}(e);return n({},r?{"os.name":r}:{},t?{"os.version":t}:{})}(e,t)}(),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==g?void 0:g["service.name"])&&void 0!==a?a:null==e?void 0:e.serviceName)&&void 0!==o?o:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(l=null==g?void 0:g["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(u=null==g?void 0:g["deployment.environment"])&&void 0!==u?u:null==e?void 0:e.environment,resourceAttributes:g,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:h,maxQueueSize:_,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:p,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var qS=["debug","log","warn","error","info"],HS="console",US="__posthogHandledLogsRequestError",WS=(e,t)=>{var r=e instanceof Error?e:new Error(t);return r[US]=!0,r},zS=e=>!!e&&"object"==typeof e&&!0===e[US],VS={featureFlags:class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=RS,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._reloadingHandlers=[],this._hasLoadedFlags=!1,this._requestInFlight=!1,this._requestGeneration=0,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._staleCacheRefreshTriggered=!1,this._consecutiveStatusZeroFailures=0,this._onOnline=()=>{var e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e,t=this._refreshIntervalMs;Rt(t)||this._config.remoteRequestsDisabled||!c||"hidden"===c.visibilityState||Date.now()-(null!==(e=this._lastRefreshAt)&&void 0!==e?e:0)<t||(this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onVisibilityChange=()=>{"visible"===(null==c?void 0:c.visibilityState)&&this._refreshIfDue()},"get"in e?this._configSource=e:(this._instance=e,this._mutableConfigSource=new IS(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var r;null==(r=this._mutableConfigSource)||r.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),_S(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(e){var t;if(this._client===e)return l&&Ws(l,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=e.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_syncAutomaticRefresh(){var e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&c&&!Rt(e)&&e>0?e:void 0;t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),Rt(t)||(this._refreshIntervalMs=t,this._scheduleNextRefresh(),null!=c&&c.addEventListener&&Ws(c,st,this._onVisibilityChange)))}_scheduleNextRefresh(){Rt(this._refreshIntervalMs)||(Rt(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){Rt(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==c||null==c.removeEventListener||c.removeEventListener(st,this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var e,t;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null==(e=this._dynamicProperties)||e.dispose(),this._dynamicProperties=void 0,null==(t=this._crossTabPersistenceUnsubscribe)||t.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null==l||l.removeEventListener("online",this._onOnline),this._client=void 0)}get _config(){return this._configSource.get()}_prop(e){var t;return this._bootstrapState&&e in this._bootstrapState?this._bootstrapState[e]:null==(t=this._client)?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!Rt(null==(e=this._client)?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null==(t=this._client)?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,r){var i;if(null!=(i=this._instance)&&i.persistence&&e.$enabled_feature_flags){var s=this._prop("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(e=>{var t=e[1];return!(null!=t&&t.failed)}).map(e=>e[0]):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:r&&!Et(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),d=this._prop("$feature_flag_payloads")||{},c=e.$feature_flag_payloads||{},h=l||r?u:Array.from(new Set([...Object.keys(d),...Object.keys(c)])),p=!l&&!r,_=!!p||u,g=!!p||h,v={[ne]:_,[se]:_,[le]:g};for(var f of(e.$feature_flag_details&&(v[ae]=_),[ue,Me,de]))Rt(e[f])||(v[f]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}}_remove(e){this._persist(()=>{var t;return null==(t=this._client)?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){var e={};for(var t of[ne,le,ue,ce]){var r=this._prop(t);Rt(r)||(e[t]=r)}this._baseEventProperties=e;var i=n({},e),s=this._prop(se);if(s)for(var o of Object.entries(s))i["$feature/"+o[0]]=o[1];this._eventPropertiesWithFlagValues=i}_isCacheStale(){var e=this._config.cacheTtlMs;if(!e||0>=e)return!1;var t=this._prop(Me);return"number"!=typeof t||Date.now()-t>e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,this._logger.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e=this._config.evaluationContexts;return null!=e&&e.length?e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}_getValidFlagKeys(){var e=this._config.flagKeys;if(!Rt(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||this._logger.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t,r=this._config,i=null!==(e=null==(t=r.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(i).length){var s,n,o=null!==(s=null==(n=r.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(i).filter(e=>!Rt(i[e])).reduce((e,t)=>(e[t]=i[t],e),{}),l=Object.keys(o).filter(e=>a[e]).reduce((e,t)=>(e[t]=o[t],e),{});return this._receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,r){var i,s,o=null!=r&&r.merge&&null!==(i=this._prop("$enabled_feature_flags"))&&void 0!==i?i:{},a=null!=r&&r.merge&&null!==(s=this._prop("$feature_flag_payloads"))&&void 0!==s?s:{},l=n({},o,e),u=n({},a,t),d={};for(var c of Object.entries(l)){var h=c[0],p=c[1];d[h]={key:h,enabled:Zi(p),variant:Yi(p),reason:void 0,metadata:Rt(null==u?void 0:u[h])?void 0:{id:0,version:void 0,description:void 0,payload:u[h]}}}this._receivedFeatureFlags({flags:d})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(ae),t=this._prop(ce),r=this._prop(he);if(!r&&!t)return e||{};var i=Os({},e||{});for(var s of[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])]){var o,a,l=i[s],u=null==t?void 0:t[s],d=Rt(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,c=Rt(u)?null==l?void 0:l.variant:"string"==typeof u?u:void 0,h=null==r?void 0:r[s],p=n({},l,{enabled:d,variant:d?null!=c?c:null==l?void 0:l.variant:void 0});d!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),c!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),h&&(p.metadata=n({},null==l?void 0:l.metadata,{payload:h,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),i[s]=p}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(r=>{var i=e[r];return{key:r,enabled:Zi(i),variant:Yi(i),payload:Ki(t[r])}})}getFlagVariants(){var e=this._prop(se),t=this._prop(ce);if(!t)return e||{};for(var r=Os({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this._prop(le),t=this._prop(he);if(!t)return e||{};for(var r=Os({},e||{}),i=Object.keys(t),s=0;i.length>s;s++)r[i[s]]=t[i[s]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this._config.featureFlagsDisabled||this._hasStatusZeroCircuitBreakerTripped()||(this._requestInFlight&&(this._additionalReloadRequested=!0),this._reloadDebouncer||(this._reloadingHandlers.slice().forEach(e=>{try{e()}catch(e){this._logger.error("Error while running feature flags reloading callback",e)}}),this._reloadDebouncer=setTimeout(()=>{this._callFlagsEndpoint()},5)))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}onReloading(e){return this._reloadingHandlers.push(e),()=>{this._reloadingHandlers=this._reloadingHandlers.filter(t=>t!==e)}}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}resetFlagCallReported(){this._remove(Ie)}_callFlagsEndpoint(e){this._clearDebouncer();var t=this._client;if(t&&!this._config.remoteRequestsDisabled&&!this._hasStatusZeroCircuitBreakerTripped())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:n({},t.initialPersonProperties,this._prop("$stored_person_properties")||{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(_e),timezone:wl()};Rt(t.deviceId)||(r.$device_id=t.deviceId),(null!=e&&e.disableFlags||this._config.featureFlagsDisabled)&&(r.disable_flags=!0);var i=this._getValidEvaluationEnvironments();i.length&&(r.evaluation_contexts=i);var s=this._getValidFlagKeys();Rt(s)||(r.flag_keys=s);var o=this._config.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this._requestGeneration;this._requestInFlight=!0;var u=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},d=e=>{this._requestInFlight=!1,l===this._requestGeneration?(this._set({[Pe]:[FS]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),u()):u()};try{t.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(e=>{var t,i,s=null!==(t=e.json)&&void 0!==t?t:{},n=200!==e.statusCode;if(this._requestInFlight=!1,l===this._requestGeneration){if(this._trackStatusZeroReachability(e.statusCode),n||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),!r.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!n;var a=[];e.error?a.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?FS:"unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var d=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));d&&a.push("quota_limited"),this._set({[Pe]:a}),d?this._logger.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."):r.disable_flags||this._receivedFeatureFlags(s,n,{partialResponse:o}),u()}}else u()}).catch(d)}catch(e){d(e)}}}_hasStatusZeroCircuitBreakerTripped(){return Js(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=Xs(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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(e,t){var r;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFeatureFlagResult(e,t);return null!==(r=null==i?void 0:i.variant)&&void 0!==r?r:null==i?void 0:i.enabled}}else this._logger.warn('getFeatureFlag for key "'+e+MS)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t;return null==(t=this.getFeatureFlagResult(e,{send_event:!1}))?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var r,i=this.getFlagVariants(),s=e in i,o=i[e],a=this.getFlagPayloads()[e],l=String(o),u=this._prop("$feature_flag_request_id")||void 0,d=this._prop("$feature_flag_evaluated_at")||void 0,c=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var h,p=null==(h=this._client)?void 0:h.session.sessionId,_=this._prop(Re);p&&p!==_&&(c={},r=p)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(l))r&&this._set({[Ie]:c,[Re]:r});else{var g,v,f,m,y,b,S,w,k,C,E,x,T;Et(c[e])?c[e].push(l):c[e]=[l],this._set(n({[Ie]:c},r?{[Re]:r}:{}));var I=this.getFeatureFlagDetails(e),R=[...null!==(g=this._prop("$feature_flag_errors"))&&void 0!==g?g:[]];Rt(o)&&R.push("flag_missing");var P={$feature_flag:e,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:u,$feature_flag_evaluated_at:d,$feature_flag_bootstrapped_response:null!==(v=null==(f=this._config.bootstrap)||null==(f=f.featureFlags)?void 0:f[e])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this._config.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])&&void 0!==m?m:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Rt(null==I||null==(b=I.metadata)?void 0:b.has_experiment)||(P.$feature_flag_has_experiment=I.metadata.has_experiment),Rt(null==I||null==(S=I.metadata)?void 0:S.version)||(P.$feature_flag_version=I.metadata.version);var M=null!==(w=null==I||null==(k=I.reason)?void 0:k.description)&&void 0!==w?w:null==I||null==(C=I.reason)?void 0:C.code;M&&(P.$feature_flag_reason=M),null!=I&&null!=(E=I.metadata)&&E.id&&(P.$feature_flag_id=I.metadata.id),Rt(null==I?void 0:I.original_variant)&&Rt(null==I?void 0:I.original_enabled)||(P.$feature_flag_original_response=Rt(I.original_variant)?I.original_enabled:I.original_variant),null!=I&&null!=(x=I.metadata)&&x.original_payload&&(P.$feature_flag_original_payload=null==I||null==(T=I.metadata)?void 0:T.original_payload),R.length&&(P.$feature_flag_error=R.join(",")),this._captureFeatureFlagCalled(P)}else r&&this._set({[Ie]:c,[Re]:r});if(s)return{key:e,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Ki(a)}}}else this._logger.warn('getFeatureFlagResult for key "'+e+MS)}_captureFeatureFlagCalled(e){try{var t;null==(t=this._client)||t.capture("$feature_flag_called",e).catch(e=>{this._logger.error("Failed to capture feature flag call",e)})}catch(e){this._logger.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this._getRemoteConfigPayload(e,t)}_getRemoteConfigPayload(e,t){var r=this;return a(function*(){var i=r._client;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r._getValidEvaluationEnvironments();n.length&&(s.evaluation_contexts=n);var o,a=r._getValidFlagKeys();Rt(a)||(s.flag_keys=a);try{var l;o=(null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r._config.compression,sentAt:"body",timeoutMs:r._config.requestTimeoutMs})).json)||null==(l=l.featureFlagPayloads)?void 0:l[e])||void 0}catch(e){return void r._logger.error("Remote config feature flag request failed",e)}try{t(o)}catch(e){r._logger.error("Remote config feature flag callback failed",e)}}})()}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+MS),t.defaultValue;var r=this.getFeatureFlag(e,t);return Rt(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,r){this._receivedFeatureFlags(e,t,r)}_receivedFeatureFlags(e,t,r){if(this._client){this._hasLoadedFlags=!0;var i=function(e,t,r,i,s,o){void 0===t&&(t={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o=RS);var a=((e,t)=>{var r=e.flags;return r?n({},e,{featureFlags:Object.fromEntries(Object.keys(r).map(e=>{var t;return[e,null!==(t=r[e].variant)&&void 0!==t?t:r[e].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter(e=>r[e].enabled).filter(e=>{var t;return!Rt(null==(t=r[e].metadata)?void 0:t.payload)}).map(e=>{var t;return[e,null==(t=r[e].metadata)?void 0:t.payload]}))}):(e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e)})(e,o),l=a.flags,u=a.featureFlags,d=a.featureFlagPayloads;if(u){var c=e.requestId,h=e.evaluatedAt;if(Et(u)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var _=0;u.length>_;_++)p[u[_]]=!0;return{[ne]:u,[se]:p,[de]:!1}}var g=u,v=d,f=l;if(null!=s&&s.partialResponse){var m=Object.keys(g),y=v||{};g=n({},t,g),v=n({},r,y),m.forEach(e=>{var t;e in y||null==(t=v)||delete t[e]}),f=n({},i,f)}else if(e.errorsWhileComputingFlags)if(l){var b=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));g=n({},t,Object.fromEntries(Object.entries(g).filter(e=>b.has(e[0]))));var S=Object.fromEntries(Object.entries(v||{}).filter(e=>b.has(e[0])));v=n({},r,S),b.forEach(e=>{var t;e in S||null==(t=v)||delete t[e]}),f=n({},i,Object.fromEntries(Object.entries(f||{}).filter(e=>b.has(e[0]))))}else g=n({},t,g),v=n({},r,v),f=n({},i,f);return n({[ne]:Object.keys(AS(g)),[se]:g||{},[le]:v||{},[ae]:f||{},[de]:!0===e.minimalFlagCalledEvents},c?{[ue]:c}:{},h?{[Me]:h}:{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this._logger);if(i)if(!1===(null==r?void 0:r.persist)){var s=!Rt(this._client.kv.get(se));this._bootstrapState=i,s||this._set(i)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(i,e,!(null==r||!r.partialResponse)),this._set(i);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),this._logger.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this._overrideFeatureFlags(e)}_overrideFeatureFlags(e){if(this._client){if(!1===e)return this._remove([ce,he]),this._fireFeatureFlagsCallbacks(),void PS.info("All overrides cleared");if(Et(e))return this._set({[ce]:LS(e)}),this._fireFeatureFlagsCallbacks(),void PS.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,r=e;this._override_warning=Boolean(null!==(t=r.suppressWarning)&&void 0!==t&&t);var i={},s=r.flags,n=r.payloads;return s&&(i[ce]=Et(s)?LS(s):s),n&&(i[he]=n),Object.keys(i).length&&this._set(i),!1===s&&!1===n?this._remove([ce,he]):!1===s?this._remove(ce):!1===n&&this._remove(he),this._fireFeatureFlagsCallbacks(),!1===s?PS.info("Flag overrides cleared"):s&&PS.info("Flag overrides set",{flags:s}),void(!1===n?PS.info("Payload overrides cleared"):n&&PS.info("Payload overrides set",{payloads:n}))}if(e&&"object"==typeof e)return this._set({[ce]:e}),this._fireFeatureFlagsCallbacks(),void PS.info("Flag overrides set",{flags:e});this._logger.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this._logger.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;try{e(r,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var i,s=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r);var l=n({},this.getFlagVariants(),{[e]:t});null==(i=this._instance)||null==(i=i.persistence)||i.markCrossTabFeatureFlagChanges({[ne]:[e],[se]:[e],[pe]:Object.keys(o)}),this._set({[ne]:Object.keys(AS(l)),[se]:l,[pe]:n({},this._prop("$stored_person_properties")||{},o)}),this._fireFeatureFlagsCallbacks();try{var u;null==(u=this._client)||u.capture("$feature_enrollment_update",a).catch(e=>{this._logger.error("Failed to capture early access feature enrollment",e)})}catch(e){this._logger.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var i=this._prop(oe);!i||t?this._getEarlyAccessFeatures(e,r):e(i)}_getEarlyAccessFeatures(e,t){var r=this;return a(function*(){var i=r._client;if(i){var s,n=t?"&"+t.map(e=>"stage="+e).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;s=o.json.earlyAccessFeatures,r._set({[oe]:s})}catch(e){return void r._logger.error("Early access feature request failed",e)}try{e(s)}catch(e){r._logger.error("Early access feature callback failed",e)}}})()}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,r)=>(e[r]=t[r],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();var t=this._prepareFeatureFlagsForCallbacks(),r=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach(t=>{try{t(r,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop("$stored_person_properties")||{},i=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),s=null==e?void 0:e.$set_once,o={};if(s)for(var a in s)({}).hasOwnProperty.call(s,a)&&(a in r||(o[a]=s[a]));this._set({[pe]:n({},r,o,i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=n({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete r[e]}),this._set({[pe]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._remove(pe),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this._prop("$stored_group_properties")||{},i=n({},r);for(var s of Object.keys(e))i[s]=n({},r[s],e[s]);this._set({[_e]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop("$stored_group_properties")||{};this._set({[_e]:n({},t,{[e]:{}})})}else this._remove(_e)}reset(){this._requestGeneration++,this._additionalReloadRequested=!1,this._baseEventProperties={},this._eventPropertiesWithFlagValues={},this._bootstrapState=void 0,this._hasLoadedFlags=!1,this._reloadingDisabled=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1,this._consecutiveStatusZeroFailures=0}}},jS={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return"awaiting_config"===this._recordingStatus||"missing_config"===this._recordingStatus?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=Xn,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var e;if(null==c||!c.visibilityState||"visible"===c.visibilityState)return!0;var t=null==l||null==(e=l.performance)||null==e.getEntriesByType?void 0:e.getEntriesByType("visibility-state");return!(null!=t&&t.length)||t.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e;"visible"===(null==c?void 0:c.visibilityState)&&(this._documentWasEverVisible=!0,null==(e=this._lazyLoadedSessionRecording)||null==e.setDocumentWasEverVisible||e.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw aS.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._config.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=c&&c.addEventListener&&Ws(c,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose(e){var t=(void 0===e?{}:e).discardBufferedEvents,r=void 0!==t&&t;this._sessionRecordingDisposed=!0,null==c||null==c.removeEventListener||c.removeEventListener("visibilitychange",this._onVisibilityChange),r?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(H))||!e.enabled),r=!this._config.disable_session_recording,i=this._config.disable_session_recording||this._instance.consent.isOptedOut();return l&&t&&r&&!i}startIfEnabledOrStop(e){var t;if(!(this._sessionRecordingDisposed||this._isRecordingEnabled&&null!=(t=this._lazyLoadedSessionRecording)&&t.isStarted)){var r=!Rt(Object.assign)&&!Rt(Array.from);this._isRecordingEnabled&&r?(this._lazyLoadAndStart(e),aS.info("starting")):(this._recordingStatus=Xn,this.stopRecording())}}_lazyLoadAndStart(e){var t,r;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=so),null!=b&&null!=(t=b.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=b.__PosthogExtensions__)&&r.initSessionRecording)this._onScriptLoaded(e);else{var i,s=this._instance.sessionManager;null==(i=b.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this._scriptName,t=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===s)return t?(this._instance.register_for_session({[We]:!0}),aS.error("could not load recorder",t)):void this._onScriptLoaded(e);this._recordingStatus=Xn})}}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(e){var t,r;void 0===e&&(e=!1),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=void 0,null==(r=this._lazyLoadedSessionRecording)||r.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null==(e=this._persistence)||e.unregister(K),null==(t=this._persistence)||t.unregister(W)}_validateSampleRate(e,t){if(Lt(e))return null;var r,i=At(e)?e:parseFloat(e);return"number"!=typeof(r=i)||!Number.isFinite(r)||0>r||r>1?(aS.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}_persistRemoteConfig(e){if(this._persistence){var t,r,i=this._persistence,s=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,s=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=s?s:o;Lt(a)&&this._resetSampling();var l=null==r?void 0:r.minimumDurationMilliseconds;i.register({[H]:n({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:n({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Rt(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};s(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(s)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this._persistRemoteConfig(t),void this._discardRecording()):(this._persistRemoteConfig(t),void this.startIfEnabledOrStop()):("awaiting_config"===this._recordingStatus&&(this._recordingStatus="missing_config",aS.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this._lazyLoadedSessionRecording)&&r.log?this._lazyLoadedSessionRecording.log(e,t):aS.warn("log called before recorder was ready")}get _scriptName(){var e;return(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.get_property("$session_recording_remote_config"))||null==(e=e.scriptConfig)?void 0:e.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(H);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return aS.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Lt(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}_onScriptLoaded(e){var t,r,i;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(null==(t=b.__PosthogExtensions__)||!t.initSessionRecording)return aS.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[We]:!0});var s;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(s=b.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this._documentWasEverVisible),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if("missing_config"===this._recordingStatus||"awaiting_config"===this._recordingStatus)return;return this._recordingStatus="awaiting_config",aS.info("persisted remote config is stale, requesting fresh config before starting"),void new Qy(this._instance).load()}this._recordingStatus=so,null==(r=(i=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||r.call(i,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=Xn}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(e=this._persistence)||e.register({[V]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(e=this._persistence)||e.register({[z]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideSampling()}overrideTrigger(e){var t,r;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({["url"===e?j:G]:!0}),null==(r=this._lazyLoadedSessionRecording)||r.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this._lazyLoadedSessionRecording)||!r.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e;null==(e=this._lazyLoadedSessionRecording)||null==e.flushBeforeIdentityReset||e.flushBeforeIdentityReset()}}},GS={autocapture:class extends oy{constructor(e){super(new Xb(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){var e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(Ms.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this._lastLocation=this._getCurrentLocation(),this.startIfEnabled()}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,this._hashchangeListener&&this._hashchangeListener(),this._hashchangeListener=void 0,Ms.info("History API monitoring stopped")}monitorHistoryChanges(){l&&l.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(e){var t;if(l&&(null==(t=l.history[e])||!t.__posthog_wrapped__)){var r=this;tp(l.history,e,t=>function(i,s,n){t.call(this,i,s,n),r._capturePageview(e)})}}_getCurrentLocation(){var e=null==l?void 0:l.location;if(null!=e&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}_getCaptureOptions(){var e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:Tt(e)?e:{}}_shouldCaptureHashChanges(e){return void 0===e&&(e=this._getCaptureOptions()),!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){var t=this._getCaptureOptions(),r=this._lastLocation;return!(!r||!(t.path&&e.pathname!==r.pathname||t.search&&e.search!==r.search||this._shouldCaptureHashChanges(t)&&e.hash!==r.hash))}_capturePageview(e){try{var t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(ot,{navigation_type:e}),this._lastLocation=t}catch(t){Ms.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};Ws(l,"popstate",e),this._popstateListener=()=>{l&&l.removeEventListener("popstate",e)}}}_setupHashchangeListener(){if(!this._hashchangeListener){var e=()=>{this._capturePageview("hashchange")};Ws(l,"hashchange",e),this._hashchangeListener=()=>{l&&l.removeEventListener("hashchange",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[M]),this.rageclicks=new ey(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return Tt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Lt(this._config.capture_heatmaps)?Lt(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;lS.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[M]:r}),this._enabledServerSide=r,this.startIfEnabled()}}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){uS(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==c?void 0:c.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){l&&c&&(this._flushHandler=this._flush.bind(this),Ws(l,nt,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==l?void 0:l.event)),Ws(c,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==l?void 0:l.event)),Ws(c,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new by(this.instance,my,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),Ws(c,st,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;l&&c&&(this._flushHandler&&l.removeEventListener(nt,this._flushHandler),this._onClickHandler&&c.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&c.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&c.removeEventListener(st,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,r){for(var i=e;i&&sn(i)&&!nn(i,"body");){if(i===r)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=i.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:l)?void 0:n.getComputedStyle(i).position}catch(e){return!1}if(ht(t,s))return!0;i=fn(i)}return!1}(pn(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:i),y:e.clientY+(n?0:r),target_fixed:n,type:t}}_onClick(e,t){var r;if(void 0===t&&(t="click"),!rn(e.target)&&uS(e)){var i=this._getProperties(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&En(pn(e),this.instance.config.rageclick)&&this._capture(n({},i,{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){!rn(e.target)&&uS(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(l){var t=this._config.disable_capture_url_hashes?li(l.location.href):l.location.href,r=this._config.custom_personal_data_properties,i=Zs(t,this._config.mask_personal_data_properties?[...dl,...r||[]]:[],hl);this._buffer=this._buffer||{},this._buffer[i]||(this._buffer[i]=[]),this._buffer[i].push(e)}}_flush(){this._buffer&&!It(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:by,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this._enabledServerSide=!1,this._initialized=!1,this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),this._delayedFlushTimer=void 0,0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",n({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>n({},e,{["$web_vitals_"+t.name+"_event"]:n({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{}))),this._buffer={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t;if(this._buffer=this._buffer||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Lt(null==e?void 0:e.name)||Lt(null==e?void 0:e.value))rS.error("Invalid metric received",e);else{var r="string"==typeof e.navigationURL?e.navigationURL:void 0,i=this._maskedURL(r);if(!Rt(i)){var s=At(e.navigationId)||"string"==typeof e.navigationId?"navigation:"+e.navigationId:"url:"+i;if(!this._maxAllowedValue||this._maxAllowedValue>e.value){this._buffer.navigationKey!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Rt(this._buffer.navigationKey)&&(this._buffer.navigationKey=s,this._buffer.url=i),this._buffer.firstMetricTimestamp=Rt(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;var o=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),a=n({},e,r?{navigationURL:i}:{},{$current_url:i,timestamp:Date.now()});if(delete a.entries,Tt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){var l={};for(var u of oS){var d="url"===u&&"string"==typeof e.attribution[u]?this._maskedURL(e.attribution[u]):e.attribution[u];Rt(d)||(l[u]=d)}a.attribution=l}else delete a.attribution;Rt(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this._buffer.metrics.push(a),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()}else rS.error("Ignoring metric with value >= "+this._maxAllowedValue,e)}}},this._startCapturing=()=>{if(!this._initialized){var e,t,r,i,s=!1,o=b.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Rt(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Rt(l)){var u=l.withoutAttribution,d=this.attributionMetrics;s=!Rt(u),e=d.indexOf("LCP")>-1?l.onLCP:(null==u?void 0:u.onLCP)||l.onLCP,t=d.indexOf("CLS")>-1?l.onCLS:(null==u?void 0:u.onCLS)||l.onCLS,r=d.indexOf("FCP")>-1?l.onFCP:(null==u?void 0:u.onFCP)||l.onFCP,i=d.indexOf("INP")>-1?l.onINP:(null==u?void 0:u.onINP)||l.onINP}if(e&&t&&r&&i){var c={reportSoftNavs:this.useSoftNavs},h=s&&this.attributionMetrics.indexOf("INP")>-1?n({},c,{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this._addToBuffer.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&i(this._addToBuffer.bind(this),h),this._initialized=!0}else rS.error("web vitals callbacks not loaded - not starting")}},this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[O]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=Tt(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Lt(r)?(null==(t=this._instance.persistence)?void 0:t.props.$web_vitals_allowed_metrics)||sS:r}get flushToCaptureTimeoutMs(){return(Tt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var e=Tt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return Dt(e)?e?sS:[]:Et(e)?e:nS}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var e;return null!==(e=Tt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0)&&void 0!==e&&e}get _maxAllowedValue(){var e=Tt(this._perfConfig)&&At(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:iS;return e>0&&6e4>=e?iS:e}get isEnabled(){var e=null==h?void 0:h.protocol;if("http:"!==e&&"https:"!==e)return rS.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Tt(this._perfConfig)?this._perfConfig.web_vitals:Dt(this._perfConfig)?this._perfConfig:void 0;return Dt(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(rS.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var r=Tt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Tt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[O]:r}),this._instance.persistence.register({[q]:i})),this._enabledServerSide=r,this.startIfEnabled()}}}get _callbackFlavor(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_loadScript(e){var t=b.__PosthogExtensions__,r=this._callbackFlavor,i=null==t?void 0:t.postHogWebVitalsCallbacksByFlavor;null!=i&&i[r]||"web-vitals"===r&&Rt(i)&&null!=t&&t.postHogWebVitalsCallbacks?e():null==t||null==t.loadExternalDependency||t.loadExternalDependency(this._instance,r,t=>{t?rS.error("failed to load script",t):e()})}_maskedURL(e){var t=e||(null==l?void 0:l.location.href);if(t){var r=this._instance.config.disable_capture_url_hashes?li(t):t,i=this._instance.config.custom_personal_data_properties;return Zs(r,this._instance.config.mask_personal_data_properties?[...dl,...i||[]]:[],hl)}rS.error("Could not determine current URL")}}},QS={exceptionObserver:class{constructor(e){var t;this._startCapturing=()=>{var e;if(l&&this.isEnabled&&null!=(e=b.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=b.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=b.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,i=b.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=r(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=i(this.captureException.bind(this)))}catch(e){eS.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[F]),this._rateLimiter=new Kt(n({},function(e){var t,r,i,s;return void 0===e&&(e={}),{refillRate:null!==(t=null!==(r=e.exceptionRateLimiterRefillRate)&&void 0!==r?r:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(i=null!==(s=e.exceptionRateLimiterBucketSize)&&void 0!==s?s:e.__exceptionRateLimiterBucketSize)&&void 0!==i?i:10}}(this._instance.config.error_tracking),{refillInterval:1e4,_logger:eS})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Tt(e)?t=n({},t,e):(Rt(e)?this._remoteEnabled:e)&&(t=n({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(eS.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return eS.error("failed to load script",t);e()})}_stopCapturing(){var e,t,r;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(r=this._unwrapConsoleError)||r.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[F]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,r,i,s=null!==(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(s))return void eS.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,r;this._suppressionRules=[],this._errorPropertiesBuilder=Zv(),this._instance=e,this._suppressionRules=null!==(t=null==(r=this._instance.persistence)?void 0:r.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=ji(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new Gi(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=ji(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,r,i;if(e.ok){var s=e.config;if("errorTracking"in s){var n=null!==(t=null==(r=s.errorTracking)?void 0:r.suppressionRules)&&void 0!==t?t:[],o=null==(i=s.errorTracking)?void 0:i.captureExtensionExceptions;this._suppressionRules=n,this._instance.persistence&&this._instance.persistence.register({[L]:this._suppressionRules,[A]:o})}}}get _captureExtensionExceptions(){var e,t,r=!!this._instance.get_property(A);return null!==(e=null!==(t=this._instance.config.error_tracking.captureExtensionExceptions)&&void 0!==t?t:r)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this._exceptionStepsConfig.enabled)try{if(!Pt(e)||0===e.trim().length)return void Vv.warn("Ignoring exception step because message must be a non-empty string");var r=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((r,i)=>zi.has(i)?(t.push(i),r):(r[i]=e[i],r),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t)),i=r.sanitizedProperties,s=r.droppedKeys;s.length>0&&Vv.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(n({[Ui]:e,[Wi]:(new Date).toISOString()},i))}catch(e){Vv.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void Vv.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by a browser extension"),void Vv.info("Skipping exception capture because it was thrown by an extension");if(!this._captureExtensionExceptions&&this._isInjectedBrowserScriptException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by an injected browser script"),void Vv.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return this._addDroppedExceptionStep("Exception dropped: thrown by the PostHog SDK"),void Vv.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this._exceptionStepsConfig.enabled&&Lt(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,i="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;i&&(r.$release_id=i);try{var s=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return s&&this._exceptionStepsBuffer.clear(),s}catch(e){return zv(e)||Vv.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void(zv(e)||Vv.error("Failed to process exception event. Ignoring this exception.",e))}var n}_addBufferedExceptionSteps(e){try{var t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:n({},e,{$exception_steps:t})}catch(t){return Vv.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[Ui]:e,[Wi]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return Tt(e)?n({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{var t=e.reduce((e,t)=>{var r=t.type,i=t.value;return Pt(r)&&r.length>0&&e.$exception_types.push(r),Pt(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{var r=e.values.map(e=>{var r=el[e.operator],i=t[e.key];if(!r||!i)return!1;var s=Et(e.value)?e.value:[e.value];return s.length>0&&r(s,i)});return"OR"===e.type?r.some(Boolean):r.every(Boolean)})}catch(e){return Vv.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){var t=e.flatMap(e=>{var t,r;return null!==(t=null==(r=e.stacktrace)?void 0:r.frames)&&void 0!==t?t:[]}),r=t.filter(e=>{var t=e.filename;return!!t&&Qv.some(e=>t.startsWith(e))});return 0!==r.length&&(!r.every(e=>{var t=e.filename;return!!t&&t.startsWith(jv)})||e.some(e=>{var t=e.value;return"NoResponse"===e.type||Pt(t)&&Gv.some(e=>{var r=e.value;return e.exact?t===r:t.includes(r)})})&&!t.some(e=>{var t=e.filename;return e.in_app&&!(null!=t&&t.startsWith(jv))}))}_isInjectedBrowserScriptException(e){return e.some(e=>{var t=e.value;return Pt(t)&&Kv.some(e=>t.includes(e))})}_isPostHogException(e){if(e.length>0){var t,r,i,s,n=null!==(t=null==(r=e[0].stacktrace)?void 0:r.frames)&&void 0!==t?t:[];return null!==(i=null==(s=n[n.length-1])||null==(s=s.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==i&&i}return!1}_isExceptionList(e){return!Lt(e)&&Et(e)}}},KS=n({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var r,i;if(this._persistence&&this._persistence.register({[N]:!!t.productTours}),!cS(this._instance))return!this._productTourManager&&Lt(null==(r=this._persistence)?void 0:r.props.ph_product_tours)||dS.info("product tours disabled; stopping and clearing cached tours"),null==(i=this._productTourManager)||i.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this._productTourManager&&cS(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",t=>{t?dS.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&null!=(e=b.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=b.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Et(this._cachedTours)||t){var r=this._persistence;if(r){var i=r.props[Se];if(Et(i)&&!t)return this._cachedTours=i,void e(i,{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:t=>{if(cS(this._instance)){var i=t.statusCode;if(200!==i||!t.json){var s="Product Tours API could not be loaded, status: "+i;return 0===i?t.error||dS.warn(s):dS.error(s),void e([],{isLoaded:!1,error:s})}var n=Et(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,r&&r.register({[Se]:n}),e(n,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Lt(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(Se)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},VS),ZS={siteApps:class{constructor(e){this._instance=e,this._siteAppElementPatchCount=0,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this._bufferedInvocations.push(r),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=b._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,o,a,l,u,d;if(!e)throw new Error("Event payload is required");var c={},h=this._instance.get_property("$groups")||[],p=this._instance.get_property("$stored_group_properties")||{};for(var _ of Object.entries(p)){var g=_[0];c[g]={id:h[g],type:g,properties:_[1]}}var v=e.$set_once,f=e.$set;return{event:n({},s(e,i),{properties:n({},e.properties,f?{$set:n({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},f)}:{},v?{$set_once:n({},null!==(o=null==(a=e.properties)?void 0:a.$set_once)&&void 0!==o?o:{},v)}:{}),elements_chain:null!==(l=null==(u=e.properties)?void 0:u.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(d=e.properties)?void 0:d.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}_prepareElementForSiteApp(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(hS.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(hS.error("prepare_external_dependency_script returned null"),null):e}_patchSiteAppElementInsertionMethods(){var e,t,r,i,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==c?void 0:c.defaultView,u=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();var d=[],h=this,p=new WeakSet,_=(e,t,r)=>{if(null!=e&&e[t]){var i=e[t];e[t]=r(i),d.push(()=>{e[t]=i})}},g=e=>{if(p.has(e))return e;var t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},v=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!Ft(e));return _(u,"appendChild",e=>function(t){var r=g(t);return r?e.call(this,r):t}),_(u,"insertBefore",e=>function(t,r){var i=g(t);return i?e.call(this,i,r):t}),_(u,"replaceChild",e=>function(t,r){var i=g(t);return i?e.call(this,i,r):r}),[null==(t=l.Element)?void 0:t.prototype,null==(r=l.Document)?void 0:r.prototype,null==(i=l.DocumentFragment)?void 0:i.prototype].forEach(e=>{_(e,"append",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))}),_(e,"prepend",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(e=>{_(e,"before",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))}),_(e,"after",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];return e.apply(this,v(r))}),_(e,"replaceWith",e=>function(){for(var t=arguments.length,r=new Array(t),i=0;t>i;i++)r[i]=arguments[i];var s=v(r);return r.length&&!s.length?void 0:e.apply(this,s)})}),_(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",e=>function(t,r){var i=g(r);return i?e.call(this,t,i):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){var e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null==(t=this._restoreSiteAppElementPatches)||t.call(this)))}}_runWithPreparedSiteAppElements(e,t){void 0===t&&(t=!0);var r=this._patchSiteAppElementInsertionMethods();try{var i=e(r);return t&&r(),i}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this._bufferedInvocations.length&&(hS.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(r=this._stopBuffering)||r.call(this))},i=!1,s=s=>{t.errored=!s,t.loaded=!0,hS.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),i&&r()};try{var n=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),s(e)}}),!1).processEvent;n&&(t.processEvent=n),i=!0}catch(t){hS.error(pS+e.id,t),s(!1)}if(i&&t.loaded)try{r()}catch(r){hS.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}_setupSiteApps(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}_onCapturedEvent(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),i=function(i){try{t._runWithPreparedSiteAppElements(()=>null==i.processEvent?void 0:i.processEvent(r))}catch(t){hS.error("Error while processing event "+e.event+" for site app "+i.id,t)}};for(var s of Object.values(this.apps))i(s)}}onRemoteConfig(e){var t,r,i,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void hS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this._stopBuffering)||r.call(this),e.ok){var n=e.config;if(null!=(i=n.siteApps)&&i.length)if(this.isEnabled){var o=function(){var e,t=a.id,r=a.url;b["__$$ph_site_app_"+t]=s._instance,null==(e=b.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,r,e=>{if(e)return hS.error(pS+t,e)})};for(var a of n.siteApps)o()}else hS.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},YS={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{var e,t,r=this._syncHostnamesForPatch();r?(Rt(this._restoreXHRPatch)&&(this._restoreXHRPatch=null==(e=b.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Rt(this._restoreFetchPatch)&&(this._restoreFetchPatch=null==(t=b.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,r;null!=(t=b.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return tS.error("failed to load script",t);e()})}_getConfiguredHostnames(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}_syncHostnamesForPatch(){var e=this._getConfiguredHostnames();return Et(e)?(Et(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(Et(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},JS=n({surveys:class extends fS{constructor(e){var t;super(new kS(e),(t=e,{get projectToken(){return t.config.token},kv:new wS(t)})),this._instance=e}_sendSurveysRequest(e,t){var r=t.query?eb(e,t.query):e;return new Promise(e=>{var i;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(i=t.target)&&void 0!==i?i:"api",r),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},VS),XS={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){b.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=b.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,r){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),zs(this.instance.config))return!1;if(!l||!c)return!1;e=null!=e?e:l.location,r=null!=r?r:l.history;try{if(!t){try{l.localStorage.setItem("test","test"),l.localStorage.removeItem("test")}catch(e){return!1}t=null==l?void 0:l.localStorage}var i,s=CS||Ys(e.hash,"__posthog")||Ys(e.hash,"state"),n=s?Ns(()=>JSON.parse(atob(decodeURIComponent(s))))||Ns(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((i=n).source="url",i&&Object.keys(i).length>0&&(n.desiredHash?e.hash=n.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(ES)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch(e){return!1}}_callLoadToolbar(e){var t=b.ph_load_toolbar||b.ph_load_editor;!Lt(t)&&xt(t)?t(e,this.instance):xS.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==c||!c.getElementById("__POSTHOG_TOOLBAR__"));if(!l||t)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,i=n({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(l.localStorage.setItem(ES,JSON.stringify(n({},i,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(i);else if(0===this._getToolbarState()){var s;this._setToolbarState(1),null==(s=b.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return xS.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(i)}),Ws(l,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(i)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},ew=n({experiments:class e{get _config(){return this._instance.config}constructor(t){var r=this;this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),r.getWebExperiments(t=>{e._logInfo("retrieved web experiments from the server"),r._flagToExperiments=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;r._flagToExperiments&&(e._logInfo("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=r._flagToExperiments)||i.set(t.feature_flag_key,t));var s=r._instance.getFeatureFlag(t.feature_flag_key);Pt(s)&&t.variants[s]&&r._applyTransforms(t.name,s,t.variants[s].transforms)}else if(t.variants)for(var n in t.variants){var o=t.variants[n];e._matchesTestVariant(o,r._instance)&&r._applyTransforms(t.name,n,o.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e._logInfo(OS);else if(!this._config.disable_web_experiments){if(Lt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e._logInfo("applying feature flags",t),t.forEach(e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var r,i=this._instance.getFeatureFlag(e),s=null==(r=this._flagToExperiments)?void 0:r.get(e);i&&null!=s&&s.variants[i]&&this._applyTransforms(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){var t=e.getWindowLocation();if(null!=t&&t.search){var r=Ks(null==t?void 0:t.search,"__experiment_id"),i=Ks(null==t?void 0:t.search,"__experiment_variant");r&&i&&(e._logInfo("previewing web experiments "+r+" && "+i),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(r),i,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(t,r,i){var s=i.filter(e=>e.id===t);s&&s.length>0&&(e._logInfo("Previewing web experiment ["+s[0].name+"] with variant ["+r+"]"),this._applyTransforms(s[0].name,r,s[0].variants[r].transforms))}static _matchesTestVariant(t,r){return!Lt(t.conditions)&&e._matchUrlConditions(t,r)&&e._matchUTMConditions(t)}static _matchUrlConditions(t,r){var i;if(Lt(t.conditions)||Lt(null==(i=t.conditions)?void 0:i.url))return!0;var s=e.getWindowLocation();if(s){var n,o,a,l=en(r,s.href);return null==(n=t.conditions)||!n.url||DS[null!==(o=null==(a=t.conditions)?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return null==l?void 0:l.location}static _matchUTMConditions(e){var t;if(Lt(e.conditions)||Lt(null==(t=e.conditions)?void 0:t.utm))return!0;var r=_l();if(r.utm_source){var i,s,n,o,a,l,u,d,c=null==(i=e.conditions)||null==(i=i.utm)||!i.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==r.utm_campaign,h=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==r.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==r.utm_medium,_=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(d=e.conditions)||null==(d=d.utm)?void 0:d.utm_term)==r.utm_term;return c&&p&&_&&h}return!1}static _logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;t>i;i++)r[i-1]=arguments[i];Ms.info("[WebExperiments] "+e,r)}_applyTransforms(t,r,i){this._is_bot()?e._logInfo(OS):"control"!==r?i.forEach(i=>{var s;i.selector&&(e._logInfo("applying transform of variant "+r+" for experiment "+t+" ",i),null==(s=document)||null==(s=s.querySelectorAll(i.selector))||s.forEach(e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}):e._logInfo("Control variants leave the page unmodified.")}_is_bot(){return d&&this._instance?Sb(d,this._config.custom_blocked_useragents):void 0}}},VS),tw=n({},VS,jS,GS,QS,KS,ZS,JS,YS,XS,ew,{conversations:class{constructor(e){this._instance=e,this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._loadFailed=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&(this._remoteConfigSuccessful=e.ok,e.ok)){var t=e.config.conversations;Lt(t)||(Dt(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||zs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==b?void 0:b.__PosthogExtensions__;if(e&&!Rt(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var r=e.loadExternalDependency;if(!r)return void this._handleLoadError(et);r(this._instance,"conversations",t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1})}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else NS.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),this._loadFailed=!1,NS.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else NS.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){NS.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():NS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ft(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":zs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":Rt(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Lt(this._remoteConfig)||!this._remoteConfig.token?"missing_token":null!=b&&b.__PosthogExtensions__?this._isInitializing?"initializing":this._loadFailed?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,r){var i=this;return a(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,r):(NS.warn(BS),null)})()}getMessages(e,t){var r=this;return a(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(NS.warn(BS),null)})()}markAsRead(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(NS.warn(BS),null)})()}getTickets(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(NS.warn(BS),null)})()}requestRestoreLink(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(NS.warn(BS),null)})()}restoreFromToken(e){var t=this;return a(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(NS.warn(BS),null)})()}restoreFromUrlToken(){var e=this;return a(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(NS.warn(BS),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t,r=this;this._instance=e,this.name=dg,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Fs("[logs]"),this._coreLogger=n({},this._logger,{error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];t.some(zS)||r._logger.error(...t)}}),this._queue=[],this._consoleQueue=[],this._consecutiveStatusZeroFailures=0,this._disposed=!1,this._consoleBuffer=[],this._consoleRecorderUnpatchers=[],this._isRecordingConsole=!1,this._isRecordingConsoleEntry=!1,this._onReconnect=()=>{var e,t;this._disposed||(this._consecutiveStatusZeroFailures=0,null==(e=this._core)||e.onReconnect(),null==(t=this._consoleCore)||t.onReconnect())},this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),l&&Ws(l,"online",this._onReconnect)}_buildCore(e,t,r,i){var s,n=$S(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,r);return[new ws(this._createHost(e,t),n,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,i),n]}_getCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._core||this._resolvedFrom!==t){var r;null==(r=this._core)||r.reset(),this._resolvedFrom=t;var i=this._buildCore(()=>this._queue,e=>{this._queue=e});this._core=i[0],this._resolvedConfig=i[1]}return this._core}_getConsoleCore(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this._consoleCore||this._consoleResolvedFrom!==t){var r;null==(r=this._consoleCore)||r.reset(),this._consoleResolvedFrom=t;var i=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},HS);this._consoleCore=i[0],this._consoleResolvedConfig=i[1]}return this._consoleCore}setup(e){var t;if(!this._disposed){this._client=e,null!=(t=this._instance)&&null!=(t=t.config)&&null!=(t=t.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();var r=!1,i=e.onRemoteConfig(e=>{var t;r=e.ok&&!0===(null==(t=e.config.logs)?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?i.dispose():(this._remoteConfigSubscription=i,r||this.loadIfEnabled())}}dispose(){var e,t,r,i;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null==(e=this._remoteConfigSubscription)||e.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==l||l.removeEventListener("online",this._onReconnect),null==(t=this._consoleLogsDispose)||t.call(this),this._consoleLogsDispose=void 0,null==(r=this._core)||r.reset(),null==(i=this._consoleCore)||i.reset())}onRemoteConfig(e){var t,r;if(!this._disposed){var i=e.ok?null==(t=e.config.logs)?void 0:t.captureConsoleLogs:void 0;Lt(i)?this._stopRecorderStartedByPersistedHint():(null==(r=this._instance)||null==(r=r.persistence)||r.register({[B]:!!i}),i?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}}reset(){var e,t,r,i;this._stopConsoleRecorder(),null==(e=this._core)||e.clearQueue(),this._queue=[],null==(t=this._core)||t.reset(),null==(r=this._consoleCore)||r.clearQueue(),this._consoleQueue=[],null==(i=this._consoleCore)||i.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,r){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:r})}_persistedCaptureHint(){var e;return!(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.props)||!e[B])}_remoteConfigWillArrive(){var e,t;return null==(e=this._instance)||null==e._shouldDisableFlags||!e._shouldDisableFlags()||!(null==(t=b._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])||!t.config)}_onOptOut(){var e;this._stopConsoleRecorder(),null==(e=this._consoleCore)||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e,t=this;if(!this._isRecordingConsole&&null!=b&&b.console){var r=$S(null==(e=this._instance)||null==(e=e.config)?void 0:e.logs).maxBufferSize,i=function(e){var i;try{i=Fv(b.console[e])}catch(e){return 0}if(!i)return 0;t._consoleRecorderUnpatchers.push(tp(b.console,e,s=>{var n=function(){for(var i=arguments.length,n=new Array(i),o=0;i>o;o++)n[o]=arguments[o];try{t._recordConsoleEntry(e,n,r)}catch(e){}return s.apply(b.console,n)};return n.__rrweb_original__=i,n}))};for(var s of qS)i(s);this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}}_recordConsoleEntry(e,t,r){var i;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null!=(i=this._instance)&&i.is_capturing()){if(r>this._consoleBuffer.length){this._isRecordingConsoleEntry=!0;try{this._consoleBuffer.push({level:e,args:t,occurredAtMs:Date.now(),context:this._getSdkContext()})}finally{this._isRecordingConsoleEntry=!1}}}else this._stopConsoleRecorder()}_stopConsoleRecorder(){if(this._consoleBuffer=[],this._isRecordingConsole){for(var e of(this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0),this._consoleRecorderUnpatchers))e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){var e=this._consoleBuffer;return this._stopConsoleRecorder(),e}get logger(){return this._capture_logger||(this._capture_logger={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this._capture_logger}flushLogs(e){e?this._flushViaTransport(e):(this._core&&this._core.flush().catch(e=>this._logFlushError(e)),this._consoleCore&&this._consoleCore.flush().catch(e=>this._logFlushError(e)))}_logFlushError(e){zS(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(!this._disposed&&this._isLogsEnabled&&!this._isLoaded&&!this._isLoading){var e=null==b?void 0:b.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();var t=e.loadExternalDependency;if(!t)return this._logger.error(et),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",t=>{if(this._isLoading=!1,!this._disposed&&this._isLogsEnabled){var r=e.logs;if(t||null==r||!r.initializeLogs)this._logger.error("Could not load logs script",t),this._stopConsoleRecorder();else{var i,s,n=this._takeConsoleBuffer();this._consoleLogsDispose=r.initializeLogs(null!==(i=this._client)&&void 0!==i?i:this._instance),this._isLoaded=!0,n.length>0&&(null==r.replayConsoleBuffer||r.replayConsoleBuffer(null!==(s=this._client)&&void 0!==s?s:this._instance,n))}}})}catch(e){throw this._isLoading=!1,e}}}_createHost(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===vt.LogsQueue?e():void 0,setPersistedProperty(e,r){e===vt.LogsQueue&&t(null!=r?r:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>Ba.LIB_NAME,getLibraryVersion:()=>Ba.LIB_VERSION}}_sendLogsBatch(e){return new Promise(t=>{if(Js(this._consecutiveStatusZeroFailures,3))t({kind:"fatal",error:WS(void 0,"logs endpoint is unreachable, dropping batch")});else{var r=!1,i=e=>{r||(r=!0,clearTimeout(s),t(e))},s=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:WS(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this._logsUrl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)i({kind:"ok"});else if(413===t)i({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)i({kind:"fatal",error:new Error("logs request failed with status "+t)});else{var r;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:WS(e.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:null!==(r=e.error)&&void 0!==r?r:new Error("logs request failed with status "+t)})}}})}})}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=Xs(e,this._consecutiveStatusZeroFailures,3,()=>this._logger.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.")))}_flushViaTransport(e){this._queue.length>0&&this._drainQueueViaTransport(e,this._queue,this._resolvedConfig,Ba.LIB_NAME,e=>{this._queue=e}),this._consoleQueue.length>0&&this._drainQueueViaTransport(e,this._consoleQueue,this._consoleResolvedConfig,HS,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,r,i,s){if(0!==t.length){var n=t.map(e=>e.record);s([]);var o=Ss(n,bs(r,Ba.LIB_NAME,Ba.LIB_VERSION),i,Ba.LIB_VERSION);this._instance._send_request({method:"POST",url:this._logsUrl(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}_logsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_getSdkContext(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var r=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=r.windowId,s=r.sessionStartTimestamp,n=r.lastActivityTimestamp;t.sessionId=r.sessionId,t.windowId=i,Lt(s)||(t.sessionStartTimestamp=s),Lt(n)||(t.lastActivityTimestamp=n)}if(null!=b&&null!=(e=b.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?li(b.location.href):b.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(t.activeFeatureFlags=o)}return t}}},{metrics:class{constructor(e){this._instance=e,this._logger=Fs("[metrics]")}initialize(){}_getCore(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this._core&&this._resolvedFrom===r||(null==(t=this._core)||t.reset(),this._resolvedFrom=r,this._core=new xs(this._createHost(),function(e){var t,r,i,s,n,o=null==e?void 0:e.resourceAttributes;return{serviceName:null!==(t=null==o?void 0:o["service.name"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(r=null==o?void 0:o["service.version"])&&void 0!==r?r:null==e?void 0:e.serviceVersion,environment:null!==(i=null==o?void 0:o["deployment.environment"])&&void 0!==i?i:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(r),this._logger)),this._core}count(e,t,r){void 0===t&&(t=1),this._getCore().count(e,t,r)}gauge(e,t,r){this._getCore().gauge(e,t,r)}histogram(e,t,r){this._getCore().histogram(e,t,r)}flush(e){if(!this._core)return Promise.resolve();if(e){var t=this._core.drainWindow();return t&&this._sendMetricsBatch(t,e),Promise.resolve()}return this._core.flush().catch(e=>this._logger.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this._core)||e.reset()}_createHost(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},_sendMetricsBatch:e=>t._sendMetricsBatch(e),getLibraryId:()=>Ba.LIB_NAME,getLibraryVersion:()=>Ba.LIB_VERSION}}_sendMetricsBatch(e,t){return new Promise(r=>{var i=!1,s=e=>{i||(i=!0,clearTimeout(o),r(e))},o=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(n({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t,r=e.statusCode;s(r>=200&&300>r?{kind:"ok"}:413===r?{kind:"too-large"}:0!==r&&408!==r&&429!==r&&500>r?{kind:"fatal",error:new Error("metrics request failed with status "+r)}:{kind:"retry-later",error:null!==(t=e.error)&&void 0!==t?t:new Error("metrics request failed with status "+r)})}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});Jb.__defaultExtensionClasses=n({},tw);var rw=function(){Ba.SDK_DIST_CHANNEL="npm";var e=Ob[Vb]=new Jb;return function(){function e(){e.done||(e.done=!0,jb=!1,As(Ob,function(e){e._dom_loaded()}))}null!=c&&c.addEventListener?"complete"===c.readyState?e():Ws(c,"DOMContentLoaded",e,{capture:!1}):l&&Ms.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}(),iw=rw;export{W_ as Compression,Uy as DEFAULT_PRODUCT_TOUR_APPEARANCE,eg as DisplaySurveyType,Jb as PostHog,Wy as ProductTourEventName,zy as ProductTourEventProperties,J_ as SurveyEventName,X_ as SurveyEventProperties,z_ as SurveyEventType,j_ as SurveyPosition,Z_ as SurveyQuestionBranchingType,K_ as SurveyQuestionType,Y_ as SurveySchedule,G_ as SurveyTabPosition,Q_ as SurveyType,V_ as SurveyWidgetType,iw as default,rw as posthog,Ky as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.full.no-external.js.map
|