posthog-js 1.429.2 → 1.429.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.es5.js.map +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.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js +1 -1
- package/dist/customizations.d.ts +2 -0
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/exception-autocapture.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +2 -0
- package/dist/module.full.d.ts +2 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +2 -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.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.d.ts +2 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.d.ts +2 -0
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/src/extensions/surveys.d.ts +2 -0
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.d.ts +2 -0
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/surveys.d.ts +2 -0
- package/lib/src/extensions/surveys.js +18 -1
- package/lib/src/extensions/surveys.js.map +1 -1
- package/lib/src/feature-flags-config.js +5 -5
- package/lib/src/feature-flags-config.js.map +1 -1
- package/lib/src/posthog-core.js +3 -7
- package/lib/src/posthog-core.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e="u">typeof window?window:void 0,t="u">typeof globalThis?globalThis:e,i=null==t?void 0:t.navigator,s=null==t?void 0:t.document,n=null==t?void 0:t.location,r=null==t?void 0:t.fetch,o=(null==t?void 0:t.XMLHttpRequest)&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,c=null==i?void 0:i.userAgent;function u(){return!(!e||!1===e.navigator.onLine)}const d="undefined"!=typeof globalThis?globalThis:e;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});const h=null!=e?e:{},p="$people_distinct_id",_="distinct_id",g="$device_id",f="$device_model",v="__alias",m="__cmpns",y="$fbc",b="$fbc_persistence",S="__timers",w="$autocapture_disabled_server_side",k="$heatmaps_enabled_server_side",C="$exception_capture_enabled_server_side",E="$error_tracking_suppression_rules",x="$error_tracking_capture_extension_exceptions",T="$web_vitals_enabled_server_side",I="$dead_clicks_enabled_server_side",R="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",M="$web_vitals_allowed_metrics",F="$session_recording_remote_config",L="$session_recording_enabled_server_side",A="$replay_sample_rate",O="$replay_override_sampling",D="$replay_override_linked_flag",N="$replay_override_url_trigger",B="$replay_override_event_trigger",q="$sesid",H="$session_is_sampled",U="$session_past_minimum_duration",W="$session_recording_url_trigger_activated_session",z="$session_recording_event_trigger_activated_session",j="$posthog_sr_group_event_trigger_",V="$posthog_sr_group_url_trigger_",G="$posthog_sr_group_sampling_",Q="$debug_first_full_snapshot_timestamp",K="$sess_rec_flush_size",Z="$enabled_feature_flags",Y="$active_feature_flags",J="$early_access_features",X="$feature_flag_details",ee="$feature_flag_payloads",te="$feature_flag_request_id",ie="$minimal_flag_called_events",se="$override_feature_flags",ne="$override_feature_flag_payloads",re="$stored_person_properties",oe="$stored_group_properties",ae="$groups",le="$surveys",ce="$surveys_loaded_at",ue="$surveys_activated",de="$surveys_activated_session",he="$surveys_activated_timestamps",pe="ph_product_tours",_e="$product_tours_activated",ge="$product_tours_activated_session",fe="$conversations_widget_session_id",ve="$conversations_ticket_id",me="$conversations_widget_state",ye="$conversations_user_traits",be="$flag_call_reported",Se="$flag_call_reported_session_id",we="$feature_flag_errors",ke="$feature_flag_evaluated_at",Ce="$user_state",Ee="$client_session_props",xe="$capture_rate_limit",Te="$initial_campaign_params",Ie="$initial_referrer_info",Re="$initial_person_info",Pe="$epp",Me="$posthog_cookieless",Fe="$cookieless_mode",Le="$sdk_debug_extensions_init_method",Ae="$sdk_debug_extensions_init_time_ms",Oe="$sdk_debug_recording_script_not_loaded",$e="$sdk_debug_replay_event_trigger_status",De="$sdk_debug_replay_linked_flag_trigger_status",Ne="$sdk_debug_replay_matched_recording_trigger_groups",Be="$sdk_debug_replay_pending_trigger_conditions",qe="$sdk_debug_replay_remote_trigger_matching_config",He="$sdk_debug_replay_trigger_groups_count",Ue="$sdk_debug_replay_url_trigger_status",We="$sdk_debug_rrweb_attached",ze="$sdk_debug_rrweb_start_attempted",je="$session_recording_start_reason",Ve="PostHog loadExternalDependency extension not found.",Ge="anonymous",Qe="identified",Ke="identified_only",Ze="visibilitychange",Ye="beforeunload",Je="$pageview",Xe="$pageleave",et="$identify",tt="$groupidentify";function it(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,n)}function st(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(e){it(r,s,n,o,a,"next",e)}function a(e){it(r,s,n,o,a,"throw",e)}o(void 0)})}}function nt(e){return nt="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},nt(e)}function rt(e,t,i){return(t=function(e){var t=function(e){if("object"!=nt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=nt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ot(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function at(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(i),!0).forEach(function(t){rt(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ot(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var lt=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}({}),ct=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const ut="min_length",dt="max_length",ht=["$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"],pt=["token"];function _t(e,t){return-1!==e.indexOf(t)}const gt=function(e){return e.trim()},ft=function(e){return e.replace(/^\$/,"")};function vt(e){var t;const i=[];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(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}const mt=Object.prototype,yt=mt.hasOwnProperty,bt=mt.toString,St=Array.isArray||function(e){return"[object Array]"===bt.call(e)},wt=e=>"function"==typeof e,kt=e=>e===Object(e)&&!St(e),Ct=e=>{if(kt(e)){for(const t in e)if(yt.call(e,t))return!1;return!0}return!1},Et=e=>void 0===e,xt=e=>"[object String]"==bt.call(e),Tt=e=>xt(e)&&0===e.trim().length,It=e=>null===e,Rt=e=>Et(e)||It(e),Pt=e=>"[object Number]"==bt.call(e)&&e==e,Mt=e=>Pt(e)&&e>0,Ft=e=>"[object Boolean]"===bt.call(e),Lt=e=>e instanceof FormData,At=e=>_t(ht,e),Ot=e=>_t(pt,e);function $t(e){return null===e||"object"!=typeof e}function Dt(e,t){return{}.toString.call(e)===`[object ${t}]`}function Nt(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 qt(e,Error)}}function Bt(e){return"u">typeof Event&&qt(e,Event)}function qt(e,t){try{return e instanceof t}catch(e){return!1}}const Ht=[!0,"true",1,"1","yes"],Ut=e=>_t(Ht,e),Wt=[!1,"false",0,"0","no"],zt=["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"],jt=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return zt.concat(t).some(e=>{const t=e.toLowerCase();return-1!==i.indexOf(t)})};function Vt(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),Pt(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+n),Vt(null!=n?n:i,t,i,s))}var Gt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Vt(e.bucketSize,0,100,e._logger),this._refillRate=Vt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Vt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){const i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let n=this._buckets[s];return n?this._applyRefill(n,i):(n={tokens:this._bucketSize,lastAccess:i},this._buckets[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(t=this._onBucketRateLimited)||void 0===t||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}};const Qt="Mobile",Kt="Android",Zt="Tablet",Yt="Android Tablet",Jt="iPad",Xt="Apple Watch",ei="Safari",ti="BlackBerry",ii="Samsung Internet",si="Chrome",ni="Chrome iOS",ri="Internet Explorer",oi="Internet Explorer Mobile",ai="Opera",li="Microsoft Edge",ci="Firefox",ui="Firefox iOS",di="Nintendo",hi="PlayStation",pi="Xbox",_i="Android Mobile",gi="Mobile Safari",fi="Windows",vi="Windows Phone",mi="Nokia",yi="Ouya",bi="Generic "+Qt.toLowerCase(),Si="Generic "+Zt.toLowerCase(),wi="Konqueror",ki="Oculus Browser",Ci="Vivaldi",Ei="Yandex",xi="Whale",Ti="DuckDuckGo",Ii="Pale Moon",Ri="Waterfox",Pi="Brave",Mi="Claude",Fi="Codex",Li="ChatGPT",Ai="Google Search App",Oi=new RegExp("Version/(\\d+(\\.\\d+)?)"),$i=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Di=new RegExp(pi,"i"),Ni=new RegExp("PlayStation \\w+","i"),Bi=new RegExp("Nintendo \\w+","i"),qi=new RegExp("BlackBerry|PlayBook|BB10","i"),Hi={"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"},Ui=function(e,t,i,s){t=t||"";const n=function(e){return(null==e?void 0:e.brave)?Pi:null}(i);return n||((null==s?void 0:s.detectGoogleSearchApp)&&_t(e,"GSA/")?Ai:_t(e," OPR/")&&_t(e,"Mini")?"Opera Mini":_t(e," OPR/")?ai:qi.test(e)?ti:_t(e,"IEMobile")||_t(e,"WPDesktop")?oi:_t(e,"OculusBrowser")?ki:_t(e,"SamsungBrowser")?ii:_t(e,"Edge")||_t(e,"Edg/")?li:_t(e,"Vivaldi/")?Ci:_t(e,"YaBrowser/")?Ei:_t(e,"Whale/")?xi:_t(e,"DuckDuckGo/")||_t(e,"Ddg/")?Ti:_t(e,"Claude/")?Mi:_t(e,"Codex/")?Fi:_t(e,"ChatGPT/")?Li:_t(e,"FBIOS")?"Facebook Mobile":_t(e,"UCWEB")||_t(e,"UCBrowser")?"UC Browser":_t(e,"CriOS")?ni:_t(e,"CrMo")||_t(e,si)?si:_t(e,Kt)&&_t(e,ei)?_i:_t(e,"FxiOS")?ui:_t(e.toLowerCase(),wi.toLowerCase())?wi:_t(e,"Brave/")?Pi:((e,t)=>t&&_t(t,"Apple")||function(e){return _t(e,ei)&&!_t(e,si)&&!_t(e,Kt)}(e))(e,t)?_t(e,Qt)?gi:ei:_t(e,"PaleMoon/")?Ii:_t(e,"Waterfox/")?Ri:_t(e,ci)?ci:_t(e,"MSIE")||_t(e,"Trident/")?ri:_t(e,"Gecko")?ci:"")},Wi={[oi]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[li]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[si]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ni]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ei]:[Oi],[gi]:[Oi],[ai]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[wi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ti]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oi],[_i]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ii]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[ki]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Mi]:[$i],[Fi]:[$i],[Li]:[$i],[Ti]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},zi=function(e,t,i,s){const n=Ui(e,t,i,s),r=Wi[n];if(Et(r))return null;for(let t=0;r.length>t;t++){const i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},ji=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[pi,e&&e[1]||""]],[new RegExp(di,"i"),[di,""]],[new RegExp(hi,"i"),[hi,""]],[qi,[ti,""]],[new RegExp(fi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[vi,""];if(new RegExp(Qt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=Hi[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[fi,e]}return[fi,""]}],[/((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=>{let t="";return e&&e.length>=3&&(t=Et(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Kt,[e[2],e[3],e[4]||"0"].join(".")]:[Kt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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",""]]],Vi=function(e){for(let t=0;ji.length>t;t++){const[i,s]=ji[t],n=i.exec(e),r=n&&(wt(s)?s(n,e):s);if(r)return r}return["",""]},Gi=function(e){return Bi.test(e)?di:Ni.test(e)?hi:Di.test(e)?pi:new RegExp(yi,"i").test(e)?yi:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?vi:/iPad/.test(e)?Jt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Xt:qi.test(e)?ti:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(mi,"i").test(e)?mi:/(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(Qt).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)?Kt:Yt:new RegExp("(pda|Mobile)","i").test(e)?bi:new RegExp(Zt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Si:""},Qi=function(e,t){var i;const s=Gi(e);return s===Jt||s===Yt||"Kobo"===s||"Kindle Fire"===s||s===Si?Zt:s===di||s===pi||s===hi||s===yi?"Console":s===Xt?"Wearable":s?Qt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(i=null==t?void 0:t.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(n=null==t?void 0:t.screenWidth)&&void 0!==n?n:0,null!==(r=null==t?void 0:t.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==t?void 0:t.devicePixelRatio)&&void 0!==o?o:1)?Qt:Zt:"Desktop";var n,r,o},Ki=/\bFBAV\/(\d+(?:\.\d+)*)/i,Zi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ki],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ki],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ki],[/\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"]],Yi="[Truncated]",Ji="[Unserializable]";function Xi(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const s=e.charCodeAt(i+1);56320>s||s>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}Date,Date;const es=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ts(e,t){return"string"==typeof(i=e)&&es.test(i)?e:t();var i}function is(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function ss(e){return e?e.split("#")[0]:e}function ns(e,t){const i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function rs(e,t,i){return os.apply(this,arguments)}function os(){return(os=st(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,n)=>{s=ns(()=>{try{null==i||i(),e()}catch(e){n(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let as,ls,cs;function us(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return cs&&i.length===ls||(ls=i.length,cs=i.reduce((i,s)=>{as||(as={});const n=as[s];if(n)i[n[0]]=n[1];else{const n=e(s);for(let e=n.length-1;e>=0;e--){const r=n[e],o=null==r?void 0:r.filename,a=t[s];if(o&&a){i[o]=a,as[s]=[o,a];break}}}return i},{})),cs}var ds=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return st(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&St(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null===(t=e.syntheticException)||void 0===t?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){let i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),at(at({},e),{},{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return st(function*(){let i=e;for(const e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){var i,s,n;const r={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});const o=[r];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,at(at({},t),{},{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:us(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i=0){const s=(i,s)=>{if(4>=s){const n=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,n)}};return at(at({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}};function hs(e,t,i,s,n){const r={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!!t&&!t.startsWith("webkit-masked-url://")&&"<anonymous>"!==t};return Et(s)||(r.lineno=s),Et(n)||(r.colno=n),r}const ps=(e,t)=>{const i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},_s=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,gs=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fs=/\((\S*)(?::(\d+))(?::(\d+))\)/,vs=(e,t)=>{const i=_s.exec(e);if(i){const[,e,s,n]=i;return hs(t,e,"?",+s,+n)}const s=gs.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){const e=fs.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}const[e,i]=ps(s[1]||"?",s[2]);return hs(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ms=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ys=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,bs=(e,t)=>{const i=ms.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const e=ys.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],s=i[1]||"?";return[s,e]=ps(s,e),hs(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ss=/\(error: (.*)\)/;function ws(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function ks(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!ws(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let s=0;t>s;s++)e[i+s]=e[i+t+s];return e.length=i+t,{start:i,length:t}}}}function Cs(e,t){const i=t.start+t.length,s=xs(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function Es(e,t){let i=t.start;for(;i>0&&ws(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function xs(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&ws(e[s],e[s-t.length]);)s++;return s-i}function Ts(e,t){const i=t[0];let s=e.length-(i?Es(e,i):0);for(const i of t)s-=xs(e,i);return s}function Is(e,t,i){for(let s=0;e.length>s;s++){const n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var Rs=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=xt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Dt(e,"DOMException")}isDOMError(e){return Dt(e,"DOMError")}},Ps=class{match(e){return Nt(e)}coerce(e,t){var i;const s=this.getStack(e),n=void 0===s;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Ms=class{match(e){return!!Dt(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);const s=t.apply(e.message);return at(at({},s),{},{stack:null!==(i=this._buildLocationStack(e))&&void 0!==i?i:s.stack,synthetic:!0})}_hasUsableMessage(e){return xt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,i;const s=e,n=null!==(t=s.lineno)&&void 0!==t?t:0,r=null!==(i=s.colno)&&void 0!==i?i:0;if(xt(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Fs=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Ls=class{match(e){return"string"==typeof e}coerce(e,t){var i;const[s,n]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(Fs);return s&&(t=s[1],i=s[2]),[t,i]}};const As=["fatal","error","warning","log","info","debug"];function Os(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){const s=i.slice(0,e).join(", ");if(t>=s.length)return e===i.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var $s=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s;const n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null!==(i=this.getStack(e))&&void 0!==i?i:null===(s=t.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Bt(e))return e.constructor.name;const t="name"in e?e.name:void 0;return xt(t)&&!Tt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let 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;const t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${Os(e)}`}isSeverityLevel(e){return xt(e)&&!Tt(e)&&As.indexOf(e)>=0}getStack(e){try{return xt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:xt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(Nt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Ds=class{match(e){return Bt(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Os(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Ns=class{match(e){return $t(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Bs=class{match(e){return Dt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Bt(e))return!1;try{const t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return $t(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:t.apply(s)}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}};const qs="$message",Hs="$timestamp",Us=new Set([qs,Hs]),Ws={enabled:!0,max_bytes:32768};function zs(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Ws.enabled,max_bytes:Vs(e.max_bytes,Ws.max_bytes)}:at({},Ws)}var js=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=zs(e)}setConfig(e){this._config=zs(e),this._trimToMaxBytes()}add(e){const t=function(e){let t;try{t=vt(e)}catch(e){return}try{const e=JSON.parse(t);if(!kt(e))return;const i=e,s=i[qs],n=i[Hs];if(!xt(s)||0===s.trim().length)return;if(!xt(n)&&!Pt(n))return;return{step:i,json:t}}catch(e){return}}(e);if(!t)return;const i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;const t=encodeURIComponent(e);let i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,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;){const e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function Vs(e,t){if(!Pt(e)||1/0===e||-1/0===e)return t;const i=Math.floor(e);return 0>i?t:i}const Gs=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function Qs(e){return"string"==typeof e||e}function Ks(e){return"string"==typeof e?e:void 0}const Zs=["$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"],Ys="NativeGzipValidationError",Js=e=>e.length>=2&&31===e[0]&&139===e[1],Xs=(e,t)=>e===ct.GZipJS||t===ct.GZipJS||"gzip"===t,en=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),tn=e=>{if(!e||"object"!=typeof e)return!1;const t="name"in e?String(e.name):"";return en(e)||t===Ys};let sn;const nn=e=>{throw is(Ys,`Native gzip produced invalid output: ${e}`)},rn=(on=st(function*(e,t){18>e.size&&nn("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Js(i)&&8===i[2]||nn("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{const t=(()=>{if(sn)return sn;sn=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;sn[e]=t>>>0}return sn})();let i=4294967295;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&nn("invalid-crc");const n=t.length>>>0;s.getUint32(4,!0)!==n&&nn("invalid-size")}),function(e,t){return on.apply(this,arguments)});var on;function an(e){return ln.apply(this,arguments)}function ln(){return ln=st(function*(e,t=!0,i){try{const t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),n=i.writable.getWriter(),r=n.write(t).then(()=>n.close()).catch((s=st(function*(e){try{yield n.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield rn(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var s}),ln.apply(this,arguments)}function cn(e,t){if(null==e)return{};var i,s,n=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;i[s]=e[s]}return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}const un={}.propertyIsEnumerable;function dn(e,t){try{return _n(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function hn(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Yi};if(i.remainingNodes--,Ft(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){const i=e.toString(),s=BigInt("9223372036854775808");return e>=s||-s>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(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)};const i=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:Xi(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Yi};if(e instanceof Date){const t=e.getTime(),i=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:"string"==typeof i?Xi(i):String(i)}}i.ancestors.add(e);try{try{const n=e.toJSON;if("function"==typeof n)return hn(n.call(e),t,i,s+1)}catch(e){}return St(e)?{arrayValue:{values:pn(e,t,i,s+1)}}:{kvlistValue:{values:_n(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:Xi(String(e))}}function pn(e,t,i,s){const n=[],r=Math.min(e.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in e?e[o]:void 0;if(Rt(r))continue;n.push(hn(r,t,i,s))}catch(e){n.push({stringValue:Ji})}return e.length>o&&n.push({stringValue:Yi}),n}function _n(e,t,i,s){const n=[];for(const r in e)if(un.call(e,r)){if(!r){null==t||t.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[r];if(It(o)||Et(o))continue;n.push({key:Xi(r),value:hn(o,t,i,s)})}catch(e){n.push({key:Xi(r),value:{stringValue:Ji}})}}return n}function gn(e,t,i){return at(at(at(at({},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":i})}const fn={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};const vn={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}},mn=vn.info;function yn(e){try{return Xi(String(e))}catch(e){return Ji}}function bn(e,t,i,s){const n=e.level||"info",{text:r,number:o}=vn[n]||mn,a=function(e=Date.now()){return String(e)+"000000"}(Pt(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),Rt(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),Rt(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=at({},l),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(const t of e){let e;try{e=u[t]}catch(t){e=Ji}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:yn(e.body)},attributes:dn(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),Et(e.trace_flags)||(d.flags=e.trace_flags),d}function Sn(e,t,i){return gn(e,t,i)}function wn(e,t,i,s){return{resourceLogs:[{resource:{attributes:dn(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var kn=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this._config=t,this._logger=i,this._getContext=s,this._onReady=n,this._waitForStoragePersist=r,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(lt.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 i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==e?void 0:e.body))return;const s=this._runBeforeSend(e);if(null===s)return;if(!s.body)return void this._logger.info("Log was rejected in beforeSend function");if(!this._checkRateLimit())return;const n={record:bn(s,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(n))}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=St(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Log was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return s}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;const 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 st(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return st(function*(){var t;e._clearFlushTimer();let i=null!==(t=e._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==t?t:[];if(0===i.length)return;const s=i.length;let n=0;for(;i.length>0&&s>n;){var r,o;const t=e._queueGeneration;e._evictedSinceAdvance=0;const s=Math.min(i.length,e._maxBatchRecordsPerPost),a=i.slice(0,s),l=wn(a.map(e=>e.record),e._buildResourceAttributes(),null!==(r=e._scopeName)&&void 0!==r?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(l);if(e._queueGeneration!==t)return;if("too-large"===c.kind&&a.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(a.length/2)),e._logger.warn(`Received 413 when sending logs batch of size ${a.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(a.length),i=null!==(o=e._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==o?o:[],n+=a.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return st(function*(){var i;const s=Math.max(0,e-t._evictedSinceAdvance),n=null!==(i=t._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(lt.LogsQueue,n.slice(s)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return Sn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(this._instance.optedOut)return;const i=null!==(t=this._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>i.length||(i.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(lt.LogsQueue,i),this._maxBufferSize>i.length?this._armFlushTimer():this._flushInBackground()}_armFlushTimer(e=this._flushIntervalMs){this._flushTimer||(this._flushTimer=ns(()=>{this._flushTimer=void 0,this._flushInBackground()},e))}_nextFlushDelay(){const e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){const e=this._instance.getPersistedProperty(lt.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return st(function*(){t._clearFlushTimer();const i=t.flush().catch(()=>{});void 0!==e?yield rs(i,e):yield i})()}flushWithTimeout(e){var t=this;return st(function*(){const i=t.flush();yield rs(i,e,()=>{i.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)}};const Cn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function En(e){return String(e)+"000000"}function xn(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(s[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${n}`}var Tn=class{constructor(e,t,i){this._instance=e,this._config=t,this._logger=i,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t=1,i){this._capture({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this._capture({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this._capture({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e=this;const t=this._flushPromise,i=function(){var i=st(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this._flushPromise===i&&(this._flushPromise=null)});return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;const 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)return;const t=this._runBeforeSend(e);if(null===t)return;if(!t.name||"string"!=typeof t.name)return void this._logger.warn("Dropping metric with empty name");if("number"!=typeof t.value||!Number.isFinite(t.value))return void this._logger.warn(`Dropping metric '${t.name}': value must be a finite number`);if("count"===t.type&&0>t.value)return void this._logger.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?at({},t.attributes):void 0,s=xn(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e)}let n=this._series.get(s);if(!n){if(!this._admitNewSeries())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(s,n)}const r=this._typeByName.get(t.name);void 0===r?this._typeByName.set(t.name,t.type):r===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this._fold(n,t.value),this._armFlushTimer()}_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){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?i: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(Cn.length+1).fill(0)});const 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(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,Cn)]+=1;break}}}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=St(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Metric was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return s}_armFlushTimer(){this._flushTimer||(this._flushTimer=ns(()=>{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 st(function*(){if(0===e._series.size)return;const t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;const i=e._generation,s=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(i===e._generation)switch(s.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:",s.error)}})()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return gn(e,t,i)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:dn(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}_buildMetrics(e){const t=En(Date.now()),i=new Map;for(const o of e.values()){var s;const e=xn(o.type,o.name,o.unit,void 0);let a=i.get(e);a||(a=at({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));const l=dn(null!==(s=o.attributes)&&void 0!==s?s:{},this._logger),c=En(o.windowStartMs);if("count"===o.type){var n;const e={attributes:l,startTimeUnixNano:c,timeUnixNano:t,asDouble:null!==(n=o.total)&&void 0!==n?n:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){var r;const e={attributes:l,timeUnixNano:t,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(e)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Cn})}return Array.from(i.values())}_mergeWindowBack(e){for(const[s,n]of e){const e=this._series.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,n.windowStartMs),e.type){case"count":var t,i;e.total=(null!==(t=e.total)&&void 0!==t?t:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(e.hist){e.hist.count+=n.hist.count,e.hist.sum+=n.hist.sum,e.hist.min=Math.min(e.hist.min,n.hist.min),e.hist.max=Math.max(e.hist.max,n.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=n.hist.bucketCounts[t]}else e.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function In(e,t){if(!e)return;const i=e.find(e=>e.type===t);return null==i?void 0:i.value}const Rn="0.8.2",Pn={DEBUG:!1,LIB_VERSION:Rn,LIB_NAME:"browser-common",JS_SDK_VERSION:Rn},Mn=(t,{debugEnabled:i}={})=>{const s={_log(s,...n){e&&(Pn.DEBUG||e.POSTHOG_DEBUG||i)&&!Et(e.console)&&e.console&&("__rrweb_original__"in e.console[s]?e.console[s].__rrweb_original__:e.console[s])(t,...n)},debug(...e){s._log("debug",...e)},info(...e){s._log("log",...e)},warn(...e){s._log("warn",...e)},error(...e){s._log("error",...e)},critical(...e){console.error(t,...e)},uninitializedWarning(e){s.error(`You must initialize PostHog before calling ${e}`)},createLogger:(e,i)=>Mn(`${t} ${e}`,i)};return s},Fn=Mn("[PostHog.js]"),Ln=Fn.createLogger;function An(e,t){St(e)&&e.forEach(t)}function On(e,t){if(!Rt(e))if(St(e))e.forEach(t);else if(Lt(e))e.forEach((e,i)=>t(e,i));else for(const i in e)yt.call(e,i)&&t(e[i],i)}const $n=function(e,...t){for(const i of t)for(const t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function Dn(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}const Nn=function(e){try{return e()}catch(e){return}},Bn=function(e){return function(...t){try{return e.apply(this,t)}catch(e){Fn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Fn.critical(e)}}},qn=function(e){const t={};return On(e,function(e,i){(xt(e)&&e.length>0||Pt(e))&&(t[i]=e)}),t};function Hn(e){const t=at({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}const Un=["herokuapp.com","vercel.app","netlify.app"];function Wn(e){const t=null==e?void 0:e.hostname;if(!xt(t))return!1;const i=t.split(".").slice(-2).join(".");for(const e of Un)if(i===e)return!1;return!0}function zn(e,t,i,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:n,passive:r})}function jn(e){return"ph_toolbar_internal"===e.name}const Vn=["localhost","127.0.0.1"],Gn=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>{var s;return Nt(t)?(null!==(s=i)&&void 0!==s||(i=new WeakMap),i.has(t)||i.set(t,Hn(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return vt(e)}},Qn=e=>{const t=null==s?void 0:s.createElement("a");return Et(t)?null:(t.href=e,t)},Kn=function(e,t="&"){let i,s;const n=[];return On(e,function(e,t){Et(e)||Et(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),n[n.length]=s+"="+i)}),n.join(t)},Zn=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let e=0;i.length>e;e++){const n=i[e].split("=");if(n[0]===t){s=n;break}}if(!St(s)||2>s.length)return"";{let e=s[1];try{e=decodeURIComponent(e)}catch(t){Fn.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},Yn=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let e=0;l.length>e;e++){const s=l[e].split("=");St(s)&&(t.includes(s[0])?c.push(s[0]+"="+i):c.push(l[e]))}let u=a;return null!=o&&(u+="?"+c.join("&")),null!=n&&(u+="#"+n),u},Jn=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Xn=(e,t)=>e>=t&&u(),er=(e,t,i,s)=>{if(0===e){if(u()){const e=t+1;return e===i&&s(),e}return t}return 0};function tr(e,t){var i;const s=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!wt(s))return t;try{const e=s(t);return xt(e)&&e?e:t}catch(e){return Fn.error("Error in get_current_url, falling back to window.location.href",e),t}}function ir(t){var i;const s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return Et(s)?void 0:tr(t,s)}function sr(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null===(t=e.closest)||void 0===t?void 0:t.call(e,".toolbar-global-fade-container")))}function nr(e){return!!e&&1===e.nodeType}function rr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function or(e){return!!e&&3===e.nodeType}function ar(e){return!!e&&11===e.nodeType&&nr(e.host)}function lr(e){return e?gt(e).split(/\s+/):[]}function cr(e,t){const i=ir(t);return!!(i&&e&&e.some(e=>i.match(e)))}function ur(e){let 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 lr(t)}function dr(e){return Rt(e)?null:gt(e).split(/(\s+)/).filter(e=>Nr(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function hr(e){let t="";return Rr(e)&&!Pr(e)&&e.childNodes&&e.childNodes.length&&On(e.childNodes,function(e){var i;or(e)&&e.textContent&&(t+=null!==(i=dr(e.textContent))&&void 0!==i?i:"")}),gt(t)}function pr(e){var t;return Et(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}const _r=["a","button","form","input","select","textarea","label"];function gr(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function fr(e,t){if(Et(t))return!0;for(const i of e)if(t.some(e=>gr(i,e)))return!0;return!1}function vr(e){const t=e.parentNode;return!(!t||!nr(t))&&t}const mr=[".ph-no-autocapture","[data-ph-no-autocapture]"],yr=["next","previous","prev",">","<"],br=[...yr,"+","-","−","–"],Sr=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,wr=[".ph-no-deadclick",".ph-no-capture"],kr=[".ph-no-rageclick",".ph-no-capture"],Cr=["","text","search","email","password","url","tel","number"];function Er(e){return!(!e||!nr(e))&&(!!rr(e,"textarea")||(rr(e,"input")?_t(Cr,(e.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;const i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(e)))}function xr(t,i){if(!e||Tr(t))return!1;let s,n,r;var o,a;if(Ft(i)?(s=!!i&&kr,n=void 0,r=!1):(s=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:kr,n=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===s)return!1;if(r&&Er(t))return!1;const{targetElementList:l}=Ir(t,!1);return!function(e,t){if(!1===e||Et(e))return!1;let i;if(!0===e)i=yr;else{if(!St(e))return!1;if(e.length>10)return Fn.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>i.some(i=>Sr(e,i)||Sr(t,i)))}(n,l.map(e=>{var t;return{safeText:hr(e).toLowerCase(),ariaLabel:(null===(t=e.getAttribute("aria-label"))||void 0===t?void 0:t.toLowerCase().trim())||""}}))&&!fr(l,s)}const Tr=e=>!e||rr(e,"html")||!nr(e),Ir=(t,i)=>{if(!e||Tr(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!rr(r,"body");){if(ar(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=vr(r);if(!t)break;if(i||_r.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(e){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Rr(e){const t=new Set;let i=0;for(let s=e;s.parentNode&&!rr(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);const e=ur(s);if(_t(e,"ph-sensitive")||_t(e,"ph-no-capture"))return!1}if(_t(ur(e),"ph-include"))return!0;const s=e.type||"";if(xt(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";return!xt(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Pr(e){return!!(rr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rr(e,"select")||rr(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const Mr=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}))$"),Fr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Lr=[16,15,14,13],Ar=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Or=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),$r=/[0-9A-Za-z_]/;function Dr(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function Nr(e,t=!0){if(Rt(e))return!1;if(xt(e)){if(e=gt(e),t?Mr.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(Fr.lastIndex=0;t=Fr.exec(e);){const e=t[2];if(!e)continue;const i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(const t of Lr){const s=e+t;if(i.length>=s){const t=i.slice(e,s);if(Mr.test(t)&&Dr(t))return!0}}}return!1}(e))return!1;if(t?Ar.test(e):function(e){let t;for(Or.lastIndex=0;t=Or.exec(e);){const e=t[1],i=t[3];if(!(e&&i&&$r.test(e)&&$r.test(i)))return!0}return!1}(e))return!1}return!0}function Br(e){let t=hr(e);return t=`${t} ${qr(e)}`.trim(),Nr(t)?t:""}function qr(e){let t="";return e&&e.childNodes&&e.childNodes.length&&On(e.childNodes,function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=hr(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${qr(e)}`.trim())}catch(e){Fn.error("[AutoCapture]",e)}}),t}function Hr(e){return e.replace(/"|\\"/g,'\\"')}function Ur(e){const t=e.attr__class;if(t)return St(t)?t:lr(t)}const Wr=1e6;function zr(e){var t;return Math.min(Wr,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:Wr)}const jr={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:Wr,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},Vr=["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"],Gr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Qr=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Kr=e=>{Rt(e)||On(Object.keys(e),t=>{(e=>{const t=e.toLowerCase();return Vr.includes(t)||Qr.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},Zr=["/s/","/e/","/i/"];function Yr(e,t,i,s){if(Rt(e))return e;let n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return xt(n)&&(n=parseInt(n)),n>i?`[SessionRecording] ${s} body too large to record (${n} bytes)`:e}function Jr(e,t){if(Rt(e))return e;let i=e;return Nr(i,!1)||(i="[SessionRecording] "+t+" body redacted"),On(Gr,e=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(e))&&(i="[SessionRecording] "+t+" body redacted as might contain: "+e)}),i}const Xr=new WeakSet,eo="disabled",to="sampled",io="active",so="buffering",no="paused",ro="lazy_loading",oo="rrweb_error",ao="trigger_activated",lo="trigger_pending",co="trigger_disabled";function uo(e,t,i,s,n,r){return 0===t?co:(null==e?void 0:e.get_property(i?s+i:n))===r?ao:lo}function ho(e,t,i){return t.some(t=>{var s;return"regex"===t.matching&&(null!==(s=null==i?void 0:i.get(t.url))&&void 0!==s?s:new RegExp(t.url)).test(e)})}function po(e){return e.includes("trigger_activated")?ao:e.includes("trigger_pending")?lo:co}function _o(e){const t=new Set(e);switch(t.delete(co),t.size){case 0:return co;case 1:return Array.from(t)[0];default:return lo}}var 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())}},fo=class{constructor(e){this._matchers=e}triggerStatus(e){return _o(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return _o(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},vo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return ao}stop(){}};const mo=e=>"sessionRecording"in e;var yo=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,i;this._urlTriggers=(mo(e)?kt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(mo(e)?kt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear();for(const e of this._urlTriggers)if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){Fn.error("Invalid URL trigger regex pattern:",e.url,t)}for(const e of this._urlBlocklist)if("regex"===e.matching&&!this._compiledBlocklistRegexes.has(e.url))try{this._compiledBlocklistRegexes.set(e.url,new RegExp(e.url))}catch(t){Fn.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return uo(this._instance,this._urlTriggers.length,this._groupId,V,W,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ue]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){const e=ir(this._instance);if(!e)return!1;try{return ho(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){const i=ir(this._instance);if(!i)return;if(i===this._lastCheckedUrl)return;this._lastCheckedUrl=i;const s=this.urlBlocked,n=ho(i,this._urlBlocklist,this._compiledBlocklistRegexes);s&&n||(n&&!s?e():!n&&s&&t())}checkUrlTriggerConditions(e,t,i,s){const n=ir(this._instance);if(!n)return;if(n===this._lastCheckedUrl)return;this._lastCheckedUrl=n;const r=this.urlBlocked,o=ho(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!r?e():!o&&r&&t();const a=this._urlTriggerStatus(s)===ao,l=ho(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&i("url",n)}stop(){this._lastCheckedUrl=""}},bo=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){const e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[De]:e}),e}triggerStatusNoSideEffects(){let e=lo;return Rt(this.linkedFlag)&&(e=co),this.linkedFlagSeen&&(e=ao),e}onConfig(e,t){var i;if(this.linkedFlag=(mo(e)?kt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Rt(this.linkedFlag)&&!this.linkedFlagSeen){const e=xt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=xt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((s,n)=>{let r=!1;if(kt(n)&&e in n){const t=n[e];r=Ft(t)?!0===t:i?t===i:!!t}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&t(e,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},So=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(mo(e)?kt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?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,j,z,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[$e]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,i){if(0===this._eventTriggers.length)return;const s=this._eventTriggerStatus(i)===ao,n=this._eventTriggers.includes(e);!s&&n&&t("event",e)}stop(){}},wo=class{constructor(e,t,i){if(this._instance=e,this.group=t,this._urlTriggerMatching=new yo(e,t.id),this._eventTriggerMatching=new So(e,t.id),this._linkedFlagMatching=new bo(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){const e=(t.conditions.events||[]).map(e=>e.name),s={urlTriggers:t.conditions.urls||[],eventTriggers:e,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,i);const n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new go(n):new fo(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(({status:e})=>e===lo).map(({label:e})=>e)}checkEventTriggerConditions(e,t,i){this._eventTriggerMatching.checkEventTriggerConditions(e,t,i)}checkUrlTriggerConditions(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,i,s)}activateTrigger(e,t){var i;const s="url"===e?V+this.group.id:j+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[s]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function ko(e){if(e.rrwebError)return oo;if(!e.receivedFlags)return so;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return no;const t=!0===e.isSampled,i=new go([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?to:"trigger_activated"===i?io:"trigger_pending"===i?so:!1===e.isSampled?eo:io}function Co(e){if(e.rrwebError)return oo;if(!e.receivedFlags)return so;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return no;const t=new fo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==co,s=Ft(e.isSampled);return i&&"trigger_pending"===t?so:i&&"trigger_disabled"===t||s&&!e.isSampled?eo:!0===e.isSampled?to:io}function Eo(){const e=[];return function(t,i){if(kt(i)||St(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}function xo(e){const t=JSON.stringify(e,Eo());return t?new Blob([t]).size:0}function To(e){if(It(e))return 4;if(Et(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(St(e)){let t=2;for(let i=0;e.length>i;i++){i>0&&(t+=1);const s=e[i];t+=Et(s)||It(s)?4:To(s)}return t}const t=e;let i=2,s=!0;for(const e in t){if(!{}.hasOwnProperty.call(t,e))continue;const n=t[e];Et(n)||(s||(i+=1),s=!1,i+=e.length+3+To(n))}return i}default:return 0}}function Io(e,t=6606028.8){if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),i=e.sizes.slice(0,t),s=e.sizes.slice(t);return[Io({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,t),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Io({size:s.reduce((e,t)=>e+t,0),data:e.data.slice(t),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Ro=Uint8Array,Po=Uint16Array,Mo=Uint32Array,Fo=new Ro([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]),Lo=new Ro([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]),Ao=new Ro([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oo=function(e,t){for(var i=new Po(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new Mo(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},$o=Oo(Fo,2),Do=$o[1];$o[0][28]=258,Do[258]=28;for(var No=Oo(Lo,0)[1],Bo=new Po(32768),qo=0;32768>qo;++qo){var Ho=(43690&qo)>>>1|(21845&qo)<<1;Bo[qo]=((65280&(Ho=(61680&(Ho=(52428&Ho)>>>2|(13107&Ho)<<2))>>>4|(3855&Ho)<<4))>>>8|(255&Ho)<<8)>>>1}var Uo=function(e,t,i){for(var s=e.length,n=0,r=new Po(t);s>n;++n)++r[e[n]-1];var o,a=new Po(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new Po(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],d=a[e[n]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[Bo[d]>>>l]=c}else for(o=new Po(s),n=0;s>n;++n)o[n]=Bo[a[e[n]-1]++]>>>15-e[n];return o},Wo=new Ro(288);for(qo=0;144>qo;++qo)Wo[qo]=8;for(qo=144;256>qo;++qo)Wo[qo]=9;for(qo=256;280>qo;++qo)Wo[qo]=7;for(qo=280;288>qo;++qo)Wo[qo]=8;var zo=new Ro(32);for(qo=0;32>qo;++qo)zo[qo]=5;var jo=Uo(Wo,9,0),Vo=Uo(zo,5,0),Go=function(e){return(e/8|0)+(7&e&&1)},Qo=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof Po?Po:e instanceof Mo?Mo:Ro)(i-t);return s.set(e.subarray(t,i)),s},Ko=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Zo=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Yo=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Ro(0),0];if(1==n){var o=new Ro(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;n>s;++s)r[s].s>h&&(h=r[s].s);var p=new Po(h+1),_=Jo(i[u-1],p,0);if(_>t){s=0;var g=0,f=_-t,v=1<<f;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;g+=v-(1<<_-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=r[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=r[s].s;p[b]==t&&(--p[b],++g)}_=t}return[new Ro(p),_]},Jo=function(e,t,i){return-1==e.s?Math.max(Jo(e.l,t,i+1),Jo(e.r,t,i+1)):t[e.s]=i},Xo=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Po(++t),s=0,n=e[0],r=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=e[a]}return[i.subarray(0,s),t]},ea=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},ta=function(e,t,i){var s=i.length,n=Go(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},ia=function(e,t,i,s,n,r,o,a,l,c,u){Ko(t,u++,i),++n[256];for(var d=Yo(n,15),h=d[0],p=d[1],_=Yo(r,15),g=_[0],f=_[1],v=Xo(h),m=v[0],y=v[1],b=Xo(g),S=b[0],w=b[1],k=new Po(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=Yo(k,7),x=E[0],T=E[1],I=19;I>4&&!x[Ao[I-1]];--I);var R,P,M,F,L=c+5<<3,A=ea(n,Wo)+ea(r,zo)+o,O=ea(n,h)+ea(r,g)+o+14+3*I+ea(k,x)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return ta(t,u,e.subarray(l,l+c));if(Ko(t,u,1+(A>O)),u+=2,A>O){R=Uo(h,p,0),P=h,M=Uo(g,f,0),F=g;var D=Uo(x,T,0);for(Ko(t,u,y-257),Ko(t,u+5,w-1),Ko(t,u+10,I-4),u+=14,C=0;I>C;++C)Ko(t,u+3*C,x[Ao[C]]);u+=3*I;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)Ko(t,u,D[H=31&q[C]]),u+=x[H],H>15&&(Ko(t,u,q[C]>>>5&127),u+=q[C]>>>12)}}else R=jo,P=Wo,M=Vo,F=zo;for(C=0;a>C;++C)if(s[C]>255){var H;Zo(t,u,R[257+(H=s[C]>>>18&31)]),u+=P[H+257],H>7&&(Ko(t,u,s[C]>>>23&31),u+=Fo[H]);var U=31&s[C];Zo(t,u,M[U]),u+=F[U],U>3&&(Zo(t,u,s[C]>>>5&8191),u+=Lo[U])}else Zo(t,u,R[s[C]]),u+=P[s[C]];return Zo(t,u,R[256]),u+P[256]},sa=new Mo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),na=new Ro(0),ra=function(){for(var e=new Mo(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),oa=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function aa(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=ra[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var n,r,o,a,l,c=(n=e,r=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,i,s,n,r){var o=e.length,a=new Ro(s+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(s,a.length-n),c=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?c=ta(l,c,e.subarray(u,d)):(l[u]=r,c=ta(l,c,e.subarray(u,o)))}else{for(var h=sa[t-1],p=h>>>13,_=8191&h,g=(1<<i)-1,f=new Po(32768),v=new Po(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new Mo(25e3),w=new Po(288),k=new Po(32),C=0,E=0,x=(u=0,0),T=0,I=0;o>u;++u){var R=b(u),P=32767&u,M=v[R];if(f[P]=M,v[R]=P,u>=T){var F=o-u;if((C>7e3||x>24576)&&F>423){c=ia(e,l,0,S,w,k,E,x,I,u-I,c),x=C=E=0,I=u;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(u-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,u),H=Math.min(258,F);q>=N&&--D&&P!=M;){if(e[u+A]==e[u+A-N]){for(var U=0;H>U&&e[u+U]==e[u+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 j=u-N+L+32768&32767,V=j-f[j]+32768&32767;V>z&&(z=V,M=j)}}}N+=(P=M)-(M=f[P])+32768&32767}if(O){S[x++]=268435456|Do[A]<<18|No[O];var G=31&Do[A],Q=31&No[O];E+=Fo[G]+Lo[Q],++w[257+G],++k[Q],T=u+A,++C}else S[x++]=e[u],++w[e[u]]}}c=ia(e,l,r,S,w,k,E,x,I,u-I,c),r||(c=ta(l,c,na))}return Qo(a,0,s+Go(c)+n)}(n,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+r.mem,o,a,!l)),u=c.length;return function(e,t){var i=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&&oa(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(c,t),oa(c,u-8,i.d()),oa(c,u-4,s),c}function la(e,t){var i=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new Ro(e.length+(e.length>>>1)),n=0,r=function(e){s[n++]=e},o=0;i>o;++o){if(n+5>s.length){var a=new Ro(n+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l||t?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return Qo(s,0,n)}function ca(e,t){var i="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var s=0;e.length>s;){var n=e[s++];128>n||t?i+=String.fromCharCode(n):224>n?i+=String.fromCharCode((31&n)<<6|63&e[s++]):240>n?i+=String.fromCharCode((15&n)<<12|(63&e[s++])<<6|63&e[s++]):(n=((15&n)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536,i+=String.fromCharCode(55296|n>>10,56320|1023&n))}return i}var ua=class{constructor(e,t={}){var i,s,n,r;this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{const 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,i;this._loggedTracker[e]=!0;const s=this._getNode(e);null===(t=(i=this._options).onBlockedNode)||void 0===t||t.call(i,e,s)}},this._getNodeOrRelevantParent=e=>{const t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,i,s,n,r,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(s=null===(n=e.attributes)||void 0===n?void 0:n.length)&&void 0!==s?s:0)+(null!==(r=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,i=this._numberOfChanges(t);if(t.attributes){const e=t.attributes.length;t.attributes=t.attributes.filter(e=>{const[t]=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t)&&e});const i=e-t.attributes.length;var s,n;i>0&&(null===(s=(n=this._options).onDroppedAttributeMutations)||void 0===s||s.call(n,i))}const r=this._numberOfChanges(t);if(0===r&&i!==r)return;if(this._byteBudgetDisabled)return e;this._refillByteBudget();const o=To(e);var a,l;return o>this._byteTokens?(null===(a=(l=this._options).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._scheduleResync()):(this._byteTokens-=o,e)},this._scheduleResync=()=>{if(this._resyncTimer)return;const 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)||void 0===e||e.call(t)},e)},this._rateLimiter=new Gt({bucketSize:null!==(i=this._options.bucketSize)&&void 0!==i?i:100,refillRate:null!==(s=this._options.refillRate)&&void 0!==s?s:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:Fn}),this._bytesBucketSize=null!==(n=this._options.bytesBucketSize)&&void 0!==n?n:0,this._bytesRefillRate=null!==(r=this._options.bytesRefillRate)&&void 0!==r?r:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;const o=this._options.resyncIntervalMs;this._resyncIntervalMs=Pt(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}};const da=e=>{if(s){try{const t=e+"=",i=s.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let s=i[e];for(;" "==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 Pt(e)&&isFinite(e)&&Math.floor(e)===e});var ha=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new e(r)}toString(){let e="";for(let 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(let t=0;16>t;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},pa=class{generate(){const e=this.generateOrAbort();if(!Et(e))return e;{this._timestamp=0;const e=this.generateOrAbort();if(Et(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return Pt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ha.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}};let _a=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!Et(e.crypto)&&crypto.getRandomValues&&(_a=e=>crypto.getRandomValues(e));var ga=class{nextUint32(){return this._buffer.length>this._cursor||(_a(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}};let fa;const va=()=>ma().toString(),ma=()=>(fa||(fa=new pa)).generate();let ya="";const ba=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Sa=null;const wa={_is_supported(){if(!It(Sa))return Sa;if(Sa=!1,s)try{const e=`__ph_cookie_support_${va()}`;wa._set(e,"xyz"),Sa='"xyz"'===da(e),wa._remove(e)}catch(e){Sa=!1}return Sa},_error(e){Fn.error("cookieStore error: "+e)},_get:da,_parse(e){let t;try{t=JSON.parse(wa._get(e))||{}}catch(e){}return t},_set(e,t,i,n,r){if(!s)return!1;try{let o="",a="";const l=function(e,t){if(t){let t=function(e,t=s){if(ya)return ya;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const i=e.split(".");let n=Math.min(i.length,8);const r="dmn_chk_"+va();for(;!ya&&n--;){const e=i.slice(n).join("."),s=r+"=1;domain=."+e+";path=/";t.cookie=s+";max-age=3",t.cookie.includes(r)&&(t.cookie=s+";max-age=0",ya=e)}return ya}(e);if(!t){const i=(e=>{const t=e.match(ba);return t?t[0]:""})(e);i!==t&&Fn.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(s.location.hostname,n);if(i){const e=new Date;e.setTime(e.getTime()+864e5*i),o="; expires="+e.toUTCString()}r&&(a="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Fn.warn("cookieStore warning: large cookie, len="+c.length),s.cookie=c,!0}catch(e){return!1}},_remove(e,t){if(null==s?void 0:s.cookie)try{wa._set(e,"",-1,t)}catch(e){return}}};let ka=null;const Ca={_is_supported(){if(!It(ka))return ka;let t=!0;if(Et(e))t=!1;else try{const e="__mplssupport__";Ca._set(e,"xyz"),'"xyz"'!==Ca._get(e)&&(t=!1),Ca._remove(e)}catch(e){t=!1}return t||Fn.error("localStorage unsupported; falling back to cookie store"),ka=t,t},_error(e){Fn.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){Ca._error(e)}return null},_parse(e){try{return JSON.parse(Ca._get(e))||{}}catch(e){}return null},_set(t,i){try{return null==e||e.localStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Ca._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){Ca._error(e)}}},Ea=[re,Y,Z,X,ee,te,ke,we,be],xa=[g,_,q,H,Pe,Re,b,Ce],Ta=e=>e+"_cpm",Ia=["__proto__","constructor","prototype"],Ra=e=>{if(!kt(e))return{};const t={};return Object.keys(e).forEach(i=>{-1===Ia.indexOf(i)&&(t[i]=e[i])}),t},Pa=(e,t=[])=>{const i={};return[...xa,...t].forEach(t=>{const s=e[t];Et(s)||It(s)||""===s||(i[t]=s)}),i},Ma=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Fa=(e,t)=>({p:t,f:Ma(JSON.stringify(e))}),La=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=wa._parse(Ta(e)),s=(null==i?void 0:i.f)===Ma(t)&&St(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Aa=(e,t)=>t+"|"+(wa._get(Ta(e))||""),Oa={},$a={_is_supported:()=>!0,_error(e){Fn.error("memoryStorage error: "+e)},_get:e=>e in Oa?Oa[e]:null,_parse:e=>e in Oa?Oa[e]:null,_set:(e,t)=>(Oa[e]=t,!0),_remove(e){delete Oa[e]}};let Da=null;const Na={_is_supported(){if(!It(Da))return Da;if(Da=!0,Et(e))Da=!1;else try{const e="__support__";Na._set(e,"xyz"),'"xyz"'!==Na._get(e)&&(Da=!1),Na._remove(e)}catch(e){Da=!1}return Da},_error(e){Fn.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){Na._error(e)}return null},_parse(e){try{return JSON.parse(Na._get(e))||null}catch(e){}return null},_set(t,i){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Na._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){Na._error(e)}}};Pn.DEBUG=!1,Pn.LIB_VERSION="1.429.2",Pn.LIB_NAME="web";var Ba=Pn,qa=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(K,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){const t=this._getProperty(K);return kt(i=t)&&xt(i.sessionId)&&Pt(i.size)&&t.sessionId===e?t.size:0;var i}};function Ha(e,t){return function(e){let t=0;for(let i=0;e.length>i;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(e)%100<Vt(100*t,0,100,Fn)}function Ua(e){return`$survey_response_${e}`}function Wa(e,t){if(!t)return null;const i=e[Ua(t)];return St(i)?[...i]:i}function za(e={},t,i){const s={};return t.questions.forEach(t=>{if(Et(t.originalQuestionIndex))return;const i=0===(n=t.originalQuestionIndex)?"$survey_response":`$survey_response_${n}`;var n;const r=Wa(e,t.id);Et(r)||(s[i]=r)}),at(at({$survey_questions:t.questions.map(t=>{var s,n;return{id:t.id,question:null!==(s=null==i?void 0:i[null!==(n=t.id)&&void 0!==n?n:""])&&void 0!==s?s:t.question,response:Wa(e,t.id)}})},e),s)}function ja(e={}){return Object.values(e).some(e=>!Rt(e))}function Va(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Ga(e){return"string"==typeof e&&e.trim()?e.trim():null}function Qa(e){return e.toLowerCase()}function Ka(e,t,i){if(!e||!t)return null;const s=Qa(t),n=Object.keys(e).find(e=>Qa(e)===s);if(n)return null==i||i.debug(`Found exact translation match: ${n}`),n;if(s.includes("-")){const n=s.split("-")[0],r=Object.keys(e).find(e=>Qa(e)===n);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${t})`),r}return null}const Za=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Ya(e,t,i){var s;const n=Ka(e.translations,t,i),r=at({},e);let o=!1;if(n){var a;const t=null===(a=e.translations)||void 0===a?void 0:a[n];if(t)if(null==i||i.info(`Applying survey-level translation for language: ${n}`),Et(t.name)||(r.name=t.name,o=!0),r.appearance){const e=at({},r.appearance);for(const i of Za){const s=t[i];Et(s)||(e[i]=s,o=!0)}r.appearance=e}else(function(e){return Za.some(t=>!Et(e[t]))})(t)&&(o=!0)}const l=e.questions.map(e=>function(e,t,i){var s;const n=Ka(e.translations,t,i);if(!n)return{question:e,matchedKey:null,hasChanges:!1};const r=null===(s=e.translations)||void 0===s?void 0:s[n];if(!r)return{question:e,matchedKey:null,hasChanges:!1};const o=at({},e);let a=!1;return Et(r.question)||(o.question=r.question,a=!0),Et(r.description)||(o.description=r.description,a=!0),Et(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Et(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Et(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Et(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(e){return St(e.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:e,matchedKey:a?n:null,hasChanges:a}}(e,t,i)),c=l.map(e=>e.question),u=l.some(e=>e.hasChanges);let d=null;return n||(d=(null===(s=l.find(e=>e.matchedKey))||void 0===s?void 0:s.matchedKey)||null),u&&(r.questions=c,o=!0,null==i||i.info(`Applied question-level translations for language: ${t}`)),{survey:r,matchedKey:o?n||d:null}}function Ja(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}function Xa(e){var t;return Ja(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}const el=(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}},tl=e=>e.toLowerCase(),il={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=>el(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!el(t,e))),icontains:(e,t)=>t.map(tl).some(t=>e.map(tl).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(tl).every(t=>e.map(tl).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function sl(e,t){return!e||Object.entries(e).every(([e,i])=>{const s=null==t?void 0:t[e];if(null==s)return!1;const n=il[i.operator];return!!n&&n(i.values,[String(s)])})}function nl(e,t,i){return Gn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const rl=new Set(["is_not","not_icontains","not_regex"]);function ol(e,t,i){return!e||0===e.length||e.every(e=>{const s="person"===e.type?i:t,n=null==s?void 0:s[e.key],r=e.operator||"exact";if(Et(n)||It(n))return rl.has(r);const o=il[r];return!!o&&!Et(e.value)&&!It(e.value)&&o(St(e.value)?e.value.map(String):[String(e.value)],St(n)?n.map(String):[String(n)])})}const al=Ln("[SessionRecording]");function ll(e,t){return t?e:"!"+e}function cl(e,t){return e===t||e!=="!"+t&&null}var ul=class{constructor(e,t,i,s,n,r,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=i,this._linkedFlagMatching=s,this._reportStarted=n,this._tryTakeFullSnapshot=r,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=Co}onRemoteConfig(e){this._sampleRate=Pt(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new go([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=ko):(this._triggerStatusMatcher=new fo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Co),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){const t=this._instance.get_property("$session_recording_remote_config"),i=null==t?void 0:t.minimumDurationMilliseconds;return Pt(i)?i:null}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(t,i,s,e)}setupEventTriggerListeners(e,t,i){if(0!==this._eventTriggerMatching._eventTriggers.length&&Rt(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,i,t)}catch(e){al.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t;const i=this._sampleRate;var s,n;if(!Pt(i))return null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_is_sampled"),void(null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"));const r=this._instance.get_property(H),o=this._instance.get_property(A),a=cl(r,e),l=Pt(o)&&o!==i,c=Et(o)&&r===e,u=l||c||!Ft(a),d=u?Ha(e,i):a;u&&(d?this._reportStarted("sampled"):al.warn(`Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`)),null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:ll(e,d),$replay_sample_rate:It(o)&&r===e?null:i})}ensureSamplingDecision(e){if(!Pt(this._sampleRate))return;const t=this._instance.get_property(H);Ft(cl(t,e))||this.makeSamplingDecisions(e)}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,i,s,n;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_event_trigger_activated_session"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_past_minimum_duration")}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null===(t=this._triggerStatusMatcher)||void 0===t?void 0:t.triggerStatus(e))===lo}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(({status:e})=>e===lo).map(({label:e})=>e)}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},dl=class{constructor(e,t,i,s,n){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=i,this._tryAddCustomEvent=s,this._onTriggerActivated=n,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",[He]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):al.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return oo;if(!e.receivedFlags)return so;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return no;const t=e.triggerGroupMatchers,i=e.triggerGroupSamplingResults;if(0===t.length)return eo;let s=!1,n=!1;for(const r of t){const t=r.triggerStatus(e.sessionId);if("trigger_activated"===t){const e=r.group.id,t=i.get(e);Et(t)?Fn.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:e}):!0===t&&(n=!0)}else"trigger_pending"===t&&(s=!0)}return n?to:s?so:eo}({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){let t=null;for(const i of this._triggerGroupMatchers)if("trigger_activated"===i.triggerStatus(e)){const e=i.group.minDurationMs;Pt(e)&&(It(t)||t>e)&&(t=e)}return t}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlBlocklist(t,i);for(const s of this._triggerGroupMatchers)s.checkUrlTriggerConditions(t,i,t=>{this._checkGroupLevelProperties(s,void 0)&&(s.activateTrigger(t,e),this.updateActiveTriggers(e),this._onTriggerActivated(t))},e)}setupEventTriggerListeners(e,t,i){return this._removeEventTriggerCaptureHook=e(e=>{var i;if(this._hasCompletedInitialFlush)return al.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{for(const i of this._triggerGroupMatchers)i.checkEventTriggerConditions(e.event,s=>{if(!this._checkGroupLevelProperties(i,e.properties))return;const n=(i.group.conditions.events||[]).filter(t=>t.name===e.event),r=this._instance.get_property(re);n.some(t=>!t.properties||0===t.properties.length||ol(t.properties,e.properties,r))&&(i.activateTrigger(s,t),this.updateActiveTriggers(t),this._onTriggerActivated(s))},t)}catch(e){al.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(const i of this._triggerGroupMatchers){var t;const s=i.group,n=s.id,r=s.sampleRate,o=G+n,a=this._instance.get_property(o);let l=null,c=!1,u=!1,d=!1;if(kt(a)){const t=a.sessionId,i=a.sampleRate,s=a.sampled;c="string"==typeof t&&t!==e,u=Pt(i)&&i!==r,l=t===e&&Pt(i)&&i===r&&Ft(s)?s:null}else l=a===e||null,c="string"==typeof a&&a!==e,d=a===e;const h=c||u||d||!Ft(l),p=h?Ha(e+n,r):l;h&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:s.name,sampleRate:r,isSampled:p}),this._triggerGroupSamplingResults.set(n,p),null===(t=this._instance.persistence)||void 0===t||t.register({[o]:{sessionId:e,sampleRate:r,sampled:p}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,i;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const e of this._triggerGroupMatchers){var s,n,r;const t=e.group.id;null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_event_trigger_"+t),null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_url_trigger_"+t),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+t)}}updateActiveTriggers(e){const t=[];for(const i of this._triggerGroupMatchers){const s=i.group,n=s.id,r="trigger_activated"===i.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);r&&t.push({id:n,name:s.name,matched:!0,sampled:o})}this._instance.register_for_session({[Ne]:t})}hasPendingTriggers(e){for(const 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)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){const i=e.group.conditions.properties;return!i||0===i.length||ol(i,t,this._instance.get_property(re))}_setupTriggerGroups(e){this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();for(const t of e){const e=new wo(this._instance,t,(e,i)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:i,group_id:t.id,group_name:t.name}),this._onTriggerActivated()});this._triggerGroupMatchers.push(e)}}};const hl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],pl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...hl],_l="<masked>",gl=["li_fat_id"];function fl(e,t,i){if(!s)return{};const n=t?[...hl,...i||[]]:[],r=vl(Yn(s.URL,n,_l),e),o=function(){const e={};return On(gl,function(t){const i=da(t);e[t]=i||null}),e}();return $n(o,r)}function vl(e,t){const i=pl.concat(t||[]),s={};return On(i,function(t){const i=Zn(e,t);s[t]=i||null}),s}function ml(e){const 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),i="yahoo"!=t?"q":"p",n={};if(!It(t)){n.$search_engine=t;const e=s?Zn(s.referrer,i):"";e.length&&(n.ph_keyword=e)}return n}function yl(){return navigator.language||navigator.userLanguage}function bl(){const e=yl();return"string"==typeof e?e.split("-")[0]:void 0}const Sl="$direct";function wl(){return(null==s?void 0:s.referrer)||Sl}function kl(e,t,i=!1){const s=e?[...hl,...t||[]]:[],r=i?ss(null==n?void 0:n.href):null==n?void 0:n.href,o=null==r?void 0:r.substring(0,1e3);return{r:wl().substring(0,1e3),u:o?Yn(o,s,_l):void 0}}function Cl(e,t=!1){var i;const{r:s,u:n}=e,r=t?ss(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Sl?Sl:null===(i=Qn(s))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const e=Qn(r);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname;const t=vl(r);$n(o,t)}if(s){const e=ml(s);$n(o,e)}return o}function El(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function xl(){try{return(new Date).getTimezoneOffset()}catch(e){return}}const Tl=1e5,Il=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Rl=[],Pl=()=>!1,Ml="@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(" "),Fl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Ll="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(" "),Al="Accommodation AdministrativeArea Country Place State".split(" "),Ol={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:Fl,publisher:Ll},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Rl},Offer:{seller:Ll},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:Ll,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Ll,areaServed:Al,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Rl}},$l=[["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(" "),Ol.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Ol.Event],[Ll,Ol.Organization],[Al,Ol.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Ol.Product]];function Dl(e,t){return yt.call(e,t)?e[t]:void 0}function Nl(e){const t=typeof e;return It(e)||"string"===t||"number"===t||"boolean"===t}function Bl(e,t){return t&&function(e){return xt(e)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(e.trim())}(e)?t(e.trim())||void 0:e}function ql(e,t){return St(e)&&e.every(Nl)?e.map(e=>Bl(e,t)).filter(e=>!Et(e)):Nl(e)?Bl(e,t):void 0}function Hl(e,t){if("string"!=typeof e)return;const i=e.trim(),s=i.indexOf("#"),n=0>s?i:i.slice(s+1);if(!(!n||0>s&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return t(n)?n:void 0}catch(e){return}}function Ul(e){if(yt.call(Ol,e))return Ol[e];for(const[t,i]of $l)if(t.includes(e))return i}function Wl(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}function zl(e,t,i,s){if(St(e)){const n=e.map(e=>zl(e,t,i,s)).filter(e=>!Et(e));return n.length?n:void 0}return jl(e,t,i,s)||void 0}function jl(e,t,i,s){if(!kt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(i))return null;const n=Dl(e,"@type"),r=function(e){const t=new Set,i="string"==typeof e?[e]:St(e)?e:[],s=[];for(const e of i){if("string"!=typeof e)continue;const i=e.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Il.test(i)&&!t.has(i)&&(t.add(i),s.push(i),20===s.length))break}return s}(n),o=r.filter(e=>!!Ul(e)&&(!s||!s.length||s.includes(e))),a={};for(const s of Ml){const o="@type"===s?r.length?"string"==typeof n?r[0]:r:void 0:"@id"===s?Hl(Dl(e,s),t):ql(Dl(e,s),i.maskUrl);Et(o)||Wl(a,s,o)}for(const s of o){const n=Ul(s);for(const s of Object.keys(n)){const r=Dl(e,s),o=n[s];if(!0===o){const e=ql(r,i.maskUrl);Et(e)||Wl(a,s,e)}else{const e=zl(r,t,i,o);Et(e)||Wl(a,s,e)}}}const l=zl(Dl(e,"@graph"),t,i);return Et(l)||Wl(a,"@graph",l),Object.keys(a).length?a:null}function Vl(e,t,i){if(!kt(e))return null;const s=Dl(e,"@context");if("string"!=typeof s||!/^https?:\/\/schema\.org\/?$/.test(s))return null;const n=jl(e,t,i);return n?at({"@context":"https://schema.org"},n):null}function Gl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.trim().toLowerCase())}function Ql(e,t,i){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!!i&&e.matches(i)}catch(e){return!1}}function Kl(e,t,i){for(let s=e;s;){if(Ql(s,t,i))return!0;const e=s.parentNode;s=s.parentElement||(e&&e.nodeType===e.DOCUMENT_FRAGMENT_NODE?e.host:null)}return!1}function Zl(e){return Gl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(Gl)}function Yl(e){return Et(e)?void 0:Math.round(e)}function Jl(e){return kt(e)?e.network_timing:e}const Xl=Ln("[SessionRecording]"),ec=[1,2,3,4,5,6,7,12],tc=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function ic(){var e;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.rrweb}function sc(){var e;return null===(e=ic())||void 0===e?void 0:e.record}function nc(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,Eo())}}function rc(e){return ca(aa(la(nc(e))),!0)}function oc(e){return ac.apply(this,arguments)}function ac(){return(ac=st(function*(e){const t=yield an(nc(e),Ba.DEBUG,{rethrow:!0});return ca(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}let lc,cc;const uc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let dc=!1;function hc(e){var t;return St(e)&&0===e.length?(lc=null!==(t=lc)&&void 0!==t?t:rc([]),lc):rc(e)}function pc(e){return _c.apply(this,arguments)}function _c(){return(_c=st(function*(e){var t;return St(e)&&0===e.length?lc||(cc=null!==(t=cc)&&void 0!==t?t:oc([]).then(e=>(lc=e,e)).catch(e=>{throw lc=void 0,cc=void 0,e}),cc):oc(e)})).apply(this,arguments)}function gc(e){return uc&&!dc&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function fc(e){return{event:e,size:To(e)}}function vc(e,t){return at(at({},e),{},{data:t,cv:"2024-10"})}function mc(e,t){return at(at({},e),{},{cv:"2024-10",data:at(at({},e.data),t)})}function yc(e){try{if(2===e.type)return fc(vc(e,rc(e.data)));if(3===e.type&&0===e.data.source)return fc(mc(e,{texts:hc(e.data.texts),attributes:hc(e.data.attributes),removes:hc(e.data.removes),adds:hc(e.data.adds)}));if(3===e.type&&8===e.data.source)return fc(mc(e,{adds:e.data.adds?rc(e.data.adds):void 0,removes:e.data.removes?rc(e.data.removes):void 0}))}catch(e){Xl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:xo(e)}}function bc(){return bc=st(function*(e){try{if(2===e.type)return fc(vc(e,yield oc(e.data)));if(3===e.type&&0===e.data.source){const[t,i,s,n]=yield Promise.all([pc(e.data.texts),pc(e.data.attributes),pc(e.data.removes),pc(e.data.adds)]);return fc(mc(e,{texts:t,attributes:i,removes:s,adds:n}))}if(3===e.type&&8===e.data.source){const[t,i]=yield Promise.all([e.data.adds?oc(e.data.adds):void 0,e.data.removes?oc(e.data.removes):void 0]);return fc(mc(e,{adds:t,removes:i}))}}catch(t){return tn(t)&&(dc=!0),Xl.error("could not compress event asynchronously - trying synchronous compression",t),yc(e)}return{event:e,size:xo(e)}}),bc.apply(this,arguments)}function Sc(e,t){return 5===e.type&&e.data.tag===t}function wc(e){return Sc(e,"sessionIdle")}function kc(e){return Sc(e,"$session_ending")}function Cc(e){return Sc(e,"$session_starting")}var Ec=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 cl(this._instance.get_property(H),this.sessionId)}get _sampleRate(){var e;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.sampleRate;return Pt(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?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,i)=>{var s,n,r,o;if(!i)return;if(e===this._sessionId&&t===this._windowId)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this._sessionId,c=this._windowId;var u;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null===(u=this._flushedSizeTracker)||void 0===u?void 0:u.currentTrackedSize(l)}),null===(s=this._instance.persistence)||void 0===s||s.unregister("$debug_first_full_snapshot_timestamp"),this._maxDepthExceeded=!1,null===(n=ic())||void 0===n||null===(r=n.resetMaxDepthState)||void 0===r||r.call(n),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){const t=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(t)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp}),null===(o=this._strategy)||void 0===o||o.makeSamplingDecisions(e)},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[U])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;const i=null===(e=this._buffer.data[0])||void 0===e?void 0:e.timestamp,s=null===(t=this._buffer.data[this._buffer.data.length-1])||void 0===t?void 0:t.timestamp;return Pt(i)&&Pt(s)?s-i:null},this._isBelowMinimumDuration=()=>{var e,t;const i=this._minimumDuration;if(!Pt(i))return!1;if(null===(e=null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.strictMinimumDuration)||void 0===e||!e){const e=this._sessionDuration;return Pt(e)&&e>=0&&i>e}if(this._hasPassedMinimumDuration())return!1;const s=this._getBufferDuration();return!!It(s)||i>s||(null===(n=this._instance.persistence)||void 0===n||n.register({$session_past_minimum_duration:this._sessionId}),!1);var n},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==s?void 0:s.visibilityState)&&("visible"===s.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+s.visibilityState,{}))},this._documentWasEverVisible=null==t||t;const{sessionId:i,windowId:n,sessionStartTimestamp:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=i,this._windowId=n,this._sessionStartTimestamp=r,this._linkedFlagMatching=new bo(this._instance),this._urlTriggerMatching=new yo(this._instance),this._eventTriggerMatching=new So(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||Xl.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 qa(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,i,s,n,r,o,a,l;const c=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking,u={maskAllInputs:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.blockSelector,maskAllElementAttributes:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.maskAllElementAttributes},d=null!==(r=null==u?void 0:u.maskAllInputs)&&void 0!==r?r:null==c?void 0:c.maskAllInputs,h=null!==(o=null==u?void 0:u.maskTextSelector)&&void 0!==o?o:null==c?void 0:c.maskTextSelector,p=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==c?void 0:c.blockSelector,_=null!==(l=null==u?void 0:u.maskAllElementAttributes)&&void 0!==l?l:null==c?void 0:c.maskAllElementAttributes;return Et(d)&&Et(h)&&Et(p)&&Et(_)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(this._hasWarnedClientMaskingOverride)return;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking;if(Rt(t))return;const i=this._instance.config.session_recording,s=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{const s=null==i?void 0:i[e],n=t[e];return!Et(s)&&s!==n});0!==s.length&&(this._hasWarnedClientMaskingOverride=!0,Xl.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: '+s.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:t}))}get _canvasResolutionScale(){var e;return Vt(null===(e=this._instance.config.session_recording.canvasCapture)||void 0===e?void 0:e.resolutionScale,.1,1,Ln("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,i,s,n,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(e=this._remoteConfig)||void 0===e?void 0:e.canvasRecording,c=null!==(t=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==t&&t,u=null!==(s=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==s?s:4;let d=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof d){const e=parseFloat(d);d=isNaN(e)?.4:e}return{enabled:c,fps:Vt(u,0,12,Ln("canvas recording fps"),4),quality:Vt(d,0,1,Ln("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e;const t=!!(null===(e=this._remoteConfig)||void 0===e?void 0:e.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get _networkPayloadCapture(){var e,t,i;const s=null===(e=this._remoteConfig)||void 0===e?void 0:e.networkPayloadCapture,n={recordHeaders:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==n?void 0:n.recordHeaders)||(null==s?void 0:s.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==s?void 0:s.recordBody),a=Jl(this._instance.config.capture_performance),l=Jl(null==s?void 0:s.capturePerformance),c=!!(Ft(a)?a:l);return r||o||c?{recordHeaders:r,recordBody:o,recordPerformance:c}:void 0}_gatherRRWebPlugins(){var e,t;const i=[],s=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordConsolePlugin;s&&this._isConsoleLogCaptureEnabled&&i.push(s());const r=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&wt(r))if(!Vn.includes(n.hostname)||this._forceAllowLocalhostNetworkCapture){const e=wt(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((e,t,i)=>{const s={payloadSizeLimitBytes:jr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...jr.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...jr.payloadHostDenyList]},n=!1!==e.session_recording.recordHeaders&&t.recordHeaders,r=!1!==e.session_recording.recordBody&&t.recordBody,o=!1!==e.capture_performance&&t.recordPerformance,a=(e=>{const t=zr(e);return e=>((null==e?void 0:e.requestBody)&&(e.requestBody=Yr(e.requestBody,e.requestHeaders,t,"Request")),(null==e?void 0:e.responseBody)&&(e.responseBody=Yr(e.responseBody,e.responseHeaders,t,"Response")),e)})(s),l=t=>{return a(((e,t,i)=>{var s;if(null==i?void 0:i(e.name))return;const n=Qn(e.name);let r=0===t.indexOf("http")?null===(s=Qn(t))||void 0===s?void 0:s.pathname:t;"/"===r&&(r="");const o=null==n?void 0:n.pathname.replace(r||"","");return n&&o&&Zr.some(e=>0===o.indexOf(e))?void 0:e})((Kr((s=t).requestHeaders),Kr(s.responseHeaders),s),e.api_host,i));var s},c=wt(e.session_recording.maskNetworkRequestFn);return c&&wt(e.session_recording.maskCapturedNetworkRequestFn)&&Fn.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const i=e.session_recording.maskNetworkRequestFn({url:t.name});return!i&&t.isInitial?i:at(at({},t),{},{name:null==i?void 0:i.url})}),s.maskRequestFn=wt(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,s;const n=l(t);if(!n)return;const r=n.isInitial?{name:"",entryType:n.entryType,startTime:n.startTime,duration:n.duration,endTime:n.endTime,timeOrigin:n.timeOrigin,timestamp:n.timestamp,isInitial:!0}:void 0,o=null===(i=(s=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(s,n);return Rt(o)&&r?(Xr.add(r),r):null!=o?o:void 0}:e=>function(e){if(!Et(e))return e.requestBody=Jr(e.requestBody,"Request"),e.responseBody=Jr(e.responseBody,"Response"),e}(l(e)),at(at(at({},jr),s),{},{recordHeaders:n,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,e)))}else Xl.info("NetworkCapture not started because we are on localhost.");return i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?ss(e):e}_maskReplayUrl(e,t=!1){const i=t?ss(e):this._stripUrlHash(e),s=this._instance.config.mask_personal_data_properties?[...hl,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(Yn(i,s,_l))}_maskUrl(e){const t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var i;const s=t.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==s?void 0:s.name)&&void 0!==i?i:null==s?void 0:s.url}if(t.maskNetworkRequestFn){const i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return 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}):Xl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(tc(()=>sc().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{const t=sc();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e=!1){Promise.resolve().then(()=>{var t;return null===(t=this._jsonLdCapture)||void 0===t?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;const t=new URL(e.location.href),i=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==i&&(this._lastHref=i,this._tryAddCustomEvent("$url_changed",{href:i}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){const e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(tc(()=>sc().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,i;if((null===(e=this._strategy)||void 0===e?void 0:e.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var s;const e=null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.trigger_pending_buffer_interval_millis;return Pt(e)&&Number.isFinite(e)&&e>=1e3&&36e5>=e?e:6e4}return null!==(t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0===this._isIdle)return;const 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)||void 0===e||e.scan(),clearInterval(this._fullSnapshotTimer),Xl.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null===(e=this._jsonLdCapture)||void 0===e||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Xl.info("recording resumed"))}_activateTrigger(e,t){var i;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&(null===(i=this._strategy)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this._isActivatingTrigger=!0;try{var s,n;const i="url"===e?W:z;null===(s=this._instance.persistence)||void 0===s||s.register({[i]:this.sessionId}),null===(n=this._strategy)||void 0===n||n.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(){const e=this._instance.get_property(F);if(!e)return;let t;try{t=kt(e)?e:JSON.parse(e)}catch(e){return void Xl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var i;const n=null!==(i=t.cache_timestamp)&&void 0!==i?i:Date.now();var s;if(Date.now()-n>36e5)return Xl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e}),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_recording_remote_config"))}return t}_checkOverride(e,t,i){this._instance.get_property(e)&&(t(),i())}start(t){var i,n;const r=this._remoteConfig;if(!r)return void Xl.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const e=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(e?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=e,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=o,this._windowId=a,this._sessionStartTimestamp=l,this._restorePendingBuffer(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this._endpoint=null==r?void 0:r.endpoint),this._strategy=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new dl(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new ul(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(r),null===(n=this._removeEventTriggerCaptureHook)||void 0===n||n.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(O,()=>{this.overrideSampling()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(O)}),this._checkOverride(D,()=>{this.overrideLinkedFlag()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(D)}),this._checkOverride(B,()=>{this.overrideTrigger("event")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(B)}),this._checkOverride(N,()=>{this.overrideTrigger("url")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(N)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(zn(e,"beforeunload",this._onBeforeUnload),zn(e,"pagehide",this._onPageHide),zn(e,"offline",this._onOffline),zn(e,"online",this._onOnline),zn(s,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&wt(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&wt(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,i)=>{var s;null===(s=this._forceIdleSessionIdListener)||void 0===s||s.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,i)})}):wt(this._sessionManager.on)||Xl.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Rt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){const t=(null==e?void 0:e.properties.$current_url)?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){Xl.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(t||"recording_initialized"))}_teardown(){var t,i,n,r,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(r=this._onSessionIdleResetForcedListener)||void 0===r||r.call(this),this._onSessionIdleResetForcedListener=void 0,null===(o=this._forceIdleSessionIdListener)||void 0===o||o.call(this),this._forceIdleSessionIdListener=void 0,null===(a=this._strategy)||void 0===a||a.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)||void 0===e||e.stop(),this._queuedRRWebEvents=[],null===(t=this._jsonLdCapture)||void 0===t||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var i;null===(i=this._stopRrweb)||void 0===i||i.call(this)}catch(e){Xl.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;const 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(),Xl.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),Xl.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),Xl.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,i;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null===(t=ic())||void 0===t||null===(i=t.resetSnapshotCostState)||void 0===i||i.call(t),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,{preserveLogDedup:t=!1}={}){if(this._holdFlushUntilInteraction=!Et(e),this._flushHoldReason=e,Et(e))return void(t||(this._lastLoggedFlushHold=void 0));if(this._isRestartingForSessionIdChange)return;const i=`${this.sessionId}:${e}`;i!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=i,Xl.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({discardProducerEvents:e=!1}={}){this._holdFlushUntilInteraction=!0,e&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),Xl.info("discarded")}_captureProcessedEvent(e,t,i,s,n){const r={$snapshot_bytes:i,$snapshot_data:t,$session_id:s,$window_id:n};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,s),this._captureSnapshotBuffered(r)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,Xl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t;const i=null===(e=ic())||void 0===e||null===(t=e.getLastSnapshotCost)||void 0===t?void 0:t.call(e);i&&i!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=i,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=i.durationMs||(this._slowestFullSnapshot=i),500>i.durationMs||Xl.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(Et(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,Xl.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,i){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,i,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{let t=e.event,i=xo(e.event);if(e.compressionEnabled)try{({event:t,size:i}=yc(e.event))}catch(e){Xl.error("could not process queued compression event - will use uncompressed event",e)}try{this._captureQueuedCompressionEvent(e,t,i)}catch(e){Xl.error("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{this._processQueuedCompressionEventSync(e)})}_enqueueCompression(e,t,i,s){var n=this;const r={event:e,compressionEnabled:t,targetSessionId:i,targetWindowId:s,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(r),this._queuedCompressionEvents+=1;const o=(a=st(function*(){try{if(r.processed)return;let i,s;try{const n=t?gc(e)?yield function(e){return bc.apply(this,arguments)}(e):yc(e):{event:e,size:xo(e)};i=n.event,s=n.size}catch(t){Xl.error("could not process queued compression event - will use uncompressed event",t),i=e,s=xo(e)}n._captureQueuedCompressionEvent(r,i,s)}finally{n._finishQueuedCompressionEvent(r)}}),function(){return a.apply(this,arguments)});var a;this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(t){var i,s,n,r,o,a,l,c,u,d,h,p,_;if(!this._instance.sessionManager)return;if(this._processQueuedEvents(),!t||!kt(t))return;if(4===t.type){const e=this._maskReplayUrl(t.data.href);if(this._lastHref=e,!e)return;t.data.href=e}else this._pageViewFallBack();if(null===(i=this._strategy)||void 0===i||i.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}(t))return;2===t.type&&((null===(d=ic())||void 0===d||null===(h=d.wasMaxDepthReached)||void 0===h?void 0:h.call(d))&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null===(p=this._mutationThrottler)||void 0===p||p.reset(),null===(_=this._instance.persistence)||void 0===_||_.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const g=2===t.type&&(null===(s=this._strategy)||void 0===s?void 0:s.hasPendingTriggers(this.sessionId));g&&this._clearBufferBeforeMostRecentMeta();const f=this._mutationThrottler?this._mutationThrottler.throttleMutations(t):t;if(!f)return void(!0===this._isIdle&&this._eventsDroppedWhileIdle++);const v=function(e){const t=e;if(t&&kt(t)&&6===t.type&&kt(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]"));const i=[];for(let e=0;t.data.payload.payload.length>e;e++)i.push(t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?t.data.payload.payload[e].slice(0,2e3)+"...[truncated]":t.data.payload.payload[e]);return t.data.payload.payload=i,e}return e}(f),m=function(e){return kc(e)?e.data.payload:null}(v),y=function(e){return Cc(e)?e.data.payload:null}(v),b=function(e){return wc(e)?e.data.payload:null}(v);m||y?(null==m?void 0:m.lastActivityTimestamp)&&(v.timestamp=m.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this._updateWindowAndSessionIds(v),2===t.type&&(this._fullSnapshotTimestamps.push([this._sessionId,t.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));const S=null!==(n=null!==(r=null!==(o=null==m?void 0:m.currentSessionId)&&void 0!==o?o:null==y?void 0:y.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==n?n:this._sessionId,w=null!==(a=null!==(l=null!==(c=null==m?void 0:m.currentWindowId)&&void 0!==c?c:null==y?void 0:y.nextWindowId)&&void 0!==l?l:null==b?void 0:b.windowId)&&void 0!==a?a:this._windowId;if(!0===this._isIdle&&!function(e){return wc(e)||kc(e)||Cc(e)}(v))return void(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source}(v)&&this._eventsDroppedWhileIdle++);2===v.type&&(this._eventsDroppedWhileIdle=0),b&&(v.timestamp=b.lastActivityTimestamp+b.threshold);const k=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,g?this._scheduleJsonLdScan(!0):k||this._scheduleJsonLdScan();const C=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===v.type&&"$json_ld"===v.data.tag){let t;try{t=e?this._maskReplayUrl(e.location.href):void 0}catch(e){}v.data.href=t}if(this._queuedCompressionEvents>0||C&&gc(v))return void this._enqueueCompression(v,C,S,w);const{event:E,size:x}=C?yc(v):{event:v,size:xo(v)};this._captureProcessedEvent(v,E,x,S,w)}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}):eo}log(e,t="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.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)||void 0===e||e.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t;const i=null==e||null===(t=e.location)||void 0===t?void 0:t.href;if(!i)return;const s=this._maskReplayUrl(i);if(!s)return;return new URL(s).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)&&!kc(e)&&!Cc(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Be]:[]}),void(this._lastLoggedBufferingReason=void 0);const t=this._describePendingTriggerConditions();if(0===t.length)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Be]:[]}),void(this._lastLoggedBufferingReason=void 0);const i=t.join(", "),s=`${this.sessionId}:${i}`;s!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=s,this._instance.register_for_session({[Be]:t}),Xl.info(`buffering: ${i}`))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null===(e=this._instance.persistence)||void 0===e?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())return;this._pendingBufferRestored=!0;const e=Na._parse(this._pendingBufferStorageKey);Na._remove(this._pendingBufferStorageKey),kt(e)&&St(e.data)&&0!==e.data.length&&St(e.sizes)&&e.sizes.length===e.data.length&&Pt(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}_flushBuffer(e=!1){var t;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);const i=this._buffer;null===(t=this._strategy)||void 0===t||t.ensureSamplingDecision(this.sessionId);const s=this._isBelowMinimumDuration(),n=this.status;if(this._maybeLogBufferingReason(n),"buffering"===n||"paused"===n||"disabled"===n||s)return!e||"active"!==n&&"sampled"!==n||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==i)return this._buffer;if(i.data.length>0){var r;const e=this._currentMaskedHostname();Io(i).forEach(t=>{try{var i;null===(i=this._flushedSizeTracker)||void 0===i||i.trackSize(t.sessionId,t.size),this._captureSnapshot({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Ba.LIB_NAME,$lib_version:Ba.LIB_VERSION,$snapshot_host:e})}catch(e){Xl.warn("could not capture snapshot chunk - skipping it",e)}}),Et(this._lastParkedBufferSize)||(Na._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null===(r=this._strategy)||void 0===r||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t;const i=2+((null===(t=this._buffer)||void 0===t?void 0:t.data.length)||0),s=e.$session_id,n=this._buffer.sessionId!==s;if(n||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+i>943718.4){const t=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==t)return;n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=s,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+i>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;const i=null===(e=this._buffer)||void 0===e?void 0:e.data[(null===(t=this._buffer)||void 0===t?void 0:t.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();let e=-1;for(let 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({[je]:e}),Xl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",at({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==ec.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const 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());const{windowId:i,sessionId:s}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp);let n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){const t="unknown"===this._isIdle;this._isIdle=!1,t||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}const r=this._sessionId!==s,o=this._windowId!==i;if(this._windowId=i,this._sessionId=s,r||o){const e=r&&!1!==this._isIdle;e&&(this._isIdle="unknown"),this._restartForSessionIdChange(e)}else if(t&&this._releaseHoldAndFlush(),n){var a;const e=["sampled","active"].includes(this.status)||(null===(a=this._strategy)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&e&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null===(e=this._strategy)||void 0===e||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,i,s,n,r,o,a,l,c,u,d;const h=null===(e=ic())||void 0===e||null===(t=e.getDeferredStylesheetStats)||void 0===t?void 0:t.call(e);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===(i=this._flushedSizeTracker)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:Yl(null===(s=this._slowestFullSnapshot)||void 0===s?void 0:s.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Yl(null===(n=this._slowestFullSnapshot)||void 0===n?void 0:n.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this._slowestFullSnapshot)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this._slowestFullSnapshot)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this._slowestFullSnapshot)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==h?void 0:h.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==h?void 0:h.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==h?void 0:h.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Yl(null==h?void 0:h.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Yl(null==h?void 0:h.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Yl(null===(l=ic())||void 0===l||null===(c=l.getMutationCost)||void 0===c||null===(c=c.call(l))||void 0===c?void 0:c.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(u=ic())||void 0===u||null===(d=u.getDiscardedDurationSamples)||void 0===d?void 0:d.call(u),$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,[We]:!!this._stopRrweb,[ze]:this._rrwebStartAttempted}}_startRecorder(){var t;if(this._stopRrweb)return;this._rrwebStartAttempted=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},n=this._instance.config.session_recording;for(const[e,t]of Object.entries(n||{}))if(e in i)if("maskInputOptions"===e)i.maskInputOptions=at({password:!0},t);else if("sampling"===e){const e=null!=t?t:{},s={};Et(e.mousemove)||(s.mousemove=e.mousemove),Et(e.mouseInteraction)||(s.mouseInteraction=e.mouseInteraction),i.sampling=s}else i[e]=t;var r,o,a,l;!0===(null==n?void 0:n.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=at(at({},i.slimDOMOptions),{},{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling=at(at({},i.sampling),{},{canvas:this._canvasRecording.fps}),i.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},i.canvasResolutionScale=this._canvasResolutionScale,i.canvasMasking={configured:()=>{var e;return wt(null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn)},regionsFn:e=>{var t;const i=null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn;if(wt(i))try{var s;return null!==(s=i(e))&&void 0!==s?s:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,Xl.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(i.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this._masking.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this._masking.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this._masking.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,Xl.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();const c=sc();if(!c)return void Xl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new ua(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{const i=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;Xl.info(i,{node:t}),this.log("[SessionRecording] "+i,"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()});const u=this._gatherRRWebPlugins();if(this._stopRrweb=c(at({emit:e=>{this.onRRwebEmit(e)},plugins:u,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,Xl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},i)),!this._stopRrweb)return this._rrwebError=!0,void Xl.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==n?void 0:n.captureJsonLd)&&s&&(null==e?void 0:e.MutationObserver)&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,i){const s=new WeakMap,n=i.getCaptureState||(()=>!0);let r=Tl;const o=function(e,t){const i=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Pl:i=>{const s=e.getElementById(i);return!!s&&"SCRIPT"!==s.nodeName&&(!t.isRecordedElement||t.isRecordedElement(s))&&!Kl(s,t.blockClass,t.blockSelector)}}(e,i),a=t=>{try{const a=n();if(!r||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return Kl(e,t.blockClass,t.blockSelector)||Kl(e,t.maskTextClass,t.maskTextSelector)}(t,i))return;const l=function(e,t=Pl,i){if(!e||e.length>Tl)return null;try{const s=JSON.parse(e),n={maskUrl:i,remainingNodes:2048,exceeded:!1},r=St(s)?s.map(e=>Vl(e,t,n)):Vl(s,t,n);if(n.exceeded||It(r)||St(r)&&(!r.length||r.some(It)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(e){return null}}(t.text,o,i.maskUrl);if(!l)return void s.delete(t);const[c,u]=l;if(It(a))return void s.set(t,u);if(s.get(t)!==u){if(u.length>r)return void(r=0);i.emit(c)&&(s.set(t,u),r-=u.length)}}catch(e){return}};try{const i=new t(e=>{try{if(!r||!1===n())return;const t=e=>{for(const t of Zl(e))a(t)};for(const i of e)if("childList"===i.type)Gl(i.target)&&a(i.target),i.addedNodes.forEach(t);else if("characterData"===i.type){const e=i.target.parentNode;e&&Gl(e)&&a(e)}else"attributes"===i.type&&Gl(i.target)&&a(i.target)}catch(e){return}});return i.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t=!1){r&&!1!==n()&&Zl(e.documentElement).forEach(e=>{t&&s.delete(e),a(e)})},stop(){return i.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(s,e.MutationObserver,{maskUrl:e=>this._maskReplayUrl(e),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:e=>c.mirror.getId(e)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null===(e=this._instance.config.session_recording)||void 0===e?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=Ft(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:u.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}};const xc=["type"];var Tc=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}({}),Ic=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}({}),Rc=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}({}),Pc=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),Mc=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),Fc=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}({}),Lc=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 Ac(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 Oc={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},$c={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Dc={};function Nc(e){if(Dc[e])return Dc[e];const t=function(e){var t,i;const s=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(i=t.__symbol__)||void 0===i?void 0:i.call(t,e);return s&&globalThis[s]?globalThis[s]:void 0}(e)||globalThis[e],i=t.prototype,s=e in Oc?Oc[e]:void 0,n=Boolean(s&&s.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(i,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),r=e in $c?$c[e]:void 0,o=Boolean(r&&r.every(e=>{var t;return"function"==typeof i[e]&&(null===(t=i[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(n&&o)return Dc[e]=t.prototype,t.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const s=a.contentWindow;if(!s)return t.prototype;const n=s[e].prototype;return n?(function(e){return Ac(e,"AppleWebKit")&&!Ac(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Dc[e]=n):i}catch(e){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Bc=Object.create(null);function qc(e,t,i){var s;const n=Bc[e],r=n[i];if(r)return r.call(t);const o=Nc(e),a=null===(s=Object.getOwnPropertyDescriptor(o,i))||void 0===s?void 0:s.get;return a?(n[i]=a,a.call(t)):t[i]}Bc.Node=Object.create(null),Bc.ShadowRoot=Object.create(null),Bc.MutationObserver=Object.create(null),Bc.Element=Object.create(null);var Hc,Uc={};function Wc(e,t,i){const s=`${e}.${String(i)}`;if(Uc[s])return Uc[s].bind(t);const n=Nc(e)[i];return"function"!=typeof n?t[i]:(Uc[s]=n,n.bind(t))}function zc(){return Nc("MutationObserver").constructor}function jc(e,t,i){try{if(!(t in e))return()=>{};const s=e[t],n={next:s},r=i(function(...e){return n.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=n.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let s=e[t],o=i(s);for(;o;){if(o.next===r)return void(o.next=n.next);s=o.next,o=i(s)}}}catch(e){return()=>{}}}var Vc={childNodes:e=>qc("Node",e,"childNodes"),parentNode:e=>qc("Node",e,"parentNode"),parentElement:e=>qc("Node",e,"parentElement"),textContent:e=>qc("Node",e,"textContent"),isConnected(e){if(void 0===Hc){var t;const e=null===(t=Object.getOwnPropertyDescriptor(Nc("Node"),"isConnected"))||void 0===t?void 0:t.get;Hc=(null==e?void 0:e.toString().includes("[native code]"))?e:null}return null==Hc?void 0:Hc.call(e)},contains:(e,t)=>Wc("Node",e,"contains")(t),getRootNode:e=>Wc("Node",e,"getRootNode")(),host:e=>e&&"host"in e?qc("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?qc("Element",e,"shadowRoot"):null,querySelector:(e,t)=>Wc("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>Wc("Element",e,"querySelectorAll")(t),mutationObserver:zc,patch:jc};function Gc(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var Qc=0;function Kc(){Qc+=1}function Zc(){return Qc}function Yc(e,t){return(t!==Qc||e>6e4)&&!0}var Jc=0,Xc=0,eu=0,tu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},iu=null,su=null,nu=[],ru=0,ou=0,au={slowestBatchMs:0},lu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function cu(e){(Jc+=1)>1||(tu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},nu=[],ru=0,su=(e=>e&&e>0?e:null)(e),Xc=Gc(),eu=Qc)}function uu(){return 0===Jc?iu||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Jc-=1)>0?tu:(tu.durationMs=Gc()-Xc,tu.deferredStylesheetCount=ru,lu.deferredCount+=ru,su=null,Yc(tu.durationMs,eu)?tu:iu=tu)}function du(e,t,i){let s=e.length;if(i>=32)return s;for(let n=0;e.length>n;n++){const r=e[n];try{const e=r.cssRules;if(e&&e.length)s+=du(e,t,i+1);else if(t&&r.styleSheet){const e=r.styleSheet;if(!t.has(e)){t.add(e);const n=e.rules||e.cssRules;n&&(s+=du(n,t,i+1))}}}catch(e){}}return s}function hu(e){if(0===Jc)return;const t=du(e,null,0);tu.cssRuleCount+=t,ou>0&&(tu.nonDeferrableCssRuleCount+=t)}function pu(e){ou+=1;try{return e()}finally{ou-=1}}function _u(e){Jc>0&&(tu.stylesheetMs+=e)}function gu(e){if(0===Jc||null===su)return!1;const t=tu.cssRuleCount-tu.nonDeferrableCssRuleCount;return t>=su||t+function(e){try{const t=e&&(e.rules||e.cssRules);if(!t)return 0;const i=new WeakSet;return i.add(e),du(t,i,0)}catch(e){return 0}}(e)>su}function fu(){const e=nu;return nu=[],e}function vu(){lu.failedCount+=1}function mu(e){e>0&&(lu.abandonedCount+=e)}function yu(e){return yu="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},yu(e)}function bu(e,t,i){return(t=function(e){var t=function(e){if("object"!=yu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=yu(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Su(e){return e.nodeType===e.ELEMENT_NODE}function wu(e){const t=e&&"host"in e&&"mode"in e&&Vc.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Vc.shadowRoot(t)===e)}function ku(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Cu(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 Eu(e){const{cssText:t}=e;if(3>t.split('"').length)return t;const i=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}var xu=0;function Tu(e){const t=0===xu,i=t?Gc():0;xu+=1;try{const t=e.rules||e.cssRules;if(!t)return null;hu(t);let i=e.href;return!i&&e.ownerNode&&(i=e.ownerNode.baseURI),Cu(Array.from(t,e=>Iu(e,i)).join(""))}catch(e){return null}finally{xu-=1,t&&_u(Gc()-i)}}function Iu(e,t){if(Pu(e)){let t;try{t=Tu(e.styleSheet)||Eu(e)}catch(i){t=e.cssText}try{var i;if(t&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return Vu(t,e.styleSheet.href)}catch(e){}return t}{let i=e.cssText;return Mu(e)&&e.selectorText.includes(":")&&(i=Ru(i)),t?Vu(i,t):i}}function Ru(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Pu(e){return"styleSheet"in e}function Mu(e){return"selectorText"in e}var Fu=/^-?[A-Za-z_][\w-]*$/,Lu=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Au(e){const t=[];let i=!1,s=null;const n=new Map;function r(e){const n=t.pop();if("group"===n.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void r(null)}const i=t[t.length-1];return i.parts.push(e),void(i.index+=1)}if(!n.importRule)return i=!0,void(s=e);o(t[t.length-1],n.importRule,e)}function o(e,t,i){try{let n;try{n=i||Eu(t)}catch(e){n=t.cssText}try{var s;n&&(null===(s=t.styleSheet)||void 0===s?void 0:s.href)&&(n=Vu(n,t.styleSheet.href))}catch(e){}n&&e.parts.push(n),e.index+=1}catch(e){r(null)}}function a(e){const i=e.rules[e.index];if("sheet"===e.kind&&Pu(i)){const s=n.get(i);return null===s?(e.parts.push(i.cssText),void(e.index+=1)):s?void t.push({kind:"sheet",sheet:s.sheet,rules:s.rules,sheetHref:s.sheetHref,index:0,parts:[],importRule:i}):void o(e,i,null)}if(function(e,i){try{const s=function(e){const 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(Mu(e)){if("number"==typeof t.type&&1!==t.type)return null;const i=t.style?t.style.cssText:"";return`${e.selectorText} {${i?" "+i:""}`}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!Fu.test(t.containerName)?null:`@container ${t.containerName?`${t.containerName} `:""}${t.containerQuery} {`;if("string"==typeof t.conditionText){let s="";try{var i;s=(null===(i=e.constructor)||void 0===i?void 0:i.name)||""}catch(e){return null}return""===s||"Object"===s||"CSSSupportsRule"===s?`@supports ${t.conditionText} {`:null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?Fu.test(t.name)?`@keyframes ${t.name} {`:null:""===t.name?"@layer {":Lu.test(t.name)?`@layer ${t.name} {`:null:null}(e);if(null===s)return!1;const n=i.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:n,index:0,parts:[],prelude:n?Vu(s,n):s,fixColons:"sheet"===i.kind&&Mu(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(i,e))return;let s=i.cssText;"sheet"===e.kind&&Mu(i)&&i.selectorText.includes(":")&&(s=Ru(s)),e.parts.push(e.sheetHref?Vu(s,e.sheetHref):s),e.index+=1}return function(e){try{const i=e.rules||e.cssRules;if(!i)return!1;hu(i);let s=e.href;!s&&e.ownerNode&&(s=e.ownerNode.baseURI);const r=Array.from(i);return t.push({kind:"sheet",sheet:e,rules:r,sheetHref:s,index:0,parts:[],importRule:null}),function(e,t){const i=[{sheet:t,rules:e,index:0}];for(;i.length>0;){const e=i[i.length-1];if(e.index>=e.rules.length){i.pop();continue}const t=e.rules[e.index];if(e.index+=1,!Pu(t)||n.has(t))continue;let s=null;try{s=t.styleSheet}catch(e){n.set(t,null);continue}if(s&&!i.some(e=>e.sheet===s))try{const e=s.rules||s.cssRules;if(!e)continue;hu(e);let r=s.href;!r&&s.ownerNode&&(r=s.ownerNode.baseURI);const o=Array.from(e);n.set(t,{sheet:s,rules:o,sheetHref:r}),i.push({sheet:s,rules:o,index:0})}catch(e){}}}(r,e),!0}catch(e){return!1}}(e)||(i=!0),{advance(e){if(i)return!0;const n=Gc();let o=e>0?e:1;try{for(;!i&&o>0;){const e=t[t.length-1];if(e.index>=e.rules.length){let t=null;try{if("group"===e.kind){const i=e.prelude+e.parts.join("")+"}";t=e.fixColons?Ru(i):i}else t=Cu(e.parts.join(""))}catch(e){}r(t);continue}o-=1;try{a(e)}catch(e){r(null)}}}catch(e){i=!0,s=null}finally{_u(Gc()-n)}return i},text:()=>i?s:null,remainingRules(){if(i)return 0;let e=0;for(const i of t)e+=i.rules.length-i.index;return e}}}var Ou=class{constructor(){bu(this,"idNodeMap",new Map),bu(this,"nodeMetaMap",new WeakMap)}getId(e){var t,i;return e&&null!==(t=null===(i=this.getMeta(e))||void 0===i?void 0:i.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){const t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),Su(e)){const t=Vc.shadowRoot(e);t&&this.removeNodeFromMap(t),"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){const i=this.getNode(e);if(i){const e=this.nodeMetaMap.get(i);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function $u({element:e,maskInputOptions:t,tagName:i,type:s,value:n,maskInputFn:r}){let o=n||"";const a=s&&Du(s);return(t[i.toLowerCase()]||a&&t[a])&&(o=r?r(o,e):"*".repeat(o.length)),o}function Du(e){return e.toLowerCase()}var Nu=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 Bu({element:e,name:t,value:i,maskAllElementAttributes:s,maskAttributeFn:n,isGenerated:r=!1}){return i?s?r&&Nu.has(Du(t))?i:"*".repeat(i.length):n?n(t,i,e):i:i}var qu="__rrweb_original__";function Hu(e){try{const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Du(t):null}catch(e){return null}}var Uu=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Wu=/^(?:[a-z+]+:)?\/\//i,zu=/^www\..*/i,ju=/^(data:)([^,]*),(.*)/i;function Vu(e,t){return(e||"").replace(Uu,(e,i,s,n,r,o)=>{const a=s||r||o,l=i||n||"";if(!a)return e;if(Wu.test(a)||zu.test(a))return`url(${l}${a}${l})`;if(ju.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),u=a.split("/");c.pop();for(const e of u)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}var Gu,Qu,Ku=new Map,Zu=1,Yu=new RegExp("[^a-z0-9-_:]");function Ju(){return Zu++}var Xu=/^[^ \t\n\r\u000c]+/,ed=/^[, \t\n\r\u000c]+/,td=new WeakMap;function id(e,t){return t&&""!==t.trim()?sd(e,t):t}function sd(e,t){let i=td.get(e);if(i||(i=e.createElement("a"),td.set(e,i)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return i.setAttribute("href",t),i.href}function nd(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 rd(e,t,i,s,n,r){if(!s)return s;if("src"===i||"href"===i&&("use"!==t||"#"!==s[0])){if("link"===t&&n){var o;const e=null===(o=n.sheet)||void 0===o?void 0:o.href;if(e)return e}const i=id(e,s);if(i.startsWith("data:")){if("img"===t&&n){let e=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(e=function(e,t,i,s){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;const n=Ku.get(t);if(n&&n.type===i&&n.quality===s)return n.result;try{const n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;const r=n.getContext("2d");if(!r)return t;r.drawImage(e,0,0);const o=n.toDataURL(i||"image/webp",null!=s?s:.4),a=t.length>o.length?o:t;if(Ku.size>=10){const e=Ku.keys().next().value;void 0!==e&&Ku.delete(e)}return Ku.set(t,{type:i,quality:s,result:a}),a}catch(e){return t}}(n,i,r.type,r.quality)),nd(e,r)}if("image"===t)return nd(i,r)}return i}if("xlink:href"===i&&"#"!==s[0]){const i=id(e,s);return"image"===t&&i.startsWith("data:")?nd(i,r):i}return"background"!==i||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===i?function(e,t){if(""===t.trim())return t;let i=0;function s(e){let s;const n=e.exec(t.substring(i));return n?(s=n[0],i+=s.length,s):""}const n=[];for(;s(ed),t.length>i;){let r=s(Xu);if(","===r.slice(-1))r=id(e,r.substring(0,r.length-1)),n.push(r);else{let s="";r=id(e,r);let o=!1;for(;;){const e=t.charAt(i);if(""===e){n.push((r+s).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){i+=1,n.push((r+s).trim());break}"("===e&&(o=!0)}s+=e,i+=1}}}return n.join(", ")}(e,s):"style"===i?Vu(s,sd(e)):"object"===t&&"data"===i?id(e,s):s:id(e,s)}function od(e,t,i){return("video"===e||"audio"===e)&&"autoplay"===t}function ad(e,t,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&ad(Vc.parentNode(e),t,i);for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!i&&ad(Vc.parentNode(e),t,i)}function ld(e,t,i,s){let n;if(Su(e)){if(n=e,!Vc.childNodes(n).length)return!1}else{if(null===Vc.parentElement(e))return!1;n=Vc.parentElement(e)}try{if("string"==typeof t){if(s){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(ad(n,t,s))return!0;if(i)if(s){if(n.closest(i))return!0}else if(n.matches(i))return!0}catch(e){}return!1}function cd(e,t,i){const s=e.removeEventListener;"function"==typeof s&&s.call(e,t,i)}var ud=new Map;function dd(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function hd(e){return null==e?"":e.toLowerCase()}var pd=!1,_d=!1;function gd(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p=!1,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f={},inlineImages:v=!1,recordCanvas:m=!1,canvasMaskingConfigured:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w=5e3,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:T=!1,depth:I=0,maxDepth:R=50}=t;let{needsMask:P}=t,{preserveWhiteSpace:M=!0}=t;if(I>=R)return _d=!0,pd||(pd=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${R}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=ld(e,o,a,void 0===P)),Jc>0&&(tu.nodeCount+=1);const F=function(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,maskAllElementAttributes:d=!1,maskAttributeFn:h,dataURLOptions:p={},inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const i=t.getId(e);return 1===i?void 0:i}(i,s);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Lc.Document,childNodes:[],compatMode:e.compatMode}:{type:Lc.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Lc.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:i,blockClass:s,blockSelector:n,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:c,dataURLOptions:u={},inlineImages:d,recordCanvas:h,canvasMaskingConfigured:p,keepIframeSrcFn:_,newlyAddedElement:g=!1,rootId:f}=t,v=function(e,t,i){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(i)return e.matches(i)}catch(e){}return!1}(e,s,n),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Du(e.tagName);return Yu.test(t)?"div":t}(e),y=new Set;let b={};const S=e.attributes.length;for(let t=0;S>t;t++){const s=e.attributes[t];od(m,s.name)||(b[s.name]=rd(i,m,Du(s.name),s.value,e,u))}if("link"===m&&r&&!v){let t=e.sheet;if(!t){const s=function(e){return e.href}(e);s&&(t=dd(i,s),!t&&s.includes(".css"))&&(t=dd(i,window.location.origin+"/"+s.replace(window.location.href,"")))}let s=null;t&&(gu(t)?Jc>0&&(nu.push(e),ru+=1):s=Tu(t)),s&&(delete b.rel,delete b.href,b._cssText=s)}if("style"===m&&e.sheet&&!(e.innerText||Vc.textContent(e)||"").trim().length){const t=pu(()=>Tu(e.sheet));t&&(b._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,i=e.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&t?b.value=$u({element:e,type:Hu(e),tagName:m,value:t,maskInputOptions:o,maskInputFn:a}):i&&(b.checked=i)}if("option"===m&&(e.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===m&&e.open){try{b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}y.add("rr_open_mode")}if("canvas"===m&&h&&!(null==p?void 0:p()))if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let i=0;e.width>i;i+=50)for(let s=0;e.height>s;s+=50){const n=t.getImageData;if(new Uint32Array((qu in n?n[qu]:n).call(t,i,s,Math.min(50,e.width-i),Math.min(50,e.height-s)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),s=i.createElement("canvas");s.width=e.width,s.height=e.height,t!==s.toDataURL(u.type,u.quality)&&(b.rr_dataURL=t)}let w,k=!1;if("img"===m&&d){Gu||(Gu=i.createElement("canvas"),Qu=Gu.getContext("2d"));const t=e,s=t.currentSrc||t.getAttribute("src")||"<unknown-src>",n=t.crossOrigin,r=(t,i)=>k?Bu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c}):i,o=()=>{cd(t,"load",o);try{Gu.width=t.naturalWidth,Gu.height=t.naturalHeight,Qu.drawImage(t,0,0);const e=Gu.toDataURL(u.type,u.quality);b.rr_dataURL=r("rr_dataURL",e)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${s}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(n?b.crossOrigin=r("crossOrigin",n):t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=b;t.rr_mediaState=e.paused?"paused":"played",y.add("rr_mediaState"),t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(g||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),v){var C,E,x;const{width:t,height:s,left:n,top:r}=e.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(e);b={class:b.class,rr_width:`${t}px`,rr_height:`${s}px`,rr_left:`${Math.floor(n+((null===(E=i.defaultView)||void 0===E?void 0:E.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(x=i.defaultView)||void 0===x?void 0:x.scrollY)||0))}px`},y.add("rr_width"),y.add("rr_height"),y.add("rr_left"),y.add("rr_top"),o&&(b.rr_position=o.position||"static",y.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,y.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,y.add("rr_display")))}if("iframe"!==m||_(b.src)||(e.contentDocument||(b.rr_src=b.src),delete b.src),l||c)for(const[t,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[t]=Bu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c,isGenerated:y.has(t)}));k=!0;try{customElements.get(m)&&(w=!0)}catch(e){}return{type:Lc.Element,tagName:m,attributes:b,childNodes:[],isSVG:(T=e,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:v,rootId:f,isCustom:w};var T}(e,{doc:i,blockClass:n,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,maskAllElementAttributes:d,maskAttributeFn:h,dataURLOptions:p,inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:i,maskTextFn:s,rootId:n}=t,r=Vc.parentNode(e),o=r&&r.tagName;let a=Vc.textContent(e);const l="STYLE"===o||void 0,c="SCRIPT"===o||void 0;if(l&&a){try{var u;if(e.nextSibling||e.previousSibling);else if(gu(r.sheet));else if(null===(u=r.sheet)||void 0===u?void 0:u.cssRules){const e=Tu(r.sheet);e&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(e)&&(a=e)}}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}a=Vu(a,sd(t.doc))}return c&&(a="SCRIPT_PLACEHOLDER"),!l&&!c&&a&&i&&(a=s?s(a,Vc.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Lc.Text,textContent:a||"",isStyle:l,rootId:n}}(e,{doc:i,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:Lc.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Lc.Comment,textContent:Vc.textContent(e)||"",rootId:y};default:return!1}}(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:x,newlyAddedElement:T});if(!F)return console.warn(e,"not serialized"),null;let L;L=s.hasNode(e)?s.getId(e):function(e,t){if(t.comment&&e.type===Lc.Comment)return!0;if(e.type===Lc.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;let i;try{i=new URL(e,window.location.href)}catch(e){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==s?void 0:s[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&&(hd(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===hd(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(hd(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&hd(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(hd(e.attributes.property).match(/^(og|twitter|fb):/)||hd(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===hd(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(hd(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(hd(e.attributes.name))||hd(e.attributes.property).match(/^article:/)||hd(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(hd(e.attributes.name)))return!0}}return!1}(F,g)||!M&&F.type===Lc.Text&&!F.isStyle&&!F.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Ju();const A=Object.assign(F,{id:L});if(s.add(e,A),-2===L)return null;b&&b(e);let O=!l;if(A.type===Lc.Element){O=O&&!A.needBlock,delete A.needBlock;const t=Vc.shadowRoot(e);t&&ku(t)&&(A.isShadowHost=!0)}if((A.type===Lc.Document||A.type===Lc.Element)&&O){g.headWhitespace&&A.type===Lc.Element&&"head"===A.tagName&&(M=!1);const t={doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:x,depth:I+1,maxDepth:R};if(A.type===Lc.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else for(const i of Array.from(Vc.childNodes(e))){const e=gd(i,t);e&&A.childNodes.push(e)}let T=null;if(Su(e)&&(T=Vc.shadowRoot(e)))for(const e of Array.from(Vc.childNodes(T))){const i=gd(e,t);i&&(ku(T)&&(i.isShadow=!0),A.childNodes.push(i))}}const D=Vc.parentNode(e);if(D&&wu(D)&&ku(D)&&(A.isShadow=!0),A.type===Lc.Element&&"iframe"===A.tagName){const t=function(e,t,i){const s=()=>{},n=e.contentWindow;if(!n)return s;let r;try{r=n.document.readyState}catch(e){return s}const o=()=>t();if("complete"!==r){let s=!1,n=null;const r=()=>{s||(s=!0,null!==n&&(clearTimeout(n),n=null),cd(e,"load",a),e.addEventListener("load",o),t())},a=()=>r();return n=setTimeout(r,i),e.addEventListener("load",a),()=>{null!==n&&(clearTimeout(n),n=null),s?cd(e,"load",o):(s=!0,cd(e,"load",a))}}const a="about:blank";let l;try{l=n.location.href}catch(e){return s}if(l!==a||e.src===a||""===e.src){const i=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(i),cd(e,"load",o)}}return e.addEventListener("load",o),()=>{cd(e,"load",o)}}(e,()=>{const t=e.contentDocument;if(t&&S){const i=gd(t,{doc:t,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:x,depth:I+1,maxDepth:R});i&&S(e,i)}},w);null==k||k(e,t)}return A.type===Lc.Element&&"link"===A.tagName&&"stylesheet"===A.attributes.rel&&function(t,l,k){if(ud.has(t))return;let T;try{T=t.sheet}catch(e){return}if(T)return;const F=new AbortController;let L=!1;const A=()=>{if(!L){L=!0;try{(()=>{if(C){const t=gd(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:x,depth:I,maxDepth:R});t&&C(e,t)}})()}finally{ud.delete(t),F.abort()}}},O=setTimeout(A,k);F.signal.addEventListener("abort",()=>clearTimeout(O),{once:!0}),t.addEventListener("load",A,{signal:F.signal,once:!0}),ud.set(t,F)}(e,0,E),A}function fd(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 vd=class e{constructor(...e){bu(this,"parentElement",null),bu(this,"parentNode",null),bu(this,"ownerDocument",void 0),bu(this,"firstChild",null),bu(this,"lastChild",null),bu(this,"previousSibling",null),bu(this,"nextSibling",null),bu(this,"ELEMENT_NODE",1),bu(this,"TEXT_NODE",3),bu(this,"nodeType",void 0),bu(this,"nodeName",void 0),bu(this,"RRNodeType",void 0)}get childNodes(){const e=[];let t=this.firstChild;for(;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 md(e,t,i=document){const s={capture:!0,passive:!0};return i.addEventListener(e,t,s),()=>yd(i,e,t,s)}function yd(e,t,i,s){bd(()=>{const n=e.removeEventListener;"function"==typeof n&&(void 0!==s?n.call(e,t,i,s):n.call(e,t,i))})}function bd(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function Sd(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var wd="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.",kd={map:{},getId(){return console.error(wd),-1},getNode(){return console.error(wd),null},removeNodeFromMap(){console.error(wd)},has(){return console.error(wd),!1},reset(){console.error(wd)}};function Cd(e,t,i={}){let s=null,n=0;return function(...r){const o=Date.now();n||!1!==i.leading||(n=o);const a=t-(o-n),l=this;0>=a||a>t?(s&&(clearTimeout(s),s=null),n=o,e.apply(l,r)):s||!1===i.trailing||(s=setTimeout(()=>{n=!1===i.leading?0:Date.now(),s=null,e.apply(l,r)},a))}}function Ed(e,t,i,s,n=window){const r=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,s?i:{set(e){if(setTimeout(()=>{try{i.set.call(this,e)}catch(e){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(e){return}r.set.call(this,e)}}}),()=>Ed(e,t,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(kd=new Proxy(kd,{get(e,t,i){return"map"===t&&console.error(wd),Reflect.get(e,t,i)}}));var xd=Date.now;function Td(e){var t,i,s,n;const r=e.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(t=Vc.parentElement(r.body))||void 0===t?void 0:t.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(s=Vc.parentElement(r.body))||void 0===s?void 0:s.scrollTop)||(null==r||null===(n=r.body)||void 0===n?void 0:n.scrollTop)||0}}function Id(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Rd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Pd(e){return e?e.nodeType===e.ELEMENT_NODE?e:Vc.parentElement(e):null}function Md(e,t,i,s){if(!e)return!1;const n=Pd(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(s&&null!==n.closest("."+t))return!0}else if(ad(n,t,s))return!0}catch(e){}if(i){if(n.matches(i))return!0;if(s&&null!==n.closest(i))return!0}return!1}function Fd(e,t,i){return!("TITLE"!==e.tagName||!i.headTitleMutations)||-2===t.getId(e)}function Ld(e,t){if(wu(e))return!1;const i=t.getId(e);if(!t.has(i))return!0;const s=Vc.parentNode(e);return(!s||s.nodeType!==e.DOCUMENT_NODE)&&(!s||Ld(s,t))}function Ad(e){return Boolean(e.changedTouches)}function Od(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function $d(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Dd(e){return!!e&&(e instanceof vd&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Vc.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(xd=()=>(new Date).getTime());var Nd=class{constructor(){bu(this,"id",1),bu(this,"styleIDMap",new WeakMap),bu(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){if(this.has(e))return this.getId(e);let i;return i=void 0===t?this.id++:t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}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 Bd(e){var t;let i=null;return"getRootNode"in e&&(null===(t=Vc.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Vc.host(Vc.getRootNode(e))&&(i=Vc.host(Vc.getRootNode(e))),i}function qd(e){const t=e.ownerDocument;if(!t)return!1;if(Vc.contains(t,e))return!0;const i=Vc.isConnected(e);return"boolean"==typeof i?i:function(e){const t=e.ownerDocument;if(!t)return!1;const i=function(e){let t,i=e;for(;t=Bd(i);)i=t;return i}(e);return Vc.contains(t,i)}(e)}function Hd(e){return"__ln"in e}var Ud,Wd=class{constructor(){bu(this,"length",0),bu(this,"head",null),bu(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let i=0;e>i;i++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Hd(e.previousSibling)){const i=e.previousSibling.__ln.next;t.next=i,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,i&&(i.previous=t)}else if(e.nextSibling&&Hd(e.nextSibling)&&e.nextSibling.__ln.previous){const 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){const 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--)}},zd=(e,t)=>`${e}@${t}`,jd=class{constructor(){bu(this,"frozen",!1),bu(this,"locked",!1),bu(this,"texts",[]),bu(this,"attributes",[]),bu(this,"attributeMap",new WeakMap),bu(this,"generatedAttributes",new WeakMap),bu(this,"removes",[]),bu(this,"mapRemoves",new Set),bu(this,"movedMap",{}),bu(this,"addedSet",new Set),bu(this,"movedSet",new Set),bu(this,"droppedSet",new Set),bu(this,"removesSubTreeCache",new Set),bu(this,"mutationCb",void 0),bu(this,"blockClass",void 0),bu(this,"blockSelector",void 0),bu(this,"maskTextClass",void 0),bu(this,"maskTextSelector",void 0),bu(this,"inlineStylesheet",void 0),bu(this,"maskInputOptions",void 0),bu(this,"maskTextFn",void 0),bu(this,"maskInputFn",void 0),bu(this,"maskAllElementAttributes",void 0),bu(this,"maskAttributeFn",void 0),bu(this,"keepIframeSrcFn",void 0),bu(this,"recordCanvas",void 0),bu(this,"canvasMaskingConfigured",void 0),bu(this,"inlineImages",void 0),bu(this,"slimDOMOptions",void 0),bu(this,"dataURLOptions",void 0),bu(this,"doc",void 0),bu(this,"mirror",void 0),bu(this,"iframeManager",void 0),bu(this,"stylesheetManager",void 0),bu(this,"shadowDomManager",void 0),bu(this,"canvasManager",void 0),bu(this,"processedNodeManager",void 0),bu(this,"unattachedDoc",void 0),bu(this,"canvasManagerReleased",!1),bu(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),bu(this,"emit",()=>{if(this.frozen||this.locked)return;const e=Gc(),t=Zc();try{this.processBufferedMutations()}finally{i=Gc()-e,s=t,Jc>0||Yc(i,null!=s?s:Qc)||i>au.slowestBatchMs&&(au.slowestBatchMs=i)}var i,s}),bu(this,"processBufferedMutations",()=>{const e=[],t=new Set,i=new Wd,s=e=>{let t=e,i=-2;for(;-2===i;)t=t&&t.nextSibling,i=t&&this.mirror.getId(t);return i};let n;const r=r=>{var o;const a=Vc.parentNode(r);if(!a||!qd(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=wu(a)?this.mirror.getId(Bd(r)):this.mirror.getId(a),c=s(r);if(-1===l||-1===c)return i.addNode(r);null!==(o=n)&&void 0!==o||(n={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=>{Od(e,this.mirror)&&this.iframeManager.addIframe(e),$d(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Dd(e)&&!Md(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Vc.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)}});const u=gd(r,n);u&&(e.push({parentId:l,nextId:c,node:u}),t.add(u.id))};for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e);for(const e of this.movedSet)Gd(this.removesSubTreeCache,e)&&!this.movedSet.has(Vc.parentNode(e))||r(e);for(const e of this.addedSet)Qd(this.droppedSet,e)||Gd(this.removesSubTreeCache,e)?Qd(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let o=null;for(;i.length;){let e=null;if(o){const t=this.mirror.getId(Vc.parentNode(o.value)),i=s(o.value);-1!==t&&-1!==i&&(e=o)}if(!e){let t=i.tail;for(;t;){const i=t;if(t=t.previous,i){const t=this.mirror.getId(Vc.parentNode(i.value));if(-1===s(i.value))continue;if(-1!==t){e=i;break}{const t=Vc.parentNode(i.value);if(t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const s=Vc.host(t);if(-1!==this.mirror.getId(s)){e=i;break}}}}}}if(!e){for(;i.head;)i.removeNode(i.head.value);break}o=e.previous,i.removeNode(e.value),r(e.value)}const a={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const t=e.node,i=Vc.parentNode(t);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const{attributes:t}=e;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){const i=JSON.stringify(e.styleDiff),s=JSON.stringify(e._unchangedStyles);t.style.length>i.length&&(i+s).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[s,n]of Object.entries(t))if("string"==typeof n||null===n){var i;t[s]=Bu({element:e.node,name:s,value:n,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(e.node))||void 0===i?void 0:i.has(s)})}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),bu(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),bu(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const i=Array.from(Vc.childNodes(e),e=>Vc.textContent(e)||"").join("");t.attributes.value=$u({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Hu(e),value:i,maskInputFn:this.maskInputFn})}),bu(this,"processMutation",e=>{if(!Fd(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Vc.textContent(e.target);Md(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:ld(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Pd(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{var t;const s=e.target,n=e.attributeName,r=null!==(t=e.attributeNamespace)&&void 0!==t?t:null;let o=function(e,t,i){if(!i)return t;const s=e.getAttributeNodeNS(i,t);if(s)return s.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${t}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${t}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===t?t:`xmlns:${t}`;const n=e.lookupPrefix(i);return n?`${n}:${t}`:t}(s,n,r),a=r?s.getAttributeNS(r,n):e.target.getAttribute(n);if("value"===o){const e=s,t=Hu(e);a=$u({element:e,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:t,value:a,maskInputFn:this.maskInputFn})}if(Md(e.target,this.blockClass,this.blockSelector,!1)||a===e.oldValue)return;let l=this.attributeMap.get(e.target);const c="IFRAME"===s.tagName&&"src"===o;if(c&&!this.keepIframeSrcFn(a)&&s.contentDocument)return;if(l||(l={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(l),this.attributeMap.set(e.target,l)),"type"===o&&"INPUT"===s.tagName&&"password"===(e.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!od(s.tagName,o)){var i;const t=rd(this.doc,Du(s.tagName),Du(o),a,s,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(a)&&(o="rr_src"),l.attributes[o]=t,null===(i=this.generatedAttributes.get(e.target))||void 0===i||i.delete(o),"style"===o){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const t=this.unattachedDoc.createElement("span"),i=s.style;e.oldValue&&(t.style.cssText=e.oldValue);for(const e of Array.from(i)){const s=i.getPropertyValue(e),n=i.getPropertyPriority(e);s!==t.style.getPropertyValue(e)||n!==t.style.getPropertyPriority(e)?l.styleDiff[e]=""===n?s:[s,n]:l._unchangedStyles[e]=[s,n]}for(const e of Array.from(t.style))""===i.getPropertyValue(e)&&(l.styleDiff[e]=!1)}else if("open"===o&&"DIALOG"===s.tagName){l.attributes.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal";let t=this.generatedAttributes.get(e.target);t||(t=new Set,this.generatedAttributes.set(e.target,t)),t.add("rr_open_mode")}}break}case"childList":if(Md(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=>{const i=this.mirror.getId(t),s=wu(e.target)?this.mirror.getId(Vc.host(e.target)):this.mirror.getId(e.target);Md(e.target,this.blockClass,this.blockSelector,!1)||Fd(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Vd(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===i||Ld(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[zd(i,s)]?Vd(this.movedSet,t):(this.removes.push({parentId:s,id:i,isShadow:!(!wu(e.target)||!ku(e.target))||void 0}),function(e,t){const i=[e];for(;i.length;){const e=i.pop();t.has(e)||(t.add(e),Vc.childNodes(e).forEach(e=>i.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),bu(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(Fd(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&-1!==i&&(this.movedMap[zd(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!Md(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;const t=Vc.childNodes(e);for(let e=0,i=t.length;i>e;e++){const i=t[e];i&&this.genAdds(i)}if(Dd(e)){const t=Vc.childNodes(Vc.shadowRoot(e));for(let i=0,s=t.length;s>i;i++){const s=t[i];s&&(this.processedNodeManager.add(s,this),this.genAdds(s,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(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){const t=this.blockClass,i=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;for(;e;){if(i&&(i.lastIndex=0),Md(e,i||t,this.blockSelector,!0))return!0;const s="getRootNode"in e?Vc.getRootNode(e):null;e=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Vc.host(s):null}return!1}};function Vd(e,t){const i=[t];for(;i.length;){const t=i.pop();if(e.delete(t),t.nodeType===t.TEXT_NODE)continue;const s=Vc.childNodes(t);for(let e=0,t=s.length;t>e;e++){const t=s[e];t&&i.push(t)}}}function Gd(e,t,i){return 0!==e.size&&function(e,t){const i=Vc.parentNode(t);return!!i&&e.has(i)}(e,t)}function Qd(e,t){if(0===e.size)return!1;let i=Vc.parentNode(t);for(;i;){if(e.has(i))return!0;i=Vc.parentNode(i)}return!1}function Kd(e){Ud=e}function Zd(){Ud=void 0}var Yd=(e,t="rrweb")=>Ud?(...i)=>{try{return e(...i)}catch(e){if(Ud&&!0===Ud(e,t))return;throw e}}:e,Jd=[];function Xd(e){try{if("composedPath"in e){const 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 eh(e,t){const i=new jd;let s;i.init(e);try{s=new(zc())(Yd(i.processMutations.bind(i)));const n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),s.observe(t,n),Jd.push(i),{observer:s,buffer:i}}catch(e){try{null==s||s.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function th({scrollCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){const o=new Map,a=r=>{const a=Xd(r);if(!a||Md(a,s,n,!0))return;const l=i.getId(a);let c,u;if(a===t&&t.defaultView){const e=Td(t.defaultView);c=e.left,u=e.top}else c=a.scrollLeft,u=a.scrollTop;const d=`${c},${u}`;o.get(l)!==d&&(o.set(l,d),e({id:l,x:c,y:u}))},l=[md("scroll",Yd(Cd(Yd(e=>a(e)),r.scroll||100)),t)];return"onscrollend"in t&&l.push(md("scrollend",Yd(a),t)),()=>l.forEach(e=>e())}function ih(e,t){for(let i=Jd.length-1;i>=0;i--){const s=Jd[i];if(!s)continue;let n=s.bufferBelongsToIframe(e);!n&&t&&t.has(s.bufferDoc())&&(n=!0),n&&(s.reset(),Jd.splice(i,1))}}var sh=["INPUT","TEXTAREA","SELECT"],nh=new WeakMap;function rh(e){return function e(t,i){if(ch("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||ch("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||ch("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||ch("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const s=Array.from(t.parentRule.cssRules).indexOf(t);return i.unshift(s),e(t.parentRule,i)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);i.unshift(e)}return i}(e,[])}function oh(e,t,i){let s,n;return e?(e.ownerNode?s=t.getId(e.ownerNode):n=i.getId(e),{styleId:n,id:s}):{}}function ah({mirror:e,stylesheetManager:t},i){var s,n;let r=null;r=e.getId("#document"===i.nodeName?i:Vc.host(i));const o="#document"===i.nodeName?null===(s=i.defaultView)||void 0===s?void 0:s.Document:null===(n=i.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n?void 0:n.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&a?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){let i;try{var s;i=null===(s=a.set)||void 0===s?void 0:s.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==r&&-1!==r)try{t.adoptStyleSheets(e,r)}catch(e){}return i}}),Yd(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}function lh(e,t={}){const i=e.doc.defaultView;if(!i)return()=>{};let s,n;!function(e,t){const{mutationCb:i,mousemoveCb:s,mouseInteractionCb:n,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:_}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),s(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),n(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),r(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),_(...e)}}(e,t);const r=[],o=Yd(()=>{try{if(n)try{n.destroy(),n.reset()}finally{const e=Jd.indexOf(n);-1!==e&&Jd.splice(e,1)}e.shadowDomManager.resetForDoc(e.doc),null==s||s.disconnect()}finally{Sd(r)}});try{if(e.recordDOM){const t=eh(e,e.doc);s=t.observer,n=t.buffer}if(r.push(function({mousemoveCb:e,sampling:t,doc:i,mirror:s}){if(!1===t.mousemove)return()=>{};const n="number"==typeof t.mousemove?t.mousemove:50,r="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Cd(Yd(t=>{const i=Date.now()-o;e(a.map(e=>(e.timeOffset-=i,e)),t),a=[],o=null}),r),c=Yd(Cd(Yd(e=>{const t=Xd(e),{clientX:i,clientY:n}=Ad(e)?e.changedTouches[0]:e;o||(o=xd()),a.push({x:i,y:n,id:s.getId(t),timeOffset:xd()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?Ic.Drag:e instanceof MouseEvent?Ic.MouseMove:Ic.TouchMove)}),n,{trailing:!1})),u=[md("mousemove",c,i),md("touchmove",c,i),md("drag",c,i)];return Yd(()=>{u.forEach(e=>e())})}(e)),r.push(function({mouseInteractionCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,a=[];let l=null;return Object.keys(Rc).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(r=>{let o=Du(r);const c=(t=>r=>{const o=Xd(r);if(Md(o,s,n,!0))return;let a=null,c=t;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Pc.Mouse;break;case"touch":a=Pc.Touch;break;case"pen":a=Pc.Pen}a===Pc.Touch&&(Rc[t]===Rc.MouseDown?c="TouchStart":Rc[t]===Rc.MouseUp&&(c="TouchEnd"))}else Ad(r)&&(a=Pc.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===Pc.Touch||c.startsWith("Mouse")&&a===Pc.Mouse)&&(a=null)):Rc[t]===Rc.Click&&(a=l,l=null);const u=Ad(r)?r.changedTouches[0]:r;if(!u)return;const d=i.getId(o),{clientX:h,clientY:p}=u;Yd(e)(at({type:Rc[c],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Rc[r]){case Rc.MouseDown:case Rc.MouseUp:o=o.replace("mouse","pointer");break;case Rc.TouchStart:case Rc.TouchEnd:return}a.push(md(o,c,t))}),Yd(()=>{a.forEach(e=>e())})}(e)),r.push(th(e)),r.push(function({viewportResizeCb:e},{win:t}){let i=-1,s=-1;return md("resize",Yd(Cd(Yd(()=>{const t=Id(),n=Rd();i===t&&s===n||(e({width:Number(n),height:Number(t)}),i=t,s=n)}),200)),t)}(e,{win:i})),r.push(function({inputCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(e){let i=Xd(e);const c=e.isTrusted,d=t.defaultView;if(i&&d&&!(i instanceof d.HTMLElement))return;const p=i&&i.tagName;if(i&&"OPTION"===p&&(i=Vc.parentElement(i)),!i||!p||0>sh.indexOf(p)||Md(i,s,n,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let _=i.value,g=!1;const f=Hu(i)||"";"radio"===f||"checkbox"===f?g=i.checked:(a[p.toLowerCase()]||a[f])&&(_=$u({element:i,maskInputOptions:a,tagName:p,type:f,value:_,maskInputFn:l})),h(i,u?{text:_,isChecked:g,userTriggered:c}:{text:_,isChecked:g});const v=i.name;"radio"===f&&v&&g&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==i){const t=e.value;h(e,u?{text:t,isChecked:!g,userTriggered:!1}:{text:t,isChecked:!g})}})}function h(t,s){const n=nh.get(t);if(!n||n.text!==s.text||n.isChecked!==s.isChecked){nh.set(t,s);const n=i.getId(t);Yd(e)(at(at({},s),{},{id:n}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>md(e,Yd(d),t)),_=t.defaultView;if(!_)return()=>{p.forEach(e=>e())};const g=_.Object.getOwnPropertyDescriptor(_.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[_.HTMLInputElement.prototype,"value"],[_.HTMLInputElement.prototype,"checked"],[_.HTMLSelectElement.prototype,"value"],[_.HTMLTextAreaElement.prototype,"value"],[_.HTMLSelectElement.prototype,"selectedIndex"],[_.HTMLOptionElement.prototype,"selected"]].map(e=>Ed(e[0],e[1],{set(){Yd(d)({target:this,isTrusted:!1})}},!1,_))),Yd(()=>{Sd(p)})}(e)),r.push(function({mediaInteractionCb:e,blockClass:t,blockSelector:i,mirror:s,sampling:n,doc:r}){const o=Yd(r=>Cd(Yd(n=>{const o=Xd(n);if(!o||Md(o,t,i,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=o;e({type:r,id:s.getId(o),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})}),n.media||500)),a=[md("play",o(Fc.Play),r),md("pause",o(Fc.Pause),r),md("seeked",o(Fc.Seeked),r),md("volumechange",o(Fc.VolumeChange),r),md("ratechange",o(Fc.RateChange),r)];return Yd(()=>{a.forEach(e=>e())})}(e)),e.recordDOM){const t=function(e){const t=new Map,i=new Set;let s=!0;const n=e=>{if(s)try{e()}catch(e){}},r=e=>{var i;const s=t.get(e);if(s){for(;null===(i=s[0])||void 0===i?void 0:i.ready;){const e=s.shift();(null==e?void 0:e.emit)&&n(e.emit)}0===s.length&&t.delete(e)}};return{queueMutation(e,i){if(!e)return void n(i);const s=t.get(e);s?(s.push({emit:i,ready:!0}),r(e)):n(i)},queuePendingMutation(o,a,l){if(!s)return()=>{};let c=t.get(o);c||(c=[],t.set(o,c));const u={emit:a,ready:!1};c.push(u);let d,h=!1,p=!1;const _=()=>{h||p||(h=!0,void 0!==d&&i.delete(d),u.ready=!0,u.emit=void 0,r(o))};try{d=e.setTimeout(_,5e3),h||p?e.clearTimeout(d):i.add(d)}catch(e){_()}return t=>{!p&&s&&(p=!0,void 0!==d&&(e.clearTimeout(d),i.delete(d)),h?t&&n(l):(u.ready=!0,t||(u.emit=void 0),r(o)))}},reset(){s=!1,i.forEach(t=>e.clearTimeout(t)),i.clear(),t.clear()}}}(i);r.push(t.reset),r.push(function({styleSheetRuleCb:e,mirror:t,stylesheetManager:i},{win:s,mutationQueue:n}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const r=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=oh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,adds:[{rule:a,index:l}]})),l},"host")}),s.CSSStyleSheet.prototype.addRule=function(e,t,i=this.cssRules.length){return s.CSSStyleSheet.prototype.insertRule.apply(this,[`${e} { ${t} }`,i])};const o=s.CSSStyleSheet.prototype.deleteRule;let a,l;s.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=oh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,removes:[{index:a}]})),l},"host")}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);try{const s=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof s)return l;i.onCssomSheetMutation(r);const{id:o,styleId:c}=oh(r,t,i.styleMirror);if(!(o&&-1!==o||c&&-1!==c))return l;const u=n.queuePendingMutation(r,()=>e({id:o,styleId:c,replace:a}),()=>{const t=Tu(r);null!==t&&e({id:o,styleId:c,replace:t})});try{s.call(l,()=>u(!0),()=>u(!1))}catch(e){u(!1)}}catch(e){}return l},"host")})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=oh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,replaceSync:a})),l},"host")}));const c={};uh("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(uh("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),uh("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),uh("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));const u={};return Object.entries(c).forEach(([s,r])=>{u[s]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(u[s].insertRule,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=oh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...rh(r),l];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,adds:[{rule:a,index:t}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(u[s].deleteRule,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=oh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...rh(r),a];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,removes:[{index:t}]}))}return l},"host")})}),Yd(()=>{s.CSSStyleSheet.prototype.insertRule=r,s.CSSStyleSheet.prototype.deleteRule=o,a&&(s.CSSStyleSheet.prototype.replace=a),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:i,mutationQueue:t})),r.push(ah(e,e.doc)),r.push(function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:i,stylesheetManager:s},{win:n,mutationQueue:r}){const o=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Yd((n,o,a)=>{var l;const[c,u,d]=a,h=n.apply(o,a);if(i.has(c))return h;const p=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(p);const{id:_,styleId:g}=oh(p,t,s.styleMirror);if(_&&-1!==_||g&&-1!==g){const t=rh(o.parentRule);r.queueMutation(p,()=>e({id:_,styleId:g,set:{property:c,value:u,priority:d},index:t}))}return h},"host")});const a=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Yd((n,o,a)=>{var l;const[c]=a,u=n.apply(o,a);if(i.has(c))return u;const d=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(d);const{id:h,styleId:p}=oh(d,t,s.styleMirror);if(h&&-1!==h||p&&-1!==p){const t=rh(o.parentRule);r.queueMutation(d,()=>e({id:h,styleId:p,remove:{property:c},index:t}))}return u},"host")}),Yd(()=>{n.CSSStyleDeclaration.prototype.setProperty=o,n.CSSStyleDeclaration.prototype.removeProperty=a})}(e,{win:i,mutationQueue:t})),e.collectFonts&&r.push(function({fontCb:e,doc:t}){const i=t.defaultView;if(!i)return()=>{};const s=[],n=new WeakMap,r=i.FontFace;i.FontFace=function(e,t,i){const s=new r(e,t,i);return n.set(s,{family:e,buffer:"string"!=typeof t,descriptors:i,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),s};const o=jc(t.fonts,"add",function(t){return function(i){return setTimeout(Yd(()=>{const t=n.get(i);t&&(e(t),n.delete(i))}),0),t.apply(this,[i])}});return s.push(()=>{i.FontFace=r}),s.push(o),Yd(()=>{s.forEach(e=>e())})}(e))}r.push(function(e){const{doc:t,mirror:i,blockClass:s,blockSelector:n,selectionCb:r}=e;let o=!0;const a=Yd(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;l>t;t++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:c}=e.getRangeAt(t);Md(r,s,n,!0)||Md(l,s,n,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:c})}r({ranges:a})});return a(),md("selectionchange",a)}(e)),r.push(function({doc:e,customElementCb:t}){const i=e.defaultView;return i&&i.customElements?jc(i.customElements,"define",function(e){return function(i,s,n){try{t({define:{name:i}})}catch(e){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,s,n])}}):()=>{}}(e));for(const t of e.plugins)r.push(t.observer(t.callback,i,t.options))}catch(e){try{o()}catch(e){}throw e}return o}function ch(e){return void 0!==window[e]}function uh(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var dh=class{constructor(e){bu(this,"generateIdFn",void 0),bu(this,"iframeRemoteIdToLocalIdMap",new WeakMap),bu(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,i,s){if(0>t)return t;const n=i||this.getRemoteIdToLocalIdMap(e),r=s||this.getLocalIdToRemoteIdMap(e);let o=n.get(t);return void 0===o&&(o=this.generateIdFn(),n.set(t,o),r.set(o,t)),o}getIds(e,t){const i=this.getRemoteIdToLocalIdMap(e),s=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,i,s))}getRemoteId(e,t,i){var s;return"number"!=typeof t||0>t?t:null!==(s=(i||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==s?s:-1}getRemoteIds(e,t){const i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,i))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){let t=this.iframeRemoteIdToLocalIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToLocalIdMap.set(e,t)),t}getLocalIdToRemoteIdMap(e){let t=this.iframeLocalIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeLocalIdToRemoteIdMap.set(e,t)),t}},hh=class{constructor(e){bu(this,"iframes",new WeakMap),bu(this,"crossOriginIframeMap",new WeakMap),bu(this,"crossOriginIframeMirror",new dh(Ju)),bu(this,"crossOriginIframeStyleMirror",void 0),bu(this,"crossOriginIframeRootIdMap",new WeakMap),bu(this,"mirror",void 0),bu(this,"mutationCb",void 0),bu(this,"wrappedEmit",void 0),bu(this,"loadListener",void 0),bu(this,"pageHideListener",void 0),bu(this,"stylesheetManager",void 0),bu(this,"recordCrossOriginIframes",void 0),bu(this,"messageHandler",void 0),bu(this,"nestedIframeListeners",new Map),bu(this,"attachedWindows",new WeakMap),bu(this,"attachedDocuments",new WeakMap),bu(this,"attachedIframes",new Map),bu(this,"loadListenerDisposers",new WeakMap),bu(this,"iframeElementsById",new Map),bu(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new dh(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){let i=this.loadListenerDisposers.get(e);i||(i=new Set,this.loadListenerDisposers.set(e,i)),i.add(t);const s=this.mirror.getId(e);-1!==s&&this.iframeElementsById.set(s,e)}getIframeElementById(e){var t,i,s;return null!==(t=null!==(i=null===(s=this.attachedIframes.get(e))||void 0===s?void 0:s.element)&&void 0!==i?i:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){const t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>bd(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){const t=this.pageHideHandlers.get(e);t&&(t.forEach(({win:e,handler:t})=>{yd(e,"pagehide",t)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){const i=this.mirror.getId(e);return this.attachedIframes.set(i,{element:e,content:t}),i}attachIframe(e,t){var i;const s=this.trackIframeContent(e,t);if(e.contentDocument){let t=this.attachedDocuments.get(e);t||(t=new Set,this.attachedDocuments.set(e,t)),t.add(e.contentDocument)}this.mutationCb({adds:[{parentId:s,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){const t=this.handleMessage.bind(this);bd(()=>{n.addEventListener("message",t),this.nestedIframeListeners.set(n,t);let i=this.attachedWindows.get(e);i||(i=new Set,this.attachedWindows.set(e,i)),i.add(n)})}bd(()=>{const t=e.contentWindow;if(!t)return;let i=this.pageHideHandlers.get(e);if(i)for(const e of i)if(e.win===t)return;const 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),i||(i=new Set,this.pageHideHandlers.set(e,i)),i.add({win:t,handler:s})}),null===(i=this.loadListener)||void 0===i||i.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){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,t.data.event);s&&this.wrappedEmit(s,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case Tc.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:Tc.IncrementalSnapshot,data:{source:Ic.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Tc.Meta:case Tc.Load:case Tc.DomContentLoaded:return!1;case Tc.Plugin:return t;case Tc.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Tc.IncrementalSnapshot:switch(t.data.source){case Ic.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(t.node,i)}),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 Ic.Drag:case Ic.TouchMove:case Ic.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Ic.ViewportResize:return!1;case Ic.MediaInteraction:case Ic.MouseInteraction:case Ic.Scroll:case Ic.CanvasMutation:case Ic.Input:return this.replaceIds(t.data,e,["id"]),t;case Ic.StyleSheetRule:case Ic.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Ic.Font:return t;case Ic.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Ic.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,i,s){for(const n of s)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(i,t[n]):e.getId(i,t[n]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}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===Lc.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){const t=this.attachedIframes.get(e),i=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),i){const e=i.contentWindow,t=this.attachedWindows.get(i);t&&(t.forEach(e=>{const t=this.nestedIframeListeners.get(e);t&&(yd(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(i)),e&&this.nestedIframeListeners.has(e)&&(yd(e,"message",this.nestedIframeListeners.get(e)),this.nestedIframeListeners.delete(e)),e&&this.crossOriginIframeMap.delete(e),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const s=this.attachedDocuments.get(i);s&&(s.forEach(e=>{bd(()=>this.mirror.removeNodeFromMap(e))}),bd(()=>ih(i,s)),this.attachedDocuments.delete(i))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const e=[];this.attachedIframes.forEach((t,i)=>{this.mirror.has(i)||e.push(i)}),e.forEach(e=>this.removeIframeById(e))}reattachIframes(){this.attachedIframes.forEach(({content:e},t)=>{this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&yd(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{yd(t,"message",e)}),this.nestedIframeListeners.clear();const e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(({element:t})=>e.add(t)),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}},ph=class{constructor(e){bu(this,"shadowDoms",new WeakSet),bu(this,"mutationCb",void 0),bu(this,"scrollCb",void 0),bu(this,"bypassOptions",void 0),bu(this,"mirror",void 0),bu(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 i,s;if(!ku(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=null!==(i=null===(s=Vc.host(e))||void 0===s?void 0:s.ownerDocument)&&void 0!==i?i:t,{observer:r,buffer:o}=eh(at(at({},this.bypassOptions),{},{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push({doc:n,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const e=Jd.indexOf(o);-1!==e&&Jd.splice(e,1)}}),this.restoreHandlers.push({doc:n,handler:th(at(at({},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(Vc.host(e))),this.restoreHandlers.push({doc:n,handler:ah({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){const i=this;this.restoreHandlers.push({doc:t,handler:jc(e.prototype,"attachShadow",function(e){return function(s){const n=e.call(this,s),r=Vc.shadowRoot(this);return r&&qd(this)&&i.addShadowRoot(r,t),n}})})}reset(){this.restoreHandlers.forEach(({handler:e})=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){const t=[];for(const i of this.restoreHandlers)if(i.doc===e)try{i.handler()}catch(e){}else t.push(i);this.restoreHandlers=t}},_h="skip-frame";function gh(e){if("object"!=typeof e||null===e)return!1;const{x:t,y:i,width:s,height:n}=e;return Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(n)&&s>=0&&n>=0}for(var fh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),mh=0;64>mh;mh++)vh[fh.charCodeAt(mh)]=mh;var yh=function(e){var t,i=new Uint8Array(e),s=i.length,n="";for(t=0;s>t;t+=3)n+=fh[i[t]>>2],n+=fh[(3&i[t])<<4|i[t+1]>>4],n+=fh[(15&i[t+1])<<2|i[t+2]>>6],n+=fh[63&i[t+2]];return s%3==2?n=n.substring(0,n.length-1)+"=":s%3==1&&(n=n.substring(0,n.length-2)+"=="),n},bh=new Map,Sh=(e,t,i)=>{if(!e||!Ch(e,t)&&"object"!=typeof e)return;const s=function(e,t){let i=bh.get(e);return i||(i=new Map,bh.set(e,i)),i.has(t)||i.set(t,[]),i.get(t)}(i,e.constructor.name);let n=s.indexOf(e);return-1===n&&(n=s.length,s.push(e)),n};function wh(e,t,i,s){if(e instanceof Array)return e.map(e=>wh(e,t,i,s));if(null===e)return e;if(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)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:yh(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[wh(e.buffer,t,i,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:i}=e;return{rr_type:t,src:i}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(s.type,s.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[wh(e.data,t,i,s),e.width,e.height]}:Ch(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:Sh(e,t,i)}:e}var kh=(e,t,i,s)=>e.map(e=>wh(e,t,i,s)),Ch=(e,t)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(i.find(i=>e instanceof t[i]))},Eh=["webgl","webgl2"];function xh(e){return"nodeType"in e}function Th(e,t,i,s){const n=[];try{if(s){const s=function(e,t,i){const s=e.GPUCanvasContext;if((null==s?void 0:s.prototype)&&"function"==typeof s.prototype.configure)return jc(s.prototype,"configure",function(s){return function(n){const r=function(e){const{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!r||xh(r)&&Md(r,t,i,!0))return s.call(this,n);xh(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(e){const t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return s.call(this,null!==o&&n?at(at({},n),{},{usage:"number"==typeof n.usage?n.usage|o:o}):n)}})}(e,t,i);s&&n.push(s)}const r=jc(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...r){const o=function(e){return"experimental-webgl"===e?"webgl":e}(n);if(!Md(this,t,i,!0)&&("__context"in this||(this.__context=o),s&&Eh.includes(o)))if(r[0]&&"object"==typeof r[0]){const e=r[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[n,...r])}});n.push(r)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function Ih(e,t,i,s,n,r,o){const a=[],l=Object.getOwnPropertyNames(e);for(const c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const l=jc(e,c,function(e){return function(...a){const l=e.apply(this,a);if(Sh(l,r,this),this.canvas&&"tagName"in this.canvas&&!Md(this.canvas,s,n,!0)){const e=kh(a,r,this,o);i(this.canvas,{type:t,property:c,args:e})}return l}});a.push(l)}catch(r){const o=Ed(e,c,{set(e){this.canvas&&"tagName"in this.canvas&&!Md(this.canvas,s,n,!0)&&i(this.canvas,{type:t,property:c,args:[e],setter:!0})}});a.push(o)}return a}var Rh='(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',Ph="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Rh],{type:"text/javascript;charset=utf-8"});function Mh(e){let t;try{if(t=Ph&&(self.URL||self.webkitURL).createObjectURL(Ph),!t)throw"";const i=new Worker(t,{name:null==e?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Rh),{name:null==e?void 0:e.name})}}var Fh,Lh,Ah,Oh=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){bu(this,"pendingCanvasMutations",new Map),bu(this,"rafStamps",{latestId:0,invokeId:null}),bu(this,"mirror",void 0),bu(this,"mutationCb",void 0),bu(this,"resetObservers",void 0),bu(this,"frozen",!1),bu(this,"locked",!1),bu(this,"rafIdTimestamp",null),bu(this,"rafIdFlush",null),bu(this,"refCount",0),bu(this,"torndown",!1),bu(this,"resetFrameDedup",null),bu(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)});const{sampling:t="all",win:i,blockClass:s,blockSelector:n,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&"all"===t&&this.initCanvasMutationObserver(i,s,n,o),r&&"number"==typeof t&&this.initCanvasFPSObserver(t,i,s,n,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(e,t,i,s,n){var r=this;if(!("OffscreenCanvas"in t))return;const o="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,a=Th(t,i,s,!0),l=new Map;let c;try{c=new Mh}catch(e){return}let u=!1;c.onerror=()=>{var e;u=!0,cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=e=>{const{id:t}=e.data;if(l.set(t,!1),!("base64"in e.data))return;const{base64:i,type:s,displayWidth:n,displayHeight:r}=e.data;this.mutationCb({id:t,type:Mc["2D"],commands:[{property:"clearRect",args:[0,0,n,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:s}]},0,0,n,r]}],displayWidth:n,displayHeight:r})};const d=1e3/e;let h,p=0;const _=e=>{var a;u||(p&&d>e-p||(p=e,(()=>{const e=[],n=t=>{try{t.querySelectorAll("canvas").forEach(t=>{Md(t,i,s,!0)||e.push(t)}),t.querySelectorAll("*").forEach(e=>{e.shadowRoot&&n(e.shadowRoot)})}catch(e){}};return n(t.document),e})().forEach((a=st(function*(e){const t=r.mirror.getId(e);if(!l.get(t)&&0!==e.width&&0!==e.height){l.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var i,s;const n=e.getContext(e.__context);if(null==n||null===(i=n.isContextLost)||void 0===i?void 0:i.call(n))return void l.set(t,!1);!1===(null==n||null===(s=n.getContextAttributes())||void 0===s?void 0:s.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=e.clientWidth||e.width,a=e.clientHeight||e.height,u=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),h=function(e,t,i,s,n,r){if(!e||"function"!=typeof e.regionsFn)return;let o;try{o=e.regionsFn(t)}catch(e){return _h}if(void 0===o)return;if(!Array.isArray(o)||!o.every(gh))return _h;const a=i/n,l=s/r;return o.filter(e=>e.width>0&&e.height>0).map(e=>{const t=Math.floor(e.x*a),i=Math.floor(e.y*l);return{x:t,y:i,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-i}})}(n.canvasMasking,e,u,d,r,a);if("skip-frame"===h)return void l.set(t,!1);const p=yield createImageBitmap(e,1>o?{resizeWidth:u,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:u,resizeHeight:d});c.postMessage({id:t,bitmap:p,width:u,height:d,displayWidth:r,displayHeight:a,dataURLOptions:n.dataURLOptions,maskRegions:h},[p])}catch(e){l.set(t,!1)}}}),function(e){return a.apply(this,arguments)}))),h=requestAnimationFrame(_))};h=requestAnimationFrame(_),this.resetObservers=()=>{var e;a(),cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(e,t,i,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=Th(e,t,i,!1),r=function(e,t,i,s,n){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=jc(t.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return Md(this.canvas,i,s,!0)||setTimeout(()=>{const i=kh(o,t,this,n);e(this.canvas,{type:Mc["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(n){const o=Ed(t.CanvasRenderingContext2D.prototype,a,{set(t){Md(this.canvas,i,s,!0)||e(this.canvas,{type:Mc["2D"],property:a,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s),o=function(e,t,i,s,n){const r=[];return void 0!==t.WebGLRenderingContext&&r.push(...Ih(t.WebGLRenderingContext.prototype,Mc.WebGL,e,i,s,t,n)),void 0!==t.WebGL2RenderingContext&&r.push(...Ih(t.WebGL2RenderingContext.prototype,Mc.WebGL2,e,i,s,t,n)),()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s);this.resetObservers=()=>{n(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||-1===t)return;const s=i.map(e=>cn(e,xc)),{type:n}=i[0];this.mutationCb({id:t,type:n,commands:s}),this.pendingCanvasMutations.delete(e)}},$h=class{constructor(e){var t;bu(this,"trackedLinkElements",new WeakSet),bu(this,"pendingDeferredSheets",new Set),bu(this,"mutationCb",void 0),bu(this,"adoptedStyleSheetCb",void 0),bu(this,"maskAllElementAttributes",void 0),bu(this,"maskAttributeFn",void 0),bu(this,"styleMirror",new Nd),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;let i=null,s=null;try{s=e.sheet,s&&(i=Au(s))}catch(e){}if(!i||!s)return vu(),null;const n=i;let r=!1;const o={sheet:s,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=Gc(),c=Zc();let u=!0;try{if(r)return a=!0,vu(),!0;if(!n.advance(i))return u=!1,!1;a=!0;const o=n.text();if(!e.isConnected)return!0;let l=null;try{l=e.sheet}catch(e){}return l!==s?(vu(),!0):o?(this.emitCssTextMutation(e,t,o),!0):(vu(),!0)}finally{u&&this.pendingDeferredSheets.delete(o),Yc(d=Gc()-l,null!=(h=c)?h:Qc)||(lu.totalMs+=d,d>lu.slowestSliceMs&&(lu.slowestSliceMs=d))}var d,h},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(const t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var i;null===(i=this.beginDeferredLinkInlining(e,t))||void 0===i||i.advance(1/0)}emitCssTextMutation(e,t,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:Bu({element:e,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const i={id:t,styleIds:[]},s=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{const i=this.styleMirror.add(t);e=i;const n=Gc();try{pu(()=>{try{const e=t.rules||t.cssRules;e&&hu(e)}catch(e){}s.push({styleId:i,rules:Array.from(t.rules||CSSRule,(e,i)=>({rule:Iu(e,t.href),index:i}))})})}finally{_u(Gc()-n)}}i.styleIds.push(e)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),ud.forEach(e=>e.abort()),ud.clear()}trackStylesheetInLinkElement(e){}},Dh=class{constructor(){bu(this,"nodeMap",new WeakMap),bu(this,"active",!1)}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).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(){}},Nh=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var Bh;const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null===(Bh=e.contentWindow)||void 0===Bh?void 0:Bh.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var qh=new Ou,Hh=new Set([Ic.Mutation,Ic.MediaInteraction,Ic.StyleSheetRule,Ic.CanvasMutation,Ic.Font,Ic.Log,Ic.StyleDeclaration,Ic.AdoptedStyleSheet]);function Uh(e){const t=window;if("function"==typeof t.requestIdleCallback){const i=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,i)}}}const i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function Wh(e={}){let t;const{emit:i,checkoutEveryNms:s,checkoutEveryNth:n,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,inlineStylesheetBudgetRules:h,maskAllInputs:p,maskInputOptions:_,slimDOMOptions:g,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m=!1,maskAttributeFn:y,hooks:b,packFn:S,sampling:w={},dataURLOptions:k={},canvasResolutionScale:C,canvasMasking:E,mousemoveWait:x,recordDOM:T=!0,recordCanvas:I=!1,recordCrossOriginIframes:R=!1,recordAfter:P=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:M=!1,collectFonts:F=!1,inlineImages:L=!1,plugins:A,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:D=new Set([]),attributeFilter:N,errorHandler:B}=e;Kd(B);const q=at({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},k),H=!R||window.parent===window;let U=!1;if(!H)try{window.parent.document&&(U=!1)}catch(e){U=!0}if(H&&!i)throw new Error("emit function is required");if(!H&&!U)return()=>{};void 0!==x&&void 0===w.mousemove&&(w.mousemove=x),qh.reset();const W=!0===p?{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!==_?_:{password:!0},z=fd(void 0!==g&&g);let j;!function(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)}();let V=0;const G=new Map;let Q,K;const Z=e=>{for(const t of A||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!U&&(e=S(e)),e};Fh=(e,t)=>{var r;const o=e;if(o.timestamp=xd(),!(null===(r=Jd[0])||void 0===r?void 0:r.isFrozen())||o.type===Tc.FullSnapshot||o.type===Tc.IncrementalSnapshot&&Hh.has(o.data.source)||Jd.forEach(e=>e.unfreeze()),H)null==i||i(Z(o),t);else if(U){const e={type:"rrweb",event:Z(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(e,"*")}if(o.type===Tc.FullSnapshot)j=o,V=0;else if(o.type===Tc.IncrementalSnapshot){if(o.data.source===Ic.Mutation&&o.data.isAttachIframe)return;V++,(n&&V>=n||s&&o.timestamp-j.timestamp>s)&&Lh(!0)}};const Y=e=>{if(e.removes&&e.removes.length>0){const t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,i=new Set;if(e.adds.length>0)for(const t of e.adds){const e=qh.getNode(t.node.id);e&&"IFRAME"===e.nodeName&&i.add(e)}e.removes.forEach(({id:e})=>{if(t&&t.has(e))return;const s=te.getIframeElementById(e);s&&i.has(s)?te.forgetIframeId(e):(null==Q||Q(e),te.removeIframeById(e))}),null==K||K(),te.cleanupDetachedIframes()}Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Mutation},e)})},J=e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Scroll},e)}),X=e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.CanvasMutation},e)}),ee=new $h({mutationCb:Y,adoptedStyleSheetCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.AdoptedStyleSheet},e)}),maskAllElementAttributes:m,maskAttributeFn:y}),te=new hh({mirror:qh,mutationCb:Y,stylesheetManager:ee,recordCrossOriginIframes:R,wrappedEmit:Fh});for(const e of A||[])e.getMirror&&e.getMirror({nodeMirror:qh,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const ie=new Dh,se=null==E?void 0:E.configured;Ah=new Oh({recordCanvas:I,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:qh,sampling:w.canvas,dataURLOptions:q,resolutionScale:C,canvasMasking:E});const ne=new ph({mutationCb:Y,scrollCb:J,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:W,dataURLOptions:q,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,recordCanvas:I,canvasMaskingConfigured:se,inlineImages:L,sampling:w,slimDOMOptions:z,iframeManager:te,stylesheetManager:ee,canvasManager:Ah,keepIframeSrcFn:O,processedNodeManager:ie,attributeFilter:N},mirror:qh});Lh=(e=!1)=>{if(T){cu(h);try{Fh({type:Tc.Meta,data:{href:window.location.href,width:Rd(),height:Id()}},e),null==t||t.cancel(),t=void 0,ee.reset(),ne.init(),Jd.forEach(e=>e.lock());let i=null,s=[];try{i=function(e,t){const{mirror:i=new Ou,blockClass:s="rr-block",blockSelector:n=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,canvasMaskingConfigured:u,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_=!1,maskAttributeFn:g,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:E=()=>!1,maxDepth:x,inlineStylesheetBudgetRules:T}=t||{},I=!0===d?{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===d?{password:!0}:d,R=fd(f);cu(T);try{return gd(e,{doc:e,mirror:i,blockClass:s,blockSelector:n,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:I,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_,maskAttributeFn:g,slimDOMOptions:R,dataURLOptions:v,inlineImages:l,recordCanvas:c,canvasMaskingConfigured:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:E,newlyAddedElement:!1,maxDepth:x})}finally{uu()}}(document,{mirror:qh,blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:W,inlineStylesheetBudgetRules:h,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,slimDOM:z,dataURLOptions:q,recordCanvas:I,canvasMaskingConfigured:se,inlineImages:L,onSerialize(e){Od(e,qh)&&te.addIframe(e),$d(e,qh)&&ee.trackLinkElement(e),Dd(e)&&ne.addShadowRoot(Vc.shadowRoot(e),document)},onIframeLoad(e,t){te.attachIframe(e,t),ne.observeAttachShadow(e)},onIframeListenerRegistered(e,t){te.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){ee.attachLinkElement(e,t)},keepIframeSrcFn:O})}finally{s=fu()}if(!i)return console.warn("Failed to snapshot the document");if(Fh({type:Tc.FullSnapshot,data:{node:i,initialOffset:Td(window)}},e),Jd.forEach(e=>e.unlock()),Ah.onFullSnapshot(),s.length){const e=function(e,t,i){let s=!1,n=null,r=0,o=null;const a=()=>null!==o||e.length>r,l=()=>{const i=e[r];e[r]=null,r+=1,i&&bd(()=>{o=t.beginDeferredLinkInlining(i,qh.getId(i))})},c=()=>{if(!o)return;const e=o;let t=!0;bd(()=>{t=e.advance(200)}),t&&(o=null)},u=()=>{o||l(),c()},d=e=>{if(n=null,s)return;let t=0;do{try{u()}catch(e){null==o||o.discard(),o=null,mu(1)}t+=1}while(!s&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));s||(a()?n=Uh(d):i())};return n=Uh(d),{cancel(){s=!0,null==o||o.discard(),o=null,null==n||n.cancel(),n=null},flush(){if(s)return;s=!0,null==n||n.cancel(),n=null;let t=0,u=0;for(;a()&&50>t;){o||l();const e=o;if(e)if(Math.floor(e.remainingRules()/200)+1>50-t)e.discard(),o=null,u+=1;else{try{c()}catch(e){null==o||o.discard(),o=null,u+=1}t+=1}}if(a()||u>0){let t=u+(null!==o?1:0);for(let i=r;e.length>i;i++)null!==e[i]&&(t+=1);mu(t),null==o||o.discard(),o=null}i()}}}(s,ee,()=>{t===e&&(t=void 0)});t=e}R&&te.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,qh.getId(document))}finally{uu()}}};try{const e=[];e.push(md("pagehide",()=>{try{null==t||t.flush()}catch(e){}t=void 0},window));for(const t of["visibilitychange","freeze","resume"])e.push(md(t,Kc,document));Q=t=>{const i=G.get(t);i&&(i.forEach(t=>{bd(t);const i=e.indexOf(t);-1!==i&&e.splice(i,1)}),G.delete(t))},K=()=>{for(const[e]of G){const t=qh.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==Q||Q(e)}catch(t){null==Q||Q(e)}else null==Q||Q(e)}};const i=e=>{var t;return Yd(lh)({mutationCb:Y,mousemoveCb:(e,t)=>Fh({type:Tc.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.MouseInteraction},e)}),scrollCb:J,viewportResizeCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.ViewportResize},e)}),inputCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Input},e)}),mediaInteractionCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.MediaInteraction},e)}),styleSheetRuleCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.StyleSheetRule},e)}),styleDeclarationCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.StyleDeclaration},e)}),canvasMutationCb:X,fontCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Font},e)}),selectionCb(e){Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Selection},e)})},customElementCb(e){Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.CustomElement},e)})},blockClass:r,ignoreClass:a,ignoreSelector:l,maskTextClass:c,maskTextSelector:u,maskInputOptions:W,inlineStylesheet:d,sampling:w,recordDOM:T,recordCanvas:I,canvasMaskingConfigured:se,inlineImages:L,userTriggeredOnInput:M,collectFonts:F,doc:e,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m,maskAttributeFn:y,keepIframeSrcFn:O,blockSelector:o,slimDOMOptions:z,dataURLOptions:q,mirror:qh,iframeManager:te,stylesheetManager:ee,shadowDomManager:ne,processedNodeManager:ie,canvasManager:Ah,ignoreCSSAttributes:D,attributeFilter:N,plugins:(null==A||null===(t=A.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Fh({type:Tc.Plugin,data:{plugin:e.name,payload:t}})})))||[]},b)};te.addLoadListener(t=>{try{const s=qh.getId(t),n=i(t.contentDocument);if("function"==typeof n&&(e.push(n),-1!==s)){let e=G.get(s);e||(e=new Set,G.set(s,e)),e.add(n)}}catch(e){console.warn(e)}}),te.addPageHideListener(e=>{const t=qh.getId(e);null==Q||Q(t),ih(e)});let s=-1;const n=e=>Fh({type:Tc.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),h=()=>{var e,t,i,r;const o=document,a=null!==(e=null!==(t=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==t?t:o.msFullscreenElement)&&void 0!==e?e:null,l=a?qh.getId(a):-1;l!==s&&(-1!==s&&n({id:s,enter:!1}),s=l,-1!==l&&n({id:l,enter:!0}))},p=()=>{Lh();const t=i(document);"function"==typeof t&&e.push(t),e.push(md("fullscreenchange",h)),e.push(md("webkitfullscreenchange",h)),e.push(md("mozfullscreenchange",h)),e.push(md("MSFullscreenChange",h)),Nh=!0};return["interactive","complete"].includes(document.readyState)?p():(e.push(md("DOMContentLoaded",()=>{Fh({type:Tc.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&p()})),e.push(md("load",()=>{Fh({type:Tc.Load,data:{}}),"load"===P&&p()},window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Sd(e),ie.destroy(),te.removeLoadListener(),te.destroy(),G.clear(),ne.reset(),qh.reset(),Nh=!1,Zd()}}catch(e){console.warn(e)}}Wh.addCustomEvent=(e,t)=>{if(!Nh)throw new Error("please add custom event after start recording");Fh({type:Tc.Custom,data:{tag:e,payload:t}})},Wh.freezePage=()=>{Jd.forEach(e=>e.freeze())},Wh.takeFullSnapshot=e=>{if(!Nh)throw new Error("please take full snapshot after start recording");Lh(e)},Wh.mirror=qh,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var zh=Object.create(null);function jh(e){return jh="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},jh(e)}function Vh(e,t,i){return(t=function(e){var t=function(e){if("object"!=jh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=jh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}zh.Node=Object.create(null),zh.ShadowRoot=Object.create(null),zh.MutationObserver=Object.create(null),zh.Element=Object.create(null);var Gh=class{constructor(e){Vh(this,"fileName",void 0),Vh(this,"functionName",void 0),Vh(this,"lineNumber",void 0),Vh(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}},Qh=/(^|@)\S+:\d+/,Kh=/^\s*at .*(\S+:\d+|\(native\))/m,Zh=/^(eval@)?(\[native code])?$/,Yh={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Kh)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];const 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(Kh)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=i?t.replace(i[0],""):t;const s=t.split(/\s+/).slice(1),n=this.extractLocation(i?i[1]:s.pop());return new Gh({functionName:s.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0],lineNumber:n[1],columnNumber:n[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(Zh)},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 Gh({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(t),s=i&&i[1]?i[1]:void 0,n=this.extractLocation(e.replace(t,""));return new Gh({functionName:s,fileName:n[0],lineNumber:n[1],columnNumber:n[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){const t=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),s=[];for(let e=2,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new Gh({fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera10(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),s=[];for(let e=0,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new Gh({functionName:n[3]||void 0,fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(Qh)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),i=this.extractLocation(t.pop());return new Gh({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function Jh(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let i=e.localName;if(!i)break;i=i.toLowerCase();const s=e.parentElement,n=[];if(s.children&&s.children.length>0)for(let e=0;s.children.length>e;e++){const t=s.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===i&&n.push(t)}n.length>1&&(i+=`:eq(${n.indexOf(e)})`),t=i+(t?">"+t:""),e=s}return t}function Xh(e){return Array.isArray(e)}function ep(e){return"object"==typeof e&&null!==e&&!Xh(e)}function tp(e,t){if(0===t)return!0;const i=Object.keys(e);for(const s of i)if(ep(e[s])&&tp(e[s],t-1))return!0;return!1}function ip(e,t){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,t);const s=[],n=[];return JSON.stringify(e,function(e,t){if(s.length>0){const i=s.indexOf(this);~i?s.splice(i+1):s.push(this),~i?n.splice(i,1/0,e):n.push(e),~s.indexOf(t)&&(t=s[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,s.indexOf(t)).join(".")+"]")}else s.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(ep(r=t)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||ep(r)&&tp(r,i.depthOfLimit))return function(e){let t=e.toString();return i.stringLengthLimit&&t.length>i.stringLengthLimit&&(t=`${t.slice(0,i.stringLengthLimit)}...`),t}(t);var r;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const i in t){const s=t[i];e[i]=Xh(s)?Jh(s.length?s[0]:null):s}return e}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 sp={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 np(e,t,i){const s=i?Object.assign({},sp,i):sp,n=s.logger;if(!n)return()=>{};let r;r="string"==typeof n?t[n]:n;let o=0,a=!1;const l=[];if(s.level.includes("error")){const i=t=>{const i=t.message;e({level:"error",trace:Yh.parse(t.error).map(e=>e.toString()),payload:[ip(i,s.stringifyOptions)]})};t.addEventListener("error",i),l.push(()=>{t.removeEventListener("error",i)});const n=t=>{let i,n;t.reason instanceof Error?(i=t.reason,n=[ip(`Uncaught (in promise) ${i.name}: ${i.message}`,s.stringifyOptions)]):(i=new Error,n=[ip("Uncaught (in promise)",s.stringifyOptions),ip(t.reason,s.stringifyOptions)]),e({level:"error",trace:Yh.parse(i).map(e=>e.toString()),payload:n})};t.addEventListener("unhandledrejection",n),l.push(()=>{t.removeEventListener("unhandledrejection",n)})}for(const e of s.level)l.push(c(r,e));return()=>{l.forEach(e=>e())};function c(t,i){return t[i]?function(e,t,i){try{if(!(t in e))return()=>{};const s=e[t],n={next:s},r=i(function(...e){return n.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=n.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let s=e[t],o=i(s);for(;o;){if(o.next===r)return void(o.next=n.next);s=o.next,o=i(s)}}}catch(e){return()=>{}}}(t,i,t=>(...n)=>{if(t.apply(this,n),!("assert"===i&&n[0]||a)){a=!0;try{const t=Yh.parse(new Error).map(e=>e.toString()).splice(1),r=("assert"===i?n.slice(1):n).map(e=>ip(e,s.stringifyOptions));o++,s.lengthThreshold>o?e({level:i,trace:t,payload:r}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[ip("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...n)}finally{a=!1}}}):()=>{}}}var rp=e=>({name:"rrweb/console@1",observer:np,options:e});const op=()=>{},ap=e=>{var t;if(wt(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function lp(e,t,i){try{if(!(t in e))return op;const s={next:e[t]},n=i(function(...e){return s.next.apply(this,e)});return wt(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let i=e[t],r=ap(i);for(;r;){if(r.next===n)return void(r.next=s.next);i=r.next,r=ap(i)}}}catch(e){return op}}function cp(e,t){var i;const s=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),n={hostname:s,isHostDenied:!1};if(!(null===(i=t.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==s?void 0:s.trim().length))return n;for(const e of t.payloadHostDenyList)if(s.endsWith(e))return{hostname:s,isHostDenied:!0};return n}const up=Ln("[Recorder]"),dp=e=>"navigation"===e.entryType,hp=e=>"resource"===e.entryType;function pp(e,t){return!!t&&(Ft(t)||t[e])}function _p(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}const gp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function fp({type:e,recordBody:t,headers:i,url:s}){function n(e){const t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),s=t&&i[t];return e.some(e=>null==s?void 0:s.toLowerCase().includes(e))}if(!t)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!_p(t)&&e(t.url)}catch(e){return!1}}(s))return!1;if(n(gp))return!1;if(Ft(t))return!0;if(St(t))return n(t);const r=t[e];return Ft(r)?r:n(r)}function vp(e,t,i,s,n){return mp.apply(this,arguments)}function mp(){return mp=st(function*(e,t,i,s,n,r=0){if(r>10)return up.warn("Failed to get performance entry for request",{url:i,initiatorType:t}),null;const o=function(e,t){for(let i=e.length-1;i>=0;i-=1)if(t(e[i]))return e[i]}(e.performance.getEntriesByName(i),e=>hp(e)&&e.initiatorType===t&&(Et(s)||e.startTime>=s)&&(Et(n)||n>=e.startTime));return o||(yield new Promise(e=>setTimeout(e,50*r)),vp(e,t,i,s,n,r+1))}),mp.apply(this,arguments)}function yp({body:e,options:t,url:i}){if(Rt(e))return null;const{hostname:s,isHostDenied:n}=cp(i,t);if(n)return s+" is in deny list";if(xt(e))return e;if((e=>"u">typeof Document&&e instanceof Document)(e))return e.textContent;if(Lt(e))return Kn(e);if(kt(e))try{return JSON.stringify(e)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}const bp=e=>!It(e)&&("navigation"===e.entryType||"resource"===e.entryType);function Sp({entry:e,method:t,status:i,networkRequest:s,isInitial:n,start:r,end:o,url:a,initiatorType:l}){r=e?e.startTime:r,o=e?e.responseEnd:o;const c=Math.floor(Date.now()-performance.now()),u=Math.floor(c+(r||0)),d=[at(at({},e?e.toJSON():{name:a}),{},{startTime:Et(r)?void 0:Math.round(r),endTime:Et(o)?void 0:Math.round(o),timeOrigin:c,timestamp:u,method:t,initiatorType:l||(e?e.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:n})];if(bp(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:u,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const wp=["video/","audio/"];function kp(e){return kt(e)&&wt(e.getReader)&&wt(e.tee)}const Cp="[SessionReplay] Timeout while trying to read body",Ep="[SessionReplay] Failed to read body";function xp(e){return`${Ep}: ${e}`}function Tp(e){return`[SessionReplay] Body too large to record (> ${e} bytes)`}function Ip(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{const i=setTimeout(()=>t(Cp),500);try{e.clone().text().then(e=>t(e),e=>t(xp(e))).finally(()=>clearTimeout(i))}catch(e){clearTimeout(i),t(Ep)}})}(e);const i=zr(t);return function(e,t){try{var i,s;const n=null===(i=e.headers)||void 0===i||null===(s=i.get)||void 0===s?void 0:s.call(i,"content-length");if(!n)return!1;const r=parseInt(n,10);return Number.isFinite(r)&&r>t}catch(e){return!1}}(e,i)?Promise.resolve(Tp(i)):function(e,t){return new Promise(i=>{let s,n=!1;function r(){try{null==s||s.cancel().catch(()=>{})}catch(e){}}function o(e){n||(n=!0,clearTimeout(a),r(),i(e))}const a=setTimeout(()=>o(Cp),500);let l;try{l=e.clone()}catch(e){return void o(Ep)}const c=l.body;if(!kp(c)||"undefined"==typeof TextDecoder){try{l.text().then(e=>o(e),e=>o(xp(e)))}catch(e){o(Ep)}return}try{s=c.getReader()}catch(e){return void o(Ep)}const u=[];let d=0;!function e(){s.read().then(({done:i,value:s})=>{if(n)r();else if(i)o((new TextDecoder).decode(function(e,t){const i=new Uint8Array(t);let s=0;for(const t of e)i.set(t,s),s+=t.byteLength;return i}(u,d)));else{if(s){if(d+s.byteLength>t)return void o(Tp(t));d+=s.byteLength,u.push(s)}e()}},e=>o(xp(e)))}()})}(e,i)}function Rp(){return Rp=st(function*({r:e,options:t,url:i}){const{hostname:s,isHostDenied:n}=cp(i,t);return n?Promise.resolve(s+" is in deny list"):Ip(e,t)}),Rp.apply(this,arguments)}function Pp(){return Pp=st(function*({r:e,options:t,url:i}){const s=function({r:e,options:t,url:i}){var s;if("chunked"===e.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const n=null===(s=e.headers.get("Content-Type"))||void 0===s?void 0:s.toLowerCase(),r=wp.some(e=>null==n?void 0:n.startsWith(e));if(n&&r)return`Content-Type ${n} is not supported`;const{hostname:o,isHostDenied:a}=cp(i,t);return a?o+" is in deny list":null}({r:e,options:t,url:i});return It(s)?Ip(e,t):Promise.resolve(s)}),Pp.apply(this,arguments)}let Mp=null;function Fp(e,t,i){if(!("performance"in t))return()=>{};if(Mp)return up.warn("Network observer already initialised, doing nothing"),()=>{};const s=i?Object.assign({},jr,i):jr,n=t=>{const i=[];let n=!1;t.requests.forEach(e=>{const t="serverTiming"===e.entryType;if(t&&n)return;const r=s.maskRequestFn(e);t||(n=!r||(e=>!!e&&Xr.has(e))(r)),r&&i.push(r)}),i.length>0&&e(at(at({},t),{},{requests:i}))},r=function(e,t,i){i.recordInitialRequests&&e({requests:t.performance.getEntries().filter(e=>dp(e)||hp(e)&&i.initiatorTypes.includes(e.initiatorType)).flatMap(e=>Sp({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const s=new t.PerformanceObserver(t=>{e({requests:t.getEntries().filter(e=>dp(e)||hp(e)&&i.initiatorTypes.includes(e.initiatorType)&&(e=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>Sp({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),n=PerformanceObserver.supportedEntryTypes.filter(e=>i.performanceEntryTypeToObserve.includes(e));return s.observe({entryTypes:n}),()=>{s.disconnect()}}(n,t,s);let o=()=>{},a=()=>{};return(s.recordHeaders||s.recordBody)&&(o=function(e,t,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const s=pp("request",i.recordHeaders),n=pp("response",i.recordHeaders),r=lp(t.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,c,u){const d=this;try{const r=new Request(a),l={};let c,u;const h={},p=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(h[e]=t,p(e,t)),s&&(l.requestHeaders=h);const _=d.send.bind(d);d.send=e=>(fp({type:"request",headers:h,url:a,recordBody:i.recordBody})&&(l.requestBody=yp({body:e,options:i,url:a})),c=t.performance.now(),_(e));const g=()=>{d.removeEventListener("readystatechange",f),d.removeEventListener("error",g),d.removeEventListener("abort",g),d.removeEventListener("timeout",g)},f=()=>{if(d.readyState!==d.DONE)return;g(),u=t.performance.now();const s={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),i=t.shift(),n=t.join(": ");i&&(s[i]=n)}),n&&(l.responseHeaders=s),fp({type:"response",headers:s,url:a,recordBody:i.recordBody})&&(l.responseBody=yp({body:d.response,options:i,url:a})),vp(t,"xmlhttprequest",r.url,c,u).then(t=>{e({requests:Sp({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:l,start:c,end:u,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};d.addEventListener("readystatechange",f),d.addEventListener("error",g),d.addEventListener("abort",g),d.addEventListener("timeout",g)}catch(e){up.error("Failed to instrument XHR for network capture",e)}r.call(d,o,a.toString(),l,c,u)});return()=>{r()}}(n,t,s),a=function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const s=pp("request",i.recordHeaders),n=pp("response",i.recordHeaders),r=lp(t,"fetch",r=>function(){var o=st(function*(o,a){let l,c;try{l=new Request(o,a)}catch(e){return up.error("Failed to instrument fetch for network capture",e),r(o,a)}const u={};let d,h;try{try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),s&&(u.requestHeaders=e),!kp(null==a?void 0:a.body)&&fp({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(u.requestBody=yield function(e){return Rp.apply(this,arguments)}({r:l,options:i,url:o}))}catch(e){up.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),c=_p(o)?yield r(l):yield r(o,a),h=t.performance.now();try{const e={};c.headers.forEach((t,i)=>{e[i]=t}),n&&(u.responseHeaders=e),fp({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield function(e){return Pp.apply(this,arguments)}({r:c,options:i,url:o}))}catch(e){up.error("Failed to record fetch response for network capture",e)}return c}finally{vp(t,"fetch",l.url,d,h).then(t=>{e({requests:Sp({entry:t,method:l.method,status:null==c?void 0:c.status,networkRequest:u,start:d,end:h,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{r()}}(n,t,s)),Mp=()=>{r(),o(),a(),Mp=null},Mp}const Lp=e=>({name:"rrweb/network@1",observer:Fp,options:e});var Ap,Op,$p,Dp,Np,Bp,qp,Hp,Up,Wp,zp,jp,Vp,Gp,Qp;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:rp,getRecordNetworkPlugin:Lp},h.__PosthogExtensions__.rrweb={record:Wh,version:"v2",wasMaxDepthReached:()=>_d,resetMaxDepthState(){_d=!1,pd=!1},getLastSnapshotCost:()=>iu,getMutationCost:()=>at({},au),resetSnapshotCostState(){Jc=0,Xc=0,eu=0,Qc=0,tu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},iu=null,su=null,nu=[],ru=0,ou=0,au={slowestBatchMs:0},lu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:Wh,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:rp},h.getRecordNetworkPlugin=Lp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new Ec(e,t);var Kp,Zp,Yp,Jp,Xp={},e_=[],t_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,i_=Array.isArray;function s_(e,t){for(var i in t)e[i]=t[i];return e}function n_(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function r_(e,t,i){var s,n,r,o={};for(r in t)"key"==r?s=t[r]:"ref"==r?n=t[r]:o[r]=t[r];if(arguments.length>2&&(o.children=arguments.length>3?Ap.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===o[r]&&(o[r]=e.defaultProps[r]);return o_(e,o,s,n,null)}function o_(e,t,i,s,n){var r={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++$p:n,__i:-1,__u:0};return null==n&&null!=Op.vnode&&Op.vnode(r),r}function a_(e){return e.children}function l_(e,t){this.props=e,this.context=t}function c_(e,t){if(null==t)return e.__?c_(e.__,e.__i+1):null;for(var i;e.__k.length>t;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?c_(e):null}function u_(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,s=[],n=[],r=s_({},t);r.__v=t.__v+1,Op.vnode&&Op.vnode(r),b_(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,s,null==i?c_(t):i,!!(32&t.__u),n),r.__v=t.__v,r.__.__k[r.__i]=r,w_(s,r,n),t.__e=t.__=null,r.__e!=i&&d_(r)}}function d_(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}),d_(e)}function h_(e){(!e.__d&&(e.__d=!0)&&Dp.push(e)&&!p_.__r++||Np!=Op.debounceRendering)&&((Np=Op.debounceRendering)||Bp)(p_)}function p_(){try{for(var e,t=1;Dp.length;)Dp.length>t&&Dp.sort(qp),e=Dp.shift(),t=Dp.length,u_(e)}finally{Dp.length=p_.__r=0}}function __(e,t,i,s,n,r,o,a,l,c,u){var d,h,p,_,g,f,v,m=s&&s.__k||e_,y=t.length;for(l=function(e,t,i,s,n){var r,o,a,l,c,u=i.length,d=u,h=0;for(e.__k=new Array(n),r=0;n>r;r++)null!=(o=t[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[r]=o_(null,o,null,null,null):i_(o)?o=e.__k[r]=o_(a_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[r]=o_(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[r]=o,l=r+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(c=o.__i=f_(o,i,l,d))&&(d--,(a=i[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(n>u?h--:u>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):e.__k[r]=null;if(d)for(r=0;u>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==s&&(s=c_(a)),E_(a,a));return s}(i,t,m,l,y),d=0;y>d;d++)null!=(p=i.__k[d])&&(h=-1!=p.__i&&m[p.__i]||Xp,p.__i=d,f=b_(e,p,h,n,r,o,a,l,c,u),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&C_(h.ref,null,p),u.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(v=!!(4&p.__u))||h.__k===p.__k?(l=g_(p,l,e,v),v&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==f?l=f:_&&(l=_.nextSibling),p.__u&=-7);return i.__e=g,l}function g_(e,t,i,s){var n,r;if("function"==typeof e.type){for(n=e.__k,r=0;n&&n.length>r;r++)n[r]&&(n[r].__=e,t=g_(n[r],t,i,s));return t}e.__e!=t&&(s&&(t&&e.type&&!t.parentNode&&(t=c_(e)),i.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function f_(e,t,i,s){var n,r,o,a=e.key,l=e.type,c=t[i],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return i;if(s>(u?1:0))for(n=i-1,r=i+1;n>=0||t.length>r;)if(null!=(c=t[o=0>n?r++:n--])&&!(2&c.__u)&&a==c.key&&l==c.type)return o;return-1}function v_(e,t,i){"-"==t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||t_.test(t)?i:i+"px"}function m_(e,t,i,s,n){var r,o;e:if("style"==t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof s&&(e.style.cssText=s=""),s)for(t in s)i&&t in i||v_(e.style,t,"");if(i)for(t in i)s&&i[t]==s[t]||v_(e.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(zp,"$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+r]=i,i?s?i[Wp]=s[Wp]:(i[Wp]=jp,e.addEventListener(t,r?Gp:Vp,r)):e.removeEventListener(t,r?Gp:Vp,r);else{if("http://www.w3.org/2000/svg"==n)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==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==i?"":i))}}function y_(e){return function(t){if(this.l){var i=this.l[t.type+e];if(null==t[Up])t[Up]=jp++;else if(i[Wp]>t[Up])return;return i(Op.event?Op.event(t):t)}}}function b_(e,t,i,s,n,r,o,a,l,c){var u,d,h,p,_,g,f,v,m,y,$,b,S,w,k,C,E=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(u=Op.__b)&&u(t);e:if("function"==typeof E){d=o.length;try{if(m=t.props,y=E.prototype&&E.prototype.render,$=(u=E.contextType)&&s[u.__c],b=u?$?$.props.value:u.__:s,i.__c?v=(h=t.__c=i.__c).__=h.__E:(y?t.__c=h=new E(m,b):(t.__c=h=new l_(m,b),h.constructor=E,h.render=x_),$&&$.sub(h),h.state||(h.state={}),h.__n=s,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=s_({},h.__s)),s_(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==i.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=i.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(e){e&&(e.__=t)}),e_.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,f)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=Op.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),e_.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(s=s_(s_({},s),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(f=h.getSnapshotBeforeUpdate(_,g)),k=null!=u&&u.type===a_&&null==u.key?k_(u.props.children):u,a=__(e,i_(k)?k:[k],t,i,s,n,r,o,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),t.__e=a}else{if(null!=r)for(C=r.length;C--;)n_(r[C]);S_(t)}else t.__e=i.__e,!t.__k&&i.__k&&(t.__k=i.__k),e.then||S_(t);Op.__e(e,t,i)}}else null==r&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=function(e,t,i,s,n,r,o,a,l){var c,u,d,h,p,_,g,f=i.props||Xp,v=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;r.length>c;c++)if((p=r[c])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null==m)return document.createTextNode(v);e=document.createElementNS(n,m,v.is&&v),a&&(Op.__m&&Op.__m(t,r),a=!1),r=null}if(null==m)f===v||a&&e.data==v||(e.data=v);else{if(r="textarea"==m&&null!=v.defaultValue?null:r&&Ap.call(e.childNodes),!a&&null!=r)for(f={},c=0;e.attributes.length>c;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"dangerouslySetInnerHTML"==c?d=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||m_(e,c,null,p,n);for(c in v)p=v[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?_=p:"checked"==c?g=p:a&&"function"!=typeof p||f[c]===p||m_(e,c,p,f[c],n);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),__("template"==t.type?e.content:e,i_(h)?h:[h],t,i,s,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,r,o,r?r[0]:i.__k&&c_(i,0),a,l),null!=r)for(c=r.length;c--;)n_(r[c]);a&&"textarea"!=m||(c="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[c]||"progress"==m&&!_||"option"==m&&_!=f[c])&&m_(e,c,_,f[c],n),c="checked",null!=g&&g!=e[c]&&m_(e,c,g,f[c],n))}return e}(i.__e,t,i,s,n,r,o,l,c);return(u=Op.diffed)&&u(t),128&t.__u?void 0:a}function S_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(S_))}function w_(e,t,i){for(var s=0;i.length>s;s++)C_(i[s],i[++s],i[++s]);Op.__c&&Op.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Op.__e(e,t.__v)}})}function k_(e){return"object"!=typeof e||null==e||e.__b>0?e:i_(e)?e.map(k_):void 0!==e.constructor?null:s_({},e)}function C_(e,t,i){try{if("function"==typeof e){var s="function"==typeof e.__u;s&&e.__u(),s&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Op.__e(e,i)}}function E_(e,t,i){var s,n;if(Op.unmount&&Op.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||C_(s,null,t)),null!=(s=e.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(e){Op.__e(e,t)}s.base=s.__P=s.__n=null}if(s=e.__k)for(n=0;s.length>n;n++)s[n]&&E_(s[n],t,i||"function"!=typeof e.type);i||n_(e.__e),e.__c=e.__=e.__e=void 0}function x_(e,t,i){return this.constructor(e,i)}function T_(e,t,i){var s,n,r,o;t==document&&(t=document.documentElement),Op.__&&Op.__(e,t),n=(s="function"==typeof i)?null:i&&i.__k||t.__k,r=[],o=[],b_(t,e=(!s&&i||t).__k=r_(a_,null,[e]),n||Xp,Xp,t.namespaceURI,!s&&i?[i]:n?null:t.firstChild?Ap.call(t.childNodes):null,r,!s&&i?i:n?n.__e:t.firstChild,s,o),w_(r,e,o),e.props.children=null}Ap=e_.slice,Op={__e(e,t,i,s){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,s||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},$p=0,l_.prototype.setState=function(e,t){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=s_({},this.state);"function"==typeof e&&(e=e(s_({},i),this.props)),e&&s_(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),h_(this))},l_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),h_(this))},l_.prototype.render=a_,Dp=[],Bp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qp=function(e,t){return e.__v.__b-t.__v.__b},p_.__r=0,Hp=Math.random().toString(8),Up="__d"+Hp,Wp="__a"+Hp,zp=/(PointerCapture)$|Capture$/i,jp=0,Vp=y_(!1),Gp=y_(!0),Qp=0;var I_=0,R_=[],P_=Op,M_=P_.__b,F_=P_.__r,L_=P_.diffed,A_=P_.__c,O_=P_.unmount,$_=P_.__;function D_(e,t){P_.__h&&P_.__h(Zp,e,I_||t),I_=0;var i=Zp.__H||(Zp.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function N_(e){return I_=1,function(e,t){var i=D_(Kp++,2);if(i.t=e,!i.__c&&(i.__=[K_(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],s=i.t(t,e);t!==s&&(i.__N=[s,i.__[1]],i.__c.setState({}))}],i.__c=Zp,!Zp.__f)){var s=function(e,t,s){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==e;if(i.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),n){var a=n.call(this,e,t,s);return r?a||o:a}return!r||o};Zp.__f=!0;var n=Zp.shouldComponentUpdate,r=Zp.componentWillUpdate;Zp.componentWillUpdate=function(e,t,i){if(this.__e){var o=n;n=void 0,s(e,t,i),n=o}r&&r.call(this,e,t,i)},Zp.shouldComponentUpdate=s}return i.__N||i.__}(K_,e)}function B_(e,t){var i=D_(Kp++,3);!P_.__s&&Q_(i.__H,t)&&(i.__=e,i.u=t,Zp.__H.__h.push(i))}function q_(e){return I_=5,H_(function(){return{current:e}},[])}function H_(e,t){var i=D_(Kp++,7);return Q_(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function U_(e){var t=Zp.context[e.__c],i=D_(Kp++,9);return i.c=e,t?(null==i.__&&(i.__=!0,t.sub(Zp)),t.props.value):e.__}function W_(){for(var e;e=R_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(V_),t.__h.some(G_),t.__h=[]}catch(i){t.__h=[],P_.__e(i,e.__v)}}}P_.__b=function(e){Zp=null,M_&&M_(e)},P_.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),$_&&$_(e,t)},P_.__r=function(e){F_&&F_(e),Kp=0;var t=(Zp=e.__c).__H;t&&(Yp===Zp?(t.__h=[],Zp.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&W_(),Kp=0)),Yp=Zp},P_.diffed=function(e){L_&&L_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==R_.push(t)&&Jp===P_.requestAnimationFrame||((Jp=P_.requestAnimationFrame)||j_)(W_)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),Yp=Zp=null},P_.__c=function(e,t){t.some(function(e){try{e.__h.some(V_),e.__h=e.__h.filter(function(e){return!e.__||G_(e)})}catch(i){t.some(function(e){e.__h&&(e.__h=[])}),t=[],P_.__e(i,e.__v)}}),A_&&A_(e,t)},P_.unmount=function(e){O_&&O_(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.some(function(e){try{V_(e)}catch(e){t=e}}),i.__H=void 0,t&&P_.__e(t,i.__v))};var z_="function"==typeof requestAnimationFrame;function j_(e){var t,i=function(){clearTimeout(s),z_&&cancelAnimationFrame(t),setTimeout(e)},s=setTimeout(i,35);z_&&(t=requestAnimationFrame(i))}function V_(e){var t=Zp,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),Zp=t}function G_(e){var t=Zp;e.__c=e.__(),Zp=t}function Q_(e,t){return!e||e.length!==t.length||t.some(function(t,i){return t!==e[i]})}function K_(e,t){return"function"==typeof t?t(e):t}const Z_={GZipJS:"gzip-js",Base64:"base64"},Y_={Activation:"events",Cancellation:"cancelEvents"},J_={Button:"button",Tab:"tab",Selector:"selector"},X_={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"},eg={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},tg={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ig={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},sg={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},ng={Once:"once",Recurring:"recurring",Always:"always"},rg={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},og={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"},ag={Popover:"popover",Inline:"inline"};function lg(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&wt(i.then)&&i.then(void 0,()=>{})}}}}const cg=Ln("[Surveys]"),ug="PostHog is not capturing, so a survey response cannot be recorded";function dg(e){return wt(e.is_capturing)?e.is_capturing():!e.has_opted_out_capturing()}function hg(e){return!(!e.start_date||e.end_date)}function pg(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const _g=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,gg=e=>_g("seenSurvey_",e),fg=e=>{try{const t=gg(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){cg.error("Failed to persist survey seen state",e)}},vg=[tg.Popover,tg.Widget,tg.API],mg={ignoreConditions:!1,ignoreDelay:!1,displayType:ag.Popover},yg="logs",bg=Ln("[Stylesheet Loader]"),Sg=e,wg=s,kg="#020617",Cg={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:X_.Right,widgetType:J_.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:kg,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Eg=[X_.Center,X_.Left,X_.Right];function xg(e){if(e.startsWith("#")){let 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 Tg(e=Cg.backgroundColor){let t;"#"===e[0]&&(t=xg(e)),e.startsWith("rgb")&&(t=e);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(i&&(t=xg(i)),!t)return kg;const s=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(s){const e=parseInt(s[1]),t=parseInt(s[2]),i=parseInt(s[3]);return Math.sqrt(e*e*.299+t*t*.587+i*i*.114)>127.5?kg:"white"}return kg}const Ig=(e,t,i)=>{const s=Gg(e),n=wg.querySelector(`.${s}`);if(n&&n.shadowRoot)return{shadow:n.shadowRoot,isNewlyCreated:!1};const r=wg.createElement("div");((e,t,i)=>{const s=at(at({},Cg),i),n=e.style,r=!Eg.includes(s.position)||t===tg.Widget&&(null==i?void 0:i.widgetType)===J_.Tab;n.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const 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}`}(s.fontFamily)),n.setProperty("--ph-survey-box-padding",s.boxPadding),n.setProperty("--ph-survey-max-width",s.maxWidth),n.setProperty("--ph-survey-z-index",s.zIndex),n.setProperty("--ph-survey-border-color",s.borderColor),r?(n.setProperty("--ph-survey-border-radius",s.borderRadius),n.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(n.setProperty("--ph-survey-border-bottom","none"),n.setProperty("--ph-survey-border-radius",`${s.borderRadius} ${s.borderRadius} 0 0`)),n.setProperty("--ph-survey-background-color",s.backgroundColor),n.setProperty("--ph-survey-box-shadow",s.boxShadow),n.setProperty("--ph-survey-disabled-button-opacity",s.disabledButtonOpacity),n.setProperty("--ph-survey-submit-button-color",s.submitButtonColor),n.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||Tg(s.submitButtonColor)),n.setProperty("--ph-survey-rating-bg-color",s.ratingButtonColor),n.setProperty("--ph-survey-rating-active-bg-color",s.ratingButtonActiveColor),n.setProperty("--ph-survey-rating-active-text-color",Tg(s.ratingButtonActiveColor)),n.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Tg(s.backgroundColor)),n.setProperty("--ph-survey-text-subtle-color",s.textSubtleColor),n.setProperty("--ph-widget-color",s.widgetColor),n.setProperty("--ph-widget-text-color",Tg(s.widgetColor)),n.setProperty("--ph-widget-z-index",s.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||s.inputBackground;o||"white"!==s.backgroundColor||(a="#f8f8f8"),n.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||Tg(a);n.setProperty("--ph-survey-input-text-color",l),n.setProperty("--ph-survey-rating-text-color",l),n.setProperty("--ph-survey-scrollbar-thumb-color",s.scrollbarThumbColor),n.setProperty("--ph-survey-scrollbar-track-color",s.scrollbarTrackColor),n.setProperty("--ph-survey-outline-color",s.outlineColor)})(r,e.type,e.appearance),r.className=s;const o=r.attachShadow({mode:"open"}),a=function(e){const t=((e,t,i)=>{let s=e.createElement("style");s.innerText=t;const n=(e=>{var t;return wt(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(i);return n&&(s=n(s)),s||(bg.error("prepare_external_dependency_stylesheet returned null"),null)})(wg,':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(a){const e=o.querySelector("style");e&&o.removeChild(e),o.appendChild(a)}return(i||wg.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Rg=({responses:e,survey:t,surveySubmissionId:i,posthog:s,isSurveyCompleted:n,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;s?dg(s)&&(fg(t),s.capture(rg.SENT,at(at(at(at({[og.SURVEY_NAME]:t.name,[og.SURVEY_ID]:t.id,[og.SURVEY_ITERATION]:t.current_iteration,[og.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,[og.SURVEY_SUBMISSION_ID]:i,[og.SURVEY_COMPLETED]:n},o&&{[og.SURVEY_LANGUAGE]:o}),{},{sessionRecordingUrl:null===(l=s.get_session_replay_url)||void 0===l?void 0:l.call(s)},za(e,t,a)),r),{},{$set:{[Va(t,"responded")]:!0}})),n&&(Sg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),Vg(t),s.reloadFeatureFlags())):cg.error("[survey sent] event not captured, PostHog instance not found.")},Pg=(e,t,i)=>{var s;return at(at({[og.SURVEY_NAME]:e.name,[og.SURVEY_ID]:e.id,[og.SURVEY_ITERATION]:e.current_iteration,[og.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[og.SURVEY_PARTIALLY_COMPLETED]:ja(null==t?void 0:t.responses)},(null==t?void 0:t.surveyLanguage)&&{[og.SURVEY_LANGUAGE]:t.surveyLanguage}),{},{sessionRecordingUrl:null===(s=i.get_session_replay_url)||void 0===s?void 0:s.call(i),[og.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},za(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots))},Mg=(e,t,i,s)=>{if(!t)return void cg.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const n=zg(e),r=n?n.surveyLanguage:s;t.capture(rg.DISMISSED,at(at(at({},Pg(e,n,t)),r&&{[og.SURVEY_LANGUAGE]:r}),{},{$set:{[Va(e,"dismissed")]:!0}})),Vg(e),fg(e),Sg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},Fg=(e,t)=>{if(!t)return void cg.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(e=>_g("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(i))return}catch(e){return}const s=zg(e);if(s){try{localStorage.setItem(i,"true")}catch(e){}t.capture(rg.ABANDONED,Pg(e,s,t),{transport:"sendBeacon"})}},Lg=e=>e.map(e=>({sort:Math.floor(10*Math.random()),value:e})).sort((e,t)=>e.sort-t.sort).map(e=>e.value),Ag=(e,t)=>e.length===t.length&&e.every((e,i)=>e===t[i])?t.reverse():t,Og=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},$g=(e,t)=>{return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(i=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const i=new Map(e.questions.map(e=>[e.id,e])),s=[];for(const e of t){const t=i.get(e);if(!t)return null;s.push(t)}return s})(e,t.questionOrder))&&void 0!==i?i:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Ag(e.questions,Lg(e.questions)):e.questions;var i},Dg=e=>Xa(e)||jg(e),Ng=function(e){function t(e){var i,s;return this.getChildContext||(i=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&i.forEach(function(e){e.__e=!0,h_(e)})},this.sub=function(e){i.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i&&i.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}),Bg=()=>U_(Ng),qg=({component:e,children:t,renderAsHtml:i,style:s})=>function(e,t,i){var s,n,r,o,a=s_({},e.props);for(r in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==r?s=t[r]:"ref"==r?n=t[r]:a[r]=void 0===t[r]&&null!=o?o[r]:t[r];return arguments.length>2&&(a.children=arguments.length>3?Ap.call(arguments,2):i),o_(e.type,a,s||e.key,n||e.ref,null)}(e,i?{dangerouslySetInnerHTML:{__html:t},style:s}:{children:t,style:s});function Hg(e,t){var i,s;if(!(null===(i=e.conditions)||void 0===i?void 0:i.url))return!0;const n=ir(t);if(!n)return!1;const r=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType);return il[o](r,[n])}const Ug=e=>_g("inProgressSurvey_",e),Wg=(e,t)=>{try{localStorage.setItem(Ug(e),JSON.stringify(t))}catch(e){cg.error("Error setting in-progress survey state in localStorage",e)}},zg=e=>{try{const t=localStorage.getItem(Ug(e));if(t)return JSON.parse(t)}catch(e){cg.error("Error getting in-progress survey state from localStorage",e)}return null},jg=e=>{const t=zg(e);return!Rt(null==t?void 0:t.surveySubmissionId)},Vg=e=>{try{localStorage.removeItem(Ug(e))}catch(e){cg.error("Error clearing in-progress survey state from localStorage",e)}};function Gg(e,t=!1){const i=`PostHogSurvey-${e.id}`;return t?`.${i}`:i}function Qg(e,t=X_.Right,i){if(e===tg.ExternalSurvey)return{};switch(t){case X_.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case X_.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case X_.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case X_.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case X_.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case X_.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case X_.Left:return{left:"30px"};case X_.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===tg.Widget&&i===J_.Tab?"60px":"30px"}}}var Kg=0;function Zg(e,t,i,s,n,r){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 c={type:e,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Kg,__i:-1,__u:0,__source:n,__self:r};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return Op.vnode&&Op.vnode(c),c}const Yg=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),Jg=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),Xg=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),ef=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),tf=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),sf=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Zg("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"})}),nf=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Zg("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"})}),rf=({fill:e="currentColor"}={})=>Zg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Zg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Zg("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:e})]}),of=Zg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Zg("g",{"clip-path":"url(#clip0_2415_6911)",children:[Zg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Zg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Zg("g",{mask:"url(#mask0_2415_6911)",children:[Zg("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"}),Zg("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"}),Zg("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"}),Zg("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"}),Zg("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"}),Zg("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"})]})]}),Zg("defs",{children:Zg("clipPath",{id:"clip0_2415_6911",children:Zg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function af({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return Zg("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",of]})}function lf({text:t,submitDisabled:i,appearance:s,onSubmit:n,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:c}){const{isPreviewMode:u}=U_(Ng),d=!!l&&!!c,h=!a&&Zg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==e||e.open(r)),u?null==o||o():n()},children:t});return Zg("div",{className:"bottom-section",children:[d?Zg("div",{className:"form-buttons form-buttons-with-back",children:[Zg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:s.backButtonText||"Back"}),h]}):h,!s.whiteLabel&&Zg(af,{urlParams:{utm_source:"survey-footer"}})]})}function cf({question:e,forceDisableHtml:t,htmlFor:i}){return Zg("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[Zg(e.type===ig.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:e.question}),e.description&&qg({component:r_("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function uf({onClick:e}){const{isPreviewMode:t}=U_(Ng);return Zg("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:rf({fill:"black"})})}const df=e;function hf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onClose:r}){const{isPopup:o}=U_(Ng);return B_(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),r())};return zn(df,"keydown",e),()=>{df.removeEventListener("keydown",e)}},[r]),Zg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Zg(uf,{onClick:()=>r()}),Zg("h3",{className:"thank-you-message-header",children:e}),t&&qg({component:r_("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!s&&"text"!==i}),o&&Zg(lf,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>r()})]})}function pf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=U_(Ng);return Zg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Zg(uf,{onClick:()=>l()}),e&&Zg("h3",{className:"intro-screen-header",children:e}),t&&qg({component:r_("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!s&&"text"!==i}),Zg(lf,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const _f=e=>St(e)&&e.every(e=>xt(e));function gf({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=Bg(),u=q_(null),[d,h]=N_(()=>xt(o)?o:""),p=null==i?void 0:i.disableAutofocus;B_(()=>{p||setTimeout(()=>{var e;c||null===(e=u.current)||void 0===e||e.focus()},100)},[c,p]);const _=`surveyQuestion${r}`,g=H_(()=>function(e,t,i){const s=e.trim();if(!i&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case ut:var n;if(void 0!==e.value&&e.value>s.length)return null!==(n=e.errorMessage)&&void 0!==n?n:`Please enter at least ${e.value} characters`;break;case dt:var r;if(void 0!==e.value&&s.length>e.value)return null!==(r=e.errorMessage)&&void 0!==r?r:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),f=In(e.validation,ut),v=In(e.validation,dt),m=H_(()=>function(e,t){const i=1===e?void 0:e;return i&&t?`Enter ${i}-${t} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(f,v),[f,v]),y=()=>{g||s(d.trim())},b=()=>{g||n(d.trim())};return Zg(a_,{children:[Zg("div",{className:"question-container",children:[Zg(cf,{question:e,forceDisableHtml:t,htmlFor:_}),Zg("textarea",{ref:u,id:_,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:f,maxLength:v,onInput(e){h(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||g||(e.preventDefault(),c?b():y())},value:d}),m&&Zg("div",{className:"validation-hint",children:m})]}),Zg(lf,{text:e.buttonText||"Submit",submitDisabled:!!g,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:a,onBack:l})]})}function ff({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,canGoBack:r,onBack:o}){return Zg(a_,{children:[Zg("div",{className:"question-container",children:Zg(cf,{question:e,forceDisableHtml:t})}),Zg(lf,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:i,onSubmit:()=>s("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:r,onBack:o})]})}function vf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var c;const u=e.scale,d=10===e.scale?0:1,[h,p]=N_(()=>Pt(o)?o:St(o)&&o.length>0&&Pt(parseInt(o[0]))?parseInt(o[0]):xt(o)&&Pt(parseInt(o))?parseInt(o):null),_="emoji"===e.display&&2===e.scale,{isPreviewMode:g}=Bg(),f=e=>g?r(e):n(e);return Zg(a_,{children:[Zg("div",{className:"question-container",children:[Zg(cf,{question:e,forceDisableHtml:t}),Zg("div",{className:"rating-section",children:[Zg("div",{className:"rating-options",children:["emoji"===e.display&&Zg("div",{className:"rating-options-emoji"+(_?" rating-options-emoji-2":""),children:null===(c=kf[e.scale])||void 0===c?void 0:c.map((t,s)=>Zg("button",{"aria-label":`Rate ${s+1}`,className:`ratings-emoji question-${i}-rating-${s} ${s+1===h?"rating-active":""}`,value:s+1,type:"button",onClick(){const t=s+1;p(t),e.skipSubmitButton&&f(t)},children:t},s))}),"number"===e.display&&Zg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${u-d+1}, minmax(0, 1fr))`},children:Cf(e.scale).map((t,n)=>Zg(mf,{displayQuestionIndex:i,active:h===t,appearance:s,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&f(t)}},n))})]}),!_&&Zg("div",{className:"rating-text",children:[Zg("div",{children:e.lowerBoundLabel}),Zg("div",{children:e.upperBoundLabel})]})]})]}),Zg(lf,{text:e.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:It(h)&&!e.optional,appearance:s,onSubmit:()=>n(h),onPreviewSubmit:()=>r(h),skipSubmitButton:e.skipSubmitButton,canGoBack:a,onBack:l})]})}function mf({num:e,active:t,displayQuestionIndex:i,setActiveNumber:s}){return Zg("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${i}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){s(e)},children:e})}function yf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const c=q_(null),u=H_(()=>(e=>{if(!e.shuffleOptions)return e.choices;const t=e.choices;let i="";e.hasOpenChoice&&(i=t.pop());const s=Ag(t,Lg(t));return e.hasOpenChoice&&(e.choices.push(i),s.push(i)),s})(e),[e]),[d,h]=N_(()=>((e,t)=>xt(e)||_f(e)?e:t===ig.SingleChoice?null:[])(o,e.type)),[p,_]=N_(()=>((e,t)=>{if(xt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(_f(e)){const i=e.find(e=>!t.includes(e));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,u)),{isPreviewMode:g}=Bg(),f=e.type===ig.SingleChoice,v=e.type===ig.MultipleChoice,m=e.skipSubmitButton&&f&&!e.hasOpenChoice,y=(e,t)=>{if(t){const e=!p.isSelected;return _(t=>at(at({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),f&&h(""),void(e&&setTimeout(()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.focus()},75))}if(f)return h(e),_(e=>at(at({},e),{},{isSelected:!1,inputValue:""})),void(m&&(n(e),g&&r(e)));v&&St(d)&&(d.includes(e)?h(d.filter(t=>t!==e)):h([...d,e]))},b=e=>{e.stopPropagation();const t=e.currentTarget.value;_(e=>at(at({},e),{},{inputValue:t})),f&&h(t)},S=e=>{e.stopPropagation(),"Enter"!==e.key||w()||(e.preventDefault(),k()),"Escape"===e.key&&(e.preventDefault(),_(e=>at(at({},e),{},{isSelected:!1,inputValue:""})),f&&h(null))},w=()=>!(e.optional||!It(d)&&(!St(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),k=()=>{p.isSelected&&v?St(d)&&(g?r([...d,p.inputValue]):n([...d,p.inputValue])):g?r(d):n(d)};return Zg(a_,{children:[Zg("div",{className:"question-container",children:[Zg(cf,{question:e,forceDisableHtml:t}),Zg("fieldset",{className:"multiple-choice-options limit-height",children:[Zg("legend",{className:"sr-only",children:v?" Select all that apply":" Select one"}),u.map((t,s)=>{const n=!!e.hasOpenChoice&&s===e.choices.length-1,r=`surveyQuestion${i}Choice${s}`,o=`${r}Open`,a=n?p.isSelected:f?d===t:St(d)&&d.includes(t);return Zg("label",{className:n?"choice-option-open":"",children:[Zg("div",{className:"response-choice",children:[Zg("input",{type:f?"radio":"checkbox",name:r,checked:a,onChange:()=>y(t,n),id:r,"aria-controls":o}),Zg("span",{children:n?`${t}:`:t})]}),n&&Zg("input",{type:"text",ref:c,id:o,name:`question${i}Open`,value:p.inputValue,onKeyDown:S,onInput:b,onClick(e){p.isSelected||y(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},s)})]})]}),Zg(lf,{text:e.buttonText||"Submit",submitDisabled:w(),appearance:s,onSubmit:k,onPreviewSubmit:k,skipSubmitButton:m,canGoBack:a,onBack:l})]})}const bf=[1,2,3,4,5],Sf=[1,2,3,4,5,6,7],wf=[0,1,2,3,4,5,6,7,8,9,10],kf={2:[sf,nf],3:[Xg,Jg,Yg],5:[ef,Xg,Jg,Yg,tf]};function Cf(e){switch(e){case 5:default:return bf;case 7:return Sf;case 10:return wf}}const Ef=Ln("[Surveys]");function xf(e,t,i){var s;const n=e.questions[t],r=t+1;if(!(null===(s=n.branching)||void 0===s?void 0:s.type))return t===e.questions.length-1?sg.End:r;if(n.branching.type===sg.End)return sg.End;if(n.branching.type===sg.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===sg.ResponseBased){if(n.type===ig.SingleChoice){var o;let e=n.choices.indexOf(`${i}`);if(-1===e&&n.hasOpenChoice&&(e=n.choices.length-1),null===(o=n.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===sg.End?sg.End:r}}else if(n.type===ig.Rating){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const e=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")}(i,n.scale);if(null===(a=n.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===sg.End?sg.End:r}}return r}return Ef.warn("Falling back to next question index due to unexpected branching type"),r}const Tf=Ln("[SurveyTranslations]");function If(e,t){const i=function(e){return function({overrideLanguage:e,storedPersonProperties:t,locale:i},s){const n=Ga(e);if(n)return null==s||s.info(`Using override display language: ${n}`),n;const r=function(e){return e&&"object"==typeof e&&"language"in e?Ga(e.language):null}(t);if(r)return null==s||s.info(`Using person property language: ${r}`),r;const o=Ga(i);return o?(null==s||s.info(`Using detected locale: ${o}`),o):(null==s||s.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:wt(e.get_property)?e.get_property(re):void 0,locale:yl()},Tf)}(t);if(!i)return Tf.info("No user language detected"),{survey:e,language:null};const s=Ya(e,i,Tf);return{survey:s.survey,language:s.matchedKey}}const Rf=e,Pf=s,Mf="ph:show_survey_widget",Ff="PHWidgetSurveyClickListener";function Lf(e,t){try{const i=e.getBoundingClientRect(),s=Rf.innerHeight,n=Rf.innerWidth;let r=i.left+i.width/2-t/2;r+t>n-20&&(r=n-t-20),20>r&&(r=20);const o=s-i.bottom,a=250>o&&i.top>o;return{position:"fixed",top:a?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:a?s-i.top+12+"px":"auto",zIndex:Cg.zIndex}}catch(e){return cg.warn("Failed to calculate trigger position:",e),null}}var Af=class{constructor(e){this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTabWidgets=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=()=>{const e=this._posthog.get_property(le);if(e)for(const t of e)jg(t)&&Fg(t,this._posthog)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:i=!1}={})=>{var s,n,r,o,a,l;if(!dg(this._posthog))return;const{survey:c,language:u}=this._translateSurveyForRendering(e);this._currentLanguage=u,this._surveyPopupProps=null,this._displayOptions=t;const d=this._applyDisplayOverrides(c,t);this._clearSurveyTimeout(d.id);const{properties:h,initialResponses:p}=null!=t?t:{},_=!(!p||0>=Object.keys(p).length)&&this._handleInitialResponses(d,p,h,u);if(_&&!(null===(s=d.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this._addSurveyToFocus(d);let g={};if((null===(n=d.appearance)||void 0===n?void 0:n.position)===X_.NextToTrigger&&(null===(r=d.appearance)||void 0===r?void 0:r.widgetSelector)){const e=Pf.querySelector(d.appearance.widgetSelector);var f;e&&(g=Lf(e,parseInt((null===(f=d.appearance)||void 0===f?void 0:f.maxWidth)||Cg.maxWidth))||{})}const v=(null===(o=d.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:m}=Ig(d,this._posthog);this._renderedTargets.set(m,m.host);const y={posthog:this._posthog,survey:d,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:h,style:g,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:u};if(this._surveyPopupProps=y,0>=v)return this._surveyIsRendered=!0,T_(Zg(Bf,at({},y)),m);const b=()=>{this._surveyIsRendered=!0;const{survey:i,language:s}=this._translateSurveyForRendering(e);this._currentLanguage=s;const n=this._applyDisplayOverrides(i,t),r=at(at({},y),{},{survey:n,surveyLanguage:s});this._surveyPopupProps=r,T_(Zg(Bf,at(at({},r),{},{survey:at(at({},n),{},{appearance:at(at({},n.appearance),{},{surveyPopupDelaySeconds:0})})})),m)},S=()=>{if(!dg(this._posthog)||!this._shouldDisplaySurvey(d))return cg.info(`Survey ${d.id} no longer eligible when its display delay elapsed; not displaying`),this._removeSurveyFromFocus(d);b()},w=i?null===(a=this._posthog.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(l=a.getActivationTimestamp)||void 0===l?void 0:l.call(a,d.id):void 0,k=Pt(w)?Math.max(0,Date.now()-w):0,C=Math.max(0,1e3*v-k);if(0>=C)return S();const E=Rf.setTimeout(()=>{this._surveyTimeouts.delete(d.id),S()},C);this._surveyTimeouts.set(d.id,E)},this._handleWidget=e=>{var t;const{survey:i,language:s}=this._translateSurveyForRendering(e),{shadow:n,isNewlyCreated:r}=Ig(i,this._posthog);this._renderedTargets.set(n,n.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===J_.Tab&&this._renderedTabWidgets.set(e.id,e),r&&T_(Zg(Hf,{posthog:this._posthog,survey:i,surveyLanguage:s},e.id),n)},this._detachWidgetSelectorListener=e=>{const t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Ff),this._widgetSelectorListeners.delete(e),cg.info(`Removed click listener for survey ${e}`))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._removeTabWidget=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._renderedTabWidgets.delete(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;const i=Pf.querySelector(Gg(e,!0));return!!(null==i||null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{const i=Pf.querySelector(t),s=this._widgetSelectorListeners.get(e.id);if(i){if(this._handleWidget(e),s){if(i===s.element)return;cg.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this._detachWidgetSelectorListener(e.id)}if(!i.hasAttribute(Ff)){const t=t=>{var i,s;t.stopPropagation();const n=(null===(i=e.appearance)||void 0===i?void 0:i.position)===X_.NextToTrigger?Lf(t.currentTarget,parseInt((null===(s=e.appearance)||void 0===s?void 0:s.maxWidth)||Cg.maxWidth)):{};Rf.dispatchEvent(new CustomEvent(Mf,{detail:{surveyId:e.id,position:n}}))};zn(i,"click",t),i.setAttribute(Ff,"true"),this._widgetSelectorListeners.set(e.id,{element:i,listener:t,survey:e}),cg.info(`Attached click listener for feedback button survey ${e.id}`)}}else s&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{if(!dg(this._posthog))return;const{survey:t,language:i}=this._translateSurveyForRendering(e),{shadow:s}=Ig(t,this._posthog);this._renderedTargets.set(s,s.host),T_(Zg(Bf,{posthog:this._posthog,survey:t,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,i)=>{var s;if(!dg(this._posthog))return;const{survey:n,language:r}=this._translateSurveyForRendering(e);let o=!1;(null===(s=this._posthog.config)||void 0===s||null===(s=s.surveys)||void 0===s?void 0:s.prefillFromUrl)&&(o=this._handleUrlPrefill(n,r,i)),T_(Zg(Bf,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(t=>{e(t.filter(e=>this._shouldDisplaySurvey(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{const t=dg(this._posthog),i=e.filter(e=>t&&(e.type===tg.Popover||e.type===tg.Widget)),s=new Set(i.map(e=>e.id));for(const e of Array.from(this._surveyTimeouts.keys()))s.has(e)||this.cancelSurvey(e);const n=this._sortSurveysByAppearanceDelay(i),r=new Set,o=new Set;n.forEach(e=>{if(e.type===tg.Widget){var t,i,s,n;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===J_.Tab)return o.add(e.id),void this._handleWidget(e);(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)===J_.Selector&&(null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector)&&(r.add(e.id),this._manageWidgetSelectorListener(e,null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector))}It(this._surveyInFocus)&&e.type===tg.Popover&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this._widgetSelectorListeners.forEach(({survey:e})=>{r.has(e.id)||this._removeWidgetSelectorListener(e)}),this._renderedTabWidgets.forEach((e,t)=>{o.has(t)||this._removeTabWidget(e)})},e)},this._addSurveyToFocus=e=>{It(this._surveyInFocus)||cg.error(`Survey ${this._surveyInFocus} already in focus. Cannot add survey ${e.id}.`),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&cg.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(),zn(Rf,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags(()=>this._onLanguageChange())}_onLanguageChange(){if(It(this._surveyInFocus))return;const e=this._posthog.get_property(le),t=null==e?void 0:e.find(e=>e.id===this._surveyInFocus);if(!t)return;const{survey:i,language:s}=this._translateSurveyForRendering(t);if(s===this._currentLanguage)return;if(this._currentLanguage=s,!this._surveyIsRendered)return;const n=this._applyDisplayOverrides(i,this._displayOptions),{shadow:r}=Ig(n,this._posthog);T_(Zg(Bf,at(at({},this._surveyPopupProps),{},{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),r)}get _featureFlags(){var e,t,i;return null!==(e=null===(t=(i=this._posthog).getExtension)||void 0===t?void 0:t.call(i,"featureFlags"))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?at(at({},e),{},{appearance:at(at(at({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){const t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(cg.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)||void 0===e||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(Rf.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)=>{T_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._renderedTabWidgets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var i,s;const n=jg(e),r=jg(t);if(n&&!r)return-1;if(!n&&r)return 1;const o=e.schedule===ng.Always,a=t.schedule===ng.Always;return o&&!a?1:!o&&a?-1:((null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(s=t.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return If(e,this._posthog)}_handleUrlPrefill(e,t,i){if(this._prefillHandledSurveys.has(e.id))return!1;const{params:s}=function(){const e={};let t=!1;const i=Rf.location.search.replace(/^\?/,"");if(!i)return{params:e,autoSubmit:t};const s=i.split("&");for(const i of s){const[s,n]=i.split("=");if(!s||Et(n))continue;const r=decodeURIComponent(s),o=decodeURIComponent(n);if("auto_submit"===r&&"true"===o){t=!0;continue}const a=r.match(/^q(\d+)$/);if(a){const t=parseInt(a[1],10);e[t]||(e[t]=[]),e[t].push(o)}}return{params:e,autoSubmit:t}}();if(0===Object.keys(s).length)return!1;cg.info("[Survey Prefill] Detected URL prefill parameters");const n=this._processPrefillData(e,s,t);return!!n&&(this._autoSubmitPrefilledResponses(e,n,i,t),this._prefillHandledSurveys.add(e.id),n.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,i,s){const{responses:n,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=t;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Rg({responses:o?n:a,survey:e,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:s})}_handleInitialResponses(e,t,i,s){const n={};for(const[e,i]of Object.entries(t))n[parseInt(e)]=St(i)?i.map(String):[String(i)];cg.info("[Survey] Processing initial responses");const r=this._processPrefillData(e,n,s);return!!r&&(this._autoSubmitPrefilledResponses(e,r,i,s),r.isSurveyCompleted)}_processPrefillData(e,t,i){try{const s=function(e,t){const i={};return e.questions.forEach((e,s)=>{if(!t[s]||!e.id)return;const n=t[s],r=Ua(e.id);try{switch(e.type){case ig.SingleChoice:{if(!e.choices||0===e.choices.length)return void Fn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=parseInt(n[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void Fn.warn(`[Survey Prefill] Invalid choice index for q${s}: ${n[0]}`);i[r]=e.choices[t];break}case ig.MultipleChoice:{if(!e.choices||0===e.choices.length)return void Fn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=n.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void Fn.warn(`[Survey Prefill] No valid choices for q${s}`);const o=[...new Set(t.map(t=>e.choices[t]))];t.length>o.length&&Fn.warn(`[Survey Prefill] Removed duplicate choices for q${s}`),i[r]=o;break}case ig.Rating:{const t=parseInt(n[0],10),o=e.scale||10;if(isNaN(t)||0>t||t>o)return void Fn.warn(`[Survey Prefill] Invalid rating for q${s}: ${n[0]} (scale: 0-${o})`);i[r]=t;break}default:Fn.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){Fn.error(`[Survey Prefill] Error converting q${s}:`,e)}}),i}(e,t);if(0===Object.keys(s).length)return cg.warn("[Survey Prefill] No valid responses after conversion"),null;const n=va(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(e,t,i){let s=0;const n={},r=[],o=e.questions.length+1;let a=0;for(;e.questions.length>s&&o>a&&(a++,t.includes(s));){const t=e.questions[s];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=Ua(t.id);Et(i[e])||(n[e]=i[e])}r.push(s);const o=xf(e,s,t.id?i[Ua(t.id)]:null);if(o===sg.End)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:r};s=o}return{startQuestionIndex:s,skippedResponses:n,skippedIndices:r}}(e,Object.keys(t).map(e=>parseInt(e,10)),s),l=r>=e.questions.length;return Wg(e,{surveySubmissionId:n,responses:s,lastQuestionIndex:r,questionOrder:Og(e.questions),visitedIndices:a,surveyLanguage:i}),cg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:s,submissionId:n,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(e){return cg.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t=void 0){if(!e)return!0;const i=this._featureFlags,s=!!(null==i?void 0:i.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let n=!0;return t&&(n=(null==i?void 0:i.getFeatureFlag(e,{send_event:!1}))===t||"any"===t),s&&n}_isSurveyConditionMatched(t){return!t.conditions||Hg(t,this._posthog)&&function(t){var s,n;return function(t,s){var n,r,o;if(!t||0===t.length)return!0;if(!c)return!1;const a=Qi(c,{userAgentDataPlatform:null==i||null===(n=i.userAgentData)||void 0===n?void 0:n.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==e||null===(r=e.screen)||void 0===r?void 0:r.width,screenHeight:null==e||null===(o=e.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return il[null!=s?s:"icontains"](t,[a])}(null===(s=t.conditions)||void 0===s?void 0:s.deviceTypes,null===(n=t.conditions)||void 0===n?void 0:n.deviceTypesMatchType)}(t)&&function(e){var t;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null==wg?void 0:wg.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return Dg(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)||void 0===t?void 0:t.hasLoadedFlags)?{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}:{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,i;const s={eligible:!0,reason:void 0};if(!hg(e))return s.eligible=!1,s.reason=`Survey is not running. It was completed on ${e.end_date}`,s;if(!vg.includes(e.type))return s.eligible=!1,s.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,s;const n=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return s.eligible=!1,s.reason=n?`Survey linked feature flag is not enabled for variant ${n}`:"Survey linked feature flag is not enabled",s;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return s.eligible=!1,s.reason="Survey targeting feature flag is not enabled",s;const r=this._internalFlagCheckSatisfied(e);var o;return r.satisfied?function(e,t){if(!e||!t)return!0;const i="string"==typeof t?new Date(t):t,s=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(s/864e5)>e}(null===(i=e.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Ca._get("lastSeenSurveyDate"))?(e=>!!Ca._get(gg(e))&&!Dg(e))(e)?(s.eligible=!1,s.reason="Survey has already been seen and it can't be activated again",s):s:(s.eligible=!1,s.reason="Survey wait period has not passed",s):(s.eligible=!1,s.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",s)}checkSurveyCaptureEligibility(){return dg(this._posthog)?{eligible:!0}:{eligible:!1,reason:ug}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!Ja(e)&&!pg(e))return!0;const i=null===(t=this._posthog.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==i?void 0:i.includes(e.id))}_checkFlags(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this._isSurveyFeatureFlagEnabled(t))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{const t=Pf.querySelector(Gg(e,!0));(null==t?void 0:t.shadowRoot)&&(T_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){cg.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 Of(e,t){if(!Pf||!Rf)return;const i=new Af(e);if(e.config.disable_surveys_automatic_display)return cg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return cg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let s;i.callSurveysAndEvaluateDisplayLogic(!0);const n=()=>{Et(s)&&(s=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Et(s)||(clearInterval(s),s=void 0)};n();const o=()=>{Pf.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),n())};return zn(Pf,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Pf.removeEventListener("visibilitychange",o)}),i}function $f({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:i,isPreviewMode:s=!1,posthog:n}){B_(()=>{var r;if(s||!(null===(r=e.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var s;const r=e.type===tg.Widget,o=Hg(e,n),a=(null===(s=e.appearance)||void 0===s?void 0:s.widgetType)===J_.Tab&&r;if(!o)return cg.info(`Hiding survey ${e.id} because URL does not match`),i(!1),t(e);a&&(cg.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),i(!0))};zn(Rf,"popstate",o),zn(Rf,"hashchange",o);const a=Rf.history.pushState,l=Rf.history.replaceState;return Rf.history.pushState=function(...e){a.apply(this,e),o()},Rf.history.replaceState=function(...e){l.apply(this,e),o()},()=>{Rf.removeEventListener("popstate",o),Rf.removeEventListener("hashchange",o),Rf.history.pushState=a,Rf.history.replaceState=l}},[s,e,t,i,n])}const Df=200;function Nf(e=eg.Right){switch(e){case eg.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case eg.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case eg.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Bf({survey:e,forceDisableHtml:t,posthog:i,style:s={},previewPageIndex:n,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:c=()=>{},onCloseConfirmationMessage:u=()=>{},properties:d,isSurveyCompleted:h,skipShownEvent:p,surveyLanguage:_}){var g,f,v,m,y,b,S,w,k,C,E,x;const T=q_(null),I=Number.isInteger(n),{isPopupVisible:R,isSurveySent:P,hidePopupWithAnimation:M}=function(e,t,i,s,n,r,o,a,l){const[c,u]=N_(s||0===i||e.type===tg.ExternalSurvey),[d,h]=N_(!1),p=q_(!1),_=()=>{const t=()=>{r&&n(e),u(!1)};if(p.current)return;const i=null==o?void 0:o.current;i?(p.current=!0,i.style.transition=`opacity ${Df}ms ease-out`,i.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},g=t=>{t.detail.surveyId===e.id&&_()};return B_(()=>{if(!t)return void cg.error("usePopupVisibility hook called without a PostHog instance.");if(s)return;let n;const r=t=>{var i,s;if(t.detail.surveyId===e.id){if(!(null===(i=e.appearance)||void 0===i?void 0:i.displayThankYouMessage))return _();h(!0),(null===(s=e.appearance)||void 0===s?void 0:s.autoDisappear)&&(n&&clearTimeout(n),n=setTimeout(_,5e3))}},o=()=>{if(Hg(e,t)){var i;u(!0),Rf.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(rg.SHOWN,at(at({[og.SURVEY_NAME]:e.name,[og.SURVEY_ID]:e.id,[og.SURVEY_ITERATION]:e.current_iteration,[og.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},l&&{[og.SURVEY_LANGUAGE]:l}),{},{sessionRecordingUrl:null===(i=t.get_session_replay_url)||void 0===i?void 0:i.call(t)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};zn(Rf,"PHSurveyClosed",g),zn(Rf,"PHSurveySent",r);const c=i>0?setTimeout(o,i):void 0;return Et(c)&&o(),()=>{Et(c)||clearTimeout(c),Et(n)||clearTimeout(n),Rf.removeEventListener("PHSurveyClosed",g),Rf.removeEventListener("PHSurveySent",r)}},[]),$f({survey:e,removeSurveyFromFocus:n,setSurveyVisible:u,isPreviewMode:s,posthog:t}),{isPopupVisible:c,isSurveySent:d,setIsPopupVisible:u,hidePopupWithAnimation:_}}(e,i,(null===(g=e.appearance)||void 0===g?void 0:g.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,I,r,o,T,p,_),F=P||n===e.questions.length||!0===h,[L,A]=N_(!1),O=H_(()=>!!zg(e),[e]),D=!(!(null===(f=e.appearance)||void 0===f?void 0:f.introScreenHeader)&&!(null===(v=e.appearance)||void 0===v?void 0:v.introScreenDescription)),N=I?-1===n:!!(null===(m=e.appearance)||void 0===m?void 0:m.displayIntroScreen)&&D&&!L&&!O,B=H_(()=>{const t=zg(e),s=(null==t?void 0:t.surveySubmissionId)||va();return{isPreviewMode:I,previewPageIndex:n,onPopupSurveyDismissed(){_?Mg(e,i,I,_):Mg(e,i,I),c()},isPopup:o||!1,surveySubmissionId:s,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:d,surveyLanguage:_}},[I,n,o,i,e,c,a,l,d,_]);return R?Zg(Ng.Provider,{value:B,children:Zg("div",{className:"ph-survey",style:at(at({},Qg(e.type,null===(y=e.appearance)||void 0===y?void 0:y.position,null===(b=e.appearance)||void 0===b?void 0:b.widgetType)),s),ref:T,children:F?Zg(hf,{header:(null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageHeader)||"Thank you!",description:(null===(w=e.appearance)||void 0===w?void 0:w.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescriptionContentType,appearance:e.appearance||Cg,onClose(){M(),u()}}):N?Zg(pf,{header:(null===(C=e.appearance)||void 0===C?void 0:C.introScreenHeader)||"",description:(null===(E=e.appearance)||void 0===E?void 0:E.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(x=e.appearance)||void 0===x?void 0:x.introScreenDescriptionContentType,appearance:e.appearance||Cg,onStart:()=>A(!0)}):Zg(qf,{survey:e,forceDisableHtml:!!t,posthog:i})})}):null}function qf({survey:e,forceDisableHtml:t,posthog:i}){var s,n;const r=H_(()=>{const t=zg(e);if(!t)return null;const i=Pt(t.lastQuestionIndex);return!i||i&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(Vg(e),null)},[e]),[o,a]=N_(()=>((null==r?void 0:r.responses)&&cg.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,c]=N_(!1),{previewPageIndex:u,onPopupSurveyDismissed:d,isPopup:h,onPreviewSubmit:p,onPreviewBack:_,surveySubmissionId:g,isPreviewMode:f,properties:v,surveyLanguage:m}=U_(Ng),[y,b]=N_(()=>{const t=null==r?void 0:r.lastQuestionIndex,i=Pt(t)&&t>=0&&e.questions.length>t?t:0;return Pt(u)&&u>=0?u:i}),[S,w]=N_(()=>{var t;return(null!==(t=null==r?void 0:r.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[k,C]=N_(()=>{var t;const i=zg(e);return null!==(t=null==i?void 0:i.questionSnapshots)&&void 0!==t?t:{}}),E=H_(()=>Og($g(e,r)),[e.id,r]),x=H_(()=>{if(!E||new Set(E).size!==E.length)return $g(e,r);const t=new Map(e.questions.map(e=>[e.id,e])),i=E.map(e=>t.get(e)).filter(e=>!!e);return i.length===E.length?i:e.questions},[E,e.questions,e,r]);B_(()=>{!f||Et(u)||0>u||b(u)},[u,f]);const T=!!(null===(s=e.appearance)||void 0===s?void 0:s.allowGoBack)&&(f?(null!=u?u:0)>0:S.length>0),I=x.at(y);return I?Zg("form",{className:"survey-form",name:"surveyForm",children:[h&&!0!==(null===(n=e.appearance)||void 0===n?void 0:n.hideCancelButton)&&Zg(uf,{onClick(){d()}}),Zg("div",{className:"survey-box","data-question-index":y,children:[l&&Zg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Uf({question:I,forceDisableHtml:t,displayQuestionIndex:y,appearance:e.appearance||Cg,onSubmit:t=>(({res:t,displayQuestionIndex:s,questionId:n})=>{if(!i)return void cg.error("onNextButtonClick called without a PostHog instance.");if(!dg(i))return void c(!0);if(c(!1),!n)return void cg.error("onNextButtonClick called without a questionId.");const r=Ua(n),l=at(at({},o),{},{[r]:t});a(l);const u=x[s],d=(null==u?void 0:u.id)?at(at({},k),{},{[u.id]:u.question}):k;C(d);const h=xf(e,s,t),p=h===sg.End,_=[...S,s];if(p||(w(_),b(h),Wg(e,{surveySubmissionId:g,responses:l,lastQuestionIndex:h,questionOrder:Og(x),visitedIndices:_,surveyLanguage:m,questionSnapshots:d})),e.enable_partial_responses||p){const t=new Set(_.map(e=>{var t;return null===(t=x[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>Ua(e))),s=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));Rg({responses:s,survey:e,surveySubmissionId:g,isSurveyCompleted:p,posthog:i,properties:v,surveyLanguage:m,questionSnapshots:d})}})({res:t,displayQuestionIndex:y,questionId:I.id}),onPreviewSubmit:p,initialValue:I.id?o[Ua(I.id)]:void 0,canGoBack:T,onBack(){if(f)return void _();if(0===S.length)return;const t=S[S.length-1],i=S.slice(0,-1);w(i),b(t),Wg(e,{surveySubmissionId:g,responses:o,lastQuestionIndex:t,questionOrder:Og(x),visitedIndices:i,surveyLanguage:m,questionSnapshots:k})}})]})]}):null}function Hf({survey:e,forceDisableHtml:t,posthog:i,readOnly:s,surveyLanguage:n}){var r,o,a,l,c,u,d;const[h,p]=N_(!0),[_,g]=N_(!1),[f,v]=N_({}),m=q_(void 0),y=()=>{(_||!i||s||dg(i))&&g(!_)};if(B_(()=>{var t;if(!i)return void cg.error("FeedbackWidget called without a PostHog instance.");if(s)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&v({top:"50%",bottom:"auto"});const n=t=>{var i;const s=t;(null===(i=s.detail)||void 0===i?void 0:i.surveyId)===e.id&&(cg.info(`Received show event for feedback button survey ${e.id}`),v(s.detail.position||{}),y())};return zn(Rf,Mf,n),()=>{Et(m.current)||(clearTimeout(m.current),m.current=void 0),Rf.removeEventListener(Mf,n)}},[i,s,e.id,null===(r=e.appearance)||void 0===r?void 0:r.widgetType,null===(o=e.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=e.appearance)||void 0===a?void 0:a.borderColor]),$f({survey:e,setSurveyVisible:p,posthog:i}),!h)return null;const b=()=>{e.schedule!==ng.Always&&p(!1),Et(m.current)||clearTimeout(m.current),m.current=setTimeout(()=>{m.current=void 0,g(!1)},200)};return Zg(a_,{children:["tab"===(null===(l=e.appearance)||void 0===l?void 0:l.widgetType)&&Zg("button",{className:"ph-survey-widget-tab "+((null===(c=e.appearance)||void 0===c?void 0:c.tabPosition)===eg.Top?"widget-tab-top":""),onClick:y,disabled:s,style:Nf(null===(u=e.appearance)||void 0===u?void 0:u.tabPosition),children:(null===(d=e.appearance)||void 0===d?void 0:d.widgetLabel)||""}),_&&Zg(Bf,{posthog:i,survey:e,forceDisableHtml:t,style:f,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:n})]})}const Uf=({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const c={forceDisableHtml:t,appearance:s,onPreviewSubmit(e){r(e)},onSubmit(e){n(e)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(e.type){case ig.Open:return r_(gf,at(at({},c),{},{question:e,key:e.id}));case ig.Link:return r_(ff,at(at({},c),{},{question:e,key:e.id}));case ig.Rating:return r_(vf,at(at({},c),{},{question:e,key:e.id}));case ig.SingleChoice:case ig.MultipleChoice:return r_(yf,at(at({},c),{},{question:e,key:e.id}));default:return cg.error(`Unsupported question type: ${e.type}`),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=Of,h.extendPostHogWithSurveys=Of;const Wf=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},zf=1e4,jf=(e,t,i)=>i.remaining>0?t.length>i.remaining?(e.push(t.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(e.push(t),i.remaining-=t.length,!0):(i.truncated=!0,!1),Vf=(e,t,i)=>{const s=JSON.stringify(e);if(i.remaining>=s.length)return jf(t,s,i);if(i.truncated=!0,2>i.remaining)return!1;let n=0,r=Math.min(e.length,i.remaining-2);for(;r>n;){const t=Math.ceil((n+r)/2);JSON.stringify(e.slice(0,t)).length>i.remaining?r=t-1:n=t}return jf(t,JSON.stringify(e.slice(0,n)),i)},Gf=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Qf=(e,t,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(t).length+e.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[e]=t}},Kf=(e,t,i)=>{if(!i.truncated)if(kt(e)){if(i.seen.has(e))return void Qf(t||"circular","[Circular]",i);i.seen.add(e);try{for(const s in e)try{if(!{}.hasOwnProperty.call(e,s))continue;if(Kf(e[s],t?`${t}.${s}`:s,i),i.truncated)return}catch(e){continue}}catch(e){}}else Qf(t,e,i)},Zf=(e,t,i,s,n=!1,r)=>{if(!Gf(e))return!n||jf(t,"null",i);if(It(e)||(e=>{try{return Pt(e)||Ft(e)}catch(e){return!1}})(e))return jf(t,JSON.stringify(e),i);if("string"==typeof e)return Vf(e,t,i);if(!kt(e)&&!St(e))return jf(t,JSON.stringify(e),i);if(s.has(e))return Vf("[Circular]",t,i);s.add(e);try{const r=e.toJSON;if(wt(r))return Zf(r.call(e),t,i,s,n)}catch(e){}try{const s={}.toString.call(e);if("[object String]"===s)return Vf(String(e.valueOf()),t,i);if("[object Number]"===s||"[object Boolean]"===s)return jf(t,JSON.stringify(e.valueOf()),i)}catch(e){}if(e instanceof Error){const o={};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t])}catch(e){}try{o.name=e.name}catch(e){}try{o.message=e.message}catch(e){}try{o.stack=e.stack}catch(e){}return Zf(o,t,i,s,n,r)}if(St(e)){if(!jf(t,"[",i))return!1;for(let n=0;e.length>n;n++){if(n>0&&!jf(t,",",i))return!1;let r;try{r=e[n]}catch(e){r=void 0}if(!Zf(r,t,i,s,!0))return!1}return jf(t,"]",i)}if(!jf(t,"{",i))return!1;let o=!0;try{for(const n in e){if(!{}.hasOwnProperty.call(e,n))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=e[n]}catch(e){continue}if(r)try{Kf(a,n,r)}catch(e){}if(!Gf(a))continue;const l=`${o?"":","}${JSON.stringify(n)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const c=t.length,u=i.remaining,d=i.truncated;if(!jf(t,l,i))return!1;const h=t.length,p=Zf(a,t,i,s,!1),_=i.truncated;if(t.length!==h){if(o=!1,!p)return!1}else if(t.length=c,i.remaining=u,i.truncated=p?d:_,!p)return!1}}catch(e){}return jf(t,"}",i)},Yf=(e,t)=>{const i=[],s={remaining:t,truncated:!1},n=kt(e[0])?{result:{},keysRemaining:50,sizeRemaining:zf,truncated:!1,seen:new WeakSet([e[0]])}:void 0;for(let t=0;e.length>t&&(0>=t||jf(i," ",s))&&Zf(e[t],i,s,new WeakSet,!1,0===t?n:void 0);t++);return{body:i.join("")+(s.truncated?"...":""),truncated:s.truncated,attributes:(null==n?void 0:n.result)||{}}},Jf={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Xf=e=>"canCapture"in e,ev=e=>Xf(e)?e.canCapture?e.getExtension(yg):void 0:e.is_capturing()?e.logs:void 0,tv=(e,t,i)=>{if(Xf(e))return void t.captureConsoleLog(i);const s=(e=>{const t=/^1\.(\d+)\.(\d+)$/.exec(e);if(!t)return;const i=Number(t[1]),s=Number(t[2]);return 392>i||i>419?void 0:410===i?s>4?s>10?void 0:"de":"le":418===i?s>3?s>10?s>14?s>17?void 0:"vi":"ci":"ui":"he":419===i?s>2?void 0:"vi":410>i?"le":"he"})(e.version),n=s?t[s]:void 0;wt(n)&&n.call(t,i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs(e){let t=e;const i=[],s={host:h.location.host};let n=!1;for(const e of Object.keys(Jf)){const r=i=>(...r)=>{let o=!1;try{const i=t;if(r.length>0&&!n&&i){const t=ev(i);if(t){n=!0,o=!0;const{body:a,truncated:l,attributes:c}=Yf(r,zf),u=at(at({},s),l?{body_truncated:"true"}:{}),d={level:Jf[e],body:a,attributes:at(at({"log.source":`console.${e}`},u),c)};tv(i,t,d)}}}catch(e){}finally{o&&(n=!1),i.apply(h.console,r)}},o=h.console[e];i.push(lp(h.console,e,e=>{const t=r(e);return t.__rrweb_original__=Wf(o),t}))}return()=>{t=void 0,i.forEach(e=>e())}},replayConsoleBuffer(e,t){const i=ev(e);if(i)for(const e of t)try{var s;const{body:t,truncated:n,attributes:r}=Yf(e.args,zf);null===(s=i.captureBufferedConsoleLog)||void 0===s||s.call(i,{level:Jf[e.level],body:t,attributes:at(at({"log.source":`console.${e.level}`,host:h.location.host},n?{body_truncated:"true"}:{}),r)},e.context,e.occurredAtMs)}catch(e){}}};const iv=e=>Nt(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),sv=Ln("[Error tracking]"),nv="webkit-masked-url:",rv=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],ov=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",nv],av=["__firefox__","__gCrWeb"];function lv(){return new ds([new Rs,new Bs,new Ms,new Ps,new Ds,new $s,new Ls,new Ns],function(e,...t){return(i,s=0)=>{const n=[],r=i.split("\n"),o=Math.min(r.length,s+1e3),a=[];for(let i=s;o>i;i++){const s=r[i];if(s.length>1024)continue;const o=Ss.test(s)?s.replace(Ss,"$1"):s;if(!o.match(/\S*Error: /)){for(const i of t){const t=i(o,e);if(t){n.push(t);const e=ks(n);if(e){for(let t=a.length-1;t>=0;t--){const i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if(Ts(n,a)>=50)break}}const l=[...a].sort((e,t)=>t.start-e.start),c=l[l.length-1];if(c){const e=Es(n,c);n.splice(c.start-e,e);for(const t of l)t.start-=e}for(const e of l)Cs(n,e);return a.some(e=>0===e.start&&n.length===e.length)&&function(e){const t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`);let i=0;for(let e=1;t.length>e;e++)Is(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(n),function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return at(at({},e),{},{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||"?"});var i})}(n)}}("web:javascript",vs,bs))}const cv=Ln("[ExceptionAutocapture]"),uv=lv(),dv=(e,t)=>{try{return e()}catch(e){return t}},hv=(e,t)=>dv(()=>e(t()),void 0),pv=e=>dv(()=>wt(e)&&wt(e.call),!1),_v=(e,t)=>dv(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),gv=(e,t,i)=>{dv(()=>{var i;null===(i=e[t])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),dv(()=>{e[t]=i},void 0)},fv=t=>{const i=e;i||cv.info("window not available, cannot wrap onerror");const s=dv(()=>i.onerror,void 0);return i.onerror=function(...e){var i;return hv(t,()=>uv.buildFromUnknown((([e,t,i,s,n])=>{if(null!=n)return n;if(xt(e)&&xt(t)&&t.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:e,filename:t,lineno:i,colno:s})}catch(t){return e}return e})(e),{mechanism:{handled:!1}})),!!pv(s)&&null!==(i=s(...e))&&void 0!==i&&i},_v(i,"onerror"),()=>gv(i,"onerror",s)},vv=(t,i=!1)=>{const s=e;s||cv.info("window not available, cannot wrap onUnhandledRejection");const n=dv(()=>s.onunhandledrejection,void 0);return s.onunhandledrejection=function(e){var s;return hv(t,()=>uv.buildFromUnknown(e,{mechanism:{handled:!1}})),pv(n)?null!==(s=n(e))&&void 0!==s&&s:i},_v(s,"onunhandledrejection"),()=>gv(s,"onunhandledrejection",n)},mv={wrapOnError:fv,wrapUnhandledRejection:vv,wrapConsoleError(e){const t=console;t||cv.info("console not available, cannot wrap console.error");const i=dv(()=>t.error,void 0);return t.error=function(...t){hv(e,()=>{let e;e=1==t.length?t[0]:t.join(" ");const i=t.find(e=>e instanceof Error);return uv.buildFromUnknown(i||e,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),pv(i)&&i(...t)},_v(t,"error"),()=>gv(t,"error",i)}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=mv,h.posthogErrorWrappingFunctions=mv;const yv=(e,t)=>{if(!wt(null==e?void 0:e.capture))return;const i=null==t?void 0:t.autocaptureExceptions,s=!It(i)&&"object"==typeof i&&St(i.errors_to_ignore)?i.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){cv.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],n=t=>{try{var i;null===(i=e.capture)||void 0===i||i.call(e,"$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){cv.error("Failed to capture exception for a legacy client",e)}};fv(e=>{s.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||n(e)}),vv(n,!0)};h.extendPostHogWithExceptionAutoCapture=yv,h.extendPostHogWithExceptionAutocapture=yv;const bv="X-POSTHOG-SESSION-ID",Sv="X-POSTHOG-WINDOW-ID",wv="X-POSTHOG-DISTINCT-ID",kv=[bv,Sv,wv],Cv=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Ev=(e,t)=>({}.hasOwnProperty.call(e,t)),xv=e=>"object"==typeof e&&!It(e)||wt(e),Tv=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),Iv=t=>{try{var i;return Tv(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null===(i=e.location)||void 0===i?void 0:i.href).toString()}catch(e){return}},Rv=(e,t,i,s,n)=>{let r;try{r=new URL(s).hostname}catch(e){return!1}if(!e)return!1;if(St(e)&&!e.includes(r))return!1;let o=!1;if(i){const{sessionId:e,windowId:t}=i.checkAndGetSessionAndWindowId(!0);n.set(bv,e),n.set(Sv,t),o=!0}const a=(e=>wt(e)?e():e)(t);return a&&"$posthog_cookieless"!==a&&(n.set(wv,a),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const Pv={_patchFetch:(t,i,s)=>lp(e,"fetch",e=>function(n,r){const o=arguments.length>1?[n,r]:[n];let a=o;try{const e=Iv(n);if(e)if(Tv(n)){const e=new Request(n,r);Rv(t,i,s,e.url,e.headers),a=[e]}else{const o=new Headers(xv(r)?r.headers:void 0);if(Rv(t,i,s,e,o)){const e=((e,t)=>{if(Et(e)||It(e))return{headers:t};if(!xv(e))return;const i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const e=Object.create(i);return Object.defineProperty(e,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),e}return new Proxy({headers:t},{get:(e,t)=>Ev(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>Ev(e,t)||t in i,ownKeys(e){const t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach(e=>t.add(e)),Cv.forEach(e=>{e in i&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){const s=Reflect.getOwnPropertyDescriptor(e,t);if(s)return s;if("string"==typeof t&&Cv.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};const n=Reflect.getOwnPropertyDescriptor(i,t);return n?at(at({},n),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);e&&(a=[n,e])}}}catch(e){a=o}return e.apply(this,a)}),_patchXHR:(t,i,s)=>lp(e.XMLHttpRequest.prototype,"open",e=>function(n,r,o=!0,a,l){const c=this,u=new Headers,d=Iv(r);d&&Rv(t,i,s,d,u);const h=e.call(c,n,r,o,a,l);return kv.forEach(e=>{const t=u.get(e);if(t)try{c.setRequestHeader(e,t)}catch(e){}}),h})};h.__PosthogExtensions__.tracingHeadersPatchFns=Pv,h.postHogTracingHeadersPatchFns=Pv,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){const t=this.length;let i=Math.trunc(e)||0;return 0>i&&(i+=t),0>i||i>=t?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(let i=this.length-1;i>=0;i--){const s=this[i];if(e.call(t,s,i,this))return s}},writable:!0,enumerable:!1,configurable:!0});var Mv=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(e.hadRecentInput)return;const i=this.i[0],s=this.i.at(-1);this.o&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const Fv=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Lv=e=>{if("loading"===document.readyState)return"loading";const t=Fv();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"},Av=e=>{const t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Ov=e=>{let t="";try{for(;9!==(null==e?void 0:e.nodeType);){var i;const s=e,n=s.id?"#"+s.id:[Av(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},$v=new WeakMap;function Dv(e,t){let i=$v.get(t);return i||(i=new WeakMap,$v.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}let Nv=-1;const Bv=()=>Nv,qv=e=>{addEventListener("pageshow",t=>{t.persisted&&(Nv=t.timeStamp,e(t))},!0)},Hv=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},Uv=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Wv=()=>{var e,t;return null!==(e=null===(t=Fv())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let zv=-1;const jv=new Set,Vv=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Gv=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of jv)e();isFinite(zv)||(zv="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Gv,!0))}},Qv=(e=!1)=>{if(e&&(zv=1/0),0>zv){var t;const e=Wv(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;zv=null!=i?i:Vv(),addEventListener("visibilitychange",Gv,!0),addEventListener("prerenderingchange",Gv,!0),qv(()=>{setTimeout(()=>{zv=Vv()})})}return{get firstHiddenTime(){return zv},onHidden(e){jv.add(e)}}},Kv=(e,t=-1,i,s=0,n,r,o)=>{const a=Fv(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>Bv()?a&&(document.prerendering||Wv()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Zv=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(at({type:t,buffered:!0},i));return e}}catch(e){}},Yv=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Jv=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Xv=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var em=class{constructor(){this.u=void 0}};const tm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},im=[1800,3e3],sm=(e,t={})=>{const i=Yv(t);tm(()=>{const s=Dv(t,em),n=Qv();let r,o=Kv("FCP");const a=Zv(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Wv(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=Hv(e,o,im,t.reportAllChanges),qv(i=>{o=Kv("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Bv()),r=Hv(e,o,im,t.reportAllChanges),Uv(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Zv(["soft-navigation"],i=>{i.forEach(i=>{s.u&&i.navigationId&&Jv(s.u,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Kv("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Hv(e,o,im,t.reportAllChanges),r(!0)})},t)})},nm=[.1,.25],rm=e=>e.find(e=>{var t;return 1===(null===(t=e.node)||void 0===t?void 0:t.nodeType)})||e[0],om=(e,t={})=>{const i=Dv(t=Object.assign({},t),Mv),s=new WeakMap;i.t=e=>{var i;if(null==e||null===(i=e.sources)||void 0===i?void 0:i.length){const i=rm(e.sources),o=null==i?void 0:i.node;if(o){var n,r;const e=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,o))&&void 0!==n?n:Ov(o);s.set(i,e)}}},((e,t={})=>{const i=Qv();sm(Xv(()=>{let s,n=Kv("CLS",0);const r=Dv(t,Mv),o=(i,o,a,l,c)=>{n=Kv("CLS",0,i,o,a,l,c),r.o=0,s=Hv(e,n,nm,t.reportAllChanges)},a=(e=!1)=>{r.o>n.value&&(n.value=r.o,n.entries=r.i),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.l(t):l(t);a()},u=["layout-shift"];Yv(t)&&u.push("soft-navigation");const d=Zv(u,c);d&&(s=Hv(e,n,nm,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),qv(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Bv()),Uv(s)}),setTimeout(s))}))})(t=>{e((e=>{let t={};if(e.entries.length){var i;const n=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null==n||null===(i=n.sources)||void 0===i?void 0:i.length){const e=rm(n.sources);e&&(t={largestShiftTarget:s.get(e),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:e,largestShiftEntry:n,loadState:Lv(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},am=(e,t={})=>{const i=Dv(t=Object.assign({},t),em);Yv(t)&&(i.u=new Map),sm(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Lv(Bv())};if("soft-navigation"!==e.navigationType){if(e.entries.length){const i=Fv(),s=e.entries.at(-1);if(i){const n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:Lv(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}else{var s;const n=null===(s=i.u)||void 0===s?void 0:s.get(e.navigationId);n&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:n})}return Object.assign(e,{attribution:t})})(t))},t)};let lm=0,cm=1/0,um=0;const dm=e=>{for(const t of e)t.interactionId&&(cm=Math.min(cm,t.interactionId),um=Math.max(um,t.interactionId),lm=um?(um-cm)/7+1:0)};let hm;const pm=()=>{var e;return hm?lm:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var _m=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return pm()-this.h}D(){this.h=pm(),this.v.length=0,this.p.clear()}S(e){const t=this.T(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{k:8,id:-1,entries:[]}}l(e){var t;if(null===(t=this.m)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.p.get(e.interactionId);if(s||10>this.v.length||e.duration>i.k){var n;if(s?e.duration>s.k?(s.entries=[e],s.k=e.duration):e.duration===s.k&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],k:e.duration},this.p.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.p.delete(t.id)}null===(n=this.M)||void 0===n||n.call(this,s)}}};const gm=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=Xv(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},fm=[200,500],vm=(e,t={})=>{const i=Dv(t=Object.assign({},t),_m);let s=[],n=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const c=()=>{l||(gm(u),l=!0)},u=()=>{const e=new Set(i.v.map(e=>o.get(e.entries[0]))),t=n.length-10;n=n.filter((i,s)=>s>=t||e.has(i));const a=new Set;for(const e of n){const t=d(e.startTime,e.processingEnd);for(const e of t)a.add(e)}s=s.filter(e=>e.startTime>r||a.has(e)),l=!1};i.m=e=>{const i=e.startTime+e.duration;let s;r=Math.max(r,e.processingEnd);for(let r=n.length-1;r>=0;r--){const o=n[r];if(8>=Math.abs(i-o.renderTime)){s=o,s.startTime=Math.min(e.startTime,s.startTime),s.processingStart=Math.min(e.processingStart,s.processingStart),s.processingEnd=Math.max(e.processingEnd,s.processingEnd),t.includeProcessedEventEntries&&s.entries.push(e);break}}s||(s={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]},n.push(s)),e.interactionId&&o.set(e,s),c()},i.M=e=>{if(!a.get(e)){var i;const o=null===(i=e.entries.find(e=>e.target))||void 0===i?void 0:i.target;if(o){var s,n;const i=null!==(s=null===(n=t.generateTarget)||void 0===n?void 0:n.call(t,o))&&void 0!==s?s:Ov(o);a.set(e,i)}else{var r;const t=null===(r=e.entries.find(e=>e.targetSelector))||void 0===r?void 0:r.targetSelector;t&&a.set(e,t)}}};const d=(e,t)=>{const i=[];for(const n of s)if(n.startTime+n.duration>=e){if(n.startTime>t)break;i.push(n)}return i};Zv(["long-animation-frame"],e=>{s=s.concat(e),c()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Qv();tm(()=>{var s;"interactionCount"in performance||hm||(hm=Zv(["event"],dm,{durationThreshold:0}));let n,r=Kv("INP");const o=Dv(t,_m),a=(i,s,a,l,c)=>{o.D(),r=Kv("INP",-1,i,s,a,l,c),n=Hv(e,r,fm,t.reportAllChanges)},l=()=>{const e=o.S(r.navigationType);e&&e.k!==r.value&&(r.value=e.k,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{gm(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.l(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];Yv(t)&&d.push("soft-navigation");const h=Zv(d,u,at(at({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=Hv(e,r,fm,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),qv(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Bv())}))})})(t=>{e((e=>{if(0===e.entries.length){const t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:Lv(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}const t=e.entries[0],s=o.get(t),n=Math.max(s.processingStart,t.startTime),r=Math.max(t.startTime+t.duration,n),l=Math.min(s.processingEnd,r),c=s.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,l),h=i.p.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:r,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:n-t.startTime,processingDuration:l-n,presentationDelay:r-l,loadState:Lv(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;const i=e.interactionTime,s=e.nextPaintTime;if(!(null===(t=e.longAnimationFrameEntries)||void 0===t?void 0:t.length)||!i||!s)return;const n=e.inputDelay,r=e.processingDuration;let o,a,l=0,c=0,u=0,d=0;for(const t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(const e of t.scripts){const t=e.startTime+e.duration;if(i>t)continue;const s=t-Math.max(i,e.startTime),u=e.duration?s/e.duration*e.forcedStyleAndLayoutDuration:0;l+=s-u,c+=u,s>d&&(a=i+n>e.startTime?"input-delay":i+n+r>e.startTime?"processing-duration":"presentation-delay",o=e,d=s)}}const h=e.longAnimationFrameEntries.at(-1),p=h?h.startTime+h.duration:0;p>=i+n+r&&(u=s-p),o&&a&&(e.longestScript={entry:o,subpart:a,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=u,e.totalUnattributedDuration=s-i-l-c-u})(p),Object.assign(e,{attribution:p})})(t))},t)};var mm=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null===(t=this.m)||void 0===t||t.call(this,e)}};const $=[2500,4e3];let ym=50;const bm=[];Zv(["resource"],e=>{for(const t of e)bm.push(t),bm.length>ym&&bm.shift()});const Sm=(e,t={})=>{null!=(t=Object.assign({},t)).resourceBufferSize&&(ym=t.resourceBufferSize);const i=Dv(t,mm),s=new WeakMap;Yv(t)&&(i.u=new Map),i.m=e=>{const i=e.element;if(i){var n,r;const o=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,i))&&void 0!==n?n:Ov(i);s.set(e,o)}else e.id&&s.set(e,`#${e.id}`)},((e,t={})=>{let i=!1;const s=Yv(t);tm(()=>{let n,r=Qv(),o=Kv("LCP");const a=Dv(t,mm),l=(s,a,l,c,u)=>{o=Kv("LCP",-1,s,a,l,c,u),n=Hv(e,o,$,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=Qv(!0))},c=e=>{var t;a.u&&e.navigationId&&Jv(a.u,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-Wv(),0),a.l(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.l(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=Zv(d,u);if(h){n=Hv(e,o,$,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;gm(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});qv(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Bv()),n=Hv(e,o,$,t.reportAllChanges),Uv(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n,r,o;const a=e.entries.at(-1),l=a.url&&(bm.findLast(e=>e.name===a.url)||performance.getEntriesByType("resource").findLast(e=>e.name===a.url));let c;t.target=s.get(a),t.lcpEntry=a,a.url&&(t.url=a.url),l&&(t.lcpResourceEntry=l);let u=0,d=0;if("soft-navigation"!==e.navigationType?(c=Fv(),u=null!==(n=null==c?void 0:c.activationStart)&&void 0!==n?n:0,d=null!==(r=null==c?void 0:c.responseStart)&&void 0!==r?r:0):(u=e.navigationStartTime||0,c=null===(o=i.u)||void 0===o?void 0:o.get(e.navigationId)),c){const i=Math.max(0,d-u),s=Math.max(i,l?(l.requestStart||l.startTime)-u:0),n=Math.min(e.value,Math.max(s,l?l.responseEnd-u:0));t=at(at({},t),{},{timeToFirstByte:i,resourceLoadDelay:s-i,resourceLoadDuration:n-s,elementRenderDelay:e.value-n,navigationEntry:c})}}return Object.assign(e,{attribution:t})})(t))},t)};let wm=-1;const km=()=>wm,Cm=e=>{addEventListener("pageshow",t=>{t.persisted&&(wm=t.timeStamp,e(t))},!0)},Em=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},xm=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Tm=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Im=()=>{var e,t;return null!==(e=null===(t=Tm())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let Rm=-1;const Pm=new Set,Mm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Fm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Pm)e();isFinite(Rm)||(Rm="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Fm,!0))}},Lm=(e=!1)=>{if(e&&(Rm=1/0),0>Rm){var t;const e=Im(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;Rm=null!=i?i:Mm(),addEventListener("visibilitychange",Fm,!0),addEventListener("prerenderingchange",Fm,!0),Cm(()=>{setTimeout(()=>{Rm=Mm()})})}return{get firstHiddenTime(){return Rm},onHidden(e){Pm.add(e)}}},Am=(e,t=-1,i,s=0,n,r,o)=>{const a=Tm(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>km()?a&&(document.prerendering||Im()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Om=new WeakMap;function $m(e,t){let i=Om.get(t);return i||(i=new WeakMap,Om.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var Dm=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(e.hadRecentInput)return;const i=this.o[0],s=this.o.at(-1);this.i&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const Nm=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(at({type:t,buffered:!0},i));return e}}catch(e){}},Bm=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},qm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Hm=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var Um=class{constructor(){this.l=void 0}};const Wm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},zm=[1800,3e3],jm=(e,t={})=>{const i=Bm(t);Wm(()=>{const s=$m(t,Um),n=Lm();let r,o=Am("FCP");const a=Nm(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Im(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=Em(e,o,zm,t.reportAllChanges),Cm(i=>{o=Am("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,km()),r=Em(e,o,zm,t.reportAllChanges),xm(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Nm(["soft-navigation"],i=>{i.forEach(i=>{s.l&&i.navigationId&&qm(s.l,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Am("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Em(e,o,zm,t.reportAllChanges),r(!0)})},t)})},Vm=[.1,.25],Gm=(e,t={})=>{const i=Lm();jm(Hm(()=>{let s,n=Am("CLS",0);const r=$m(t,Dm),o=(i,o,a,l,c)=>{n=Am("CLS",0,i,o,a,l,c),r.i=0,s=Em(e,n,Vm,t.reportAllChanges)},a=(e=!1)=>{r.i>n.value&&(n.value=r.i,n.entries=r.o),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.h(t):l(t);a()},u=["layout-shift"];Bm(t)&&u.push("soft-navigation");const d=Nm(u,c);d&&(s=Em(e,n,Vm,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),Cm(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,km()),xm(s)}),setTimeout(s))}))};let Qm=0,Km=1/0,Zm=0;const Ym=e=>{for(const t of e)t.interactionId&&(Km=Math.min(Km,t.interactionId),Zm=Math.max(Zm,t.interactionId),Qm=Zm?(Zm-Km)/7+1:0)};let Jm;const Xm=()=>{var e;return Jm?Qm:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var ey=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Xm()-this.u}M(){this.u=Xm(),this.v.length=0,this.m.clear()}L(e){const t=this._(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{P:8,id:-1,entries:[]}}h(e){var t;if(null===(t=this.p)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.m.get(e.interactionId);if(s||10>this.v.length||e.duration>i.P){var n;if(s?e.duration>s.P?(s.entries=[e],s.P=e.duration):e.duration===s.P&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],P:e.duration},this.m.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}null===(n=this.T)||void 0===n||n.call(this,s)}}};const ty=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=Hm(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},iy=[200,500],sy=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Lm();Wm(()=>{var s;"interactionCount"in performance||Jm||(Jm=Nm(["event"],Ym,{durationThreshold:0}));let n,r=Am("INP");const o=$m(t,ey),a=(i,s,a,l,c)=>{o.M(),r=Am("INP",-1,i,s,a,l,c),n=Em(e,r,iy,t.reportAllChanges)},l=()=>{const e=o.L(r.navigationType);e&&e.P!==r.value&&(r.value=e.P,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{ty(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];Bm(t)&&d.push("soft-navigation");const h=Nm(d,u,at(at({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=Em(e,r,iy,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),Cm(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,km())}))})};var ny=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null===(t=this.p)||void 0===t||t.call(this,e)}};const ry=[2500,4e3],oy=(e,t={})=>{let i=!1;const s=Bm(t);Wm(()=>{let n,r=Lm(),o=Am("LCP");const a=$m(t,ny),l=(s,a,l,c,u)=>{o=Am("LCP",-1,s,a,l,c,u),n=Em(e,o,ry,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=Lm(!0))},c=e=>{var t;a.l&&e.navigationId&&qm(a.l,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-Im(),0),a.h(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.h(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=Nm(d,u);if(h){n=Em(e,o,ry,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;ty(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});Cm(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,km()),n=Em(e,o,ry,t.reportAllChanges),xm(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})},ay={onLCP:Sm,onCLS:om,onFCP:am,onINP:vm,withoutAttribution:{onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=ay,h.__PosthogExtensions__.postHogWebVitalsCallbacks=ay,h.postHogWebVitalsCallbacks=ay;const ly={onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=ly,h.__PosthogExtensions__.postHogWebVitalsCallbacks=ly,h.postHogWebVitalsCallbacks=ly,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>ly;const cy={onLCP:Sm,onCLS:om,onFCP:am,onINP:vm,withoutAttribution:{onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=cy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=cy,h.postHogWebVitalsCallbacks=cy;const uy={onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=uy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=uy,h.postHogWebVitalsCallbacks=uy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>uy;var dy=class{constructor(e){this.disabled=!1===e;const t=kt(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,i){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const hy="$copy_autocapture",py=Ln("[AutoCapture]");function _y(e,t){return t.length>e?t.slice(0,e)+"...":t}function gy(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!nr(t));return t}function fy(t,{e:i,maskAllElementAttributes:s,maskAllText:n,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,c;if(!nr(t))return{props:{}};const u=[t],d=new Set([t]);let h=t;for(;h.parentNode&&!rr(h,"body")&&1e3>u.length;){if(ar(h.parentNode)){const e=h.parentNode.host;if(d.has(e))break;d.add(e),u.push(e),h=e;continue}if(!nr(h.parentNode))break;if(d.has(h.parentNode))break;d.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const p="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(e=>rr(e,"button")||rr(e,"a")):-1;p>0&&(n=n||u.slice(0,p+1).some(e=>!Rr(e)||Pr(e)));const _=[],g={};let f,v=!1,m=!1;if(On(u,e=>{const t=Rr(e);if(rr(e,"a")){const i=e.getAttribute("href");v=!!(t&&i&&Nr(i))&&(a?ss(i):i)}_t(ur(e),"ph-no-capture")&&(m=!0),_.push(function(e,t,i,s,n=!1){const r=e.tagName.toLowerCase(),o={tag_name:r};_r.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?_y(1024,Br(e)):_y(1024,hr(e)));const a=ur(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),On(e.attributes,function(i){var r;if((!Pr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&Nr(i.value)&&(!xt(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let e=i.value;"class"===i.name&&(e=lr(e).join(" ")),o["attr__"+i.name]=_y(1024,"href"===i.name&&n?ss(e):e)}});let l=1,c=1,u=e;for(;u=gy(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(e,s,n,r,a)),On(function(e){if(!Rr(e))return{};const t={};return On(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&Nr(s)&&(t[i]=s)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(g,t)||(g[t]=e)})}),m)return{props:{},explicitNoCapture:m};if(p>0&&(t=u[p],_.splice(0,p)),n||(_[0].$el_text=rr(t,"a")||rr(t,"button")?Br(t):hr(t)),v){var y,b;_[0].attr__href=v;const t=null===(y=Qn(v))||void 0===y?void 0:y.host,i=null==e||null===(b=e.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(f=v)}return{props:$n((w=i.type,{$event_type:w,$ce_version:1}),o?{}:{$elements:_},{$elements_chain:(S=_,St(S)?function(e){return e.map(e=>{var t,i;let s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)s+=`.${t.replace(/"/g,"")}`}const n=at(at(at(at({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return Dn(n).sort(([e],[t])=>function(e,t){return t>e?-1:e>t?1:0}(e,t)).forEach(([e,t])=>r[Hr(e.toString())]=Hr(t.toString())),s+=":",s+=Dn(r).map(([e,t])=>`${e}="${t}"`).join(""),s}).join(";")}(function(e){return e.map(e=>{var t,i;const s={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Ur(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Dn(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>s.attributes[e]=t),s})}(S)):"")},(null===(l=_[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(c=_[0])||void 0===c?void 0:c.$el_text}:{},f&&"click"===i.type?{$external_click_url:f}:{},g),target:t};var S,w}var vy=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!Rr(e))return!0;const i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:mr,s=new Set;let n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const e=n,t=ur(e);if(_t(t,"ph-no-capture")||_t(t,"ph-sensitive")||Pr(e)||i.some(t=>gr(e,t)))return!0;const r=n.parentNode;n=ar(r)?r.host:r&&nr(r)?r:null}return!1}_trackPointer(e){if(!this.isEnabled||"pointercancel"===e.type)return void this._clearPointer();if("pointerdown"===e.type){this._clearPointer();const i=pr(e);var t;return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&nr(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this._client)||void 0===t?void 0:t.distinctId}))}const i=this._pointerDown;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this._clearPointer():"pointerup"===e.type&&(i.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}_recoverClickTarget(e){var t;const i=this._pointerDown;this._clearPointer();const n=pr(e);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(t=this._client)||void 0===t?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&n&&(rr(n,"html")||rr(n,"body"))){var r;if(i.excluded)return null;const e=null!==(r=this._refreshConfig().css_selector_ignorelist)&&void 0!==r?r:mr;return[n,null==s?void 0:s.documentElement,null==s?void 0:s.body].some(t=>{if(!t)return!1;const i=ur(t);return _t(i,"ph-no-capture")||_t(i,"ph-sensitive")||!Rr(t)||Pr(t)||e.some(e=>gr(t,e))})?null:i.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 dy(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;const 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)||void 0===e||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?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null===(t=this._config.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){if(!this.isBrowserSupported())return void py.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!s)return;const t=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{if("blur"===t.type)return void this._clearPointer();if(0===t.type.indexOf("pointer"))return void this._trackPointer(t);const e="click"===t.type?this._recoverClickTarget(t):void 0;if(It(e))return;this._captureEvent(t,"$autocapture",e)}catch(e){py.error("Failed to capture event",e)}};if(zn(e,"blur",t),zn(s,"submit",t,{capture:!0}),zn(s,"change",t,{capture:!0}),zn(s,"click",t,{capture:!0}),On(["pointerdown","pointermove","pointerup","pointercancel"],e=>{zn(s,e,t,{capture:!0})}),this._refreshConfig().capture_copied_text){const t=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,hy)}catch(e){py.error("Failed to capture clipboard event",e)}};zn(s,"copy",t,{capture:!0}),zn(s,"cut",t,{capture:!0}),zn(s,"paste",t,{capture:!0})}}_removeDomEventHandlers(){this._clearPointer(),this._domEventHandler&&(null==e||e.removeEventListener("blur",this._domEventHandler),On(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==s||s.removeEventListener(e,this._domEventHandler,!0)}),null==s||s.removeEventListener("submit",this._domEventHandler,!0),null==s||s.removeEventListener("change",this._domEventHandler,!0),null==s||s.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==s||s.removeEventListener("copy",this._copiedTextHandler,!0),null==s||s.removeEventListener("cut",this._copiedTextHandler,!0),null==s||s.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)return;if(this._hasReceivedConfigResponse=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;Ft(i)&&(null===(s=this._client)||void 0===s||s.kv.set("$autocapture_disabled_server_side",i),this._isDisabledServerSide=i),this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e,t){var i;const n=[];return null===(i=this._elementSelectors)||void 0===i||i.forEach(i=>{const r=null==s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{e!==s&&t!==s||_t(n,i)||n.push(i)})}),n}get isEnabled(){var e,t;if(this._disposed)return!1;const i=null===(e=this._client)||void 0===e?void 0:e.kv.get(w),s=this._isDisabledServerSide,n=this._refreshConfig();if(!n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;const r=n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(It(s)&&!Ft(i)&&!r)return!1;const o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!n.enabled&&!o}_captureEvent(t,i="$autocapture",s){if(!this.isEnabled)return void this._clearPointer();let n=s||pr(t);or(n)&&(n=n.parentNode||null);const r=this._compileUrlPatterns();var o;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&xr(n,r.rageclick)&&this._captureEvent(t,"$rageclick",s);const a=i===hy,l=a?at(at({},r),{},{dom_event_allowlist:void 0}):r;if(n&&function(t,i,s,n,r,o){var a;if(!e||Tr(t))return!1;if((null==s?void 0:s.url_allowlist)&&!cr(s.url_allowlist,o))return!1;if((null==s?void 0:s.url_ignorelist)&&cr(s.url_ignorelist,o))return!1;if(null==s?void 0:s.dom_event_allowlist){const e=s.dom_event_allowlist;if(e&&!e.some(e=>i.type===e))return!1}const{parentIsUsefulElement:l,targetElementList:c}=Ir(t,n);if(!function(e,t){const i=null==t?void 0:t.element_allowlist;if(Et(i))return!0;for(const t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,s))return!1;if(!fr(c,null==s?void 0:s.css_selector_allowlist))return!1;if(fr(c,null!==(a=null==s?void 0:s.css_selector_ignorelist)&&void 0!==a?a:mr))return!1;try{const s=e.getComputedStyle(t);if(s&&"pointer"===s.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(e){}const u=t.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return l?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(_r.indexOf(u)>-1||"true"===t.getAttribute("contenteditable"))}}(n,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:s,explicitNoCapture:o,target:a}=fy(n,{e:t,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(n,a);if(l&&l.length>0&&(s.$element_selectors=l),i===hy){const i=t.type||"clipboard";if("paste"!==i){var u,d;const t=null==e||null===(u=e.getSelection())||void 0===u?void 0:u.toString(),i=dr(t);if(!i)return!1;s.$selected_content=i,s.$clipboard_text_length=null!==(d=null==t?void 0:t.length)&&void 0!==d?d:0}s.$copy_type=i}return null===(c=this._client)||void 0===c||c.capture(i,s).catch(e=>py.error("Failed to capture event",e)),!0}}isBrowserSupported(){return wt(null==s?void 0:s.querySelectorAll)}};const my={};function yy(e,t){const i=pr(e);return i?at({node:i,originalEvent:e,timestamp:Date.now()},t):null}function by(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function Sy(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}const wy="canvas,video,audio,embed,object";function ky(e,t){return Pt(e)&&e>=t}function Cy(e,t=1e3){return e>=0&&t>e?e:void 0}function Ey(e,t,i=1e3){return Pt(t)?Cy(e-t,i):void 0}var xy=class{_asRequiredConfig(e){var t,i,s,n,r,o,a,l;const c=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:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==e?void 0:e.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(s=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==s?s:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:c.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:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(e,t){this.instance=e,this._hadSelection=!1,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._clearMouseSelection=()=>{clearTimeout(this._mouseSelectionTimer),this._mouseSelectionTimer=void 0,this._mouseSelection=void 0},this._onMouseDown=e=>{if(this._clearMouseSelection(),0===e.button){const t={path:e.composedPath(),trusted:e.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==s?void 0:s.getSelection();t.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._selectionTouchesGesture(i,t),this._mouseSelection=t}},this._onMouseOut=e=>{It(e.relatedTarget)&&this._clearMouseSelection()},this._onMouseUp=e=>{const t=this._mouseSelection,i=e;if(!t||0!==i.button||e.isTrusted!==t.trusted)return;const s=e.composedPath();for(const e of t.path)if(nr(e)&&-1!==s.indexOf(e)){t.clickTarget=e;break}t.clickDetail=i.detail,this._mouseSelectionTimer=h.setTimeout(this._clearMouseSelection,0)},this._onClick=e=>{const t=e,i=yy(t,{type:"click"}),s=this._mouseSelection;i&&s&&0===t.button&&t.detail>0&&t.detail===s.clickDetail&&e.isTrusted===s.trusted&&i.node===s.clickTarget&&(i.selectionChangedDuringGesture=s.selectionChanged&&this._config.selection_change_threshold_ms>0,this._clearMouseSelection()),It(i)||this._ignore(i)||this._queueCandidate(i),this._scheduleCheck()},this._onScroll=()=>{const e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{Et(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=e=>{var t,i;const n=null==s?void 0:s.getSelection(),r=this._hadSelection;this._hadSelection="Range"===(null==n?void 0:n.type);const o=null==n?void 0:n.focusNode,a=o&&(nr(o)?o:o.parentElement),l=null==s?void 0:s.activeElement;let c=l;for(;null==c||null===(t=c.shadowRoot)||void 0===t?void 0:t.activeElement;)c=c.shadowRoot.activeElement;const u=Er(pr(e))||Er(null!=a?a:null)||Er(null!==(i=c)&&void 0!==i?i:null),d="Caret"===(null==n?void 0:n.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this._hadSelection||u||d))return;const h=Date.now();this._lastSelectionChanged=h;const p=this._mouseSelection;if(p&&(r||this._hadSelection||u)){const t=pr(e);let i;if(Er(t))i=t;else if("Caret"===(null==n?void 0:n.type)){var _;Er(null!==(_=c)&&void 0!==_?_:null)||d?i=c:u&&(i=a)}const s=i?this._selectionIsInGesture(i,p):n&&(o||n.anchorNode)?this._selectionTouchesGesture(n,p):r&&!this._hadSelection&&p.selectionInitiallyRelated;p.selectionChanged=p.selectionChanged||s}this._clicks.forEach(e=>{const t=h-e.timestamp;0>t||!Et(e.selectionChangedDelayMs)&&t>=e.selectionChangedDelayMs||(e.selectionChangedDelayMs=t)})},this._onVisibilityChange=()=>{"hidden"===(null==s?void 0:s.visibilityState)&&this._clearMouseSelection();const e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{const e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{const t=e.touches,i=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t;const i=this._touchStart;if(this._touchStart=void 0,Et(i)||this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)return;const n=e,r=null===(t=n.changedTouches)||void 0===t?void 0:t[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,c=this._config.swipe_threshold_px;if(c*c>l)return;if([this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>Pt(e)&&e>=i.timestamp))return;var u,d;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==s||null===(d=s.elementsFromPoint)||void 0===d?void 0:d.call(s,i.x,i.y))&&void 0!==u?u:[]).some(e=>{var t;return null===(t=e.matches)||void 0===t?void 0:t.call(e,wy)}))return;const h=yy(n,{type:"swipe",swipeDirection:by(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});It(h)||this._ignore(h)||this._queueCandidate(h),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(t){if(!this._mutationObserver){const i=function(t){return function(t,i){const s=my[t];if(s)return s;let n=i[t];if((e=>wt(e)&&-1!==e.toString().indexOf("[native code]"))(n)&&!(null==e?void 0:e.Zone))return my[t]=n.bind(i);const r=i.document;if(r&&wt(r.createElement)){let e,s=!1;try{e=r.createElement("iframe"),e.hidden=!0,r.head.appendChild(e);const l=e.contentWindow;var o,a;l&&l[t]&&(n=l[t],"MutationObserver"===t&&function(e){return _t(e,"AppleWebKit")&&!_t(e,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(e.classList.add("rr-block","ph-no-capture"),s=!0))}catch(e){Fn.warn(`Could not create sandbox iframe for ${t} check, bailing to assignableWindow.${t}: `,e)}finally{!s&&(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)}}return n&&wt(n)?my[t]=n.bind(i):n}("MutationObserver",t)}(h);this._mutationObserver=new i(e=>{this._onMutation(e)}),this._mutationObserver.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,h.removeEventListener("click",this._onClick),h.removeEventListener("mousedown",this._onMouseDown,{capture:!0}),h.removeEventListener("mouseup",this._onMouseUp,{capture:!0}),h.removeEventListener("mouseout",this._onMouseOut,{capture:!0}),h.removeEventListener("dragstart",this._clearMouseSelection,{capture:!0}),h.removeEventListener("pointercancel",this._clearMouseSelection,{capture:!0}),h.removeEventListener("blur",this._clearMouseSelection),this._clearMouseSelection(),h.removeEventListener("scroll",this._onScroll,{capture:!0}),null==s||s.removeEventListener("selectionchange",this._onSelectionChange),h.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),h.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),h.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),h.removeEventListener("blur",this._onFocusChange),h.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){zn(h,"click",this._onClick),zn(h,"mousedown",this._onMouseDown,{capture:!0}),zn(h,"mouseup",this._onMouseUp,{capture:!0}),zn(h,"mouseout",this._onMouseOut,{capture:!0}),zn(h,"dragstart",this._clearMouseSelection,{capture:!0}),zn(h,"pointercancel",this._clearMouseSelection,{capture:!0}),zn(h,"blur",this._clearMouseSelection)}_queueCandidate(e){e.selectionChangedDelayMs=Ey(e.timestamp,this._lastSelectionChanged,this._config.selection_change_threshold_ms),e.visibilityChangedDelayMs=Ey(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=Ey(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Et(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){zn(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){var e;this._hadSelection="Range"===(null==s||null===(e=s.getSelection())||void 0===e?void 0:e.type),zn(s,"selectionchange",this._onSelectionChange)}_selectionIsInGesture(e,t){const i=t.path[0];for(;e;){if(-1!==t.path.indexOf(e)||nr(i)&&i.contains(e))return!0;e=e.getRootNode().host}return!1}_selectionTouchesGesture(e,t){const i=t.path[0],s=e.rangeCount>0?e.getRangeAt(0):void 0;if(s&&nr(i)&&s.startContainer.getRootNode()===i.getRootNode()){var n;if(!s.collapsed)return s.intersectsNode(i);const e=nr(s.startContainer)&&null!==(n=s.startContainer.childNodes[s.startOffset])&&void 0!==n?n:s.startContainer;return this._selectionIsInGesture(e,t)}return this._selectionIsInGesture(e.focusNode,t)||this._selectionIsInGesture(e.anchorNode,t)}_startVisibilityChangeObserver(){zn(s,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){zn(h,"blur",this._onFocusChange),zn(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(i=>{const s=Cy(t-i.timestamp);Pt(s)&&(Et(i[e])||i[e]>s)&&(i[e]=s)})}_startSwipeObserver(){zn(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),zn(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),zn(h,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){const e=Et(this._surfacesCheckedAt)||Pt(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Et(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!!(null==s?void 0:s.querySelector(wy))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){return!(!sr(t.node)&&!this._clicks.some(e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp))&&!rr(t.node,"html")&&nr(t.node)&&function(t,i){var s;if(!e||Tr(t))return!1;const n=Ft(i)?wr:null!==(s=null==i?void 0:i.css_selector_ignorelist)&&void 0!==s?s:wr,{targetElementList:r}=Ir(t,!1);return!fr(r,n)}(t.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(t){return!(this._config.capture_clicks_with_modifier_keys||(i=t.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this._ignoreCommon(t)||function(t){if(!e||Tr(t))return!1;const{targetElementList:i}=Ir(t,!1);return i.some(e=>rr(e,"a"))}(t.node);var i}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;const e=this._clicks;this._clicks=[];for(const i of e){var t;i.mutationDelayMs=null!==(t=i.mutationDelayMs)&&void 0!==t?t:this._lastMutation&&this._lastMutation>=i.timestamp?this._lastMutation-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const e=ky(i.scrollDelayMs,this._config.scroll_threshold_ms),s=ky(i.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=ky(i.mutationDelayMs,this._config.mutation_threshold_ms),r=ky(i.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),o=Pt(i.scrollDelayMs)&&this._config.scroll_threshold_ms>i.scrollDelayMs,a=Pt(i.mutationDelayMs)&&this._config.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Pt(i.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>i.selectionChangedDelayMs,c=Pt(i.visibilityChangedDelayMs),u=Pt(i.focusChangedDelayMs);if(!(o||a||l||c||u))if(e||n||r||s){const t=Sy(i);if("$dead_swipe"===t){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(i,{[`${t}_last_mutation_timestamp`]:this._lastMutation,[`${t}_event_timestamp`]:i.timestamp,[`${t}_scroll_timeout`]:e,[`${t}_mutation_timeout`]:n,[`${t}_absolute_timeout`]:r,[`${t}_selection_changed_timeout`]:s,[`${t}_visibility_changed_timeout`]:!1})}else this._config.mutation_threshold_ms>i.absoluteDelayMs&&this._clicks.push(i)}this._scheduleCheck()}_captureDeadClick(e,t){const i=Sy(e);this.instance.capture(i,at(at(at({},t),fy(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),{},{[`${i}_scroll_delay_ms`]:e.scrollDelayMs,[`${i}_mutation_delay_ms`]:e.mutationDelayMs,[`${i}_absolute_delay_ms`]:e.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:e.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:e.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new xy(e,t);var Ty=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(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){const e=this._storage._get(this._storageKey);return Ut(e)?1:_t(Wt,e)?0:-1}get _storage(){const e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ca:wa,i=t._is_supported()?t:$a;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;const t="localStorage"===e?wa:Ca;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ut(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(e=>Ut(e))}};const Iy=Ln("[Dead Clicks]"),Ry=()=>!0,Py=e=>{var t;const i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property(I)),s=e.instance.config.capture_dead_clicks;return Ft(s)?s:!!kt(s)||i};var My=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[I]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?Iy.error("failed to load script",t):e()})}_start(){var e;if(s){if(!this._lazyLoadedDeadClicksAutocapture&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){const e=kt(this.instance.config.capture_dead_clicks)?at({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(s),Iy.info("starting...")}}else Iy.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Iy.info("stopping..."))}};const Fy=Ln("[SegmentIntegration]");function Ly(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:n,filterProperties:r}=(e=>wt(e.register))(o=s)?{analytics:o}:o;var o;!function(e,t,i,s){const n=t=>{const n=()=>t.anonymousId()||va();e.config.get_device_id=n,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:n()}),e.persistence.set_property(Ce,Qe)),i(s?void 0:t.anonymousId()||void 0)},r=t.user();"then"in r&&wt(r.then)?r.then(n):n(r)}(e,n,i=>{n.register(((e,t,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||Fy.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!t&&s.event.anonymousId===t&&!s.event.userId;r||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(Fy.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(Fy.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));let o=e.calculateEventProperties(n,s.event.properties);if(!Rt(i)){const e=s.event.properties||{},t={};for(const i of Object.keys(o))yt.call(e,i)||(t[i]=o[i]);const n=((e,t)=>{const i=St(e)?e:[e];let s=at({},t);for(const e of i)try{if(s=e(s),Rt(s))return null}catch(e){return Fy.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(Rt(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return s(e,e.event.event)},page(e){return s(e,Je)},identify(e){return s(e,et)},screen(e){return s(e,"$screen")}}})(e,i,{filterProperties:r})).then(()=>{t()},e=>{Fy.error("Failed to register the Segment integration",e),t()})},i)}const Ay="posthog-js";function Oy(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if("*"!==n&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],_=p.map(e=>at(at({},e),{},{stacktrace:e.stacktrace?at(at({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>at(at({},e),{},{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null===(l=p[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(c=p[0])||void 0===c?void 0:c.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(u=p[0])||void 0===u?void 0:u.value)||o.message,$sentry_exception_type:null===(d=p[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var f;return t&&i&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(f=e.exceptions)||void 0===f||f.sendExceptionEvent(g)),o}}var $y=class{constructor(e,t,i,s,n,r){this.name=Ay,this.setupOnce=function(o){o(Oy(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},Dy=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Fn.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),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?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null===(e=this._unsubscribeSessionId)||void 0===e||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,i){var s;const n=this._previousPageViewProperties(t,i);return this._currentPageview={pathname:null!==(s=null==e?void 0:e.location.pathname)&&void 0!==s?s:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}_previousPageViewProperties(e,t){const i=this._currentPageview;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=n;if(!(Et(e)||Et(t)||Et(i)||Et(r)||Et(o)||Et(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const n=e>1?Vt(t/e,0,1,Fn):1,l=e>1?Vt(i/e,0,1,Fn):1,c=r>1?Vt(o/r,0,1,Fn):1,u=r>1?Vt(a/r,0,1,Fn):1;s=$n(s,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:u})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};const Ny=["flags","surveys"],By={[p]:{exposure:"hidden"},[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[S]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"event"},[k]:{exposure:"hidden"},[P]:{exposure:"hidden"},[C]:{exposure:"event"},[E]:{exposure:"hidden"},[x]:{exposure:"event"},[T]:{exposure:"event"},[I]:{exposure:"event"},[R]:{exposure:"hidden"},[M]:{exposure:"event"},[F]:{exposure:"hidden"},[L]:{exposure:"hidden"},[q]:{exposure:"hidden"},[H]:{exposure:"event"},[A]:{exposure:"event",shouldSkipFromEventProperties:e=>It(e)},[U]:{exposure:"event"},[W]:{exposure:"event"},[z]:{exposure:"event"},[Q]:{exposure:"event"},[K]:{exposure:"hidden"},[Z]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden",storageGroup:"flags"},[J]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[ee]:{exposure:"hidden",storageGroup:"flags"},[te]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ie]:{exposure:"hidden",storageGroup:"flags"},[se]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[re]:{exposure:"hidden"},[oe]:{exposure:"hidden"},[le]:{exposure:"hidden",storageGroup:"surveys"},[ce]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ue]:{exposure:"event"},[de]:{exposure:"hidden"},[he]:{exposure:"hidden"},[pe]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[ge]:{exposure:"hidden"},[fe]:{exposure:"event"},[ve]:{exposure:"event"},[me]:{exposure:"event"},[ye]:{exposure:"event"},[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[ae]:{exposure:"event"},[we]:{exposure:"hidden"},[ke]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ce]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[xe]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Ie]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[O]:{exposure:"event"},[D]:{exposure:"event"},[N]:{exposure:"event"},[B]:{exposure:"event"},[Le]:{exposure:"event"},[Ae]:{exposure:"event"},[Oe]:{exposure:"event"},[$e]:{exposure:"event"},[De]:{exposure:"event"},[Ne]:{exposure:"event"},[Be]:{exposure:"event"},[qe]:{exposure:"event"},[He]:{exposure:"event"},[Ue]:{exposure:"event"},[je]:{exposure:"event"}},qy=[[j,{exposure:"hidden"}],[V,{exposure:"hidden"}],[G,{exposure:"hidden"}]],Hy=e=>{const t=By[e];if(t)return t;for(const[t,i]of qy)if(0===e.indexOf(t))return i},Uy={flags:ke,surveys:ce},Wy=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],zy=e=>`${e}_cookie_identity_change_pending`,jy=e=>{let t="",i=0;for(const s of e){const e=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+e>1e3)break;t+=s,i+=e}return t},Vy="main",Gy=[Z,Y,X,ee,te,ke,ie,re],Qy=e=>-1!==Gy.indexOf(e),Ky=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Zy=e=>{if(!e)return{};const t=JSON.parse(e);return kt(t)?t:{}},Yy=(e,t)=>{On(e,(i,s)=>{const n=Hy(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})};var Jy=class{constructor(t,i,s=!0){if(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=t,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{let 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"})(t),this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&Fn.info("Persistence loaded",t.persistence,at({},this.props)),this.update_config(t,t,i),this.save(),e){const t=()=>this.flush();zn(e,"beforeunload",t,{capture:!1}),zn(e,"pagehide",t,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){const e=Ny.find(e=>t.key===this._groupEntryName(e));e&&this._syncCrossTabFeatureFlagProperties(t.key,e)}}else this._syncCrossTabFeatureFlagProperties(t.key,Vy)},zn(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!Qy(e)||!0===i)return;if(!0===t)return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(i||[]);t.forEach(e=>s.add(e)),s.size&&this._setCrossTabFeatureFlagChangesPending(e,s)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i=!0){if(this._disabled)return!1;let s,n;try{if(n=Ca._get(e),It(n)){const e=this._slotWriteState(t);return e.storageValue=null,t!==Vy&&(e.persisted=!1),!1}s=Zy(n)}catch(e){return!1}const r=t===Vy?s:Ca._parse(this._name);if(r&&this._hasCrossTabFeatureFlagIdentityMismatch(r))return!1;const o=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===Vy&&this._splitStorage&&!Ky(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,n),o}_hasCrossTabFeatureFlagIdentityMismatch(e){const t=this.props[_],i=e[_];return!Et(t)&&!Et(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){const n=this._slotWriteState(t);n.storageValue=s,t!==Vy&&(n.persisted=i);try{n.fingerprint=this._entryFingerprint(e,t)}catch(e){n.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){let s=!1;return Gy.forEach(i=>{var n;const r=null===(n=Hy(i))||void 0===n?void 0:n.storageGroup;if(t===Vy&&this._splitStorage&&r||t!==Vy&&r!==t)return;const o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&Ky(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),s=!0)}),s&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),s}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;const e=Ca._get(this._name),t=this._slotWriteState(Vy);let i,s=!1,n=!1;if(e!==t.storageValue)if(It(e))t.storageValue=null;else{if(i=Zy(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(i),this._crossTabFeatureFlagIdentityMismatch)return!1;n=this._mergeCrossTabFeatureFlagProperties(i,Vy,!1),!this._splitStorage||Ky(this._partitionProps().main,i)?this._rememberCrossTabStorageFingerprint(i,Vy,!0,e):t.storageValue=e,s=!0}return this._splitStorage&&Ny.forEach(e=>{const t=Ca._get(this._groupEntryName(e)),r=this._slotWriteState(e),o=i||{},a=s&&Gy.some(t=>{var i;return(null===(i=Hy(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===r.storageValue&&!a)return;if(It(t))return r.storageValue=null,r.persisted=!1,void(a&&(n=this._mergeCrossTabFeatureFlagProperties(o,e,!1)||n));const l=Zy(t);n=this._mergeCrossTabFeatureFlagProperties(l,e,!1)||n,this._rememberCrossTabStorageFingerprint(l,e,!0,t)}),n}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);const i=Hy(e);(null==i?void 0:i.volatile)||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||Vy).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Gy.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{const e=Ca._get(this._name),t=Zy(e);this._slotWriteState(Vy).storageValue=e,Gy.forEach(e=>{var i;const s=this._splitStorage?null===(i=Hy(e))||void 0===i?void 0:i.storageGroup:void 0,n=s?Ca._get(this._groupEntryName(s)):null;if(s){const e=this._slotWriteState(s);e.storageValue=n,e.persisted=!It(n)}const r=s&&!It(n)?Zy(n):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,r[e],this.props[e]):e in r&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){const s=new Set(St(t)?t:[]),n=new Set(St(this.props[e])?this.props[e]:[]);return i.forEach(e=>n.has(e)?s.add(e):s.delete(e)),Array.from(s)}const s=kt(t)?at({},t):{},n=kt(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in n?s[e]=n[e]:delete s[e]}),s}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(!Qy(e))return;const s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0===s)return;let n=t;if(this._splitStorageEligible)try{var r;const t=this._splitStorage?null===(r=Hy(e))||void 0===r?void 0:r.storageGroup:void 0,i=t?this._groupEntryName(t):this._name;n=Zy(Ca._get(i))[e]}catch(e){}const o=new Set(s||[]);if("$active_feature_flags"===e){if(!Et(t)&&!St(t)||!Et(n)&&!St(n)||!St(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(t||[]),r=new Set(n||[]),a=new Set(i);new Set([...s,...a]).forEach(e=>{s.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{r.has(e)===a.has(e)&&o.delete(e)})}else{if(!kt(i))return void(Ky(n,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));{if(!Et(t)&&!kt(t)||Et(t)&&Ct(i)&&Et(n))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=kt(t)?t:{},r=kt(n)?n:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&Ky(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in r==e in i&&Ky(r[e],i[e])&&o.delete(e)})}}o.size?this._setCrossTabFeatureFlagChangesPending(e,o):this._pendingCrossTabFeatureFlagChanges.delete(e)}_saveDebounceMs(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Pt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{const t=Pa(e,this._config.cookie_persisted_properties||[]),i=Fa(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=wa._get(this._name)||void 0;n&&Aa(this._name,n)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=n)}catch(e){}else try{const e=wa._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=e?Aa(this._name,e):void 0,this._lastSeenMainCookieValue=e}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t=!1){if(this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;let i;try{i=wa._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;const s=Aa(this._name,i);let n;try{n=Ra(JSON.parse(i))}catch(e){return!1}if((wa._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=i;const r=La(this._name,i),o=[...xa,...r.properties],a={};if(Object.keys(n).forEach(e=>{const t=n[e];(Et(t)||It(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete n[e])}),Ct(n))return!1;const l="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,c=this.props,u=c[_],d=c[Ce],h=$n({},c);[...xa,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in n)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){const t=h[e];(r.isValid||-1===xa.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=$n(h,n),Gy.forEach(e=>{const t=e in this.props;e in c===t&&Ky(c[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,c[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this._setProp(Ce,Ge);const p=this.props[_],g=this.props[Ce];return!l||p===u&&g===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Na._set(zy(this._name),!0),this._deleteProp(re),this._deleteProp(Y),this._deleteProp(Z),this._deleteProp(X),this._deleteProp(ee),this._deleteProp(te),this._deleteProp(ke),this._deleteProp(we),this._deleteProp(be),"anonymous"!==g||"identified"!==d&&"anonymous"!==n.$user_state&&(Et(u)||p===u)||(Yy(this.props,n),this._deleteProp(oe)),"identified"===g?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(v)),!0}consumeCookieIdentityChange(){const e=zy(this._name),t=this._cookieIdentityChangePending||!!Na._get(e);return this._cookieIdentityChangePending=!1,t&&Na._remove(e),t}_beginCookieSyncSuppression(e=!1){return!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Vy],this._writeNow(!0))}_endCookieSyncSuppression(e=!0){if(this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===Wy.indexOf(t.persistence.toLowerCase())&&(Fn.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1)=>{const s=[...xa,...t];return at(at({},Ca),{},{_parse(e){try{let n,r={};try{n=wa._get(e)||void 0,r=n?Ra(JSON.parse(n)):{}}catch(e){}const o=JSON.parse(Ca._get(e)||"{}");let a;if(i){const i=La(e,n),l=[...xa,...i.properties],c={};Object.keys(r).forEach(e=>{const t=r[e];It(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(c[e]=t)});const u="distinct_id"in c||"anonymous"===c.$user_state||"identified"===c.$user_state;if(Object.keys(c).length>0){var t;const e=o[_],n=null!==(t=o.$user_state)&&void 0!==t?t:Ge;s.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in r)&&(u||"distinct_id"!==e&&"$user_state"!==e)){const t=o[e];(i.isValid||-1===xa.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!u||"$user_state"in r||"$user_state"in o||(o[Ce]=Ge),!u||("distinct_id"in c?c[_]:o[_])===e&&("$user_state"in c?c[Ce]:o[Ce])===n||(Ea.forEach(e=>delete o[e]),"identified"===c.$user_state&&"distinct_id"in c?o.$user_id=c[_]:delete o.$user_id,"identified"!==c.$user_state&&(delete o[ae],delete o[oe]),delete o.__alias)}a=$n(o,c)}else a=$n(r,o);return Ca._set(e,a),a}catch(e){}return null},_set(e,s,n,r,o,a){const l=Ca._set(e,s,void 0,void 0,a);try{const c=Pa(s,t);if(Object.keys(c).length){if(i){const i=Ta(e),u=Fa(c,t);if(wa._set(i,u,n,r,o,a),wa._get(i)!==JSON.stringify(u)){wa._remove(i,r);const t=Pa(s);return wa._set(e,t,n,r,o,a),l}}wa._set(e,c,n,r,o,a)}}catch(e){Ca._error(e)}return l},_remove(t,i){try{null==e||e.localStorage.removeItem(t),wa._remove(t,i),wa._remove(Ta(t),i)}catch(e){Ca._error(e)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict);let s,n=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&Ca._is_supported()?(s=Ca,r=!0):"localstorage+cookie"===o&&i._is_supported()?(s=i,r=!0,n=!0):"sessionstorage"===o&&Na._is_supported()?s=Na:"memory"===o?s=$a:"cookie"===o&&wa._is_supported()?(s=wa,n=!0):i._is_supported()?(s=i,r=!0,n=!0):wa._is_supported()?(s=wa,n=!0):s=$a,this._splitStorageEligible=r,this._storesIdentityInCookie=n,s}_groupEntryName(e){return`${this._name}__${e}`}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){const e={};return On(this.props,(t,i)=>{const s=Hy(i);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this._disabled&&!e)return;const t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?Ca._parse(this._name):null;let s={};if(t)try{s=Ra(wa._parse(this._name)),On(s,(e,t)=>{(Et(e)||It(e)||""===e)&&delete s[t]})}catch(e){}const n=this._storage._parse(this._name);if(n&&(this.props=$n({},n)),this._splitStorage&&this._loadGroupEntries(),t&&n){var r,o;const e=null==i?void 0:i[_],t=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Ge,a=n[_],l=null!==(o=n.$user_state)&&void 0!==o?o:Ge;if(a!==e||l!==t){this._cookieIdentityChangePending=!0,Na._set(zy(this._name),!0);const i=$n({},this.props);Ea.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(Et(e)||a===e)||(Yy(i,s),delete i[oe]),this.props=i;const n=new Set;Ea.forEach(e=>{var t;const i=null===(t=Hy(e))||void 0===t?void 0:t.storageGroup;i&&n.add(i)}),n.forEach(e=>{const t={};On(this.props,(i,s)=>{var n;(null===(n=Hy(s))||void 0===n?void 0:n.storageGroup)===e&&(t[s]=i)}),Ct(t)?(Ca._remove(this._groupEntryName(e)),this._slotState[e]={}):Ca._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Na._get(zy(this._name))&&(this._cookieIdentityChangePending=!0)}_loadGroupEntries(){for(const e of Ny){const t=Ca._parse(this._groupEntryName(e));if(t&&!Ct(t)){const i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||$n(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=Hy(t))||void 0===i?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){const i=Uy[e];if(!i)return!1;const s=t[i],n=this.props[i];return Pt(s)&&Pt(n)&&n>s}refreshKey(e){var t;if(this._disabled)return;if("$fbc_persistence"===e&&this._facebookClickIdChangePending)return;const i=this._splitStorage?null===(t=Hy(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?Ca._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){const t=this._storage._parse(this._name);if(t&&e in t)return void this._setProp(e,t[e],!1)}this._deleteProp(e,!1)}}save(){if(this._disabled)return;const e=this._saveDebounceMs();e>0?Et(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}flush(){Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e=!1){if(this._disabled||this._cookieSyncSuppressed&&!e)return;e||(this.syncCookieProperties(),this._facebookClickIdChangePending||this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshKey(b));const t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);const i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)return void(this._config.debug&&Fn.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));const s=this._writeEntry(this._storage,this._name,this.props,Vy);"written"===s&&this._rememberCurrentCookieProperties(this.props),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}_writeNowSplit(){const{main:e,groups:t}=this._partitionProps(),i=this._writeEntry(this._storage,this._name,e,Vy);"written"===i&&this._rememberCurrentCookieProperties(e),"failed"!==i&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,Gy.forEach(e=>{var t;(null===(t=Hy(e))||void 0===t?void 0:t.storageGroup)||this._pendingCrossTabFeatureFlagChanges.delete(e)}));for(const e of Ny){var s;const i=t[e];if(Ct(i)&&!(null===(s=this._slotState[e])||void 0===s?void 0:s.persisted)){Gy.forEach(t=>{var i;(null===(i=Hy(t))||void 0===i?void 0:i.storageGroup)===e&&this._pendingCrossTabFeatureFlagChanges.delete(t)});continue}const n=this._writeEntry(Ca,this._groupEntryName(e),i,e);"failed"!==n&&Gy.forEach(t=>{const i=Hy(t);(null==i?void 0:i.storageGroup)!==e||"written"!==n&&i.volatile||this._pendingCrossTabFeatureFlagChanges.delete(t)})}}_partitionProps(){const e={},t={flags:{},surveys:{}};return On(this.props,(i,s)=>{var n;const r=null===(n=Hy(s))||void 0===n?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Vy)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;const i={};return On(e,(e,t)=>{var s;i[t]=(null===(s=Hy(t))||void 0===s?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){const n=this._slotWriteState(s);if(s!==Vy&&!n.dirty&&!Et(n.fingerprint))return"skipped";let r;try{if(r=this._entryFingerprint(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,s!==Vy&&(n.persisted=!0),Et(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=Ca._get(t)),"written"):(this._config.debug&&Fn.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this._markAllCrossTabFeatureFlagChangesPending(),Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!e&&this._ownsSplitStorage)for(const e of Ny)Ca._remove(this._groupEntryName(e));e?delete this._slotState[Vy]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(kt(e)){this.syncCookieProperties(),Et(t)&&(t="None"),this._expire_days=Et(i)?this._default_expiry:i;let s=!1;if(On(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(kt(e)){this.syncCookieProperties(),this._expire_days=Et(t)?this._default_expiry:t;let i=!1;if(On(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||kt(t)||St(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t="string"==typeof e?[e]:e;let i=!1;for(const e of t)e in this.props&&(this._deleteProp(e),i=!0);i&&this.save()}update_campaign_params(){const e=null==s?void 0:s.URL;if(e===this._campaign_params_url)return;const t=fl(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!Ct(qn(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}update_search_keyword(){this.register(function(){const e=null==s?void 0:s.referrer;return e?ml(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:wl(),$referring_domain:(null==s?void 0:s.referrer)&&(null===(e=Qn(s.referrer))||void 0===e?void 0:e.host)||Sl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=kl(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Re]:this._storesIdentityInCookie?{r:jy(e.r),u:e.u?jy(e.u):void 0}:e},void 0)}get_initial_props(){const e={};On([Ie,Te],t=>{const i=this.props[t];i&&On(i,function(t,i){e["$initial_"+ft(i)]=t})});const t=this.props[Re];if(t){const i=function(e,t=!1){const i=Cl(e,t),s={};return On(i,function(e,t){s[`$initial_${ft(t)}`]=e}),s}(t,this._config.disable_capture_url_hashes);$n(e,i)}return e}safe_merge(e){return On(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;const i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(s||n||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(at(at({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=r||o?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();const u=this._resolveSplitStorage(e),d=r||u!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const e=this.props;this.clear(),this._storage=c,this._splitStorage=u,this.props=e,this.save()}else o&&(this._storage=c,a||(delete this._slotState[Vy],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){const e=this.props[Re];if(!this._storesIdentityInCookie||!kt(e)||"string"!=typeof e.r)return;const t=jy(e.r),i="string"==typeof e.u?jy(e.u):e.u;t===e.r&&i===e.u||this._setProp(Re,at(at({},e),{},{r:t,u:i}))}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){const i=this.props.__timers||{};i[e]=t,this._setProp(S,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return Et(i)||(delete t[e],this._setProp(S,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i=!0){var s;const n=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||n===t||(this._localIdentityChangePending=!0),"$fbc_persistence"!==e||Ky(n,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,n,t),(null===(s=Hy(e))||void 0===s?void 0:s.volatile)||this._markGroupDirty(e))}_deleteProp(e,t=!0){delete this.props[e],t&&(Qy(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),"$fbc_persistence"===e&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t;const i=null===(t=Hy(e))||void 0===t?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}};const Xy={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},eb={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"},tb={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"},ib=Ln("[RateLimiter]");var sb=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{ib.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void ib.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?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const e=(Pt(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this._captureWarning(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){const t=this.instance.config.property_denylist;return!St(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&(null==n?void 0:n.pathname))return`${null!==(e=n.origin)&&void 0!==e?e:""}${n.pathname}`}_captureWarning(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};const nb=Ln("[RemoteConfig]");var rb=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}_loadRemoteConfigJs(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,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 nb.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void nb.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return nb.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){nb.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||nb.warn("Failed to fetch remote config from PostHog."):nb.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){nb.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 i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(e){nb.error("Error loading feature flags",e)}}};const ob=["fatal","error","warning","log","info","debug"],ab=!!o||!!r,lb="text/plain";let cb=!1;const ub=(e,t)=>{const[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;const o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},db=(e,t,i=!0)=>{var s;const[n,r]=e.split("?"),o=at({},t),a=null!==(s=null==r?void 0:r.split("&").map(e=>{var t;const[s,n]=e.split("="),r=i&&null!==(t=o[s])&&void 0!==t?t:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],l=Kn(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},hb=e=>{if(e._encodedBody)return e._encodedBody;const{data:t,compression:i}=e;if(!t)return;if(i===Z_.GZipJS){const e=aa(la(Gn(t)),{mtime:0});return{contentType:lb,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===Z_.Base64){const e=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(Gn(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:Gn(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const s=Gn(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},pb=e=>{const t=()=>"sendBeacon"===e.transport?{url:db(e.url,{compression:Z_.Base64}),encodedBody:hb(at(at({},e),{},{compression:Z_.Base64,_encodedBody:void 0}))}:{url:ub(e.url,"compression"),encodedBody:hb(at(at({},e),{},{compression:void 0,_encodedBody:void 0}))};let i;try{i=hb(e)}catch(i){if(Xs(e.compression,Zn(e.url,"compression")))return Fn.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return i&&Xs(e.compression,Zn(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?Js(new Uint8Array(s)):ArrayBuffer.isView(s)&&Js(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(cb=!0,t()):{url:e.url,encodedBody:i};var s},_b=e=>{try{return pb(e)}catch(i){var t;return Fn.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},gb=function(){var e=st(function*(e){const t=yield an(Gn(e.data),Ba.DEBUG,{rethrow:!0});if(!t)return e;const i=yield t.arrayBuffer();return at(at({},e),{},{_encodedBody:{contentType:lb,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),fb=/Failed to fetch|NetworkError|Load failed/i,vb=e=>"TypeError"===(null==e?void 0:e.name)&&fb.test((null==e?void 0:e.message)||""),mb=e=>{const t=_b(e);if(!t)return;const i=new o,{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);const{contentType:r,body:a}=null!=n?n:{};On(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;const s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,s)}},i.send(a)},yb=e=>{const t=_b(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:n,body:o,estimatedSize:l}=null!=s?s:{},c=new Headers;On(e.headers,function(e,t){c.append(t,e)}),n&&c.append("Content-Type",n);let u=null,d=!1;if(a){const t=new a;u={signal:t.signal,timeout:setTimeout(()=>{var i;d=!0,t.abort(is("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))},e.timeout)}}const h=t=>{var i;d&&"AbortError"===(null==t?void 0:t.name)||vb(t)?Fn.warn(t):Fn.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t})};try{r(i,at({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:o,signal:null==u?void 0:u.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s;const n={statusCode:t.status,text:i};if(200===t.status)try{n.json=JSON.parse(i)}catch(e){Fn.error(e)}null===(s=e.callback)||void 0===s||s.call(e,n)})).catch(h).finally(()=>u?clearTimeout(u.timeout):null)}catch(e){u&&clearTimeout(u.timeout),h(e)}},bb=e=>{try{var t;const{url:s,encodedBody:n}=pb(e),{contentType:o,body:a,estimatedSize:l}=null!=n?n:{};if(!a)return;const c=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(s,c))return;const u=St(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(St(u)&&u.length>1&&(null!=l?l:0)>16384){const t=Math.ceil(u.length/2),i=t=>St(e.data)?t:at(at({},e.data),{},{batch:t});return bb(at(at({},e),{},{data:i(u.slice(0,t))})),void bb(at(at({},e),{},{data:i(u.slice(t))}))}Fn.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?yb(at(at({},e),{},{_keepaliveDisabled:!0})):mb(e)}catch(e){Fn.warn("Beacon send failed",e)}},Sb=(e,t,i,s)=>{const n="query"===s?"POST"===t?"sent_at":"_":void 0;return db(i===Z_.GZipJS?ub(e,"compression"):e,at(at({},n?{[n]:Date.now().toString()}:{}),i===Z_.GZipJS?{}:{compression:i}))},wb=(()=>{const e=[];return r&&e.push({transport:"fetch",method:yb}),o&&e.push({transport:"XHR",method:mb}),(null==i?void 0:i.sendBeacon)&&e.push({transport:"sendBeacon",method:bb}),e})();var kb=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Vt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Fn.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();const 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(at(at({},e),{},{transport:"sendBeacon"}))})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){const e=this._formatQueue();for(const t in e){const i=e[t],s=(new Date).getTime();i.data&&St(i.data)&&On(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),this._sendRequestSafely(i)}}},this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Fn.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){const e={};return On(this._queue,t=>{var i;const s=t,n=(s?s.batchKey:null)||s.url;Et(e[n])&&(e[n]=at(at({},s),{},{data:[]})),null===(i=e[n].data)||void 0===i||i.push(s.data)}),this._queue=[],e}};const Cb=["retriesPerformedSoFar"];var Eb=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!Et(e)&&"onLine"in e.navigator){if(this._areWeOnline=e.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},zn(e,"online",this._onlineListener),zn(e,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e){let{retriesPerformedSoFar:t}=e,i=cn(e,Cb);Mt(t)&&(i.url=db(i.url,{retry_count:t})),this._instance._send_request(at(at({},i),{},{callback:e=>{var s;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(at({retriesPerformedSoFar:t},i));0===e.statusCode&&Fn.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===(s=i.callback)||void 0===s||s.call(i,e)}}))}_enqueue(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const i=function(e){const t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),n=(Math.random()-.5)*(s-i);return Math.ceil(s+n)}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});let n=`Enqueued failed request for retry in ${i}`;navigator.onLine||(n+=" (Browser is offline)"),Fn.warn(n),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(){const e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Et(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0));for(const{requestOptions:e}of this._queue)try{this._instance._send_request(at(at({},e),{},{transport:"sendBeacon"}))}catch(e){Fn.error(e)}this._queue=[]}},xb=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=r+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(r),this._context.maxScrollY=Math.max(r,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!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){const e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){zn(e,"scroll",this._updateScrollData,{capture:!0}),zn(e,"scrollend",this._updateScrollData,{capture:!0}),zn(e,"resize",this._updateScrollData)}scrollElement(){if(this._scrollRoot){const i=St(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(const s of i){var t;const i=null==e||null===(t=e.document)||void 0===t?void 0:t.querySelector(s);if(i)return i}return}var i;return null==e||null===(i=e.document)||void 0===i?void 0:i.documentElement}_scrollPosition(t){var i,s;const n="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){const e=this.scrollElement();return e&&e[n]||0}return e?"y"===t?e.scrollY||e.pageYOffset||(null===(i=e.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:e.scrollX||e.pageXOffset||(null===(s=e.document)||void 0===s||null===(s=s.documentElement)||void 0===s?void 0:s.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}};const Tb=e=>kl(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);var Ib=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{const t=this._getStored();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Ee]:i})},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||Tb,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Ee]}getSetOnceProps(){var e;const t=null===(e=this._getStored())||void 0===e?void 0:e.props;return t?"r"in t?Cl(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(){const e={};return On(qn(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${ft(i)}`]=t}),e}},Rb=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(const i of this._events[e]||[])i(t);for(const i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}};const Pb=Ln("[SessionId]"),Mb=864e5;var Fb=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new Rb,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Mt(e)||!Mt(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=i||va;const n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Vt(this._config.session_idle_timeout_seconds||1800,60,36e3,Pb.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){const e=Na._parse(this._window_id_storage_key),t=Na._parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:Na._remove(this._window_id_storage_key),Na._set(this._primary_window_exists_storage_key,!0)}(null===(s=this._config.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Et(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){const t=this._lastPersistedActivityTimestamp;return!It(t)&&!It(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){const s=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!s||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[q]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Mt(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(q):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(It(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._lastPersistedActivityTimestamp)return;this._refreshSessionIdFromStorage();const[,t,i]=this._getSessionId();t===this._sessionId&&i===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(){const[e]=this._getSessionId(),t=Mt(e)?e:0,i=Mt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){const e=this._persistence.props[q];return St(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=!1){const i=((e,t=(new Date).getTime())=>{try{const i=(e=>{const 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 i>t+6e4?void Pb.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void Pb.error("Invalid sessionID in bootstrap",e)}})(e);return!Et(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener(Ye,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)},zn(e,Ye,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||(new Date).getTime(),n=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(It(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var r,o;null===(r=(o=this._persistence).syncCookieProperties)||void 0===r||r.call(o),this._lastCookieSyncTimestamp=s}let[,a,l]=this._getSessionId();const c=!Et(n)&&a!==n,u=this._freshestActivityTimestamp();let d=this._getWindowId();const h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>Mb),_=h?p:Mt(l)&&Math.abs(s-l)>Mb;let g=!1,f=c;const v=!a||!!h,m=a;let y=!v&&!e&&this._sessionHasBeenIdleTooLong(s,u);if(y&&(y=this._isSessionIdleAfterCrossTabRefresh(s),y||Pb.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this._getSessionId()),v||y||_){f=!1;const e=h&&!p;a=e?h.sessionId:this._sessionIdGenerator(),d=this._windowIdGenerator(),Pb.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_}}),l=e?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,g=!0}else d||(d=this._windowIdGenerator(),g=!0),f=f||a!==m,f&&(Pb.info("adopted cross-tab session id",{sessionId:a,windowId:d}),g=!0);const b=Mt(u)&&e&&!_?u:s,S=Mt(l)?l:(new Date).getTime();this._setWindowId(d),this._setSessionId(a,b,S),e||this._resetIdleTimer();const w={noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_,crossTabAdoption:f};return g&&this._sessionIdChangedHandlers.forEach(e=>e(a,d,w)),{sessionId:a,windowId:d,sessionStartTimestamp:S,changeReason:g?w:void 0,lastActivityTimestamp:u}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){const e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};const Lb=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&jt(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>jt(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function Ab(){return Ab=st(function*(){const e=null==i?void 0:i.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return xt(i)&&i.length>0?i:void 0}catch(e){return void Fn.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),Ab.apply(this,arguments)}const Ob="custom",$b="i.posthog.com",Db=/^\/static\//,Nb=["/s/","/e/","/i/"];var Bb=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${$b}`,".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":Ob),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(!Db.test(e))return;const t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}_urlKey(e){const t=Qn(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;let s=i;const n=this.instance.config.rewriteRequestPath;if(n){var r;const e=(null===(r=Qn(i))||void 0===r?void 0:r.href)||i;s=n(new URL(e)).toString()}if(n&&"api"===e&&Nb.some(e=>0===t.indexOf(e))){const e=this._urlKey(s);if(e){const t=this.apiHost;let i=this._ingestionEndpoints;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===n||(i={apiHost:t,rewriteRequestPath:n,urls:new Set},this._ingestionEndpoints=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){const t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(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){const i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,`${i}${t}`)}if(this.region===Ob)return this._prepareEndpoint(e,t,this.apiHost+t);const i=$b+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}`)}}};const qb=Ln("[PostHog ExternalIntegrations]"),Hb={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Ub=class{constructor(e){this._instance=e}_loadScript(e,t){var i,s;null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,e,e=>{if(e)return qb.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e;for(const[n,r]of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{})){var t,i,s;r&&!(null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[n])&&this._loadScript(Hb[n],()=>{var e;null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[n])||void 0===e||e.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&(null===(s=h.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},Wb=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return st(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{const i=e.setup(t._client);i&&(yield i)}catch(i){const s=t._extensions.get(e.name)===e;s&&t._extensions.delete(e.name),t._logger.error(`Failed to set up browser extension "${e.name}"`,i),s&&t._disposeExtension(e)}})()}getExtension(e){return this._extensions.get(e)}dispose(){if(this._disposed)return;this._disposed=!0;const e=Array.from(this._extensions.values()).reverse();this._extensions.clear();for(const t of e)this._disposeExtension(t)}_disposeExtension(e){try{var t;const i=null===(t=e.dispose)||void 0===t?void 0:t.call(e);i&&wt(i.then)&&i.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)}}},zb=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const i={};for(const s of e){const e=null==t?void 0:t.get_property(s);Et(e)||(i[s]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}};const jb="extensionsRemoteConfig";var Vb=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=Fn,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new zb(e),this.onEvent=e=>lg(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 lg(()=>{});const t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(jb,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),lg(i)},this._runtime=new Wb(Fn.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(){const e=this.instance.get_property(g);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?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;const n=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s: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,i){var s=this;return st(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return lg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(jb,e))}sendRequest(e){var t=this;return st(function*(e,i={}){var s;const n=t.instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),r={method:i.method,url:i.query?db(n,i.query):n,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?ct.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(t.instance._send_request(r),{statusCode:202}):new Promise(e=>{r.callback=e,t.instance._send_request(r)})}).apply(this,arguments)}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}};const Gb={};let Qb=0;const Kb=()=>{},Zb='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Yb="Surveys module not available",Jb="sanitize_properties is deprecated. Use before_send instead",Xb="Invalid value for property_denylist config: ",eS=/^[A-Za-z0-9_-]{1,400}$/,tS=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,iS=["token","distinct_id",Fe],sS="posthog";let nS=!ab&&-1===(null==c?void 0:c.indexOf("MSIE"))&&-1===(null==c?void 0:c.indexOf("Mozilla"));const rS=e=>{const 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},oS=t=>{var i;return at({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Wn(null==s?void 0:s.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kb,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:n&&xt(null==n?void 0:n.search)&&-1!==n.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==e||null===(i=e.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Fn.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:Ke,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Kb},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:br,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:rS(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)}))(t))},aS=[["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"]],lS=e=>{const t={};for(const[i,s]of aS)Et(e[i])||(t[s]=e[i]);const i=$n({},t,e),s=e.__preview_external_dependency_versioned_paths;return Et(s)||(Et(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),xt(s)&&Et(e.asset_host)&&(i.asset_host=s)),St(e.property_blacklist)&&(Et(e.property_denylist)?i.property_denylist=e.property_blacklist:St(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Fn.error(Xb+e.property_denylist)),i};var cS=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Fn.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},uS=class t{_removeExtension(e){if(!e)return;const t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}_replaceExtension(e,t){var i;return this._removeExtension(e),this._extensions.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(this._hasWarnedAboutVolatileIdentity)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this._inCookielessMode())return;const e="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!e&&!this.config.disable_persistence)return;if(this._hasStableInitialDistinctId)return;let t,i,s;e?(t=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}_healCookielessSentinelDistinctId(){if(this._inCookielessMode()||"$posthog_cookieless"!==this.get_distinct_id())return;const e=this.persistence;if(!e)return;this._is_persistence_disabled()||e.load(!0);const t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){const t=this.config.get_device_id(va());this.register({distinct_id:t,$device_id:t}),e.set_property(Ce,Ge)}this._sync_opt_out_with_persistence()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new cS,this._personProcessingSetOncePropertiesSent=!1,this.version=Ba.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Rb,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=oS(),this.SentryIntegration=$y,this.sentryIntegration=e=>function(e,t){const i=Oy(e,t);return{name:Ay,processEvent:e=>i(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 xb(this),this.pageViewManager=new Dy(this),this.rateLimiter=new sb(this),this.requestRouter=new Bb(this),this.consent=new Ty(this),this.externalIntegrations=new Ub(this);const i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{const s=xt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{const s=xt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Fn.info(`send "${null==e?void 0:e.event}"`,e))}init(e,i,s){if(s&&s!==sS){var n;const r=null!==(n=Gb[s])&&void 0!==n?n:new t;return r._init(e,i,s),Gb[s]=r,Gb[sS][s]=r,r}return this._init(e,i,s)}_init(t,i={},s){var n,r,o;const a=xt(t)?t.trim():"";if(!a)return Fn.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==(null===(l=this.config)||void 0===l?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=oS(i.defaults),i.debug=this._checkLocalStorageForDebug(i.debug),this._originalUserConfig=i,this._triggered_notifs=[],i.person_profiles?this._initialPersonProfilesConfig=i.person_profiles:i.process_person&&(this._initialPersonProfilesConfig=i.process_person);const c=oS(i.defaults),u=lS(i),d=$n({},c,u,{name:s,token:a});kt(c.rageclick)&&kt(u.rageclick)&&(d.rageclick=$n({},c.rageclick,u.rageclick)),kt(c.session_recording)&&kt(u.session_recording)&&(d.session_recording=$n({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&Fn.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Z_.GZipJS;const h=this._is_persistence_disabled();if(this.persistence=new Jy(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Jy(at(at({},this.config),{},{persistence:"sessionStorage"}),h,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&Na._is_supported()){const e=Na._parse(this._sessionRegisteredPropertiesStorageKey);St(e)&&e.forEach(e=>{xt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Na._remove(this._sessionRegisteredPropertiesStorageKey);const p=at({},this.persistence.props),_=at({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new kb(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new Eb(this),this.__request_queue=[];const g=this._inCookielessMode();g||(this.sessionManager=new Fb(this),this.sessionPropsManager=new Ib(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Fn.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(g)},0)):(Fn.info("Initializing extensions synchronously"),this._initExtensions(g)),Ba.DEBUG=Ba.DEBUG||this.config.debug,Ba.DEBUG&&Fn.info("Starting in debug mode",{this:this,config:i,thisC:at({},this.config),p:p,s:_}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=at(at({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this._hasStableInitialDistinctId=!!v&&!Tt(v),void 0!==(null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID)){const e=i.bootstrap.distinctID,t=this.get_distinct_id(),s=this.persistence.get_property(Ce);if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"anonymous"===s)this.identify(e);else if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"identified"===s)Fn.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const t=this.config.get_device_id(va()),s=i.bootstrap.isIdentifiedID?t:e;this.persistence.set_property(Ce,i.bootstrap.isIdentifiedID?Qe:Ge),this.register({distinct_id:e,$device_id:s})}}if(g)this.register_once({distinct_id:Me,$device_id:null},"");else if(!this.get_distinct_id()){const e=this.config.get_device_id(va());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(Ce,Ge)}return zn(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),zn(e,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null===(e=this._retryQueue)||void 0===e||e.resume()}),i.segment?Ly(this,()=>this._loaded()):this._loaded(),wt(this.config._onCapture)&&this.config._onCapture!==Kb&&(Fn.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Fn.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 Ab.apply(this,arguments)}().then(e=>{e&&this.register({[f]:e})}).catch(Kb),this}_isSharedExtension(e){const t=e;return xt(t.name)&&wt(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>{var t;return null===(t=e.dispose)||void 0===t?void 0:t.call(e)}).catch(t=>{Fn.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var e,i,s;const n=null!==(e=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==e?e:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||(null===(r=this._featureFlagsReloadingUnsubscribe)||void 0===r||r.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new n(this)),wt(this.featureFlags.onReloading)&&wt(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null===(o=(a=this.featureFlags).initialize)||void 0===o||o.call(a))}_initExtensions(e){const i=performance.now(),s=at(at({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,u,d;s.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this._extensions.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this._extensions.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this._extensions.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this._enrollExtension(this.autocapture=new s.autocapture(this),n),s.surveys&&this._enrollExtension(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this._enrollExtension(this.logs=null!==(a=this.logs)&&void 0!==a?a:new s.logs(this),n),s.metrics&&this._extensions.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new s.metrics(this)),s.conversations&&this._extensions.push(this.conversations=null!==(c=this.conversations)&&void 0!==c?c:new s.conversations(this)),s.productTours&&this._extensions.push(this.productTours=new s.productTours(this)),s.heatmaps&&this._extensions.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this._extensions.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,Py)),s.toolbar&&this._extensions.push(this.toolbar=null!==(u=this.toolbar)&&void 0!==u?u:new s.toolbar(this)),s.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),this._extensions.forEach(e=>{e.initialize&&n.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),n.push(()=>{if(this._pendingRemoteConfig){const e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this._processInitTaskQueue(n,i)}_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);const i=e.shift();if(i)try{i()}catch(e){Fn.error("Error initializing extension:",e)}}const i=Math.round(performance.now()-t);this.register_for_session({[Le]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ae]:i}),this.config.__preview_deferred_init_extensions&&Fn.info(`PostHog extensions initialized (${i}ms)`)}_onRemoteConfig(e){var t;if(!s||!s.body)return Fn.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 i;const t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=_t(t.supportedCompression,Z_.GZipJS)?Z_.GZipJS:_t(t.supportedCompression,Z_.Base64)?Z_.Base64:void 0),(null===(i=t.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Ke}),null===(t=this._browserClientAdapter)||void 0===t||t.handleRemoteConfig(e),this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}_loaded(){try{this.config.loaded(this)}catch(e){Fn.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&(null==n?void 0:n.hostname)){const e=n.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 rb(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&An(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,n,r;this._isPageUnloading=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Xe),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this._requestQueue)||void 0===n||n.unload(),null===(r=this._retryQueue)||void 0===r||r.unload()):this._shouldCapturePageleave()&&this.capture(Xe,null,{transport:"sendBeacon"})}_send_request(e){var t,i,s;this.__loaded?nS?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(i=e.callback)||void 0===i||i.call(e,{statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=at(at({},this.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(Et(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,i,s;const n=at({},e);n.timeout=n.timeout||6e4;const r=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===r&&Et(n.compression)&&n.data&&(n.compression=Z_.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data=(e=>{var t,i;const s=(St(e)?e:[e]).map(e=>at(at({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(t=null==n||null===(i=n.properties)||void 0===i?void 0:i.token)&&void 0!==t?t:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(n.data):"body"===n.timestampMode&&(n.data=((e,t=(new Date).toISOString())=>St(e)?e.map(e=>at(at({},e),{},{sent_at:t})):at(at({},e),{},{sent_at:t}))(n.data))),n.url=Sb(n.url,n.method,n.compression,n.timestampMode);const o=wb.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),a=null!==(i=null===(s=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(o,e=>e.transport===r))||void 0===s?void 0:s.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");const c=e=>{try{a(e)}catch(e){var t;vb(e)?Fn.warn(e):Fn.error(e),null===(t=n.callback)||void 0===t||t.call(n,{statusCode:0,error:e})}};"sendBeacon"!==r&&n.data&&n.compression===Z_.GZipJS&&l&&"undefined"!=typeof Promise&&!cb?gb(n).then(e=>{c(e)}).catch(t=>{if(en(t))return cb=!0,void c(at(at({},n),{},{compression:void 0,url:Sb(e.url,e.method,void 0,e.timestampMode)}));tn(t)&&(cb=!0),c(n)}):a(n)})(at(at({},e),{},{callback:t=>{var i,s,n;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null===(s=(n=this.config).on_request_error)||void 0===s||s.call(n,t),null===(i=e.callback)||void 0===i||i.call(e,t)}}))):e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Qb++;try{let t;const i=[],s=[],n=[];An(e,e=>{if(e)if(t=e[0],St(t))n.push(e);else if(wt(e))try{e.call(this)}catch(t){Fn.error("Error executing queued PostHog call",e,t)}else St(e)&&"alias"===t?i.push(e):St(e)&&-1!==t.indexOf("capture")&&wt(this[t])?n.push(e):s.push(e)});const r=function(e,t){An(e,function(e){try{if(St(e[0])){let i=t;On(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Fn.error("Error executing queued PostHog call",e,t)}})};r(i,this),r(s,this),r(n,this)}finally{Qb--}}push(e){if(Qb>0&&St(e)&&xt(e[0])){const i=t.prototype[e[0]];return void(wt(i)&&i.apply(this,e.slice(1)))}this._execute_array([e])}_getPersistedFacebookClickId(){var e;const t=null===(e=this.persistence)||void 0===e?void 0:e.get_property(b);return xt(t)&&tS.test(t)?{value:t,delivered:!1}:kt(t)&&xt(t.value)&&tS.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,i,s){if(!this.persistence)return;this.persistence.refreshKey(b);const n=this._getPersistedFacebookClickId();if(!s){if(i)return xt(t)&&tS.test(t)?(t!==(null==n?void 0:n.value)&&this.persistence.register({[b]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==n?void 0:n.value)||!n.delivered}):void this.persistence.unregister(b);if(xt(e)&&eS.test(e)){if((null==n?void 0:n.value.split(".")[3])===e)return{value:n.value,pending:!n.delivered};const t=`fb.1.${Date.now()}.${e}`;return this.persistence.register({[b]:{value:t,delivered:!1}}),{value:t,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(b)}_markFacebookClickIdDelivered(e){if(!this.persistence)return;this.persistence.refreshKey(b);const t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[b]:{value:e,delivered:!0}})}capture(e,t,i){var s,n,r,o,a;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void Fn.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Et(e)||!xt(e))return void Fn.error("No event name provided to posthog.capture");this._healCookielessSentinelDistinctId();const l=!this.config.opt_out_useragent_filter&&this._is_bot();if(l&&!this.config.__preview_capture_bot_pageviews)return;const c=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==c?void 0:c.isRateLimited)return void Fn.critical("This capture call is ignored due to client rate limiting.");let u;(null==t?void 0:t.$current_url)&&!xt(null==t?void 0:t.$current_url)&&(Fn.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==i?void 0:i._originatedFromCaptureException)||Fn.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&&(u=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const d=new Date,h=(null==i?void 0:i.timestamp)||d,p=ts(null==i?void 0:i.uuid,va);let _={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},h,p)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&l&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),c&&(_.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);const g="$feature_flag_called"===e&&!1===_.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!g&&(_.$set=null==i?void 0:i.$set);const f=kt(null==t?void 0:t.$set)?t.$set:void 0,v=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,m=v||!!f&&"$fbc"in f,b=v?null==i||null===(s=i.$set)||void 0===s?void 0:s[y]:null==f?void 0:f[y],S=St(null==t?void 0:t.$unset)?t.$unset:[],w=(null==i?void 0:i.$unset)||[],k=-1!==S.indexOf("$fbc")||-1!==w.indexOf("$fbc"),C=this._updateFacebookClickId(null==u?void 0:u.fbclid,b,m,k);C&&!0===_.properties.$process_person_profile&&C.pending&&!m&&!g&&(_.$set=at({[y]:C.value},_.$set));const E=null==i?void 0:i.$unset;E&&(_.$unset=E);const x=g?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==tt,e===et);if(x&&(_.$set_once=x),(null==i?void 0:i._noTruncate)||(T=this.config.properties_string_max_length,_=function(e,t){const i=new Set;return function e(s,n){if(s!==Object(s))return t?t(s):s;if(i.has(s))return;let r;if(i.add(s),St(s))r=[],An(s,t=>{r.push(e(t))});else{const t={};On(Nt(s)?Hn(s):s,(s,n)=>{i.has(s)||(t[n]=e(s,n))}),r=t}return r}(e)}(_,e=>xt(e)?e.slice(0,T):e)),_.timestamp=h,Et(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=d),g&&(_.properties=((e,t=[])=>{const i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return Zs.forEach(s),t.forEach(s),i})(_.properties,iS)),e===rg.DISMISSED||e===rg.SENT){const i=null==t?void 0:t[og.SURVEY_ID],s=null==t?void 0:t[og.SURVEY_ITERATION];fg({id:i,current_iteration:s}),_.$set=at(at({},_.$set),{},{[Va({id:i,current_iteration:s},e===rg.SENT?"responded":"dismissed")]:!0})}else e===rg.SHOWN&&(_.$set=at(at({},_.$set),{},{[og.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var T;if(e===eb.SHOWN){const e=null==t?void 0:t[tb.TOUR_TYPE];e&&(_.$set=at(at({},_.$set),{},{[`${tb.TOUR_LAST_SEEN_DATE}/${e}`]:(new Date).toISOString()}))}const I=at(at({},_.properties.$set),_.$set);if(Ct(I)||this.setPersonPropertiesForFlags(I),!Rt(this.config.before_send)){const e=this._runBeforeSend(_);if(!e)return;_=e,_.uuid=ts(_.uuid,va)}const R=null!==(n=null===(r=_.$set)||void 0===r?void 0:r.$fbc)&&void 0!==n?n:kt(null===(o=_.properties)||void 0===o?void 0:o.$set)?_.properties.$set[y]:void 0,P=(null==C?void 0:C.pending)&&R===C.value?C.value:void 0;this._internalEventEmitter.emit("eventCaptured",_);const M=null!==(a=null==i?void 0:i._url)&&void 0!==a?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),F=at(at({method:"POST",url:M,data:_,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(M)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},(null==i?void 0:i.transport)?{transport:i.transport}:{}),P?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markFacebookClickIdDelivered(P)}}:{});var L;return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||P?(!F.transport&&!F.callback&&Ct(null!==(L=this.config.request_headers)&&void 0!==L?L:{})&&this._isPageUnloading&&(F.transport="sendBeacon"),this._send_retriable_request(F)):this._requestQueue.enqueue(F),_}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this._browserClientAdapter)||void 0===t?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new Vb(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);let t=!0;return()=>{if(!t)return;t=!1;const i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}_processCookieIdentityChange(e=!0){var t,i,s;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();const l=a?void 0:this.persistence.remove_event_timer(t);let u=at({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this._inCookielessMode()&&(u[Fe]=!0),"$snapshot"===t){const e=at(at({},this.persistence.properties()),this.sessionPersistence.properties());return u.distinct_id=e.distinct_id,(!xt(u.distinct_id)&&!Pt(u.distinct_id)||Tt(u.distinct_id))&&Fn.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}const d=function(t,i,s,r=!1){var o,a,l,u;if(!c)return{};const d=t?[...hl,...i||[]]:[],[h,p]=Vi(c),[_,g]=function(e){for(let t=0;Zi.length>t;t++){const[i,s,n]=Zi[t],r=e.match(i);if(r){const t=n&&e.match(n)||r;return[s,(null==t?void 0:t[1])||""]}}return["",""]}(c),f=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),v={};Et(s)||(v.detectGoogleSearchApp=s);const m={},y=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,S=null==e||null===(l=e.screen)||void 0===l?void 0:l.width,w=null==e||null===(u=e.screen)||void 0===u?void 0:u.height,k=null==e?void 0:e.devicePixelRatio;Et(y)||(m.userAgentDataPlatform=y),Et(b)||(m.maxTouchPoints=b),Et(S)||(m.screenWidth=S),Et(w)||(m.screenHeight=w),Et(k)||(m.devicePixelRatio=k);const C=$n(qn({$os:h,$os_version:p,$browser:Ui(c,navigator.vendor,f,v),$webview_app:_,$webview_app_version:g,$device:Gi(c),$device_type:Qi(c,m),$timezone:El(),$timezone_offset:xl()}),{$current_url:Yn(r?ss(null==n?void 0:n.href):null==n?void 0:n.href,d,_l),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:c.length>1e3?c.substring(0,997)+"...":c,$browser_version:zi(c,navigator.vendor,f,v),$browser_language:yl(),$browser_language_prefix:bl(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:Pn.LIB_NAME,$lib_version:Pn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Pn.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=Pn.SDK_DIST_CHANNEL),C}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);u.$session_id=e,u.$window_id=t}this.sessionPropsManager&&$n(u,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&$n(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null===(h=this._retryQueue)||void 0===h?void 0:h.length}catch(e){u.$sdk_debug_error_capturing_properties=String(e)}let p;if(this.requestRouter.region===Ob&&(u.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),u=$n(u,p),"$pageview"===t&&s&&(u.title=s.title),!Et(l)){const e=r.getTime()-l;u.$duration=parseFloat((e/1e3).toFixed(3))}c&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");const _=this.persistence.properties(),g=this.sessionPersistence.properties(),f=u.$groups,v=_.$groups;kt(f)&&!Ct(f)&&(u.$groups=at(at({},kt(v)?v:{}),f)),On(["$referrer","$referring_domain"],e=>{e in _&&delete g[e]});const m={};if(this._extensionEventPropertyProducers.length>0)for(const e of this._extensionEventPropertyProducers.slice())try{$n(m,e())}catch(e){Fn.error("Failed to produce browser extension event properties",e)}u=$n({},d,_,g,at(at({},m),u)),u.$is_identified=this._isIdentified(),St(this.config.property_denylist)?On(this.config.property_denylist,function(e){delete u[e]}):Fn.error(Xb+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&(Fn.error(Jb),u=y(u,t));const b=this._hasPersonProcessing();return u.$process_person_profile=b,b&&!a&&this._requirePersonProcessing("_calculate_event_properties"),u}_calculate_set_once_properties(e,t=!0,i=!1){var s;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=$n({},n,r||{},e||{});const a=this.config.sanitize_properties;return a&&(Fn.error(Jb),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Ct(o)?void 0:o}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var s;null===(s=this.persistence)||void 0===s||s.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this._processCookieIdentityChange(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||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)||void 0===t||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(!this._sessionRegisteredPropertiesStorageKey)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e._disabled)||!Na._is_supported())return void Na._remove(this._sessionRegisteredPropertiesStorageKey);const t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Na._set(this._sessionRegisteredPropertiesStorageKey,t):Na._remove(this._sessionRegisteredPropertiesStorageKey)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(e,t,i)}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:Yb}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Yb})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Yb})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=mg){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Yb}}canRenderSurveyAsync(e,t=!1){var i,s;return null!==(i=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Yb})}_validateIdentifyId(e){return!e||Tt(e)?(Fn.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Fn.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())||(Fn.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,i){if(!this.__loaded||!this.persistence)return Fn.uninitializedWarning("posthog.identify");if(Pt(e)&&(e=e.toString(),Fn.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))return;if(!this._requirePersonProcessing("posthog.identify"))return;this._healCookielessSentinelDistinctId();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression();let a=!1;try{const s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property("__alias")&&(this.unregister(v),this.register({distinct_id:e}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Ge,c=e!==s,u=!c&&o;if(c&&o){var l;const n=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:s};this.persistence.set_property(Ce,Qe),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(et,n,{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=nl(e,t,i),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(u){this.persistence.set_property(Ce,Qe);const s=t||{},n=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:s,$set_once:n}),this._cachedPersonProperties=nl(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);c||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(be)):u&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}setPersonProperties(e,t){if(!e&&!t)return;if(!this._requirePersonProcessing("posthog.setPersonProperties"))return;const i=nl(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Fn.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;const i=(St(e)?e:[e]).filter(e=>xt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,i){var s;if(!e||!t)return void Fn.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this._processCookieIdentityChange();const n=this.getGroups(),r=n[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:at(at({},n),{},{[e]:t})}),(r||i)&&this._hasPersonProcessing()){const s={$group_type:e,$group_key:t};i&&(s.$group_set=i),this.capture(tt,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){const t=Ft(e)?e:null==e?void 0:e.resetDeviceID,i=Ft(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t=!1,i){var s,n,r,o,a,l;if(Fn.info("reset"),!this.__loaded)return Fn.uninitializedWarning("posthog.reset");const c=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(s=this._originalUserConfig)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this._shouldDisableFlags());const u=this.get_property(g),d=this.get_property(f),h=this.get_property(F);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const p=this.is_capturing();this.consent.reset(),t||!p||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const _=null===(a=this.persistence)||void 0===a||null===(l=a._beginCookieSyncSuppression)||void 0===l?void 0:l.call(a);let v=!1;try{var m,y,b,S,w,k,C,E,x,T,I,R,P;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Et(h)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:h}),null===(b=this.surveys)||void 0===b||b.reset(),null===(S=this.featureFlags)||void 0===S||S.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(C=this.metrics)||void 0===C||C.reset(),null===(E=this.persistence)||void 0===E||E.set_property("$user_state","anonymous"),null===(x=this.sessionManager)||void 0===x||x.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Me,$device_id:null},"");else{const t=this.config.get_device_id(va());this.register_once({distinct_id:t,$device_id:e?t:u},""),e||Et(d)||this.register({[f]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this._inCookielessMode()||(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Et(c)&&!(null===(R=this.sessionManager)||void 0===R?void 0:R.setBootstrapSessionId(c,!0))){const e=at({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var M,L;_&&(null===(M=this.persistence)||void 0===M||null===(L=M._endCookieSyncSuppression)||void 0===L||L.call(M,v))}this.reloadFeatureFlags()}shutdown(e){var t=this;return st(function*(){var e,i,s,n,r,o,a;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null===(e=t.sessionRecording)||void 0===e||e.dispose(),null===(i=t.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(s=t.metrics)||void 0===s||s.flush("sendBeacon"),null===(n=t._requestQueue)||void 0===n||n.unload(),null===(r=t._retryQueue)||void 0===r||r.unload();try{var l;null===(l=t.featureFlags)||void 0===l||l.destroy()}catch(e){Fn.error("Error while destroying feature flags",e)}null===(o=t.persistence)||void 0===o||o.destroy(),null===(a=t.sessionPersistence)||void 0===a||a.destroy()}else Fn.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null===(i=this.conversations)||void 0===i||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||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?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var n;const t=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!i)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(Fn.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Et(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(v,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Fn.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t=at({},this.config);if(kt(e)){var i,s,n,r,o,a,l,c,u,d,h,p,_;$n(this.config,lS(e));const f=this._is_persistence_disabled();null===(i=this.persistence)||void 0===i||i.update_config(this.config,t,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Jy(at(at({},this.config),{},{persistence:"sessionStorage"}),f,!1);const v=this._checkLocalStorageForDebug(this.config.debug);var g;Ft(v)&&(this.config.debug=v),Ft(this.config.debug)&&(this.config.debug?(Ba.DEBUG=!0,Ca._is_supported()&&Ca._set("ph_debug",!0),Fn.info("set_config",{config:e,oldConfig:t,newConfig:at({},this.config)})):(Ba.DEBUG=!1,Ca._is_supported()&&Ca._remove("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this._shouldDisableFlags()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(l=this.tracingHeaders)||void 0===l||l.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(u=this.heatmaps)||void 0===u||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(h=this.deadClicksAutocapture)||void 0===h||h.startIfEnabledOrStop(),null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),this._sync_opt_out_with_persistence(),null===(_=this.externalIntegrations)||void 0===_||_.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Ly(this,Kb,!1)}}_overrideSDKInfo(e,t){Ba.LIB_NAME=e,Ba.LIB_VERSION=t}startSessionRecording(e){const t=!0===e,i={sampling:t||!!(null==e?void 0:e.sampling),linked_flag:t||!!(null==e?void 0:e.linked_flag),url_trigger:t||!!(null==e?void 0:e.url_trigger),event_trigger:t||!!(null==e?void 0:e.event_trigger)};var s,n,r,o,a;Object.values(i).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),i.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),i.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),i.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),i.event_trigger&&(null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(at(at({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var e,i;return null!==(e=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==e?e:t._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:sS;return t!==sS&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?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()&&Ct(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0: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?(Fn.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Pe,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;const 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;const i=this._is_persistence_disabled();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s._onOptOut(),(null===(e=this.persistence)||void 0===e?void 0:e._disabled)!==i&&(null===(n=this.persistence)||void 0===n||n.set_disabled(i)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t._disabled)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),i}opt_in_capturing(e){var i;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var s,n,r,o,a,l;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Fb(this),this.pageViewManager=new Dy(this),this.persistence&&(this.sessionPropsManager=new Ib(this,this.sessionManager,this.persistence));const e=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=t.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var c,u;e&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new e(this)),this._lastRemoteConfig&&(null===(c=this.sessionRecording)||void 0===c||null===(u=c.onRemoteConfig)||void 0===u||u.call(c,this._lastRemoteConfig)))}var d,h;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled()),(Et(null==e?void 0:e.captureEventName)||(null==e?void 0:e.captureEventName))&&this.capture(null!==(h=null==e?void 0:e.captureEventName)&&void 0!==h?h:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Fn.warn(Zb)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Fn.warn(Zb);const e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var t,i;null==e||e.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:Me,$device_id:null}),this._removeExtension(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const 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 i?Lb(i,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){s&&("visible"===s.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Je,{title:s.title},{send_instantly:!0}),this._visibilityStateListener&&(s.removeEventListener(Ze,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),zn(s,Ze,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.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(){const 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?(Fn.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,i,s,n){const r=t in e&&!Rt(e[t]),o=i in e&&!Rt(e[i]);return r?e[t]:!!o&&(n&&n.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Fn)}_runBeforeSend(e){var t;if(Rt(this.config.before_send))return e;const i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Ot),s=St(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=e;for(const t of s)try{if(n=t(n),Rt(n)){const t=`Event '${e.event}' was rejected in beforeSend function`;return At(e.event)?Fn.warn(`${t}. This can cause unexpected behavior.`):Fn.info(t),null}n.properties&&!Ct(n.properties)||Fn.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return Fn.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(const t of i)if(n.properties&&Rt(n.properties[t]))return Fn.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){const t=Ft(e)&&!e,i=Ca._is_supported()&&"true"===Ca._get("ph_debug");return!t&&(!!i||e)}};uS.__defaultExtensionClasses={},uS._noopLogger=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Bn(e.prototype[t[i]])}(uS,["identify"]);var dS=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,i=kt(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==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}};const hS=Ln("[ExceptionAutocapture]"),pS=Ln("[TracingHeaders]"),_S=Ln("[Web Vitals]"),gS=9e5,fS=["CLS","FCP","INP","LCP"],vS=["INP","LCP"],mS=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],yS=Ln("[SessionRecording]"),bS=Ln("[Heatmaps]");function SS(e){return kt(e)&&"clientX"in e&&"clientY"in e&&Pt(e.clientX)&&Pt(e.clientY)}const wS=Ln("[Product Tours]"),kS=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(R))},CS=["$set_once","$set"],ES=Ln("[SiteApps]"),xS="Error while initializing PostHog app with config id ",TS=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),IS="SDK is not enabled or survey functionality is not yet loaded",RS="Disabled. Not loading surveys.";var PS=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)return;if(this._config.disableSurveys)return;if(!e.ok)return cg.warn("Remote config unavailable. Not loading surveys.");const t=e.config.surveys;if(Rt(t))return cg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=Ft(t)?t:t.length>0,cg.info(`flags response received, isSurveysEnabled: ${this._isSurveysEnabled}`),this.loadIfEnabled()}}setup(e){if(!this._disposed)return this._initializingClient=e,TS(e.kv.initialize(),()=>{if(this._initializingClient!==e||this._disposed)return;this._initializingClient=void 0,this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(s=i.dispose)||void 0===s||s.call(i),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)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(this._disposed||!this._client)return;const e=this._config;if(this._surveyManager)return;if(this._isInitializingSurveys)return void cg.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void cg.info(RS);if(e.cookielessMode&&this._configSource.isOptedOut())return void cg.info("Not loading surveys in cookieless mode without consent.");const t=this._configSource.getExtensions();if(!t)return void cg.error("PostHog Extensions not found.");if(Et(this._isSurveysEnabled)&&!e.advancedEnableSurveys)return;const i=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{const e=t.generateSurveys;if(e)return this._completeSurveyInitialization(e,i),void(this._isInitializingSurveys=!1);const s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(Ve),void(this._isInitializingSurveys=!1);s(e=>{try{if(this._disposed)return;const t=this._configSource.getExtensions();e||!(null==t?void 0:t.generateSurveys)?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,i)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),cg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){cg.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=!1){var i;const s=null!==(i=this._client)&&void 0!==i?i:this._initialClientState;if(!s||this._disposed)return;if(this._config.disableSurveys)return cg.info(RS),e([]);const n=s.kv.get(le);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)return void this._getSurveysInFlightPromise.then(({surveys:t,context:i})=>{this._disposed||e(t,i)}).catch(e=>cg.error("Error in survey callback",e));const r=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(s,e)}catch(e){return cg.error("Error processing surveys response",e),this._handleSurveyResponse(s,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(s,{statusCode:0,error:e}));this._getSurveysInFlightPromise=r;const o=()=>{this._getSurveysInFlightPromise===r&&(this._getSurveysInFlightPromise=null)};r.then(t=>{o(),this._disposed||e(t.surveys,t.context)},o).catch(e=>cg.error("Error in survey callback",e))}_sendSurveysRequest(e,t){const i=this._client;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:new Error(IS)}))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:IS}};const i=t.statusCode;if(200!==i||!t.json){const e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?cg.error(e):t.error||cg.warn(e),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this._lastSurveyRefreshFailedAt=null;const s=t.json.surveys||[],n=s.filter(e=>hg(e)&&(Ja(e)||pg(e)));var r;return n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n)),e.kv.set({[le]:s,[ce]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t;const i=null===(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)||void 0===e?void 0:e.kv.get(ce);return Pt(i)&&Date.now()-i>3e5}_isSurveyRefreshBackingOff(){return Pt(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var i;const s={id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null};fg(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(const t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){cg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t=!1){if(!Rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);cg.warn("init was not called")}_getSurveyById(e){let t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}_checkSurveyEligibility(e){if(Rt(this._surveyManager))return{eligible:!1,reason:IS};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(!this._configSource.isCapturing())return{eligible:!1,reason:ug};if(Rt(this._surveyManager))return{eligible:!1,reason:IS};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Rt(this._surveyManager))return cg.warn("init was not called"),{visible:!1,disabledReason:IS};const t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Rt(this._surveyManager)?(cg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:IS})):new Promise(i=>{this.getSurveys(t=>{var s;const n=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(n){const e=this._checkSurveyRenderability(n);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var n;if(!this._configSource.isCapturing())return;if(Rt(this._surveyManager))return void cg.warn("init was not called");const r="string"==typeof e?this._getSurveyById(e):e;if(!(null==r?void 0:r.id))return void cg.warn("Survey not found");if(!vg.includes(r.type))return void cg.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==s?void 0:s.querySelector(t);if(o){if(null===(n=r.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds){cg.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const e=setTimeout(()=>{var t,s;this._renderTimeouts.delete(e),!this._disposed&&this._configSource.isCapturing()&&(cg.info(`Rendering survey ${r.id} with delay of ${null===(t=r.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(r,o,i),cg.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this._renderTimeouts.add(e)}this._surveyManager.renderSurvey(r,o,i)}else cg.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this._configSource.isCapturing())return;if(Rt(this._surveyManager))return void cg.warn("init was not called");const s=this._getSurveyById(e);if(!s)return void cg.warn("Survey not found");let n=s;if((null===(i=s.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(n=at(at({},s),{},{appearance:at(at({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==ag.Popover&&t.initialResponses&&cg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){const e=this._checkSurveyEligibility(s);if(!e.eligible)return void cg.warn("Survey is not eligible to be displayed: ",e.reason)}t.displayType!==ag.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){Rt(this._surveyManager)?cg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}};function MS(e,t,i){if(Rt(e))return!1;switch(i){case"exact":return e===t;case"contains":{const 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 FS=class{constructor(e){this._instance=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new Rb,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?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;Et(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null===(e=this._captureHookUnsubscribe)||void 0===e||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new Rb}register(e){var t,i;if(!Et(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const e=new Set;this._actionRegistry.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}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(const i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null==t?void 0:t.url){var i;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!MS(s,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 i;if(!(null==t?void 0:t.href))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>MS(e.href,t.href,t.href_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&MS(function(e){const t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(n),t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(!(null==t?void 0:t.text))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>MS(e.text,t.text,t.text_matching||"exact")||MS(e.$el_text,t.text,t.text_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&(r=function(e){const t=[],i=/(?::|")text="(.*?)"/g;let s;for(;!Rt(s=i.exec(e));)t.includes(s[1])||t.push(s[1]);return t}(n),o=t.text,a=t.text_matching||"exact",r.some(e=>MS(e,o,a)));var r,o,a}_checkStepSelector(e,t){var i,s;if(!(null==t?void 0:t.selector))return!0;const n=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(null==n?void 0:n.includes(t.selector))return!0;const r=(null==e||null===(s=e.properties)||void 0===s?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||sl(t.properties.reduce((e,t)=>{const i=St(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},LS=class{constructor(e){var t,i;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null===(t=this._instance)||void 0===t||null===(i=t.onSessionId)||void 0===i?void 0:i.call(t,e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&sl(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){const i=new Map;return e.forEach(e=>{var s;null===(s=e.conditions)||void 0===s||null===(s=s[t])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(t=>{if(null==t?void 0:t.name){const s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}_getMatchingItems(e,t,i){const s=(i===Y_.Activation?this._eventToItems:this._cancelEventToItems).get(e);let n=[];return this._getItems(e=>{n=e.filter(e=>null==s?void 0:s.includes(e.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[i])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(t=>t.name===e);return this._doesEventMatchFilter(r,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var i;Et(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){const i=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});var s;if(t&&this._actionToItems.clear(),0===i.length)return void(t&&(null===(s=this._actionMatcher)||void 0===s||s.replace([])));this._actionMatcher||(this._actionMatcher=new FS(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));const n=[];i.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEach(t=>{if(n.push(t),t.name){var i;const s=null!==(i=this._actionToItems.get(t.name))&&void 0!==i?i:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}})}),t?this._actionMatcher.replace(n):this._actionMatcher.register(n)}_mergeItemMaps(e,t){t.forEach((t,i)=>{var s;const n=null!==(s=e.get(i))&&void 0!==s?s:[];t.forEach(e=>{n.includes(e)||n.push(e)}),e.set(i,n)})}_setupEventBasedItems(e,t){var i,s;const n=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this._buildEventToItemMap(e,Y_.Activation),a=this._buildEventToItemMap(e,Y_.Cancellation);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==n.length||0!==r.length)&&(null!==(i=this._captureHookUnsubscribe)&&void 0!==i||(this._captureHookUnsubscribe=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;const n=this._getLogger(),r=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(s=t.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const t=this._activationOutcome(e,r);if("consume"===t)return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._deactivateItems([r]);if("persist"===t)return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this._persistActivation(r),void this._clearActivationTimestamps([r])}if(this._cancelEventToItems.has(e)){const i=this._getMatchingItems(e,t,Y_.Cancellation);i.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._deactivateItems(i.map(e=>e.id)),i.forEach(e=>this._cancelPendingItem(e.id)))}if(!this._eventToItems.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});const o=this._getMatchingItems(e,t,Y_.Activation);this._activateItems(o.map(e=>e.id))}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t,i;if(0===e.length)return;const s=!!(null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t)),n=[];for(const t of e)s&&this._shouldPersistArmedActivation(t)?this._persistActivation(t)&&this._recordActivationTimestamp(t):n.push(t);n.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...n])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);const t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){const t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));const i=this._getRawPersistedActivatedIds(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this._setActivatedItems(s),0===s.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e;const t=this._getActivationTimestampsKey();if(!t)return{};const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t];return i&&"object"==typeof i?i:{}}_recordActivationTimestamp(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps();this._writeActivationTimestamps(at(at({},t),{},{[e]:Date.now()}))}_clearActivationTimestamps(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps(),i={};let s=!1;for(const[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(Ct(i)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(i))}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(!this._getPersistedActivatedIds().includes(e))return;const t=this._getRawActivationTimestamps()[e];return Pt(t)?t:void 0}_getRawPersistedActivatedIds(){var e;const t=this._getActivatedKey();return(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,i;const s=this._getRawPersistedActivatedIds();if(0===s.length)return[];const n=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this._getActivatedSessionKey()],r=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);return r&&n===r?s:[]}_stampActivationSession(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(t=e.get_session_id)||void 0===t?void 0:t.call(e);i&&this._setActivatedSession(i)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this._getActivatedSessionKey()];if(i&&i!==e){const e=this._getRawPersistedActivatedIds(),t=this._getRawActivationTimestamps();e.length>0&&(this._setActivatedItems([]),e.filter(e=>Pt(t[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,i;null===(e=this._sessionIdUnsubscribe)||void 0===e||e.call(this),this._sessionIdUnsubscribe=void 0,null===(t=this._captureHookUnsubscribe)||void 0===t||t.call(this),this._captureHookUnsubscribe=void 0,null===(i=this._actionMatcher)||void 0===i||i.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}},AS=class extends LS{constructor(e){super(e)}_getActivatedKey(){return ue}_getActivatedSessionKey(){return de}_getActivationTimestampsKey(){return he}_writeActivationTimestamps(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_timestamps:e})}_clearActivationTimestampsStore(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_timestamps")}_shouldPersistArmedActivation(e){var t;let i;this._getItems(t=>{i=t.find(t=>t.id===e)});const s=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return Pt(s)&&s>0}_getShownEventName(){return rg.SHOWN}_getItems(e){var t;null===(t=this._instance)||void 0===t||t.getSurveys(e)}_cancelPendingItem(e){var t;null===(t=this._instance)||void 0===t||t.cancelPendingSurvey(e)}_getLogger(){return cg}_setActivatedItems(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated:e})}_setActivatedSession(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_session:e})}_clearActivatedSession(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_session")}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){let i;return this._getItems(e=>{i=e.find(e=>e.id===t)}),!i||Xa(i)?e===rg.SHOWN?"consume":"ignore":e===rg.SHOWN?"persist":e===rg.DISMISSED||e===rg.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},OS=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);const t={};for(const i of e){const e=this._instance.get_property(i);Et(e)||(t[i]=e)}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)}},$S=class{constructor(e){this._instance=e}get(){const 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()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}createEventReceiver(){return new AS(this._instance)}};const DS=(null==e?void 0:e.location)?Jn(e.location.hash,"__posthog")||Jn(location.hash,"state"):null,NS="_postHogToolbarParams",BS=Ln("[Toolbar]"),qS=Ln("[FeatureFlags]");var HS=class{constructor(e,t=!1){this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var i,s,n,r,o;return{bootstrap:{featureFlags:null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags,featureFlagPayloads:null===(s=e.bootstrap)||void 0===s?void 0:s.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!==(n=e.remote_config_refresh_interval_ms)&&void 0!==n?n:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(r=null!==(o=e.evaluation_contexts)&&void 0!==o?o:e.evaluation_environments)&&void 0!==r?r:[],flagKeys:St(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(qS.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),Et(e.flag_keys)||St(e.flag_keys)||qS.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}};const US=Ln("[FeatureFlags]"),WS=Ln("[FeatureFlags]",{debugEnabled:!0}),zS="\" failed. Feature flags didn't load in time.",jS="connection_error",VS=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},GS=e=>{const t={};for(const[i,s]of Dn(e||{}))s&&(t[i]=s);return t},QS="Refusing to render web experiment since the viewer is a likely bot",KS={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>el(t,e),not_regex:(e,t)=>!el(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},ZS=Ln("[Conversations]"),YS="Conversations not available yet.";function JS(e,t){var s,n,r,o,a,l,c;const u=null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:3e3,d=null!==(n=null==e?void 0:e.maxBufferSize)&&void 0!==n?n:100,h=(null==t?void 0:t.consoleCapture)?void 0:null!==(r=null==e?void 0:e.maxLogsPerInterval)&&void 0!==r?r:1e3,p=Et(h)?Math.max(d,2048):Math.max(d,h),_=at(at({},function(){let e="",t="";try{const s=null==i?void 0:i.userAgent;s&&([e,t]=Vi(s))}catch(e){}return function(e,t){const i=function(e){if(e)return{}.hasOwnProperty.call(fn,e)?fn[e]:e}(e);return at(at({},i?{"os.name":i}:{}),t?{"os.version":t}:{})}(e,t)}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==_?void 0:_["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==_?void 0:_["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(c=null==_?void 0:_["deployment.environment"])&&void 0!==c?c:null==e?void 0:e.environment,resourceAttributes:_,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const XS=["debug","log","warn","error","info"],ew="console",tw="__posthogHandledLogsRequestError",iw=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[tw]=!0,i},sw=e=>!!e&&"object"==typeof e&&!0===e[tw],nw={featureFlags:class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=US,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=()=>{const e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e;const t=this._refreshIntervalMs;Et(t)||this._config.remoteRequestsDisabled||!s||"hidden"===s.visibilityState||Date.now()-(null!==(e=this._lastRefreshAt)&&void 0!==e?e:0)<t||(this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onVisibilityChange=()=>{"visible"===(null==s?void 0:s.visibilityState)&&this._refreshIfDue()},"get"in e?this._configSource=e:(this._instance=e,this._mutableConfigSource=new HS(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var i;null===(i=this._mutableConfigSource)||void 0===i||i.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),TS(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(t){var i;if(this._client===t)return e&&zn(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_syncAutomaticRefresh(){const e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&s&&!Et(e)&&e>0?e:void 0;t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),Et(t)||(this._refreshIntervalMs=t,this._scheduleNextRefresh(),(null==s?void 0:s.addEventListener)&&zn(s,Ze,this._onVisibilityChange)))}_scheduleNextRefresh(){Et(this._refreshIntervalMs)||(Et(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){var e;Et(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==s||null===(e=s.removeEventListener)||void 0===e||e.call(s,"visibilitychange",this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t,i;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null===(t=this._dynamicProperties)||void 0===t||t.dispose(),this._dynamicProperties=void 0,null===(i=this._crossTabPersistenceUnsubscribe)||void 0===i||i.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null==e||e.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?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!Et(null===(e=this._client)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,i){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!e.$enabled_feature_flags)return;const n=this._prop("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,c=l?a:i&&!St(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),u=this._prop("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},h=l||i?c:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),p=!l&&!i,_=!!p||c,g=!!p||h,f={[Y]:_,[Z]:_,[ee]:g};e.$feature_flag_details&&(f[X]=_);for(const t of[te,ke,ie])Et(e[t])||(f[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(f)}_remove(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){const e={};for(const t of[Y,ee,te,se]){const i=this._prop(t);Et(i)||(e[t]=i)}this._baseEventProperties=e;const t=at({},e),i=this._prop(Z);if(i)for(const[e,s]of Object.entries(i))t[`$feature/${e}`]=s;this._eventPropertiesWithFlagValues=t}_isCacheStale(){const e=this._config.cacheTtlMs;if(!e||0>=e)return!1;const t=this._prop(ke);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(){const e=this._config.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{const 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(){const e=this._config.flagKeys;if(!Et(e))return e.filter(e=>{const 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;const i=this._config,s=null!==(e=null===(t=i.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var n,r;const e=null!==(n=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},t=Object.keys(s).filter(e=>!Et(s[e])).reduce((e,t)=>(e[t]=s[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this._receivedFeatureFlags({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;const r=(null==i?void 0:i.merge)&&null!==(s=this._prop("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==i?void 0:i.merge)&&null!==(n=this._prop("$feature_flag_payloads"))&&void 0!==n?n:{},a=at(at({},r),e),l=at(at({},o),t),c={};for(const[e,t]of Object.entries(a))c[e]={key:e,enabled:Qs(t),variant:Ks(t),reason:void 0,metadata:Et(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this._receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this._prop(X),t=this._prop(se),i=this._prop(ne);if(!i&&!t)return e||{};const s=$n({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const e of n){var r;const n=s[e],a=null==t?void 0:t[e],l=Et(a)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!a,c=Et(a)?null==n?void 0:n.variant:"string"==typeof a?a:void 0,u=null==i?void 0:i[e],d=at(at({},n),{},{enabled:l,variant:l?null!=c?c:null==n?void 0:n.variant:void 0});var o;l!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),c!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),u&&(d.metadata=at(at({},null==n?void 0:n.metadata),{},{payload:u,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[e]=d}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this._override_warning=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:Qs(s),variant:Ks(s),payload:Gs(t[i])}})}getFlagVariants(){const e=this._prop(Z),t=this._prop(se);if(!t)return e||{};const i=$n({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){const e=this._prop(ee),t=this._prop(ne);if(!t)return e||{};const i=$n({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}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(be)}_callFlagsEndpoint(e){this._clearDebouncer();const t=this._client;if(!t||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped())return;if(this._requestInFlight)return void(this._additionalReloadRequested=!0);const i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:at(at(at({},t.initialPersonProperties),this._prop("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(oe),timezone:El()};Et(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this._config.featureFlagsDisabled)&&(i.disable_flags=!0);const s=this._getValidEvaluationEnvironments();s.length&&(i.evaluation_contexts=s);const n=this._getValidFlagKeys();Et(n)||(i.flag_keys=n);const r=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this._requestGeneration;this._requestInFlight=!0;const l=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},c=e=>{var t,s;const n=null!==(t=e.json)&&void 0!==t?t:{},o=200!==e.statusCode;if(this._requestInFlight=!1,a!==this._requestGeneration)return void l();if(this._trackStatusZeroReachability(e.statusCode),o||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),i.disable_flags&&!this._additionalReloadRequested)return;this._flagsLoadedFromRemote=!o;const c=[];e.error?c.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?jS:"unknown_error"):200!==e.statusCode&&c.push(`api_error_${e.statusCode}`),n.errorsWhileComputingFlags&&c.push("errors_while_computing_flags");const u=!!(null===(s=n.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));u&&c.push("quota_limited"),this._set({[we]:c}),u?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."):i.disable_flags||this._receivedFeatureFlags(n,o,{partialResponse:r}),l()},u=e=>{this._requestInFlight=!1,a===this._requestGeneration?(this._set({[we]:[jS]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),l()):l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(c).catch(u)}catch(e){u(e)}}_hasStatusZeroCircuitBreakerTripped(){return Xn(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=er(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 i;if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlag for key "'+e+zS);if(this._checkAndTriggerStaleRefresh())return;const s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlagResult for key "'+e+zS);if(this._checkAndTriggerStaleRefresh())return;const i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this._prop("$feature_flag_request_id")||void 0,l=this._prop("$feature_flag_evaluated_at")||void 0;let c,u=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var d;const e=null===(d=this._client)||void 0===d?void 0:d.session.sessionId,t=this._prop(Se);e&&e!==t&&(u={},c=e)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))c&&this._set({[be]:u,[Se]:c});else{var h,p,_,g,f,v,m,y,b,S,w,k;St(u[e])?u[e].push(o):u[e]=[o],this._set(at({[be]:u},c?{[Se]:c}:{}));const t=this.getFeatureFlagDetails(e),i=[...null!==(h=this._prop("$feature_flag_errors"))&&void 0!==h?h:[]];Et(n)&&i.push("flag_missing");const s={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(p=null===(_=this._config.bootstrap)||void 0===_||null===(_=_.featureFlags)||void 0===_?void 0:_[e])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(g=null===(f=this._config.bootstrap)||void 0===f||null===(f=f.featureFlagPayloads)||void 0===f?void 0:f[e])&&void 0!==g?g:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Et(null==t||null===(v=t.metadata)||void 0===v?void 0:v.has_experiment)||(s.$feature_flag_has_experiment=t.metadata.has_experiment),Et(null==t||null===(m=t.metadata)||void 0===m?void 0:m.version)||(s.$feature_flag_version=t.metadata.version);const d=null!==(y=null==t||null===(b=t.reason)||void 0===b?void 0:b.description)&&void 0!==y?y:null==t||null===(S=t.reason)||void 0===S?void 0:S.code;var C;d&&(s.$feature_flag_reason=d),(null==t||null===(w=t.metadata)||void 0===w?void 0:w.id)&&(s.$feature_flag_id=t.metadata.id),Et(null==t?void 0:t.original_variant)&&Et(null==t?void 0:t.original_enabled)||(s.$feature_flag_original_response=Et(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(k=t.metadata)||void 0===k?void 0:k.original_payload)&&(s.$feature_flag_original_payload=null==t||null===(C=t.metadata)||void 0===C?void 0:C.original_payload),i.length&&(s.$feature_flag_error=i.join(",")),this._captureFeatureFlagCalled(s)}else c&&this._set({[be]:u,[Se]:c});return s?{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:Gs(r)}:void 0}_captureFeatureFlagCalled(e){try{var t;null===(t=this._client)||void 0===t||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 i=this;return st(function*(){const s=i._client;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i._getValidEvaluationEnvironments();r.length&&(n.evaluation_contexts=r);const o=i._getValidFlagKeys();let a;Et(o)||(n.flag_keys=o);try{var l;const t=null===(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i._config.compression,sentAt:"body",timeoutMs:i._config.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==t?void 0:t[e])||void 0}catch(e){return void i._logger.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i._logger.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+zS),t.defaultValue;const i=this.getFeatureFlag(e,t);return Et(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this._receivedFeatureFlags(e,t,i)}_receivedFeatureFlags(e,t,i){if(!this._client)return;this._hasLoadedFlags=!0;const s=((e,t={},i={},s={},n,r=US)=>{const o=((e,t)=>{const i=e.flags;if(i){const t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!==(t=i[e].variant)&&void 0!==t?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!Et(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return at(at({},e),{},{featureFlags:t,featureFlagPayloads:s})}return e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e,r),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(!l)return;const u=e.requestId,d=e.evaluatedAt;if(St(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[Y]:l,[Z]:e,[ie]:!1}}let h=l,p=c,_=a;if(null==n?void 0:n.partialResponse){const e=Object.keys(h),n=p||{};h=at(at({},t),h),p=at(at({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=at(at({},s),_)}else if(e.errorsWhileComputingFlags)if(a){const e=new Set(Object.keys(a).filter(e=>{var t;return!(null===(t=a[e])||void 0===t?void 0:t.failed)}));h=at(at({},t),Object.fromEntries(Object.entries(h).filter(([t])=>e.has(t))));const n=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=at(at({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=at(at({},s),Object.fromEntries(Object.entries(_||{}).filter(([t])=>e.has(t))))}else h=at(at({},t),h),p=at(at({},i),p),_=at(at({},s),_);return at(at({[Y]:Object.keys(GS(h)),[Z]:h||{},[ee]:p||{},[X]:_||{},[ie]:!0===e.minimalFlagCalledEvents},u?{[te]:u}:{}),d?{[ke]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this._logger);if(s)if(!1===(null==i?void 0:i.persist)){const e=!Et(this._client.kv.get(Z));this._bootstrapState=s,e||this._set(s)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(s,e,!!(null==i?void 0:i.partialResponse)),this._set(s);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}override(e,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([se,ne]),this._fireFeatureFlagsCallbacks(),void WS.info("All overrides cleared");if(St(e))return this._set({[se]:VS(e)}),this._fireFeatureFlagsCallbacks(),void WS.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;const i=e;this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t);const s={},n=i.flags,r=i.payloads;return n&&(s[se]=St(n)?VS(n):n),r&&(s[ne]=r),Object.keys(s).length&&this._set(s),!1===n&&!1===r?this._remove([se,ne]):!1===n?this._remove(se):!1===r&&this._remove(ne),this._fireFeatureFlagsCallbacks(),!1===n?WS.info("Flag overrides cleared"):n&&WS.info("Flag overrides set",{flags:n}),void(!1===r?WS.info("Payload overrides cleared"):r&&WS.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this._set({[se]:e}),this._fireFeatureFlagsCallbacks(),void WS.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){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();try{e(t,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const n=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);const a=at(at({},this.getFlagVariants()),{},{[e]:t});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this._set({[Y]:Object.keys(GS(a)),[Z]:a,[re]:at(at({},this._prop("$stored_person_properties")||{}),r)}),this._fireFeatureFlagsCallbacks();try{var l;null===(l=this._client)||void 0===l||l.capture("$feature_enrollment_update",o).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=!1,i){const s=this._prop(J);!s||t?this._getEarlyAccessFeatures(e,i):e(s)}_getEarlyAccessFeatures(e,t){var i=this;return st(function*(){const s=i._client;if(!s)return;const n=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";let r;try{const e=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;r=e.json.earlyAccessFeatures,i._set({[J]:r})}catch(e){return void i._logger.error("Early access feature request failed",e)}try{e(r)}catch(e){i._logger.error("Early access feature callback failed",e)}})()}_prepareFeatureFlagsForCallbacks(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t=!0){this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t=!0){const i=this._prop("$stored_person_properties")||{},s=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),n=null==e?void 0:e.$set_once,r={};if(n)for(const e in n)({}).hasOwnProperty.call(n,e)&&(e in i||(r[e]=n[e]));this._set({[re]:at(at(at({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=at({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this._set({[re]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this._remove(re),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this._prop("$stored_group_properties")||{},s=at({},i);for(const t of Object.keys(e))s[t]=at(at({},i[t]),e[t]);this._set({[oe]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this._prop("$stored_group_properties")||{};this._set({[oe]:at(at({},t),{},{[e]:{}})})}else this._remove(oe)}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}}},rw={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!!(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0: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?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=eo,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t,i;if(!(null==s?void 0:s.visibilityState)||"visible"===s.visibilityState)return!0;const n=null==e||null===(t=e.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==n?void 0:n.length)||n.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e,t;"visible"===(null==s?void 0:s.visibilityState)&&(this._documentWasEverVisible=!0,null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw yS.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==s?void 0:s.addEventListener)&&zn(s,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._sessionRecordingDisposed=!0,null==s||null===(t=s.removeEventListener)||void 0===t||t.call(s,"visibilitychange",this._onVisibilityChange),e?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),s=!this._config.disable_session_recording,n=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&i&&s&&!n}startIfEnabledOrStop(e){var t;if(this._sessionRecordingDisposed)return;if(this._isRecordingEnabled&&(null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.isStarted))return;const i=!Et(Object.assign)&&!Et(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),yS.info("starting")):(this._recordingStatus=eo,this.stopRecording())}_lazyLoadAndStart(e){var t,i;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=ro),(null==h||null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this._onScriptLoaded(e);else{var s,n;const t=this._instance.sessionManager;null===(s=h.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this._scriptName,i=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),yS.error("could not load recorder",i)):void this._onScriptLoaded(e);this._recordingStatus="disabled"})}}stopRecording(){var e,t;null===(e=this._persistFlagsOnSessionListener)||void 0===e||e.call(this),this._persistFlagsOnSessionListener=void 0,null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.stop()}_discardRecording(e=!1){var t,i;null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=void 0,null===(i=this._lazyLoadedSessionRecording)||void 0===i||i.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null===(e=this._persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._persistence)||void 0===t||t.unregister("$replay_sample_rate")}_validateSampleRate(e,t){if(Rt(e))return null;const i=Pt(e)?e:parseFloat(e);return"number"!=typeof(s=i)||!Number.isFinite(s)||0>s||s>1?(yS.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}_persistRemoteConfig(e){if(this._persistence){var t,i;const s=this._persistence,n=()=>{var t;const i=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null===(t=this._config.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),r=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=n?n:r;Rt(o)&&this._resetSampling();const a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[F]:at(at({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:at({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Et(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};n(),null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(n)}}onRemoteConfig(e){const 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",yS.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.log)?this._lazyLoadedSessionRecording.log(e,t):yS.warn("log called before recorder was ready")}get _scriptName(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(F);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){const e=this._instance.get_property(F);if(!e)return!1;let t;try{t="object"==typeof e?e:JSON.parse(e)}catch(e){return yS.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Rt(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_onScriptLoaded(e){var t,i,s;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return yS.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Oe]:!0});var n;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null===(n=h.__PosthogExtensions__)||void 0===n?void 0:n.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",yS.info("persisted remote config is stale, requesting fresh config before starting"),void new rb(this._instance).load()}this._recordingStatus=ro,null===(i=(s=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||void 0===i||i.call(s,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=eo}onRRwebEmit(e){var t,i;null===(t=this._lazyLoadedSessionRecording)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null===(i=this._persistence)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}},ow={autocapture:class extends vy{constructor(e){super(new dS(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(Fn.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,Fn.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var i;if(!e||(null===(i=e.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const s=this;lp(e.history,t,e=>function(i,n,r){e.call(this,i,n,r),s._capturePageview(t)})}_getCurrentLocation(){const t=null==e?void 0:e.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){const e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:kt(e)?e:{}}_shouldCaptureHashChanges(e=this._getCaptureOptions()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){const t=this._getCaptureOptions(),i=this._lastLocation;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this._shouldCaptureHashChanges(t)&&e.hash!==i.hash))}_capturePageview(e){try{const t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(Je,{navigation_type:e}),this._lastLocation=t}catch(t){Fn.error(`Error capturing ${e} pageview`,t)}}_setupPopstateListener(){if(this._popstateListener)return;const t=()=>{this._capturePageview("popstate")};zn(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}_setupHashchangeListener(){if(this._hashchangeListener)return;const t=()=>{this._capturePageview("hashchange")};zn(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}},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)||void 0===t?void 0:t.props[k]),this.rageclicks=new dy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return kt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Rt(this._config.capture_heatmaps)?Rt(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;bS.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)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[k]:i}),this._enabledServerSide=i,this.startIfEnabled()}getAndClearBuffer(){const e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){SS(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==s?void 0:s.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&s&&(this._flushHandler=this._flush.bind(this),zn(e,Ye,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),zn(s,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),zn(s,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new My(this.instance,Ry,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),zn(s,Ze,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&s&&(this._flushHandler&&e.removeEventListener(Ye,this._flushHandler),this._onClickHandler&&s.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&s.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&s.removeEventListener(Ze,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null===(t=this._deadClicksCapture)||void 0===t||t.stop(),this._initialized=!1)}_getProperties(t,i){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,s){let n=t;for(;n&&nr(n)&&!rr(n,"body");){if(n===s)return!1;let t;try{var r,o,a;t=null===(r=null!==(o=null===(a=n.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:e)||void 0===r?void 0:r.getComputedStyle(n).position}catch(e){return!1}if(_t(i,t))return!0;n=vr(n)}return!1}(pr(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:s),target_fixed:o,type:i}}_onClick(e,t="click"){var i;if(sr(e.target)||!SS(e))return;const s=this._getProperties(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&xr(pr(e),this.instance.config.rageclick)&&this._capture(at(at({},s),{},{type:"rageclick"})),this._capture(s)}_onMouseMove(e){!sr(e.target)&&SS(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(t){if(!e)return;const i=this._config.disable_capture_url_hashes?ss(e.location.href):e.location.href,s=this._config.custom_personal_data_properties,n=this._config.mask_personal_data_properties?[...hl,...s||[]]:[],r=Yn(i,n,_l);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(t)}_flush(){this._buffer&&!Ct(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:My,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",at({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>at(at({},e),{},{[`$web_vitals_${t.name}_event`]:at({},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},Rt(null==e?void 0:e.name)||Rt(null==e?void 0:e.value))return void _S.error("Invalid metric received",e);const i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this._maskedURL(i);if(Et(s))return;const n=Pt(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${s}`;if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void _S.error("Ignoring metric with value >= "+this._maxAllowedValue,e);this._buffer.navigationKey!==n&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Et(this._buffer.navigationKey)&&(this._buffer.navigationKey=n,this._buffer.url=s),this._buffer.firstMetricTimestamp=Et(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;const r=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=at(at(at({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,kt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){const t={};for(const i of mS){const s="url"===i&&"string"==typeof e.attribution[i]?this._maskedURL(e.attribution[i]):e.attribution[i];Et(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;Et(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()},this._startCapturing=()=>{if(this._initialized)return;let e,t,i,s,n=!1;const r=h.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Et(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Et(a)){const r=a.withoutAttribution,o=this.attributionMetrics;n=!Et(r),e=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,t=o.indexOf("CLS")>-1?a.onCLS:(null==r?void 0:r.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==r?void 0:r.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(e&&t&&i&&s))return void _S.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},c=n&&this.attributionMetrics.indexOf("INP")>-1?at(at({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this),c),this._initialized=!0},this._enabledServerSide=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[T]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=kt(this._perfConfig)?null===(e=this._perfConfig)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Rt(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||fS:i}get flushToCaptureTimeoutMs(){return(kt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=kt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return Ft(e)?e?fS:[]:St(e)?e:vS}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=kt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){const e=kt(this._perfConfig)&&Pt(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:gS;return e>0&&6e4>=e?gS:e}get isEnabled(){const e=null==n?void 0:n.protocol;if("http:"!==e&&"https:"!==e)return _S.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=kt(this._perfConfig)?this._perfConfig.web_vitals:Ft(this._perfConfig)?this._perfConfig:void 0;return Ft(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(_S.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=kt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=kt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[T]:i}),this._instance.persistence.register({[M]:s})),this._enabledServerSide=i,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;const i=h.__PosthogExtensions__,s=this._callbackFlavor,n=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&Et(n)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,s,t=>{t?_S.error("failed to load script",t):e()})}_maskedURL(t){const i=t||(null==e?void 0:e.location.href);if(!i)return void _S.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?ss(i):i,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...hl,...n||[]]:[];return Yn(s,r,_l)}}},aw={exceptionObserver:class{constructor(t){var i;this._startCapturing=()=>{var t;if(!e||!this.isEnabled||!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=i(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=s(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=n(this.captureException.bind(this)))}catch(e){hS.error("failed to start",e),this._stopCapturing()}},this._instance=t,this._remoteEnabled=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[C]),this._rateLimiter=new Gt(at(at({},function(e={}){var t,i,s,n;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(s=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,_logger:hS})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return kt(e)?t=at(at({},t),e):(Et(e)?this._remoteEnabled:e)&&(t=at(at({},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?(hS.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return hS.error("failed to load script",t);e()})}_stopCapturing(){var e,t,i;null===(e=this._unwrapOnError)||void 0===e||e.call(this),this._unwrapOnError=void 0,null===(t=this._unwrapUnhandledRejection)||void 0===t||t.call(this),this._unwrapUnhandledRejection=void 0,null===(i=this._unwrapConsoleError)||void 0===i||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[C]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,i,s;const n=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(n))return void hS.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=lv(),this._instance=e,this._suppressionRules=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=zs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new js(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=zs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const n=e.config;if(!("errorTracking"in n))return;const r=null!==(t=null===(i=n.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[E]:this._suppressionRules,[x]:o})}get _captureExtensionExceptions(){var e;const t=!!this._instance.get_property(x),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&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(!xt(e)||0===e.trim().length)return void sv.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};const t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>Us.has(s)?(t.push(s),i):(i[s]=e[s],i),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t));s.length>0&&sv.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(at({[qs]:e,[Hs]:(new Date).toISOString()},i))}catch(e){sv.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void sv.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 sv.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 sv.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 sv.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this._exceptionStepsConfig.enabled&&Rt(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,s=function(){const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();s&&(i.$release_id=s);try{const e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return e&&this._exceptionStepsBuffer.clear(),e}catch(e){return iv(e)||sv.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void(iv(e)||sv.error("Failed to process exception event. Ignoring this exception.",e))}}_addBufferedExceptionSteps(e){try{const t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:at(at({},e),{},{$exception_steps:t})}catch(t){return sv.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[qs]:e,[Hs]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return kt(e)?at({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{const t=e.reduce((e,{type:t,value:i})=>(xt(t)&&t.length>0&&e.$exception_types.push(t),xt(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{const i=e.values.map(e=>{const i=il[e.operator],s=t[e.key];if(!i||!s)return!1;const n=St(e.value)?e.value:[e.value];return n.length>0&&i(n,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return sv.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){const t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&ov.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(nv))||e.some(({type:e,value:t})=>"NoResponse"===e||xt(t)&&rv.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(nv))))}_isInjectedBrowserScriptException(e){return e.some(({value:e})=>xt(e)&&av.some(t=>e.includes(t)))}_isPostHogException(e){if(e.length>0){var t,i,s,n;const r=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}_isExceptionList(e){return!Rt(e)&&St(e)}}},lw=at({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)return;const t=e.config;if("productTours"in t){var i,s;if(this._persistence&&this._persistence.register({[R]:!!t.productTours}),!kS(this._instance))return!this._productTourManager&&Rt(null===(i=this._persistence)||void 0===i?void 0:i.props.ph_product_tours)||wS.info("product tours disabled; stopping and clearing cached tours"),null===(s=this._productTourManager)||void 0===s||s.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&kS(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"product-tours",t=>{t?wS.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this._productTourManager=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(St(this._cachedTours)&&!t)return void e(this._cachedTours,{isLoaded:!0});const i=this._persistence;if(i){const s=i.props[pe];if(St(s)&&!t)return this._cachedTours=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:t=>{if(!kS(this._instance))return void e([],{isLoaded:!0});const s=t.statusCode;if(200!==s||!t.json){const i=`Product Tours API could not be loaded, status: ${s}`;return 0===s?t.error||wS.warn(i):wS.error(i),void e([],{isLoaded:!1,error:i})}const n=St(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[pe]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){Rt(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null===(t=this._productTourManager)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this._productTourManager)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this._productTourManager)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this._productTourManager)||void 0===e||e.previousStep()}clearCache(){var e;this._cachedTours=null,null===(e=this._persistence)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this._productTourManager)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.cancelPendingTour(e)}}},nw),cw={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)return;const i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}get siteAppLoaders(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[e,t]of Object.entries(u))l[e]={id:c[e],type:e,properties:t};const{$set_once:d,$set:h}=e;return{event:at(at({},cn(e,CS)),{},{properties:at(at(at({},e.properties),h?{$set:at(at({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:at(at({},null!==(s=null===(n=e.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),elements_chain:null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t;const i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(e)||(ES.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(e)||(ES.error("prepare_external_dependency_script returned null"),null)}return e}_patchSiteAppElementInsertionMethods(){var e,t,i,n,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=null==s?void 0:s.defaultView,u=null==c||null===(e=c.Node)||void 0===e?void 0:e.prototype;if(!c||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();const d=[],h=this,p=new WeakSet,_=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;const s=e[t];e[t]=i(s),d.push(()=>{e[t]=s})},g=e=>{if(p.has(e))return e;const t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!It(e));return _(u,"appendChild",e=>function(t){const i=g(t);return i?e.call(this,i):t}),_(u,"insertBefore",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):t}),_(u,"replaceChild",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):i}),[null===(t=c.Element)||void 0===t?void 0:t.prototype,null===(i=c.Document)||void 0===i?void 0:i.prototype,null===(n=c.DocumentFragment)||void 0===n?void 0:n.prototype].forEach(e=>{_(e,"append",e=>function(...t){return e.apply(this,f(t))}),_(e,"prepend",e=>function(...t){return e.apply(this,f(t))})}),[null===(r=c.Element)||void 0===r?void 0:r.prototype,null===(o=c.CharacterData)||void 0===o?void 0:o.prototype,null===(a=c.DocumentType)||void 0===a?void 0:a.prototype].forEach(e=>{_(e,"before",e=>function(...t){return e.apply(this,f(t))}),_(e,"after",e=>function(...t){return e.apply(this,f(t))}),_(e,"replaceWith",e=>function(...t){const i=f(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),_(null===(l=c.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){const s=g(i);return s?e.call(this,t,s):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){let e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null===(t=this._restoreSiteAppElementPatches)||void 0===t||t.call(this)))}}_runWithPreparedSiteAppElements(e,t=!0){const i=this._patchSiteAppElementInsertionMethods();try{const s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(ES.info(`Processing ${this._bufferedInvocations.length} events for site app with id ${e.id}`),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this._stopBuffering)||void 0===i||i.call(this))};let s=!1;const n=n=>{t.errored=!n,t.loaded=!0,ES.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:i}=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),n(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){ES.error(xS+e.id,t),n(!1)}if(s&&t.loaded)try{i()}catch(i){ES.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}_setupSiteApps(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}_onCapturedEvent(e){if(0===Object.keys(this.apps).length)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this._runWithPreparedSiteAppElements(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){ES.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,s;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void ES.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this._stopBuffering)||void 0===i||i.call(this),!e.ok)return;const n=e.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:e,url:t}of n.siteApps){var r,o;h[`__$$ph_site_app_${e}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,t,t=>{if(t)return ES.error(xS+e,t)})}else ES.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},uw={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{const e=this._syncHostnamesForPatch();var t,i;e?(Et(this._restoreXHRPatch)&&(this._restoreXHRPatch=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Et(this._restoreFetchPatch)&&(this._restoreFetchPatch=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"tracing-headers",t=>{if(t)return pS.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(){const e=this._getConfiguredHostnames();return St(e)?(St(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(St(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},dw=at({surveys:class extends PS{constructor(e){var t;super(new $S(e),(t=e,{get projectToken(){return t.config.token},kv:new OS(t)})),this._instance=e}_sendSurveysRequest(e,t){const i=t.query?db(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(s=t.target)&&void 0!==s?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},nw),hw={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){h.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,n=void 0){var r,o;if(jn(this.instance.config))return!1;if(!e||!s)return!1;t=null!==(r=t)&&void 0!==r?r:e.location,n=null!==(o=n)&&void 0!==o?o:e.history;try{if(!i){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}i=null==e?void 0:e.localStorage}const s=DS||Jn(t.hash,"__posthog")||Jn(t.hash,"state");let r;const o=s?Nn(()=>JSON.parse(atob(decodeURIComponent(s))))||Nn(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(NS)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){const t=h.ph_load_toolbar||h.ph_load_editor;!Rt(t)&&wt(t)?t(e,this.instance):BS.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==s?void 0:s.getElementById("__POSTHOG_TOOLBAR__"));if(!e||i)return!1;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=at(at({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(e.localStorage.setItem(NS,JSON.stringify(at(at({},r),{},{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var o,a;this._setToolbarState(1),null===(o=h.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",e=>{if(e)return BS.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)}),zn(e,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(r)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},pw=at({experiments:class t{get _config(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(e=!1)=>{this.getWebExperiments(e=>{t._logInfo("retrieved web experiments from the server"),this._flagToExperiments=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;this._flagToExperiments&&(t._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=this._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e));const s=this._instance.getFeatureFlag(e.feature_flag_key);xt(s)&&e.variants[s]&&this._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(const i in e.variants){const s=e.variants[i];t._matchesTestVariant(s,this._instance)&&this._applyTransforms(e.name,i,s.transforms)}})},e)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())t._logInfo(QS);else if(!this._config.disable_web_experiments){if(Rt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t._logInfo("applying feature flags",e),e.forEach(e=>{var t;if(this._flagToExperiments&&(null===(t=this._flagToExperiments)||void 0===t?void 0:t.has(e))){var i;const t=this._instance.getFeatureFlag(e),s=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this._applyTransforms(s.name,t,s.variants[t].transforms)}})}}previewWebExperiment(){const e=t.getWindowLocation();if(null==e?void 0:e.search){const i=Zn(null==e?void 0:e.search,"__experiment_id"),s=Zn(null==e?void 0:e.search,"__experiment_variant");i&&s&&(t._logInfo(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);const s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);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(e,i,s){const n=s.filter(t=>t.id===e);n&&n.length>0&&(t._logInfo(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this._applyTransforms(n[0].name,i,n[0].variants[i].transforms))}static _matchesTestVariant(e,i){return!Rt(e.conditions)&&t._matchUrlConditions(e,i)&&t._matchUTMConditions(e)}static _matchUrlConditions(e,i){var s;if(Rt(e.conditions)||Rt(null===(s=e.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,a;const t=tr(i,n.href);return!(null===(r=e.conditions)||void 0===r?void 0:r.url)||KS[null!==(o=null===(a=e.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](e.conditions.url,t)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(Rt(e.conditions)||Rt(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=fl();if(i.utm_source){var s,n,r,o,a,l,c,u;const t=!(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==i.utm_campaign,d=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,h=!(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,p=!(null===(c=e.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==i.utm_term;return t&&h&&p&&d}return!1}static _logInfo(e,...t){Fn.info(`[WebExperiments] ${e}`,t)}_applyTransforms(e,i,s){this._is_bot()?t._logInfo(QS):"control"!==i?s.forEach(s=>{if(s.selector){var n;t._logInfo(`applying transform of variant ${i} for experiment ${e} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(e=>{const t=e;s.html&&(t.innerHTML=s.html),s.css&&t.setAttribute("style",s.css)})}}):t._logInfo("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Lb(i,this._config.custom_blocked_useragents):void 0}}},nw),_w={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)return;if(this._remoteConfigSuccessful=e.ok,!e.ok)return;const t=e.config.conversations;Rt(t)||(Ft(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this._isInitializing)return;if(this._instance.config.disable_conversations)return;if(jn(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=null==h?void 0:h.__PosthogExtensions__;if(e&&!Et(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{const t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);const i=e.loadExternalDependency;if(!i)return void this._handleLoadError(Ve);i(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 ZS.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,ZS.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else ZS.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){ZS.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():ZS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!It(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":jn(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":Et(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Rt(this._remoteConfig)||!this._remoteConfig.token?"missing_token":(null==h?void 0:h.__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?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var s=this;return st(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(ZS.warn(YS),null)})()}getMessages(e,t){var i=this;return st(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(ZS.warn(YS),null)})()}markAsRead(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(ZS.warn(YS),null)})()}getTickets(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(ZS.warn(YS),null)})()}requestRestoreLink(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(ZS.warn(YS),null)})()}restoreFromToken(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(ZS.warn(YS),null)})()}restoreFromUrlToken(){var e=this;return st(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(ZS.warn(YS),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}_onIdentityCleared(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}},gw={logs:class{constructor(t){var i;this._instance=t,this.name=yg,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Ln("[logs]"),this._coreLogger=at(at({},this._logger),{},{error:(...e)=>{e.some(sw)||this._logger.error(...e)}}),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)||void 0===e||e.onReconnect(),null===(t=this._consoleCore)||void 0===t||t.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this._isLogsEnabled=!0),e&&zn(e,"online",this._onReconnect)}_buildCore(e,t,i,s){var n;const r=JS(null===(n=this._instance)||void 0===n||null===(n=n.config)||void 0===n?void 0:n.logs,i);return[new kn(this._createHost(e,t),r,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,s),r]}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,[this._core,this._resolvedConfig]=this._buildCore(()=>this._queue,e=>{this._queue=e})),this._core}_getConsoleCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._consoleCore&&this._consoleResolvedFrom===t||(null===(i=this._consoleCore)||void 0===i||i.reset(),this._consoleResolvedFrom=t,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ew)),this._consoleCore}setup(e){var t;if(this._disposed)return;this._client=e,(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();let i=!1;const s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?s.dispose():(this._remoteConfigSubscription=s,i||this.loadIfEnabled())}dispose(){var t,i,s,n;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null===(t=this._remoteConfigSubscription)||void 0===t||t.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==e||e.removeEventListener("online",this._onReconnect),null===(i=this._consoleLogsDispose)||void 0===i||i.call(this),this._consoleLogsDispose=void 0,null===(s=this._core)||void 0===s||s.reset(),null===(n=this._consoleCore)||void 0===n||n.reset())}onRemoteConfig(e){var t,i;if(this._disposed)return;const s=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;Rt(s)?this._stopRecorderStartedByPersistedHint():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!s}),s?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}reset(){var e,t,i,s;this._stopConsoleRecorder(),null===(e=this._core)||void 0===e||e.clearQueue(),this._queue=[],null===(t=this._core)||void 0===t||t.reset(),null===(i=this._consoleCore)||void 0===i||i.clearQueue(),this._consoleQueue=[],null===(s=this._consoleCore)||void 0===s||s.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,i){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:i})}_persistedCaptureHint(){var e;return!!(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e[P])}_remoteConfigWillArrive(){var e,t,i;return!(null===(e=this._instance)||void 0===e||null===(t=e._shouldDisableFlags)||void 0===t?void 0:t.call(e))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}_onOptOut(){var e;this._stopConsoleRecorder(),null===(e=this._consoleCore)||void 0===e||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e;if(this._isRecordingConsole||!(null==h?void 0:h.console))return;const t=JS(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs).maxBufferSize;for(const e of XS){let i;try{i=Wf(h.console[e])}catch(e){continue}i&&this._consoleRecorderUnpatchers.push(lp(h.console,e,s=>{const n=(...i)=>{try{this._recordConsoleEntry(e,i,t)}catch(e){}return s.apply(h.console,i)};return n.__rrweb_original__=i,n}))}this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}_recordConsoleEntry(e,t,i){var s;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(i>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){this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0);for(const e of this._consoleRecorderUnpatchers)e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){const 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){sw(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this._disposed||!this._isLogsEnabled||this._isLoaded||this._isLoading)return;const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();const t=e.loadExternalDependency;if(!t)return this._logger.error(Ve),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",t=>{if(this._isLoading=!1,this._disposed||!this._isLogsEnabled)return;const i=e.logs;if(t||!(null==i?void 0:i.initializeLogs))this._logger.error("Could not load logs script",t),this._stopConsoleRecorder();else{var s;const e=this._takeConsoleBuffer();var n,r;this._consoleLogsDispose=i.initializeLogs(null!==(s=this._client)&&void 0!==s?s:this._instance),this._isLoaded=!0,e.length>0&&(null===(n=i.replayConsoleBuffer)||void 0===n||n.call(i,null!==(r=this._client)&&void 0!==r?r:this._instance,e))}})}catch(e){throw this._isLoading=!1,e}}_createHost(e,t){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===lt.LogsQueue?e():void 0,setPersistedProperty(e,i){var s;e===lt.LogsQueue&&t(null!==(s=i)&&void 0!==s?s:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>Ba.LIB_NAME,getLibraryVersion:()=>Ba.LIB_VERSION}}_sendLogsBatch(e){return new Promise(t=>{if(Xn(this._consecutiveStatusZeroFailures,3))return void t({kind:"fatal",error:iw(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=e=>{i||(i=!0,clearTimeout(n),t(e))},n=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:iw(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=>{const t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error(`logs request failed with status ${t}`)});else{var i;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:iw(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`logs request failed with status ${t}`)})}}})})}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=er(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,ew,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,i,s,n){if(0===t.length)return;const r=t.map(e=>e.record);n([]);const o=wn(r,Sn(i,Ba.LIB_NAME,Ba.LIB_VERSION),s,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;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:e,windowId:i,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=i,Rt(s)||(t.sessionStartTimestamp=s),Rt(n)||(t.lastActivityTimestamp=n)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ss(h.location.href):h.location.href),this._instance.featureFlags){const e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},fw={metrics:class{constructor(e){this._instance=e,this._logger=Ln("[metrics]")}initialize(){}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,this._core=new Tn(this._createHost(),function(e){var t,i,s,n,r;const 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!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(t),this._logger)),this._core}count(e,t=1,i){this._getCore().count(e,t,i)}gauge(e,t,i){this._getCore().gauge(e,t,i)}histogram(e,t,i){this._getCore().histogram(e,t,i)}flush(e){if(!this._core)return Promise.resolve();if(e){const 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)||void 0===e||e.reset()}_createHost(){const 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(i=>{let s=!1;const n=e=>{s||(s=!0,clearTimeout(r),i(e))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(at(at({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){const t=e.statusCode;if(t>=200&&300>t)n({kind:"ok"});else if(413===t)n({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)n({kind:"fatal",error:new Error(`metrics request failed with status ${t}`)});else{var i;n({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`metrics request failed with status ${t}`)})}}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};uS.__defaultExtensionClasses=at({},at(at(at(at(at(at(at(at(at(at(at(at(at({},nw),rw),ow),aw),lw),cw),dw),uw),hw),pw),_w),gw),fw));const vw=function(){Ba.SDK_DIST_CHANNEL="npm";const t=Gb[sS]=new uS;return function(){function t(){t.done||(t.done=!0,nS=!1,On(Gb,function(e){e._dom_loaded()}))}(null==s?void 0:s.addEventListener)?"complete"===s.readyState?t():zn(s,"DOMContentLoaded",t,{capture:!1}):e&&Fn.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();var mw=vw;export{Z_ as Compression,Xy as DEFAULT_PRODUCT_TOUR_APPEARANCE,ag as DisplaySurveyType,uS as PostHog,eb as ProductTourEventName,tb as ProductTourEventProperties,rg as SurveyEventName,og as SurveyEventProperties,Y_ as SurveyEventType,X_ as SurveyPosition,sg as SurveyQuestionBranchingType,ig as SurveyQuestionType,ng as SurveySchedule,eg as SurveyTabPosition,tg as SurveyType,J_ as SurveyWidgetType,mw as default,vw as posthog,ob as severityLevels};
|
|
1
|
+
const e="u">typeof window?window:void 0,t="u">typeof globalThis?globalThis:e,i=null==t?void 0:t.navigator,s=null==t?void 0:t.document,n=null==t?void 0:t.location,r=null==t?void 0:t.fetch,o=(null==t?void 0:t.XMLHttpRequest)&&"withCredentials"in new t.XMLHttpRequest?t.XMLHttpRequest:void 0,a=null==t?void 0:t.AbortController,l=null==t?void 0:t.CompressionStream,c=null==i?void 0:i.userAgent;function u(){return!(!e||!1===e.navigator.onLine)}const d="undefined"!=typeof globalThis?globalThis:e;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});const h=null!=e?e:{},p="$people_distinct_id",_="distinct_id",g="$device_id",f="$device_model",v="__alias",m="__cmpns",y="$fbc",b="$fbc_persistence",S="__timers",w="$autocapture_disabled_server_side",k="$heatmaps_enabled_server_side",C="$exception_capture_enabled_server_side",E="$error_tracking_suppression_rules",x="$error_tracking_capture_extension_exceptions",T="$web_vitals_enabled_server_side",I="$dead_clicks_enabled_server_side",R="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",M="$web_vitals_allowed_metrics",F="$session_recording_remote_config",L="$session_recording_enabled_server_side",A="$replay_sample_rate",O="$replay_override_sampling",D="$replay_override_linked_flag",N="$replay_override_url_trigger",B="$replay_override_event_trigger",q="$sesid",H="$session_is_sampled",U="$session_past_minimum_duration",W="$session_recording_url_trigger_activated_session",z="$session_recording_event_trigger_activated_session",j="$posthog_sr_group_event_trigger_",V="$posthog_sr_group_url_trigger_",G="$posthog_sr_group_sampling_",Q="$debug_first_full_snapshot_timestamp",K="$sess_rec_flush_size",Z="$enabled_feature_flags",Y="$active_feature_flags",J="$early_access_features",X="$feature_flag_details",ee="$feature_flag_payloads",te="$feature_flag_request_id",ie="$minimal_flag_called_events",se="$override_feature_flags",ne="$override_feature_flag_payloads",re="$stored_person_properties",oe="$stored_group_properties",ae="$groups",le="$surveys",ce="$surveys_loaded_at",ue="$surveys_activated",de="$surveys_activated_session",he="$surveys_activated_timestamps",pe="ph_product_tours",_e="$product_tours_activated",ge="$product_tours_activated_session",fe="$conversations_widget_session_id",ve="$conversations_ticket_id",me="$conversations_widget_state",ye="$conversations_user_traits",be="$flag_call_reported",Se="$flag_call_reported_session_id",we="$feature_flag_errors",ke="$feature_flag_evaluated_at",Ce="$user_state",Ee="$client_session_props",xe="$capture_rate_limit",Te="$initial_campaign_params",Ie="$initial_referrer_info",Re="$initial_person_info",Pe="$epp",Me="$posthog_cookieless",Fe="$cookieless_mode",Le="$sdk_debug_extensions_init_method",Ae="$sdk_debug_extensions_init_time_ms",Oe="$sdk_debug_recording_script_not_loaded",$e="$sdk_debug_replay_event_trigger_status",De="$sdk_debug_replay_linked_flag_trigger_status",Ne="$sdk_debug_replay_matched_recording_trigger_groups",Be="$sdk_debug_replay_pending_trigger_conditions",qe="$sdk_debug_replay_remote_trigger_matching_config",He="$sdk_debug_replay_trigger_groups_count",Ue="$sdk_debug_replay_url_trigger_status",We="$sdk_debug_rrweb_attached",ze="$sdk_debug_rrweb_start_attempted",je="$session_recording_start_reason",Ve="PostHog loadExternalDependency extension not found.",Ge="anonymous",Qe="identified",Ke="identified_only",Ze="visibilitychange",Ye="beforeunload",Je="$pageview",Xe="$pageleave",et="$identify",tt="$groupidentify";function it(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,n)}function st(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(e){it(r,s,n,o,a,"next",e)}function a(e){it(r,s,n,o,a,"throw",e)}o(void 0)})}}function nt(e){return nt="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},nt(e)}function rt(e,t,i){return(t=function(e){var t=function(e){if("object"!=nt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=nt(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ot(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function at(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(i),!0).forEach(function(t){rt(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ot(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var lt=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}({}),ct=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const ut="min_length",dt="max_length",ht=["$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"],pt=["token"];function _t(e,t){return-1!==e.indexOf(t)}const gt=function(e){return e.trim()},ft=function(e){return e.replace(/^\$/,"")};function vt(e){var t;const i=[];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(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))&&void 0!==t?t:"null"}const mt=Object.prototype,yt=mt.hasOwnProperty,bt=mt.toString,St=Array.isArray||function(e){return"[object Array]"===bt.call(e)},wt=e=>"function"==typeof e,kt=e=>e===Object(e)&&!St(e),Ct=e=>{if(kt(e)){for(const t in e)if(yt.call(e,t))return!1;return!0}return!1},Et=e=>void 0===e,xt=e=>"[object String]"==bt.call(e),Tt=e=>xt(e)&&0===e.trim().length,It=e=>null===e,Rt=e=>Et(e)||It(e),Pt=e=>"[object Number]"==bt.call(e)&&e==e,Mt=e=>Pt(e)&&e>0,Ft=e=>"[object Boolean]"===bt.call(e),Lt=e=>e instanceof FormData,At=e=>_t(ht,e),Ot=e=>_t(pt,e);function $t(e){return null===e||"object"!=typeof e}function Dt(e,t){return{}.toString.call(e)===`[object ${t}]`}function Nt(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 qt(e,Error)}}function Bt(e){return"u">typeof Event&&qt(e,Event)}function qt(e,t){try{return e instanceof t}catch(e){return!1}}const Ht=[!0,"true",1,"1","yes"],Ut=e=>_t(Ht,e),Wt=[!1,"false",0,"0","no"],zt=["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"],jt=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return zt.concat(t).some(e=>{const t=e.toLowerCase();return-1!==i.indexOf(t)})};function Vt(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),Pt(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+n),Vt(null!=n?n:i,t,i,s))}var Gt=class{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=Vt(e.bucketSize,0,100,e._logger),this._refillRate=Vt(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=Vt(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){const i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let n=this._buckets[s];return n?this._applyRefill(n,i):(n={tokens:this._bucketSize,lastAccess:i},this._buckets[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(t=this._onBucketRateLimited)||void 0===t||t.call(this,e)),0===n.tokens)}stop(){this._buckets={}}};const Qt="Mobile",Kt="Android",Zt="Tablet",Yt="Android Tablet",Jt="iPad",Xt="Apple Watch",ei="Safari",ti="BlackBerry",ii="Samsung Internet",si="Chrome",ni="Chrome iOS",ri="Internet Explorer",oi="Internet Explorer Mobile",ai="Opera",li="Microsoft Edge",ci="Firefox",ui="Firefox iOS",di="Nintendo",hi="PlayStation",pi="Xbox",_i="Android Mobile",gi="Mobile Safari",fi="Windows",vi="Windows Phone",mi="Nokia",yi="Ouya",bi="Generic "+Qt.toLowerCase(),Si="Generic "+Zt.toLowerCase(),wi="Konqueror",ki="Oculus Browser",Ci="Vivaldi",Ei="Yandex",xi="Whale",Ti="DuckDuckGo",Ii="Pale Moon",Ri="Waterfox",Pi="Brave",Mi="Claude",Fi="Codex",Li="ChatGPT",Ai="Google Search App",Oi=new RegExp("Version/(\\d+(\\.\\d+)?)"),$i=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Di=new RegExp(pi,"i"),Ni=new RegExp("PlayStation \\w+","i"),Bi=new RegExp("Nintendo \\w+","i"),qi=new RegExp("BlackBerry|PlayBook|BB10","i"),Hi={"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"},Ui=function(e,t,i,s){t=t||"";const n=function(e){return(null==e?void 0:e.brave)?Pi:null}(i);return n||((null==s?void 0:s.detectGoogleSearchApp)&&_t(e,"GSA/")?Ai:_t(e," OPR/")&&_t(e,"Mini")?"Opera Mini":_t(e," OPR/")?ai:qi.test(e)?ti:_t(e,"IEMobile")||_t(e,"WPDesktop")?oi:_t(e,"OculusBrowser")?ki:_t(e,"SamsungBrowser")?ii:_t(e,"Edge")||_t(e,"Edg/")?li:_t(e,"Vivaldi/")?Ci:_t(e,"YaBrowser/")?Ei:_t(e,"Whale/")?xi:_t(e,"DuckDuckGo/")||_t(e,"Ddg/")?Ti:_t(e,"Claude/")?Mi:_t(e,"Codex/")?Fi:_t(e,"ChatGPT/")?Li:_t(e,"FBIOS")?"Facebook Mobile":_t(e,"UCWEB")||_t(e,"UCBrowser")?"UC Browser":_t(e,"CriOS")?ni:_t(e,"CrMo")||_t(e,si)?si:_t(e,Kt)&&_t(e,ei)?_i:_t(e,"FxiOS")?ui:_t(e.toLowerCase(),wi.toLowerCase())?wi:_t(e,"Brave/")?Pi:((e,t)=>t&&_t(t,"Apple")||function(e){return _t(e,ei)&&!_t(e,si)&&!_t(e,Kt)}(e))(e,t)?_t(e,Qt)?gi:ei:_t(e,"PaleMoon/")?Ii:_t(e,"Waterfox/")?Ri:_t(e,ci)?ci:_t(e,"MSIE")||_t(e,"Trident/")?ri:_t(e,"Gecko")?ci:"")},Wi={[oi]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[li]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[si]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ni]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ei]:[Oi],[gi]:[Oi],[ai]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[wi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ti]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oi],[_i]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ii]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[ki]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ei]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[xi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Mi]:[$i],[Fi]:[$i],[Li]:[$i],[Ti]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ri]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},zi=function(e,t,i,s){const n=Ui(e,t,i,s),r=Wi[n];if(Et(r))return null;for(let t=0;r.length>t;t++){const i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},ji=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[pi,e&&e[1]||""]],[new RegExp(di,"i"),[di,""]],[new RegExp(hi,"i"),[hi,""]],[qi,[ti,""]],[new RegExp(fi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[vi,""];if(new RegExp(Qt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=Hi[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[fi,e]}return[fi,""]}],[/((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=>{let t="";return e&&e.length>=3&&(t=Et(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Kt,[e[2],e[3],e[4]||"0"].join(".")]:[Kt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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",""]]],Vi=function(e){for(let t=0;ji.length>t;t++){const[i,s]=ji[t],n=i.exec(e),r=n&&(wt(s)?s(n,e):s);if(r)return r}return["",""]},Gi=function(e){return Bi.test(e)?di:Ni.test(e)?hi:Di.test(e)?pi:new RegExp(yi,"i").test(e)?yi:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?vi:/iPad/.test(e)?Jt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Xt:qi.test(e)?ti:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(mi,"i").test(e)?mi:/(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(Qt).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)?Kt:Yt:new RegExp("(pda|Mobile)","i").test(e)?bi:new RegExp(Zt,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Si:""},Qi=function(e,t){var i;const s=Gi(e);return s===Jt||s===Yt||"Kobo"===s||"Kindle Fire"===s||s===Si?Zt:s===di||s===pi||s===hi||s===yi?"Console":s===Xt?"Wearable":s?Qt:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(i=null==t?void 0:t.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(n=null==t?void 0:t.screenWidth)&&void 0!==n?n:0,null!==(r=null==t?void 0:t.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==t?void 0:t.devicePixelRatio)&&void 0!==o?o:1)?Qt:Zt:"Desktop";var n,r,o},Ki=/\bFBAV\/(\d+(?:\.\d+)*)/i,Zi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ki],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ki],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ki],[/\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"]],Yi="[Truncated]",Ji="[Unserializable]";function Xi(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const s=e.charCodeAt(i+1);56320>s||s>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}Date,Date;const es=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ts(e,t){return"string"==typeof(i=e)&&es.test(i)?e:t();var i}function is(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function ss(e){return e?e.split("#")[0]:e}function ns(e,t){const i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function rs(e,t,i){return os.apply(this,arguments)}function os(){return(os=st(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,n)=>{s=ns(()=>{try{null==i||i(),e()}catch(e){n(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let as,ls,cs;function us(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return cs&&i.length===ls||(ls=i.length,cs=i.reduce((i,s)=>{as||(as={});const n=as[s];if(n)i[n[0]]=n[1];else{const n=e(s);for(let e=n.length-1;e>=0;e--){const r=n[e],o=null==r?void 0:r.filename,a=t[s];if(o&&a){i[o]=a,as[s]=[o,a];break}}}return i},{})),cs}var ds=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return st(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&St(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null===(t=e.syntheticException)||void 0===t?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){let i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),at(at({},e),{},{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return st(function*(){let i=e;for(const e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){var i,s,n;const r={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});const o=[r];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,at(at({},t),{},{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:us(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,i=0){const s=(i,s)=>{if(4>=s){const n=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,n)}};return at(at({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}};function hs(e,t,i,s,n){const r={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!!t&&!t.startsWith("webkit-masked-url://")&&"<anonymous>"!==t};return Et(s)||(r.lineno=s),Et(n)||(r.colno=n),r}const ps=(e,t)=>{const i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},_s=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,gs=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fs=/\((\S*)(?::(\d+))(?::(\d+))\)/,vs=(e,t)=>{const i=_s.exec(e);if(i){const[,e,s,n]=i;return hs(t,e,"?",+s,+n)}const s=gs.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){const e=fs.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}const[e,i]=ps(s[1]||"?",s[2]);return hs(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ms=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ys=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,bs=(e,t)=>{const i=ms.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const e=ys.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],s=i[1]||"?";return[s,e]=ps(s,e),hs(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ss=/\(error: (.*)\)/;function ws(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function ks(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!ws(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let s=0;t>s;s++)e[i+s]=e[i+t+s];return e.length=i+t,{start:i,length:t}}}}function Cs(e,t){const i=t.start+t.length,s=xs(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function Es(e,t){let i=t.start;for(;i>0&&ws(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function xs(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&ws(e[s],e[s-t.length]);)s++;return s-i}function Ts(e,t){const i=t[0];let s=e.length-(i?Es(e,i):0);for(const i of t)s-=xs(e,i);return s}function Is(e,t,i){for(let s=0;e.length>s;s++){const n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var Rs=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=xt(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?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){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Dt(e,"DOMException")}isDOMError(e){return Dt(e,"DOMError")}},Ps=class{match(e){return Nt(e)}coerce(e,t){var i;const s=this.getStack(e),n=void 0===s;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}},Ms=class{match(e){return!!Dt(e,"ErrorEvent")&&(null!=e.error||this._hasUsableMessage(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);const s=t.apply(e.message);return at(at({},s),{},{stack:null!==(i=this._buildLocationStack(e))&&void 0!==i?i:s.stack,synthetic:!0})}_hasUsableMessage(e){return xt(e.message)&&e.message.length>0}_buildLocationStack(e){var t,i;const s=e,n=null!==(t=s.lineno)&&void 0!==t?t:0,r=null!==(i=s.colno)&&void 0!==i?i:0;if(xt(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Fs=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Ls=class{match(e){return"string"==typeof e}coerce(e,t){var i;const[s,n]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=n?n:e,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(Fs);return s&&(t=s[1],i=s[2]),[t,i]}};const As=["fatal","error","warning","log","info","debug"];function Os(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){const s=i.slice(0,e).join(", ");if(t>=s.length)return e===i.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var $s=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s;const n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null!==(i=this.getStack(e))&&void 0!==i?i:null===(s=t.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Bt(e))return e.constructor.name;const t="name"in e?e.name:void 0;return xt(t)&&!Tt(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let 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;const t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${Os(e)}`}isSeverityLevel(e){return xt(e)&&!Tt(e)&&As.indexOf(e)>=0}getStack(e){try{return xt(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:xt(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(Nt(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},Ds=class{match(e){return Bt(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${Os(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Ns=class{match(e){return $t(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Bs=class{match(e){return Dt(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Bt(e))return!1;try{const t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return $t(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:t.apply(s)}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}};const qs="$message",Hs="$timestamp",Us=new Set([qs,Hs]),Ws={enabled:!0,max_bytes:32768};function zs(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:Ws.enabled,max_bytes:Vs(e.max_bytes,Ws.max_bytes)}:at({},Ws)}var js=class{constructor(e){this._entries=[],this._totalBytes=0,this._config=zs(e)}setConfig(e){this._config=zs(e),this._trimToMaxBytes()}add(e){const t=function(e){let t;try{t=vt(e)}catch(e){return}try{const e=JSON.parse(t);if(!kt(e))return;const i=e,s=i[qs],n=i[Hs];if(!xt(s)||0===s.trim().length)return;if(!xt(n)&&!Pt(n))return;return{step:i,json:t}}catch(e){return}}(e);if(!t)return;const i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;const t=encodeURIComponent(e);let i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this._config.max_bytes||(this._entries.push({step:t.step,bytes:i}),this._totalBytes+=i,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;){const e=this._entries.shift();e&&(this._totalBytes-=e.bytes)}}};function Vs(e,t){if(!Pt(e)||1/0===e||-1/0===e)return t;const i=Math.floor(e);return 0>i?t:i}const Gs=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function Qs(e){return"string"==typeof e||e}function Ks(e){return"string"==typeof e?e:void 0}const Zs=["$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"],Ys="NativeGzipValidationError",Js=e=>e.length>=2&&31===e[0]&&139===e[1],Xs=(e,t)=>e===ct.GZipJS||t===ct.GZipJS||"gzip"===t,en=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),tn=e=>{if(!e||"object"!=typeof e)return!1;const t="name"in e?String(e.name):"";return en(e)||t===Ys};let sn;const nn=e=>{throw is(Ys,`Native gzip produced invalid output: ${e}`)},rn=(on=st(function*(e,t){18>e.size&&nn("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Js(i)&&8===i[2]||nn("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{const t=(()=>{if(sn)return sn;sn=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;sn[e]=t>>>0}return sn})();let i=4294967295;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&nn("invalid-crc");const n=t.length>>>0;s.getUint32(4,!0)!==n&&nn("invalid-size")}),function(e,t){return on.apply(this,arguments)});var on;function an(e){return ln.apply(this,arguments)}function ln(){return ln=st(function*(e,t=!0,i){try{const t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),n=i.writable.getWriter(),r=n.write(t).then(()=>n.close()).catch((s=st(function*(e){try{yield n.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield rn(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var s}),ln.apply(this,arguments)}function cn(e,t){if(null==e)return{};var i,s,n=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;i[s]=e[s]}return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}const un={}.propertyIsEnumerable;function dn(e,t){try{return _n(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function hn(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Yi};if(i.remainingNodes--,Ft(e))return{boolValue:e};if("bigint"==typeof e)return function(e,t){const i=e.toString(),s=BigInt("9223372036854775808");return e>=s||-s>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(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)};const i=BigInt(e).toString();return e>=0x8000000000000000||-0x8000000000000000>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if("string"==typeof e)return{stringValue:Xi(e)};if("function"==typeof e)return{stringValue:"[Function]"};if("symbol"==typeof e)return{stringValue:String(e)};if("object"==typeof e&&null!==e){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Yi};if(e instanceof Date){const t=e.getTime(),i=Number.isFinite(t)?e.toISOString():String(e);return{stringValue:"string"==typeof i?Xi(i):String(i)}}i.ancestors.add(e);try{try{const n=e.toJSON;if("function"==typeof n)return hn(n.call(e),t,i,s+1)}catch(e){}return St(e)?{arrayValue:{values:pn(e,t,i,s+1)}}:{kvlistValue:{values:_n(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:Xi(String(e))}}function pn(e,t,i,s){const n=[],r=Math.min(e.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in e?e[o]:void 0;if(Rt(r))continue;n.push(hn(r,t,i,s))}catch(e){n.push({stringValue:Ji})}return e.length>o&&n.push({stringValue:Yi}),n}function _n(e,t,i,s){const n=[];for(const r in e)if(un.call(e,r)){if(!r){null==t||t.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[r];if(It(o)||Et(o))continue;n.push({key:Xi(r),value:hn(o,t,i,s)})}catch(e){n.push({key:Xi(r),value:{stringValue:Ji}})}}return n}function gn(e,t,i){return at(at(at(at({},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":i})}const fn={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};const vn={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}},mn=vn.info;function yn(e){try{return Xi(String(e))}catch(e){return Ji}}function bn(e,t,i,s){const n=e.level||"info",{text:r,number:o}=vn[n]||mn,a=function(e=Date.now()){return String(e)+"000000"}(Pt(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),Rt(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),Rt(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const c=at({},l),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(const t of e){let e;try{e=u[t]}catch(t){e=Ji}Object.defineProperty(c,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}const d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:yn(e.body)},attributes:dn(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),Et(e.trace_flags)||(d.flags=e.trace_flags),d}function Sn(e,t,i){return gn(e,t,i)}function wn(e,t,i,s){return{resourceLogs:[{resource:{attributes:dn(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var kn=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this._config=t,this._logger=i,this._getContext=s,this._onReady=n,this._waitForStoragePersist=r,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(lt.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 i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==e?void 0:e.body))return;const s=this._runBeforeSend(e);if(null===s)return;if(!s.body)return void this._logger.info("Log was rejected in beforeSend function");if(!this._checkRateLimit())return;const n={record:bn(s,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this._getContext(),this._logger,null==t?void 0:t.occurredAtMs)};this._onReady(()=>this._enqueue(n))}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=St(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Log was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for log:",e),null}return s}_checkRateLimit(){if(void 0===this._maxLogsPerInterval)return!0;const 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 st(function*(){if(!e._instance.isDisabled)return e._flushPromise||(e._flushPromise=e._flushInner().finally(()=>{e._flushPromise=null})),e._flushPromise})()}_flushInner(){var e=this;return st(function*(){var t;e._clearFlushTimer();let i=null!==(t=e._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==t?t:[];if(0===i.length)return;const s=i.length;let n=0;for(;i.length>0&&s>n;){var r,o;const t=e._queueGeneration;e._evictedSinceAdvance=0;const s=Math.min(i.length,e._maxBatchRecordsPerPost),a=i.slice(0,s),l=wn(a.map(e=>e.record),e._buildResourceAttributes(),null!==(r=e._scopeName)&&void 0!==r?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance._sendLogsBatch(l);if(e._queueGeneration!==t)return;if("too-large"===c.kind&&a.length>1)e._maxBatchRecordsPerPost=Math.max(1,Math.floor(a.length/2)),e._logger.warn(`Received 413 when sending logs batch of size ${a.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(a.length),i=null!==(o=e._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==o?o:[],n+=a.length,"fatal"===c.kind)throw c.error}}})()}_persistQueueAdvance(e){var t=this;return st(function*(){var i;const s=Math.max(0,e-t._evictedSinceAdvance),n=null!==(i=t._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(lt.LogsQueue,n.slice(s)),yield t._waitForStoragePersist()})()}_buildResourceAttributes(){return Sn(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion())}_enqueue(e){var t;if(this._instance.optedOut)return;const i=null!==(t=this._instance.getPersistedProperty(lt.LogsQueue))&&void 0!==t?t:[];this._maxQueueSize>i.length||(i.shift(),this._evictedSinceAdvance++,this._logger.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(lt.LogsQueue,i),this._maxBufferSize>i.length?this._armFlushTimer():this._flushInBackground()}_armFlushTimer(e=this._flushIntervalMs){this._flushTimer||(this._flushTimer=ns(()=>{this._flushTimer=void 0,this._flushInBackground()},e))}_nextFlushDelay(){const e=Math.min(Math.max(0,this._consecutiveFlushFailures-1),6);return this._flushIntervalMs*Math.pow(2,e)}_hasQueuedRecords(){const e=this._instance.getPersistedProperty(lt.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return st(function*(){t._clearFlushTimer();const i=t.flush().catch(()=>{});void 0!==e?yield rs(i,e):yield i})()}flushWithTimeout(e){var t=this;return st(function*(){const i=t.flush();yield rs(i,e,()=>{i.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)}};const Cn=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function En(e){return String(e)+"000000"}function xn(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(s[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${n}`}var Tn=class{constructor(e,t,i){this._instance=e,this._config=t,this._logger=i,this._series=new Map,this._flushPromise=null,this._seriesCapWarned=!1,this._typeByName=new Map,this._typeCollisionWarned=new Set,this._generation=0}count(e,t=1,i){this._capture({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this._capture({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this._capture({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e=this;const t=this._flushPromise,i=function(){var i=st(function*(){t&&(yield t.catch(()=>{})),yield e._doFlush()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this._flushPromise===i&&(this._flushPromise=null)});return this._flushPromise=i,i}drainWindow(){if(0===this._series.size)return null;const 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)return;const t=this._runBeforeSend(e);if(null===t)return;if(!t.name||"string"!=typeof t.name)return void this._logger.warn("Dropping metric with empty name");if("number"!=typeof t.value||!Number.isFinite(t.value))return void this._logger.warn(`Dropping metric '${t.name}': value must be a finite number`);if("count"===t.type&&0>t.value)return void this._logger.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?at({},t.attributes):void 0,s=xn(t.type,t.name,t.unit,i)}catch(e){return void this._logger.warn(`Dropping metric '${t.name}': attributes could not be serialized`,e)}let n=this._series.get(s);if(!n){if(!this._admitNewSeries())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this._series.set(s,n)}const r=this._typeByName.get(t.name);void 0===r?this._typeByName.set(t.name,t.type):r===t.type||this._typeCollisionWarned.has(t.name)||(this._typeCollisionWarned.add(t.name),this._logger.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this._fold(n,t.value),this._armFlushTimer()}_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){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?i: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(Cn.length+1).fill(0)});const 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(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,Cn)]+=1;break}}}_runBeforeSend(e){const t=this._config.beforeSend;if(!t)return e;const i=St(t)?t:[t];let s=e;for(const e of i)try{const t=e(s);if(!t)return this._logger.info("Metric was rejected in beforeSend function"),null;s=t}catch(e){return this._logger.error("Error in beforeSend function for metric:",e),null}return s}_armFlushTimer(){this._flushTimer||(this._flushTimer=ns(()=>{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 st(function*(){if(0===e._series.size)return;const t=e._series;e._series=new Map,e._seriesCapWarned=!1,e._typeByName=new Map,e._typeCollisionWarned=new Set;const i=e._generation,s=yield e._instance._sendMetricsBatch(e._buildPayload(t));if(i===e._generation)switch(s.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:",s.error)}})()}_buildPayload(e){return t=this._buildMetrics(e),i=function(e,t,i){return gn(e,t,i)}(this._config,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:dn(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}_buildMetrics(e){const t=En(Date.now()),i=new Map;for(const o of e.values()){var s;const e=xn(o.type,o.name,o.unit,void 0);let a=i.get(e);a||(a=at({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));const l=dn(null!==(s=o.attributes)&&void 0!==s?s:{},this._logger),c=En(o.windowStartMs);if("count"===o.type){var n;const e={attributes:l,startTimeUnixNano:c,timeUnixNano:t,asDouble:null!==(n=o.total)&&void 0!==n?n:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){var r;const e={attributes:l,timeUnixNano:t,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(e)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Cn})}return Array.from(i.values())}_mergeWindowBack(e){for(const[s,n]of e){const e=this._series.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,n.windowStartMs),e.type){case"count":var t,i;e.total=(null!==(t=e.total)&&void 0!==t?t:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(e.hist){e.hist.count+=n.hist.count,e.hist.sum+=n.hist.sum,e.hist.min=Math.min(e.hist.min,n.hist.min),e.hist.max=Math.max(e.hist.max,n.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=n.hist.bucketCounts[t]}else e.hist=n.hist}else this._admitNewSeries()&&this._series.set(s,n)}}};function In(e,t){if(!e)return;const i=e.find(e=>e.type===t);return null==i?void 0:i.value}const Rn="0.8.2",Pn={DEBUG:!1,LIB_VERSION:Rn,LIB_NAME:"browser-common",JS_SDK_VERSION:Rn},Mn=(t,{debugEnabled:i}={})=>{const s={_log(s,...n){e&&(Pn.DEBUG||e.POSTHOG_DEBUG||i)&&!Et(e.console)&&e.console&&("__rrweb_original__"in e.console[s]?e.console[s].__rrweb_original__:e.console[s])(t,...n)},debug(...e){s._log("debug",...e)},info(...e){s._log("log",...e)},warn(...e){s._log("warn",...e)},error(...e){s._log("error",...e)},critical(...e){console.error(t,...e)},uninitializedWarning(e){s.error(`You must initialize PostHog before calling ${e}`)},createLogger:(e,i)=>Mn(`${t} ${e}`,i)};return s},Fn=Mn("[PostHog.js]"),Ln=Fn.createLogger;function An(e,t){St(e)&&e.forEach(t)}function On(e,t){if(!Rt(e))if(St(e))e.forEach(t);else if(Lt(e))e.forEach((e,i)=>t(e,i));else for(const i in e)yt.call(e,i)&&t(e[i],i)}const $n=function(e,...t){for(const i of t)for(const t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function Dn(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}const Nn=function(e){try{return e()}catch(e){return}},Bn=function(e){return function(...t){try{return e.apply(this,t)}catch(e){Fn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Fn.critical(e)}}},qn=function(e){const t={};return On(e,function(e,i){(xt(e)&&e.length>0||Pt(e))&&(t[i]=e)}),t};function Hn(e){const t=at({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}const Un=["herokuapp.com","vercel.app","netlify.app"];function Wn(e){const t=null==e?void 0:e.hostname;if(!xt(t))return!1;const i=t.split(".").slice(-2).join(".");for(const e of Un)if(i===e)return!1;return!0}function zn(e,t,i,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:n,passive:r})}function jn(e){return"ph_toolbar_internal"===e.name}const Vn=["localhost","127.0.0.1"],Gn=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>{var s;return Nt(t)?(null!==(s=i)&&void 0!==s||(i=new WeakMap),i.has(t)||i.set(t,Hn(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return vt(e)}},Qn=e=>{const t=null==s?void 0:s.createElement("a");return Et(t)?null:(t.href=e,t)},Kn=function(e,t="&"){let i,s;const n=[];return On(e,function(e,t){Et(e)||Et(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),n[n.length]=s+"="+i)}),n.join(t)},Zn=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let e=0;i.length>e;e++){const n=i[e].split("=");if(n[0]===t){s=n;break}}if(!St(s)||2>s.length)return"";{let e=s[1];try{e=decodeURIComponent(e)}catch(t){Fn.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},Yn=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let e=0;l.length>e;e++){const s=l[e].split("=");St(s)&&(t.includes(s[0])?c.push(s[0]+"="+i):c.push(l[e]))}let u=a;return null!=o&&(u+="?"+c.join("&")),null!=n&&(u+="#"+n),u},Jn=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Xn=(e,t)=>e>=t&&u(),er=(e,t,i,s)=>{if(0===e){if(u()){const e=t+1;return e===i&&s(),e}return t}return 0};function tr(e,t){var i;const s=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!wt(s))return t;try{const e=s(t);return xt(e)&&e?e:t}catch(e){return Fn.error("Error in get_current_url, falling back to window.location.href",e),t}}function ir(t){var i;const s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return Et(s)?void 0:tr(t,s)}function sr(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null===(t=e.closest)||void 0===t?void 0:t.call(e,".toolbar-global-fade-container")))}function nr(e){return!!e&&1===e.nodeType}function rr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function or(e){return!!e&&3===e.nodeType}function ar(e){return!!e&&11===e.nodeType&&nr(e.host)}function lr(e){return e?gt(e).split(/\s+/):[]}function cr(e,t){const i=ir(t);return!!(i&&e&&e.some(e=>i.match(e)))}function ur(e){let 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 lr(t)}function dr(e){return Rt(e)?null:gt(e).split(/(\s+)/).filter(e=>Nr(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function hr(e){let t="";return Rr(e)&&!Pr(e)&&e.childNodes&&e.childNodes.length&&On(e.childNodes,function(e){var i;or(e)&&e.textContent&&(t+=null!==(i=dr(e.textContent))&&void 0!==i?i:"")}),gt(t)}function pr(e){var t;return Et(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}const _r=["a","button","form","input","select","textarea","label"];function gr(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function fr(e,t){if(Et(t))return!0;for(const i of e)if(t.some(e=>gr(i,e)))return!0;return!1}function vr(e){const t=e.parentNode;return!(!t||!nr(t))&&t}const mr=[".ph-no-autocapture","[data-ph-no-autocapture]"],yr=["next","previous","prev",">","<"],br=[...yr,"+","-","−","–"],Sr=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,wr=[".ph-no-deadclick",".ph-no-capture"],kr=[".ph-no-rageclick",".ph-no-capture"],Cr=["","text","search","email","password","url","tel","number"];function Er(e){return!(!e||!nr(e))&&(!!rr(e,"textarea")||(rr(e,"input")?_t(Cr,(e.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;const i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(e)))}function xr(t,i){if(!e||Tr(t))return!1;let s,n,r;var o,a;if(Ft(i)?(s=!!i&&kr,n=void 0,r=!1):(s=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:kr,n=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===s)return!1;if(r&&Er(t))return!1;const{targetElementList:l}=Ir(t,!1);return!function(e,t){if(!1===e||Et(e))return!1;let i;if(!0===e)i=yr;else{if(!St(e))return!1;if(e.length>10)return Fn.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(({safeText:e,ariaLabel:t})=>i.some(i=>Sr(e,i)||Sr(t,i)))}(n,l.map(e=>{var t;return{safeText:hr(e).toLowerCase(),ariaLabel:(null===(t=e.getAttribute("aria-label"))||void 0===t?void 0:t.toLowerCase().trim())||""}}))&&!fr(l,s)}const Tr=e=>!e||rr(e,"html")||!nr(e),Ir=(t,i)=>{if(!e||Tr(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!rr(r,"body");){if(ar(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=vr(r);if(!t)break;if(i||_r.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(e){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Rr(e){const t=new Set;let i=0;for(let s=e;s.parentNode&&!rr(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);const e=ur(s);if(_t(e,"ph-sensitive")||_t(e,"ph-no-capture"))return!1}if(_t(ur(e),"ph-include"))return!0;const s=e.type||"";if(xt(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=e.name||e.id||"";return!xt(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Pr(e){return!!(rr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rr(e,"select")||rr(e,"textarea")||"true"===e.getAttribute("contenteditable"))}const Mr=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}))$"),Fr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Lr=[16,15,14,13],Ar=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Or=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),$r=/[0-9A-Za-z_]/;function Dr(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function Nr(e,t=!0){if(Rt(e))return!1;if(xt(e)){if(e=gt(e),t?Mr.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(Fr.lastIndex=0;t=Fr.exec(e);){const e=t[2];if(!e)continue;const i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(const t of Lr){const s=e+t;if(i.length>=s){const t=i.slice(e,s);if(Mr.test(t)&&Dr(t))return!0}}}return!1}(e))return!1;if(t?Ar.test(e):function(e){let t;for(Or.lastIndex=0;t=Or.exec(e);){const e=t[1],i=t[3];if(!(e&&i&&$r.test(e)&&$r.test(i)))return!0}return!1}(e))return!1}return!0}function Br(e){let t=hr(e);return t=`${t} ${qr(e)}`.trim(),Nr(t)?t:""}function qr(e){let t="";return e&&e.childNodes&&e.childNodes.length&&On(e.childNodes,function(e){var i;if(e&&"span"===(null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=hr(e);t=`${t} ${i}`.trim(),e.childNodes&&e.childNodes.length&&(t=`${t} ${qr(e)}`.trim())}catch(e){Fn.error("[AutoCapture]",e)}}),t}function Hr(e){return e.replace(/"|\\"/g,'\\"')}function Ur(e){const t=e.attr__class;if(t)return St(t)?t:lr(t)}const Wr=1e6;function zr(e){var t;return Math.min(Wr,null!==(t=e.payloadSizeLimitBytes)&&void 0!==t?t:Wr)}const jr={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:Wr,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},Vr=["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"],Gr=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Qr=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],Kr=e=>{Rt(e)||On(Object.keys(e),t=>{(e=>{const t=e.toLowerCase();return Vr.includes(t)||Qr.some(e=>t.includes(e))})(t)&&(e[t]="redacted")})},Zr=["/s/","/e/","/i/"];function Yr(e,t,i,s){if(Rt(e))return e;let n=(null==t?void 0:t["content-length"])||function(e){return new Blob([e]).size}(e);return xt(n)&&(n=parseInt(n)),n>i?`[SessionRecording] ${s} body too large to record (${n} bytes)`:e}function Jr(e,t){if(Rt(e))return e;let i=e;return Nr(i,!1)||(i="[SessionRecording] "+t+" body redacted"),On(Gr,e=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(e))&&(i="[SessionRecording] "+t+" body redacted as might contain: "+e)}),i}const Xr=new WeakSet,eo="disabled",to="sampled",io="active",so="buffering",no="paused",ro="lazy_loading",oo="rrweb_error",ao="trigger_activated",lo="trigger_pending",co="trigger_disabled";function uo(e,t,i,s,n,r){return 0===t?co:(null==e?void 0:e.get_property(i?s+i:n))===r?ao:lo}function ho(e,t,i){return t.some(t=>{var s;return"regex"===t.matching&&(null!==(s=null==i?void 0:i.get(t.url))&&void 0!==s?s:new RegExp(t.url)).test(e)})}function po(e){return e.includes("trigger_activated")?ao:e.includes("trigger_pending")?lo:co}function _o(e){const t=new Set(e);switch(t.delete(co),t.size){case 0:return co;case 1:return Array.from(t)[0];default:return lo}}var 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())}},fo=class{constructor(e){this._matchers=e}triggerStatus(e){return _o(this._matchers.map(t=>t.triggerStatus(e)))}triggerStatusNoSideEffects(e){return _o(this._matchers.map(t=>t.triggerStatusNoSideEffects(e)))}stop(){this._matchers.forEach(e=>e.stop())}},vo=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return ao}stop(){}};const mo=e=>"sessionRecording"in e;var yo=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,i;this._urlTriggers=(mo(e)?kt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?void 0:t.urlTriggers:[]:null==e?void 0:e.urlTriggers)||[],this._urlBlocklist=(mo(e)?kt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==e?void 0:e.urlBlocklist)||[],this._compileRegexCache()}_compileRegexCache(){this._compiledTriggerRegexes.clear(),this._compiledBlocklistRegexes.clear();for(const e of this._urlTriggers)if("regex"===e.matching&&!this._compiledTriggerRegexes.has(e.url))try{this._compiledTriggerRegexes.set(e.url,new RegExp(e.url))}catch(t){Fn.error("Invalid URL trigger regex pattern:",e.url,t)}for(const e of this._urlBlocklist)if("regex"===e.matching&&!this._compiledBlocklistRegexes.has(e.url))try{this._compiledBlocklistRegexes.set(e.url,new RegExp(e.url))}catch(t){Fn.error("Invalid URL blocklist regex pattern:",e.url,t)}}onRemoteConfig(e){this.onConfig(e)}_urlTriggerStatus(e){return uo(this._instance,this._urlTriggers.length,this._groupId,V,W,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[Ue]:t}),t}triggerStatusNoSideEffects(e){return this._urlTriggerStatus(e)}isCurrentUrlBlocked(){const e=ir(this._instance);if(!e)return!1;try{return ho(e,this._urlBlocklist,this._compiledBlocklistRegexes)}catch(e){return!0}}checkUrlBlocklist(e,t){const i=ir(this._instance);if(!i)return;if(i===this._lastCheckedUrl)return;this._lastCheckedUrl=i;const s=this.urlBlocked,n=ho(i,this._urlBlocklist,this._compiledBlocklistRegexes);s&&n||(n&&!s?e():!n&&s&&t())}checkUrlTriggerConditions(e,t,i,s){const n=ir(this._instance);if(!n)return;if(n===this._lastCheckedUrl)return;this._lastCheckedUrl=n;const r=this.urlBlocked,o=ho(n,this._urlBlocklist,this._compiledBlocklistRegexes);o&&!r?e():!o&&r&&t();const a=this._urlTriggerStatus(s)===ao,l=ho(n,this._urlTriggers,this._compiledTriggerRegexes);!a&&l&&i("url",n)}stop(){this._lastCheckedUrl=""}},bo=class{constructor(e){this._instance=e,this.linkedFlag=null,this.linkedFlagSeen=!1,this._flagListenerCleanup=()=>{}}triggerStatus(){const e=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[De]:e}),e}triggerStatusNoSideEffects(){let e=lo;return Rt(this.linkedFlag)&&(e=co),this.linkedFlagSeen&&(e=ao),e}onConfig(e,t){var i;if(this.linkedFlag=(mo(e)?kt(e.sessionRecording)?null===(i=e.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==e?void 0:e.linkedFlag)||null,!Rt(this.linkedFlag)&&!this.linkedFlagSeen){const e=xt(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=xt(this.linkedFlag)?null:this.linkedFlag.variant;this._flagListenerCleanup=this._instance.onFeatureFlags((s,n)=>{let r=!1;if(kt(n)&&e in n){const t=n[e];r=Ft(t)?!0===t:i?t===i:!!t}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&t(e,i)})}}onRemoteConfig(e,t){this.onConfig(e,t)}stop(){this._flagListenerCleanup()}},So=class{constructor(e,t){this._instance=e,this._eventTriggers=[],this._groupId=t}onConfig(e){var t;this._eventTriggers=(mo(e)?kt(e.sessionRecording)?null===(t=e.sessionRecording)||void 0===t?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,j,z,e)}triggerStatus(e){const t=this.triggerStatusNoSideEffects(e);return this._instance.register_for_session({[$e]:t}),t}triggerStatusNoSideEffects(e){return this._eventTriggerStatus(e)}checkEventTriggerConditions(e,t,i){if(0===this._eventTriggers.length)return;const s=this._eventTriggerStatus(i)===ao,n=this._eventTriggers.includes(e);!s&&n&&t("event",e)}stop(){}},wo=class{constructor(e,t,i){if(this._instance=e,this.group=t,this._urlTriggerMatching=new yo(e,t.id),this._eventTriggerMatching=new So(e,t.id),this._linkedFlagMatching=new bo(e),t.conditions.events&&t.conditions.events.length>0||t.conditions.urls&&t.conditions.urls.length>0||t.conditions.flag){const e=(t.conditions.events||[]).map(e=>e.name),s={urlTriggers:t.conditions.urls||[],eventTriggers:e,linkedFlag:t.conditions.flag||null,urlBlocklist:[]};this._urlTriggerMatching.onConfig(s),this._eventTriggerMatching.onConfig(s),this._linkedFlagMatching.onConfig(s,i);const n=[this._eventTriggerMatching,this._urlTriggerMatching,this._linkedFlagMatching];this._combinedMatching="any"===t.conditions.matchType?new go(n):new fo(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(({status:e})=>e===lo).map(({label:e})=>e)}checkEventTriggerConditions(e,t,i){this._eventTriggerMatching.checkEventTriggerConditions(e,t,i)}checkUrlTriggerConditions(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(e,t,i,s)}activateTrigger(e,t){var i;const s="url"===e?V+this.group.id:j+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[s]:t})}stop(){this._urlTriggerMatching.stop(),this._eventTriggerMatching.stop(),this._linkedFlagMatching.stop()}};function ko(e){if(e.rrwebError)return oo;if(!e.receivedFlags)return so;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return no;const t=!0===e.isSampled,i=new go([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId);return t?to:"trigger_activated"===i?io:"trigger_pending"===i?so:!1===e.isSampled?eo:io}function Co(e){if(e.rrwebError)return oo;if(!e.receivedFlags)return so;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return no;const t=new fo([e.eventTriggerMatching,e.urlTriggerMatching,e.linkedFlagMatching]).triggerStatus(e.sessionId),i=t!==co,s=Ft(e.isSampled);return i&&"trigger_pending"===t?so:i&&"trigger_disabled"===t||s&&!e.isSampled?eo:!0===e.isSampled?to:io}function Eo(){const e=[];return function(t,i){if(kt(i)||St(i)){for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(i)?"[Circular]":(e.push(i),i)}return i}}function xo(e){const t=JSON.stringify(e,Eo());return t?new Blob([t]).size:0}function To(e){if(It(e))return 4;if(Et(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(St(e)){let t=2;for(let i=0;e.length>i;i++){i>0&&(t+=1);const s=e[i];t+=Et(s)||It(s)?4:To(s)}return t}const t=e;let i=2,s=!0;for(const e in t){if(!{}.hasOwnProperty.call(t,e))continue;const n=t[e];Et(n)||(s||(i+=1),s=!1,i+=e.length+3+To(n))}return i}default:return 0}}function Io(e,t=6606028.8){if(e.size>=t&&e.data.length>1){const t=Math.floor(e.data.length/2),i=e.sizes.slice(0,t),s=e.sizes.slice(t);return[Io({size:i.reduce((e,t)=>e+t,0),data:e.data.slice(0,t),sizes:i,sessionId:e.sessionId,windowId:e.windowId}),Io({size:s.reduce((e,t)=>e+t,0),data:e.data.slice(t),sizes:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap(e=>e)}return[e]}var Ro=Uint8Array,Po=Uint16Array,Mo=Uint32Array,Fo=new Ro([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]),Lo=new Ro([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]),Ao=new Ro([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oo=function(e,t){for(var i=new Po(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new Mo(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},$o=Oo(Fo,2),Do=$o[1];$o[0][28]=258,Do[258]=28;for(var No=Oo(Lo,0)[1],Bo=new Po(32768),qo=0;32768>qo;++qo){var Ho=(43690&qo)>>>1|(21845&qo)<<1;Bo[qo]=((65280&(Ho=(61680&(Ho=(52428&Ho)>>>2|(13107&Ho)<<2))>>>4|(3855&Ho)<<4))>>>8|(255&Ho)<<8)>>>1}var Uo=function(e,t,i){for(var s=e.length,n=0,r=new Po(t);s>n;++n)++r[e[n]-1];var o,a=new Po(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new Po(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],d=a[e[n]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[Bo[d]>>>l]=c}else for(o=new Po(s),n=0;s>n;++n)o[n]=Bo[a[e[n]-1]++]>>>15-e[n];return o},Wo=new Ro(288);for(qo=0;144>qo;++qo)Wo[qo]=8;for(qo=144;256>qo;++qo)Wo[qo]=9;for(qo=256;280>qo;++qo)Wo[qo]=7;for(qo=280;288>qo;++qo)Wo[qo]=8;var zo=new Ro(32);for(qo=0;32>qo;++qo)zo[qo]=5;var jo=Uo(Wo,9,0),Vo=Uo(zo,5,0),Go=function(e){return(e/8|0)+(7&e&&1)},Qo=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof Po?Po:e instanceof Mo?Mo:Ro)(i-t);return s.set(e.subarray(t,i)),s},Ko=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},Zo=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Yo=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Ro(0),0];if(1==n){var o=new Ro(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;n>s;++s)r[s].s>h&&(h=r[s].s);var p=new Po(h+1),_=Jo(i[u-1],p,0);if(_>t){s=0;var g=0,f=_-t,v=1<<f;for(r.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;g+=v-(1<<_-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=r[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=r[s].s;p[b]==t&&(--p[b],++g)}_=t}return[new Ro(p),_]},Jo=function(e,t,i){return-1==e.s?Math.max(Jo(e.l,t,i+1),Jo(e.r,t,i+1)):t[e.s]=i},Xo=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Po(++t),s=0,n=e[0],r=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==n&&a!=t)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=e[a]}return[i.subarray(0,s),t]},ea=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},ta=function(e,t,i){var s=i.length,n=Go(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},ia=function(e,t,i,s,n,r,o,a,l,c,u){Ko(t,u++,i),++n[256];for(var d=Yo(n,15),h=d[0],p=d[1],_=Yo(r,15),g=_[0],f=_[1],v=Xo(h),m=v[0],y=v[1],b=Xo(g),S=b[0],w=b[1],k=new Po(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=Yo(k,7),x=E[0],T=E[1],I=19;I>4&&!x[Ao[I-1]];--I);var R,P,M,F,L=c+5<<3,A=ea(n,Wo)+ea(r,zo)+o,O=ea(n,h)+ea(r,g)+o+14+3*I+ea(k,x)+(2*k[16]+3*k[17]+7*k[18]);if(A>=L&&O>=L)return ta(t,u,e.subarray(l,l+c));if(Ko(t,u,1+(A>O)),u+=2,A>O){R=Uo(h,p,0),P=h,M=Uo(g,f,0),F=g;var D=Uo(x,T,0);for(Ko(t,u,y-257),Ko(t,u+5,w-1),Ko(t,u+10,I-4),u+=14,C=0;I>C;++C)Ko(t,u+3*C,x[Ao[C]]);u+=3*I;for(var N=[m,S],B=0;2>B;++B){var q=N[B];for(C=0;q.length>C;++C)Ko(t,u,D[H=31&q[C]]),u+=x[H],H>15&&(Ko(t,u,q[C]>>>5&127),u+=q[C]>>>12)}}else R=jo,P=Wo,M=Vo,F=zo;for(C=0;a>C;++C)if(s[C]>255){var H;Zo(t,u,R[257+(H=s[C]>>>18&31)]),u+=P[H+257],H>7&&(Ko(t,u,s[C]>>>23&31),u+=Fo[H]);var U=31&s[C];Zo(t,u,M[U]),u+=F[U],U>3&&(Zo(t,u,s[C]>>>5&8191),u+=Lo[U])}else Zo(t,u,R[s[C]]),u+=P[s[C]];return Zo(t,u,R[256]),u+P[256]},sa=new Mo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),na=new Ro(0),ra=function(){for(var e=new Mo(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),oa=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function aa(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=ra[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var n,r,o,a,l,c=(n=e,r=t,o=function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),a=8,function(e,t,i,s,n,r){var o=e.length,a=new Ro(s+o+5*(1+Math.floor(o/7e3))+n),l=a.subarray(s,a.length-n),c=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?c=ta(l,c,e.subarray(u,d)):(l[u]=r,c=ta(l,c,e.subarray(u,o)))}else{for(var h=sa[t-1],p=h>>>13,_=8191&h,g=(1<<i)-1,f=new Po(32768),v=new Po(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},S=new Mo(25e3),w=new Po(288),k=new Po(32),C=0,E=0,x=(u=0,0),T=0,I=0;o>u;++u){var R=b(u),P=32767&u,M=v[R];if(f[P]=M,v[R]=P,u>=T){var F=o-u;if((C>7e3||x>24576)&&F>423){c=ia(e,l,0,S,w,k,E,x,I,u-I,c),x=C=E=0,I=u;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(u-N))for(var B=Math.min(p,F)-1,q=Math.min(32767,u),H=Math.min(258,F);q>=N&&--D&&P!=M;){if(e[u+A]==e[u+A-N]){for(var U=0;H>U&&e[u+U]==e[u+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 j=u-N+L+32768&32767,V=j-f[j]+32768&32767;V>z&&(z=V,M=j)}}}N+=(P=M)-(M=f[P])+32768&32767}if(O){S[x++]=268435456|Do[A]<<18|No[O];var G=31&Do[A],Q=31&No[O];E+=Fo[G]+Lo[Q],++w[257+G],++k[Q],T=u+A,++C}else S[x++]=e[u],++w[e[u]]}}c=ia(e,l,r,S,w,k,E,x,I,u-I,c),r||(c=ta(l,c,na))}return Qo(a,0,s+Go(c)+n)}(n,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+r.mem,o,a,!l)),u=c.length;return function(e,t){var i=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&&oa(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(c,t),oa(c,u-8,i.d()),oa(c,u-4,s),c}function la(e,t){var i=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new Ro(e.length+(e.length>>>1)),n=0,r=function(e){s[n++]=e},o=0;i>o;++o){if(n+5>s.length){var a=new Ro(n+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l||t?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return Qo(s,0,n)}function ca(e,t){var i="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var s=0;e.length>s;){var n=e[s++];128>n||t?i+=String.fromCharCode(n):224>n?i+=String.fromCharCode((31&n)<<6|63&e[s++]):240>n?i+=String.fromCharCode((15&n)<<12|(63&e[s++])<<6|63&e[s++]):(n=((15&n)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536,i+=String.fromCharCode(55296|n>>10,56320|1023&n))}return i}var ua=class{constructor(e,t={}){var i,s,n,r;this._rrweb=e,this._options=t,this._loggedTracker={},this._lastByteRefill=Date.now(),this._lastResyncAt=-1/0,this._refillByteBudget=()=>{const 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,i;this._loggedTracker[e]=!0;const s=this._getNode(e);null===(t=(i=this._options).onBlockedNode)||void 0===t||t.call(i,e,s)}},this._getNodeOrRelevantParent=e=>{const t=this._getNode(e);if("svg"!==(null==t?void 0:t.nodeName)&&t instanceof Element){const e=t.closest("svg");if(e)return[this._rrweb.mirror.getId(e),e]}return[e,t]},this._getNode=e=>this._rrweb.mirror.getNode(e),this._numberOfChanges=e=>{var t,i,s,n,r,o,a,l;return(null!==(t=null===(i=e.removes)||void 0===i?void 0:i.length)&&void 0!==t?t:0)+(null!==(s=null===(n=e.attributes)||void 0===n?void 0:n.length)&&void 0!==s?s:0)+(null!==(r=null===(o=e.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=e.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=e=>{if(3!==e.type||0!==e.data.source)return e;const t=e.data,i=this._numberOfChanges(t);if(t.attributes){const e=t.attributes.length;t.attributes=t.attributes.filter(e=>{const[t]=this._getNodeOrRelevantParent(e.id);return!this._rateLimiter.consumeRateLimit(t)&&e});const i=e-t.attributes.length;var s,n;i>0&&(null===(s=(n=this._options).onDroppedAttributeMutations)||void 0===s||s.call(n,i))}const r=this._numberOfChanges(t);if(0===r&&i!==r)return;if(this._byteBudgetDisabled)return e;this._refillByteBudget();const o=To(e);var a,l;return o>this._byteTokens?(null===(a=(l=this._options).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._scheduleResync()):(this._byteTokens-=o,e)},this._scheduleResync=()=>{if(this._resyncTimer)return;const 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)||void 0===e||e.call(t)},e)},this._rateLimiter=new Gt({bucketSize:null!==(i=this._options.bucketSize)&&void 0!==i?i:100,refillRate:null!==(s=this._options.refillRate)&&void 0!==s?s:10,refillInterval:1e3,_onBucketRateLimited:this._onNodeRateLimited,_logger:Fn}),this._bytesBucketSize=null!==(n=this._options.bytesBucketSize)&&void 0!==n?n:0,this._bytesRefillRate=null!==(r=this._options.bytesRefillRate)&&void 0!==r?r:25600,this._byteBudgetDisabled=!Number.isFinite(this._bytesBucketSize)||0>=this._bytesBucketSize,this._byteTokens=this._bytesBucketSize;const o=this._options.resyncIntervalMs;this._resyncIntervalMs=Pt(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}};const da=e=>{if(s){try{const t=e+"=",i=s.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let s=i[e];for(;" "==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 Pt(e)&&isFinite(e)&&Math.floor(e)===e});var ha=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new e(r)}toString(){let e="";for(let 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(let t=0;16>t;t++){const i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},pa=class{generate(){const e=this.generateOrAbort();if(!Et(e))return e;{this._timestamp=0;const e=this.generateOrAbort();if(Et(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return Pt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ha.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}};let _a=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!Et(e.crypto)&&crypto.getRandomValues&&(_a=e=>crypto.getRandomValues(e));var ga=class{nextUint32(){return this._buffer.length>this._cursor||(_a(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}};let fa;const va=()=>ma().toString(),ma=()=>(fa||(fa=new pa)).generate();let ya="";const ba=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Sa=null;const wa={_is_supported(){if(!It(Sa))return Sa;if(Sa=!1,s)try{const e=`__ph_cookie_support_${va()}`;wa._set(e,"xyz"),Sa='"xyz"'===da(e),wa._remove(e)}catch(e){Sa=!1}return Sa},_error(e){Fn.error("cookieStore error: "+e)},_get:da,_parse(e){let t;try{t=JSON.parse(wa._get(e))||{}}catch(e){}return t},_set(e,t,i,n,r){if(!s)return!1;try{let o="",a="";const l=function(e,t){if(t){let t=function(e,t=s){if(ya)return ya;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";const i=e.split(".");let n=Math.min(i.length,8);const r="dmn_chk_"+va();for(;!ya&&n--;){const e=i.slice(n).join("."),s=r+"=1;domain=."+e+";path=/";t.cookie=s+";max-age=3",t.cookie.includes(r)&&(t.cookie=s+";max-age=0",ya=e)}return ya}(e);if(!t){const i=(e=>{const t=e.match(ba);return t?t[0]:""})(e);i!==t&&Fn.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(s.location.hostname,n);if(i){const e=new Date;e.setTime(e.getTime()+864e5*i),o="; expires="+e.toUTCString()}r&&(a="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&Fn.warn("cookieStore warning: large cookie, len="+c.length),s.cookie=c,!0}catch(e){return!1}},_remove(e,t){if(null==s?void 0:s.cookie)try{wa._set(e,"",-1,t)}catch(e){return}}};let ka=null;const Ca={_is_supported(){if(!It(ka))return ka;let t=!0;if(Et(e))t=!1;else try{const e="__mplssupport__";Ca._set(e,"xyz"),'"xyz"'!==Ca._get(e)&&(t=!1),Ca._remove(e)}catch(e){t=!1}return t||Fn.error("localStorage unsupported; falling back to cookie store"),ka=t,t},_error(e){Fn.error("localStorage error: "+e)},_get(t){try{return null==e?void 0:e.localStorage.getItem(t)}catch(e){Ca._error(e)}return null},_parse(e){try{return JSON.parse(Ca._get(e))||{}}catch(e){}return null},_set(t,i){try{return null==e||e.localStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Ca._error(e)}return!1},_remove(t){try{null==e||e.localStorage.removeItem(t)}catch(e){Ca._error(e)}}},Ea=[re,Y,Z,X,ee,te,ke,we,be],xa=[g,_,q,H,Pe,Re,b,Ce],Ta=e=>e+"_cpm",Ia=["__proto__","constructor","prototype"],Ra=e=>{if(!kt(e))return{};const t={};return Object.keys(e).forEach(i=>{-1===Ia.indexOf(i)&&(t[i]=e[i])}),t},Pa=(e,t=[])=>{const i={};return[...xa,...t].forEach(t=>{const s=e[t];Et(s)||It(s)||""===s||(i[t]=s)}),i},Ma=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Fa=(e,t)=>({p:t,f:Ma(JSON.stringify(e))}),La=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=wa._parse(Ta(e)),s=(null==i?void 0:i.f)===Ma(t)&&St(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Aa=(e,t)=>t+"|"+(wa._get(Ta(e))||""),Oa={},$a={_is_supported:()=>!0,_error(e){Fn.error("memoryStorage error: "+e)},_get:e=>e in Oa?Oa[e]:null,_parse:e=>e in Oa?Oa[e]:null,_set:(e,t)=>(Oa[e]=t,!0),_remove(e){delete Oa[e]}};let Da=null;const Na={_is_supported(){if(!It(Da))return Da;if(Da=!0,Et(e))Da=!1;else try{const e="__support__";Na._set(e,"xyz"),'"xyz"'!==Na._get(e)&&(Da=!1),Na._remove(e)}catch(e){Da=!1}return Da},_error(e){Fn.error("sessionStorage error: ",e)},_get(t){try{return null==e?void 0:e.sessionStorage.getItem(t)}catch(e){Na._error(e)}return null},_parse(e){try{return JSON.parse(Na._get(e))||null}catch(e){}return null},_set(t,i){try{return null==e||e.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(e){Na._error(e)}return!1},_remove(t){try{null==e||e.sessionStorage.removeItem(t)}catch(e){Na._error(e)}}};Pn.DEBUG=!1,Pn.LIB_VERSION="1.429.3",Pn.LIB_NAME="web";var Ba=Pn,qa=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(K,{sessionId:e,size:this.currentTrackedSize(e)+t})}currentTrackedSize(e){const t=this._getProperty(K);return kt(i=t)&&xt(i.sessionId)&&Pt(i.size)&&t.sessionId===e?t.size:0;var i}};function Ha(e,t){return function(e){let t=0;for(let i=0;e.length>i;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return Math.abs(t)}(e)%100<Vt(100*t,0,100,Fn)}function Ua(e){return`$survey_response_${e}`}function Wa(e,t){if(!t)return null;const i=e[Ua(t)];return St(i)?[...i]:i}function za(e={},t,i){const s={};return t.questions.forEach(t=>{if(Et(t.originalQuestionIndex))return;const i=0===(n=t.originalQuestionIndex)?"$survey_response":`$survey_response_${n}`;var n;const r=Wa(e,t.id);Et(r)||(s[i]=r)}),at(at({$survey_questions:t.questions.map(t=>{var s,n;return{id:t.id,question:null!==(s=null==i?void 0:i[null!==(n=t.id)&&void 0!==n?n:""])&&void 0!==s?s:t.question,response:Wa(e,t.id)}})},e),s)}function ja(e={}){return Object.values(e).some(e=>!Rt(e))}function Va(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Ga(e){return"string"==typeof e&&e.trim()?e.trim():null}function Qa(e){return e.toLowerCase()}function Ka(e,t,i){if(!e||!t)return null;const s=Qa(t),n=Object.keys(e).find(e=>Qa(e)===s);if(n)return null==i||i.debug(`Found exact translation match: ${n}`),n;if(s.includes("-")){const n=s.split("-")[0],r=Object.keys(e).find(e=>Qa(e)===n);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${t})`),r}return null}const Za=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function Ya(e,t,i){var s;const n=Ka(e.translations,t,i),r=at({},e);let o=!1;if(n){var a;const t=null===(a=e.translations)||void 0===a?void 0:a[n];if(t)if(null==i||i.info(`Applying survey-level translation for language: ${n}`),Et(t.name)||(r.name=t.name,o=!0),r.appearance){const e=at({},r.appearance);for(const i of Za){const s=t[i];Et(s)||(e[i]=s,o=!0)}r.appearance=e}else(function(e){return Za.some(t=>!Et(e[t]))})(t)&&(o=!0)}const l=e.questions.map(e=>function(e,t,i){var s;const n=Ka(e.translations,t,i);if(!n)return{question:e,matchedKey:null,hasChanges:!1};const r=null===(s=e.translations)||void 0===s?void 0:s[n];if(!r)return{question:e,matchedKey:null,hasChanges:!1};const o=at({},e);let a=!1;return Et(r.question)||(o.question=r.question,a=!0),Et(r.description)||(o.description=r.description,a=!0),Et(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Et(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Et(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Et(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(e){return St(e.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:e,matchedKey:a?n:null,hasChanges:a}}(e,t,i)),c=l.map(e=>e.question),u=l.some(e=>e.hasChanges);let d=null;return n||(d=(null===(s=l.find(e=>e.matchedKey))||void 0===s?void 0:s.matchedKey)||null),u&&(r.questions=c,o=!0,null==i||i.info(`Applied question-level translations for language: ${t}`)),{survey:r,matchedKey:o?n||d:null}}function Ja(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}function Xa(e){var t;return Ja(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}const el=(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}},tl=e=>e.toLowerCase(),il={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=>el(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!el(t,e))),icontains:(e,t)=>t.map(tl).some(t=>e.map(tl).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(tl).every(t=>e.map(tl).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function sl(e,t){return!e||Object.entries(e).every(([e,i])=>{const s=null==t?void 0:t[e];if(null==s)return!1;const n=il[i.operator];return!!n&&n(i.values,[String(s)])})}function nl(e,t,i){return Gn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const rl=new Set(["is_not","not_icontains","not_regex"]);function ol(e,t,i){return!e||0===e.length||e.every(e=>{const s="person"===e.type?i:t,n=null==s?void 0:s[e.key],r=e.operator||"exact";if(Et(n)||It(n))return rl.has(r);const o=il[r];return!!o&&!Et(e.value)&&!It(e.value)&&o(St(e.value)?e.value.map(String):[String(e.value)],St(n)?n.map(String):[String(n)])})}const al=Ln("[SessionRecording]");function ll(e,t){return t?e:"!"+e}function cl(e,t){return e===t||e!=="!"+t&&null}var ul=class{constructor(e,t,i,s,n,r,o){this._instance=e,this._urlTriggerMatching=t,this._eventTriggerMatching=i,this._linkedFlagMatching=s,this._reportStarted=n,this._tryTakeFullSnapshot=r,this._onTriggerActivated=o,this._sampleRate=null,this._recordingStatusFunction=Co}onRemoteConfig(e){this._sampleRate=Pt(e.sampleRate)?e.sampleRate:null,"any"===e.triggerMatchType?(this._triggerStatusMatcher=new go([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=ko):(this._triggerStatusMatcher=new fo([this._eventTriggerMatching,this._urlTriggerMatching]),this._recordingStatusFunction=Co),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){const t=this._instance.get_property("$session_recording_remote_config"),i=null==t?void 0:t.minimumDurationMilliseconds;return Pt(i)?i:null}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlTriggerConditions(t,i,s,e)}setupEventTriggerListeners(e,t,i){if(0!==this._eventTriggerMatching._eventTriggers.length&&Rt(this._removeEventTriggerCaptureHook))return this._removeEventTriggerCaptureHook=e(e=>{try{this._eventTriggerMatching.checkEventTriggerConditions(e.event,i,t)}catch(e){al.error("Could not activate event trigger",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){var t;const i=this._sampleRate;var s,n;if(!Pt(i))return null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_is_sampled"),void(null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"));const r=this._instance.get_property(H),o=this._instance.get_property(A),a=cl(r,e),l=Pt(o)&&o!==i,c=Et(o)&&r===e,u=l||c||!Ft(a),d=u?Ha(e,i):a;u&&(d?this._reportStarted("sampled"):al.warn(`Sample rate (${i}) has determined that this sessionId (${e}) will not be sent to the server.`)),null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:ll(e,d),$replay_sample_rate:It(o)&&r===e?null:i})}ensureSamplingDecision(e){if(!Pt(this._sampleRate))return;const t=this._instance.get_property(H);Ft(cl(t,e))||this.makeSamplingDecisions(e)}onFlushComplete(){}clearConditionalRecordingPersistence(){var e,t,i,s,n;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_event_trigger_activated_session"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_past_minimum_duration")}updateActiveTriggers(e){}hasPendingTriggers(e){var t;return(null===(t=this._triggerStatusMatcher)||void 0===t?void 0:t.triggerStatus(e))===lo}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(({status:e})=>e===lo).map(({label:e})=>e)}stop(){var e;null===(e=this._removeEventTriggerCaptureHook)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._eventTriggerMatching.stop(),this._urlTriggerMatching.stop(),this._linkedFlagMatching.stop()}},dl=class{constructor(e,t,i,s,n){this._instance=e,this._urlTriggerMatching=t,this._reportStarted=i,this._tryAddCustomEvent=s,this._onTriggerActivated=n,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",[He]:e.triggerGroups.length}),this._urlTriggerMatching.onConfig(e)):al.warn("[V2Strategy] No trigger groups configured")}getStatus(e){return function(e){if(e.rrwebError)return oo;if(!e.receivedFlags)return so;if(!e.isRecordingEnabled)return eo;if(e.urlTriggerMatching.urlBlocked)return no;const t=e.triggerGroupMatchers,i=e.triggerGroupSamplingResults;if(0===t.length)return eo;let s=!1,n=!1;for(const r of t){const t=r.triggerStatus(e.sessionId);if("trigger_activated"===t){const e=r.group.id,t=i.get(e);Et(t)?Fn.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:e}):!0===t&&(n=!0)}else"trigger_pending"===t&&(s=!0)}return n?to:s?so:eo}({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){let t=null;for(const i of this._triggerGroupMatchers)if("trigger_activated"===i.triggerStatus(e)){const e=i.group.minDurationMs;Pt(e)&&(It(t)||t>e)&&(t=e)}return t}checkUrlTriggers(e,t,i,s){this._urlTriggerMatching.checkUrlBlocklist(t,i);for(const s of this._triggerGroupMatchers)s.checkUrlTriggerConditions(t,i,t=>{this._checkGroupLevelProperties(s,void 0)&&(s.activateTrigger(t,e),this.updateActiveTriggers(e),this._onTriggerActivated(t))},e)}setupEventTriggerListeners(e,t,i){return this._removeEventTriggerCaptureHook=e(e=>{var i;if(this._hasCompletedInitialFlush)return al.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),void(this._removeEventTriggerCaptureHook=void 0);try{for(const i of this._triggerGroupMatchers)i.checkEventTriggerConditions(e.event,s=>{if(!this._checkGroupLevelProperties(i,e.properties))return;const n=(i.group.conditions.events||[]).filter(t=>t.name===e.event),r=this._instance.get_property(re);n.some(t=>!t.properties||0===t.properties.length||ol(t.properties,e.properties,r))&&(i.activateTrigger(s,t),this.updateActiveTriggers(t),this._onTriggerActivated(s))},t)}catch(e){al.error("Could not activate event trigger for trigger groups",e)}}),this._removeEventTriggerCaptureHook}makeSamplingDecisions(e){for(const i of this._triggerGroupMatchers){var t;const s=i.group,n=s.id,r=s.sampleRate,o=G+n,a=this._instance.get_property(o);let l=null,c=!1,u=!1,d=!1;if(kt(a)){const t=a.sessionId,i=a.sampleRate,s=a.sampled;c="string"==typeof t&&t!==e,u=Pt(i)&&i!==r,l=t===e&&Pt(i)&&i===r&&Ft(s)?s:null}else l=a===e||null,c="string"==typeof a&&a!==e,d=a===e;const h=c||u||d||!Ft(l),p=h?Ha(e+n,r):l;h&&this._tryAddCustomEvent("triggerGroupSamplingDecisionMade",{group_id:n,group_name:s.name,sampleRate:r,isSampled:p}),this._triggerGroupSamplingResults.set(n,p),null===(t=this._instance.persistence)||void 0===t||t.register({[o]:{sessionId:e,sampleRate:r,sampled:p}})}this.updateActiveTriggers(e)}ensureSamplingDecision(e){}onFlushComplete(){this._hasCompletedInitialFlush=!0}clearConditionalRecordingPersistence(){var e,t,i;null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._instance.persistence)||void 0===t||t.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const e of this._triggerGroupMatchers){var s,n,r;const t=e.group.id;null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_event_trigger_"+t),null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_url_trigger_"+t),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+t)}}updateActiveTriggers(e){const t=[];for(const i of this._triggerGroupMatchers){const s=i.group,n=s.id,r="trigger_activated"===i.triggerStatus(e),o=!0===this._triggerGroupSamplingResults.get(n);r&&t.push({id:n,name:s.name,matched:!0,sampled:o})}this._instance.register_for_session({[Ne]:t})}hasPendingTriggers(e){for(const 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)||void 0===e||e.call(this),this._removeEventTriggerCaptureHook=void 0,this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear(),this._urlTriggerMatching.stop()}_checkGroupLevelProperties(e,t){const i=e.group.conditions.properties;return!i||0===i.length||ol(i,t,this._instance.get_property(re))}_setupTriggerGroups(e){this._triggerGroupMatchers.forEach(e=>e.stop()),this._triggerGroupMatchers=[],this._triggerGroupSamplingResults.clear();for(const t of e){const e=new wo(this._instance,t,(e,i)=>{this._reportStarted("linked_flag_matched",{flag:e,variant:i,group_id:t.id,group_name:t.name}),this._onTriggerActivated()});this._triggerGroupMatchers.push(e)}}};const hl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],pl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...hl],_l="<masked>",gl=["li_fat_id"];function fl(e,t,i){if(!s)return{};const n=t?[...hl,...i||[]]:[],r=vl(Yn(s.URL,n,_l),e),o=function(){const e={};return On(gl,function(t){const i=da(t);e[t]=i||null}),e}();return $n(o,r)}function vl(e,t){const i=pl.concat(t||[]),s={};return On(i,function(t){const i=Zn(e,t);s[t]=i||null}),s}function ml(e){const 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),i="yahoo"!=t?"q":"p",n={};if(!It(t)){n.$search_engine=t;const e=s?Zn(s.referrer,i):"";e.length&&(n.ph_keyword=e)}return n}function yl(){return navigator.language||navigator.userLanguage}function bl(){const e=yl();return"string"==typeof e?e.split("-")[0]:void 0}const Sl="$direct";function wl(){return(null==s?void 0:s.referrer)||Sl}function kl(e,t,i=!1){const s=e?[...hl,...t||[]]:[],r=i?ss(null==n?void 0:n.href):null==n?void 0:n.href,o=null==r?void 0:r.substring(0,1e3);return{r:wl().substring(0,1e3),u:o?Yn(o,s,_l):void 0}}function Cl(e,t=!1){var i;const{r:s,u:n}=e,r=t?ss(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Sl?Sl:null===(i=Qn(s))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const e=Qn(r);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname;const t=vl(r);$n(o,t)}if(s){const e=ml(s);$n(o,e)}return o}function El(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function xl(){try{return(new Date).getTimezoneOffset()}catch(e){return}}const Tl=1e5,Il=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Rl=[],Pl=()=>!1,Ml="@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(" "),Fl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Ll="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(" "),Al="Accommodation AdministrativeArea Country Place State".split(" "),Ol={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:Fl,publisher:Ll},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Rl},Offer:{seller:Ll},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:Ll,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Ll,areaServed:Al,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Rl}},$l=[["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(" "),Ol.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Ol.Event],[Ll,Ol.Organization],[Al,Ol.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Ol.Product]];function Dl(e,t){return yt.call(e,t)?e[t]:void 0}function Nl(e){const t=typeof e;return It(e)||"string"===t||"number"===t||"boolean"===t}function Bl(e,t){return t&&function(e){return xt(e)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(e.trim())}(e)?t(e.trim())||void 0:e}function ql(e,t){return St(e)&&e.every(Nl)?e.map(e=>Bl(e,t)).filter(e=>!Et(e)):Nl(e)?Bl(e,t):void 0}function Hl(e,t){if("string"!=typeof e)return;const i=e.trim(),s=i.indexOf("#"),n=0>s?i:i.slice(s+1);if(!(!n||0>s&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return t(n)?n:void 0}catch(e){return}}function Ul(e){if(yt.call(Ol,e))return Ol[e];for(const[t,i]of $l)if(t.includes(e))return i}function Wl(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0})}function zl(e,t,i,s){if(St(e)){const n=e.map(e=>zl(e,t,i,s)).filter(e=>!Et(e));return n.length?n:void 0}return jl(e,t,i,s)||void 0}function jl(e,t,i,s){if(!kt(e)||!function(e){return e.remainingNodes?(e.remainingNodes--,!0):(e.exceeded=!0,!1)}(i))return null;const n=Dl(e,"@type"),r=function(e){const t=new Set,i="string"==typeof e?[e]:St(e)?e:[],s=[];for(const e of i){if("string"!=typeof e)continue;const i=e.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&Il.test(i)&&!t.has(i)&&(t.add(i),s.push(i),20===s.length))break}return s}(n),o=r.filter(e=>!!Ul(e)&&(!s||!s.length||s.includes(e))),a={};for(const s of Ml){const o="@type"===s?r.length?"string"==typeof n?r[0]:r:void 0:"@id"===s?Hl(Dl(e,s),t):ql(Dl(e,s),i.maskUrl);Et(o)||Wl(a,s,o)}for(const s of o){const n=Ul(s);for(const s of Object.keys(n)){const r=Dl(e,s),o=n[s];if(!0===o){const e=ql(r,i.maskUrl);Et(e)||Wl(a,s,e)}else{const e=zl(r,t,i,o);Et(e)||Wl(a,s,e)}}}const l=zl(Dl(e,"@graph"),t,i);return Et(l)||Wl(a,"@graph",l),Object.keys(a).length?a:null}function Vl(e,t,i){if(!kt(e))return null;const s=Dl(e,"@context");if("string"!=typeof s||!/^https?:\/\/schema\.org\/?$/.test(s))return null;const n=jl(e,t,i);return n?at({"@context":"https://schema.org"},n):null}function Gl(e){var t;return"SCRIPT"===e.nodeName&&"application/ld+json"===(null===(t=e.getAttribute("type"))||void 0===t?void 0:t.trim().toLowerCase())}function Ql(e,t,i){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!!i&&e.matches(i)}catch(e){return!1}}function Kl(e,t,i){for(let s=e;s;){if(Ql(s,t,i))return!0;const e=s.parentNode;s=s.parentElement||(e&&e.nodeType===e.DOCUMENT_FRAGMENT_NODE?e.host:null)}return!1}function Zl(e){return Gl(e)?[e]:e.nodeType!==e.ELEMENT_NODE?[]:Array.from(e.querySelectorAll("script")).filter(Gl)}function Yl(e){return Et(e)?void 0:Math.round(e)}function Jl(e){return kt(e)?e.network_timing:e}const Xl=Ln("[SessionRecording]"),ec=[1,2,3,4,5,6,7,12],tc=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function ic(){var e;return null==h||null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.rrweb}function sc(){var e;return null===(e=ic())||void 0===e?void 0:e.record}function nc(e){try{return JSON.stringify(e)}catch(t){return JSON.stringify(e,Eo())}}function rc(e){return ca(aa(la(nc(e))),!0)}function oc(e){return ac.apply(this,arguments)}function ac(){return(ac=st(function*(e){const t=yield an(nc(e),Ba.DEBUG,{rethrow:!0});return ca(new Uint8Array(yield t.arrayBuffer()),!0)})).apply(this,arguments)}let lc,cc;const uc="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let dc=!1;function hc(e){var t;return St(e)&&0===e.length?(lc=null!==(t=lc)&&void 0!==t?t:rc([]),lc):rc(e)}function pc(e){return _c.apply(this,arguments)}function _c(){return(_c=st(function*(e){var t;return St(e)&&0===e.length?lc||(cc=null!==(t=cc)&&void 0!==t?t:oc([]).then(e=>(lc=e,e)).catch(e=>{throw lc=void 0,cc=void 0,e}),cc):oc(e)})).apply(this,arguments)}function gc(e){return uc&&!dc&&function(e){return 2===e.type||3===e.type&&(0===e.data.source||8===e.data.source)}(e)}function fc(e){return{event:e,size:To(e)}}function vc(e,t){return at(at({},e),{},{data:t,cv:"2024-10"})}function mc(e,t){return at(at({},e),{},{cv:"2024-10",data:at(at({},e.data),t)})}function yc(e){try{if(2===e.type)return fc(vc(e,rc(e.data)));if(3===e.type&&0===e.data.source)return fc(mc(e,{texts:hc(e.data.texts),attributes:hc(e.data.attributes),removes:hc(e.data.removes),adds:hc(e.data.adds)}));if(3===e.type&&8===e.data.source)return fc(mc(e,{adds:e.data.adds?rc(e.data.adds):void 0,removes:e.data.removes?rc(e.data.removes):void 0}))}catch(e){Xl.error("could not compress event - will use uncompressed event",e)}return{event:e,size:xo(e)}}function bc(){return bc=st(function*(e){try{if(2===e.type)return fc(vc(e,yield oc(e.data)));if(3===e.type&&0===e.data.source){const[t,i,s,n]=yield Promise.all([pc(e.data.texts),pc(e.data.attributes),pc(e.data.removes),pc(e.data.adds)]);return fc(mc(e,{texts:t,attributes:i,removes:s,adds:n}))}if(3===e.type&&8===e.data.source){const[t,i]=yield Promise.all([e.data.adds?oc(e.data.adds):void 0,e.data.removes?oc(e.data.removes):void 0]);return fc(mc(e,{adds:t,removes:i}))}}catch(t){return tn(t)&&(dc=!0),Xl.error("could not compress event asynchronously - trying synchronous compression",t),yc(e)}return{event:e,size:xo(e)}}),bc.apply(this,arguments)}function Sc(e,t){return 5===e.type&&e.data.tag===t}function wc(e){return Sc(e,"sessionIdle")}function kc(e){return Sc(e,"$session_ending")}function Cc(e){return Sc(e,"$session_starting")}var Ec=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 cl(this._instance.get_property(H),this.sessionId)}get _sampleRate(){var e;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.sampleRate;return Pt(t)?t:null}get _minimumDuration(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?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,i)=>{var s,n,r,o;if(!i)return;if(e===this._sessionId&&t===this._windowId)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this._sessionId,c=this._windowId;var u;if(a&&this._tryAddCustomEvent("$session_ending",{currentSessionId:l,currentWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp,flushed_size:null===(u=this._flushedSizeTracker)||void 0===u?void 0:u.currentTrackedSize(l)}),null===(s=this._instance.persistence)||void 0===s||s.unregister("$debug_first_full_snapshot_timestamp"),this._maxDepthExceeded=!1,null===(n=ic())||void 0===n||null===(r=n.resetMaxDepthState)||void 0===r||r.call(n),this._tryAddCustomEvent("$session_id_change",{sessionId:e,windowId:t,changeReason:i}),this._clearConditionalRecordingPersistence(),!(!1===this._isIdle&&this.isStarted||this._sessionId===e&&this._windowId===t)){const t=this._sessionId!==e&&!1!==this._isIdle;this._isIdle="unknown",this._restartForSessionIdChange(t)}a&&this._tryAddCustomEvent("$session_starting",{previousSessionId:l,previousWindowId:c,nextSessionId:e,nextWindowId:t,changeReason:i,lastActivityTimestamp:this._lastActivityTimestamp}),null===(o=this._strategy)||void 0===o||o.makeSamplingDecisions(e)},this._isRestartingForSessionIdChange=!1,this._hasPassedMinimumDuration=()=>{var e;return(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[U])===this._sessionId},this._getBufferDuration=()=>{var e,t;if(0===this._buffer.data.length)return null;const i=null===(e=this._buffer.data[0])||void 0===e?void 0:e.timestamp,s=null===(t=this._buffer.data[this._buffer.data.length-1])||void 0===t?void 0:t.timestamp;return Pt(i)&&Pt(s)?s-i:null},this._isBelowMinimumDuration=()=>{var e,t;const i=this._minimumDuration;if(!Pt(i))return!1;if(null===(e=null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.strictMinimumDuration)||void 0===e||!e){const e=this._sessionDuration;return Pt(e)&&e>=0&&i>e}if(this._hasPassedMinimumDuration())return!1;const s=this._getBufferDuration();return!!It(s)||i>s||(null===(n=this._instance.persistence)||void 0===n||n.register({$session_past_minimum_duration:this._sessionId}),!1);var n},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==s?void 0:s.visibilityState)&&("visible"===s.visibilityState&&(this._documentWasEverVisible=!0),this._tryAddCustomEvent("window "+s.visibilityState,{}))},this._documentWasEverVisible=null==t||t;const{sessionId:i,windowId:n,sessionStartTimestamp:r}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=i,this._windowId=n,this._sessionStartTimestamp=r,this._linkedFlagMatching=new bo(this._instance),this._urlTriggerMatching=new yo(this._instance),this._eventTriggerMatching=new So(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||Xl.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 qa(this._instance)}setDocumentWasEverVisible(e){e&&(this._documentWasEverVisible=!0)}get _masking(){var e,t,i,s,n,r,o,a,l;const c=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking,u={maskAllInputs:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.blockSelector,maskAllElementAttributes:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.maskAllElementAttributes},d=null!==(r=null==u?void 0:u.maskAllInputs)&&void 0!==r?r:null==c?void 0:c.maskAllInputs,h=null!==(o=null==u?void 0:u.maskTextSelector)&&void 0!==o?o:null==c?void 0:c.maskTextSelector,p=null!==(a=null==u?void 0:u.blockSelector)&&void 0!==a?a:null==c?void 0:c.blockSelector,_=null!==(l=null==u?void 0:u.maskAllElementAttributes)&&void 0!==l?l:null==c?void 0:c.maskAllElementAttributes;return Et(d)&&Et(h)&&Et(p)&&Et(_)?void 0:{maskAllInputs:null==d||d,maskTextSelector:h,blockSelector:p,maskAllElementAttributes:_}}_warnIfClientMaskingShadowsServer(){var e;if(this._hasWarnedClientMaskingOverride)return;const t=null===(e=this._remoteConfig)||void 0===e?void 0:e.masking;if(Rt(t))return;const i=this._instance.config.session_recording,s=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(e=>{const s=null==i?void 0:i[e],n=t[e];return!Et(s)&&s!==n});0!==s.length&&(this._hasWarnedClientMaskingOverride=!0,Xl.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: '+s.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:t}))}get _canvasResolutionScale(){var e;return Vt(null===(e=this._instance.config.session_recording.canvasCapture)||void 0===e?void 0:e.resolutionScale,.1,1,Ln("canvas recording resolution scale"),1)}get _canvasRecording(){var e,t,i,s,n,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(e=this._remoteConfig)||void 0===e?void 0:e.canvasRecording,c=null!==(t=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==t&&t,u=null!==(s=null!==(n=null==a?void 0:a.canvasFps)&&void 0!==n?n:null==l?void 0:l.fps)&&void 0!==s?s:4;let d=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof d){const e=parseFloat(d);d=isNaN(e)?.4:e}return{enabled:c,fps:Vt(u,0,12,Ln("canvas recording fps"),4),quality:Vt(d,0,1,Ln("canvas recording quality"),.4)}}get _isConsoleLogCaptureEnabled(){var e;const t=!!(null===(e=this._remoteConfig)||void 0===e?void 0:e.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:t}get _networkPayloadCapture(){var e,t,i;const s=null===(e=this._remoteConfig)||void 0===e?void 0:e.networkPayloadCapture,n={recordHeaders:null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==n?void 0:n.recordHeaders)||(null==s?void 0:s.recordHeaders),o=(null==n?void 0:n.recordBody)||(null==s?void 0:s.recordBody),a=Jl(this._instance.config.capture_performance),l=Jl(null==s?void 0:s.capturePerformance),c=!!(Ft(a)?a:l);return r||o||c?{recordHeaders:r,recordBody:o,recordPerformance:c}:void 0}_gatherRRWebPlugins(){var e,t;const i=[],s=null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordConsolePlugin;s&&this._isConsoleLogCaptureEnabled&&i.push(s());const r=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordNetworkPlugin;if(this._networkPayloadCapture&&wt(r))if(!Vn.includes(n.hostname)||this._forceAllowLocalhostNetworkCapture){const e=wt(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((e,t,i)=>{const s={payloadSizeLimitBytes:jr.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...jr.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...jr.payloadHostDenyList]},n=!1!==e.session_recording.recordHeaders&&t.recordHeaders,r=!1!==e.session_recording.recordBody&&t.recordBody,o=!1!==e.capture_performance&&t.recordPerformance,a=(e=>{const t=zr(e);return e=>((null==e?void 0:e.requestBody)&&(e.requestBody=Yr(e.requestBody,e.requestHeaders,t,"Request")),(null==e?void 0:e.responseBody)&&(e.responseBody=Yr(e.responseBody,e.responseHeaders,t,"Response")),e)})(s),l=t=>{return a(((e,t,i)=>{var s;if(null==i?void 0:i(e.name))return;const n=Qn(e.name);let r=0===t.indexOf("http")?null===(s=Qn(t))||void 0===s?void 0:s.pathname:t;"/"===r&&(r="");const o=null==n?void 0:n.pathname.replace(r||"","");return n&&o&&Zr.some(e=>0===o.indexOf(e))?void 0:e})((Kr((s=t).requestHeaders),Kr(s.responseHeaders),s),e.api_host,i));var s},c=wt(e.session_recording.maskNetworkRequestFn);return c&&wt(e.session_recording.maskCapturedNetworkRequestFn)&&Fn.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),c&&(e.session_recording.maskCapturedNetworkRequestFn=t=>{const i=e.session_recording.maskNetworkRequestFn({url:t.name});return!i&&t.isInitial?i:at(at({},t),{},{name:null==i?void 0:i.url})}),s.maskRequestFn=wt(e.session_recording.maskCapturedNetworkRequestFn)?t=>{var i,s;const n=l(t);if(!n)return;const r=n.isInitial?{name:"",entryType:n.entryType,startTime:n.startTime,duration:n.duration,endTime:n.endTime,timeOrigin:n.timeOrigin,timestamp:n.timestamp,isInitial:!0}:void 0,o=null===(i=(s=e.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(s,n);return Rt(o)&&r?(Xr.add(r),r):null!=o?o:void 0}:e=>function(e){if(!Et(e))return e.requestBody=Jr(e.requestBody,"Request"),e.responseBody=Jr(e.responseBody,"Response"),e}(l(e)),at(at(at({},jr),s),{},{recordHeaders:n,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===e.session_recording.streamNetworkBody})})(this._instance.config,this._networkPayloadCapture,e)))}else Xl.info("NetworkCapture not started because we are on localhost.");return i}_stripUrlHash(e){return this._instance.config.disable_capture_url_hashes?ss(e):e}_maskReplayUrl(e,t=!1){const i=t?ss(e):this._stripUrlHash(e),s=this._instance.config.mask_personal_data_properties?[...hl,...this._instance.config.custom_personal_data_properties||[]]:[];return this._maskUrl(Yn(i,s,_l))}_maskUrl(e){const t=this._instance.config.session_recording;if(t.maskCapturedNetworkRequestFn){var i;const s=t.maskCapturedNetworkRequestFn({name:e});return null!==(i=null==s?void 0:s.name)&&void 0!==i?i:null==s?void 0:s.url}if(t.maskNetworkRequestFn){const i=t.maskNetworkRequestFn({url:e});return null==i?void 0:i.url}return 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}):Xl.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(tc(()=>sc().addCustomEvent(e,t)))}_canCaptureJsonLd(){var e;return this._jsonLdCaptureReady&&!0===(null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.captureJsonLd)&&!this._urlTriggerMatching.urlBlocked&&!0!==this._isIdle}_tryAddJsonLdEvent(e){if(!this._canCaptureJsonLd())return!1;try{const t=sc();return!!t&&(t.addCustomEvent("$json_ld",e),this._canCaptureJsonLd())}catch(e){return!1}}_scheduleJsonLdScan(e=!1){Promise.resolve().then(()=>{var t;return null===(t=this._jsonLdCapture)||void 0===t?void 0:t.scan(e)})}_pageViewFallBack(){try{if(this._instance.config.capture_pageview||!e)return;const t=new URL(e.location.href),i=this._maskReplayUrl(t.origin+t.pathname+t.search);this._lastHref!==i&&(this._lastHref=i,this._tryAddCustomEvent("$url_changed",{href:i}))}catch(e){}}_processQueuedEvents(){if(this._queuedRRWebEvents.length){const e=[...this._queuedRRWebEvents];this._queuedRRWebEvents=[],e.forEach(e=>{Date.now()-e.enqueuedAt>2e3||this._tryRRWebMethod(e)})}}_tryTakeFullSnapshot(){return this._tryRRWebMethod(tc(()=>sc().takeFullSnapshot()))}get _fullSnapshotIntervalMillis(){var e,t,i;if((null===(e=this._strategy)||void 0===e?void 0:e.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var s;const e=null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.trigger_pending_buffer_interval_millis;return Pt(e)&&Number.isFinite(e)&&e>=1e3&&36e5>=e?e:6e4}return null!==(t=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==t?t:3e5}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!0===this._isIdle)return;const 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)||void 0===e||e.scan(),clearInterval(this._fullSnapshotTimer),Xl.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e;this._urlTriggerMatching.urlBlocked&&(null===(e=this._jsonLdCapture)||void 0===e||e.scan(),this._urlTriggerMatching.urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Xl.info("recording resumed"))}_activateTrigger(e,t){var i;if("event"===e&&this._releaseHoldAndFlush(),!this._isActivatingTrigger&&(null===(i=this._strategy)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this._isActivatingTrigger=!0;try{var s,n;const i="url"===e?W:z;null===(s=this._instance.persistence)||void 0===s||s.register({[i]:this.sessionId}),null===(n=this._strategy)||void 0===n||n.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(){const e=this._instance.get_property(F);if(!e)return;let t;try{t=kt(e)?e:JSON.parse(e)}catch(e){return void Xl.warn("persisted remote config for session recording is invalid and will be ignored",e)}if(!this.isStarted&&!this._isRestartingForSessionIdChange){var i;const n=null!==(i=t.cache_timestamp)&&void 0!==i?i:Date.now();var s;if(Date.now()-n>36e5)return Xl.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:e}),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_recording_remote_config"))}return t}_checkOverride(e,t,i){this._instance.get_property(e)&&(t(),i())}start(t){var i,n;const r=this._remoteConfig;if(!r)return void Xl.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const e=!1!==this._isIdle&&!this._suppressNextFreshStartHold;this._setFlushHold(e?"no_interaction_since_recording_started":void 0),this._suppressNextFreshStartHold=!1,this._heldEpochShipsOnUnload=e,this._heldBufferOverflowed=!1}this._isStoppingAfterCompression&&(this._invalidateCompressionQueue(),this._clearBuffer());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this._sessionManager.checkAndGetSessionAndWindowId();this._sessionId=o,this._windowId=a,this._sessionStartTimestamp=l,this._restorePendingBuffer(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this._endpoint=null==r?void 0:r.endpoint),this._strategy=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new dl(this._instance,this._urlTriggerMatching,this._reportStarted.bind(this),this._tryAddCustomEvent.bind(this),this._onTriggerActivated.bind(this)):new ul(this._instance,this._urlTriggerMatching,this._eventTriggerMatching,this._linkedFlagMatching,this._reportStarted.bind(this),this._tryTakeFullSnapshot.bind(this),this._onTriggerActivated.bind(this)),this._strategy.onRemoteConfig(r),null===(n=this._removeEventTriggerCaptureHook)||void 0===n||n.call(this),this._removeEventTriggerCaptureHook=this._strategy.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(e,t)=>this._activateTrigger(e,t)),this._checkOverride(O,()=>{this.overrideSampling()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(O)}),this._checkOverride(D,()=>{this.overrideLinkedFlag()},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(D)}),this._checkOverride(B,()=>{this.overrideTrigger("event")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(B)}),this._checkOverride(N,()=>{this.overrideTrigger("url")},()=>{var e;return null===(e=this._instance.persistence)||void 0===e?void 0:e.unregister(N)}),this._strategy.makeSamplingDecisions(this.sessionId),this._startRecorder(),this._rrwebError||(zn(e,"beforeunload",this._onBeforeUnload),zn(e,"pagehide",this._onPageHide),zn(e,"offline",this._onOffline),zn(e,"online",this._onOnline),zn(s,"visibilitychange",this._onVisibilityChange),!this._onSessionIdListener&&wt(this._sessionManager.onSessionId)&&(this._onSessionIdListener=this._sessionManager.onSessionId(this._onSessionIdCallback)),!this._onSessionIdleResetForcedListener&&wt(this._sessionManager.on)?this._onSessionIdleResetForcedListener=this._sessionManager.on("forcedIdleReset",()=>{this._clearConditionalRecordingPersistence(),this._isIdle="unknown",this.stop(),this._forceIdleSessionIdListener=this._sessionManager.onSessionId((e,t,i)=>{var s;null===(s=this._forceIdleSessionIdListener)||void 0===s||s.call(this),this._forceIdleSessionIdListener=void 0,this._onSessionIdCallback(e,t,i)})}):wt(this._sessionManager.on)||Xl.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Rt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this._instance.on("eventCaptured",e=>{try{if("$pageview"===e.event){const t=(null==e?void 0:e.properties.$current_url)?this._maskReplayUrl(e.properties.$current_url):"";if(!t)return;this._tryAddCustomEvent("$pageview",{href:t})}}catch(e){Xl.error("Could not add $pageview to rrweb session",e)}})),"active"===this.status&&this._reportStarted(t||"recording_initialized"))}_teardown(){var t,i,n,r,o,a;null==e||e.removeEventListener("beforeunload",this._onBeforeUnload),null==e||e.removeEventListener("pagehide",this._onPageHide),null==e||e.removeEventListener("offline",this._onOffline),null==e||e.removeEventListener("online",this._onOnline),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),clearInterval(this._fullSnapshotTimer),this._clearFlushBufferTimer(),null===(t=this._removePageViewCaptureHook)||void 0===t||t.call(this),this._removePageViewCaptureHook=void 0,null===(i=this._removeEventTriggerCaptureHook)||void 0===i||i.call(this),this._removeEventTriggerCaptureHook=void 0,null===(n=this._onSessionIdListener)||void 0===n||n.call(this),this._onSessionIdListener=void 0,null===(r=this._onSessionIdleResetForcedListener)||void 0===r||r.call(this),this._onSessionIdleResetForcedListener=void 0,null===(o=this._forceIdleSessionIdListener)||void 0===o||o.call(this),this._forceIdleSessionIdListener=void 0,null===(a=this._strategy)||void 0===a||a.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)||void 0===e||e.stop(),this._queuedRRWebEvents=[],null===(t=this._jsonLdCapture)||void 0===t||t.stop(),this._jsonLdCapture=void 0,this._jsonLdCaptureReady=!1;try{var i;null===(i=this._stopRrweb)||void 0===i||i.call(this)}catch(e){Xl.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;const 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(),Xl.info("stopped"))}).catch(()=>{this._isStoppingAfterCompression=!1,this._releaseHoldAfterStop(),this._teardown(),Xl.info("stopped")}),!0}stop(){if(this._stopRecordingProducers(),this._isRestartingForSessionIdChange)this._drainCompressionQueueSync();else if(this._stopAfterCompressionQueueDrains())return;this._flushBuffer(),this._clearBuffer(),this._releaseHoldAfterStop(),this._teardown(),Xl.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,i;this.stop(),this._slowestFullSnapshot=void 0,this._lastSeenSnapshotCost=void 0,this._throttledMutationsDropped=0,this._oversizedMutationsDropped=0,this._oversizedMutationBytesDropped=0,null===(t=ic())||void 0===t||null===(i=t.resetSnapshotCostState)||void 0===i||i.call(t),this.start("session_id_changed")}finally{this._isRestartingForSessionIdChange=!1}this._setFlushHold(e?"no_interaction_since_session_rotated":void 0),this._heldEpochShipsOnUnload=!1}_setFlushHold(e,{preserveLogDedup:t=!1}={}){if(this._holdFlushUntilInteraction=!Et(e),this._flushHoldReason=e,Et(e))return void(t||(this._lastLoggedFlushHold=void 0));if(this._isRestartingForSessionIdChange)return;const i=`${this.sessionId}:${e}`;i!==this._lastLoggedFlushHold&&(this._lastLoggedFlushHold=i,Xl.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({discardProducerEvents:e=!1}={}){this._holdFlushUntilInteraction=!0,e&&(this._clearBuffer(),this._stopRecordingProducers()),this._clearBuffer(),this._teardown(),this._clearBuffer(),this._releaseHoldAfterStop(),Xl.info("discarded")}_captureProcessedEvent(e,t,i,s,n){const r={$snapshot_bytes:i,$snapshot_data:t,$session_id:s,$window_id:n};"disabled"!==this.status?(this._ensureFullSnapshotForSession(e,s),this._captureSnapshotBuffered(r)):this._clearBuffer()}_safeTrackFullSnapshotCost(){try{this._trackFullSnapshotCost()}catch(e){this._snapshotCostErrorLogged||(this._snapshotCostErrorLogged=!0,Xl.error("could not track full snapshot cost",e))}}_trackFullSnapshotCost(){var e,t;const i=null===(e=ic())||void 0===e||null===(t=e.getLastSnapshotCost)||void 0===t?void 0:t.call(e);i&&i!==this._lastSeenSnapshotCost&&(this._lastSeenSnapshotCost=i,this._slowestFullSnapshot&&this._slowestFullSnapshot.durationMs>=i.durationMs||(this._slowestFullSnapshot=i),500>i.durationMs||Xl.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}_ensureFullSnapshotForSession(e,t){2!==e.type?3===e.type&&(Et(this._lastFullSnapshotSessionId)||this._lastFullSnapshotSessionId===t||this._fullSnapshotHealAttemptedFor===t||(this._fullSnapshotHealAttemptedFor=t,Xl.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,i){e.processed||e.generation!==this._compressionQueueGeneration||(e.processed=!0,this._captureProcessedEvent(e.event,t,i,e.targetSessionId,e.targetWindowId))}_processQueuedCompressionEventSync(e){try{let t=e.event,i=xo(e.event);if(e.compressionEnabled)try{({event:t,size:i}=yc(e.event))}catch(e){Xl.error("could not process queued compression event - will use uncompressed event",e)}try{this._captureQueuedCompressionEvent(e,t,i)}catch(e){Xl.error("could not capture queued compression event",e)}}finally{this._finishQueuedCompressionEvent(e)}}_drainCompressionQueueSync(){[...this._pendingCompressionEvents].forEach(e=>{this._processQueuedCompressionEventSync(e)})}_enqueueCompression(e,t,i,s){var n=this;const r={event:e,compressionEnabled:t,targetSessionId:i,targetWindowId:s,generation:this._compressionQueueGeneration,processed:!1,counted:!0};this._pendingCompressionEvents.push(r),this._queuedCompressionEvents+=1;const o=(a=st(function*(){try{if(r.processed)return;let i,s;try{const n=t?gc(e)?yield function(e){return bc.apply(this,arguments)}(e):yc(e):{event:e,size:xo(e)};i=n.event,s=n.size}catch(t){Xl.error("could not process queued compression event - will use uncompressed event",t),i=e,s=xo(e)}n._captureQueuedCompressionEvent(r,i,s)}finally{n._finishQueuedCompressionEvent(r)}}),function(){return a.apply(this,arguments)});var a;this._compressionQueue=this._compressionQueue?this._compressionQueue.catch(()=>{}).then(o):o()}onRRwebEmit(t){var i,s,n,r,o,a,l,c,u,d,h,p,_;if(!this._instance.sessionManager)return;if(this._processQueuedEvents(),!t||!kt(t))return;if(4===t.type){const e=this._maskReplayUrl(t.data.href);if(this._lastHref=e,!e)return;t.data.href=e}else this._pageViewFallBack();if(null===(i=this._strategy)||void 0===i||i.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}(t))return;2===t.type&&((null===(d=ic())||void 0===d||null===(h=d.wasMaxDepthReached)||void 0===h?void 0:h.call(d))&&(this._maxDepthExceeded=!0),this._safeTrackFullSnapshotCost(),Promise.resolve().then(()=>this._safeTrackFullSnapshotCost()),this._scheduleFullSnapshot(),null===(p=this._mutationThrottler)||void 0===p||p.reset(),null===(_=this._instance.persistence)||void 0===_||_.register_once({$debug_first_full_snapshot_timestamp:t.timestamp},void 0));const g=2===t.type&&(null===(s=this._strategy)||void 0===s?void 0:s.hasPendingTriggers(this.sessionId));g&&this._clearBufferBeforeMostRecentMeta();const f=this._mutationThrottler?this._mutationThrottler.throttleMutations(t):t;if(!f)return void(!0===this._isIdle&&this._eventsDroppedWhileIdle++);const v=function(e){const t=e;if(t&&kt(t)&&6===t.type&&kt(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]"));const i=[];for(let e=0;t.data.payload.payload.length>e;e++)i.push(t.data.payload.payload[e]&&t.data.payload.payload[e].length>2e3?t.data.payload.payload[e].slice(0,2e3)+"...[truncated]":t.data.payload.payload[e]);return t.data.payload.payload=i,e}return e}(f),m=function(e){return kc(e)?e.data.payload:null}(v),y=function(e){return Cc(e)?e.data.payload:null}(v),b=function(e){return wc(e)?e.data.payload:null}(v);m||y?(null==m?void 0:m.lastActivityTimestamp)&&(v.timestamp=m.lastActivityTimestamp):(null==b?void 0:b.sessionId)||this._updateWindowAndSessionIds(v),2===t.type&&(this._fullSnapshotTimestamps.push([this._sessionId,t.timestamp]),this._fullSnapshotTimestamps.length>6&&(this._fullSnapshotTimestamps=this._fullSnapshotTimestamps.slice(-6)));const S=null!==(n=null!==(r=null!==(o=null==m?void 0:m.currentSessionId)&&void 0!==o?o:null==y?void 0:y.nextSessionId)&&void 0!==r?r:null==b?void 0:b.sessionId)&&void 0!==n?n:this._sessionId,w=null!==(a=null!==(l=null!==(c=null==m?void 0:m.currentWindowId)&&void 0!==c?c:null==y?void 0:y.nextWindowId)&&void 0!==l?l:null==b?void 0:b.windowId)&&void 0!==a?a:this._windowId;if(!0===this._isIdle&&!function(e){return wc(e)||kc(e)||Cc(e)}(v))return void(function(e){return 2===e.type||4===e.type||3===e.type&&9!==e.data.source}(v)&&this._eventsDroppedWhileIdle++);2===v.type&&(this._eventsDroppedWhileIdle=0),b&&(v.timestamp=b.lastActivityTimestamp+b.threshold);const k=this._jsonLdCaptureReady;this._jsonLdCaptureReady=!0,g?this._scheduleJsonLdScan(!0):k||this._scheduleJsonLdScan();const C=null===(u=this._instance.config.session_recording.compress_events)||void 0===u||u;if(5===v.type&&"$json_ld"===v.data.tag){let t;try{t=e?this._maskReplayUrl(e.location.href):void 0}catch(e){}v.data.href=t}if(this._queuedCompressionEvents>0||C&&gc(v))return void this._enqueueCompression(v,C,S,w);const{event:E,size:x}=C?yc(v):{event:v,size:xo(v)};this._captureProcessedEvent(v,E,x,S,w)}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}):eo}log(e,t="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.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)||void 0===e||e.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this._tryTakeFullSnapshot(),this._releaseHoldAndFlush(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e),this._releaseHoldAndFlush()}_currentMaskedHostname(){try{var t;const i=null==e||null===(t=e.location)||void 0===t?void 0:t.href;if(!i)return;const s=this._maskReplayUrl(i);if(!s)return;return new URL(s).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)&&!kc(e)&&!Cc(e))}_describePendingTriggerConditions(){var e,t;return null!==(e=null===(t=this._strategy)||void 0===t?void 0:t.getPendingTriggerConditions(this.sessionId))&&void 0!==e?e:[]}_maybeLogBufferingReason(e){if("buffering"!==e)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Be]:[]}),void(this._lastLoggedBufferingReason=void 0);const t=this._describePendingTriggerConditions();if(0===t.length)return Et(this._lastLoggedBufferingReason)||this._instance.register_for_session({[Be]:[]}),void(this._lastLoggedBufferingReason=void 0);const i=t.join(", "),s=`${this.sessionId}:${i}`;s!==this._lastLoggedBufferingReason&&(this._lastLoggedBufferingReason=s,this._instance.register_for_session({[Be]:t}),Xl.info(`buffering: ${i}`))}_canParkPendingBuffer(){var e;return"memory"!==this._instance.config.persistence&&!0!==(null===(e=this._instance.persistence)||void 0===e?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())return;this._pendingBufferRestored=!0;const e=Na._parse(this._pendingBufferStorageKey);Na._remove(this._pendingBufferStorageKey),kt(e)&&St(e.data)&&0!==e.data.length&&St(e.sizes)&&e.sizes.length===e.data.length&&Pt(e.size)&&e.sessionId===this._sessionId&&e.windowId===this._windowId&&(this._buffer.data.length>0||(this._buffer=e))}_flushBuffer(e=!1){var t;if(this._clearFlushBufferTimer(),this._holdFlushUntilInteraction)return this._buffer;if(this._wouldOpenRecordingWithMarkersOnly())return this._buffer.size>943718.4?this._clearBuffer():(e&&this._parkBufferForNextPage(),this._buffer);const i=this._buffer;null===(t=this._strategy)||void 0===t||t.ensureSamplingDecision(this.sessionId);const s=this._isBelowMinimumDuration(),n=this.status;if(this._maybeLogBufferingReason(n),"buffering"===n||"paused"===n||"disabled"===n||s)return!e||"active"!==n&&"sampled"!==n||this._parkBufferForNextPage(),this._scheduleFlushBuffer(),this._buffer;if(this._buffer!==i)return this._buffer;if(i.data.length>0){var r;const e=this._currentMaskedHostname();Io(i).forEach(t=>{try{var i;null===(i=this._flushedSizeTracker)||void 0===i||i.trackSize(t.sessionId,t.size),this._captureSnapshot({$snapshot_bytes:t.size,$snapshot_data:t.data,$session_id:t.sessionId,$window_id:t.windowId,$lib:Ba.LIB_NAME,$lib_version:Ba.LIB_VERSION,$snapshot_host:e})}catch(e){Xl.warn("could not capture snapshot chunk - skipping it",e)}}),Et(this._lastParkedBufferSize)||(Na._remove(this._pendingBufferStorageKey),this._lastParkedBufferSize=void 0),null===(r=this._strategy)||void 0===r||r.onFlushComplete()}return this._clearBuffer()}_captureSnapshotBuffered(e){var t;const i=2+((null===(t=this._buffer)||void 0===t?void 0:t.data.length)||0),s=e.$session_id,n=this._buffer.sessionId!==s;if(n||!0!==this._isIdle&&!this._holdFlushUntilInteraction&&this._buffer.size+e.$snapshot_bytes+i>943718.4){const t=this._sessionId;if(this._buffer=this._flushBuffer(),this._sessionId!==t)return;n&&this._buffer.data.length>0&&(this._buffer=this._clearBuffer()),this._buffer.sessionId=s,this._buffer.windowId=e.$window_id}this._holdFlushUntilInteraction&&(this._heldBufferOverflowed||this._buffer.size+e.$snapshot_bytes+i>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;const i=null===(e=this._buffer)||void 0===e?void 0:e.data[(null===(t=this._buffer)||void 0===t?void 0:t.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}_clearBufferBeforeMostRecentMeta(){if(!this._buffer||0===this._buffer.data.length)return this._clearBuffer();let e=-1;for(let 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({[je]:e}),Xl.info(e.replace("_"," "),t),"session_id_changed"!==e&&this._tryAddCustomEvent("$recording_started",at({reason:e},t))}_isInteractiveEvent(e){var t;return 3===e.type&&-1!==ec.indexOf(null===(t=e.data)||void 0===t?void 0:t.source)}_updateWindowAndSessionIds(e){const 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());const{windowId:i,sessionId:s}=this._sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp);let n=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this._isIdle)){const t="unknown"===this._isIdle;this._isIdle=!1,t||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}const r=this._sessionId!==s,o=this._windowId!==i;if(this._windowId=i,this._sessionId=s,r||o){const e=r&&!1!==this._isIdle;e&&(this._isIdle="unknown"),this._restartForSessionIdChange(e)}else if(t&&this._releaseHoldAndFlush(),n){var a;const e=["sampled","active"].includes(this.status)||(null===(a=this._strategy)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this._eventsDroppedWhileIdle>0&&e&&this._tryTakeFullSnapshot(),this._scheduleJsonLdScan(),this._scheduleFullSnapshot()}}_clearConditionalRecordingPersistence(){var e;null===(e=this._strategy)||void 0===e||e.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var e,t,i,s,n,r,o,a,l,c,u,d;const h=null===(e=ic())||void 0===e||null===(t=e.getDeferredStylesheetStats)||void 0===t?void 0:t.call(e);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===(i=this._flushedSizeTracker)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this._fullSnapshotTimestamps,$snapshot_max_depth_exceeded:this._maxDepthExceeded,$sdk_debug_replay_slowest_full_snapshot_ms:Yl(null===(s=this._slowestFullSnapshot)||void 0===s?void 0:s.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:Yl(null===(n=this._slowestFullSnapshot)||void 0===n?void 0:n.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this._slowestFullSnapshot)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this._slowestFullSnapshot)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this._slowestFullSnapshot)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==h?void 0:h.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==h?void 0:h.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==h?void 0:h.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:Yl(null==h?void 0:h.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:Yl(null==h?void 0:h.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:Yl(null===(l=ic())||void 0===l||null===(c=l.getMutationCost)||void 0===c||null===(c=c.call(l))||void 0===c?void 0:c.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(u=ic())||void 0===u||null===(d=u.getDiscardedDurationSamples)||void 0===d?void 0:d.call(u),$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,[We]:!!this._stopRrweb,[ze]:this._rrwebStartAttempted}}_startRecorder(){var t;if(this._stopRrweb)return;this._rrwebStartAttempted=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},n=this._instance.config.session_recording;for(const[e,t]of Object.entries(n||{}))if(e in i)if("maskInputOptions"===e)i.maskInputOptions=at({password:!0},t);else if("sampling"===e){const e=null!=t?t:{},s={};Et(e.mousemove)||(s.mousemove=e.mousemove),Et(e.mouseInteraction)||(s.mouseInteraction=e.mouseInteraction),i.sampling=s}else i[e]=t;var r,o,a,l;!0===(null==n?void 0:n.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=at(at({},i.slimDOMOptions),{},{script:!0})),this._canvasRecording&&this._canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling=at(at({},i.sampling),{},{canvas:this._canvasRecording.fps}),i.dataURLOptions={type:"image/webp",quality:this._canvasRecording.quality},i.canvasResolutionScale=this._canvasResolutionScale,i.canvasMasking={configured:()=>{var e;return wt(null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn)},regionsFn:e=>{var t;const i=null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn;if(wt(i))try{var s;return null!==(s=i(e))&&void 0!==s?s:null}catch(e){return this._maskRegionsFnFailed||(this._maskRegionsFnFailed=!0,Xl.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",e)),null}}}),this._masking&&(i.maskAllInputs=null===(r=this._masking.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this._masking.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this._masking.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this._masking.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this._hasWarnedExclusiveAttributeMasking||(this._hasWarnedExclusiveAttributeMasking=!0,Xl.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();const c=sc();if(!c)return void Xl.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this._mutationThrottler=null!==(t=this._mutationThrottler)&&void 0!==t?t:new ua(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(e,t)=>{const i=`Too many mutations on node '${e}'. Rate limiting. This could be due to SVG animations or something similar`;Xl.info(i,{node:t}),this.log("[SessionRecording] "+i,"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()});const u=this._gatherRRWebPlugins();if(this._stopRrweb=c(at({emit:e=>{this.onRRwebEmit(e)},plugins:u,errorHandler:(e,t)=>"rrweb"===t&&(this._hasLoggedRecorderCallbackError||(this._hasLoggedRecorderCallbackError=!0,Xl.error("rrweb internal error - recording will continue but may be incomplete",e)),!0)},i)),!this._stopRrweb)return this._rrwebError=!0,void Xl.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this._rrwebError=!1,!0===(null==n?void 0:n.captureJsonLd)&&s&&(null==e?void 0:e.MutationObserver)&&!this._jsonLdCapture&&(this._jsonLdCapture=function(e,t,i){const s=new WeakMap,n=i.getCaptureState||(()=>!0);let r=Tl;const o=function(e,t){const i=t.attributeFilter;return t.maskAllElementAttributes||t.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Pl:i=>{const s=e.getElementById(i);return!!s&&"SCRIPT"!==s.nodeName&&(!t.isRecordedElement||t.isRecordedElement(s))&&!Kl(s,t.blockClass,t.blockSelector)}}(e,i),a=t=>{try{const a=n();if(!r||!1===a||!t.isConnected||t.ownerDocument!==e||function(e,t){return Kl(e,t.blockClass,t.blockSelector)||Kl(e,t.maskTextClass,t.maskTextSelector)}(t,i))return;const l=function(e,t=Pl,i){if(!e||e.length>Tl)return null;try{const s=JSON.parse(e),n={maskUrl:i,remainingNodes:2048,exceeded:!1},r=St(s)?s.map(e=>Vl(e,t,n)):Vl(s,t,n);if(n.exceeded||It(r)||St(r)&&(!r.length||r.some(It)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(e){return null}}(t.text,o,i.maskUrl);if(!l)return void s.delete(t);const[c,u]=l;if(It(a))return void s.set(t,u);if(s.get(t)!==u){if(u.length>r)return void(r=0);i.emit(c)&&(s.set(t,u),r-=u.length)}}catch(e){return}};try{const i=new t(e=>{try{if(!r||!1===n())return;const t=e=>{for(const t of Zl(e))a(t)};for(const i of e)if("childList"===i.type)Gl(i.target)&&a(i.target),i.addedNodes.forEach(t);else if("characterData"===i.type){const e=i.target.parentNode;e&&Gl(e)&&a(e)}else"attributes"===i.type&&Gl(i.target)&&a(i.target)}catch(e){return}});return i.observe(e,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(t=!1){r&&!1!==n()&&Zl(e.documentElement).forEach(e=>{t&&s.delete(e),a(e)})},stop(){return i.disconnect()}}}catch(e){return{scan(){},stop(){}}}}(s,e.MutationObserver,{maskUrl:e=>this._maskReplayUrl(e),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:e=>c.mirror.getId(e)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var e;return!0!==(null===(e=this._instance.config.session_recording)||void 0===e?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=Ft(this._isIdle)?this._isIdle:"unknown",this.tryAddCustomEvent("$remote_config_received",this._remoteConfig),this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:u.map(e=>null==e?void 0:e.name)}),this._tryAddCustomEvent("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(e,t){return this._tryAddCustomEvent(e,t)}};const xc=["type"];var Tc=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}({}),Ic=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}({}),Rc=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}({}),Pc=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}({}),Mc=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}({}),Fc=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}({}),Lc=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 Ac(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 Oc={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},$c={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Dc={};function Nc(e){if(Dc[e])return Dc[e];const t=function(e){var t,i;const s=null===(t=globalThis)||void 0===t||null===(t=t.Zone)||void 0===t||null===(i=t.__symbol__)||void 0===i?void 0:i.call(t,e);return s&&globalThis[s]?globalThis[s]:void 0}(e)||globalThis[e],i=t.prototype,s=e in Oc?Oc[e]:void 0,n=Boolean(s&&s.every(e=>{var t;return Boolean(null===(t=Object.getOwnPropertyDescriptor(i,e))||void 0===t||null===(t=t.get)||void 0===t?void 0:t.toString().includes("[native code]"))})),r=e in $c?$c[e]:void 0,o=Boolean(r&&r.every(e=>{var t;return"function"==typeof i[e]&&(null===(t=i[e])||void 0===t?void 0:t.toString().includes("[native code]"))}));if(n&&o)return Dc[e]=t.prototype,t.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const s=a.contentWindow;if(!s)return t.prototype;const n=s[e].prototype;return n?(function(e){return Ac(e,"AppleWebKit")&&!Ac(e,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",e),l=!0),Dc[e]=n):i}catch(e){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var Bc=Object.create(null);function qc(e,t,i){var s;const n=Bc[e],r=n[i];if(r)return r.call(t);const o=Nc(e),a=null===(s=Object.getOwnPropertyDescriptor(o,i))||void 0===s?void 0:s.get;return a?(n[i]=a,a.call(t)):t[i]}Bc.Node=Object.create(null),Bc.ShadowRoot=Object.create(null),Bc.MutationObserver=Object.create(null),Bc.Element=Object.create(null);var Hc,Uc={};function Wc(e,t,i){const s=`${e}.${String(i)}`;if(Uc[s])return Uc[s].bind(t);const n=Nc(e)[i];return"function"!=typeof n?t[i]:(Uc[s]=n,n.bind(t))}function zc(){return Nc("MutationObserver").constructor}function jc(e,t,i){try{if(!(t in e))return()=>{};const s=e[t],n={next:s},r=i(function(...e){return n.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=n.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let s=e[t],o=i(s);for(;o;){if(o.next===r)return void(o.next=n.next);s=o.next,o=i(s)}}}catch(e){return()=>{}}}var Vc={childNodes:e=>qc("Node",e,"childNodes"),parentNode:e=>qc("Node",e,"parentNode"),parentElement:e=>qc("Node",e,"parentElement"),textContent:e=>qc("Node",e,"textContent"),isConnected(e){if(void 0===Hc){var t;const e=null===(t=Object.getOwnPropertyDescriptor(Nc("Node"),"isConnected"))||void 0===t?void 0:t.get;Hc=(null==e?void 0:e.toString().includes("[native code]"))?e:null}return null==Hc?void 0:Hc.call(e)},contains:(e,t)=>Wc("Node",e,"contains")(t),getRootNode:e=>Wc("Node",e,"getRootNode")(),host:e=>e&&"host"in e?qc("ShadowRoot",e,"host"):null,styleSheets:e=>e.styleSheets,shadowRoot:e=>e&&"shadowRoot"in e?qc("Element",e,"shadowRoot"):null,querySelector:(e,t)=>Wc("Element",e,"querySelector")(t),querySelectorAll:(e,t)=>Wc("Element",e,"querySelectorAll")(t),mutationObserver:zc,patch:jc};function Gc(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(e){}return Date.now()}var Qc=0;function Kc(){Qc+=1}function Zc(){return Qc}function Yc(e,t){return(t!==Qc||e>6e4)&&!0}var Jc=0,Xc=0,eu=0,tu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},iu=null,su=null,nu=[],ru=0,ou=0,au={slowestBatchMs:0},lu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function cu(e){(Jc+=1)>1||(tu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},nu=[],ru=0,su=(e=>e&&e>0?e:null)(e),Xc=Gc(),eu=Qc)}function uu(){return 0===Jc?iu||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(Jc-=1)>0?tu:(tu.durationMs=Gc()-Xc,tu.deferredStylesheetCount=ru,lu.deferredCount+=ru,su=null,Yc(tu.durationMs,eu)?tu:iu=tu)}function du(e,t,i){let s=e.length;if(i>=32)return s;for(let n=0;e.length>n;n++){const r=e[n];try{const e=r.cssRules;if(e&&e.length)s+=du(e,t,i+1);else if(t&&r.styleSheet){const e=r.styleSheet;if(!t.has(e)){t.add(e);const n=e.rules||e.cssRules;n&&(s+=du(n,t,i+1))}}}catch(e){}}return s}function hu(e){if(0===Jc)return;const t=du(e,null,0);tu.cssRuleCount+=t,ou>0&&(tu.nonDeferrableCssRuleCount+=t)}function pu(e){ou+=1;try{return e()}finally{ou-=1}}function _u(e){Jc>0&&(tu.stylesheetMs+=e)}function gu(e){if(0===Jc||null===su)return!1;const t=tu.cssRuleCount-tu.nonDeferrableCssRuleCount;return t>=su||t+function(e){try{const t=e&&(e.rules||e.cssRules);if(!t)return 0;const i=new WeakSet;return i.add(e),du(t,i,0)}catch(e){return 0}}(e)>su}function fu(){const e=nu;return nu=[],e}function vu(){lu.failedCount+=1}function mu(e){e>0&&(lu.abandonedCount+=e)}function yu(e){return yu="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},yu(e)}function bu(e,t,i){return(t=function(e){var t=function(e){if("object"!=yu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=yu(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function Su(e){return e.nodeType===e.ELEMENT_NODE}function wu(e){const t=e&&"host"in e&&"mode"in e&&Vc.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Vc.shadowRoot(t)===e)}function ku(e){return"[object ShadowRoot]"==={}.toString.call(e)}function Cu(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 Eu(e){const{cssText:t}=e;if(3>t.split('"').length)return t;const i=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}var xu=0;function Tu(e){const t=0===xu,i=t?Gc():0;xu+=1;try{const t=e.rules||e.cssRules;if(!t)return null;hu(t);let i=e.href;return!i&&e.ownerNode&&(i=e.ownerNode.baseURI),Cu(Array.from(t,e=>Iu(e,i)).join(""))}catch(e){return null}finally{xu-=1,t&&_u(Gc()-i)}}function Iu(e,t){if(Pu(e)){let t;try{t=Tu(e.styleSheet)||Eu(e)}catch(i){t=e.cssText}try{var i;if(t&&(null===(i=e.styleSheet)||void 0===i?void 0:i.href))return Vu(t,e.styleSheet.href)}catch(e){}return t}{let i=e.cssText;return Mu(e)&&e.selectorText.includes(":")&&(i=Ru(i)),t?Vu(i,t):i}}function Ru(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Pu(e){return"styleSheet"in e}function Mu(e){return"selectorText"in e}var Fu=/^-?[A-Za-z_][\w-]*$/,Lu=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Au(e){const t=[];let i=!1,s=null;const n=new Map;function r(e){const n=t.pop();if("group"===n.kind){if(null===e){for(;t.length>0&&"group"===t[t.length-1].kind;)t.pop();return void r(null)}const i=t[t.length-1];return i.parts.push(e),void(i.index+=1)}if(!n.importRule)return i=!0,void(s=e);o(t[t.length-1],n.importRule,e)}function o(e,t,i){try{let n;try{n=i||Eu(t)}catch(e){n=t.cssText}try{var s;n&&(null===(s=t.styleSheet)||void 0===s?void 0:s.href)&&(n=Vu(n,t.styleSheet.href))}catch(e){}n&&e.parts.push(n),e.index+=1}catch(e){r(null)}}function a(e){const i=e.rules[e.index];if("sheet"===e.kind&&Pu(i)){const s=n.get(i);return null===s?(e.parts.push(i.cssText),void(e.index+=1)):s?void t.push({kind:"sheet",sheet:s.sheet,rules:s.rules,sheetHref:s.sheetHref,index:0,parts:[],importRule:i}):void o(e,i,null)}if(function(e,i){try{const s=function(e){const 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(Mu(e)){if("number"==typeof t.type&&1!==t.type)return null;const i=t.style?t.style.cssText:"";return`${e.selectorText} {${i?" "+i:""}`}if("containerName"in t)return"string"!=typeof t.containerQuery||t.containerName&&!Fu.test(t.containerName)?null:`@container ${t.containerName?`${t.containerName} `:""}${t.containerQuery} {`;if("string"==typeof t.conditionText){let s="";try{var i;s=(null===(i=e.constructor)||void 0===i?void 0:i.name)||""}catch(e){return null}return""===s||"Object"===s||"CSSSupportsRule"===s?`@supports ${t.conditionText} {`:null}return"string"==typeof t.name?"keyText"in t.cssRules[0]?Fu.test(t.name)?`@keyframes ${t.name} {`:null:""===t.name?"@layer {":Lu.test(t.name)?`@layer ${t.name} {`:null:null}(e);if(null===s)return!1;const n=i.sheetHref;return t.push({kind:"group",rules:Array.from(e.cssRules),sheetHref:n,index:0,parts:[],prelude:n?Vu(s,n):s,fixColons:"sheet"===i.kind&&Mu(e)&&e.selectorText.includes(":")}),!0}catch(e){return!1}}(i,e))return;let s=i.cssText;"sheet"===e.kind&&Mu(i)&&i.selectorText.includes(":")&&(s=Ru(s)),e.parts.push(e.sheetHref?Vu(s,e.sheetHref):s),e.index+=1}return function(e){try{const i=e.rules||e.cssRules;if(!i)return!1;hu(i);let s=e.href;!s&&e.ownerNode&&(s=e.ownerNode.baseURI);const r=Array.from(i);return t.push({kind:"sheet",sheet:e,rules:r,sheetHref:s,index:0,parts:[],importRule:null}),function(e,t){const i=[{sheet:t,rules:e,index:0}];for(;i.length>0;){const e=i[i.length-1];if(e.index>=e.rules.length){i.pop();continue}const t=e.rules[e.index];if(e.index+=1,!Pu(t)||n.has(t))continue;let s=null;try{s=t.styleSheet}catch(e){n.set(t,null);continue}if(s&&!i.some(e=>e.sheet===s))try{const e=s.rules||s.cssRules;if(!e)continue;hu(e);let r=s.href;!r&&s.ownerNode&&(r=s.ownerNode.baseURI);const o=Array.from(e);n.set(t,{sheet:s,rules:o,sheetHref:r}),i.push({sheet:s,rules:o,index:0})}catch(e){}}}(r,e),!0}catch(e){return!1}}(e)||(i=!0),{advance(e){if(i)return!0;const n=Gc();let o=e>0?e:1;try{for(;!i&&o>0;){const e=t[t.length-1];if(e.index>=e.rules.length){let t=null;try{if("group"===e.kind){const i=e.prelude+e.parts.join("")+"}";t=e.fixColons?Ru(i):i}else t=Cu(e.parts.join(""))}catch(e){}r(t);continue}o-=1;try{a(e)}catch(e){r(null)}}}catch(e){i=!0,s=null}finally{_u(Gc()-n)}return i},text:()=>i?s:null,remainingRules(){if(i)return 0;let e=0;for(const i of t)e+=i.rules.length-i.index;return e}}}var Ou=class{constructor(){bu(this,"idNodeMap",new Map),bu(this,"nodeMetaMap",new WeakMap)}getId(e){var t,i;return e&&null!==(t=null===(i=this.getMeta(e))||void 0===i?void 0:i.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){const t=this.getId(e);if(this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(e=>this.removeNodeFromMap(e)),Su(e)){const t=Vc.shadowRoot(e);t&&this.removeNodeFromMap(t),"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){const i=this.getNode(e);if(i){const e=this.nodeMetaMap.get(i);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function $u({element:e,maskInputOptions:t,tagName:i,type:s,value:n,maskInputFn:r}){let o=n||"";const a=s&&Du(s);return(t[i.toLowerCase()]||a&&t[a])&&(o=r?r(o,e):"*".repeat(o.length)),o}function Du(e){return e.toLowerCase()}var Nu=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 Bu({element:e,name:t,value:i,maskAllElementAttributes:s,maskAttributeFn:n,isGenerated:r=!1}){return i?s?r&&Nu.has(Du(t))?i:"*".repeat(i.length):n?n(t,i,e):i:i}var qu="__rrweb_original__";function Hu(e){try{const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Du(t):null}catch(e){return null}}var Uu=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Wu=/^(?:[a-z+]+:)?\/\//i,zu=/^www\..*/i,ju=/^(data:)([^,]*),(.*)/i;function Vu(e,t){return(e||"").replace(Uu,(e,i,s,n,r,o)=>{const a=s||r||o,l=i||n||"";if(!a)return e;if(Wu.test(a)||zu.test(a))return`url(${l}${a}${l})`;if(ju.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${l})`;const c=t.split("/"),u=a.split("/");c.pop();for(const e of u)"."!==e&&(".."===e?c.pop():c.push(e));return`url(${l}${c.join("/")}${l})`})}var Gu,Qu,Ku=new Map,Zu=1,Yu=new RegExp("[^a-z0-9-_:]");function Ju(){return Zu++}var Xu=/^[^ \t\n\r\u000c]+/,ed=/^[, \t\n\r\u000c]+/,td=new WeakMap;function id(e,t){return t&&""!==t.trim()?sd(e,t):t}function sd(e,t){let i=td.get(e);if(i||(i=e.createElement("a"),td.set(e,i)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return i.setAttribute("href",t),i.href}function nd(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 rd(e,t,i,s,n,r){if(!s)return s;if("src"===i||"href"===i&&("use"!==t||"#"!==s[0])){if("link"===t&&n){var o;const e=null===(o=n.sheet)||void 0===o?void 0:o.href;if(e)return e}const i=id(e,s);if(i.startsWith("data:")){if("img"===t&&n){let e=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(e=function(e,t,i,s){if(1e5>t.length)return t;if(!e.complete||0===e.naturalWidth)return t;if(e.naturalWidth>4096||e.naturalHeight>4096)return t;const n=Ku.get(t);if(n&&n.type===i&&n.quality===s)return n.result;try{const n=document.createElement("canvas");n.width=e.naturalWidth,n.height=e.naturalHeight;const r=n.getContext("2d");if(!r)return t;r.drawImage(e,0,0);const o=n.toDataURL(i||"image/webp",null!=s?s:.4),a=t.length>o.length?o:t;if(Ku.size>=10){const e=Ku.keys().next().value;void 0!==e&&Ku.delete(e)}return Ku.set(t,{type:i,quality:s,result:a}),a}catch(e){return t}}(n,i,r.type,r.quality)),nd(e,r)}if("image"===t)return nd(i,r)}return i}if("xlink:href"===i&&"#"!==s[0]){const i=id(e,s);return"image"===t&&i.startsWith("data:")?nd(i,r):i}return"background"!==i||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===i?function(e,t){if(""===t.trim())return t;let i=0;function s(e){let s;const n=e.exec(t.substring(i));return n?(s=n[0],i+=s.length,s):""}const n=[];for(;s(ed),t.length>i;){let r=s(Xu);if(","===r.slice(-1))r=id(e,r.substring(0,r.length-1)),n.push(r);else{let s="";r=id(e,r);let o=!1;for(;;){const e=t.charAt(i);if(""===e){n.push((r+s).trim());break}if(o)")"===e&&(o=!1);else{if(","===e){i+=1,n.push((r+s).trim());break}"("===e&&(o=!0)}s+=e,i+=1}}}return n.join(", ")}(e,s):"style"===i?Vu(s,sd(e)):"object"===t&&"data"===i?id(e,s):s:id(e,s)}function od(e,t,i){return("video"===e||"audio"===e)&&"autoplay"===t}function ad(e,t,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&ad(Vc.parentNode(e),t,i);for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;return!!i&&ad(Vc.parentNode(e),t,i)}function ld(e,t,i,s){let n;if(Su(e)){if(n=e,!Vc.childNodes(n).length)return!1}else{if(null===Vc.parentElement(e))return!1;n=Vc.parentElement(e)}try{if("string"==typeof t){if(s){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(ad(n,t,s))return!0;if(i)if(s){if(n.closest(i))return!0}else if(n.matches(i))return!0}catch(e){}return!1}function cd(e,t,i){const s=e.removeEventListener;"function"==typeof s&&s.call(e,t,i)}var ud=new Map;function dd(e,t){return Array.from(e.styleSheets).find(e=>e.href===t)}function hd(e){return null==e?"":e.toLowerCase()}var pd=!1,_d=!1;function gd(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p=!1,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f={},inlineImages:v=!1,recordCanvas:m=!1,canvasMaskingConfigured:y,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w=5e3,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:T=!1,depth:I=0,maxDepth:R=50}=t;let{needsMask:P}=t,{preserveWhiteSpace:M=!0}=t;if(I>=R)return _d=!0,pd||(pd=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${R}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=ld(e,o,a,void 0===P)),Jc>0&&(tu.nodeCount+=1);const F=function(e,t){const{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,maskAllElementAttributes:d=!1,maskAttributeFn:h,dataURLOptions:p={},inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const i=t.getId(e);return 1===i?void 0:i}(i,s);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Lc.Document,childNodes:[],compatMode:e.compatMode}:{type:Lc.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Lc.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:i,blockClass:s,blockSelector:n,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:c,dataURLOptions:u={},inlineImages:d,recordCanvas:h,canvasMaskingConfigured:p,keepIframeSrcFn:_,newlyAddedElement:g=!1,rootId:f}=t,v=function(e,t,i){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;)if(t.test(e.classList[i]))return!0;if(i)return e.matches(i)}catch(e){}return!1}(e,s,n),m=function(e){if(e instanceof HTMLFormElement)return"form";const t=Du(e.tagName);return Yu.test(t)?"div":t}(e),y=new Set;let b={};const S=e.attributes.length;for(let t=0;S>t;t++){const s=e.attributes[t];od(m,s.name)||(b[s.name]=rd(i,m,Du(s.name),s.value,e,u))}if("link"===m&&r&&!v){let t=e.sheet;if(!t){const s=function(e){return e.href}(e);s&&(t=dd(i,s),!t&&s.includes(".css"))&&(t=dd(i,window.location.origin+"/"+s.replace(window.location.href,"")))}let s=null;t&&(gu(t)?Jc>0&&(nu.push(e),ru+=1):s=Tu(t)),s&&(delete b.rel,delete b.href,b._cssText=s)}if("style"===m&&e.sheet&&!(e.innerText||Vc.textContent(e)||"").trim().length){const t=pu(()=>Tu(e.sheet));t&&(b._cssText=t)}if("input"===m||"textarea"===m||"select"===m){const t=e.value,i=e.checked;"radio"!==b.type&&"checkbox"!==b.type&&"submit"!==b.type&&"button"!==b.type&&t?b.value=$u({element:e,type:Hu(e),tagName:m,value:t,maskInputOptions:o,maskInputFn:a}):i&&(b.checked=i)}if("option"===m&&(e.selected&&!o.select?b.selected=!0:delete b.selected),"dialog"===m&&e.open){try{b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"}catch(e){b.rr_open_mode="modal",b.ph_rr_could_not_detect_modal=!0}y.add("rr_open_mode")}if("canvas"===m&&h&&!(null==p?void 0:p()))if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let i=0;e.width>i;i+=50)for(let s=0;e.height>s;s+=50){const n=t.getImageData;if(new Uint32Array((qu in n?n[qu]:n).call(t,i,s,Math.min(50,e.width-i),Math.min(50,e.height-s)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(b.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),s=i.createElement("canvas");s.width=e.width,s.height=e.height,t!==s.toDataURL(u.type,u.quality)&&(b.rr_dataURL=t)}let w,k=!1;if("img"===m&&d){Gu||(Gu=i.createElement("canvas"),Qu=Gu.getContext("2d"));const t=e,s=t.currentSrc||t.getAttribute("src")||"<unknown-src>",n=t.crossOrigin,r=(t,i)=>k?Bu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c}):i,o=()=>{cd(t,"load",o);try{Gu.width=t.naturalWidth,Gu.height=t.naturalHeight,Qu.drawImage(t,0,0);const e=Gu.toDataURL(u.type,u.quality);b.rr_dataURL=r("rr_dataURL",e)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o));console.warn(`Cannot inline img src=${s}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(n?b.crossOrigin=r("crossOrigin",n):t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if("audio"===m||"video"===m){const t=b;t.rr_mediaState=e.paused?"paused":"played",y.add("rr_mediaState"),t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}if(g||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),v){var C,E,x;const{width:t,height:s,left:n,top:r}=e.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(e);b={class:b.class,rr_width:`${t}px`,rr_height:`${s}px`,rr_left:`${Math.floor(n+((null===(E=i.defaultView)||void 0===E?void 0:E.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(x=i.defaultView)||void 0===x?void 0:x.scrollY)||0))}px`},y.add("rr_width"),y.add("rr_height"),y.add("rr_left"),y.add("rr_top"),o&&(b.rr_position=o.position||"static",y.add("rr_position"),o.transform&&"none"!==o.transform&&(b.rr_transform=o.transform,y.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(b.rr_display=o.display,y.add("rr_display")))}if("iframe"!==m||_(b.src)||(e.contentDocument||(b.rr_src=b.src),delete b.src),l||c)for(const[t,i]of Object.entries(b))"string"!=typeof i&&null!==i||(b[t]=Bu({element:e,name:t,value:i,maskAllElementAttributes:l,maskAttributeFn:c,isGenerated:y.has(t)}));k=!0;try{customElements.get(m)&&(w=!0)}catch(e){}return{type:Lc.Element,tagName:m,attributes:b,childNodes:[],isSVG:(T=e,Boolean("svg"===T.tagName||T.ownerSVGElement)||void 0),needBlock:v,rootId:f,isCustom:w};var T}(e,{doc:i,blockClass:n,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,maskAllElementAttributes:d,maskAttributeFn:h,dataURLOptions:p,inlineImages:_,recordCanvas:g,canvasMaskingConfigured:f,keepIframeSrcFn:v,newlyAddedElement:m,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:i,maskTextFn:s,rootId:n}=t,r=Vc.parentNode(e),o=r&&r.tagName;let a=Vc.textContent(e);const l="STYLE"===o||void 0,c="SCRIPT"===o||void 0;if(l&&a){try{var u;if(e.nextSibling||e.previousSibling);else if(gu(r.sheet));else if(null===(u=r.sheet)||void 0===u?void 0:u.cssRules){const e=Tu(r.sheet);e&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(e)&&(a=e)}}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}a=Vu(a,sd(t.doc))}return c&&(a="SCRIPT_PLACEHOLDER"),!l&&!c&&a&&i&&(a=s?s(a,Vc.parentElement(e)):a.replace(/[\S]/g,"*")),{type:Lc.Text,textContent:a||"",isStyle:l,rootId:n}}(e,{doc:i,needsMask:o,maskTextFn:c,rootId:y});case e.CDATA_SECTION_NODE:return{type:Lc.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Lc.Comment,textContent:Vc.textContent(e)||"",rootId:y};default:return!1}}(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,keepIframeSrcFn:x,newlyAddedElement:T});if(!F)return console.warn(e,"not serialized"),null;let L;L=s.hasNode(e)?s.getId(e):function(e,t){if(t.comment&&e.type===Lc.Comment)return!0;if(e.type===Lc.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;let i;try{i=new URL(e,window.location.href)}catch(e){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(t=null==s?void 0:s[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&&(hd(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===hd(e.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(hd(e.attributes.rel)))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&hd(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(hd(e.attributes.property).match(/^(og|twitter|fb):/)||hd(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===hd(e.attributes.name)))return!0;if(t.headMetaRobots&&["robots","googlebot","bingbot"].includes(hd(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(hd(e.attributes.name))||hd(e.attributes.property).match(/^article:/)||hd(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(hd(e.attributes.name)))return!0}}return!1}(F,g)||!M&&F.type===Lc.Text&&!F.isStyle&&!F.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Ju();const A=Object.assign(F,{id:L});if(s.add(e,A),-2===L)return null;b&&b(e);let O=!l;if(A.type===Lc.Element){O=O&&!A.needBlock,delete A.needBlock;const t=Vc.shadowRoot(e);t&&ku(t)&&(A.isShadowHost=!0)}if((A.type===Lc.Document||A.type===Lc.Element)&&O){g.headWhitespace&&A.type===Lc.Element&&"head"===A.tagName&&(M=!1);const t={doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:x,depth:I+1,maxDepth:R};if(A.type===Lc.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else for(const i of Array.from(Vc.childNodes(e))){const e=gd(i,t);e&&A.childNodes.push(e)}let T=null;if(Su(e)&&(T=Vc.shadowRoot(e)))for(const e of Array.from(Vc.childNodes(T))){const i=gd(e,t);i&&(ku(T)&&(i.isShadow=!0),A.childNodes.push(i))}}const D=Vc.parentNode(e);if(D&&wu(D)&&ku(D)&&(A.isShadow=!0),A.type===Lc.Element&&"iframe"===A.tagName){const t=function(e,t,i){const s=()=>{},n=e.contentWindow;if(!n)return s;let r;try{r=n.document.readyState}catch(e){return s}const o=()=>t();if("complete"!==r){let s=!1,n=null;const r=()=>{s||(s=!0,null!==n&&(clearTimeout(n),n=null),cd(e,"load",a),e.addEventListener("load",o),t())},a=()=>r();return n=setTimeout(r,i),e.addEventListener("load",a),()=>{null!==n&&(clearTimeout(n),n=null),s?cd(e,"load",o):(s=!0,cd(e,"load",a))}}const a="about:blank";let l;try{l=n.location.href}catch(e){return s}if(l!==a||e.src===a||""===e.src){const i=setTimeout(t,0);return e.addEventListener("load",o),()=>{clearTimeout(i),cd(e,"load",o)}}return e.addEventListener("load",o),()=>{cd(e,"load",o)}}(e,()=>{const t=e.contentDocument;if(t&&S){const i=gd(t,{doc:t,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:x,depth:I+1,maxDepth:R});i&&S(e,i)}},w);null==k||k(e,t)}return A.type===Lc.Element&&"link"===A.tagName&&"stylesheet"===A.attributes.rel&&function(t,l,k){if(ud.has(t))return;let T;try{T=t.sheet}catch(e){return}if(T)return;const F=new AbortController;let L=!1;const A=()=>{if(!L){L=!0;try{(()=>{if(C){const t=gd(e,{doc:i,mirror:s,blockClass:n,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:h,maskAllElementAttributes:p,maskAttributeFn:_,slimDOMOptions:g,dataURLOptions:f,inlineImages:v,recordCanvas:m,canvasMaskingConfigured:y,preserveWhiteSpace:M,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:w,onStylesheetLoad:C,stylesheetLoadTimeout:E,keepIframeSrcFn:x,depth:I,maxDepth:R});t&&C(e,t)}})()}finally{ud.delete(t),F.abort()}}},O=setTimeout(A,k);F.signal.addEventListener("abort",()=>clearTimeout(O),{once:!0}),t.addEventListener("load",A,{signal:F.signal,once:!0}),ud.set(t,F)}(e,0,E),A}function fd(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 vd=class e{constructor(...e){bu(this,"parentElement",null),bu(this,"parentNode",null),bu(this,"ownerDocument",void 0),bu(this,"firstChild",null),bu(this,"lastChild",null),bu(this,"previousSibling",null),bu(this,"nextSibling",null),bu(this,"ELEMENT_NODE",1),bu(this,"TEXT_NODE",3),bu(this,"nodeType",void 0),bu(this,"nodeName",void 0),bu(this,"RRNodeType",void 0)}get childNodes(){const e=[];let t=this.firstChild;for(;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 md(e,t,i=document){const s={capture:!0,passive:!0};return i.addEventListener(e,t,s),()=>yd(i,e,t,s)}function yd(e,t,i,s){bd(()=>{const n=e.removeEventListener;"function"==typeof n&&(void 0!==s?n.call(e,t,i,s):n.call(e,t,i))})}function bd(e){try{e()}catch(e){if(!(e instanceof DOMException&&"SecurityError"===e.name))throw e}}function Sd(e){e.forEach(e=>{if("function"==typeof e)try{e()}catch(e){}})}var wd="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.",kd={map:{},getId(){return console.error(wd),-1},getNode(){return console.error(wd),null},removeNodeFromMap(){console.error(wd)},has(){return console.error(wd),!1},reset(){console.error(wd)}};function Cd(e,t,i={}){let s=null,n=0;return function(...r){const o=Date.now();n||!1!==i.leading||(n=o);const a=t-(o-n),l=this;0>=a||a>t?(s&&(clearTimeout(s),s=null),n=o,e.apply(l,r)):s||!1===i.trailing||(s=setTimeout(()=>{n=!1===i.leading?0:Date.now(),s=null,e.apply(l,r)},a))}}function Ed(e,t,i,s,n=window){const r=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,s?i:{set(e){if(setTimeout(()=>{try{i.set.call(this,e)}catch(e){}},0),r&&r.set){if(r.get)try{r.get.call(this)}catch(e){return}r.set.call(this,e)}}}),()=>Ed(e,t,r||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(kd=new Proxy(kd,{get(e,t,i){return"map"===t&&console.error(wd),Reflect.get(e,t,i)}}));var xd=Date.now;function Td(e){var t,i,s,n;const r=e.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(t=Vc.parentElement(r.body))||void 0===t?void 0:t.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(s=Vc.parentElement(r.body))||void 0===s?void 0:s.scrollTop)||(null==r||null===(n=r.body)||void 0===n?void 0:n.scrollTop)||0}}function Id(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Rd(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Pd(e){return e?e.nodeType===e.ELEMENT_NODE?e:Vc.parentElement(e):null}function Md(e,t,i,s){if(!e)return!1;const n=Pd(e);if(!n)return!1;try{if("string"==typeof t){if(n.classList.contains(t))return!0;if(s&&null!==n.closest("."+t))return!0}else if(ad(n,t,s))return!0}catch(e){}if(i){if(n.matches(i))return!0;if(s&&null!==n.closest(i))return!0}return!1}function Fd(e,t,i){return!("TITLE"!==e.tagName||!i.headTitleMutations)||-2===t.getId(e)}function Ld(e,t){if(wu(e))return!1;const i=t.getId(e);if(!t.has(i))return!0;const s=Vc.parentNode(e);return(!s||s.nodeType!==e.DOCUMENT_NODE)&&(!s||Ld(s,t))}function Ad(e){return Boolean(e.changedTouches)}function Od(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function $d(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Dd(e){return!!e&&(e instanceof vd&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Vc.shadowRoot(e)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(xd=()=>(new Date).getTime());var Nd=class{constructor(){bu(this,"id",1),bu(this,"styleIDMap",new WeakMap),bu(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){if(this.has(e))return this.getId(e);let i;return i=void 0===t?this.id++:t,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}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 Bd(e){var t;let i=null;return"getRootNode"in e&&(null===(t=Vc.getRootNode(e))||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Vc.host(Vc.getRootNode(e))&&(i=Vc.host(Vc.getRootNode(e))),i}function qd(e){const t=e.ownerDocument;if(!t)return!1;if(Vc.contains(t,e))return!0;const i=Vc.isConnected(e);return"boolean"==typeof i?i:function(e){const t=e.ownerDocument;if(!t)return!1;const i=function(e){let t,i=e;for(;t=Bd(i);)i=t;return i}(e);return Vc.contains(t,i)}(e)}function Hd(e){return"__ln"in e}var Ud,Wd=class{constructor(){bu(this,"length",0),bu(this,"head",null),bu(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let i=0;e>i;i++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Hd(e.previousSibling)){const i=e.previousSibling.__ln.next;t.next=i,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,i&&(i.previous=t)}else if(e.nextSibling&&Hd(e.nextSibling)&&e.nextSibling.__ln.previous){const 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){const 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--)}},zd=(e,t)=>`${e}@${t}`,jd=class{constructor(){bu(this,"frozen",!1),bu(this,"locked",!1),bu(this,"texts",[]),bu(this,"attributes",[]),bu(this,"attributeMap",new WeakMap),bu(this,"generatedAttributes",new WeakMap),bu(this,"removes",[]),bu(this,"mapRemoves",new Set),bu(this,"movedMap",{}),bu(this,"addedSet",new Set),bu(this,"movedSet",new Set),bu(this,"droppedSet",new Set),bu(this,"removesSubTreeCache",new Set),bu(this,"mutationCb",void 0),bu(this,"blockClass",void 0),bu(this,"blockSelector",void 0),bu(this,"maskTextClass",void 0),bu(this,"maskTextSelector",void 0),bu(this,"inlineStylesheet",void 0),bu(this,"maskInputOptions",void 0),bu(this,"maskTextFn",void 0),bu(this,"maskInputFn",void 0),bu(this,"maskAllElementAttributes",void 0),bu(this,"maskAttributeFn",void 0),bu(this,"keepIframeSrcFn",void 0),bu(this,"recordCanvas",void 0),bu(this,"canvasMaskingConfigured",void 0),bu(this,"inlineImages",void 0),bu(this,"slimDOMOptions",void 0),bu(this,"dataURLOptions",void 0),bu(this,"doc",void 0),bu(this,"mirror",void 0),bu(this,"iframeManager",void 0),bu(this,"stylesheetManager",void 0),bu(this,"shadowDomManager",void 0),bu(this,"canvasManager",void 0),bu(this,"processedNodeManager",void 0),bu(this,"unattachedDoc",void 0),bu(this,"canvasManagerReleased",!1),bu(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),bu(this,"emit",()=>{if(this.frozen||this.locked)return;const e=Gc(),t=Zc();try{this.processBufferedMutations()}finally{i=Gc()-e,s=t,Jc>0||Yc(i,null!=s?s:Qc)||i>au.slowestBatchMs&&(au.slowestBatchMs=i)}var i,s}),bu(this,"processBufferedMutations",()=>{const e=[],t=new Set,i=new Wd,s=e=>{let t=e,i=-2;for(;-2===i;)t=t&&t.nextSibling,i=t&&this.mirror.getId(t);return i};let n;const r=r=>{var o;const a=Vc.parentNode(r);if(!a||!qd(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=wu(a)?this.mirror.getId(Bd(r)):this.mirror.getId(a),c=s(r);if(-1===l||-1===c)return i.addNode(r);null!==(o=n)&&void 0!==o||(n={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=>{Od(e,this.mirror)&&this.iframeManager.addIframe(e),$d(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Dd(e)&&!Md(e,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(Vc.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)}});const u=gd(r,n);u&&(e.push({parentId:l,nextId:c,node:u}),t.add(u.id))};for(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e);for(const e of this.movedSet)Gd(this.removesSubTreeCache,e)&&!this.movedSet.has(Vc.parentNode(e))||r(e);for(const e of this.addedSet)Qd(this.droppedSet,e)||Gd(this.removesSubTreeCache,e)?Qd(this.movedSet,e)?r(e):this.droppedSet.add(e):r(e);let o=null;for(;i.length;){let e=null;if(o){const t=this.mirror.getId(Vc.parentNode(o.value)),i=s(o.value);-1!==t&&-1!==i&&(e=o)}if(!e){let t=i.tail;for(;t;){const i=t;if(t=t.previous,i){const t=this.mirror.getId(Vc.parentNode(i.value));if(-1===s(i.value))continue;if(-1!==t){e=i;break}{const t=Vc.parentNode(i.value);if(t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const s=Vc.host(t);if(-1!==this.mirror.getId(s)){e=i;break}}}}}}if(!e){for(;i.head;)i.removeNode(i.head.value);break}o=e.previous,i.removeNode(e.value),r(e.value)}const a={texts:this.texts.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const t=e.node,i=Vc.parentNode(t);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(t),value:e.value}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),attributes:this.attributes.filter(e=>!this.isBlockedAtEmission(e.node)).map(e=>{const{attributes:t}=e;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof t.style){const i=JSON.stringify(e.styleDiff),s=JSON.stringify(e._unchangedStyles);t.style.length>i.length&&(i+s).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[s,n]of Object.entries(t))if("string"==typeof n||null===n){var i;t[s]=Bu({element:e.node,name:s,value:n,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(e.node))||void 0===i?void 0:i.has(s)})}return{id:this.mirror.getId(e.node),attributes:t}}).filter(e=>!t.has(e.id)).filter(e=>this.mirror.has(e.id)),removes:this.removes,adds:e};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),bu(this,"bufferBelongsToIframe",e=>this.doc===e.contentDocument),bu(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const i=Array.from(Vc.childNodes(e),e=>Vc.textContent(e)||"").join("");t.attributes.value=$u({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Hu(e),value:i,maskInputFn:this.maskInputFn})}),bu(this,"processMutation",e=>{if(!Fd(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Vc.textContent(e.target);Md(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:ld(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Pd(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{var t;const s=e.target,n=e.attributeName,r=null!==(t=e.attributeNamespace)&&void 0!==t?t:null;let o=function(e,t,i){if(!i)return t;const s=e.getAttributeNodeNS(i,t);if(s)return s.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${t}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${t}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===t?t:`xmlns:${t}`;const n=e.lookupPrefix(i);return n?`${n}:${t}`:t}(s,n,r),a=r?s.getAttributeNS(r,n):e.target.getAttribute(n);if("value"===o){const e=s,t=Hu(e);a=$u({element:e,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:t,value:a,maskInputFn:this.maskInputFn})}if(Md(e.target,this.blockClass,this.blockSelector,!1)||a===e.oldValue)return;let l=this.attributeMap.get(e.target);const c="IFRAME"===s.tagName&&"src"===o;if(c&&!this.keepIframeSrcFn(a)&&s.contentDocument)return;if(l||(l={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(l),this.attributeMap.set(e.target,l)),"type"===o&&"INPUT"===s.tagName&&"password"===(e.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!od(s.tagName,o)){var i;const t=rd(this.doc,Du(s.tagName),Du(o),a,s,this.dataURLOptions);if(c&&!this.keepIframeSrcFn(a)&&(o="rr_src"),l.attributes[o]=t,null===(i=this.generatedAttributes.get(e.target))||void 0===i||i.delete(o),"style"===o){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const t=this.unattachedDoc.createElement("span"),i=s.style;e.oldValue&&(t.style.cssText=e.oldValue);for(const e of Array.from(i)){const s=i.getPropertyValue(e),n=i.getPropertyPriority(e);s!==t.style.getPropertyValue(e)||n!==t.style.getPropertyPriority(e)?l.styleDiff[e]=""===n?s:[s,n]:l._unchangedStyles[e]=[s,n]}for(const e of Array.from(t.style))""===i.getPropertyValue(e)&&(l.styleDiff[e]=!1)}else if("open"===o&&"DIALOG"===s.tagName){l.attributes.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal";let t=this.generatedAttributes.get(e.target);t||(t=new Set,this.generatedAttributes.set(e.target,t)),t.add("rr_open_mode")}}break}case"childList":if(Md(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=>{const i=this.mirror.getId(t),s=wu(e.target)?this.mirror.getId(Vc.host(e.target)):this.mirror.getId(e.target);Md(e.target,this.blockClass,this.blockSelector,!1)||Fd(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Vd(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===i||Ld(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[zd(i,s)]?Vd(this.movedSet,t):(this.removes.push({parentId:s,id:i,isShadow:!(!wu(e.target)||!ku(e.target))||void 0}),function(e,t){const i=[e];for(;i.length;){const e=i.pop();t.has(e)||(t.add(e),Vc.childNodes(e).forEach(e=>i.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.add(t))})}}),bu(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(Fd(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let i=null;t&&this.mirror.hasNode(t)&&(i=this.mirror.getId(t)),i&&-1!==i&&(this.movedMap[zd(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!Md(e,this.blockClass,this.blockSelector,!1)){if(e.nodeType===e.TEXT_NODE)return;const t=Vc.childNodes(e);for(let e=0,i=t.length;i>e;e++){const i=t[e];i&&this.genAdds(i)}if(Dd(e)){const t=Vc.childNodes(Vc.shadowRoot(e));for(let i=0,s=t.length;s>i;i++){const s=t[i];s&&(this.processedNodeManager.add(s,this),this.genAdds(s,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(const e of this.mapRemoves)this.mapRemoves.delete(e),this.mirror.removeNodeFromMap(e)}isBlockedAtEmission(e){const t=this.blockClass,i=t&&"string"!=typeof t&&(t.global||t.sticky)?new RegExp(t):null;for(;e;){if(i&&(i.lastIndex=0),Md(e,i||t,this.blockSelector,!0))return!0;const s="getRootNode"in e?Vc.getRootNode(e):null;e=(null==s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?Vc.host(s):null}return!1}};function Vd(e,t){const i=[t];for(;i.length;){const t=i.pop();if(e.delete(t),t.nodeType===t.TEXT_NODE)continue;const s=Vc.childNodes(t);for(let e=0,t=s.length;t>e;e++){const t=s[e];t&&i.push(t)}}}function Gd(e,t,i){return 0!==e.size&&function(e,t){const i=Vc.parentNode(t);return!!i&&e.has(i)}(e,t)}function Qd(e,t){if(0===e.size)return!1;let i=Vc.parentNode(t);for(;i;){if(e.has(i))return!0;i=Vc.parentNode(i)}return!1}function Kd(e){Ud=e}function Zd(){Ud=void 0}var Yd=(e,t="rrweb")=>Ud?(...i)=>{try{return e(...i)}catch(e){if(Ud&&!0===Ud(e,t))return;throw e}}:e,Jd=[];function Xd(e){try{if("composedPath"in e){const 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 eh(e,t){const i=new jd;let s;i.init(e);try{s=new(zc())(Yd(i.processMutations.bind(i)));const n={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return e.attributeFilter&&e.attributeFilter.length>0&&(n.attributeFilter=e.attributeFilter),s.observe(t,n),Jd.push(i),{observer:s,buffer:i}}catch(e){try{null==s||s.disconnect(),i.destroy(),i.reset()}catch(e){}throw e}}function th({scrollCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){const o=new Map,a=r=>{const a=Xd(r);if(!a||Md(a,s,n,!0))return;const l=i.getId(a);let c,u;if(a===t&&t.defaultView){const e=Td(t.defaultView);c=e.left,u=e.top}else c=a.scrollLeft,u=a.scrollTop;const d=`${c},${u}`;o.get(l)!==d&&(o.set(l,d),e({id:l,x:c,y:u}))},l=[md("scroll",Yd(Cd(Yd(e=>a(e)),r.scroll||100)),t)];return"onscrollend"in t&&l.push(md("scrollend",Yd(a),t)),()=>l.forEach(e=>e())}function ih(e,t){for(let i=Jd.length-1;i>=0;i--){const s=Jd[i];if(!s)continue;let n=s.bufferBelongsToIframe(e);!n&&t&&t.has(s.bufferDoc())&&(n=!0),n&&(s.reset(),Jd.splice(i,1))}}var sh=["INPUT","TEXTAREA","SELECT"],nh=new WeakMap;function rh(e){return function e(t,i){if(ch("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||ch("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||ch("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||ch("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const s=Array.from(t.parentRule.cssRules).indexOf(t);return i.unshift(s),e(t.parentRule,i)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);i.unshift(e)}return i}(e,[])}function oh(e,t,i){let s,n;return e?(e.ownerNode?s=t.getId(e.ownerNode):n=i.getId(e),{styleId:n,id:s}):{}}function ah({mirror:e,stylesheetManager:t},i){var s,n;let r=null;r=e.getId("#document"===i.nodeName?i:Vc.host(i));const o="#document"===i.nodeName?null===(s=i.defaultView)||void 0===s?void 0:s.Document:null===(n=i.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n?void 0:n.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&a?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var e;return null===(e=a.get)||void 0===e?void 0:e.call(this)},set(e){let i;try{var s;i=null===(s=a.set)||void 0===s?void 0:s.call(this,e)}catch(e){if(e&&"object"==typeof e&&"NotAllowedError"===e.name)return;throw e}if(null!==r&&-1!==r)try{t.adoptStyleSheets(e,r)}catch(e){}return i}}),Yd(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}function lh(e,t={}){const i=e.doc.defaultView;if(!i)return()=>{};let s,n;!function(e,t){const{mutationCb:i,mousemoveCb:s,mouseInteractionCb:n,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:_}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),s(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),n(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),r(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),o(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),_(...e)}}(e,t);const r=[],o=Yd(()=>{try{if(n)try{n.destroy(),n.reset()}finally{const e=Jd.indexOf(n);-1!==e&&Jd.splice(e,1)}e.shadowDomManager.resetForDoc(e.doc),null==s||s.disconnect()}finally{Sd(r)}});try{if(e.recordDOM){const t=eh(e,e.doc);s=t.observer,n=t.buffer}if(r.push(function({mousemoveCb:e,sampling:t,doc:i,mirror:s}){if(!1===t.mousemove)return()=>{};const n="number"==typeof t.mousemove?t.mousemove:50,r="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let o,a=[];const l=Cd(Yd(t=>{const i=Date.now()-o;e(a.map(e=>(e.timeOffset-=i,e)),t),a=[],o=null}),r),c=Yd(Cd(Yd(e=>{const t=Xd(e),{clientX:i,clientY:n}=Ad(e)?e.changedTouches[0]:e;o||(o=xd()),a.push({x:i,y:n,id:s.getId(t),timeOffset:xd()-o}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?Ic.Drag:e instanceof MouseEvent?Ic.MouseMove:Ic.TouchMove)}),n,{trailing:!1})),u=[md("mousemove",c,i),md("touchmove",c,i),md("drag",c,i)];return Yd(()=>{u.forEach(e=>e())})}(e)),r.push(function({mouseInteractionCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,a=[];let l=null;return Object.keys(Rc).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]).forEach(r=>{let o=Du(r);const c=(t=>r=>{const o=Xd(r);if(Md(o,s,n,!0))return;let a=null,c=t;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Pc.Mouse;break;case"touch":a=Pc.Touch;break;case"pen":a=Pc.Pen}a===Pc.Touch&&(Rc[t]===Rc.MouseDown?c="TouchStart":Rc[t]===Rc.MouseUp&&(c="TouchEnd"))}else Ad(r)&&(a=Pc.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===Pc.Touch||c.startsWith("Mouse")&&a===Pc.Mouse)&&(a=null)):Rc[t]===Rc.Click&&(a=l,l=null);const u=Ad(r)?r.changedTouches[0]:r;if(!u)return;const d=i.getId(o),{clientX:h,clientY:p}=u;Yd(e)(at({type:Rc[c],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Rc[r]){case Rc.MouseDown:case Rc.MouseUp:o=o.replace("mouse","pointer");break;case Rc.TouchStart:case Rc.TouchEnd:return}a.push(md(o,c,t))}),Yd(()=>{a.forEach(e=>e())})}(e)),r.push(th(e)),r.push(function({viewportResizeCb:e},{win:t}){let i=-1,s=-1;return md("resize",Yd(Cd(Yd(()=>{const t=Id(),n=Rd();i===t&&s===n||(e({width:Number(n),height:Number(t)}),i=t,s=n)}),200)),t)}(e,{win:i})),r.push(function({inputCb:e,doc:t,mirror:i,blockClass:s,blockSelector:n,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(e){let i=Xd(e);const c=e.isTrusted,d=t.defaultView;if(i&&d&&!(i instanceof d.HTMLElement))return;const p=i&&i.tagName;if(i&&"OPTION"===p&&(i=Vc.parentElement(i)),!i||!p||0>sh.indexOf(p)||Md(i,s,n,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let _=i.value,g=!1;const f=Hu(i)||"";"radio"===f||"checkbox"===f?g=i.checked:(a[p.toLowerCase()]||a[f])&&(_=$u({element:i,maskInputOptions:a,tagName:p,type:f,value:_,maskInputFn:l})),h(i,u?{text:_,isChecked:g,userTriggered:c}:{text:_,isChecked:g});const v=i.name;"radio"===f&&v&&g&&t.querySelectorAll(`input[type="radio"][name="${v}"]`).forEach(e=>{if(e!==i){const t=e.value;h(e,u?{text:t,isChecked:!g,userTriggered:!1}:{text:t,isChecked:!g})}})}function h(t,s){const n=nh.get(t);if(!n||n.text!==s.text||n.isChecked!==s.isChecked){nh.set(t,s);const n=i.getId(t);Yd(e)(at(at({},s),{},{id:n}))}}const p=("last"===c.input?["change"]:["input","change"]).map(e=>md(e,Yd(d),t)),_=t.defaultView;if(!_)return()=>{p.forEach(e=>e())};const g=_.Object.getOwnPropertyDescriptor(_.HTMLInputElement.prototype,"value");return g&&g.set&&p.push(...[[_.HTMLInputElement.prototype,"value"],[_.HTMLInputElement.prototype,"checked"],[_.HTMLSelectElement.prototype,"value"],[_.HTMLTextAreaElement.prototype,"value"],[_.HTMLSelectElement.prototype,"selectedIndex"],[_.HTMLOptionElement.prototype,"selected"]].map(e=>Ed(e[0],e[1],{set(){Yd(d)({target:this,isTrusted:!1})}},!1,_))),Yd(()=>{Sd(p)})}(e)),r.push(function({mediaInteractionCb:e,blockClass:t,blockSelector:i,mirror:s,sampling:n,doc:r}){const o=Yd(r=>Cd(Yd(n=>{const o=Xd(n);if(!o||Md(o,t,i,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:u,loop:d}=o;e({type:r,id:s.getId(o),currentTime:a,volume:l,muted:c,playbackRate:u,loop:d})}),n.media||500)),a=[md("play",o(Fc.Play),r),md("pause",o(Fc.Pause),r),md("seeked",o(Fc.Seeked),r),md("volumechange",o(Fc.VolumeChange),r),md("ratechange",o(Fc.RateChange),r)];return Yd(()=>{a.forEach(e=>e())})}(e)),e.recordDOM){const t=function(e){const t=new Map,i=new Set;let s=!0;const n=e=>{if(s)try{e()}catch(e){}},r=e=>{var i;const s=t.get(e);if(s){for(;null===(i=s[0])||void 0===i?void 0:i.ready;){const e=s.shift();(null==e?void 0:e.emit)&&n(e.emit)}0===s.length&&t.delete(e)}};return{queueMutation(e,i){if(!e)return void n(i);const s=t.get(e);s?(s.push({emit:i,ready:!0}),r(e)):n(i)},queuePendingMutation(o,a,l){if(!s)return()=>{};let c=t.get(o);c||(c=[],t.set(o,c));const u={emit:a,ready:!1};c.push(u);let d,h=!1,p=!1;const _=()=>{h||p||(h=!0,void 0!==d&&i.delete(d),u.ready=!0,u.emit=void 0,r(o))};try{d=e.setTimeout(_,5e3),h||p?e.clearTimeout(d):i.add(d)}catch(e){_()}return t=>{!p&&s&&(p=!0,void 0!==d&&(e.clearTimeout(d),i.delete(d)),h?t&&n(l):(u.ready=!0,t||(u.emit=void 0),r(o)))}},reset(){s=!1,i.forEach(t=>e.clearTimeout(t)),i.clear(),t.clear()}}}(i);r.push(t.reset),r.push(function({styleSheetRuleCb:e,mirror:t,stylesheetManager:i},{win:s,mutationQueue:n}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const r=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=oh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,adds:[{rule:a,index:l}]})),l},"host")}),s.CSSStyleSheet.prototype.addRule=function(e,t,i=this.cssRules.length){return s.CSSStyleSheet.prototype.insertRule.apply(this,[`${e} { ${t} }`,i])};const o=s.CSSStyleSheet.prototype.deleteRule;let a,l;s.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=oh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,removes:[{index:a}]})),l},"host")}),s.CSSStyleSheet.prototype.removeRule=function(e){return s.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},s.CSSStyleSheet.prototype.replace&&(a=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);try{const s=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof s)return l;i.onCssomSheetMutation(r);const{id:o,styleId:c}=oh(r,t,i.styleMirror);if(!(o&&-1!==o||c&&-1!==c))return l;const u=n.queuePendingMutation(r,()=>e({id:o,styleId:c,replace:a}),()=>{const t=Tu(r);null!==t&&e({id:o,styleId:c,replace:t})});try{s.call(l,()=>u(!0),()=>u(!1))}catch(e){u(!1)}}catch(e){}return l},"host")})),s.CSSStyleSheet.prototype.replaceSync&&(l=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r);const{id:c,styleId:u}=oh(r,t,i.styleMirror);return(c&&-1!==c||u&&-1!==u)&&n.queueMutation(r,()=>e({id:c,styleId:u,replaceSync:a})),l},"host")}));const c={};uh("CSSGroupingRule")?c.CSSGroupingRule=s.CSSGroupingRule:(uh("CSSMediaRule")&&(c.CSSMediaRule=s.CSSMediaRule),uh("CSSConditionRule")&&(c.CSSConditionRule=s.CSSConditionRule),uh("CSSSupportsRule")&&(c.CSSSupportsRule=s.CSSSupportsRule));const u={};return Object.entries(c).forEach(([s,r])=>{u[s]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(u[s].insertRule,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=oh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...rh(r),l];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,adds:[{rule:a,index:t}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(u[s].deleteRule,{apply:Yd((s,r,o)=>{const[a]=o,l=s.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:c,styleId:u}=oh(r.parentStyleSheet,t,i.styleMirror);if(r.parentStyleSheet&&(c&&-1!==c||u&&-1!==u)){const t=[...rh(r),a];n.queueMutation(r.parentStyleSheet,()=>e({id:c,styleId:u,removes:[{index:t}]}))}return l},"host")})}),Yd(()=>{s.CSSStyleSheet.prototype.insertRule=r,s.CSSStyleSheet.prototype.deleteRule=o,a&&(s.CSSStyleSheet.prototype.replace=a),l&&(s.CSSStyleSheet.prototype.replaceSync=l),Object.entries(c).forEach(([e,t])=>{t.prototype.insertRule=u[e].insertRule,t.prototype.deleteRule=u[e].deleteRule})})}(e,{win:i,mutationQueue:t})),r.push(ah(e,e.doc)),r.push(function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:i,stylesheetManager:s},{win:n,mutationQueue:r}){const o=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Yd((n,o,a)=>{var l;const[c,u,d]=a,h=n.apply(o,a);if(i.has(c))return h;const p=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(p);const{id:_,styleId:g}=oh(p,t,s.styleMirror);if(_&&-1!==_||g&&-1!==g){const t=rh(o.parentRule);r.queueMutation(p,()=>e({id:_,styleId:g,set:{property:c,value:u,priority:d},index:t}))}return h},"host")});const a=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:Yd((n,o,a)=>{var l;const[c]=a,u=n.apply(o,a);if(i.has(c))return u;const d=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;s.onCssomSheetMutation(d);const{id:h,styleId:p}=oh(d,t,s.styleMirror);if(h&&-1!==h||p&&-1!==p){const t=rh(o.parentRule);r.queueMutation(d,()=>e({id:h,styleId:p,remove:{property:c},index:t}))}return u},"host")}),Yd(()=>{n.CSSStyleDeclaration.prototype.setProperty=o,n.CSSStyleDeclaration.prototype.removeProperty=a})}(e,{win:i,mutationQueue:t})),e.collectFonts&&r.push(function({fontCb:e,doc:t}){const i=t.defaultView;if(!i)return()=>{};const s=[],n=new WeakMap,r=i.FontFace;i.FontFace=function(e,t,i){const s=new r(e,t,i);return n.set(s,{family:e,buffer:"string"!=typeof t,descriptors:i,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),s};const o=jc(t.fonts,"add",function(t){return function(i){return setTimeout(Yd(()=>{const t=n.get(i);t&&(e(t),n.delete(i))}),0),t.apply(this,[i])}});return s.push(()=>{i.FontFace=r}),s.push(o),Yd(()=>{s.forEach(e=>e())})}(e))}r.push(function(e){const{doc:t,mirror:i,blockClass:s,blockSelector:n,selectionCb:r}=e;let o=!0;const a=Yd(()=>{const e=t.getSelection();if(!e||o&&(null==e?void 0:e.isCollapsed))return;o=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;l>t;t++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:c}=e.getRangeAt(t);Md(r,s,n,!0)||Md(l,s,n,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:c})}r({ranges:a})});return a(),md("selectionchange",a)}(e)),r.push(function({doc:e,customElementCb:t}){const i=e.defaultView;return i&&i.customElements?jc(i.customElements,"define",function(e){return function(i,s,n){try{t({define:{name:i}})}catch(e){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,s,n])}}):()=>{}}(e));for(const t of e.plugins)r.push(t.observer(t.callback,i,t.options))}catch(e){try{o()}catch(e){}throw e}return o}function ch(e){return void 0!==window[e]}function uh(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var dh=class{constructor(e){bu(this,"generateIdFn",void 0),bu(this,"iframeRemoteIdToLocalIdMap",new WeakMap),bu(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,i,s){if(0>t)return t;const n=i||this.getRemoteIdToLocalIdMap(e),r=s||this.getLocalIdToRemoteIdMap(e);let o=n.get(t);return void 0===o&&(o=this.generateIdFn(),n.set(t,o),r.set(o,t)),o}getIds(e,t){const i=this.getRemoteIdToLocalIdMap(e),s=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getId(e,t,i,s))}getRemoteId(e,t,i){var s;return"number"!=typeof t||0>t?t:null!==(s=(i||this.getLocalIdToRemoteIdMap(e)).get(t))&&void 0!==s?s:-1}getRemoteIds(e,t){const i=this.getLocalIdToRemoteIdMap(e);return t.map(t=>this.getRemoteId(e,t,i))}reset(e){if(!e)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(e),this.iframeLocalIdToRemoteIdMap.delete(e)}getRemoteIdToLocalIdMap(e){let t=this.iframeRemoteIdToLocalIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToLocalIdMap.set(e,t)),t}getLocalIdToRemoteIdMap(e){let t=this.iframeLocalIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeLocalIdToRemoteIdMap.set(e,t)),t}},hh=class{constructor(e){bu(this,"iframes",new WeakMap),bu(this,"crossOriginIframeMap",new WeakMap),bu(this,"crossOriginIframeMirror",new dh(Ju)),bu(this,"crossOriginIframeStyleMirror",void 0),bu(this,"crossOriginIframeRootIdMap",new WeakMap),bu(this,"mirror",void 0),bu(this,"mutationCb",void 0),bu(this,"wrappedEmit",void 0),bu(this,"loadListener",void 0),bu(this,"pageHideListener",void 0),bu(this,"stylesheetManager",void 0),bu(this,"recordCrossOriginIframes",void 0),bu(this,"messageHandler",void 0),bu(this,"nestedIframeListeners",new Map),bu(this,"attachedWindows",new WeakMap),bu(this,"attachedDocuments",new WeakMap),bu(this,"attachedIframes",new Map),bu(this,"loadListenerDisposers",new WeakMap),bu(this,"iframeElementsById",new Map),bu(this,"pageHideHandlers",new WeakMap),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new dh(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){let i=this.loadListenerDisposers.get(e);i||(i=new Set,this.loadListenerDisposers.set(e,i)),i.add(t);const s=this.mirror.getId(e);-1!==s&&this.iframeElementsById.set(s,e)}getIframeElementById(e){var t,i,s;return null!==(t=null!==(i=null===(s=this.attachedIframes.get(e))||void 0===s?void 0:s.element)&&void 0!==i?i:this.iframeElementsById.get(e))&&void 0!==t?t:null}forgetIframeId(e){this.attachedIframes.delete(e),this.iframeElementsById.delete(e)}disposeLoadListeners(e){const t=this.loadListenerDisposers.get(e);t&&(t.forEach(e=>bd(e)),this.loadListenerDisposers.delete(e))}removePageHideListener(e){const t=this.pageHideHandlers.get(e);t&&(t.forEach(({win:e,handler:t})=>{yd(e,"pagehide",t)}),this.pageHideHandlers.delete(e))}addLoadListener(e){this.loadListener=e}addPageHideListener(e){this.pageHideListener=e}removeLoadListener(){this.loadListener=void 0}trackIframeContent(e,t){const i=this.mirror.getId(e);return this.attachedIframes.set(i,{element:e,content:t}),i}attachIframe(e,t){var i;const s=this.trackIframeContent(e,t);if(e.contentDocument){let t=this.attachedDocuments.get(e);t||(t=new Set,this.attachedDocuments.set(e,t)),t.add(e.contentDocument)}this.mutationCb({adds:[{parentId:s,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const n=e.contentWindow;if(this.recordCrossOriginIframes&&n&&!this.nestedIframeListeners.has(n)){const t=this.handleMessage.bind(this);bd(()=>{n.addEventListener("message",t),this.nestedIframeListeners.set(n,t);let i=this.attachedWindows.get(e);i||(i=new Set,this.attachedWindows.set(e,i)),i.add(n)})}bd(()=>{const t=e.contentWindow;if(!t)return;let i=this.pageHideHandlers.get(e);if(i)for(const e of i)if(e.win===t)return;const 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),i||(i=new Set,this.pageHideHandlers.set(e,i)),i.add({win:t,handler:s})}),null===(i=this.loadListener)||void 0===i||i.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){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,t.data.event);s&&this.wrappedEmit(s,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case Tc.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),this.trackIframeContent(e,t.data.node),{timestamp:t.timestamp,type:Tc.IncrementalSnapshot,data:{source:Ic.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Tc.Meta:case Tc.Load:case Tc.DomContentLoaded:return!1;case Tc.Plugin:return t;case Tc.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Tc.IncrementalSnapshot:switch(t.data.source){case Ic.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(t.node,i)}),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 Ic.Drag:case Ic.TouchMove:case Ic.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Ic.ViewportResize:return!1;case Ic.MediaInteraction:case Ic.MouseInteraction:case Ic.Scroll:case Ic.CanvasMutation:case Ic.Input:return this.replaceIds(t.data,e,["id"]),t;case Ic.StyleSheetRule:case Ic.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Ic.Font:return t;case Ic.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Ic.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,i,s){for(const n of s)(Array.isArray(t[n])||"number"==typeof t[n])&&(t[n]=Array.isArray(t[n])?e.getIds(i,t[n]):e.getId(i,t[n]));return t}replaceIds(e,t,i){return this.replace(this.crossOriginIframeMirror,e,t,i)}replaceStyleIds(e,t,i){return this.replace(this.crossOriginIframeStyleMirror,e,t,i)}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===Lc.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}removeIframeById(e){const t=this.attachedIframes.get(e),i=(null==t?void 0:t.element)||this.iframeElementsById.get(e)||this.mirror.getNode(e);if(this.iframeElementsById.delete(e),i){const e=i.contentWindow,t=this.attachedWindows.get(i);t&&(t.forEach(e=>{const t=this.nestedIframeListeners.get(e);t&&(yd(e,"message",t),this.nestedIframeListeners.delete(e)),this.crossOriginIframeMap.delete(e)}),this.attachedWindows.delete(i)),e&&this.nestedIframeListeners.has(e)&&(yd(e,"message",this.nestedIframeListeners.get(e)),this.nestedIframeListeners.delete(e)),e&&this.crossOriginIframeMap.delete(e),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const s=this.attachedDocuments.get(i);s&&(s.forEach(e=>{bd(()=>this.mirror.removeNodeFromMap(e))}),bd(()=>ih(i,s)),this.attachedDocuments.delete(i))}t&&this.attachedIframes.delete(e)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const e=[];this.attachedIframes.forEach((t,i)=>{this.mirror.has(i)||e.push(i)}),e.forEach(e=>this.removeIframeById(e))}reattachIframes(){this.attachedIframes.forEach(({content:e},t)=>{this.mirror.has(t)?this.mutationCb({adds:[{parentId:t,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(t)})}destroy(){this.recordCrossOriginIframes&&yd(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((e,t)=>{yd(t,"message",e)}),this.nestedIframeListeners.clear();const e=new Set;this.iframeElementsById.forEach(t=>e.add(t)),this.attachedIframes.forEach(({element:t})=>e.add(t)),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}},ph=class{constructor(e){bu(this,"shadowDoms",new WeakSet),bu(this,"mutationCb",void 0),bu(this,"scrollCb",void 0),bu(this,"bypassOptions",void 0),bu(this,"mirror",void 0),bu(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 i,s;if(!ku(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=null!==(i=null===(s=Vc.host(e))||void 0===s?void 0:s.ownerDocument)&&void 0!==i?i:t,{observer:r,buffer:o}=eh(at(at({},this.bypassOptions),{},{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push({doc:n,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const e=Jd.indexOf(o);-1!==e&&Jd.splice(e,1)}}),this.restoreHandlers.push({doc:n,handler:th(at(at({},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(Vc.host(e))),this.restoreHandlers.push({doc:n,handler:ah({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){const i=this;this.restoreHandlers.push({doc:t,handler:jc(e.prototype,"attachShadow",function(e){return function(s){const n=e.call(this,s),r=Vc.shadowRoot(this);return r&&qd(this)&&i.addShadowRoot(r,t),n}})})}reset(){this.restoreHandlers.forEach(({handler:e})=>{try{e()}catch(e){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(e){const t=[];for(const i of this.restoreHandlers)if(i.doc===e)try{i.handler()}catch(e){}else t.push(i);this.restoreHandlers=t}},_h="skip-frame";function gh(e){if("object"!=typeof e||null===e)return!1;const{x:t,y:i,width:s,height:n}=e;return Number.isFinite(t)&&Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(n)&&s>=0&&n>=0}for(var fh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vh="undefined"==typeof Uint8Array?[]:new Uint8Array(256),mh=0;64>mh;mh++)vh[fh.charCodeAt(mh)]=mh;var yh=function(e){var t,i=new Uint8Array(e),s=i.length,n="";for(t=0;s>t;t+=3)n+=fh[i[t]>>2],n+=fh[(3&i[t])<<4|i[t+1]>>4],n+=fh[(15&i[t+1])<<2|i[t+2]>>6],n+=fh[63&i[t+2]];return s%3==2?n=n.substring(0,n.length-1)+"=":s%3==1&&(n=n.substring(0,n.length-2)+"=="),n},bh=new Map,Sh=(e,t,i)=>{if(!e||!Ch(e,t)&&"object"!=typeof e)return;const s=function(e,t){let i=bh.get(e);return i||(i=new Map,bh.set(e,i)),i.has(t)||i.set(t,[]),i.get(t)}(i,e.constructor.name);let n=s.indexOf(e);return-1===n&&(n=s.length,s.push(e)),n};function wh(e,t,i,s){if(e instanceof Array)return e.map(e=>wh(e,t,i,s));if(null===e)return e;if(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)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:yh(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[wh(e.buffer,t,i,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:i}=e;return{rr_type:t,src:i}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL(s.type,s.quality)}:e instanceof ImageData?{rr_type:e.constructor.name,args:[wh(e.data,t,i,s),e.width,e.height]}:Ch(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:Sh(e,t,i)}:e}var kh=(e,t,i,s)=>e.map(e=>wh(e,t,i,s)),Ch=(e,t)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(i.find(i=>e instanceof t[i]))},Eh=["webgl","webgl2"];function xh(e){return"nodeType"in e}function Th(e,t,i,s){const n=[];try{if(s){const s=function(e,t,i){const s=e.GPUCanvasContext;if((null==s?void 0:s.prototype)&&"function"==typeof s.prototype.configure)return jc(s.prototype,"configure",function(s){return function(n){const r=function(e){const{canvas:t}=e;return t&&"object"==typeof t?t:null}(this);if(!r||xh(r)&&Md(r,t,i,!0))return s.call(this,n);xh(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(e){const t=e.GPUTextureUsage;return t?t.COPY_SRC|t.RENDER_ATTACHMENT:null}(e);return s.call(this,null!==o&&n?at(at({},n),{},{usage:"number"==typeof n.usage?n.usage|o:o}):n)}})}(e,t,i);s&&n.push(s)}const r=jc(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(n,...r){const o=function(e){return"experimental-webgl"===e?"webgl":e}(n);if(!Md(this,t,i,!0)&&("__context"in this||(this.__context=o),s&&Eh.includes(o)))if(r[0]&&"object"==typeof r[0]){const e=r[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return e.apply(this,[n,...r])}});n.push(r)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(e=>e())}}function Ih(e,t,i,s,n,r,o){const a=[],l=Object.getOwnPropertyNames(e);for(const c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if("function"!=typeof e[c])continue;const l=jc(e,c,function(e){return function(...a){const l=e.apply(this,a);if(Sh(l,r,this),this.canvas&&"tagName"in this.canvas&&!Md(this.canvas,s,n,!0)){const e=kh(a,r,this,o);i(this.canvas,{type:t,property:c,args:e})}return l}});a.push(l)}catch(r){const o=Ed(e,c,{set(e){this.canvas&&"tagName"in this.canvas&&!Md(this.canvas,s,n,!0)&&i(this.canvas,{type:t,property:c,args:[e],setter:!0})}});a.push(o)}return a}var Rh='(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',Ph="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Rh],{type:"text/javascript;charset=utf-8"});function Mh(e){let t;try{if(t=Ph&&(self.URL||self.webkitURL).createObjectURL(Ph),!t)throw"";const i=new Worker(t,{name:null==e?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Rh),{name:null==e?void 0:e.name})}}var Fh,Lh,Ah,Oh=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){bu(this,"pendingCanvasMutations",new Map),bu(this,"rafStamps",{latestId:0,invokeId:null}),bu(this,"mirror",void 0),bu(this,"mutationCb",void 0),bu(this,"resetObservers",void 0),bu(this,"frozen",!1),bu(this,"locked",!1),bu(this,"rafIdTimestamp",null),bu(this,"rafIdFlush",null),bu(this,"refCount",0),bu(this,"torndown",!1),bu(this,"resetFrameDedup",null),bu(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)});const{sampling:t="all",win:i,blockClass:s,blockSelector:n,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,r&&"all"===t&&this.initCanvasMutationObserver(i,s,n,o),r&&"number"==typeof t&&this.initCanvasFPSObserver(t,i,s,n,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(e,t,i,s,n){var r=this;if(!("OffscreenCanvas"in t))return;const o="number"==typeof n.resolutionScale&&Number.isFinite(n.resolutionScale)?Math.min(1,Math.max(.1,n.resolutionScale)):1,a=Th(t,i,s,!0),l=new Map;let c;try{c=new Mh}catch(e){return}let u=!1;c.onerror=()=>{var e;u=!0,cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null},this.resetFrameDedup=()=>{c.postMessage({resetFrameDedup:!0})},c.onmessage=e=>{const{id:t}=e.data;if(l.set(t,!1),!("base64"in e.data))return;const{base64:i,type:s,displayWidth:n,displayHeight:r}=e.data;this.mutationCb({id:t,type:Mc["2D"],commands:[{property:"clearRect",args:[0,0,n,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:s}]},0,0,n,r]}],displayWidth:n,displayHeight:r})};const d=1e3/e;let h,p=0;const _=e=>{var a;u||(p&&d>e-p||(p=e,(()=>{const e=[],n=t=>{try{t.querySelectorAll("canvas").forEach(t=>{Md(t,i,s,!0)||e.push(t)}),t.querySelectorAll("*").forEach(e=>{e.shadowRoot&&n(e.shadowRoot)})}catch(e){}};return n(t.document),e})().forEach((a=st(function*(e){const t=r.mirror.getId(e);if(!l.get(t)&&0!==e.width&&0!==e.height){l.set(t,!0);try{if(["webgl","webgl2"].includes(e.__context)){var i,s;const n=e.getContext(e.__context);if(null==n||null===(i=n.isContextLost)||void 0===i?void 0:i.call(n))return void l.set(t,!1);!1===(null==n||null===(s=n.getContextAttributes())||void 0===s?void 0:s.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=e.clientWidth||e.width,a=e.clientHeight||e.height,u=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),h=function(e,t,i,s,n,r){if(!e||"function"!=typeof e.regionsFn)return;let o;try{o=e.regionsFn(t)}catch(e){return _h}if(void 0===o)return;if(!Array.isArray(o)||!o.every(gh))return _h;const a=i/n,l=s/r;return o.filter(e=>e.width>0&&e.height>0).map(e=>{const t=Math.floor(e.x*a),i=Math.floor(e.y*l);return{x:t,y:i,width:Math.ceil((e.x+e.width)*a)-t,height:Math.ceil((e.y+e.height)*l)-i}})}(n.canvasMasking,e,u,d,r,a);if("skip-frame"===h)return void l.set(t,!1);const p=yield createImageBitmap(e,1>o?{resizeWidth:u,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:u,resizeHeight:d});c.postMessage({id:t,bitmap:p,width:u,height:d,displayWidth:r,displayHeight:a,dataURLOptions:n.dataURLOptions,maskRegions:h},[p])}catch(e){l.set(t,!1)}}}),function(e){return a.apply(this,arguments)}))),h=requestAnimationFrame(_))};h=requestAnimationFrame(_),this.resetObservers=()=>{var e;a(),cancelAnimationFrame(h),null===(e=c.terminate)||void 0===e||e.call(c),this.resetFrameDedup=null}}initCanvasMutationObserver(e,t,i,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=Th(e,t,i,!1),r=function(e,t,i,s,n){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const o=jc(t.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return Md(this.canvas,i,s,!0)||setTimeout(()=>{const i=kh(o,t,this,n);e(this.canvas,{type:Mc["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(n){const o=Ed(t.CanvasRenderingContext2D.prototype,a,{set(t){Md(this.canvas,i,s,!0)||e(this.canvas,{type:Mc["2D"],property:a,args:[t],setter:!0})}});r.push(o)}return()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s),o=function(e,t,i,s,n){const r=[];return void 0!==t.WebGLRenderingContext&&r.push(...Ih(t.WebGLRenderingContext.prototype,Mc.WebGL,e,i,s,t,n)),void 0!==t.WebGL2RenderingContext&&r.push(...Ih(t.WebGL2RenderingContext.prototype,Mc.WebGL2,e,i,s,t,n)),()=>{r.forEach(e=>e())}}(this.processMutation.bind(this),e,t,i,s);this.resetObservers=()=>{n(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,this.rafIdTimestamp=requestAnimationFrame(e)};this.rafIdTimestamp=requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const i=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||-1===t)return;const s=i.map(e=>cn(e,xc)),{type:n}=i[0];this.mutationCb({id:t,type:n,commands:s}),this.pendingCanvasMutations.delete(e)}},$h=class{constructor(e){var t;bu(this,"trackedLinkElements",new WeakSet),bu(this,"pendingDeferredSheets",new Set),bu(this,"mutationCb",void 0),bu(this,"adoptedStyleSheetCb",void 0),bu(this,"maskAllElementAttributes",void 0),bu(this,"maskAttributeFn",void 0),bu(this,"styleMirror",new Nd),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;let i=null,s=null;try{s=e.sheet,s&&(i=Au(s))}catch(e){}if(!i||!s)return vu(),null;const n=i;let r=!1;const o={sheet:s,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=Gc(),c=Zc();let u=!0;try{if(r)return a=!0,vu(),!0;if(!n.advance(i))return u=!1,!1;a=!0;const o=n.text();if(!e.isConnected)return!0;let l=null;try{l=e.sheet}catch(e){}return l!==s?(vu(),!0):o?(this.emitCssTextMutation(e,t,o),!0):(vu(),!0)}finally{u&&this.pendingDeferredSheets.delete(o),Yc(d=Gc()-l,null!=(h=c)?h:Qc)||(lu.totalMs+=d,d>lu.slowestSliceMs&&(lu.slowestSliceMs=d))}var d,h},remainingRules:()=>n.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(e){if(e&&0!==this.pendingDeferredSheets.size)for(const t of this.pendingDeferredSheets)t.sheet===e&&(this.pendingDeferredSheets.delete(t),t.invalidate())}inlineDeferredLinkElement(e,t){var i;null===(i=this.beginDeferredLinkInlining(e,t))||void 0===i||i.advance(1/0)}emitCssTextMutation(e,t,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t,attributes:{_cssText:Bu({element:e,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const i={id:t,styleIds:[]},s=[];for(const t of e){let e;if(this.styleMirror.has(t))e=this.styleMirror.getId(t);else{const i=this.styleMirror.add(t);e=i;const n=Gc();try{pu(()=>{try{const e=t.rules||t.cssRules;e&&hu(e)}catch(e){}s.push({styleId:i,rules:Array.from(t.rules||CSSRule,(e,i)=>({rule:Iu(e,t.href),index:i}))})})}finally{_u(Gc()-n)}}i.styleIds.push(e)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),ud.forEach(e=>e.abort()),ud.clear()}trackStylesheetInLinkElement(e){}},Dh=class{constructor(){bu(this,"nodeMap",new WeakMap),bu(this,"active",!1)}inOtherBuffer(e,t){const i=this.nodeMap.get(e);return i&&Array.from(i).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(){}},Nh=!1;try{if(2!==Array.from([1],e=>2*e)[0]){var Bh;const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null===(Bh=e.contentWindow)||void 0===Bh?void 0:Bh.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var qh=new Ou,Hh=new Set([Ic.Mutation,Ic.MediaInteraction,Ic.StyleSheetRule,Ic.CanvasMutation,Ic.Font,Ic.Log,Ic.StyleDeclaration,Ic.AdoptedStyleSheet]);function Uh(e){const t=window;if("function"==typeof t.requestIdleCallback){const i=t.requestIdleCallback(e,{timeout:2e3});return{cancel(){var e;return null===(e=t.cancelIdleCallback)||void 0===e?void 0:e.call(t,i)}}}const i=setTimeout(e,250);return{cancel:()=>clearTimeout(i)}}function Wh(e={}){let t;const{emit:i,checkoutEveryNms:s,checkoutEveryNth:n,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:c="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,inlineStylesheetBudgetRules:h,maskAllInputs:p,maskInputOptions:_,slimDOMOptions:g,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m=!1,maskAttributeFn:y,hooks:b,packFn:S,sampling:w={},dataURLOptions:k={},canvasResolutionScale:C,canvasMasking:E,mousemoveWait:x,recordDOM:T=!0,recordCanvas:I=!1,recordCrossOriginIframes:R=!1,recordAfter:P=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:M=!1,collectFonts:F=!1,inlineImages:L=!1,plugins:A,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:D=new Set([]),attributeFilter:N,errorHandler:B}=e;Kd(B);const q=at({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},k),H=!R||window.parent===window;let U=!1;if(!H)try{window.parent.document&&(U=!1)}catch(e){U=!0}if(H&&!i)throw new Error("emit function is required");if(!H&&!U)return()=>{};void 0!==x&&void 0===w.mousemove&&(w.mousemove=x),qh.reset();const W=!0===p?{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!==_?_:{password:!0},z=fd(void 0!==g&&g);let j;!function(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)}();let V=0;const G=new Map;let Q,K;const Z=e=>{for(const t of A||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!U&&(e=S(e)),e};Fh=(e,t)=>{var r;const o=e;if(o.timestamp=xd(),!(null===(r=Jd[0])||void 0===r?void 0:r.isFrozen())||o.type===Tc.FullSnapshot||o.type===Tc.IncrementalSnapshot&&Hh.has(o.data.source)||Jd.forEach(e=>e.unfreeze()),H)null==i||i(Z(o),t);else if(U){const e={type:"rrweb",event:Z(o),origin:window.location.origin,isCheckout:t};window.parent.postMessage(e,"*")}if(o.type===Tc.FullSnapshot)j=o,V=0;else if(o.type===Tc.IncrementalSnapshot){if(o.data.source===Ic.Mutation&&o.data.isAttachIframe)return;V++,(n&&V>=n||s&&o.timestamp-j.timestamp>s)&&Lh(!0)}};const Y=e=>{if(e.removes&&e.removes.length>0){const t=e.adds.length>0?new Set(e.adds.map(e=>e.node.id)):null,i=new Set;if(e.adds.length>0)for(const t of e.adds){const e=qh.getNode(t.node.id);e&&"IFRAME"===e.nodeName&&i.add(e)}e.removes.forEach(({id:e})=>{if(t&&t.has(e))return;const s=te.getIframeElementById(e);s&&i.has(s)?te.forgetIframeId(e):(null==Q||Q(e),te.removeIframeById(e))}),null==K||K(),te.cleanupDetachedIframes()}Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Mutation},e)})},J=e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Scroll},e)}),X=e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.CanvasMutation},e)}),ee=new $h({mutationCb:Y,adoptedStyleSheetCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.AdoptedStyleSheet},e)}),maskAllElementAttributes:m,maskAttributeFn:y}),te=new hh({mirror:qh,mutationCb:Y,stylesheetManager:ee,recordCrossOriginIframes:R,wrappedEmit:Fh});for(const e of A||[])e.getMirror&&e.getMirror({nodeMirror:qh,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const ie=new Dh,se=null==E?void 0:E.configured;Ah=new Oh({recordCanvas:I,mutationCb:X,win:window,blockClass:r,blockSelector:o,mirror:qh,sampling:w.canvas,dataURLOptions:q,resolutionScale:C,canvasMasking:E});const ne=new ph({mutationCb:Y,scrollCb:J,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:W,dataURLOptions:q,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,recordCanvas:I,canvasMaskingConfigured:se,inlineImages:L,sampling:w,slimDOMOptions:z,iframeManager:te,stylesheetManager:ee,canvasManager:Ah,keepIframeSrcFn:O,processedNodeManager:ie,attributeFilter:N},mirror:qh});Lh=(e=!1)=>{if(T){cu(h);try{Fh({type:Tc.Meta,data:{href:window.location.href,width:Rd(),height:Id()}},e),null==t||t.cancel(),t=void 0,ee.reset(),ne.init(),Jd.forEach(e=>e.lock());let i=null,s=[];try{i=function(e,t){const{mirror:i=new Ou,blockClass:s="rr-block",blockSelector:n=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,canvasMaskingConfigured:u,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_=!1,maskAttributeFn:g,slimDOM:f=!1,dataURLOptions:v,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:E=()=>!1,maxDepth:x,inlineStylesheetBudgetRules:T}=t||{},I=!0===d?{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===d?{password:!0}:d,R=fd(f);cu(T);try{return gd(e,{doc:e,mirror:i,blockClass:s,blockSelector:n,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:I,maskTextFn:h,maskInputFn:p,maskAllElementAttributes:_,maskAttributeFn:g,slimDOMOptions:R,dataURLOptions:v,inlineImages:l,recordCanvas:c,canvasMaskingConfigured:u,preserveWhiteSpace:m,onSerialize:y,onIframeLoad:b,iframeLoadTimeout:S,onIframeListenerRegistered:w,onStylesheetLoad:k,stylesheetLoadTimeout:C,keepIframeSrcFn:E,newlyAddedElement:!1,maxDepth:x})}finally{uu()}}(document,{mirror:qh,blockClass:r,blockSelector:o,maskTextClass:c,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:W,inlineStylesheetBudgetRules:h,maskTextFn:v,maskInputFn:f,maskAllElementAttributes:m,maskAttributeFn:y,slimDOM:z,dataURLOptions:q,recordCanvas:I,canvasMaskingConfigured:se,inlineImages:L,onSerialize(e){Od(e,qh)&&te.addIframe(e),$d(e,qh)&&ee.trackLinkElement(e),Dd(e)&&ne.addShadowRoot(Vc.shadowRoot(e),document)},onIframeLoad(e,t){te.attachIframe(e,t),ne.observeAttachShadow(e)},onIframeListenerRegistered(e,t){te.registerLoadListenerDisposer(e,t)},onStylesheetLoad(e,t){ee.attachLinkElement(e,t)},keepIframeSrcFn:O})}finally{s=fu()}if(!i)return console.warn("Failed to snapshot the document");if(Fh({type:Tc.FullSnapshot,data:{node:i,initialOffset:Td(window)}},e),Jd.forEach(e=>e.unlock()),Ah.onFullSnapshot(),s.length){const e=function(e,t,i){let s=!1,n=null,r=0,o=null;const a=()=>null!==o||e.length>r,l=()=>{const i=e[r];e[r]=null,r+=1,i&&bd(()=>{o=t.beginDeferredLinkInlining(i,qh.getId(i))})},c=()=>{if(!o)return;const e=o;let t=!0;bd(()=>{t=e.advance(200)}),t&&(o=null)},u=()=>{o||l(),c()},d=e=>{if(n=null,s)return;let t=0;do{try{u()}catch(e){null==o||o.discard(),o=null,mu(1)}t+=1}while(!s&&a()&&(e?!e.didTimeout&&e.timeRemaining()>5:10>t));s||(a()?n=Uh(d):i())};return n=Uh(d),{cancel(){s=!0,null==o||o.discard(),o=null,null==n||n.cancel(),n=null},flush(){if(s)return;s=!0,null==n||n.cancel(),n=null;let t=0,u=0;for(;a()&&50>t;){o||l();const e=o;if(e)if(Math.floor(e.remainingRules()/200)+1>50-t)e.discard(),o=null,u+=1;else{try{c()}catch(e){null==o||o.discard(),o=null,u+=1}t+=1}}if(a()||u>0){let t=u+(null!==o?1:0);for(let i=r;e.length>i;i++)null!==e[i]&&(t+=1);mu(t),null==o||o.discard(),o=null}i()}}}(s,ee,()=>{t===e&&(t=void 0)});t=e}R&&te.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,qh.getId(document))}finally{uu()}}};try{const e=[];e.push(md("pagehide",()=>{try{null==t||t.flush()}catch(e){}t=void 0},window));for(const t of["visibilitychange","freeze","resume"])e.push(md(t,Kc,document));Q=t=>{const i=G.get(t);i&&(i.forEach(t=>{bd(t);const i=e.indexOf(t);-1!==i&&e.splice(i,1)}),G.delete(t))},K=()=>{for(const[e]of G){const t=qh.getNode(e);if(t)try{t.contentDocument&&t.contentDocument.defaultView||null==Q||Q(e)}catch(t){null==Q||Q(e)}else null==Q||Q(e)}};const i=e=>{var t;return Yd(lh)({mutationCb:Y,mousemoveCb:(e,t)=>Fh({type:Tc.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.MouseInteraction},e)}),scrollCb:J,viewportResizeCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.ViewportResize},e)}),inputCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Input},e)}),mediaInteractionCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.MediaInteraction},e)}),styleSheetRuleCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.StyleSheetRule},e)}),styleDeclarationCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.StyleDeclaration},e)}),canvasMutationCb:X,fontCb:e=>Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Font},e)}),selectionCb(e){Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.Selection},e)})},customElementCb(e){Fh({type:Tc.IncrementalSnapshot,data:at({source:Ic.CustomElement},e)})},blockClass:r,ignoreClass:a,ignoreSelector:l,maskTextClass:c,maskTextSelector:u,maskInputOptions:W,inlineStylesheet:d,sampling:w,recordDOM:T,recordCanvas:I,canvasMaskingConfigured:se,inlineImages:L,userTriggeredOnInput:M,collectFonts:F,doc:e,maskInputFn:f,maskTextFn:v,maskAllElementAttributes:m,maskAttributeFn:y,keepIframeSrcFn:O,blockSelector:o,slimDOMOptions:z,dataURLOptions:q,mirror:qh,iframeManager:te,stylesheetManager:ee,shadowDomManager:ne,processedNodeManager:ie,canvasManager:Ah,ignoreCSSAttributes:D,attributeFilter:N,plugins:(null==A||null===(t=A.filter(e=>e.observer))||void 0===t?void 0:t.map(e=>({observer:e.observer,options:e.options,callback:t=>Fh({type:Tc.Plugin,data:{plugin:e.name,payload:t}})})))||[]},b)};te.addLoadListener(t=>{try{const s=qh.getId(t),n=i(t.contentDocument);if("function"==typeof n&&(e.push(n),-1!==s)){let e=G.get(s);e||(e=new Set,G.set(s,e)),e.add(n)}}catch(e){console.warn(e)}}),te.addPageHideListener(e=>{const t=qh.getId(e);null==Q||Q(t),ih(e)});let s=-1;const n=e=>Fh({type:Tc.Custom,data:{tag:"rrweb/fullscreen",payload:e}}),h=()=>{var e,t,i,r;const o=document,a=null!==(e=null!==(t=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==t?t:o.msFullscreenElement)&&void 0!==e?e:null,l=a?qh.getId(a):-1;l!==s&&(-1!==s&&n({id:s,enter:!1}),s=l,-1!==l&&n({id:l,enter:!0}))},p=()=>{Lh();const t=i(document);"function"==typeof t&&e.push(t),e.push(md("fullscreenchange",h)),e.push(md("webkitfullscreenchange",h)),e.push(md("mozfullscreenchange",h)),e.push(md("MSFullscreenChange",h)),Nh=!0};return["interactive","complete"].includes(document.readyState)?p():(e.push(md("DOMContentLoaded",()=>{Fh({type:Tc.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&p()})),e.push(md("load",()=>{Fh({type:Tc.Load,data:{}}),"load"===P&&p()},window))),()=>{try{null==t||t.flush()}catch(e){}t=void 0,Sd(e),ie.destroy(),te.removeLoadListener(),te.destroy(),G.clear(),ne.reset(),qh.reset(),Nh=!1,Zd()}}catch(e){console.warn(e)}}Wh.addCustomEvent=(e,t)=>{if(!Nh)throw new Error("please add custom event after start recording");Fh({type:Tc.Custom,data:{tag:e,payload:t}})},Wh.freezePage=()=>{Jd.forEach(e=>e.freeze())},Wh.takeFullSnapshot=e=>{if(!Nh)throw new Error("please take full snapshot after start recording");Lh(e)},Wh.mirror=qh,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date;var zh=Object.create(null);function jh(e){return jh="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},jh(e)}function Vh(e,t,i){return(t=function(e){var t=function(e){if("object"!=jh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=jh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}zh.Node=Object.create(null),zh.ShadowRoot=Object.create(null),zh.MutationObserver=Object.create(null),zh.Element=Object.create(null);var Gh=class{constructor(e){Vh(this,"fileName",void 0),Vh(this,"functionName",void 0),Vh(this,"lineNumber",void 0),Vh(this,"columnNumber",void 0),this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}},Qh=/(^|@)\S+:\d+/,Kh=/^\s*at .*(\S+:\d+|\(native\))/m,Zh=/^(eval@)?(\[native code])?$/,Yh={parse(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Kh)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):[]:[]},extractLocation(e){if(-1===e.indexOf(":"))return[e];const 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(Kh)},this).map(function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=i?t.replace(i[0],""):t;const s=t.split(/\s+/).slice(1),n=this.extractLocation(i?i[1]:s.pop());return new Gh({functionName:s.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(n[0])>-1?void 0:n[0],lineNumber:n[1],columnNumber:n[2]})},this)},parseFFOrSafari(e){return e.stack.split("\n").filter(function(e){return!e.match(Zh)},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 Gh({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=e.match(t),s=i&&i[1]?i[1]:void 0,n=this.extractLocation(e.replace(t,""));return new Gh({functionName:s,fileName:n[0],lineNumber:n[1],columnNumber:n[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){const t=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),s=[];for(let e=2,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new Gh({fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera10(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),s=[];for(let e=0,n=i.length;n>e;e+=2){const n=t.exec(i[e]);n&&s.push(new Gh({functionName:n[3]||void 0,fileName:n[2],lineNumber:parseFloat(n[1])}))}return s},parseOpera11(e){return e.stack.split("\n").filter(function(e){return!!e.match(Qh)&&!e.match(/^Error created at/)},this).map(function(e){const t=e.split("@"),i=this.extractLocation(t.pop());return new Gh({functionName:(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function Jh(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let i=e.localName;if(!i)break;i=i.toLowerCase();const s=e.parentElement,n=[];if(s.children&&s.children.length>0)for(let e=0;s.children.length>e;e++){const t=s.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===i&&n.push(t)}n.length>1&&(i+=`:eq(${n.indexOf(e)})`),t=i+(t?">"+t:""),e=s}return t}function Xh(e){return Array.isArray(e)}function ep(e){return"object"==typeof e&&null!==e&&!Xh(e)}function tp(e,t){if(0===t)return!0;const i=Object.keys(e);for(const s of i)if(ep(e[s])&&tp(e[s],t-1))return!0;return!1}function ip(e,t){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,t);const s=[],n=[];return JSON.stringify(e,function(e,t){if(s.length>0){const i=s.indexOf(this);~i?s.splice(i+1):s.push(this),~i?n.splice(i,1/0,e):n.push(e),~s.indexOf(t)&&(t=s[0]===t?"[Circular ~]":"[Circular ~."+n.slice(0,s.indexOf(t)).join(".")+"]")}else s.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(ep(r=t)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||ep(r)&&tp(r,i.depthOfLimit))return function(e){let t=e.toString();return i.stringLengthLimit&&t.length>i.stringLengthLimit&&(t=`${t.slice(0,i.stringLengthLimit)}...`),t}(t);var r;if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const i in t){const s=t[i];e[i]=Xh(s)?Jh(s.length?s[0]:null):s}return e}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 sp={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 np(e,t,i){const s=i?Object.assign({},sp,i):sp,n=s.logger;if(!n)return()=>{};let r;r="string"==typeof n?t[n]:n;let o=0,a=!1;const l=[];if(s.level.includes("error")){const i=t=>{const i=t.message;e({level:"error",trace:Yh.parse(t.error).map(e=>e.toString()),payload:[ip(i,s.stringifyOptions)]})};t.addEventListener("error",i),l.push(()=>{t.removeEventListener("error",i)});const n=t=>{let i,n;t.reason instanceof Error?(i=t.reason,n=[ip(`Uncaught (in promise) ${i.name}: ${i.message}`,s.stringifyOptions)]):(i=new Error,n=[ip("Uncaught (in promise)",s.stringifyOptions),ip(t.reason,s.stringifyOptions)]),e({level:"error",trace:Yh.parse(i).map(e=>e.toString()),payload:n})};t.addEventListener("unhandledrejection",n),l.push(()=>{t.removeEventListener("unhandledrejection",n)})}for(const e of s.level)l.push(c(r,e));return()=>{l.forEach(e=>e())};function c(t,i){return t[i]?function(e,t,i){try{if(!(t in e))return()=>{};const s=e[t],n={next:s},r=i(function(...e){return n.next.apply(this,e)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:s},__rrweb_layer__:{enumerable:!1,value:n}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=n.next);const i=e=>{var t;return"function"==typeof e?null!==(t=e.__rrweb_layer__)&&void 0!==t?t:e.__posthog_layer__:void 0};let s=e[t],o=i(s);for(;o;){if(o.next===r)return void(o.next=n.next);s=o.next,o=i(s)}}}catch(e){return()=>{}}}(t,i,t=>(...n)=>{if(t.apply(this,n),!("assert"===i&&n[0]||a)){a=!0;try{const t=Yh.parse(new Error).map(e=>e.toString()).splice(1),r=("assert"===i?n.slice(1):n).map(e=>ip(e,s.stringifyOptions));o++,s.lengthThreshold>o?e({level:i,trace:t,payload:r}):o===s.lengthThreshold&&e({level:"warn",trace:[],payload:[ip("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...n)}finally{a=!1}}}):()=>{}}}var rp=e=>({name:"rrweb/console@1",observer:np,options:e});const op=()=>{},ap=e=>{var t;if(wt(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function lp(e,t,i){try{if(!(t in e))return op;const s={next:e[t]},n=i(function(...e){return s.next.apply(this,e)});return wt(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let i=e[t],r=ap(i);for(;r;){if(r.next===n)return void(r.next=s.next);i=r.next,r=ap(i)}}}catch(e){return op}}function cp(e,t){var i;const s=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),n={hostname:s,isHostDenied:!1};if(!(null===(i=t.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==s?void 0:s.trim().length))return n;for(const e of t.payloadHostDenyList)if(s.endsWith(e))return{hostname:s,isHostDenied:!0};return n}const up=Ln("[Recorder]"),dp=e=>"navigation"===e.entryType,hp=e=>"resource"===e.entryType;function pp(e,t){return!!t&&(Ft(t)||t[e])}function _p(e){if("undefined"==typeof Request)return!1;if(e instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(e)}catch(e){return!1}}const gp=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function fp({type:e,recordBody:t,headers:i,url:s}){function n(e){const t=Object.keys(i).find(e=>"content-type"===e.toLowerCase()),s=t&&i[t];return e.some(e=>null==s?void 0:s.toLowerCase().includes(e))}if(!t)return!1;if(function e(t){try{return"string"==typeof t?t.startsWith("blob:"):t instanceof URL?"blob:"===t.protocol:!!_p(t)&&e(t.url)}catch(e){return!1}}(s))return!1;if(n(gp))return!1;if(Ft(t))return!0;if(St(t))return n(t);const r=t[e];return Ft(r)?r:n(r)}function vp(e,t,i,s,n){return mp.apply(this,arguments)}function mp(){return mp=st(function*(e,t,i,s,n,r=0){if(r>10)return up.warn("Failed to get performance entry for request",{url:i,initiatorType:t}),null;const o=function(e,t){for(let i=e.length-1;i>=0;i-=1)if(t(e[i]))return e[i]}(e.performance.getEntriesByName(i),e=>hp(e)&&e.initiatorType===t&&(Et(s)||e.startTime>=s)&&(Et(n)||n>=e.startTime));return o||(yield new Promise(e=>setTimeout(e,50*r)),vp(e,t,i,s,n,r+1))}),mp.apply(this,arguments)}function yp({body:e,options:t,url:i}){if(Rt(e))return null;const{hostname:s,isHostDenied:n}=cp(i,t);if(n)return s+" is in deny list";if(xt(e))return e;if((e=>"u">typeof Document&&e instanceof Document)(e))return e.textContent;if(Lt(e))return Kn(e);if(kt(e))try{return JSON.stringify(e)}catch(e){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(e)}const bp=e=>!It(e)&&("navigation"===e.entryType||"resource"===e.entryType);function Sp({entry:e,method:t,status:i,networkRequest:s,isInitial:n,start:r,end:o,url:a,initiatorType:l}){r=e?e.startTime:r,o=e?e.responseEnd:o;const c=Math.floor(Date.now()-performance.now()),u=Math.floor(c+(r||0)),d=[at(at({},e?e.toJSON():{name:a}),{},{startTime:Et(r)?void 0:Math.round(r),endTime:Et(o)?void 0:Math.round(o),timeOrigin:c,timestamp:u,method:t,initiatorType:l||(e?e.initiatorType:void 0),status:i,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:n})];if(bp(e))for(const t of e.serverTiming||[])d.push({timeOrigin:c,timestamp:u,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const wp=["video/","audio/"];function kp(e){return kt(e)&&wt(e.getReader)&&wt(e.tee)}const Cp="[SessionReplay] Timeout while trying to read body",Ep="[SessionReplay] Failed to read body";function xp(e){return`${Ep}: ${e}`}function Tp(e){return`[SessionReplay] Body too large to record (> ${e} bytes)`}function Ip(e,t){if(!t.streamNetworkBody)return function(e){return new Promise(t=>{const i=setTimeout(()=>t(Cp),500);try{e.clone().text().then(e=>t(e),e=>t(xp(e))).finally(()=>clearTimeout(i))}catch(e){clearTimeout(i),t(Ep)}})}(e);const i=zr(t);return function(e,t){try{var i,s;const n=null===(i=e.headers)||void 0===i||null===(s=i.get)||void 0===s?void 0:s.call(i,"content-length");if(!n)return!1;const r=parseInt(n,10);return Number.isFinite(r)&&r>t}catch(e){return!1}}(e,i)?Promise.resolve(Tp(i)):function(e,t){return new Promise(i=>{let s,n=!1;function r(){try{null==s||s.cancel().catch(()=>{})}catch(e){}}function o(e){n||(n=!0,clearTimeout(a),r(),i(e))}const a=setTimeout(()=>o(Cp),500);let l;try{l=e.clone()}catch(e){return void o(Ep)}const c=l.body;if(!kp(c)||"undefined"==typeof TextDecoder){try{l.text().then(e=>o(e),e=>o(xp(e)))}catch(e){o(Ep)}return}try{s=c.getReader()}catch(e){return void o(Ep)}const u=[];let d=0;!function e(){s.read().then(({done:i,value:s})=>{if(n)r();else if(i)o((new TextDecoder).decode(function(e,t){const i=new Uint8Array(t);let s=0;for(const t of e)i.set(t,s),s+=t.byteLength;return i}(u,d)));else{if(s){if(d+s.byteLength>t)return void o(Tp(t));d+=s.byteLength,u.push(s)}e()}},e=>o(xp(e)))}()})}(e,i)}function Rp(){return Rp=st(function*({r:e,options:t,url:i}){const{hostname:s,isHostDenied:n}=cp(i,t);return n?Promise.resolve(s+" is in deny list"):Ip(e,t)}),Rp.apply(this,arguments)}function Pp(){return Pp=st(function*({r:e,options:t,url:i}){const s=function({r:e,options:t,url:i}){var s;if("chunked"===e.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const n=null===(s=e.headers.get("Content-Type"))||void 0===s?void 0:s.toLowerCase(),r=wp.some(e=>null==n?void 0:n.startsWith(e));if(n&&r)return`Content-Type ${n} is not supported`;const{hostname:o,isHostDenied:a}=cp(i,t);return a?o+" is in deny list":null}({r:e,options:t,url:i});return It(s)?Ip(e,t):Promise.resolve(s)}),Pp.apply(this,arguments)}let Mp=null;function Fp(e,t,i){if(!("performance"in t))return()=>{};if(Mp)return up.warn("Network observer already initialised, doing nothing"),()=>{};const s=i?Object.assign({},jr,i):jr,n=t=>{const i=[];let n=!1;t.requests.forEach(e=>{const t="serverTiming"===e.entryType;if(t&&n)return;const r=s.maskRequestFn(e);t||(n=!r||(e=>!!e&&Xr.has(e))(r)),r&&i.push(r)}),i.length>0&&e(at(at({},t),{},{requests:i}))},r=function(e,t,i){i.recordInitialRequests&&e({requests:t.performance.getEntries().filter(e=>dp(e)||hp(e)&&i.initiatorTypes.includes(e.initiatorType)).flatMap(e=>Sp({entry:e,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0});const s=new t.PerformanceObserver(t=>{e({requests:t.getEntries().filter(e=>dp(e)||hp(e)&&i.initiatorTypes.includes(e.initiatorType)&&(e=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType)(e)).flatMap(e=>Sp({entry:e,method:void 0,status:void 0,networkRequest:{}}))})}),n=PerformanceObserver.supportedEntryTypes.filter(e=>i.performanceEntryTypeToObserve.includes(e));return s.observe({entryTypes:n}),()=>{s.disconnect()}}(n,t,s);let o=()=>{},a=()=>{};return(s.recordHeaders||s.recordBody)&&(o=function(e,t,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const s=pp("request",i.recordHeaders),n=pp("response",i.recordHeaders),r=lp(t.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,c,u){const d=this;try{const r=new Request(a),l={};let c,u;const h={},p=d.setRequestHeader.bind(d);d.setRequestHeader=(e,t)=>(h[e]=t,p(e,t)),s&&(l.requestHeaders=h);const _=d.send.bind(d);d.send=e=>(fp({type:"request",headers:h,url:a,recordBody:i.recordBody})&&(l.requestBody=yp({body:e,options:i,url:a})),c=t.performance.now(),_(e));const g=()=>{d.removeEventListener("readystatechange",f),d.removeEventListener("error",g),d.removeEventListener("abort",g),d.removeEventListener("timeout",g)},f=()=>{if(d.readyState!==d.DONE)return;g(),u=t.performance.now();const s={};d.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(e=>{const t=e.split(": "),i=t.shift(),n=t.join(": ");i&&(s[i]=n)}),n&&(l.responseHeaders=s),fp({type:"response",headers:s,url:a,recordBody:i.recordBody})&&(l.responseBody=yp({body:d.response,options:i,url:a})),vp(t,"xmlhttprequest",r.url,c,u).then(t=>{e({requests:Sp({entry:t,method:o,status:null==d?void 0:d.status,networkRequest:l,start:c,end:u,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};d.addEventListener("readystatechange",f),d.addEventListener("error",g),d.addEventListener("abort",g),d.addEventListener("timeout",g)}catch(e){up.error("Failed to instrument XHR for network capture",e)}r.call(d,o,a.toString(),l,c,u)});return()=>{r()}}(n,t,s),a=function(e,t,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const s=pp("request",i.recordHeaders),n=pp("response",i.recordHeaders),r=lp(t,"fetch",r=>function(){var o=st(function*(o,a){let l,c;try{l=new Request(o,a)}catch(e){return up.error("Failed to instrument fetch for network capture",e),r(o,a)}const u={};let d,h;try{try{const e={};l.headers.forEach((t,i)=>{e[i]=t}),s&&(u.requestHeaders=e),!kp(null==a?void 0:a.body)&&fp({type:"request",headers:e,url:o,recordBody:i.recordBody})&&(u.requestBody=yield function(e){return Rp.apply(this,arguments)}({r:l,options:i,url:o}))}catch(e){up.error("Failed to record fetch request for network capture",e)}d=t.performance.now(),c=_p(o)?yield r(l):yield r(o,a),h=t.performance.now();try{const e={};c.headers.forEach((t,i)=>{e[i]=t}),n&&(u.responseHeaders=e),fp({type:"response",headers:e,url:o,recordBody:i.recordBody})&&(u.responseBody=yield function(e){return Pp.apply(this,arguments)}({r:c,options:i,url:o}))}catch(e){up.error("Failed to record fetch response for network capture",e)}return c}finally{vp(t,"fetch",l.url,d,h).then(t=>{e({requests:Sp({entry:t,method:l.method,status:null==c?void 0:c.status,networkRequest:u,start:d,end:h,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(e,t){return o.apply(this,arguments)}}());return()=>{r()}}(n,t,s)),Mp=()=>{r(),o(),a(),Mp=null},Mp}const Lp=e=>({name:"rrweb/network@1",observer:Fp,options:e});var Ap,Op,$p,Dp,Np,Bp,qp,Hp,Up,Wp,zp,jp,Vp,Gp,Qp;h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:rp,getRecordNetworkPlugin:Lp},h.__PosthogExtensions__.rrweb={record:Wh,version:"v2",wasMaxDepthReached:()=>_d,resetMaxDepthState(){_d=!1,pd=!1},getLastSnapshotCost:()=>iu,getMutationCost:()=>at({},au),resetSnapshotCostState(){Jc=0,Xc=0,eu=0,Qc=0,tu={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},iu=null,su=null,nu=[],ru=0,ou=0,au={slowestBatchMs:0},lu={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},h.rrweb={record:Wh,version:"v2"},h.rrwebConsoleRecord={getRecordConsolePlugin:rp},h.getRecordNetworkPlugin=Lp,h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initSessionRecording=(e,t)=>new Ec(e,t);var Kp,Zp,Yp,Jp,Xp={},e_=[],t_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,i_=Array.isArray;function s_(e,t){for(var i in t)e[i]=t[i];return e}function n_(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function r_(e,t,i){var s,n,r,o={};for(r in t)"key"==r?s=t[r]:"ref"==r?n=t[r]:o[r]=t[r];if(arguments.length>2&&(o.children=arguments.length>3?Ap.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(r in e.defaultProps)void 0===o[r]&&(o[r]=e.defaultProps[r]);return o_(e,o,s,n,null)}function o_(e,t,i,s,n){var r={type:e,props:t,key:i,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==n?++$p:n,__i:-1,__u:0};return null==n&&null!=Op.vnode&&Op.vnode(r),r}function a_(e){return e.children}function l_(e,t){this.props=e,this.context=t}function c_(e,t){if(null==t)return e.__?c_(e.__,e.__i+1):null;for(var i;e.__k.length>t;t++)if(null!=(i=e.__k[t])&&null!=i.__e)return i.__e;return"function"==typeof e.type?c_(e):null}function u_(e){if(e.__P&&e.__d){var t=e.__v,i=t.__e,s=[],n=[],r=s_({},t);r.__v=t.__v+1,Op.vnode&&Op.vnode(r),b_(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[i]:null,s,null==i?c_(t):i,!!(32&t.__u),n),r.__v=t.__v,r.__.__k[r.__i]=r,w_(s,r,n),t.__e=t.__=null,r.__e!=i&&d_(r)}}function d_(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}),d_(e)}function h_(e){(!e.__d&&(e.__d=!0)&&Dp.push(e)&&!p_.__r++||Np!=Op.debounceRendering)&&((Np=Op.debounceRendering)||Bp)(p_)}function p_(){try{for(var e,t=1;Dp.length;)Dp.length>t&&Dp.sort(qp),e=Dp.shift(),t=Dp.length,u_(e)}finally{Dp.length=p_.__r=0}}function __(e,t,i,s,n,r,o,a,l,c,u){var d,h,p,_,g,f,v,m=s&&s.__k||e_,y=t.length;for(l=function(e,t,i,s,n){var r,o,a,l,c,u=i.length,d=u,h=0;for(e.__k=new Array(n),r=0;n>r;r++)null!=(o=t[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=e.__k[r]=o_(null,o,null,null,null):i_(o)?o=e.__k[r]=o_(a_,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=e.__k[r]=o_(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[r]=o,l=r+h,o.__=e,o.__b=e.__b+1,a=null,-1!=(c=o.__i=f_(o,i,l,d))&&(d--,(a=i[c])&&(a.__u|=2)),null==a||null==a.__v?(-1==c&&(n>u?h--:u>n&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,o.__u|=4))):e.__k[r]=null;if(d)for(r=0;u>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==s&&(s=c_(a)),E_(a,a));return s}(i,t,m,l,y),d=0;y>d;d++)null!=(p=i.__k[d])&&(h=-1!=p.__i&&m[p.__i]||Xp,p.__i=d,f=b_(e,p,h,n,r,o,a,l,c,u),_=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&C_(h.ref,null,p),u.push(p.ref,p.__c||_,p)),null==g&&null!=_&&(g=_),(v=!!(4&p.__u))||h.__k===p.__k?(l=g_(p,l,e,v),v&&h.__e&&(h.__e=null)):"function"==typeof p.type&&void 0!==f?l=f:_&&(l=_.nextSibling),p.__u&=-7);return i.__e=g,l}function g_(e,t,i,s){var n,r;if("function"==typeof e.type){for(n=e.__k,r=0;n&&n.length>r;r++)n[r]&&(n[r].__=e,t=g_(n[r],t,i,s));return t}e.__e!=t&&(s&&(t&&e.type&&!t.parentNode&&(t=c_(e)),i.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function f_(e,t,i,s){var n,r,o,a=e.key,l=e.type,c=t[i],u=null!=c&&!(2&c.__u);if(null===c&&null==a||u&&a==c.key&&l==c.type)return i;if(s>(u?1:0))for(n=i-1,r=i+1;n>=0||t.length>r;)if(null!=(c=t[o=0>n?r++:n--])&&!(2&c.__u)&&a==c.key&&l==c.type)return o;return-1}function v_(e,t,i){"-"==t[0]?e.setProperty(t,null==i?"":i):e[t]=null==i?"":"number"!=typeof i||t_.test(t)?i:i+"px"}function m_(e,t,i,s,n){var r,o;e:if("style"==t)if("string"==typeof i)e.style.cssText=i;else{if("string"==typeof s&&(e.style.cssText=s=""),s)for(t in s)i&&t in i||v_(e.style,t,"");if(i)for(t in i)s&&i[t]==s[t]||v_(e.style,t,i[t])}else if("o"==t[0]&&"n"==t[1])r=t!=(t=t.replace(zp,"$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+r]=i,i?s?i[Wp]=s[Wp]:(i[Wp]=jp,e.addEventListener(t,r?Gp:Vp,r)):e.removeEventListener(t,r?Gp:Vp,r);else{if("http://www.w3.org/2000/svg"==n)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==i?"":i;break e}catch(e){}"function"==typeof i||(null==i||!1===i&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==i?"":i))}}function y_(e){return function(t){if(this.l){var i=this.l[t.type+e];if(null==t[Up])t[Up]=jp++;else if(i[Wp]>t[Up])return;return i(Op.event?Op.event(t):t)}}}function b_(e,t,i,s,n,r,o,a,l,c){var u,d,h,p,_,g,f,v,m,y,$,b,S,w,k,C,E=t.type;if(void 0!==t.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=t.__e=i.__e]),(u=Op.__b)&&u(t);e:if("function"==typeof E){d=o.length;try{if(m=t.props,y=E.prototype&&E.prototype.render,$=(u=E.contextType)&&s[u.__c],b=u?$?$.props.value:u.__:s,i.__c?v=(h=t.__c=i.__c).__=h.__E:(y?t.__c=h=new E(m,b):(t.__c=h=new l_(m,b),h.constructor=E,h.render=x_),$&&$.sub(h),h.state||(h.state={}),h.__n=s,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=s_({},h.__s)),s_(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==i.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,b)){t.__v!=i.__v&&(h.props=m,h.state=h.__s,h.__d=!1),t.__e=i.__e,t.__k=i.__k,t.__k.some(function(e){e&&(e.__=t)}),e_.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,f)})}if(h.context=b,h.props=m,h.__P=e,h.__e=!1,S=Op.__r,w=0,y)h.state=h.__s,h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),e_.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,S&&S(t),u=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&25>++w);h.state=h.__s,null!=h.getChildContext&&(s=s_(s_({},s),h.getChildContext())),y&&!p&&null!=h.getSnapshotBeforeUpdate&&(f=h.getSnapshotBeforeUpdate(_,g)),k=null!=u&&u.type===a_&&null==u.key?k_(u.props.children):u,a=__(e,i_(k)?k:[k],t,i,s,n,r,o,a,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&o.push(h),v&&(h.__E=h.__=null)}catch(e){if(o.length=d,t.__v=null,l||null!=r)if(e.then){for(t.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),t.__e=a}else{if(null!=r)for(C=r.length;C--;)n_(r[C]);S_(t)}else t.__e=i.__e,!t.__k&&i.__k&&(t.__k=i.__k),e.then||S_(t);Op.__e(e,t,i)}}else null==r&&t.__v==i.__v?(t.__k=i.__k,t.__e=i.__e):a=t.__e=function(e,t,i,s,n,r,o,a,l){var c,u,d,h,p,_,g,f=i.props||Xp,v=t.props,m=t.type;if("svg"==m?n="http://www.w3.org/2000/svg":"math"==m?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),null!=r)for(c=0;r.length>c;c++)if((p=r[c])&&"setAttribute"in p==!!m&&(m?p.localName==m:3==p.nodeType)){e=p,r[c]=null;break}if(null==e){if(null==m)return document.createTextNode(v);e=document.createElementNS(n,m,v.is&&v),a&&(Op.__m&&Op.__m(t,r),a=!1),r=null}if(null==m)f===v||a&&e.data==v||(e.data=v);else{if(r="textarea"==m&&null!=v.defaultValue?null:r&&Ap.call(e.childNodes),!a&&null!=r)for(f={},c=0;e.attributes.length>c;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)p=f[c],"dangerouslySetInnerHTML"==c?d=p:"children"==c||c in v||"value"==c&&"defaultValue"in v||"checked"==c&&"defaultChecked"in v||m_(e,c,null,p,n);for(c in v)p=v[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?u=p:"value"==c?_=p:"checked"==c?g=p:a&&"function"!=typeof p||f[c]===p||m_(e,c,p,f[c],n);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),__("template"==t.type?e.content:e,i_(h)?h:[h],t,i,s,"foreignObject"==m?"http://www.w3.org/1999/xhtml":n,r,o,r?r[0]:i.__k&&c_(i,0),a,l),null!=r)for(c=r.length;c--;)n_(r[c]);a&&"textarea"!=m||(c="value","progress"==m&&null==_?e.removeAttribute("value"):null!=_&&(_!==e[c]||"progress"==m&&!_||"option"==m&&_!=f[c])&&m_(e,c,_,f[c],n),c="checked",null!=g&&g!=e[c]&&m_(e,c,g,f[c],n))}return e}(i.__e,t,i,s,n,r,o,l,c);return(u=Op.diffed)&&u(t),128&t.__u?void 0:a}function S_(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(S_))}function w_(e,t,i){for(var s=0;i.length>s;s++)C_(i[s],i[++s],i[++s]);Op.__c&&Op.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){Op.__e(e,t.__v)}})}function k_(e){return"object"!=typeof e||null==e||e.__b>0?e:i_(e)?e.map(k_):void 0!==e.constructor?null:s_({},e)}function C_(e,t,i){try{if("function"==typeof e){var s="function"==typeof e.__u;s&&e.__u(),s&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Op.__e(e,i)}}function E_(e,t,i){var s,n;if(Op.unmount&&Op.unmount(e),(s=e.ref)&&(s.current&&s.current!=e.__e||C_(s,null,t)),null!=(s=e.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(e){Op.__e(e,t)}s.base=s.__P=s.__n=null}if(s=e.__k)for(n=0;s.length>n;n++)s[n]&&E_(s[n],t,i||"function"!=typeof e.type);i||n_(e.__e),e.__c=e.__=e.__e=void 0}function x_(e,t,i){return this.constructor(e,i)}function T_(e,t,i){var s,n,r,o;t==document&&(t=document.documentElement),Op.__&&Op.__(e,t),n=(s="function"==typeof i)?null:i&&i.__k||t.__k,r=[],o=[],b_(t,e=(!s&&i||t).__k=r_(a_,null,[e]),n||Xp,Xp,t.namespaceURI,!s&&i?[i]:n?null:t.firstChild?Ap.call(t.childNodes):null,r,!s&&i?i:n?n.__e:t.firstChild,s,o),w_(r,e,o),e.props.children=null}Ap=e_.slice,Op={__e(e,t,i,s){for(var n,r,o;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e,s||{}),o=n.__d),o)return n.__E=n}catch(t){e=t}throw e}},$p=0,l_.prototype.setState=function(e,t){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=s_({},this.state);"function"==typeof e&&(e=e(s_({},i),this.props)),e&&s_(i,e),null!=e&&this.__v&&(t&&this._sb.push(t),h_(this))},l_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),h_(this))},l_.prototype.render=a_,Dp=[],Bp="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qp=function(e,t){return e.__v.__b-t.__v.__b},p_.__r=0,Hp=Math.random().toString(8),Up="__d"+Hp,Wp="__a"+Hp,zp=/(PointerCapture)$|Capture$/i,jp=0,Vp=y_(!1),Gp=y_(!0),Qp=0;var I_=0,R_=[],P_=Op,M_=P_.__b,F_=P_.__r,L_=P_.diffed,A_=P_.__c,O_=P_.unmount,$_=P_.__;function D_(e,t){P_.__h&&P_.__h(Zp,e,I_||t),I_=0;var i=Zp.__H||(Zp.__H={__:[],__h:[]});return e>=i.__.length&&i.__.push({}),i.__[e]}function N_(e){return I_=1,function(e,t){var i=D_(Kp++,2);if(i.t=e,!i.__c&&(i.__=[K_(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],s=i.t(t,e);t!==s&&(i.__N=[s,i.__[1]],i.__c.setState({}))}],i.__c=Zp,!Zp.__f)){var s=function(e,t,s){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==e;if(i.__c.__H.__.some(function(e){if(e.__N){r=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),n){var a=n.call(this,e,t,s);return r?a||o:a}return!r||o};Zp.__f=!0;var n=Zp.shouldComponentUpdate,r=Zp.componentWillUpdate;Zp.componentWillUpdate=function(e,t,i){if(this.__e){var o=n;n=void 0,s(e,t,i),n=o}r&&r.call(this,e,t,i)},Zp.shouldComponentUpdate=s}return i.__N||i.__}(K_,e)}function B_(e,t){var i=D_(Kp++,3);!P_.__s&&Q_(i.__H,t)&&(i.__=e,i.u=t,Zp.__H.__h.push(i))}function q_(e){return I_=5,H_(function(){return{current:e}},[])}function H_(e,t){var i=D_(Kp++,7);return Q_(i.__H,t)&&(i.__=e(),i.__H=t,i.__h=e),i.__}function U_(e){var t=Zp.context[e.__c],i=D_(Kp++,9);return i.c=e,t?(null==i.__&&(i.__=!0,t.sub(Zp)),t.props.value):e.__}function W_(){for(var e;e=R_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(V_),t.__h.some(G_),t.__h=[]}catch(i){t.__h=[],P_.__e(i,e.__v)}}}P_.__b=function(e){Zp=null,M_&&M_(e)},P_.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),$_&&$_(e,t)},P_.__r=function(e){F_&&F_(e),Kp=0;var t=(Zp=e.__c).__H;t&&(Yp===Zp?(t.__h=[],Zp.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&W_(),Kp=0)),Yp=Zp},P_.diffed=function(e){L_&&L_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==R_.push(t)&&Jp===P_.requestAnimationFrame||((Jp=P_.requestAnimationFrame)||j_)(W_)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),Yp=Zp=null},P_.__c=function(e,t){t.some(function(e){try{e.__h.some(V_),e.__h=e.__h.filter(function(e){return!e.__||G_(e)})}catch(i){t.some(function(e){e.__h&&(e.__h=[])}),t=[],P_.__e(i,e.__v)}}),A_&&A_(e,t)},P_.unmount=function(e){O_&&O_(e);var t,i=e.__c;i&&i.__H&&(i.__H.__.some(function(e){try{V_(e)}catch(e){t=e}}),i.__H=void 0,t&&P_.__e(t,i.__v))};var z_="function"==typeof requestAnimationFrame;function j_(e){var t,i=function(){clearTimeout(s),z_&&cancelAnimationFrame(t),setTimeout(e)},s=setTimeout(i,35);z_&&(t=requestAnimationFrame(i))}function V_(e){var t=Zp,i=e.__c;"function"==typeof i&&(e.__c=void 0,i()),Zp=t}function G_(e){var t=Zp;e.__c=e.__(),Zp=t}function Q_(e,t){return!e||e.length!==t.length||t.some(function(t,i){return t!==e[i]})}function K_(e,t){return"function"==typeof t?t(e):t}const Z_={GZipJS:"gzip-js",Base64:"base64"},Y_={Activation:"events",Cancellation:"cancelEvents"},J_={Button:"button",Tab:"tab",Selector:"selector"},X_={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"},eg={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},tg={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ig={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},sg={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},ng={Once:"once",Recurring:"recurring",Always:"always"},rg={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},og={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"},ag={Popover:"popover",Inline:"inline"};function lg(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&wt(i.then)&&i.then(void 0,()=>{})}}}}const cg=Ln("[Surveys]"),ug="PostHog is not capturing, so a survey response cannot be recorded";function dg(e){return wt(e.is_capturing)?e.is_capturing():!e.has_opted_out_capturing()}function hg(e){return!(!e.start_date||e.end_date)}function pg(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const _g=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,gg=e=>_g("seenSurvey_",e),fg=e=>{try{const t=gg(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){cg.error("Failed to persist survey seen state",e)}},vg=[tg.Popover,tg.Widget,tg.API],mg={ignoreConditions:!1,ignoreDelay:!1,displayType:ag.Popover},yg="logs",bg=Ln("[Stylesheet Loader]"),Sg=e,wg=s,kg="#020617",Cg={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:X_.Right,widgetType:J_.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:kg,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},Eg=[X_.Center,X_.Left,X_.Right];function xg(e){if(e.startsWith("#")){let 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 Tg(e=Cg.backgroundColor){let t;"#"===e[0]&&(t=xg(e)),e.startsWith("rgb")&&(t=e);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(i&&(t=xg(i)),!t)return kg;const s=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(s){const e=parseInt(s[1]),t=parseInt(s[2]),i=parseInt(s[3]);return Math.sqrt(e*e*.299+t*t*.587+i*i*.114)>127.5?kg:"white"}return kg}const Ig=(e,t,i)=>{const s=Gg(e),n=wg.querySelector(`.${s}`);if(n&&n.shadowRoot)return{shadow:n.shadowRoot,isNewlyCreated:!1};const r=wg.createElement("div");((e,t,i)=>{const s=at(at({},Cg),i),n=e.style,r=!Eg.includes(s.position)||t===tg.Widget&&(null==i?void 0:i.widgetType)===J_.Tab;n.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const 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}`}(s.fontFamily)),n.setProperty("--ph-survey-box-padding",s.boxPadding),n.setProperty("--ph-survey-max-width",s.maxWidth),n.setProperty("--ph-survey-z-index",s.zIndex),n.setProperty("--ph-survey-border-color",s.borderColor),r?(n.setProperty("--ph-survey-border-radius",s.borderRadius),n.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(n.setProperty("--ph-survey-border-bottom","none"),n.setProperty("--ph-survey-border-radius",`${s.borderRadius} ${s.borderRadius} 0 0`)),n.setProperty("--ph-survey-background-color",s.backgroundColor),n.setProperty("--ph-survey-box-shadow",s.boxShadow),n.setProperty("--ph-survey-disabled-button-opacity",s.disabledButtonOpacity),n.setProperty("--ph-survey-submit-button-color",s.submitButtonColor),n.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||Tg(s.submitButtonColor)),n.setProperty("--ph-survey-rating-bg-color",s.ratingButtonColor),n.setProperty("--ph-survey-rating-active-bg-color",s.ratingButtonActiveColor),n.setProperty("--ph-survey-rating-active-text-color",Tg(s.ratingButtonActiveColor)),n.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||Tg(s.backgroundColor)),n.setProperty("--ph-survey-text-subtle-color",s.textSubtleColor),n.setProperty("--ph-widget-color",s.widgetColor),n.setProperty("--ph-widget-text-color",Tg(s.widgetColor)),n.setProperty("--ph-widget-z-index",s.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||s.inputBackground;o||"white"!==s.backgroundColor||(a="#f8f8f8"),n.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||Tg(a);n.setProperty("--ph-survey-input-text-color",l),n.setProperty("--ph-survey-rating-text-color",l),n.setProperty("--ph-survey-scrollbar-thumb-color",s.scrollbarThumbColor),n.setProperty("--ph-survey-scrollbar-track-color",s.scrollbarTrackColor),n.setProperty("--ph-survey-outline-color",s.outlineColor)})(r,e.type,e.appearance),r.className=s;const o=r.attachShadow({mode:"open"}),a=function(e){const t=((e,t,i)=>{let s=e.createElement("style");s.innerText=t;const n=(e=>{var t;return wt(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(i);return n&&(s=n(s)),s||(bg.error("prepare_external_dependency_stylesheet returned null"),null)})(wg,':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(a){const e=o.querySelector("style");e&&o.removeChild(e),o.appendChild(a)}return(i||wg.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},Rg=({responses:e,survey:t,surveySubmissionId:i,posthog:s,isSurveyCompleted:n,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;s?dg(s)&&(fg(t),s.capture(rg.SENT,at(at(at(at({[og.SURVEY_NAME]:t.name,[og.SURVEY_ID]:t.id,[og.SURVEY_ITERATION]:t.current_iteration,[og.SURVEY_ITERATION_START_DATE]:t.current_iteration_start_date,[og.SURVEY_SUBMISSION_ID]:i,[og.SURVEY_COMPLETED]:n},o&&{[og.SURVEY_LANGUAGE]:o}),{},{sessionRecordingUrl:null===(l=s.get_session_replay_url)||void 0===l?void 0:l.call(s)},za(e,t,a)),r),{},{$set:{[Va(t,"responded")]:!0}})),n&&(Sg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),Vg(t),s.reloadFeatureFlags())):cg.error("[survey sent] event not captured, PostHog instance not found.")},Pg=(e,t,i)=>{var s;return at(at({[og.SURVEY_NAME]:e.name,[og.SURVEY_ID]:e.id,[og.SURVEY_ITERATION]:e.current_iteration,[og.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date,[og.SURVEY_PARTIALLY_COMPLETED]:ja(null==t?void 0:t.responses)},(null==t?void 0:t.surveyLanguage)&&{[og.SURVEY_LANGUAGE]:t.surveyLanguage}),{},{sessionRecordingUrl:null===(s=i.get_session_replay_url)||void 0===s?void 0:s.call(i),[og.SURVEY_SUBMISSION_ID]:null==t?void 0:t.surveySubmissionId},za(null==t?void 0:t.responses,e,null==t?void 0:t.questionSnapshots))},Mg=(e,t,i,s)=>{if(!t)return void cg.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const n=zg(e),r=n?n.surveyLanguage:s;t.capture(rg.DISMISSED,at(at(at({},Pg(e,n,t)),r&&{[og.SURVEY_LANGUAGE]:r}),{},{$set:{[Va(e,"dismissed")]:!0}})),Vg(e),fg(e),Sg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},Fg=(e,t)=>{if(!t)return void cg.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(e=>_g("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(i))return}catch(e){return}const s=zg(e);if(s){try{localStorage.setItem(i,"true")}catch(e){}t.capture(rg.ABANDONED,Pg(e,s,t),{transport:"sendBeacon"})}},Lg=e=>e.map(e=>({sort:Math.floor(10*Math.random()),value:e})).sort((e,t)=>e.sort-t.sort).map(e=>e.value),Ag=(e,t)=>e.length===t.length&&e.every((e,i)=>e===t[i])?t.reverse():t,Og=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},$g=(e,t)=>{return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(i=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const i=new Map(e.questions.map(e=>[e.id,e])),s=[];for(const e of t){const t=i.get(e);if(!t)return null;s.push(t)}return s})(e,t.questionOrder))&&void 0!==i?i:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?Ag(e.questions,Lg(e.questions)):e.questions;var i},Dg=e=>Xa(e)||jg(e),Ng=function(e){function t(e){var i,s;return this.getChildContext||(i=new Set,(s={})[t.__c]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&i.forEach(function(e){e.__e=!0,h_(e)})},this.sub=function(e){i.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){i&&i.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}),Bg=()=>U_(Ng),qg=({component:e,children:t,renderAsHtml:i,style:s})=>function(e,t,i){var s,n,r,o,a=s_({},e.props);for(r in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)"key"==r?s=t[r]:"ref"==r?n=t[r]:a[r]=void 0===t[r]&&null!=o?o[r]:t[r];return arguments.length>2&&(a.children=arguments.length>3?Ap.call(arguments,2):i),o_(e.type,a,s||e.key,n||e.ref,null)}(e,i?{dangerouslySetInnerHTML:{__html:t},style:s}:{children:t,style:s});function Hg(e,t){var i,s;if(!(null===(i=e.conditions)||void 0===i?void 0:i.url))return!0;const n=ir(t);if(!n)return!1;const r=[e.conditions.url],o=function(e){return null!=e?e:"icontains"}(null===(s=e.conditions)||void 0===s?void 0:s.urlMatchType);return il[o](r,[n])}const Ug=e=>_g("inProgressSurvey_",e),Wg=(e,t)=>{try{localStorage.setItem(Ug(e),JSON.stringify(t))}catch(e){cg.error("Error setting in-progress survey state in localStorage",e)}},zg=e=>{try{const t=localStorage.getItem(Ug(e));if(t)return JSON.parse(t)}catch(e){cg.error("Error getting in-progress survey state from localStorage",e)}return null},jg=e=>{const t=zg(e);return!Rt(null==t?void 0:t.surveySubmissionId)},Vg=e=>{try{localStorage.removeItem(Ug(e))}catch(e){cg.error("Error clearing in-progress survey state from localStorage",e)}};function Gg(e,t=!1){const i=`PostHogSurvey-${e.id}`;return t?`.${i}`:i}function Qg(e,t=X_.Right,i){if(e===tg.ExternalSurvey)return{};switch(t){case X_.TopLeft:return{top:"0",left:"0",transform:"translate(30px, 30px)"};case X_.TopRight:return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case X_.TopCenter:return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case X_.MiddleLeft:return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case X_.MiddleRight:return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case X_.MiddleCenter:return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case X_.Left:return{left:"30px"};case X_.Center:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===tg.Widget&&i===J_.Tab?"60px":"30px"}}}var Kg=0;function Zg(e,t,i,s,n,r){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 c={type:e,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Kg,__i:-1,__u:0,__source:n,__self:r};if("function"==typeof e&&(o=e.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return Op.vnode&&Op.vnode(c),c}const Yg=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),Jg=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),Xg=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),ef=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),tf=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Zg("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"})}),sf=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Zg("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"})}),nf=Zg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Zg("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"})}),rf=({fill:e="currentColor"}={})=>Zg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Zg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Zg("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:e})]}),of=Zg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Zg("g",{"clip-path":"url(#clip0_2415_6911)",children:[Zg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Zg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Zg("g",{mask:"url(#mask0_2415_6911)",children:[Zg("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"}),Zg("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"}),Zg("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"}),Zg("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"}),Zg("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"}),Zg("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"})]})]}),Zg("defs",{children:Zg("clipPath",{id:"clip0_2415_6911",children:Zg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function af({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return Zg("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",of]})}function lf({text:t,submitDisabled:i,appearance:s,onSubmit:n,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:c}){const{isPreviewMode:u}=U_(Ng),d=!!l&&!!c,h=!a&&Zg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==e||e.open(r)),u?null==o||o():n()},children:t});return Zg("div",{className:"bottom-section",children:[d?Zg("div",{className:"form-buttons form-buttons-with-back",children:[Zg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:c,children:s.backButtonText||"Back"}),h]}):h,!s.whiteLabel&&Zg(af,{urlParams:{utm_source:"survey-footer"}})]})}function cf({question:e,forceDisableHtml:t,htmlFor:i}){return Zg("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[Zg(e.type===ig.Open?"label":"h3",{className:"survey-question",htmlFor:i,children:e.question}),e.description&&qg({component:r_("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function uf({onClick:e}){const{isPreviewMode:t}=U_(Ng);return Zg("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:rf({fill:"black"})})}const df=e;function hf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onClose:r}){const{isPopup:o}=U_(Ng);return B_(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),r())};return zn(df,"keydown",e),()=>{df.removeEventListener("keydown",e)}},[r]),Zg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Zg(uf,{onClick:()=>r()}),Zg("h3",{className:"thank-you-message-header",children:e}),t&&qg({component:r_("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!s&&"text"!==i}),o&&Zg(lf,{text:n.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:n,onSubmit:()=>r()})]})}function pf({header:e,description:t,contentType:i,forceDisableHtml:s,appearance:n,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=U_(Ng);return Zg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==n.hideCancelButton&&Zg(uf,{onClick:()=>l()}),e&&Zg("h3",{className:"intro-screen-header",children:e}),t&&qg({component:r_("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!s&&"text"!==i}),Zg(lf,{text:n.introScreenButtonText||"Get started",submitDisabled:!1,appearance:n,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const _f=e=>St(e)&&e.every(e=>xt(e));function gf({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:c}=Bg(),u=q_(null),[d,h]=N_(()=>xt(o)?o:""),p=null==i?void 0:i.disableAutofocus;B_(()=>{p||setTimeout(()=>{var e;c||null===(e=u.current)||void 0===e||e.focus()},100)},[c,p]);const _=`surveyQuestion${r}`,g=H_(()=>function(e,t,i){const s=e.trim();if(!i&&""===s)return"This field is required";if(""===s)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case ut:var n;if(void 0!==e.value&&e.value>s.length)return null!==(n=e.errorMessage)&&void 0!==n?n:`Please enter at least ${e.value} characters`;break;case dt:var r;if(void 0!==e.value&&s.length>e.value)return null!==(r=e.errorMessage)&&void 0!==r?r:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),f=In(e.validation,ut),v=In(e.validation,dt),m=H_(()=>function(e,t){const i=1===e?void 0:e;return i&&t?`Enter ${i}-${t} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(f,v),[f,v]),y=()=>{g||s(d.trim())},b=()=>{g||n(d.trim())};return Zg(a_,{children:[Zg("div",{className:"question-container",children:[Zg(cf,{question:e,forceDisableHtml:t,htmlFor:_}),Zg("textarea",{ref:u,id:_,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:f,maxLength:v,onInput(e){h(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||g||(e.preventDefault(),c?b():y())},value:d}),m&&Zg("div",{className:"validation-hint",children:m})]}),Zg(lf,{text:e.buttonText||"Submit",submitDisabled:!!g,appearance:i,onSubmit:y,onPreviewSubmit:b,canGoBack:a,onBack:l})]})}function ff({question:e,forceDisableHtml:t,appearance:i,onSubmit:s,onPreviewSubmit:n,canGoBack:r,onBack:o}){return Zg(a_,{children:[Zg("div",{className:"question-container",children:Zg(cf,{question:e,forceDisableHtml:t})}),Zg(lf,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:i,onSubmit:()=>s("link clicked"),onPreviewSubmit:()=>n("link clicked"),canGoBack:r,onBack:o})]})}function vf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var c;const u=e.scale,d=10===e.scale?0:1,[h,p]=N_(()=>Pt(o)?o:St(o)&&o.length>0&&Pt(parseInt(o[0]))?parseInt(o[0]):xt(o)&&Pt(parseInt(o))?parseInt(o):null),_="emoji"===e.display&&2===e.scale,{isPreviewMode:g}=Bg(),f=e=>g?r(e):n(e);return Zg(a_,{children:[Zg("div",{className:"question-container",children:[Zg(cf,{question:e,forceDisableHtml:t}),Zg("div",{className:"rating-section",children:[Zg("div",{className:"rating-options",children:["emoji"===e.display&&Zg("div",{className:"rating-options-emoji"+(_?" rating-options-emoji-2":""),children:null===(c=kf[e.scale])||void 0===c?void 0:c.map((t,s)=>Zg("button",{"aria-label":`Rate ${s+1}`,className:`ratings-emoji question-${i}-rating-${s} ${s+1===h?"rating-active":""}`,value:s+1,type:"button",onClick(){const t=s+1;p(t),e.skipSubmitButton&&f(t)},children:t},s))}),"number"===e.display&&Zg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${u-d+1}, minmax(0, 1fr))`},children:Cf(e.scale).map((t,n)=>Zg(mf,{displayQuestionIndex:i,active:h===t,appearance:s,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&f(t)}},n))})]}),!_&&Zg("div",{className:"rating-text",children:[Zg("div",{children:e.lowerBoundLabel}),Zg("div",{children:e.upperBoundLabel})]})]})]}),Zg(lf,{text:e.buttonText||(null==s?void 0:s.submitButtonText)||"Submit",submitDisabled:It(h)&&!e.optional,appearance:s,onSubmit:()=>n(h),onPreviewSubmit:()=>r(h),skipSubmitButton:e.skipSubmitButton,canGoBack:a,onBack:l})]})}function mf({num:e,active:t,displayQuestionIndex:i,setActiveNumber:s}){return Zg("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${i}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){s(e)},children:e})}function yf({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const c=q_(null),u=H_(()=>(e=>{if(!e.shuffleOptions)return e.choices;const t=e.choices;let i="";e.hasOpenChoice&&(i=t.pop());const s=Ag(t,Lg(t));return e.hasOpenChoice&&(e.choices.push(i),s.push(i)),s})(e),[e]),[d,h]=N_(()=>((e,t)=>xt(e)||_f(e)?e:t===ig.SingleChoice?null:[])(o,e.type)),[p,_]=N_(()=>((e,t)=>{if(xt(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(_f(e)){const i=e.find(e=>!t.includes(e));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,u)),{isPreviewMode:g}=Bg(),f=e.type===ig.SingleChoice,v=e.type===ig.MultipleChoice,m=e.skipSubmitButton&&f&&!e.hasOpenChoice,y=(e,t)=>{if(t){const e=!p.isSelected;return _(t=>at(at({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),f&&h(""),void(e&&setTimeout(()=>{var e;return null===(e=c.current)||void 0===e?void 0:e.focus()},75))}if(f)return h(e),_(e=>at(at({},e),{},{isSelected:!1,inputValue:""})),void(m&&(n(e),g&&r(e)));v&&St(d)&&(d.includes(e)?h(d.filter(t=>t!==e)):h([...d,e]))},b=e=>{e.stopPropagation();const t=e.currentTarget.value;_(e=>at(at({},e),{},{inputValue:t})),f&&h(t)},S=e=>{e.stopPropagation(),"Enter"!==e.key||w()||(e.preventDefault(),k()),"Escape"===e.key&&(e.preventDefault(),_(e=>at(at({},e),{},{isSelected:!1,inputValue:""})),f&&h(null))},w=()=>!(e.optional||!It(d)&&(!St(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),k=()=>{p.isSelected&&v?St(d)&&(g?r([...d,p.inputValue]):n([...d,p.inputValue])):g?r(d):n(d)};return Zg(a_,{children:[Zg("div",{className:"question-container",children:[Zg(cf,{question:e,forceDisableHtml:t}),Zg("fieldset",{className:"multiple-choice-options limit-height",children:[Zg("legend",{className:"sr-only",children:v?" Select all that apply":" Select one"}),u.map((t,s)=>{const n=!!e.hasOpenChoice&&s===e.choices.length-1,r=`surveyQuestion${i}Choice${s}`,o=`${r}Open`,a=n?p.isSelected:f?d===t:St(d)&&d.includes(t);return Zg("label",{className:n?"choice-option-open":"",children:[Zg("div",{className:"response-choice",children:[Zg("input",{type:f?"radio":"checkbox",name:r,checked:a,onChange:()=>y(t,n),id:r,"aria-controls":o}),Zg("span",{children:n?`${t}:`:t})]}),n&&Zg("input",{type:"text",ref:c,id:o,name:`question${i}Open`,value:p.inputValue,onKeyDown:S,onInput:b,onClick(e){p.isSelected||y(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},s)})]})]}),Zg(lf,{text:e.buttonText||"Submit",submitDisabled:w(),appearance:s,onSubmit:k,onPreviewSubmit:k,skipSubmitButton:m,canGoBack:a,onBack:l})]})}const bf=[1,2,3,4,5],Sf=[1,2,3,4,5,6,7],wf=[0,1,2,3,4,5,6,7,8,9,10],kf={2:[sf,nf],3:[Xg,Jg,Yg],5:[ef,Xg,Jg,Yg,tf]};function Cf(e){switch(e){case 5:default:return bf;case 7:return Sf;case 10:return wf}}const Ef=Ln("[Surveys]");function xf(e,t,i){var s;const n=e.questions[t],r=t+1;if(!(null===(s=n.branching)||void 0===s?void 0:s.type))return t===e.questions.length-1?sg.End:r;if(n.branching.type===sg.End)return sg.End;if(n.branching.type===sg.SpecificQuestion){if(Number.isInteger(n.branching.index))return n.branching.index}else if(n.branching.type===sg.ResponseBased){if(n.type===ig.SingleChoice){var o;let e=n.choices.indexOf(`${i}`);if(-1===e&&n.hasOpenChoice&&(e=n.choices.length-1),null===(o=n.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===sg.End?sg.End:r}}else if(n.type===ig.Rating){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const e=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")}(i,n.scale);if(null===(a=n.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(e)){const t=n.branching.responseValues[e];return Number.isInteger(t)?t:t===sg.End?sg.End:r}}return r}return Ef.warn("Falling back to next question index due to unexpected branching type"),r}const Tf=Ln("[SurveyTranslations]");function If(e,t){const i=function(e){return function({overrideLanguage:e,storedPersonProperties:t,locale:i},s){const n=Ga(e);if(n)return null==s||s.info(`Using override display language: ${n}`),n;const r=function(e){return e&&"object"==typeof e&&"language"in e?Ga(e.language):null}(t);if(r)return null==s||s.info(`Using person property language: ${r}`),r;const o=Ga(i);return o?(null==s||s.info(`Using detected locale: ${o}`),o):(null==s||s.info("No user language detected"),null)}({overrideLanguage:e.config.override_display_language,storedPersonProperties:wt(e.get_property)?e.get_property(re):void 0,locale:yl()},Tf)}(t);if(!i)return Tf.info("No user language detected"),{survey:e,language:null};const s=Ya(e,i,Tf);return{survey:s.survey,language:s.matchedKey}}const Rf=e,Pf=s,Mf="ph:show_survey_widget",Ff="PHWidgetSurveyClickListener";function Lf(e,t){try{const i=e.getBoundingClientRect(),s=Rf.innerHeight,n=Rf.innerWidth;let r=i.left+i.width/2-t/2;r+t>n-20&&(r=n-t-20),20>r&&(r=20);const o=s-i.bottom,a=250>o&&i.top>o;return{position:"fixed",top:a?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:a?s-i.top+12+"px":"auto",zIndex:Cg.zIndex}}catch(e){return cg.warn("Failed to calculate trigger position:",e),null}}var Af=class{constructor(e){this._surveyTimeouts=new Map,this._widgetSelectorListeners=new Map,this._renderedTabWidgets=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._loggedFeatureFlagsDisabledWarning=!1,this.handlePageUnload=()=>{const e=this._posthog.get_property(le);if(e)for(const t of e)jg(t)&&Fg(t,this._posthog)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:i=!1}={})=>{var s,n,r,o,a,l;if(!dg(this._posthog))return;const{survey:c,language:u}=this._translateSurveyForRendering(e);this._currentLanguage=u,this._surveyPopupProps=null,this._displayOptions=t;const d=this._applyDisplayOverrides(c,t);this._clearSurveyTimeout(d.id);const{properties:h,initialResponses:p}=null!=t?t:{},_=!(!p||0>=Object.keys(p).length)&&this._handleInitialResponses(d,p,h,u);if(_&&!(null===(s=d.appearance)||void 0===s?void 0:s.displayThankYouMessage))return;this._addSurveyToFocus(d);let g={};if((null===(n=d.appearance)||void 0===n?void 0:n.position)===X_.NextToTrigger&&(null===(r=d.appearance)||void 0===r?void 0:r.widgetSelector)){const e=Pf.querySelector(d.appearance.widgetSelector);var f;e&&(g=Lf(e,parseInt((null===(f=d.appearance)||void 0===f?void 0:f.maxWidth)||Cg.maxWidth))||{})}const v=(null===(o=d.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:m}=Ig(d,this._posthog);this._renderedTargets.set(m,m.host);const y={posthog:this._posthog,survey:d,removeSurveyFromFocus:this._removeSurveyFromFocus,properties:h,style:g,isSurveyCompleted:_,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:u};if(this._surveyPopupProps=y,0>=v)return this._surveyIsRendered=!0,T_(Zg(Bf,at({},y)),m);const b=()=>{this._surveyIsRendered=!0;const{survey:i,language:s}=this._translateSurveyForRendering(e);this._currentLanguage=s;const n=this._applyDisplayOverrides(i,t),r=at(at({},y),{},{survey:n,surveyLanguage:s});this._surveyPopupProps=r,T_(Zg(Bf,at(at({},r),{},{survey:at(at({},n),{},{appearance:at(at({},n.appearance),{},{surveyPopupDelaySeconds:0})})})),m)},S=()=>{if(!dg(this._posthog)||!this._shouldDisplaySurvey(d))return cg.info(`Survey ${d.id} no longer eligible when its display delay elapsed; not displaying`),this._removeSurveyFromFocus(d);b()},w=i?null===(a=this._posthog.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(l=a.getActivationTimestamp)||void 0===l?void 0:l.call(a,d.id):void 0,k=Pt(w)?Math.max(0,Date.now()-w):0,C=Math.max(0,1e3*v-k);if(0>=C)return S();const E=Rf.setTimeout(()=>{this._surveyTimeouts.delete(d.id),S()},C);this._surveyTimeouts.set(d.id,E)},this._handleWidget=e=>{var t;const{survey:i,language:s}=this._translateSurveyForRendering(e),{shadow:n,isNewlyCreated:r}=Ig(i,this._posthog);this._renderedTargets.set(n,n.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===J_.Tab&&this._renderedTabWidgets.set(e.id,e),r&&T_(Zg(Hf,{posthog:this._posthog,survey:i,surveyLanguage:s},e.id),n)},this._detachWidgetSelectorListener=e=>{const t=this._widgetSelectorListeners.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(Ff),this._widgetSelectorListeners.delete(e),cg.info(`Removed click listener for survey ${e}`))},this._removeWidgetSelectorListener=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._detachWidgetSelectorListener(e.id))},this._removeTabWidget=e=>{this._isWidgetSurveyOpen(e)||(this._removeSurveyFromDom(e),this._renderedTabWidgets.delete(e.id))},this._isWidgetSurveyOpen=e=>{try{var t;const i=Pf.querySelector(Gg(e,!0));return!!(null==i||null===(t=i.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this._manageWidgetSelectorListener=(e,t)=>{const i=Pf.querySelector(t),s=this._widgetSelectorListeners.get(e.id);if(i){if(this._handleWidget(e),s){if(i===s.element)return;cg.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this._detachWidgetSelectorListener(e.id)}if(!i.hasAttribute(Ff)){const t=t=>{var i,s;t.stopPropagation();const n=(null===(i=e.appearance)||void 0===i?void 0:i.position)===X_.NextToTrigger?Lf(t.currentTarget,parseInt((null===(s=e.appearance)||void 0===s?void 0:s.maxWidth)||Cg.maxWidth)):{};Rf.dispatchEvent(new CustomEvent(Mf,{detail:{surveyId:e.id,position:n}}))};zn(i,"click",t),i.setAttribute(Ff,"true"),this._widgetSelectorListeners.set(e.id,{element:i,listener:t,survey:e}),cg.info(`Attached click listener for feedback button survey ${e.id}`)}}else s&&this._removeWidgetSelectorListener(e)},this.renderPopover=e=>{if(!dg(this._posthog))return;const{survey:t,language:i}=this._translateSurveyForRendering(e),{shadow:s}=Ig(t,this._posthog);this._renderedTargets.set(s,s.host),T_(Zg(Bf,{posthog:this._posthog,survey:t,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:i}),s)},this.renderSurvey=(e,t,i)=>{var s;if(!dg(this._posthog))return;const{survey:n,language:r}=this._translateSurveyForRendering(e);let o=!1;(null===(s=this._posthog.config)||void 0===s||null===(s=s.surveys)||void 0===s?void 0:s.prefillFromUrl)&&(o=this._handleUrlPrefill(n,r,i)),T_(Zg(Bf,{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(t=>{e(t.filter(e=>this._shouldDisplaySurvey(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{const t=dg(this._posthog),i=e.filter(e=>t&&(e.type===tg.Popover||e.type===tg.Widget)),s=new Set(i.map(e=>e.id));for(const e of Array.from(this._surveyTimeouts.keys()))s.has(e)||this.cancelSurvey(e);const n=this._sortSurveysByAppearanceDelay(i),r=new Set,o=new Set;n.forEach(e=>{if(e.type===tg.Widget){var t,i,s,n;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===J_.Tab)return o.add(e.id),void this._handleWidget(e);(null===(i=e.appearance)||void 0===i?void 0:i.widgetType)===J_.Selector&&(null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector)&&(r.add(e.id),this._manageWidgetSelectorListener(e,null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector))}It(this._surveyInFocus)&&e.type===tg.Popover&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this._widgetSelectorListeners.forEach(({survey:e})=>{r.has(e.id)||this._removeWidgetSelectorListener(e)}),this._renderedTabWidgets.forEach((e,t)=>{o.has(t)||this._removeTabWidget(e)})},e)},this._addSurveyToFocus=e=>{It(this._surveyInFocus)||cg.error(`Survey ${this._surveyInFocus} already in focus. Cannot add survey ${e.id}.`),this._surveyInFocus=e.id},this._removeSurveyFromFocus=e=>{this._surveyInFocus!==e.id&&cg.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(),zn(Rf,"languagechange",this._languageChangeListener),this._unsubscribeFeatureFlags=e.onFeatureFlags(()=>this._onLanguageChange())}_onLanguageChange(){if(It(this._surveyInFocus))return;const e=this._posthog.get_property(le),t=null==e?void 0:e.find(e=>e.id===this._surveyInFocus);if(!t)return;const{survey:i,language:s}=this._translateSurveyForRendering(t);if(s===this._currentLanguage)return;if(this._currentLanguage=s,!this._surveyIsRendered)return;const n=this._applyDisplayOverrides(i,this._displayOptions),{shadow:r}=Ig(n,this._posthog);T_(Zg(Bf,at(at({},this._surveyPopupProps),{},{posthog:this._posthog,survey:n,removeSurveyFromFocus:this._removeSurveyFromFocus,surveyLanguage:s})),r)}get _featureFlags(){var e,t,i;return null!==(e=null===(t=(i=this._posthog).getExtension)||void 0===t?void 0:t.call(i,"featureFlags"))&&void 0!==e?e:this._posthog.featureFlags}_applyDisplayOverrides(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?at(at({},e),{},{appearance:at(at(at({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}_clearSurveyTimeout(e){const t=this._surveyTimeouts.get(e);t&&(clearTimeout(t),this._surveyTimeouts.delete(e))}cancelSurvey(e){this._surveyTimeouts.has(e)&&(cg.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)||void 0===e||e.call(this),this._automaticDisplayDispose=void 0,this._languageChangeListener&&(Rf.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)=>{T_(null,t),null==e||e.remove()}),this._renderedTargets.clear(),this._renderedTabWidgets.clear(),this._surveyInFocus=null}_sortSurveysByAppearanceDelay(e){return e.sort((e,t)=>{var i,s;const n=jg(e),r=jg(t);if(n&&!r)return-1;if(!n&&r)return 1;const o=e.schedule===ng.Always,a=t.schedule===ng.Always;return o&&!a?1:!o&&a?-1:((null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(s=t.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)||0)})}_translateSurveyForRendering(e){return If(e,this._posthog)}_handleUrlPrefill(e,t,i){if(this._prefillHandledSurveys.has(e.id))return!1;const{params:s}=function(){const e={};let t=!1;const i=Rf.location.search.replace(/^\?/,"");if(!i)return{params:e,autoSubmit:t};const s=i.split("&");for(const i of s){const[s,n]=i.split("=");if(!s||Et(n))continue;const r=decodeURIComponent(s),o=decodeURIComponent(n);if("auto_submit"===r&&"true"===o){t=!0;continue}const a=r.match(/^q(\d+)$/);if(a){const t=parseInt(a[1],10);e[t]||(e[t]=[]),e[t].push(o)}}return{params:e,autoSubmit:t}}();if(0===Object.keys(s).length)return!1;cg.info("[Survey Prefill] Detected URL prefill parameters");const n=this._processPrefillData(e,s,t);return!!n&&(this._autoSubmitPrefilledResponses(e,n,i,t),this._prefillHandledSurveys.add(e.id),n.isSurveyCompleted)}_autoSubmitPrefilledResponses(e,t,i,s){const{responses:n,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=t;(Object.keys(a).length>0&&e.enable_partial_responses||o)&&Rg({responses:o?n:a,survey:e,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:s})}_handleInitialResponses(e,t,i,s){const n={};for(const[e,i]of Object.entries(t))n[parseInt(e)]=St(i)?i.map(String):[String(i)];cg.info("[Survey] Processing initial responses");const r=this._processPrefillData(e,n,s);return!!r&&(this._autoSubmitPrefilledResponses(e,r,i,s),r.isSurveyCompleted)}_processPrefillData(e,t,i){try{const s=function(e,t){const i={};return e.questions.forEach((e,s)=>{if(!t[s]||!e.id)return;const n=t[s],r=Ua(e.id);try{switch(e.type){case ig.SingleChoice:{if(!e.choices||0===e.choices.length)return void Fn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=parseInt(n[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void Fn.warn(`[Survey Prefill] Invalid choice index for q${s}: ${n[0]}`);i[r]=e.choices[t];break}case ig.MultipleChoice:{if(!e.choices||0===e.choices.length)return void Fn.warn(`[Survey Prefill] Question ${s} has no choices`);const t=n.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void Fn.warn(`[Survey Prefill] No valid choices for q${s}`);const o=[...new Set(t.map(t=>e.choices[t]))];t.length>o.length&&Fn.warn(`[Survey Prefill] Removed duplicate choices for q${s}`),i[r]=o;break}case ig.Rating:{const t=parseInt(n[0],10),o=e.scale||10;if(isNaN(t)||0>t||t>o)return void Fn.warn(`[Survey Prefill] Invalid rating for q${s}: ${n[0]} (scale: 0-${o})`);i[r]=t;break}default:Fn.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){Fn.error(`[Survey Prefill] Error converting q${s}:`,e)}}),i}(e,t);if(0===Object.keys(s).length)return cg.warn("[Survey Prefill] No valid responses after conversion"),null;const n=va(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(e,t,i){let s=0;const n={},r=[],o=e.questions.length+1;let a=0;for(;e.questions.length>s&&o>a&&(a++,t.includes(s));){const t=e.questions[s];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=Ua(t.id);Et(i[e])||(n[e]=i[e])}r.push(s);const o=xf(e,s,t.id?i[Ua(t.id)]:null);if(o===sg.End)return{startQuestionIndex:e.questions.length,skippedResponses:n,skippedIndices:r};s=o}return{startQuestionIndex:s,skippedResponses:n,skippedIndices:r}}(e,Object.keys(t).map(e=>parseInt(e,10)),s),l=r>=e.questions.length;return Wg(e,{surveySubmissionId:n,responses:s,lastQuestionIndex:r,questionOrder:Og(e.questions),visitedIndices:a,surveyLanguage:i}),cg.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:s,submissionId:n,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(e){return cg.error("[Survey Prefill] Error handling prefill:",e),null}}_isSurveyFeatureFlagEnabled(e,t=void 0){if(!e)return!0;const i=this._featureFlags,s=!!(null==i?void 0:i.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let n=!0;t&&(n=(null==i?void 0:i.getFeatureFlag(e,{send_event:!1}))===t||"any"===t);const r=s&&n;return r||this._warnIfFeatureFlagsDisabled(e),r}_warnIfFeatureFlagsDisabled(e){var t;!this._loggedFeatureFlagsDisabledWarning&&(null===(t=this._posthog.config)||void 0===t?void 0:t.advanced_disable_feature_flags)&&(this._loggedFeatureFlagsDisabledWarning=!0,cg.warn(`Survey feature flag "${e}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}_isSurveyConditionMatched(t){return!t.conditions||Hg(t,this._posthog)&&function(t){var s,n;return function(t,s){var n,r,o;if(!t||0===t.length)return!0;if(!c)return!1;const a=Qi(c,{userAgentDataPlatform:null==i||null===(n=i.userAgentData)||void 0===n?void 0:n.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==e||null===(r=e.screen)||void 0===r?void 0:r.width,screenHeight:null==e||null===(o=e.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==e?void 0:e.devicePixelRatio});return il[null!=s?s:"icontains"](t,[a])}(null===(s=t.conditions)||void 0===s?void 0:s.deviceTypes,null===(n=t.conditions)||void 0===n?void 0:n.deviceTypesMatchType)}(t)&&function(e){var t;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null==wg?void 0:wg.querySelector(e.conditions.selector))}(t)}_internalFlagCheckSatisfied(e){var t;return Dg(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)||void 0===t?void 0:t.hasLoadedFlags)?(this._warnIfFeatureFlagsDisabled(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this._isSurveyFeatureFlagEnabled(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,i;const s={eligible:!0,reason:void 0};if(!hg(e))return s.eligible=!1,s.reason=`Survey is not running. It was completed on ${e.end_date}`,s;if(!vg.includes(e.type))return s.eligible=!1,s.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,s;const n=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this._isSurveyFeatureFlagEnabled(e.linked_flag_key,n))return s.eligible=!1,s.reason=n?`Survey linked feature flag is not enabled for variant ${n}`:"Survey linked feature flag is not enabled",s;if(!this._isSurveyFeatureFlagEnabled(e.targeting_flag_key))return s.eligible=!1,s.reason="Survey targeting feature flag is not enabled",s;const r=this._internalFlagCheckSatisfied(e);var o;return r.satisfied?function(e,t){if(!e||!t)return!0;const i="string"==typeof t?new Date(t):t,s=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(s/864e5)>e}(null===(i=e.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Ca._get("lastSeenSurveyDate"))?(e=>!!Ca._get(gg(e))&&!Dg(e))(e)?(s.eligible=!1,s.reason="Survey has already been seen and it can't be activated again",s):s:(s.eligible=!1,s.reason="Survey wait period has not passed",s):(s.eligible=!1,s.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",s)}checkSurveyCaptureEligibility(){return dg(this._posthog)?{eligible:!0}:{eligible:!1,reason:ug}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this._hasActionOrEventTriggeredSurvey(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}_hasActionOrEventTriggeredSurvey(e){var t;if(!Ja(e)&&!pg(e))return!0;const i=null===(t=this._posthog.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==i?void 0:i.includes(e.id))}_checkFlags(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this._isSurveyFeatureFlagEnabled(t))}_shouldDisplaySurvey(e){return this.checkSurveyEligibility(e).eligible&&this._isSurveyConditionMatched(e)&&this._hasActionOrEventTriggeredSurvey(e)&&this._checkFlags(e)}_removeSurveyFromDom(e){try{const t=Pf.querySelector(Gg(e,!0));(null==t?void 0:t.shadowRoot)&&(T_(null,t.shadowRoot),this._renderedTargets.delete(t.shadowRoot)),null==t||t.remove()}catch(t){cg.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 Of(e,t){if(!Pf||!Rf)return;const i=new Af(e);if(e.config.disable_surveys_automatic_display)return cg.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===t)return cg.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let s;i.callSurveysAndEvaluateDisplayLogic(!0);const n=()=>{Et(s)&&(s=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Et(s)||(clearInterval(s),s=void 0)};n();const o=()=>{Pf.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),n())};return zn(Pf,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),Pf.removeEventListener("visibilitychange",o)}),i}function $f({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:i,isPreviewMode:s=!1,posthog:n}){B_(()=>{var r;if(s||!(null===(r=e.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var s;const r=e.type===tg.Widget,o=Hg(e,n),a=(null===(s=e.appearance)||void 0===s?void 0:s.widgetType)===J_.Tab&&r;if(!o)return cg.info(`Hiding survey ${e.id} because URL does not match`),i(!1),t(e);a&&(cg.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),i(!0))};zn(Rf,"popstate",o),zn(Rf,"hashchange",o);const a=Rf.history.pushState,l=Rf.history.replaceState;return Rf.history.pushState=function(...e){a.apply(this,e),o()},Rf.history.replaceState=function(...e){l.apply(this,e),o()},()=>{Rf.removeEventListener("popstate",o),Rf.removeEventListener("hashchange",o),Rf.history.pushState=a,Rf.history.replaceState=l}},[s,e,t,i,n])}const Df=200;function Nf(e=eg.Right){switch(e){case eg.Top:return{top:"0",left:"50%",transform:"translateX(-50%)"};case eg.Left:return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case eg.Bottom:return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function Bf({survey:e,forceDisableHtml:t,posthog:i,style:s={},previewPageIndex:n,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:c=()=>{},onCloseConfirmationMessage:u=()=>{},properties:d,isSurveyCompleted:h,skipShownEvent:p,surveyLanguage:_}){var g,f,v,m,y,b,S,w,k,C,E,x;const T=q_(null),I=Number.isInteger(n),{isPopupVisible:R,isSurveySent:P,hidePopupWithAnimation:M}=function(e,t,i,s,n,r,o,a,l){const[c,u]=N_(s||0===i||e.type===tg.ExternalSurvey),[d,h]=N_(!1),p=q_(!1),_=()=>{const t=()=>{r&&n(e),u(!1)};if(p.current)return;const i=null==o?void 0:o.current;i?(p.current=!0,i.style.transition=`opacity ${Df}ms ease-out`,i.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},g=t=>{t.detail.surveyId===e.id&&_()};return B_(()=>{if(!t)return void cg.error("usePopupVisibility hook called without a PostHog instance.");if(s)return;let n;const r=t=>{var i,s;if(t.detail.surveyId===e.id){if(!(null===(i=e.appearance)||void 0===i?void 0:i.displayThankYouMessage))return _();h(!0),(null===(s=e.appearance)||void 0===s?void 0:s.autoDisappear)&&(n&&clearTimeout(n),n=setTimeout(_,5e3))}},o=()=>{if(Hg(e,t)){var i;u(!0),Rf.dispatchEvent(new Event("PHSurveyShown")),a||t.capture(rg.SHOWN,at(at({[og.SURVEY_NAME]:e.name,[og.SURVEY_ID]:e.id,[og.SURVEY_ITERATION]:e.current_iteration,[og.SURVEY_ITERATION_START_DATE]:e.current_iteration_start_date},l&&{[og.SURVEY_LANGUAGE]:l}),{},{sessionRecordingUrl:null===(i=t.get_session_replay_url)||void 0===i?void 0:i.call(t)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}};zn(Rf,"PHSurveyClosed",g),zn(Rf,"PHSurveySent",r);const c=i>0?setTimeout(o,i):void 0;return Et(c)&&o(),()=>{Et(c)||clearTimeout(c),Et(n)||clearTimeout(n),Rf.removeEventListener("PHSurveyClosed",g),Rf.removeEventListener("PHSurveySent",r)}},[]),$f({survey:e,removeSurveyFromFocus:n,setSurveyVisible:u,isPreviewMode:s,posthog:t}),{isPopupVisible:c,isSurveySent:d,setIsPopupVisible:u,hidePopupWithAnimation:_}}(e,i,(null===(g=e.appearance)||void 0===g?void 0:g.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,I,r,o,T,p,_),F=P||n===e.questions.length||!0===h,[L,A]=N_(!1),O=H_(()=>!!zg(e),[e]),D=!(!(null===(f=e.appearance)||void 0===f?void 0:f.introScreenHeader)&&!(null===(v=e.appearance)||void 0===v?void 0:v.introScreenDescription)),N=I?-1===n:!!(null===(m=e.appearance)||void 0===m?void 0:m.displayIntroScreen)&&D&&!L&&!O,B=H_(()=>{const t=zg(e),s=(null==t?void 0:t.surveySubmissionId)||va();return{isPreviewMode:I,previewPageIndex:n,onPopupSurveyDismissed(){_?Mg(e,i,I,_):Mg(e,i,I),c()},isPopup:o||!1,surveySubmissionId:s,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:d,surveyLanguage:_}},[I,n,o,i,e,c,a,l,d,_]);return R?Zg(Ng.Provider,{value:B,children:Zg("div",{className:"ph-survey",style:at(at({},Qg(e.type,null===(y=e.appearance)||void 0===y?void 0:y.position,null===(b=e.appearance)||void 0===b?void 0:b.widgetType)),s),ref:T,children:F?Zg(hf,{header:(null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageHeader)||"Thank you!",description:(null===(w=e.appearance)||void 0===w?void 0:w.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescriptionContentType,appearance:e.appearance||Cg,onClose(){M(),u()}}):N?Zg(pf,{header:(null===(C=e.appearance)||void 0===C?void 0:C.introScreenHeader)||"",description:(null===(E=e.appearance)||void 0===E?void 0:E.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(x=e.appearance)||void 0===x?void 0:x.introScreenDescriptionContentType,appearance:e.appearance||Cg,onStart:()=>A(!0)}):Zg(qf,{survey:e,forceDisableHtml:!!t,posthog:i})})}):null}function qf({survey:e,forceDisableHtml:t,posthog:i}){var s,n;const r=H_(()=>{const t=zg(e);if(!t)return null;const i=Pt(t.lastQuestionIndex);return!i||i&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(Vg(e),null)},[e]),[o,a]=N_(()=>((null==r?void 0:r.responses)&&cg.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,c]=N_(!1),{previewPageIndex:u,onPopupSurveyDismissed:d,isPopup:h,onPreviewSubmit:p,onPreviewBack:_,surveySubmissionId:g,isPreviewMode:f,properties:v,surveyLanguage:m}=U_(Ng),[y,b]=N_(()=>{const t=null==r?void 0:r.lastQuestionIndex,i=Pt(t)&&t>=0&&e.questions.length>t?t:0;return Pt(u)&&u>=0?u:i}),[S,w]=N_(()=>{var t;return(null!==(t=null==r?void 0:r.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[k,C]=N_(()=>{var t;const i=zg(e);return null!==(t=null==i?void 0:i.questionSnapshots)&&void 0!==t?t:{}}),E=H_(()=>Og($g(e,r)),[e.id,r]),x=H_(()=>{if(!E||new Set(E).size!==E.length)return $g(e,r);const t=new Map(e.questions.map(e=>[e.id,e])),i=E.map(e=>t.get(e)).filter(e=>!!e);return i.length===E.length?i:e.questions},[E,e.questions,e,r]);B_(()=>{!f||Et(u)||0>u||b(u)},[u,f]);const T=!!(null===(s=e.appearance)||void 0===s?void 0:s.allowGoBack)&&(f?(null!=u?u:0)>0:S.length>0),I=x.at(y);return I?Zg("form",{className:"survey-form",name:"surveyForm",children:[h&&!0!==(null===(n=e.appearance)||void 0===n?void 0:n.hideCancelButton)&&Zg(uf,{onClick(){d()}}),Zg("div",{className:"survey-box","data-question-index":y,children:[l&&Zg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Uf({question:I,forceDisableHtml:t,displayQuestionIndex:y,appearance:e.appearance||Cg,onSubmit:t=>(({res:t,displayQuestionIndex:s,questionId:n})=>{if(!i)return void cg.error("onNextButtonClick called without a PostHog instance.");if(!dg(i))return void c(!0);if(c(!1),!n)return void cg.error("onNextButtonClick called without a questionId.");const r=Ua(n),l=at(at({},o),{},{[r]:t});a(l);const u=x[s],d=(null==u?void 0:u.id)?at(at({},k),{},{[u.id]:u.question}):k;C(d);const h=xf(e,s,t),p=h===sg.End,_=[...S,s];if(p||(w(_),b(h),Wg(e,{surveySubmissionId:g,responses:l,lastQuestionIndex:h,questionOrder:Og(x),visitedIndices:_,surveyLanguage:m,questionSnapshots:d})),e.enable_partial_responses||p){const t=new Set(_.map(e=>{var t;return null===(t=x[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>Ua(e))),s=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));Rg({responses:s,survey:e,surveySubmissionId:g,isSurveyCompleted:p,posthog:i,properties:v,surveyLanguage:m,questionSnapshots:d})}})({res:t,displayQuestionIndex:y,questionId:I.id}),onPreviewSubmit:p,initialValue:I.id?o[Ua(I.id)]:void 0,canGoBack:T,onBack(){if(f)return void _();if(0===S.length)return;const t=S[S.length-1],i=S.slice(0,-1);w(i),b(t),Wg(e,{surveySubmissionId:g,responses:o,lastQuestionIndex:t,questionOrder:Og(x),visitedIndices:i,surveyLanguage:m,questionSnapshots:k})}})]})]}):null}function Hf({survey:e,forceDisableHtml:t,posthog:i,readOnly:s,surveyLanguage:n}){var r,o,a,l,c,u,d;const[h,p]=N_(!0),[_,g]=N_(!1),[f,v]=N_({}),m=q_(void 0),y=()=>{(_||!i||s||dg(i))&&g(!_)};if(B_(()=>{var t;if(!i)return void cg.error("FeedbackWidget called without a PostHog instance.");if(s)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&v({top:"50%",bottom:"auto"});const n=t=>{var i;const s=t;(null===(i=s.detail)||void 0===i?void 0:i.surveyId)===e.id&&(cg.info(`Received show event for feedback button survey ${e.id}`),v(s.detail.position||{}),y())};return zn(Rf,Mf,n),()=>{Et(m.current)||(clearTimeout(m.current),m.current=void 0),Rf.removeEventListener(Mf,n)}},[i,s,e.id,null===(r=e.appearance)||void 0===r?void 0:r.widgetType,null===(o=e.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=e.appearance)||void 0===a?void 0:a.borderColor]),$f({survey:e,setSurveyVisible:p,posthog:i}),!h)return null;const b=()=>{e.schedule!==ng.Always&&p(!1),Et(m.current)||clearTimeout(m.current),m.current=setTimeout(()=>{m.current=void 0,g(!1)},200)};return Zg(a_,{children:["tab"===(null===(l=e.appearance)||void 0===l?void 0:l.widgetType)&&Zg("button",{className:"ph-survey-widget-tab "+((null===(c=e.appearance)||void 0===c?void 0:c.tabPosition)===eg.Top?"widget-tab-top":""),onClick:y,disabled:s,style:Nf(null===(u=e.appearance)||void 0===u?void 0:u.tabPosition),children:(null===(d=e.appearance)||void 0===d?void 0:d.widgetLabel)||""}),_&&Zg(Bf,{posthog:i,survey:e,forceDisableHtml:t,style:f,onPopupSurveyDismissed:b,onCloseConfirmationMessage:b,surveyLanguage:n})]})}const Uf=({question:e,forceDisableHtml:t,displayQuestionIndex:i,appearance:s,onSubmit:n,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const c={forceDisableHtml:t,appearance:s,onPreviewSubmit(e){r(e)},onSubmit(e){n(e)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(e.type){case ig.Open:return r_(gf,at(at({},c),{},{question:e,key:e.id}));case ig.Link:return r_(ff,at(at({},c),{},{question:e,key:e.id}));case ig.Rating:return r_(vf,at(at({},c),{},{question:e,key:e.id}));case ig.SingleChoice:case ig.MultipleChoice:return r_(yf,at(at({},c),{},{question:e,key:e.id}));default:return cg.error(`Unsupported question type: ${e.type}`),null}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.generateSurveys=Of,h.extendPostHogWithSurveys=Of;const Wf=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},zf=1e4,jf=(e,t,i)=>i.remaining>0?t.length>i.remaining?(e.push(t.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(e.push(t),i.remaining-=t.length,!0):(i.truncated=!0,!1),Vf=(e,t,i)=>{const s=JSON.stringify(e);if(i.remaining>=s.length)return jf(t,s,i);if(i.truncated=!0,2>i.remaining)return!1;let n=0,r=Math.min(e.length,i.remaining-2);for(;r>n;){const t=Math.ceil((n+r)/2);JSON.stringify(e.slice(0,t)).length>i.remaining?r=t-1:n=t}return jf(t,JSON.stringify(e.slice(0,n)),i)},Gf=e=>void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e&&"bigint"!=typeof e,Qf=(e,t,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(t).length+e.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[e]=t}},Kf=(e,t,i)=>{if(!i.truncated)if(kt(e)){if(i.seen.has(e))return void Qf(t||"circular","[Circular]",i);i.seen.add(e);try{for(const s in e)try{if(!{}.hasOwnProperty.call(e,s))continue;if(Kf(e[s],t?`${t}.${s}`:s,i),i.truncated)return}catch(e){continue}}catch(e){}}else Qf(t,e,i)},Zf=(e,t,i,s,n=!1,r)=>{if(!Gf(e))return!n||jf(t,"null",i);if(It(e)||(e=>{try{return Pt(e)||Ft(e)}catch(e){return!1}})(e))return jf(t,JSON.stringify(e),i);if("string"==typeof e)return Vf(e,t,i);if(!kt(e)&&!St(e))return jf(t,JSON.stringify(e),i);if(s.has(e))return Vf("[Circular]",t,i);s.add(e);try{const r=e.toJSON;if(wt(r))return Zf(r.call(e),t,i,s,n)}catch(e){}try{const s={}.toString.call(e);if("[object String]"===s)return Vf(String(e.valueOf()),t,i);if("[object Number]"===s||"[object Boolean]"===s)return jf(t,JSON.stringify(e.valueOf()),i)}catch(e){}if(e instanceof Error){const o={};try{for(const t in e)({}).hasOwnProperty.call(e,t)&&(o[t]=e[t])}catch(e){}try{o.name=e.name}catch(e){}try{o.message=e.message}catch(e){}try{o.stack=e.stack}catch(e){}return Zf(o,t,i,s,n,r)}if(St(e)){if(!jf(t,"[",i))return!1;for(let n=0;e.length>n;n++){if(n>0&&!jf(t,",",i))return!1;let r;try{r=e[n]}catch(e){r=void 0}if(!Zf(r,t,i,s,!0))return!1}return jf(t,"]",i)}if(!jf(t,"{",i))return!1;let o=!0;try{for(const n in e){if(!{}.hasOwnProperty.call(e,n))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=e[n]}catch(e){continue}if(r)try{Kf(a,n,r)}catch(e){}if(!Gf(a))continue;const l=`${o?"":","}${JSON.stringify(n)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const c=t.length,u=i.remaining,d=i.truncated;if(!jf(t,l,i))return!1;const h=t.length,p=Zf(a,t,i,s,!1),_=i.truncated;if(t.length!==h){if(o=!1,!p)return!1}else if(t.length=c,i.remaining=u,i.truncated=p?d:_,!p)return!1}}catch(e){}return jf(t,"}",i)},Yf=(e,t)=>{const i=[],s={remaining:t,truncated:!1},n=kt(e[0])?{result:{},keysRemaining:50,sizeRemaining:zf,truncated:!1,seen:new WeakSet([e[0]])}:void 0;for(let t=0;e.length>t&&(0>=t||jf(i," ",s))&&Zf(e[t],i,s,new WeakSet,!1,0===t?n:void 0);t++);return{body:i.join("")+(s.truncated?"...":""),truncated:s.truncated,attributes:(null==n?void 0:n.result)||{}}},Jf={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Xf=e=>"canCapture"in e,ev=e=>Xf(e)?e.canCapture?e.getExtension(yg):void 0:e.is_capturing()?e.logs:void 0,tv=(e,t,i)=>{if(Xf(e))return void t.captureConsoleLog(i);const s=(e=>{const t=/^1\.(\d+)\.(\d+)$/.exec(e);if(!t)return;const i=Number(t[1]),s=Number(t[2]);return 392>i||i>419?void 0:410===i?s>4?s>10?void 0:"de":"le":418===i?s>3?s>10?s>14?s>17?void 0:"vi":"ci":"ui":"he":419===i?s>2?void 0:"vi":410>i?"le":"he"})(e.version),n=s?t[s]:void 0;wt(n)&&n.call(t,i)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.logs={initializeLogs(e){let t=e;const i=[],s={host:h.location.host};let n=!1;for(const e of Object.keys(Jf)){const r=i=>(...r)=>{let o=!1;try{const i=t;if(r.length>0&&!n&&i){const t=ev(i);if(t){n=!0,o=!0;const{body:a,truncated:l,attributes:c}=Yf(r,zf),u=at(at({},s),l?{body_truncated:"true"}:{}),d={level:Jf[e],body:a,attributes:at(at({"log.source":`console.${e}`},u),c)};tv(i,t,d)}}}catch(e){}finally{o&&(n=!1),i.apply(h.console,r)}},o=h.console[e];i.push(lp(h.console,e,e=>{const t=r(e);return t.__rrweb_original__=Wf(o),t}))}return()=>{t=void 0,i.forEach(e=>e())}},replayConsoleBuffer(e,t){const i=ev(e);if(i)for(const e of t)try{var s;const{body:t,truncated:n,attributes:r}=Yf(e.args,zf);null===(s=i.captureBufferedConsoleLog)||void 0===s||s.call(i,{level:Jf[e.level],body:t,attributes:at(at({"log.source":`console.${e.level}`,host:h.location.host},n?{body_truncated:"true"}:{}),r)},e.context,e.occurredAtMs)}catch(e){}}};const iv=e=>Nt(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),sv=Ln("[Error tracking]"),nv="webkit-masked-url:",rv=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],ov=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",nv],av=["__firefox__","__gCrWeb"];function lv(){return new ds([new Rs,new Bs,new Ms,new Ps,new Ds,new $s,new Ls,new Ns],function(e,...t){return(i,s=0)=>{const n=[],r=i.split("\n"),o=Math.min(r.length,s+1e3),a=[];for(let i=s;o>i;i++){const s=r[i];if(s.length>1024)continue;const o=Ss.test(s)?s.replace(Ss,"$1"):s;if(!o.match(/\S*Error: /)){for(const i of t){const t=i(o,e);if(t){n.push(t);const e=ks(n);if(e){for(let t=a.length-1;t>=0;t--){const i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if(Ts(n,a)>=50)break}}const l=[...a].sort((e,t)=>t.start-e.start),c=l[l.length-1];if(c){const e=Es(n,c);n.splice(c.start-e,e);for(const t of l)t.start-=e}for(const e of l)Cs(n,e);return a.some(e=>0===e.start&&n.length===e.length)&&function(e){const t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${e.module}`);let i=0;for(let e=1;t.length>e;e++)Is(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(n),function(e){if(!e.length)return[];const t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return at(at({},e),{},{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||"?"});var i})}(n)}}("web:javascript",vs,bs))}const cv=Ln("[ExceptionAutocapture]"),uv=lv(),dv=(e,t)=>{try{return e()}catch(e){return t}},hv=(e,t)=>dv(()=>e(t()),void 0),pv=e=>dv(()=>wt(e)&&wt(e.call),!1),_v=(e,t)=>dv(()=>{e[t].__POSTHOG_INSTRUMENTED__=!0},void 0),gv=(e,t,i)=>{dv(()=>{var i;null===(i=e[t])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),dv(()=>{e[t]=i},void 0)},fv=t=>{const i=e;i||cv.info("window not available, cannot wrap onerror");const s=dv(()=>i.onerror,void 0);return i.onerror=function(...e){var i;return hv(t,()=>uv.buildFromUnknown((([e,t,i,s,n])=>{if(null!=n)return n;if(xt(e)&&xt(t)&&t.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:e,filename:t,lineno:i,colno:s})}catch(t){return e}return e})(e),{mechanism:{handled:!1}})),!!pv(s)&&null!==(i=s(...e))&&void 0!==i&&i},_v(i,"onerror"),()=>gv(i,"onerror",s)},vv=(t,i=!1)=>{const s=e;s||cv.info("window not available, cannot wrap onUnhandledRejection");const n=dv(()=>s.onunhandledrejection,void 0);return s.onunhandledrejection=function(e){var s;return hv(t,()=>uv.buildFromUnknown(e,{mechanism:{handled:!1}})),pv(n)?null!==(s=n(e))&&void 0!==s&&s:i},_v(s,"onunhandledrejection"),()=>gv(s,"onunhandledrejection",n)},mv={wrapOnError:fv,wrapUnhandledRejection:vv,wrapConsoleError(e){const t=console;t||cv.info("console not available, cannot wrap console.error");const i=dv(()=>t.error,void 0);return t.error=function(...t){hv(e,()=>{let e;e=1==t.length?t[0]:t.join(" ");const i=t.find(e=>e instanceof Error);return uv.buildFromUnknown(i||e,{mechanism:{handled:!1},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),pv(i)&&i(...t)},_v(t,"error"),()=>gv(t,"error",i)}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.errorWrappingFunctions=mv,h.posthogErrorWrappingFunctions=mv;const yv=(e,t)=>{if(!wt(null==e?void 0:e.capture))return;const i=null==t?void 0:t.autocaptureExceptions,s=!It(i)&&"object"==typeof i&&St(i.errors_to_ignore)?i.errors_to_ignore.reduce((e,t)=>{try{e.push(new RegExp(t))}catch(e){cv.error("Ignoring invalid legacy exception exclusion rule",t,e)}return e},[]):[],n=t=>{try{var i;null===(i=e.capture)||void 0===i||i.call(e,"$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(e){cv.error("Failed to capture exception for a legacy client",e)}};fv(e=>{s.some(t=>e.$exception_list.some(e=>t.test(e.value||"")))||n(e)}),vv(n,!0)};h.extendPostHogWithExceptionAutoCapture=yv,h.extendPostHogWithExceptionAutocapture=yv;const bv="X-POSTHOG-SESSION-ID",Sv="X-POSTHOG-WINDOW-ID",wv="X-POSTHOG-DISTINCT-ID",kv=[bv,Sv,wv],Cv=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],Ev=(e,t)=>({}.hasOwnProperty.call(e,t)),xv=e=>"object"==typeof e&&!It(e)||wt(e),Tv=e=>"undefined"!=typeof Request&&(e instanceof Request||"[object Request]"==={}.toString.call(e)),Iv=t=>{try{var i;return Tv(t)?t.url:new URL(t instanceof URL?t.toString():String(t),null==e||null===(i=e.location)||void 0===i?void 0:i.href).toString()}catch(e){return}},Rv=(e,t,i,s,n)=>{let r;try{r=new URL(s).hostname}catch(e){return!1}if(!e)return!1;if(St(e)&&!e.includes(r))return!1;let o=!1;if(i){const{sessionId:e,windowId:t}=i.checkAndGetSessionAndWindowId(!0);n.set(bv,e),n.set(Sv,t),o=!0}const a=(e=>wt(e)?e():e)(t);return a&&"$posthog_cookieless"!==a&&(n.set(wv,a),o=!0),o};h.__PosthogExtensions__=h.__PosthogExtensions__||{};const Pv={_patchFetch:(t,i,s)=>lp(e,"fetch",e=>function(n,r){const o=arguments.length>1?[n,r]:[n];let a=o;try{const e=Iv(n);if(e)if(Tv(n)){const e=new Request(n,r);Rv(t,i,s,e.url,e.headers),a=[e]}else{const o=new Headers(xv(r)?r.headers:void 0);if(Rv(t,i,s,e,o)){const e=((e,t)=>{if(Et(e)||It(e))return{headers:t};if(!xv(e))return;const i=e;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const e=Object.create(i);return Object.defineProperty(e,"headers",{configurable:!0,enumerable:!0,value:t,writable:!0}),e}return new Proxy({headers:t},{get:(e,t)=>Ev(e,t)?Reflect.get(e,t):Reflect.get(i,t,i),has:(e,t)=>Ev(e,t)||t in i,ownKeys(e){const t=new Set(Reflect.ownKeys(e));return Reflect.ownKeys(i).forEach(e=>t.add(e)),Cv.forEach(e=>{e in i&&t.add(e)}),Array.from(t)},getOwnPropertyDescriptor(e,t){const s=Reflect.getOwnPropertyDescriptor(e,t);if(s)return s;if("string"==typeof t&&Cv.includes(t)&&t in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,t,i)}};const n=Reflect.getOwnPropertyDescriptor(i,t);return n?at(at({},n),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);e&&(a=[n,e])}}}catch(e){a=o}return e.apply(this,a)}),_patchXHR:(t,i,s)=>lp(e.XMLHttpRequest.prototype,"open",e=>function(n,r,o=!0,a,l){const c=this,u=new Headers,d=Iv(r);d&&Rv(t,i,s,d,u);const h=e.call(c,n,r,o,a,l);return kv.forEach(e=>{const t=u.get(e);if(t)try{c.setRequestHeader(e,t)}catch(e){}}),h})};h.__PosthogExtensions__.tracingHeadersPatchFns=Pv,h.postHogTracingHeadersPatchFns=Pv,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(e){const t=this.length;let i=Math.trunc(e)||0;return 0>i&&(i+=t),0>i||i>=t?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(e,t){for(let i=this.length-1;i>=0;i--){const s=this[i];if(e.call(t,s,i,this))return s}},writable:!0,enumerable:!1,configurable:!0});var Mv=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(e){var t;if(e.hadRecentInput)return;const i=this.i[0],s=this.i.at(-1);this.o&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.o+=e.value,this.i.push(e)):(this.o=e.value,this.i=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const Fv=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Lv=e=>{if("loading"===document.readyState)return"loading";const t=Fv();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"},Av=e=>{const t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Ov=e=>{let t="";try{for(;9!==(null==e?void 0:e.nodeType);){var i;const s=e,n=s.id?"#"+s.id:[Av(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},$v=new WeakMap;function Dv(e,t){let i=$v.get(t);return i||(i=new WeakMap,$v.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}let Nv=-1;const Bv=()=>Nv,qv=e=>{addEventListener("pageshow",t=>{t.persisted&&(Nv=t.timeStamp,e(t))},!0)},Hv=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},Uv=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Wv=()=>{var e,t;return null!==(e=null===(t=Fv())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let zv=-1;const jv=new Set,Vv=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Gv=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of jv)e();isFinite(zv)||(zv="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Gv,!0))}},Qv=(e=!1)=>{if(e&&(zv=1/0),0>zv){var t;const e=Wv(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;zv=null!=i?i:Vv(),addEventListener("visibilitychange",Gv,!0),addEventListener("prerenderingchange",Gv,!0),qv(()=>{setTimeout(()=>{zv=Vv()})})}return{get firstHiddenTime(){return zv},onHidden(e){jv.add(e)}}},Kv=(e,t=-1,i,s=0,n,r,o)=>{const a=Fv(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>Bv()?a&&(document.prerendering||Wv()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Zv=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(at({type:t,buffered:!0},i));return e}}catch(e){}},Yv=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},Jv=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Xv=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var em=class{constructor(){this.u=void 0}};const tm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},im=[1800,3e3],sm=(e,t={})=>{const i=Yv(t);tm(()=>{const s=Dv(t,em),n=Qv();let r,o=Kv("FCP");const a=Zv(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Wv(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=Hv(e,o,im,t.reportAllChanges),qv(i=>{o=Kv("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Bv()),r=Hv(e,o,im,t.reportAllChanges),Uv(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Zv(["soft-navigation"],i=>{i.forEach(i=>{s.u&&i.navigationId&&Jv(s.u,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Kv("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Hv(e,o,im,t.reportAllChanges),r(!0)})},t)})},nm=[.1,.25],rm=e=>e.find(e=>{var t;return 1===(null===(t=e.node)||void 0===t?void 0:t.nodeType)})||e[0],om=(e,t={})=>{const i=Dv(t=Object.assign({},t),Mv),s=new WeakMap;i.t=e=>{var i;if(null==e||null===(i=e.sources)||void 0===i?void 0:i.length){const i=rm(e.sources),o=null==i?void 0:i.node;if(o){var n,r;const e=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,o))&&void 0!==n?n:Ov(o);s.set(i,e)}}},((e,t={})=>{const i=Qv();sm(Xv(()=>{let s,n=Kv("CLS",0);const r=Dv(t,Mv),o=(i,o,a,l,c)=>{n=Kv("CLS",0,i,o,a,l,c),r.o=0,s=Hv(e,n,nm,t.reportAllChanges)},a=(e=!1)=>{r.o>n.value&&(n.value=r.o,n.entries=r.i),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.l(t):l(t);a()},u=["layout-shift"];Yv(t)&&u.push("soft-navigation");const d=Zv(u,c);d&&(s=Hv(e,n,nm,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),qv(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Bv()),Uv(s)}),setTimeout(s))}))})(t=>{e((e=>{let t={};if(e.entries.length){var i;const n=e.entries.reduce((e,t)=>e.value>t.value?e:t);if(null==n||null===(i=n.sources)||void 0===i?void 0:i.length){const e=rm(n.sources);e&&(t={largestShiftTarget:s.get(e),largestShiftTime:n.startTime,largestShiftValue:n.value,largestShiftSource:e,largestShiftEntry:n,loadState:Lv(n.startTime)})}}return Object.assign(e,{attribution:t})})(t))},t)},am=(e,t={})=>{const i=Dv(t=Object.assign({},t),em);Yv(t)&&(i.u=new Map),sm(t=>{e((e=>{let t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Lv(Bv())};if("soft-navigation"!==e.navigationType){if(e.entries.length){const i=Fv(),s=e.entries.at(-1);if(i){const n=Math.max(0,i.responseStart-(i.activationStart||0));t={timeToFirstByte:n,firstByteToFCP:e.value-n,loadState:Lv(e.entries[0].startTime),navigationEntry:i,fcpEntry:s}}}}else{var s;const n=null===(s=i.u)||void 0===s?void 0:s.get(e.navigationId);n&&(t={timeToFirstByte:0,firstByteToFCP:e.value,loadState:"complete",navigationEntry:n})}return Object.assign(e,{attribution:t})})(t))},t)};let lm=0,cm=1/0,um=0;const dm=e=>{for(const t of e)t.interactionId&&(cm=Math.min(cm,t.interactionId),um=Math.max(um,t.interactionId),lm=um?(um-cm)/7+1:0)};let hm;const pm=()=>{var e;return hm?lm:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var _m=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return pm()-this.h}D(){this.h=pm(),this.v.length=0,this.p.clear()}S(e){const t=this.T(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{k:8,id:-1,entries:[]}}l(e){var t;if(null===(t=this.m)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.p.get(e.interactionId);if(s||10>this.v.length||e.duration>i.k){var n;if(s?e.duration>s.k?(s.entries=[e],s.k=e.duration):e.duration===s.k&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],k:e.duration},this.p.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.k-e.k),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.p.delete(t.id)}null===(n=this.M)||void 0===n||n.call(this,s)}}};const gm=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=Xv(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},fm=[200,500],vm=(e,t={})=>{const i=Dv(t=Object.assign({},t),_m);let s=[],n=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const c=()=>{l||(gm(u),l=!0)},u=()=>{const e=new Set(i.v.map(e=>o.get(e.entries[0]))),t=n.length-10;n=n.filter((i,s)=>s>=t||e.has(i));const a=new Set;for(const e of n){const t=d(e.startTime,e.processingEnd);for(const e of t)a.add(e)}s=s.filter(e=>e.startTime>r||a.has(e)),l=!1};i.m=e=>{const i=e.startTime+e.duration;let s;r=Math.max(r,e.processingEnd);for(let r=n.length-1;r>=0;r--){const o=n[r];if(8>=Math.abs(i-o.renderTime)){s=o,s.startTime=Math.min(e.startTime,s.startTime),s.processingStart=Math.min(e.processingStart,s.processingStart),s.processingEnd=Math.max(e.processingEnd,s.processingEnd),t.includeProcessedEventEntries&&s.entries.push(e);break}}s||(s={startTime:e.startTime,processingStart:e.processingStart,processingEnd:e.processingEnd,renderTime:i,entries:t.includeProcessedEventEntries?[e]:[]},n.push(s)),e.interactionId&&o.set(e,s),c()},i.M=e=>{if(!a.get(e)){var i;const o=null===(i=e.entries.find(e=>e.target))||void 0===i?void 0:i.target;if(o){var s,n;const i=null!==(s=null===(n=t.generateTarget)||void 0===n?void 0:n.call(t,o))&&void 0!==s?s:Ov(o);a.set(e,i)}else{var r;const t=null===(r=e.entries.find(e=>e.targetSelector))||void 0===r?void 0:r.targetSelector;t&&a.set(e,t)}}};const d=(e,t)=>{const i=[];for(const n of s)if(n.startTime+n.duration>=e){if(n.startTime>t)break;i.push(n)}return i};Zv(["long-animation-frame"],e=>{s=s.concat(e),c()},t),((e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Qv();tm(()=>{var s;"interactionCount"in performance||hm||(hm=Zv(["event"],dm,{durationThreshold:0}));let n,r=Kv("INP");const o=Dv(t,_m),a=(i,s,a,l,c)=>{o.D(),r=Kv("INP",-1,i,s,a,l,c),n=Hv(e,r,fm,t.reportAllChanges)},l=()=>{const e=o.S(r.navigationType);e&&e.k!==r.value&&(r.value=e.k,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{gm(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.l(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];Yv(t)&&d.push("soft-navigation");const h=Zv(d,u,at(at({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=Hv(e,r,fm,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),qv(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,Bv())}))})})(t=>{e((e=>{if(0===e.entries.length){const t={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:e.value,loadState:Lv(e.navigationStartTime||0)};return Object.assign(e,{attribution:t})}const t=e.entries[0],s=o.get(t),n=Math.max(s.processingStart,t.startTime),r=Math.max(t.startTime+t.duration,n),l=Math.min(s.processingEnd,r),c=s.entries.sort((e,t)=>e.processingStart-t.processingStart),u=d(t.startTime,l),h=i.p.get(t.interactionId),p={interactionTarget:a.get(h),interactionType:t.name.startsWith("key")?"keyboard":"pointer",interactionTime:t.startTime,nextPaintTime:r,processedEventEntries:c,longAnimationFrameEntries:u,inputDelay:n-t.startTime,processingDuration:l-n,presentationDelay:r-l,loadState:Lv(t.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(e=>{var t;const i=e.interactionTime,s=e.nextPaintTime;if(!(null===(t=e.longAnimationFrameEntries)||void 0===t?void 0:t.length)||!i||!s)return;const n=e.inputDelay,r=e.processingDuration;let o,a,l=0,c=0,u=0,d=0;for(const t of e.longAnimationFrameEntries){c=c+t.startTime+t.duration-t.styleAndLayoutStart;for(const e of t.scripts){const t=e.startTime+e.duration;if(i>t)continue;const s=t-Math.max(i,e.startTime),u=e.duration?s/e.duration*e.forcedStyleAndLayoutDuration:0;l+=s-u,c+=u,s>d&&(a=i+n>e.startTime?"input-delay":i+n+r>e.startTime?"processing-duration":"presentation-delay",o=e,d=s)}}const h=e.longAnimationFrameEntries.at(-1),p=h?h.startTime+h.duration:0;p>=i+n+r&&(u=s-p),o&&a&&(e.longestScript={entry:o,subpart:a,intersectingDuration:d}),e.totalScriptDuration=l,e.totalStyleAndLayoutDuration=c,e.totalPaintDuration=u,e.totalUnattributedDuration=s-i-l-c-u})(p),Object.assign(e,{attribution:p})})(t))},t)};var mm=class{constructor(){this.m=void 0,this.u=void 0}l(e){var t;null===(t=this.m)||void 0===t||t.call(this,e)}};const $=[2500,4e3];let ym=50;const bm=[];Zv(["resource"],e=>{for(const t of e)bm.push(t),bm.length>ym&&bm.shift()});const Sm=(e,t={})=>{null!=(t=Object.assign({},t)).resourceBufferSize&&(ym=t.resourceBufferSize);const i=Dv(t,mm),s=new WeakMap;Yv(t)&&(i.u=new Map),i.m=e=>{const i=e.element;if(i){var n,r;const o=null!==(n=null===(r=t.generateTarget)||void 0===r?void 0:r.call(t,i))&&void 0!==n?n:Ov(i);s.set(e,o)}else e.id&&s.set(e,`#${e.id}`)},((e,t={})=>{let i=!1;const s=Yv(t);tm(()=>{let n,r=Qv(),o=Kv("LCP");const a=Dv(t,mm),l=(s,a,l,c,u)=>{o=Kv("LCP",-1,s,a,l,c,u),n=Hv(e,o,$,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=Qv(!0))},c=e=>{var t;a.u&&e.navigationId&&Jv(a.u,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-Wv(),0),a.l(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.l(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=Zv(d,u);if(h){n=Hv(e,o,$,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;gm(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});qv(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,Bv()),n=Hv(e,o,$,t.reportAllChanges),Uv(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})})(t=>{e((e=>{let t={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:e.value};if(e.entries.length){var n,r,o;const a=e.entries.at(-1),l=a.url&&(bm.findLast(e=>e.name===a.url)||performance.getEntriesByType("resource").findLast(e=>e.name===a.url));let c;t.target=s.get(a),t.lcpEntry=a,a.url&&(t.url=a.url),l&&(t.lcpResourceEntry=l);let u=0,d=0;if("soft-navigation"!==e.navigationType?(c=Fv(),u=null!==(n=null==c?void 0:c.activationStart)&&void 0!==n?n:0,d=null!==(r=null==c?void 0:c.responseStart)&&void 0!==r?r:0):(u=e.navigationStartTime||0,c=null===(o=i.u)||void 0===o?void 0:o.get(e.navigationId)),c){const i=Math.max(0,d-u),s=Math.max(i,l?(l.requestStart||l.startTime)-u:0),n=Math.min(e.value,Math.max(s,l?l.responseEnd-u:0));t=at(at({},t),{},{timeToFirstByte:i,resourceLoadDelay:s-i,resourceLoadDuration:n-s,elementRenderDelay:e.value-n,navigationEntry:c})}}return Object.assign(e,{attribution:t})})(t))},t)};let wm=-1;const km=()=>wm,Cm=e=>{addEventListener("pageshow",t=>{t.persisted&&(wm=t.timeStamp,e(t))},!0)},Em=(e,t,i,s)=>{let n,r;return o=>{var a;t.value>=0&&(o||s)&&(r=t.value-(null!==(a=n)&&void 0!==a?a:0),(r||void 0===n)&&(n=t.value,t.delta=r,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,i),e(t)))}},xm=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Tm=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Im=()=>{var e,t;return null!==(e=null===(t=Tm())||void 0===t?void 0:t.activationStart)&&void 0!==e?e:0};let Rm=-1;const Pm=new Set,Mm=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Fm=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Pm)e();isFinite(Rm)||(Rm="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Fm,!0))}},Lm=(e=!1)=>{if(e&&(Rm=1/0),0>Rm){var t;const e=Im(),i=document.prerendering||null===(t=globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e))||void 0===t?void 0:t.startTime;Rm=null!=i?i:Mm(),addEventListener("visibilitychange",Fm,!0),addEventListener("prerenderingchange",Fm,!0),Cm(()=>{setTimeout(()=>{Rm=Mm()})})}return{get firstHiddenTime(){return Rm},onHidden(e){Pm.add(e)}}},Am=(e,t=-1,i,s=0,n,r,o)=>{const a=Tm(),l=(null==a?void 0:a.navigationId)||0;let c="navigate";return i?c=i:0>km()?a&&(document.prerendering||Im()>0?c="prerender":document.wasDiscarded?c="restore":a.type&&(c=a.type.replace(/_/g,"-"))):c="back-forward-cache",{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:c,navigationId:s||l,navigationInteractionId:n,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Om=new WeakMap;function $m(e,t){let i=Om.get(t);return i||(i=new WeakMap,Om.set(t,i)),i.get(e)||i.set(e,new t),i.get(e)}var Dm=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(e){var t;if(e.hadRecentInput)return;const i=this.o[0],s=this.o.at(-1);this.i&&i&&s&&1e3>e.startTime-s.startTime&&5e3>e.startTime-i.startTime?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),null===(t=this.t)||void 0===t||t.call(this,e)}};const Nm=(e,t,i={})=>{try{const s=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(s.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const i=e.getEntries();s.length>1&&i.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(i)})});for(const t of s)e.observe(at({type:t,buffered:!0},i));return e}}catch(e){}},Bm=e=>{var t,i;return(null===(t=globalThis.PerformanceObserver)||void 0===t||null===(t=t.supportedEntryTypes)||void 0===t?void 0:t.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&e&&e.reportSoftNavs},qm=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},Hm=e=>{let t=!1;return()=>{t||(e(),t=!0)}};var Um=class{constructor(){this.l=void 0}};const Wm=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},zm=[1800,3e3],jm=(e,t={})=>{const i=Bm(t);Wm(()=>{const s=$m(t,Um),n=Lm();let r,o=Am("FCP");const a=Nm(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(a.disconnect(),n.firstHiddenTime>t.startTime&&(o.value=Math.max(t.startTime-Im(),0),o.entries.push(t),o.navigationId=t.navigationId||o.navigationId,r(!0)))});a&&(r=Em(e,o,zm,t.reportAllChanges),Cm(i=>{o=Am("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,km()),r=Em(e,o,zm,t.reportAllChanges),xm(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Nm(["soft-navigation"],i=>{i.forEach(i=>{s.l&&i.navigationId&&qm(s.l,i);const n=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Am("FCP",n,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=Em(e,o,zm,t.reportAllChanges),r(!0)})},t)})},Vm=[.1,.25],Gm=(e,t={})=>{const i=Lm();jm(Hm(()=>{let s,n=Am("CLS",0);const r=$m(t,Dm),o=(i,o,a,l,c)=>{n=Am("CLS",0,i,o,a,l,c),r.i=0,s=Em(e,n,Vm,t.reportAllChanges)},a=(e=!1)=>{r.i>n.value&&(n.value=r.i,n.entries=r.o),s(e)},l=e=>{a(!0),o("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=e=>{for(const t of e)"soft-navigation"!==t.entryType?r.h(t):l(t);a()},u=["layout-shift"];Bm(t)&&u.push("soft-navigation");const d=Nm(u,c);d&&(s=Em(e,n,Vm,t.reportAllChanges),i.onHidden(()=>{c(d.takeRecords()),s(!0)}),Cm(()=>{o("back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,km()),xm(s)}),setTimeout(s))}))};let Qm=0,Km=1/0,Zm=0;const Ym=e=>{for(const t of e)t.interactionId&&(Km=Math.min(Km,t.interactionId),Zm=Math.max(Zm,t.interactionId),Qm=Zm?(Zm-Km)/7+1:0)};let Jm;const Xm=()=>{var e;return Jm?Qm:null!==(e=performance.interactionCount)&&void 0!==e?e:0};var ey=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Xm()-this.u}M(){this.u=Xm(),this.v.length=0,this.m.clear()}L(e){const t=this._(),i=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==i||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[i]:{P:8,id:-1,entries:[]}}h(e){var t;if(null===(t=this.p)||void 0===t||t.call(this,e),!e.interactionId)return;const i=this.v.at(-1);let s=this.m.get(e.interactionId);if(s||10>this.v.length||e.duration>i.P){var n;if(s?e.duration>s.P?(s.entries=[e],s.P=e.duration):e.duration===s.P&&e.startTime===s.entries[0].startTime&&s.entries.push(e):(s={id:e.interactionId,entries:[e],P:e.duration},this.m.set(s.id,s),this.v.push(s)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}null===(n=this.T)||void 0===n||n.call(this,s)}}};const ty=e=>{const t="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,s=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const n=Hm(e);let r=-1;const o=()=>{s(r),n()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),n()},{timeout:t})}},iy=[200,500],sy=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Lm();Wm(()=>{var s;"interactionCount"in performance||Jm||(Jm=Nm(["event"],Ym,{durationThreshold:0}));let n,r=Am("INP");const o=$m(t,ey),a=(i,s,a,l,c)=>{o.M(),r=Am("INP",-1,i,s,a,l,c),n=Em(e,r,iy,t.reportAllChanges)},l=()=>{const e=o.L(r.navigationType);e&&e.P!==r.value&&(r.value=e.P,r.entries=e.entries,n())},c=e=>{l(),n(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=(e,t=!1)=>{ty(()=>{for(const t of e)"soft-navigation"!==t.entryType?o.h(t):c(t);l(),t&&n(!0)})},d=["event","first-input"];Bm(t)&&d.push("soft-navigation");const h=Nm(d,u,at(at({},t),{},{durationThreshold:null!==(s=t.durationThreshold)&&void 0!==s?s:40}));n=Em(e,r,iy,t.reportAllChanges),h&&(i.onHidden(()=>{u(h.takeRecords(),!0)}),Cm(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,km())}))})};var ny=class{constructor(){this.p=void 0,this.l=void 0}h(e){var t;null===(t=this.p)||void 0===t||t.call(this,e)}};const ry=[2500,4e3],oy=(e,t={})=>{let i=!1;const s=Bm(t);Wm(()=>{let n,r=Lm(),o=Am("LCP");const a=$m(t,ny),l=(s,a,l,c,u)=>{o=Am("LCP",-1,s,a,l,c,u),n=Em(e,o,ry,t.reportAllChanges),i=!1,"soft-navigation"===s&&(r=Lm(!0))},c=e=>{var t;a.l&&e.navigationId&&qm(a.l,e),i||n(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const s=null===(t=e.getLargestInteractionContentfulPaint)||void 0===t?void 0:t.call(e);s&&u([s])},u=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){c(t);continue}let e=0,s=[],l=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-Im(),0),a.h(t),s=[t];else if("interaction-contentful-paint"===t.entryType){var i;const n=t;if(!o.navigationId)continue;if("interactionId"in n&&n.interactionId!=o.navigationInteractionId)continue;l=(null===(i=n.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,e=Math.max(l-t.startTime,0),n.largestContentfulPaint&&(a.h(n.largestContentfulPaint),s=[n.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=e,o.entries=s,n())}},d=["largest-contentful-paint"];s&&d.push("interaction-contentful-paint","soft-navigation");const h=Nm(d,u);if(h){n=Em(e,o,ry,t.reportAllChanges);const r=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!i){const e=o.id;ty(()=>{if(!i){if(!s){h.disconnect();for(const e of r)removeEventListener(e,a,{capture:!0})}e===o.id&&(i=!0,n(!0))}})}};for(const e of r)addEventListener(e,a,{capture:!0});Cm(s=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,km()),n=Em(e,o,ry,t.reportAllChanges),xm(()=>{o.value=performance.now()-s.timeStamp,i=!0,n(!0)})})}})},ay={onLCP:Sm,onCLS:om,onFCP:am,onINP:vm,withoutAttribution:{onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=ay,h.__PosthogExtensions__.postHogWebVitalsCallbacks=ay,h.postHogWebVitalsCallbacks=ay;const ly={onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=ly,h.__PosthogExtensions__.postHogWebVitalsCallbacks=ly,h.postHogWebVitalsCallbacks=ly,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>ly;const cy={onLCP:Sm,onCLS:om,onFCP:am,onINP:vm,withoutAttribution:{onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=cy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=cy,h.postHogWebVitalsCallbacks=cy;const uy={onLCP:oy,onCLS:Gm,onFCP:jm,onINP:sy};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},h.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=uy,h.__PosthogExtensions__.postHogWebVitalsCallbacks=uy,h.postHogWebVitalsCallbacks=uy,h.__PosthogExtensions__.loadWebVitalsCallbacks=()=>uy;var dy=class{constructor(e){this.disabled=!1===e;const t=kt(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,i){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const hy="$copy_autocapture",py=Ln("[AutoCapture]");function _y(e,t){return t.length>e?t.slice(0,e)+"...":t}function gy(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do{t=t.previousSibling}while(t&&!nr(t));return t}function fy(t,{e:i,maskAllElementAttributes:s,maskAllText:n,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,c;if(!nr(t))return{props:{}};const u=[t],d=new Set([t]);let h=t;for(;h.parentNode&&!rr(h,"body")&&1e3>u.length;){if(ar(h.parentNode)){const e=h.parentNode.host;if(d.has(e))break;d.add(e),u.push(e),h=e;continue}if(!nr(h.parentNode))break;if(d.has(h.parentNode))break;d.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const p="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(e=>rr(e,"button")||rr(e,"a")):-1;p>0&&(n=n||u.slice(0,p+1).some(e=>!Rr(e)||Pr(e)));const _=[],g={};let f,v=!1,m=!1;if(On(u,e=>{const t=Rr(e);if(rr(e,"a")){const i=e.getAttribute("href");v=!!(t&&i&&Nr(i))&&(a?ss(i):i)}_t(ur(e),"ph-no-capture")&&(m=!0),_.push(function(e,t,i,s,n=!1){const r=e.tagName.toLowerCase(),o={tag_name:r};_r.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?_y(1024,Br(e)):_y(1024,hr(e)));const a=ur(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),On(e.attributes,function(i){var r;if((!Pr(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&Nr(i.value)&&(!xt(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let e=i.value;"class"===i.name&&(e=lr(e).join(" ")),o["attr__"+i.name]=_y(1024,"href"===i.name&&n?ss(e):e)}});let l=1,c=1,u=e;for(;u=gy(u);)l++,u.tagName===e.tagName&&c++;return o.nth_child=l,o.nth_of_type=c,o}(e,s,n,r,a)),On(function(e){if(!Rr(e))return{};const t={};return On(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){const i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&Nr(s)&&(t[i]=s)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(g,t)||(g[t]=e)})}),m)return{props:{},explicitNoCapture:m};if(p>0&&(t=u[p],_.splice(0,p)),n||(_[0].$el_text=rr(t,"a")||rr(t,"button")?Br(t):hr(t)),v){var y,b;_[0].attr__href=v;const t=null===(y=Qn(v))||void 0===y?void 0:y.host,i=null==e||null===(b=e.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(f=v)}return{props:$n((w=i.type,{$event_type:w,$ce_version:1}),o?{}:{$elements:_},{$elements_chain:(S=_,St(S)?function(e){return e.map(e=>{var t,i;let s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class){e.attr_class.sort();for(const t of e.attr_class)s+=`.${t.replace(/"/g,"")}`}const n=at(at(at(at({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),r={};return Dn(n).sort(([e],[t])=>function(e,t){return t>e?-1:e>t?1:0}(e,t)).forEach(([e,t])=>r[Hr(e.toString())]=Hr(t.toString())),s+=":",s+=Dn(r).map(([e,t])=>`${e}="${t}"`).join(""),s}).join(";")}(function(e){return e.map(e=>{var t,i;const s={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Ur(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Dn(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>s.attributes[e]=t),s})}(S)):"")},(null===(l=_[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(c=_[0])||void 0===c?void 0:c.$el_text}:{},f&&"click"===i.type?{$external_click_url:f}:{},g),target:t};var S,w}var vy=class{_clearPointer(){this._pointerDown=void 0,clearTimeout(this._pointerExpiry),this._pointerExpiry=void 0}_isExcludedPointerTarget(e){var t;if(!Rr(e))return!0;const i=null!==(t=this._refreshConfig().css_selector_ignorelist)&&void 0!==t?t:mr,s=new Set;let n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const e=n,t=ur(e);if(_t(t,"ph-no-capture")||_t(t,"ph-sensitive")||Pr(e)||i.some(t=>gr(e,t)))return!0;const r=n.parentNode;n=ar(r)?r.host:r&&nr(r)?r:null}return!1}_trackPointer(e){if(!this.isEnabled||"pointercancel"===e.type)return void this._clearPointer();if("pointerdown"===e.type){this._clearPointer();const i=pr(e);var t;return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&nr(i)&&(this._pointerDown={target:i,excluded:this._isExcludedPointerTarget(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this._client)||void 0===t?void 0:t.distinctId}))}const i=this._pointerDown;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this._clearPointer():"pointerup"===e.type&&(i.released=!0,this._pointerExpiry=setTimeout(()=>this._clearPointer(),0)))}_recoverClickTarget(e){var t;const i=this._pointerDown;this._clearPointer();const n=pr(e);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(t=this._client)||void 0===t?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&n&&(rr(n,"html")||rr(n,"body"))){var r;if(i.excluded)return null;const e=null!==(r=this._refreshConfig().css_selector_ignorelist)&&void 0!==r?r:mr;return[n,null==s?void 0:s.documentElement,null==s?void 0:s.body].some(t=>{if(!t)return!1;const i=ur(t);return _t(i,"ph-no-capture")||_t(i,"ph-sensitive")||!Rr(t)||Pr(t)||e.some(e=>gr(t,e))})?null:i.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 dy(this._config.rageclick),this._elementSelectors=null}setup(e){this._compileUrlPatterns(),this._client=e;const 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)||void 0===e||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?void 0:e.map(e=>new RegExp(e)),this._config.url_ignorelist=null===(t=this._config.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this._config}_addDomEventHandlers(){if(!this.isBrowserSupported())return void py.info("Disabling Automatic Event Collection because this browser is not supported");if(!e||!s)return;const t=this._domEventHandler=t=>{t=t||(null==e?void 0:e.event);try{if("blur"===t.type)return void this._clearPointer();if(0===t.type.indexOf("pointer"))return void this._trackPointer(t);const e="click"===t.type?this._recoverClickTarget(t):void 0;if(It(e))return;this._captureEvent(t,"$autocapture",e)}catch(e){py.error("Failed to capture event",e)}};if(zn(e,"blur",t),zn(s,"submit",t,{capture:!0}),zn(s,"change",t,{capture:!0}),zn(s,"click",t,{capture:!0}),On(["pointerdown","pointermove","pointerup","pointercancel"],e=>{zn(s,e,t,{capture:!0})}),this._refreshConfig().capture_copied_text){const t=this._copiedTextHandler=t=>{t=t||(null==e?void 0:e.event);try{this._captureEvent(t,hy)}catch(e){py.error("Failed to capture clipboard event",e)}};zn(s,"copy",t,{capture:!0}),zn(s,"cut",t,{capture:!0}),zn(s,"paste",t,{capture:!0})}}_removeDomEventHandlers(){this._clearPointer(),this._domEventHandler&&(null==e||e.removeEventListener("blur",this._domEventHandler),On(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==s||s.removeEventListener(e,this._domEventHandler,!0)}),null==s||s.removeEventListener("submit",this._domEventHandler,!0),null==s||s.removeEventListener("change",this._domEventHandler,!0),null==s||s.removeEventListener("click",this._domEventHandler,!0),this._domEventHandler=void 0),this._copiedTextHandler&&(null==s||s.removeEventListener("copy",this._copiedTextHandler,!0),null==s||s.removeEventListener("cut",this._copiedTextHandler,!0),null==s||s.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)return;if(this._hasReceivedConfigResponse=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;Ft(i)&&(null===(s=this._client)||void 0===s||s.kv.set("$autocapture_disabled_server_side",i),this._isDisabledServerSide=i),this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e,t){var i;const n=[];return null===(i=this._elementSelectors)||void 0===i||i.forEach(i=>{const r=null==s?void 0:s.querySelectorAll(i);null==r||r.forEach(s=>{e!==s&&t!==s||_t(n,i)||n.push(i)})}),n}get isEnabled(){var e,t;if(this._disposed)return!1;const i=null===(e=this._client)||void 0===e?void 0:e.kv.get(w),s=this._isDisabledServerSide,n=this._refreshConfig();if(!n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse)return!1;const r=n.remoteRequestsDisabled&&!this._hasReceivedConfigResponse;if(It(s)&&!Ft(i)&&!r)return!1;const o=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!n.enabled&&!o}_captureEvent(t,i="$autocapture",s){if(!this.isEnabled)return void this._clearPointer();let n=s||pr(t);or(n)&&(n=n.parentNode||null);const r=this._compileUrlPatterns();var o;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&xr(n,r.rageclick)&&this._captureEvent(t,"$rageclick",s);const a=i===hy,l=a?at(at({},r),{},{dom_event_allowlist:void 0}):r;if(n&&function(t,i,s,n,r,o){var a;if(!e||Tr(t))return!1;if((null==s?void 0:s.url_allowlist)&&!cr(s.url_allowlist,o))return!1;if((null==s?void 0:s.url_ignorelist)&&cr(s.url_ignorelist,o))return!1;if(null==s?void 0:s.dom_event_allowlist){const e=s.dom_event_allowlist;if(e&&!e.some(e=>i.type===e))return!1}const{parentIsUsefulElement:l,targetElementList:c}=Ir(t,n);if(!function(e,t){const i=null==t?void 0:t.element_allowlist;if(Et(i))return!0;for(const t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(c,s))return!1;if(!fr(c,null==s?void 0:s.css_selector_allowlist))return!1;if(fr(c,null!==(a=null==s?void 0:s.css_selector_ignorelist)&&void 0!==a?a:mr))return!1;try{const s=e.getComputedStyle(t);if(s&&"pointer"===s.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(e){}const u=t.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return l?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(_r.indexOf(u)>-1||"true"===t.getAttribute("contenteditable"))}}(n,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:s,explicitNoCapture:o,target:a}=fy(n,{e:t,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(n,a);if(l&&l.length>0&&(s.$element_selectors=l),i===hy){const i=t.type||"clipboard";if("paste"!==i){var u,d;const t=null==e||null===(u=e.getSelection())||void 0===u?void 0:u.toString(),i=dr(t);if(!i)return!1;s.$selected_content=i,s.$clipboard_text_length=null!==(d=null==t?void 0:t.length)&&void 0!==d?d:0}s.$copy_type=i}return null===(c=this._client)||void 0===c||c.capture(i,s).catch(e=>py.error("Failed to capture event",e)),!0}}isBrowserSupported(){return wt(null==s?void 0:s.querySelectorAll)}};const my={};function yy(e,t){const i=pr(e);return i?at({node:i,originalEvent:e,timestamp:Date.now()},t):null}function by(e,t){return Math.abs(e)<Math.abs(t)?0>t?"up":"down":0>e?"left":"right"}function Sy(e){return"swipe"===e.type?"$dead_swipe":"$dead_click"}const wy="canvas,video,audio,embed,object";function ky(e,t){return Pt(e)&&e>=t}function Cy(e,t=1e3){return e>=0&&t>e?e:void 0}function Ey(e,t,i=1e3){return Pt(t)?Cy(e-t,i):void 0}var xy=class{_asRequiredConfig(e){var t,i,s,n,r,o,a,l;const c=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:c.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==e?void 0:e.scroll_threshold_ms)&&void 0!==i?i:c.scroll_threshold_ms,selection_change_threshold_ms:null!==(s=null==e?void 0:e.selection_change_threshold_ms)&&void 0!==s?s:c.selection_change_threshold_ms,mutation_threshold_ms:null!==(n=null==e?void 0:e.mutation_threshold_ms)&&void 0!==n?n:c.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==e?void 0:e.capture_clicks_with_modifier_keys)&&void 0!==r?r:c.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==e?void 0:e.capture_dead_swipes)&&void 0!==o?o:c.capture_dead_swipes,swipe_threshold_px:null!==(a=null==e?void 0:e.swipe_threshold_px)&&void 0!==a?a:c.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:c.max_dead_swipes_per_page_load,css_selector_ignorelist:null==e?void 0:e.css_selector_ignorelist,__onCapture:c.__onCapture}}constructor(e,t){this.instance=e,this._hadSelection=!1,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._clearMouseSelection=()=>{clearTimeout(this._mouseSelectionTimer),this._mouseSelectionTimer=void 0,this._mouseSelection=void 0},this._onMouseDown=e=>{if(this._clearMouseSelection(),0===e.button){const t={path:e.composedPath(),trusted:e.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==s?void 0:s.getSelection();t.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this._selectionTouchesGesture(i,t),this._mouseSelection=t}},this._onMouseOut=e=>{It(e.relatedTarget)&&this._clearMouseSelection()},this._onMouseUp=e=>{const t=this._mouseSelection,i=e;if(!t||0!==i.button||e.isTrusted!==t.trusted)return;const s=e.composedPath();for(const e of t.path)if(nr(e)&&-1!==s.indexOf(e)){t.clickTarget=e;break}t.clickDetail=i.detail,this._mouseSelectionTimer=h.setTimeout(this._clearMouseSelection,0)},this._onClick=e=>{const t=e,i=yy(t,{type:"click"}),s=this._mouseSelection;i&&s&&0===t.button&&t.detail>0&&t.detail===s.clickDetail&&e.isTrusted===s.trusted&&i.node===s.clickTarget&&(i.selectionChangedDuringGesture=s.selectionChanged&&this._config.selection_change_threshold_ms>0,this._clearMouseSelection()),It(i)||this._ignore(i)||this._queueCandidate(i),this._scheduleCheck()},this._onScroll=()=>{const e=Date.now();this._lastScroll=e,e%50==0&&this._clicks.forEach(t=>{Et(t.scrollDelayMs)&&(t.scrollDelayMs=e-t.timestamp)})},this._onSelectionChange=e=>{var t,i;const n=null==s?void 0:s.getSelection(),r=this._hadSelection;this._hadSelection="Range"===(null==n?void 0:n.type);const o=null==n?void 0:n.focusNode,a=o&&(nr(o)?o:o.parentElement),l=null==s?void 0:s.activeElement;let c=l;for(;null==c||null===(t=c.shadowRoot)||void 0===t?void 0:t.activeElement;)c=c.shadowRoot.activeElement;const u=Er(pr(e))||Er(null!=a?a:null)||Er(null!==(i=c)&&void 0!==i?i:null),d="Caret"===(null==n?void 0:n.type)&&c&&!c.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this._hadSelection||u||d))return;const h=Date.now();this._lastSelectionChanged=h;const p=this._mouseSelection;if(p&&(r||this._hadSelection||u)){const t=pr(e);let i;if(Er(t))i=t;else if("Caret"===(null==n?void 0:n.type)){var _;Er(null!==(_=c)&&void 0!==_?_:null)||d?i=c:u&&(i=a)}const s=i?this._selectionIsInGesture(i,p):n&&(o||n.anchorNode)?this._selectionTouchesGesture(n,p):r&&!this._hadSelection&&p.selectionInitiallyRelated;p.selectionChanged=p.selectionChanged||s}this._clicks.forEach(e=>{const t=h-e.timestamp;0>t||!Et(e.selectionChangedDelayMs)&&t>=e.selectionChangedDelayMs||(e.selectionChangedDelayMs=t)})},this._onVisibilityChange=()=>{"hidden"===(null==s?void 0:s.visibilityState)&&this._clearMouseSelection();const e=Date.now();this._lastVisibilityChange=e,this._recordLivenessSignal("visibilityChangedDelayMs",e)},this._onFocusChange=()=>{const e=Date.now();this._lastFocusChange=e,this._recordLivenessSignal("focusChangedDelayMs",e)},this._onTouchStart=e=>{const t=e.touches,i=1===(null==t?void 0:t.length)?t[0]:void 0;this._touchStart=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this._onTouchCancel=()=>{this._touchStart=void 0},this._onTouchEnd=e=>{var t;const i=this._touchStart;if(this._touchStart=void 0,Et(i)||this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)return;const n=e,r=null===(t=n.changedTouches)||void 0===t?void 0:t[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,c=this._config.swipe_threshold_px;if(c*c>l)return;if([this._lastScroll,this._lastMutation,this._lastSelectionChanged].some(e=>Pt(e)&&e>=i.timestamp))return;var u,d;if(this._pageHasUnobservableSurfaces()&&(null!==(u=null==s||null===(d=s.elementsFromPoint)||void 0===d?void 0:d.call(s,i.x,i.y))&&void 0!==u?u:[]).some(e=>{var t;return null===(t=e.matches)||void 0===t?void 0:t.call(e,wy)}))return;const h=yy(n,{type:"swipe",swipeDirection:by(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});It(h)||this._ignore(h)||this._queueCandidate(h),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(t){if(!this._mutationObserver){const i=function(t){return function(t,i){const s=my[t];if(s)return s;let n=i[t];if((e=>wt(e)&&-1!==e.toString().indexOf("[native code]"))(n)&&!(null==e?void 0:e.Zone))return my[t]=n.bind(i);const r=i.document;if(r&&wt(r.createElement)){let e,s=!1;try{e=r.createElement("iframe"),e.hidden=!0,r.head.appendChild(e);const l=e.contentWindow;var o,a;l&&l[t]&&(n=l[t],"MutationObserver"===t&&function(e){return _t(e,"AppleWebKit")&&!_t(e,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(e.classList.add("rr-block","ph-no-capture"),s=!0))}catch(e){Fn.warn(`Could not create sandbox iframe for ${t} check, bailing to assignableWindow.${t}: `,e)}finally{!s&&(null==e?void 0:e.parentNode)&&e.parentNode.removeChild(e)}}return n&&wt(n)?my[t]=n.bind(i):n}("MutationObserver",t)}(h);this._mutationObserver=new i(e=>{this._onMutation(e)}),this._mutationObserver.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0})}}stop(){var e;null===(e=this._mutationObserver)||void 0===e||e.disconnect(),this._mutationObserver=void 0,h.removeEventListener("click",this._onClick),h.removeEventListener("mousedown",this._onMouseDown,{capture:!0}),h.removeEventListener("mouseup",this._onMouseUp,{capture:!0}),h.removeEventListener("mouseout",this._onMouseOut,{capture:!0}),h.removeEventListener("dragstart",this._clearMouseSelection,{capture:!0}),h.removeEventListener("pointercancel",this._clearMouseSelection,{capture:!0}),h.removeEventListener("blur",this._clearMouseSelection),this._clearMouseSelection(),h.removeEventListener("scroll",this._onScroll,{capture:!0}),null==s||s.removeEventListener("selectionchange",this._onSelectionChange),h.removeEventListener("touchstart",this._onTouchStart,{capture:!0}),h.removeEventListener("touchend",this._onTouchEnd,{capture:!0}),h.removeEventListener("touchcancel",this._onTouchCancel,{capture:!0}),null==s||s.removeEventListener("visibilitychange",this._onVisibilityChange),h.removeEventListener("blur",this._onFocusChange),h.removeEventListener("focus",this._onFocusChange),this._touchStart=void 0}_onMutation(e){this._lastMutation=Date.now()}_startClickObserver(){zn(h,"click",this._onClick),zn(h,"mousedown",this._onMouseDown,{capture:!0}),zn(h,"mouseup",this._onMouseUp,{capture:!0}),zn(h,"mouseout",this._onMouseOut,{capture:!0}),zn(h,"dragstart",this._clearMouseSelection,{capture:!0}),zn(h,"pointercancel",this._clearMouseSelection,{capture:!0}),zn(h,"blur",this._clearMouseSelection)}_queueCandidate(e){e.selectionChangedDelayMs=Ey(e.timestamp,this._lastSelectionChanged,this._config.selection_change_threshold_ms),e.visibilityChangedDelayMs=Ey(e.timestamp,this._lastVisibilityChange),e.focusChangedDelayMs=Ey(e.timestamp,this._lastFocusChange),this._clicks.push(e)}_scheduleCheck(){this._clicks.length&&Et(this._checkClickTimer)&&(this._checkClickTimer=h.setTimeout(()=>{this._checkClicks()},1e3))}_startScrollObserver(){zn(h,"scroll",this._onScroll,{capture:!0})}_startSelectionChangedObserver(){var e;this._hadSelection="Range"===(null==s||null===(e=s.getSelection())||void 0===e?void 0:e.type),zn(s,"selectionchange",this._onSelectionChange)}_selectionIsInGesture(e,t){const i=t.path[0];for(;e;){if(-1!==t.path.indexOf(e)||nr(i)&&i.contains(e))return!0;e=e.getRootNode().host}return!1}_selectionTouchesGesture(e,t){const i=t.path[0],s=e.rangeCount>0?e.getRangeAt(0):void 0;if(s&&nr(i)&&s.startContainer.getRootNode()===i.getRootNode()){var n;if(!s.collapsed)return s.intersectsNode(i);const e=nr(s.startContainer)&&null!==(n=s.startContainer.childNodes[s.startOffset])&&void 0!==n?n:s.startContainer;return this._selectionIsInGesture(e,t)}return this._selectionIsInGesture(e.focusNode,t)||this._selectionIsInGesture(e.anchorNode,t)}_startVisibilityChangeObserver(){zn(s,"visibilitychange",this._onVisibilityChange)}_startFocusChangeObserver(){zn(h,"blur",this._onFocusChange),zn(h,"focus",this._onFocusChange)}_recordLivenessSignal(e,t){this._clicks.forEach(i=>{const s=Cy(t-i.timestamp);Pt(s)&&(Et(i[e])||i[e]>s)&&(i[e]=s)})}_startSwipeObserver(){zn(h,"touchstart",this._onTouchStart,{capture:!0,passive:!0}),zn(h,"touchend",this._onTouchEnd,{capture:!0,passive:!0}),zn(h,"touchcancel",this._onTouchCancel,{capture:!0,passive:!0})}_pageHasUnobservableSurfaces(){const e=Et(this._surfacesCheckedAt)||Pt(this._lastMutation)&&this._lastMutation>this._surfacesCheckedAt;return(Et(this._hasUnobservableSurfaces)||e)&&(this._surfacesCheckedAt=Date.now(),this._hasUnobservableSurfaces=!!(null==s?void 0:s.querySelector(wy))),!!this._hasUnobservableSurfaces}_ignore(e){return!e||("swipe"===e.type?this._ignoreCommon(e):this._ignoreClick(e))}_ignoreCommon(t){return!(!sr(t.node)&&!this._clicks.some(e=>e.type===t.type&&e.node===t.node&&1e3>Math.abs(e.timestamp-t.timestamp))&&!rr(t.node,"html")&&nr(t.node)&&function(t,i){var s;if(!e||Tr(t))return!1;const n=Ft(i)?wr:null!==(s=null==i?void 0:i.css_selector_ignorelist)&&void 0!==s?s:wr,{targetElementList:r}=Ir(t,!1);return!fr(r,n)}(t.node,{css_selector_ignorelist:this._config.css_selector_ignorelist}))}_ignoreClick(t){return!(this._config.capture_clicks_with_modifier_keys||(i=t.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this._ignoreCommon(t)||function(t){if(!e||Tr(t))return!1;const{targetElementList:i}=Ir(t,!1);return i.some(e=>rr(e,"a"))}(t.node);var i}_checkClicks(){if(!this._clicks.length)return;clearTimeout(this._checkClickTimer),this._checkClickTimer=void 0;const e=this._clicks;this._clicks=[];for(const i of e){var t;i.mutationDelayMs=null!==(t=i.mutationDelayMs)&&void 0!==t?t:this._lastMutation&&this._lastMutation>=i.timestamp?this._lastMutation-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const e=ky(i.scrollDelayMs,this._config.scroll_threshold_ms),s=ky(i.selectionChangedDelayMs,this._config.selection_change_threshold_ms),n=ky(i.mutationDelayMs,this._config.mutation_threshold_ms),r=ky(i.absoluteDelayMs,1.1*this._config.mutation_threshold_ms),o=Pt(i.scrollDelayMs)&&this._config.scroll_threshold_ms>i.scrollDelayMs,a=Pt(i.mutationDelayMs)&&this._config.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Pt(i.selectionChangedDelayMs)&&this._config.selection_change_threshold_ms>i.selectionChangedDelayMs,c=Pt(i.visibilityChangedDelayMs),u=Pt(i.focusChangedDelayMs);if(!(o||a||l||c||u))if(e||n||r||s){const t=Sy(i);if("$dead_swipe"===t){if(this._deadSwipesCaptured>=this._config.max_dead_swipes_per_page_load)continue;this._deadSwipesCaptured++}this._onCapture(i,{[`${t}_last_mutation_timestamp`]:this._lastMutation,[`${t}_event_timestamp`]:i.timestamp,[`${t}_scroll_timeout`]:e,[`${t}_mutation_timeout`]:n,[`${t}_absolute_timeout`]:r,[`${t}_selection_changed_timeout`]:s,[`${t}_visibility_changed_timeout`]:!1})}else this._config.mutation_threshold_ms>i.absoluteDelayMs&&this._clicks.push(i)}this._scheduleCheck()}_captureDeadClick(e,t){const i=Sy(e);this.instance.capture(i,at(at(at({},t),fy(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),{},{[`${i}_scroll_delay_ms`]:e.scrollDelayMs,[`${i}_mutation_delay_ms`]:e.mutationDelayMs,[`${i}_absolute_delay_ms`]:e.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:e.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:e.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:e.focusChangedDelayMs,$dead_swipe_direction:e.swipeDirection,$dead_swipe_distance_px:e.swipeDistancePx}),{timestamp:new Date(e.timestamp)})}};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.initDeadClicksAutocapture=(e,t)=>new xy(e,t);var Ty=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(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){const e=this._storage._get(this._storageKey);return Ut(e)?1:_t(Wt,e)?0:-1}get _storage(){const e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ca:wa,i=t._is_supported()?t:$a;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;const t="localStorage"===e?wa:Ca;t._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(Ut(t._get(this._storageKey))),t._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(e=>Ut(e))}};const Iy=Ln("[Dead Clicks]"),Ry=()=>!0,Py=e=>{var t;const i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property(I)),s=e.instance.config.capture_dead_clicks;return Ft(s)?s:!!kt(s)||i};var My=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[I]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript(()=>{this._start()}):this.stop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?Iy.error("failed to load script",t):e()})}_start(){var e;if(s){if(!this._lazyLoadedDeadClicksAutocapture&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){const e=kt(this.instance.config.capture_dead_clicks)?at({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this._lazyLoadedDeadClicksAutocapture=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this._lazyLoadedDeadClicksAutocapture.start(s),Iy.info("starting...")}}else Iy.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Iy.info("stopping..."))}};const Fy=Ln("[SegmentIntegration]");function Ly(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:n,filterProperties:r}=(e=>wt(e.register))(o=s)?{analytics:o}:o;var o;!function(e,t,i,s){const n=t=>{const n=()=>t.anonymousId()||va();e.config.get_device_id=n,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:n()}),e.persistence.set_property(Ce,Qe)),i(s?void 0:t.anonymousId()||void 0)},r=t.user();"then"in r&&wt(r.then)?r.then(n):n(r)}(e,n,i=>{n.register(((e,t,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||Fy.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!t&&s.event.anonymousId===t&&!s.event.userId;r||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(Fy.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(Fy.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));let o=e.calculateEventProperties(n,s.event.properties);if(!Rt(i)){const e=s.event.properties||{},t={};for(const i of Object.keys(o))yt.call(e,i)||(t[i]=o[i]);const n=((e,t)=>{const i=St(e)?e:[e];let s=at({},t);for(const e of i)try{if(s=e(s),Rt(s))return null}catch(e){return Fy.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(Rt(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return s(e,e.event.event)},page(e){return s(e,Je)},identify(e){return s(e,et)},screen(e){return s(e,"$screen")}}})(e,i,{filterProperties:r})).then(()=>{t()},e=>{Fy.error("Failed to register the Segment integration",e),t()})},i)}const Ay="posthog-js";function Oy(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if("*"!==n&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],_=p.map(e=>at(at({},e),{},{stacktrace:e.stacktrace?at(at({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>at(at({},e),{},{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null===(l=p[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(c=p[0])||void 0===c?void 0:c.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(u=p[0])||void 0===u?void 0:u.value)||o.message,$sentry_exception_type:null===(d=p[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var f;return t&&i&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(f=e.exceptions)||void 0===f||f.sendExceptionEvent(g)),o}}var $y=class{constructor(e,t,i,s,n,r){this.name=Ay,this.setupOnce=function(o){o(Oy(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},Dy=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Fn.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),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?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null===(e=this._unsubscribeSessionId)||void 0===e||e.call(this),this._unsubscribeSessionId=void 0}doPageView(t,i){var s;const n=this._previousPageViewProperties(t,i);return this._currentPageview={pathname:null!==(s=null==e?void 0:e.location.pathname)&&void 0!==s?s:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this._previousPageViewProperties(e,null===(t=this._currentPageview)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this._currentPageview)||void 0===e?void 0:e.pageViewId}}_previousPageViewProperties(e,t){const i=this._currentPageview;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=n;if(!(Et(e)||Et(t)||Et(i)||Et(r)||Et(o)||Et(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const n=e>1?Vt(t/e,0,1,Fn):1,l=e>1?Vt(i/e,0,1,Fn):1,c=r>1?Vt(o/r,0,1,Fn):1,u=r>1?Vt(a/r,0,1,Fn):1;s=$n(s,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:u})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};const Ny=["flags","surveys"],By={[p]:{exposure:"hidden"},[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[S]:{exposure:"hidden"},[b]:{exposure:"hidden"},[w]:{exposure:"event"},[k]:{exposure:"hidden"},[P]:{exposure:"hidden"},[C]:{exposure:"event"},[E]:{exposure:"hidden"},[x]:{exposure:"event"},[T]:{exposure:"event"},[I]:{exposure:"event"},[R]:{exposure:"hidden"},[M]:{exposure:"event"},[F]:{exposure:"hidden"},[L]:{exposure:"hidden"},[q]:{exposure:"hidden"},[H]:{exposure:"event"},[A]:{exposure:"event",shouldSkipFromEventProperties:e=>It(e)},[U]:{exposure:"event"},[W]:{exposure:"event"},[z]:{exposure:"event"},[Q]:{exposure:"event"},[K]:{exposure:"hidden"},[Z]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden",storageGroup:"flags"},[J]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[ee]:{exposure:"hidden",storageGroup:"flags"},[te]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ie]:{exposure:"hidden",storageGroup:"flags"},[se]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[re]:{exposure:"hidden"},[oe]:{exposure:"hidden"},[le]:{exposure:"hidden",storageGroup:"surveys"},[ce]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ue]:{exposure:"event"},[de]:{exposure:"hidden"},[he]:{exposure:"hidden"},[pe]:{exposure:"hidden"},[_e]:{exposure:"hidden"},[ge]:{exposure:"hidden"},[fe]:{exposure:"event"},[ve]:{exposure:"event"},[me]:{exposure:"event"},[ye]:{exposure:"event"},[be]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[ae]:{exposure:"event"},[we]:{exposure:"hidden"},[ke]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ce]:{exposure:"hidden"},[Ee]:{exposure:"hidden"},[xe]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[Ie]:{exposure:"hidden"},[Re]:{exposure:"hidden"},[Pe]:{exposure:"hidden"},[O]:{exposure:"event"},[D]:{exposure:"event"},[N]:{exposure:"event"},[B]:{exposure:"event"},[Le]:{exposure:"event"},[Ae]:{exposure:"event"},[Oe]:{exposure:"event"},[$e]:{exposure:"event"},[De]:{exposure:"event"},[Ne]:{exposure:"event"},[Be]:{exposure:"event"},[qe]:{exposure:"event"},[He]:{exposure:"event"},[Ue]:{exposure:"event"},[je]:{exposure:"event"}},qy=[[j,{exposure:"hidden"}],[V,{exposure:"hidden"}],[G,{exposure:"hidden"}]],Hy=e=>{const t=By[e];if(t)return t;for(const[t,i]of qy)if(0===e.indexOf(t))return i},Uy={flags:ke,surveys:ce},Wy=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],zy=e=>`${e}_cookie_identity_change_pending`,jy=e=>{let t="",i=0;for(const s of e){const e=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+e>1e3)break;t+=s,i+=e}return t},Vy="main",Gy=[Z,Y,X,ee,te,ke,ie,re],Qy=e=>-1!==Gy.indexOf(e),Ky=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Zy=e=>{if(!e)return{};const t=JSON.parse(e);return kt(t)?t:{}},Yy=(e,t)=>{On(e,(i,s)=>{const n=Hy(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})};var Jy=class{constructor(t,i,s=!0){if(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=t,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{let 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"})(t),this._storage=this._buildStorage(t),this._splitStorage=this._resolveSplitStorage(t),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),t.debug&&Fn.info("Persistence loaded",t.persistence,at({},this.props)),this.update_config(t,t,i),this.save(),e){const t=()=>this.flush();zn(e,"beforeunload",t,{capture:!1}),zn(e,"pagehide",t,{capture:!1}),this._onStorage=t=>{if(this._splitStorageEligible&&(!t.storageArea||t.storageArea===(null==e?void 0:e.localStorage))&&t.key)if(t.key!==this._name){if(this._splitStorage){const e=Ny.find(e=>t.key===this._groupEntryName(e));e&&this._syncCrossTabFeatureFlagProperties(t.key,e)}}else this._syncCrossTabFeatureFlagProperties(t.key,Vy)},zn(e,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!Qy(e)||!0===i)return;if(!0===t)return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(i||[]);t.forEach(e=>s.add(e)),s.size&&this._setCrossTabFeatureFlagChangesPending(e,s)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&e&&(e.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i=!0){if(this._disabled)return!1;let s,n;try{if(n=Ca._get(e),It(n)){const e=this._slotWriteState(t);return e.storageValue=null,t!==Vy&&(e.persisted=!1),!1}s=Zy(n)}catch(e){return!1}const r=t===Vy?s:Ca._parse(this._name);if(r&&this._hasCrossTabFeatureFlagIdentityMismatch(r))return!1;const o=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===Vy&&this._splitStorage&&!Ky(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,n),o}_hasCrossTabFeatureFlagIdentityMismatch(e){const t=this.props[_],i=e[_];return!Et(t)&&!Et(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){const n=this._slotWriteState(t);n.storageValue=s,t!==Vy&&(n.persisted=i);try{n.fingerprint=this._entryFingerprint(e,t)}catch(e){n.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){let s=!1;return Gy.forEach(i=>{var n;const r=null===(n=Hy(i))||void 0===n?void 0:n.storageGroup;if(t===Vy&&this._splitStorage&&r||t!==Vy&&r!==t)return;const o=i in e,a=this._mergePendingCrossTabFeatureFlagChanges(i,o?e[i]:void 0),l=this._pendingCrossTabFeatureFlagChanges.has(i)?i in this.props:o;l===i in this.props&&Ky(a,this.props[i])||(l?this._setProp(i,a,!1):this._deleteProp(i,!1),s=!0)}),s&&i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()),s}_reconcileCrossTabFeatureFlagPropertiesBeforeWrite(){if(!this._splitStorageEligible)return!1;try{this._crossTabFeatureFlagIdentityMismatch=!1;const e=Ca._get(this._name),t=this._slotWriteState(Vy);let i,s=!1,n=!1;if(e!==t.storageValue)if(It(e))t.storageValue=null;else{if(i=Zy(e),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(i),this._crossTabFeatureFlagIdentityMismatch)return!1;n=this._mergeCrossTabFeatureFlagProperties(i,Vy,!1),!this._splitStorage||Ky(this._partitionProps().main,i)?this._rememberCrossTabStorageFingerprint(i,Vy,!0,e):t.storageValue=e,s=!0}return this._splitStorage&&Ny.forEach(e=>{const t=Ca._get(this._groupEntryName(e)),r=this._slotWriteState(e),o=i||{},a=s&&Gy.some(t=>{var i;return(null===(i=Hy(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===r.storageValue&&!a)return;if(It(t))return r.storageValue=null,r.persisted=!1,void(a&&(n=this._mergeCrossTabFeatureFlagProperties(o,e,!1)||n));const l=Zy(t);n=this._mergeCrossTabFeatureFlagProperties(l,e,!1)||n,this._rememberCrossTabStorageFingerprint(l,e,!0,t)}),n}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);const i=Hy(e);(null==i?void 0:i.volatile)||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||Vy).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){Gy.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{const e=Ca._get(this._name),t=Zy(e);this._slotWriteState(Vy).storageValue=e,Gy.forEach(e=>{var i;const s=this._splitStorage?null===(i=Hy(e))||void 0===i?void 0:i.storageGroup:void 0,n=s?Ca._get(this._groupEntryName(s)):null;if(s){const e=this._slotWriteState(s);e.storageValue=n,e.persisted=!It(n)}const r=s&&!It(n)?Zy(n):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,r[e],this.props[e]):e in r&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){const i=this._pendingCrossTabFeatureFlagChanges.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){const s=new Set(St(t)?t:[]),n=new Set(St(this.props[e])?this.props[e]:[]);return i.forEach(e=>n.has(e)?s.add(e):s.delete(e)),Array.from(s)}const s=kt(t)?at({},t):{},n=kt(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in n?s[e]=n[e]:delete s[e]}),s}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(!Qy(e))return;const s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0===s)return;let n=t;if(this._splitStorageEligible)try{var r;const t=this._splitStorage?null===(r=Hy(e))||void 0===r?void 0:r.storageGroup:void 0,i=t?this._groupEntryName(t):this._name;n=Zy(Ca._get(i))[e]}catch(e){}const o=new Set(s||[]);if("$active_feature_flags"===e){if(!Et(t)&&!St(t)||!Et(n)&&!St(n)||!St(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=new Set(t||[]),r=new Set(n||[]),a=new Set(i);new Set([...s,...a]).forEach(e=>{s.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{r.has(e)===a.has(e)&&o.delete(e)})}else{if(!kt(i))return void(Ky(n,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));{if(!Et(t)&&!kt(t)||Et(t)&&Ct(i)&&Et(n))return void this._setCrossTabFeatureFlagChangesPending(e,!0);const s=kt(t)?t:{},r=kt(n)?n:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&Ky(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in r==e in i&&Ky(r[e],i[e])&&o.delete(e)})}}o.size?this._setCrossTabFeatureFlagChangesPending(e,o):this._pendingCrossTabFeatureFlagChanges.delete(e)}_saveDebounceMs(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Pt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{const t=Pa(e,this._config.cookie_persisted_properties||[]),i=Fa(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=wa._get(this._name)||void 0;n&&Aa(this._name,n)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=n)}catch(e){}else try{const e=wa._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=e?Aa(this._name,e):void 0,this._lastSeenMainCookieValue=e}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t=!1){if(this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;let i;try{i=wa._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;const s=Aa(this._name,i);let n;try{n=Ra(JSON.parse(i))}catch(e){return!1}if((wa._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=i;const r=La(this._name,i),o=[...xa,...r.properties],a={};if(Object.keys(n).forEach(e=>{const t=n[e];(Et(t)||It(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete n[e])}),Ct(n))return!1;const l="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,c=this.props,u=c[_],d=c[Ce],h=$n({},c);[...xa,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in n)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){const t=h[e];(r.isValid||-1===xa.indexOf(e)||!1!==t&&0!==t)&&delete h[e]}}),this.props=$n(h,n),Gy.forEach(e=>{const t=e in this.props;e in c===t&&Ky(c[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,c[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this._setProp(Ce,Ge);const p=this.props[_],g=this.props[Ce];return!l||p===u&&g===d||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Na._set(zy(this._name),!0),this._deleteProp(re),this._deleteProp(Y),this._deleteProp(Z),this._deleteProp(X),this._deleteProp(ee),this._deleteProp(te),this._deleteProp(ke),this._deleteProp(we),this._deleteProp(be),"anonymous"!==g||"identified"!==d&&"anonymous"!==n.$user_state&&(Et(u)||p===u)||(Yy(this.props,n),this._deleteProp(oe)),"identified"===g?this.props.$user_id=p:delete this.props.$user_id,this._deleteProp(v)),!0}consumeCookieIdentityChange(){const e=zy(this._name),t=this._cookieIdentityChangePending||!!Na._get(e);return this._cookieIdentityChangePending=!1,t&&Na._remove(e),t}_beginCookieSyncSuppression(e=!1){return!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[Vy],this._writeNow(!0))}_endCookieSyncSuppression(e=!0){if(this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(t){-1===Wy.indexOf(t.persistence.toLowerCase())&&(Fn.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1)=>{const s=[...xa,...t];return at(at({},Ca),{},{_parse(e){try{let n,r={};try{n=wa._get(e)||void 0,r=n?Ra(JSON.parse(n)):{}}catch(e){}const o=JSON.parse(Ca._get(e)||"{}");let a;if(i){const i=La(e,n),l=[...xa,...i.properties],c={};Object.keys(r).forEach(e=>{const t=r[e];It(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(c[e]=t)});const u="distinct_id"in c||"anonymous"===c.$user_state||"identified"===c.$user_state;if(Object.keys(c).length>0){var t;const e=o[_],n=null!==(t=o.$user_state)&&void 0!==t?t:Ge;s.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in r)&&(u||"distinct_id"!==e&&"$user_state"!==e)){const t=o[e];(i.isValid||-1===xa.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!u||"$user_state"in r||"$user_state"in o||(o[Ce]=Ge),!u||("distinct_id"in c?c[_]:o[_])===e&&("$user_state"in c?c[Ce]:o[Ce])===n||(Ea.forEach(e=>delete o[e]),"identified"===c.$user_state&&"distinct_id"in c?o.$user_id=c[_]:delete o.$user_id,"identified"!==c.$user_state&&(delete o[ae],delete o[oe]),delete o.__alias)}a=$n(o,c)}else a=$n(r,o);return Ca._set(e,a),a}catch(e){}return null},_set(e,s,n,r,o,a){const l=Ca._set(e,s,void 0,void 0,a);try{const c=Pa(s,t);if(Object.keys(c).length){if(i){const i=Ta(e),u=Fa(c,t);if(wa._set(i,u,n,r,o,a),wa._get(i)!==JSON.stringify(u)){wa._remove(i,r);const t=Pa(s);return wa._set(e,t,n,r,o,a),l}}wa._set(e,c,n,r,o,a)}}catch(e){Ca._error(e)}return l},_remove(t,i){try{null==e||e.localStorage.removeItem(t),wa._remove(t,i),wa._remove(Ta(t),i)}catch(e){Ca._error(e)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict);let s,n=!1,r=!1;const o=t.persistence.toLowerCase();return"localstorage"===o&&Ca._is_supported()?(s=Ca,r=!0):"localstorage+cookie"===o&&i._is_supported()?(s=i,r=!0,n=!0):"sessionstorage"===o&&Na._is_supported()?s=Na:"memory"===o?s=$a:"cookie"===o&&wa._is_supported()?(s=wa,n=!0):i._is_supported()?(s=i,r=!0,n=!0):wa._is_supported()?(s=wa,n=!0):s=$a,this._splitStorageEligible=r,this._storesIdentityInCookie=n,s}_groupEntryName(e){return`${this._name}__${e}`}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){const e={};return On(this.props,(t,i)=>{const s=Hy(i);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this._disabled&&!e)return;const t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?Ca._parse(this._name):null;let s={};if(t)try{s=Ra(wa._parse(this._name)),On(s,(e,t)=>{(Et(e)||It(e)||""===e)&&delete s[t]})}catch(e){}const n=this._storage._parse(this._name);if(n&&(this.props=$n({},n)),this._splitStorage&&this._loadGroupEntries(),t&&n){var r,o;const e=null==i?void 0:i[_],t=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Ge,a=n[_],l=null!==(o=n.$user_state)&&void 0!==o?o:Ge;if(a!==e||l!==t){this._cookieIdentityChangePending=!0,Na._set(zy(this._name),!0);const i=$n({},this.props);Ea.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(Et(e)||a===e)||(Yy(i,s),delete i[oe]),this.props=i;const n=new Set;Ea.forEach(e=>{var t;const i=null===(t=Hy(e))||void 0===t?void 0:t.storageGroup;i&&n.add(i)}),n.forEach(e=>{const t={};On(this.props,(i,s)=>{var n;(null===(n=Hy(s))||void 0===n?void 0:n.storageGroup)===e&&(t[s]=i)}),Ct(t)?(Ca._remove(this._groupEntryName(e)),this._slotState[e]={}):Ca._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Na._get(zy(this._name))&&(this._cookieIdentityChangePending=!0)}_loadGroupEntries(){for(const e of Ny){const t=Ca._parse(this._groupEntryName(e));if(t&&!Ct(t)){const i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||$n(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=Hy(t))||void 0===i?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){const i=Uy[e];if(!i)return!1;const s=t[i],n=this.props[i];return Pt(s)&&Pt(n)&&n>s}refreshKey(e){var t;if(this._disabled)return;if("$fbc_persistence"===e&&this._facebookClickIdChangePending)return;const i=this._splitStorage?null===(t=Hy(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?Ca._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){const t=this._storage._parse(this._name);if(t&&e in t)return void this._setProp(e,t[e],!1)}this._deleteProp(e,!1)}}save(){if(this._disabled)return;const e=this._saveDebounceMs();e>0?Et(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}flush(){Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e=!1){if(this._disabled||this._cookieSyncSuppressed&&!e)return;e||(this.syncCookieProperties(),this._facebookClickIdChangePending||this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshKey(b));const t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);const i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)return void(this._config.debug&&Fn.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));const s=this._writeEntry(this._storage,this._name,this.props,Vy);"written"===s&&this._rememberCurrentCookieProperties(this.props),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}_writeNowSplit(){const{main:e,groups:t}=this._partitionProps(),i=this._writeEntry(this._storage,this._name,e,Vy);"written"===i&&this._rememberCurrentCookieProperties(e),"failed"!==i&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,Gy.forEach(e=>{var t;(null===(t=Hy(e))||void 0===t?void 0:t.storageGroup)||this._pendingCrossTabFeatureFlagChanges.delete(e)}));for(const e of Ny){var s;const i=t[e];if(Ct(i)&&!(null===(s=this._slotState[e])||void 0===s?void 0:s.persisted)){Gy.forEach(t=>{var i;(null===(i=Hy(t))||void 0===i?void 0:i.storageGroup)===e&&this._pendingCrossTabFeatureFlagChanges.delete(t)});continue}const n=this._writeEntry(Ca,this._groupEntryName(e),i,e);"failed"!==n&&Gy.forEach(t=>{const i=Hy(t);(null==i?void 0:i.storageGroup)!==e||"written"!==n&&i.volatile||this._pendingCrossTabFeatureFlagChanges.delete(t)})}}_partitionProps(){const e={},t={flags:{},surveys:{}};return On(this.props,(i,s)=>{var n;const r=null===(n=Hy(s))||void 0===n?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===Vy)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;const i={};return On(e,(e,t)=>{var s;i[t]=(null===(s=Hy(t))||void 0===s?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){const n=this._slotWriteState(s);if(s!==Vy&&!n.dirty&&!Et(n.fingerprint))return"skipped";let r;try{if(r=this._entryFingerprint(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e._set(t,i,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)?(n.dirty=!1,s!==Vy&&(n.persisted=!0),Et(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=Ca._get(t)),"written"):(this._config.debug&&Fn.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this._markAllCrossTabFeatureFlagChangesPending(),Et(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!e&&this._ownsSplitStorage)for(const e of Ny)Ca._remove(this._groupEntryName(e));e?delete this._slotState[Vy]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(kt(e)){this.syncCookieProperties(),Et(t)&&(t="None"),this._expire_days=Et(i)?this._default_expiry:i;let s=!1;if(On(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._setProp(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(kt(e)){this.syncCookieProperties(),this._expire_days=Et(t)?this._default_expiry:t;let i=!1;if(On(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||kt(t)||St(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t="string"==typeof e?[e]:e;let i=!1;for(const e of t)e in this.props&&(this._deleteProp(e),i=!0);i&&this.save()}update_campaign_params(){const e=null==s?void 0:s.URL;if(e===this._campaign_params_url)return;const t=fl(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!Ct(qn(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}update_search_keyword(){this.register(function(){const e=null==s?void 0:s.referrer;return e?ml(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:wl(),$referring_domain:(null==s?void 0:s.referrer)&&(null===(e=Qn(s.referrer))||void 0===e?void 0:e.host)||Sl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=kl(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[Re]:this._storesIdentityInCookie?{r:jy(e.r),u:e.u?jy(e.u):void 0}:e},void 0)}get_initial_props(){const e={};On([Ie,Te],t=>{const i=this.props[t];i&&On(i,function(t,i){e["$initial_"+ft(i)]=t})});const t=this.props[Re];if(t){const i=function(e,t=!1){const i=Cl(e,t),s={};return On(i,function(e,t){s[`$initial_${ft(t)}`]=e}),s}(t,this._config.disable_capture_url_hashes);$n(e,i)}return e}safe_merge(e){return On(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;const i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this._disabled&&!a;a||this._syncCookieProperties(t,l),this._config=e,!a&&(s||n||o)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(at(at({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const c=r||o?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();const u=this._resolveSplitStorage(e),d=r||u!==this._splitStorage,h=!a&&(d||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(l);this._storageMigrationInProgress=d;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){const e=this.props;this.clear(),this._storage=c,this._splitStorage=u,this.props=e,this.save()}else o&&(this._storage=c,a||(delete this._slotState[Vy],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){const e=this.props[Re];if(!this._storesIdentityInCookie||!kt(e)||"string"!=typeof e.r)return;const t=jy(e.r),i="string"==typeof e.u?jy(e.u):e.u;t===e.r&&i===e.u||this._setProp(Re,at(at({},e),{},{r:t,u:i}))}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){const i=this.props.__timers||{};i[e]=t,this._setProp(S,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return Et(i)||(delete t[e],this._setProp(S,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._setProp(e,t),this.save()}_setProp(e,t,i=!0){var s;const n=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||n===t||(this._localIdentityChangePending=!0),"$fbc_persistence"!==e||Ky(n,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,n,t),(null===(s=Hy(e))||void 0===s?void 0:s.volatile)||this._markGroupDirty(e))}_deleteProp(e,t=!0){delete this.props[e],t&&(Qy(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),"$fbc_persistence"===e&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t;const i=null===(t=Hy(e))||void 0===t?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}};const Xy={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},eb={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"},tb={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"},ib=Ln("[RateLimiter]");var sb=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{const t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{ib.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void ib.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?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const e=(Pt(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this._captureWarning(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){const t=this.instance.config.property_denylist;return!St(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&(null==n?void 0:n.pathname))return`${null!==(e=n.origin)&&void 0!==e?e:""}${n.pathname}`}_captureWarning(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}};const nb=Ln("[RemoteConfig]");var rb=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}_loadRemoteConfigJs(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,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 nb.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void nb.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return nb.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){nb.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||nb.warn("Failed to fetch remote config from PostHog."):nb.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){nb.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 i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(e){nb.error("Error loading feature flags",e)}}};const ob=["fatal","error","warning","log","info","debug"],ab=!!o||!!r,lb="text/plain";let cb=!1;const ub=(e,t)=>{const[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;const o=r.split("&").filter(e=>e.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},db=(e,t,i=!0)=>{var s;const[n,r]=e.split("?"),o=at({},t),a=null!==(s=null==r?void 0:r.split("&").map(e=>{var t;const[s,n]=e.split("="),r=i&&null!==(t=o[s])&&void 0!==t?t:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],l=Kn(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},hb=e=>{if(e._encodedBody)return e._encodedBody;const{data:t,compression:i}=e;if(!t)return;if(i===Z_.GZipJS){const e=aa(la(Gn(t)),{mtime:0});return{contentType:lb,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===Z_.Base64){const e=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(Gn(t)),i=(e=>"data="+encodeURIComponent("string"==typeof e?e:Gn(e)))(e);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const s=Gn(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},pb=e=>{const t=()=>"sendBeacon"===e.transport?{url:db(e.url,{compression:Z_.Base64}),encodedBody:hb(at(at({},e),{},{compression:Z_.Base64,_encodedBody:void 0}))}:{url:ub(e.url,"compression"),encodedBody:hb(at(at({},e),{},{compression:void 0,_encodedBody:void 0}))};let i;try{i=hb(e)}catch(i){if(Xs(e.compression,Zn(e.url,"compression")))return Fn.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return i&&Xs(e.compression,Zn(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?Js(new Uint8Array(s)):ArrayBuffer.isView(s)&&Js(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(cb=!0,t()):{url:e.url,encodedBody:i};var s},_b=e=>{try{return pb(e)}catch(i){var t;return Fn.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},gb=function(){var e=st(function*(e){const t=yield an(Gn(e.data),Ba.DEBUG,{rethrow:!0});if(!t)return e;const i=yield t.arrayBuffer();return at(at({},e),{},{_encodedBody:{contentType:lb,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),fb=/Failed to fetch|NetworkError|Load failed/i,vb=e=>"TypeError"===(null==e?void 0:e.name)&&fb.test((null==e?void 0:e.message)||""),mb=e=>{const t=_b(e);if(!t)return;const i=new o,{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);const{contentType:r,body:a}=null!=n?n:{};On(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;const s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,s)}},i.send(a)},yb=e=>{const t=_b(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:n,body:o,estimatedSize:l}=null!=s?s:{},c=new Headers;On(e.headers,function(e,t){c.append(t,e)}),n&&c.append("Content-Type",n);let u=null,d=!1;if(a){const t=new a;u={signal:t.signal,timeout:setTimeout(()=>{var i;d=!0,t.abort(is("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))},e.timeout)}}const h=t=>{var i;d&&"AbortError"===(null==t?void 0:t.name)||vb(t)?Fn.warn(t):Fn.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t})};try{r(i,at({method:(null==e?void 0:e.method)||"GET",headers:c,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:o,signal:null==u?void 0:u.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s;const n={statusCode:t.status,text:i};if(200===t.status)try{n.json=JSON.parse(i)}catch(e){Fn.error(e)}null===(s=e.callback)||void 0===s||s.call(e,n)})).catch(h).finally(()=>u?clearTimeout(u.timeout):null)}catch(e){u&&clearTimeout(u.timeout),h(e)}},bb=e=>{try{var t;const{url:s,encodedBody:n}=pb(e),{contentType:o,body:a,estimatedSize:l}=null!=n?n:{};if(!a)return;const c=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(s,c))return;const u=St(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(St(u)&&u.length>1&&(null!=l?l:0)>16384){const t=Math.ceil(u.length/2),i=t=>St(e.data)?t:at(at({},e.data),{},{batch:t});return bb(at(at({},e),{},{data:i(u.slice(0,t))})),void bb(at(at({},e),{},{data:i(u.slice(t))}))}Fn.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?yb(at(at({},e),{},{_keepaliveDisabled:!0})):mb(e)}catch(e){Fn.warn("Beacon send failed",e)}},Sb=(e,t,i,s)=>{const n="query"===s?"POST"===t?"sent_at":"_":void 0;return db(i===Z_.GZipJS?ub(e,"compression"):e,at(at({},n?{[n]:Date.now().toString()}:{}),i===Z_.GZipJS?{}:{compression:i}))},wb=(()=>{const e=[];return r&&e.push({transport:"fetch",method:yb}),o&&e.push({transport:"XHR",method:mb}),(null==i?void 0:i.sendBeacon)&&e.push({transport:"sendBeacon",method:bb}),e})();var kb=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Vt((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,Fn.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();const 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(at(at({},e),{},{transport:"sendBeacon"}))})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){const e=this._formatQueue();for(const t in e){const i=e[t],s=(new Date).getTime();i.data&&St(i.data)&&On(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),this._sendRequestSafely(i)}}},this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){Fn.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){const e={};return On(this._queue,t=>{var i;const s=t,n=(s?s.batchKey:null)||s.url;Et(e[n])&&(e[n]=at(at({},s),{},{data:[]})),null===(i=e[n].data)||void 0===i||i.push(s.data)}),this._queue=[],e}};const Cb=["retriesPerformedSoFar"];var Eb=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!Et(e)&&"onLine"in e.navigator){if(this._areWeOnline=e.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},zn(e,"online",this._onlineListener),zn(e,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e){let{retriesPerformedSoFar:t}=e,i=cn(e,Cb);Mt(t)&&(i.url=db(i.url,{retry_count:t})),this._instance._send_request(at(at({},i),{},{callback:e=>{var s;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(at({retriesPerformedSoFar:t},i));0===e.statusCode&&Fn.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===(s=i.callback)||void 0===s||s.call(i,e)}}))}_enqueue(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const i=function(e){const t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),n=(Math.random()-.5)*(s-i);return Math.ceil(s+n)}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});let n=`Enqueued failed request for retry in ${i}`;navigator.onLine||(n+=" (Browser is offline)"),Fn.warn(n),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(){const e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(const{requestOptions:e}of i)this.retriableRequest(e)}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Et(e)||(this._onlineListener&&(e.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(e.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0));for(const{requestOptions:e}of this._queue)try{this._instance._send_request(at(at({},e),{},{transport:"sendBeacon"}))}catch(e){Fn.error(e)}this._queue=[]}},xb=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,a=r+((null==n?void 0:n.clientHeight)||0),l=(null==n?void 0:n.scrollHeight)||0;this._context.lastScrollY=Math.ceil(r),this._context.maxScrollY=Math.max(r,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!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)}}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){const e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){zn(e,"scroll",this._updateScrollData,{capture:!0}),zn(e,"scrollend",this._updateScrollData,{capture:!0}),zn(e,"resize",this._updateScrollData)}scrollElement(){if(this._scrollRoot){const i=St(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(const s of i){var t;const i=null==e||null===(t=e.document)||void 0===t?void 0:t.querySelector(s);if(i)return i}return}var i;return null==e||null===(i=e.document)||void 0===i?void 0:i.documentElement}_scrollPosition(t){var i,s;const n="y"===t?"scrollTop":"scrollLeft";if(this._scrollRoot){const e=this.scrollElement();return e&&e[n]||0}return e?"y"===t?e.scrollY||e.pageYOffset||(null===(i=e.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:e.scrollX||e.pageXOffset||(null===(s=e.document)||void 0===s||null===(s=s.documentElement)||void 0===s?void 0:s.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}};const Tb=e=>kl(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);var Ib=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{const t=this._getStored();if(t&&t.sessionId===e)return;const i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[Ee]:i})},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||Tb,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Ee]}getSetOnceProps(){var e;const t=null===(e=this._getStored())||void 0===e?void 0:e.props;return t?"r"in t?Cl(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(){const e={};return On(qn(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${ft(i)}`]=t}),e}},Rb=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(const i of this._events[e]||[])i(t);for(const i of this._events["*"]||[])i(e,t)}constructor(){this._events={}}};const Pb=Ln("[SessionId]"),Mb=864e5;var Fb=class{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._lastPersistedActivityTimestamp=null,this._lastCookieSyncTimestamp=null,this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._destroyed=!1,this._eventEmitter=new Rb,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Mt(e)||!Mt(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=i||va;const n=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Vt(this._config.session_idle_timeout_seconds||1800,60,36e3,Pb.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){const e=Na._parse(this._window_id_storage_key),t=Na._parse(this._primary_window_exists_storage_key);e&&!t?this._windowId=e:Na._remove(this._window_id_storage_key),Na._set(this._primary_window_exists_storage_key,!0)}(null===(s=this._config.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Et(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){const t=this._lastPersistedActivityTimestamp;return!It(t)&&!It(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){const s=t!==this._sessionActivityTimestamp,n=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,n&&!s||n&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[q]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e;const t=null===(e=this._config)||void 0===e?void 0:e.persistence_save_debounce_ms;return Mt(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(q):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(It(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this._lastPersistedActivityTimestamp)return;this._refreshSessionIdFromStorage();const[,t,i]=this._getSessionId();t===this._sessionId&&i===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(){const[e]=this._getSessionId(),t=Mt(e)?e:0,i=Mt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){const e=this._persistence.props[q];return St(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=!1){const i=((e,t=(new Date).getTime())=>{try{const i=(e=>{const 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 i>t+6e4?void Pb.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void Pb.error("Invalid sessionID in bootstrap",e)}})(e);return!Et(i)&&(t?this._pendingBootstrapSession={sessionId:e,sessionStartTimestamp:i}:this._setSessionId(e,(new Date).getTime(),i),!0)}destroy(){this._destroyed=!0,this._flushPendingActivityTimestamp(),clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&e&&(e.removeEventListener(Ye,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)},zn(e,Ye,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||(new Date).getTime(),n=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(It(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var r,o;null===(r=(o=this._persistence).syncCookieProperties)||void 0===r||r.call(o),this._lastCookieSyncTimestamp=s}let[,a,l]=this._getSessionId();const c=!Et(n)&&a!==n,u=this._freshestActivityTimestamp();let d=this._getWindowId();const h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>Mb),_=h?p:Mt(l)&&Math.abs(s-l)>Mb;let g=!1,f=c;const v=!a||!!h,m=a;let y=!v&&!e&&this._sessionHasBeenIdleTooLong(s,u);if(y&&(y=this._isSessionIdleAfterCrossTabRefresh(s),y||Pb.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this._getSessionId()),v||y||_){f=!1;const e=h&&!p;a=e?h.sessionId:this._sessionIdGenerator(),d=this._windowIdGenerator(),Pb.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!e,changeReason:{noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_}}),l=e?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,g=!0}else d||(d=this._windowIdGenerator(),g=!0),f=f||a!==m,f&&(Pb.info("adopted cross-tab session id",{sessionId:a,windowId:d}),g=!0);const b=Mt(u)&&e&&!_?u:s,S=Mt(l)?l:(new Date).getTime();this._setWindowId(d),this._setSessionId(a,b,S),e||this._resetIdleTimer();const w={noSessionId:v,activityTimeout:y,sessionPastMaximumLength:_,crossTabAdoption:f};return g&&this._sessionIdChangedHandlers.forEach(e=>e(a,d,w)),{sessionId:a,windowId:d,sessionStartTimestamp:S,changeReason:g?w:void 0,lastActivityTimestamp:u}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){const e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};const Lb=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&jt(i,t))return!0;try{const i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>jt(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function Ab(){return Ab=st(function*(){const e=null==i?void 0:i.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return xt(i)&&i.length>0?i:void 0}catch(e){return void Fn.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}}),Ab.apply(this,arguments)}const Ob="custom",$b="i.posthog.com",Db=/^\/static\//,Nb=["/s/","/e/","/i/"];var Bb=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null===(e=this.instance.config.ui_host)||void 0===e?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${$b}`,".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":Ob),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(!Db.test(e))return;const t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}_urlKey(e){const t=Qn(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;let s=i;const n=this.instance.config.rewriteRequestPath;if(n){var r;const e=(null===(r=Qn(i))||void 0===r?void 0:r.href)||i;s=n(new URL(e)).toString()}if(n&&"api"===e&&Nb.some(e=>0===t.indexOf(e))){const e=this._urlKey(s);if(e){const t=this.apiHost;let i=this._ingestionEndpoints;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===n||(i={apiHost:t,rewriteRequestPath:n,urls:new Set},this._ingestionEndpoints=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){const t=this._ingestionEndpoints,i=this._urlKey(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(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){const i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,`${i}${t}`)}if(this.region===Ob)return this._prepareEndpoint(e,t,this.apiHost+t);const i=$b+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}`)}}};const qb=Ln("[PostHog ExternalIntegrations]"),Hb={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Ub=class{constructor(e){this._instance=e}_loadScript(e,t){var i,s;null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,e,e=>{if(e)return qb.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e;for(const[n,r]of Object.entries(null!==(e=this._instance.config.integrations)&&void 0!==e?e:{})){var t,i,s;r&&!(null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[n])&&this._loadScript(Hb[n],()=>{var e;null===(e=h.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[n])||void 0===e||e.start(this._instance)}),!r&&(null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&(null===(s=h.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},Wb=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return st(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{const i=e.setup(t._client);i&&(yield i)}catch(i){const s=t._extensions.get(e.name)===e;s&&t._extensions.delete(e.name),t._logger.error(`Failed to set up browser extension "${e.name}"`,i),s&&t._disposeExtension(e)}})()}getExtension(e){return this._extensions.get(e)}dispose(){if(this._disposed)return;this._disposed=!0;const e=Array.from(this._extensions.values()).reverse();this._extensions.clear();for(const t of e)this._disposeExtension(t)}_disposeExtension(e){try{var t;const i=null===(t=e.dispose)||void 0===t?void 0:t.call(e);i&&wt(i.then)&&i.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)}}},zb=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const i={};for(const s of e){const e=null==t?void 0:t.get_property(s);Et(e)||(i[s]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}};const jb="extensionsRemoteConfig";var Vb=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=Fn,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new zb(e),this.onEvent=e=>lg(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 lg(()=>{});const t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(jb,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),lg(i)},this._runtime=new Wb(Fn.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(){const e=this.instance.get_property(g);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?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;const n=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==n?void 0:n.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==n?void 0:n.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==n?void 0:n.sessionStartTimestamp)&&void 0!==s?s: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,i){var s=this;return st(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return lg(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(jb,e))}sendRequest(e){var t=this;return st(function*(e,i={}){var s;const n=t.instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),r={method:i.method,url:i.query?db(n,i.query):n,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?ct.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(t.instance._send_request(r),{statusCode:202}):new Promise(e=>{r.callback=e,t.instance._send_request(r)})}).apply(this,arguments)}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}};const Gb={};let Qb=0;const Kb=()=>{},Zb='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Yb="Surveys module not available",Jb="sanitize_properties is deprecated. Use before_send instead",Xb="Invalid value for property_denylist config: ",eS=/^[A-Za-z0-9_-]{1,400}$/,tS=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,iS=["token","distinct_id",Fe],sS="posthog";let nS=!ab&&-1===(null==c?void 0:c.indexOf("MSIE"))&&-1===(null==c?void 0:c.indexOf("Mozilla"));const rS=e=>{const 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},oS=t=>{var i;return at({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Wn(null==s?void 0:s.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Kb,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:n&&xt(null==n?void 0:n.search)&&-1!==n.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==e||null===(i=e.location)||void 0===i?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){Fn.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:Ke,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Kb},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:br,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:rS(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)}))(t))},aS=[["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"]],lS=e=>{const t={};for(const[i,s]of aS)Et(e[i])||(t[s]=e[i]);const i=$n({},t,e),s=e.__preview_external_dependency_versioned_paths;return Et(s)||(Et(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),xt(s)&&Et(e.asset_host)&&(i.asset_host=s)),St(e.property_blacklist)&&(Et(e.property_denylist)?i.property_denylist=e.property_blacklist:St(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:Fn.error(Xb+e.property_denylist)),i};var cS=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Fn.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},uS=class t{_removeExtension(e){if(!e)return;const t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}_replaceExtension(e,t){var i;return this._removeExtension(e),this._extensions.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(this._hasWarnedAboutVolatileIdentity)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this._inCookielessMode())return;const e="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!e&&!this.config.disable_persistence)return;if(this._hasStableInitialDistinctId)return;let t,i,s;e?(t=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",`${t} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}_healCookielessSentinelDistinctId(){if(this._inCookielessMode()||"$posthog_cookieless"!==this.get_distinct_id())return;const e=this.persistence;if(!e)return;this._is_persistence_disabled()||e.load(!0);const t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){const t=this.config.get_device_id(va());this.register({distinct_id:t,$device_id:t}),e.set_property(Ce,Ge)}this._sync_opt_out_with_persistence()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new cS,this._personProcessingSetOncePropertiesSent=!1,this.version=Ba.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Rb,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=oS(),this.SentryIntegration=$y,this.sentryIntegration=e=>function(e,t){const i=Oy(e,t);return{name:Ay,processEvent:e=>i(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 xb(this),this.pageViewManager=new Dy(this),this.rateLimiter=new sb(this),this.requestRouter=new Bb(this),this.consent=new Ty(this),this.externalIntegrations=new Ub(this);const i=null!==(e=t.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{const s=xt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{const s=xt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>Fn.info(`send "${null==e?void 0:e.event}"`,e))}init(e,i,s){if(s&&s!==sS){var n;const r=null!==(n=Gb[s])&&void 0!==n?n:new t;return r._init(e,i,s),Gb[s]=r,Gb[sS][s]=r,r}return this._init(e,i,s)}_init(t,i={},s){var n,r,o;const a=xt(t)?t.trim():"";if(!a)return Fn.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==(null===(l=this.config)||void 0===l?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=oS(i.defaults),i.debug=this._checkLocalStorageForDebug(i.debug),this._originalUserConfig=i,this._triggered_notifs=[],i.person_profiles?this._initialPersonProfilesConfig=i.person_profiles:i.process_person&&(this._initialPersonProfilesConfig=i.process_person);const c=oS(i.defaults),u=lS(i),d=$n({},c,u,{name:s,token:a});kt(c.rageclick)&&kt(u.rageclick)&&(d.rageclick=$n({},c.rageclick,u.rageclick)),kt(c.session_recording)&&kt(u.session_recording)&&(d.session_recording=$n({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&Fn.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Z_.GZipJS;const h=this._is_persistence_disabled();if(this.persistence=new Jy(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Jy(at(at({},this.config),{},{persistence:"sessionStorage"}),h,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!h&&Na._is_supported()){const e=Na._parse(this._sessionRegisteredPropertiesStorageKey);St(e)&&e.forEach(e=>{xt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Na._remove(this._sessionRegisteredPropertiesStorageKey);const p=at({},this.persistence.props),_=at({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new kb(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new Eb(this),this.__request_queue=[];const g=this._inCookielessMode();g||(this.sessionManager=new Fb(this),this.sessionPropsManager=new Ib(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(Fn.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(g)},0)):(Fn.info("Initializing extensions synchronously"),this._initExtensions(g)),Ba.DEBUG=Ba.DEBUG||this.config.debug,Ba.DEBUG&&Fn.info("Starting in debug mode",{this:this,config:i,thisC:at({},this.config),p:p,s:_}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=at(at({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this._hasStableInitialDistinctId=!!v&&!Tt(v),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const e=i.bootstrap.distinctID,t=this.get_distinct_id(),s=this.persistence.get_property(Ce);if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"anonymous"===s)this.identify(e);else if(i.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"identified"===s)Fn.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const t=this.config.get_device_id(va()),s=i.bootstrap.isIdentifiedID?t:e;this.persistence.set_property(Ce,i.bootstrap.isIdentifiedID?Qe:Ge),this.register({distinct_id:e,$device_id:s})}}if(g)this.register_once({distinct_id:Me,$device_id:null},"");else if(!this.get_distinct_id()){const e=this.config.get_device_id(va());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(Ce,Ge)}return zn(e,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),zn(e,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null===(e=this._retryQueue)||void 0===e||e.resume()}),i.segment?Ly(this,()=>this._loaded()):this._loaded(),wt(this.config._onCapture)&&this.config._onCapture!==Kb&&(Fn.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Fn.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 Ab.apply(this,arguments)}().then(e=>{e&&this.register({[f]:e})}).catch(Kb),this}_isSharedExtension(e){const t=e;return xt(t.name)&&wt(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>{var t;return null===(t=e.dispose)||void 0===t?void 0:t.call(e)}).catch(t=>{Fn.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var e,i,s;const n=null!==(e=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==e?e:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||(null===(r=this._featureFlagsReloadingUnsubscribe)||void 0===r||r.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new n(this)),wt(this.featureFlags.onReloading)&&wt(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null===(o=(a=this.featureFlags).initialize)||void 0===o||o.call(a))}_initExtensions(e){const i=performance.now(),s=at(at({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,u,d;s.exceptions&&this._extensions.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this._extensions.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this._extensions.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this._extensions.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this._enrollExtension(this.autocapture=new s.autocapture(this),n),s.surveys&&this._enrollExtension(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this._enrollExtension(this.logs=null!==(a=this.logs)&&void 0!==a?a:new s.logs(this),n),s.metrics&&this._extensions.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new s.metrics(this)),s.conversations&&this._extensions.push(this.conversations=null!==(c=this.conversations)&&void 0!==c?c:new s.conversations(this)),s.productTours&&this._extensions.push(this.productTours=new s.productTours(this)),s.heatmaps&&this._extensions.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this._extensions.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,Py)),s.toolbar&&this._extensions.push(this.toolbar=null!==(u=this.toolbar)&&void 0!==u?u:new s.toolbar(this)),s.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),this._extensions.forEach(e=>{e.initialize&&n.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),n.push(()=>{if(this._pendingRemoteConfig){const e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this._processInitTaskQueue(n,i)}_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);const i=e.shift();if(i)try{i()}catch(e){Fn.error("Error initializing extension:",e)}}const i=Math.round(performance.now()-t);this.register_for_session({[Le]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ae]:i}),this.config.__preview_deferred_init_extensions&&Fn.info(`PostHog extensions initialized (${i}ms)`)}_onRemoteConfig(e){var t;if(!s||!s.body)return Fn.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 i;const t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=_t(t.supportedCompression,Z_.GZipJS)?Z_.GZipJS:_t(t.supportedCompression,Z_.Base64)?Z_.Base64:void 0),(null===(i=t.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Ke}),null===(t=this._browserClientAdapter)||void 0===t||t.handleRemoteConfig(e),this._extensions.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}_loaded(){try{this.config.loaded(this)}catch(e){Fn.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&(null==n?void 0:n.hostname)){const e=n.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 rb(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this._requestQueue)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&An(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i,s,n,r;this._isPageUnloading=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Xe),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this._requestQueue)||void 0===n||n.unload(),null===(r=this._retryQueue)||void 0===r||r.unload()):this._shouldCapturePageleave()&&this.capture(Xe,null,{transport:"sendBeacon"})}_send_request(e){var t,i,s;this.__loaded?nS?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(i=e.callback)||void 0===i||i.call(e,{statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=at(at({},this.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(Et(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,i,s;const n=at({},e);n.timeout=n.timeout||6e4;const r=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===r&&Et(n.compression)&&n.data&&(n.compression=Z_.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data=(e=>{var t,i;const s=(St(e)?e:[e]).map(e=>at(at({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(t=null==n||null===(i=n.properties)||void 0===i?void 0:i.token)&&void 0!==t?t:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(n.data):"body"===n.timestampMode&&(n.data=((e,t=(new Date).toISOString())=>St(e)?e.map(e=>at(at({},e),{},{sent_at:t})):at(at({},e),{},{sent_at:t}))(n.data))),n.url=Sb(n.url,n.method,n.compression,n.timestampMode);const o=wb.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),a=null!==(i=null===(s=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(o,e=>e.transport===r))||void 0===s?void 0:s.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");const c=e=>{try{a(e)}catch(e){var t;vb(e)?Fn.warn(e):Fn.error(e),null===(t=n.callback)||void 0===t||t.call(n,{statusCode:0,error:e})}};"sendBeacon"!==r&&n.data&&n.compression===Z_.GZipJS&&l&&"undefined"!=typeof Promise&&!cb?gb(n).then(e=>{c(e)}).catch(t=>{if(en(t))return cb=!0,void c(at(at({},n),{},{compression:void 0,url:Sb(e.url,e.method,void 0,e.timestampMode)}));tn(t)&&(cb=!0),c(n)}):a(n)})(at(at({},e),{},{callback:t=>{var i,s,n;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null===(s=(n=this.config).on_request_error)||void 0===s||s.call(n,t),null===(i=e.callback)||void 0===i||i.call(e,t)}}))):e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){Qb++;try{let t;const i=[],s=[],n=[];An(e,e=>{if(e)if(t=e[0],St(t))n.push(e);else if(wt(e))try{e.call(this)}catch(t){Fn.error("Error executing queued PostHog call",e,t)}else St(e)&&"alias"===t?i.push(e):St(e)&&-1!==t.indexOf("capture")&&wt(this[t])?n.push(e):s.push(e)});const r=function(e,t){An(e,function(e){try{if(St(e[0])){let i=t;On(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Fn.error("Error executing queued PostHog call",e,t)}})};r(i,this),r(s,this),r(n,this)}finally{Qb--}}push(e){if(Qb>0&&St(e)&&xt(e[0])){const i=t.prototype[e[0]];return void(wt(i)&&i.apply(this,e.slice(1)))}this._execute_array([e])}_getPersistedFacebookClickId(){var e;const t=null===(e=this.persistence)||void 0===e?void 0:e.get_property(b);return xt(t)&&tS.test(t)?{value:t,delivered:!1}:kt(t)&&xt(t.value)&&tS.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,i,s){if(!this.persistence)return;this.persistence.refreshKey(b);const n=this._getPersistedFacebookClickId();if(!s){if(i)return xt(t)&&tS.test(t)?(t!==(null==n?void 0:n.value)&&this.persistence.register({[b]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==n?void 0:n.value)||!n.delivered}):void this.persistence.unregister(b);if(xt(e)&&eS.test(e)){if((null==n?void 0:n.value.split(".")[3])===e)return{value:n.value,pending:!n.delivered};const t=`fb.1.${Date.now()}.${e}`;return this.persistence.register({[b]:{value:t,delivered:!1}}),{value:t,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(b)}_markFacebookClickIdDelivered(e){if(!this.persistence)return;this.persistence.refreshKey(b);const t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[b]:{value:e,delivered:!0}})}capture(e,t,i){var s,n,r,o,a;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue))return void Fn.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Et(e)||!xt(e))return void Fn.error("No event name provided to posthog.capture");this._healCookielessSentinelDistinctId();const l=!this.config.opt_out_useragent_filter&&this._is_bot();if(l&&!this.config.__preview_capture_bot_pageviews)return;const c=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==c?void 0:c.isRateLimited)return void Fn.critical("This capture call is ignored due to client rate limiting.");let u;(null==t?void 0:t.$current_url)&&!xt(null==t?void 0:t.$current_url)&&(Fn.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==i?void 0:i._originatedFromCaptureException)||Fn.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&&(u=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const d=new Date,h=(null==i?void 0:i.timestamp)||d,p=ts(null==i?void 0:i.uuid,va);let _={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},h,p)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&l&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),c&&(_.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);const g="$feature_flag_called"===e&&!1===_.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!g&&(_.$set=null==i?void 0:i.$set);const f=kt(null==t?void 0:t.$set)?t.$set:void 0,v=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,m=v||!!f&&"$fbc"in f,b=v?null==i||null===(s=i.$set)||void 0===s?void 0:s[y]:null==f?void 0:f[y],S=St(null==t?void 0:t.$unset)?t.$unset:[],w=(null==i?void 0:i.$unset)||[],k=-1!==S.indexOf("$fbc")||-1!==w.indexOf("$fbc"),C=this._updateFacebookClickId(null==u?void 0:u.fbclid,b,m,k);C&&!0===_.properties.$process_person_profile&&C.pending&&!m&&!g&&(_.$set=at({[y]:C.value},_.$set));const E=null==i?void 0:i.$unset;E&&(_.$unset=E);const x=g?void 0:this._calculate_set_once_properties(null==i?void 0:i.$set_once,e!==tt,e===et);if(x&&(_.$set_once=x),(null==i?void 0:i._noTruncate)||(T=this.config.properties_string_max_length,_=function(e,t){const i=new Set;return function e(s,n){if(s!==Object(s))return t?t(s):s;if(i.has(s))return;let r;if(i.add(s),St(s))r=[],An(s,t=>{r.push(e(t))});else{const t={};On(Nt(s)?Hn(s):s,(s,n)=>{i.has(s)||(t[n]=e(s,n))}),r=t}return r}(e)}(_,e=>xt(e)?e.slice(0,T):e)),_.timestamp=h,Et(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=d),g&&(_.properties=((e,t=[])=>{const i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return Zs.forEach(s),t.forEach(s),i})(_.properties,iS)),e===rg.DISMISSED||e===rg.SENT){const i=null==t?void 0:t[og.SURVEY_ID],s=null==t?void 0:t[og.SURVEY_ITERATION];fg({id:i,current_iteration:s}),_.$set=at(at({},_.$set),{},{[Va({id:i,current_iteration:s},e===rg.SENT?"responded":"dismissed")]:!0})}else e===rg.SHOWN&&(_.$set=at(at({},_.$set),{},{[og.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var T;if(e===eb.SHOWN){const e=null==t?void 0:t[tb.TOUR_TYPE];e&&(_.$set=at(at({},_.$set),{},{[`${tb.TOUR_LAST_SEEN_DATE}/${e}`]:(new Date).toISOString()}))}const I=at(at({},_.properties.$set),_.$set);if(Ct(I)||this.setPersonPropertiesForFlags(I),!Rt(this.config.before_send)){const e=this._runBeforeSend(_);if(!e)return;_=e,_.uuid=ts(_.uuid,va)}const R=null!==(n=null===(r=_.$set)||void 0===r?void 0:r.$fbc)&&void 0!==n?n:kt(null===(o=_.properties)||void 0===o?void 0:o.$set)?_.properties.$set[y]:void 0,P=(null==C?void 0:C.pending)&&R===C.value?C.value:void 0;this._internalEventEmitter.emit("eventCaptured",_);const M=null!==(a=null==i?void 0:i._url)&&void 0!==a?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),F=at(at({method:"POST",url:M,data:_,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(M)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},(null==i?void 0:i.transport)?{transport:i.transport}:{}),P?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markFacebookClickIdDelivered(P)}}:{});var L;return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||P?(!F.transport&&!F.callback&&Ct(null!==(L=this.config.request_headers)&&void 0!==L?L:{})&&this._isPageUnloading&&(F.transport="sendBeacon"),this._send_retriable_request(F)):this._requestQueue.enqueue(F),_}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this._browserClientAdapter)||void 0===t?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new Vb(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);let t=!0;return()=>{if(!t)return;t=!1;const i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}_processCookieIdentityChange(e=!0){var t,i,s;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();const l=a?void 0:this.persistence.remove_event_timer(t);let u=at({},i);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this._inCookielessMode()&&(u[Fe]=!0),"$snapshot"===t){const e=at(at({},this.persistence.properties()),this.sessionPersistence.properties());return u.distinct_id=e.distinct_id,(!xt(u.distinct_id)&&!Pt(u.distinct_id)||Tt(u.distinct_id))&&Fn.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}const d=function(t,i,s,r=!1){var o,a,l,u;if(!c)return{};const d=t?[...hl,...i||[]]:[],[h,p]=Vi(c),[_,g]=function(e){for(let t=0;Zi.length>t;t++){const[i,s,n]=Zi[t],r=e.match(i);if(r){const t=n&&e.match(n)||r;return[s,(null==t?void 0:t[1])||""]}}return["",""]}(c),f=function(){const e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),v={};Et(s)||(v.detectGoogleSearchApp=s);const m={},y=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,b=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,S=null==e||null===(l=e.screen)||void 0===l?void 0:l.width,w=null==e||null===(u=e.screen)||void 0===u?void 0:u.height,k=null==e?void 0:e.devicePixelRatio;Et(y)||(m.userAgentDataPlatform=y),Et(b)||(m.maxTouchPoints=b),Et(S)||(m.screenWidth=S),Et(w)||(m.screenHeight=w),Et(k)||(m.devicePixelRatio=k);const C=$n(qn({$os:h,$os_version:p,$browser:Ui(c,navigator.vendor,f,v),$webview_app:_,$webview_app_version:g,$device:Gi(c),$device_type:Qi(c,m),$timezone:El(),$timezone_offset:xl()}),{$current_url:Yn(r?ss(null==n?void 0:n.href):null==n?void 0:n.href,d,_l),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:c.length>1e3?c.substring(0,997)+"...":c,$browser_version:zi(c,navigator.vendor,f,v),$browser_language:yl(),$browser_language_prefix:bl(),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:Pn.LIB_NAME,$lib_version:Pn.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Pn.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=Pn.SDK_DIST_CHANNEL),C}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);u.$session_id=e,u.$window_id=t}this.sessionPropsManager&&$n(u,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&$n(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null===(h=this._retryQueue)||void 0===h?void 0:h.length}catch(e){u.$sdk_debug_error_capturing_properties=String(e)}let p;if(this.requestRouter.region===Ob&&(u.$lib_custom_api_host=this.config.api_host),p="$pageview"!==t||a?"$pageleave"!==t||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),u=$n(u,p),"$pageview"===t&&s&&(u.title=s.title),!Et(l)){const e=r.getTime()-l;u.$duration=parseFloat((e/1e3).toFixed(3))}c&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");const _=this.persistence.properties(),g=this.sessionPersistence.properties(),f=u.$groups,v=_.$groups;kt(f)&&!Ct(f)&&(u.$groups=at(at({},kt(v)?v:{}),f)),On(["$referrer","$referring_domain"],e=>{e in _&&delete g[e]});const m={};if(this._extensionEventPropertyProducers.length>0)for(const e of this._extensionEventPropertyProducers.slice())try{$n(m,e())}catch(e){Fn.error("Failed to produce browser extension event properties",e)}u=$n({},d,_,g,at(at({},m),u)),u.$is_identified=this._isIdentified(),St(this.config.property_denylist)?On(this.config.property_denylist,function(e){delete u[e]}):Fn.error(Xb+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const y=this.config.sanitize_properties;y&&(Fn.error(Jb),u=y(u,t));const b=this._hasPersonProcessing();return u.$process_person_profile=b,b&&!a&&this._requirePersonProcessing("_calculate_event_properties"),u}_calculate_set_once_properties(e,t=!0,i=!1){var s;if(!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=$n({},n,r||{},e||{});const a=this.config.sanitize_properties;return a&&(Fn.error(Jb),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),Ct(o)?void 0:o}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var s;null===(s=this.persistence)||void 0===s||s.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this._processCookieIdentityChange(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||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)||void 0===t||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(!this._sessionRegisteredPropertiesStorageKey)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e._disabled)||!Na._is_supported())return void Na._remove(this._sessionRegisteredPropertiesStorageKey);const t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Na._set(this._sessionRegisteredPropertiesStorageKey,t):Na._remove(this._sessionRegisteredPropertiesStorageKey)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(e,t,i)}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:Yb}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Yb})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Yb})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=mg){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:Yb}}canRenderSurveyAsync(e,t=!1){var i,s;return null!==(i=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Yb})}_validateIdentifyId(e){return!e||Tt(e)?(Fn.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(Fn.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())||(Fn.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,i){if(!this.__loaded||!this.persistence)return Fn.uninitializedWarning("posthog.identify");if(Pt(e)&&(e=e.toString(),Fn.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))return;if(!this._requirePersonProcessing("posthog.identify"))return;this._healCookielessSentinelDistinctId();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression();let a=!1;try{const s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property("__alias")&&(this.unregister(v),this.register({distinct_id:e}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Ge,c=e!==s,u=!c&&o;if(c&&o){var l;const n=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:s};this.persistence.set_property(Ce,Qe),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(et,n,{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=nl(e,t,i),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(u){this.persistence.set_property(Ce,Qe);const s=t||{},n=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:s,$set_once:n}),this._cachedPersonProperties=nl(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);c||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(be)):u&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}setPersonProperties(e,t){if(!e&&!t)return;if(!this._requirePersonProcessing("posthog.setPersonProperties"))return;const i=nl(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):Fn.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;const i=(St(e)?e:[e]).filter(e=>xt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,i){var s;if(!e||!t)return void Fn.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this._processCookieIdentityChange();const n=this.getGroups(),r=n[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:at(at({},n),{},{[e]:t})}),(r||i)&&this._hasPersonProcessing()){const s={$group_type:e,$group_key:t};i&&(s.$group_set=i),this.capture(tt,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){const t=Ft(e)?e:null==e?void 0:e.resetDeviceID,i=Ft(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t=!1,i){var s,n,r,o,a,l;if(Fn.info("reset"),!this.__loaded)return Fn.uninitializedWarning("posthog.reset");const c=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(s=this._originalUserConfig)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this._shouldDisableFlags());const u=this.get_property(g),d=this.get_property(f),h=this.get_property(F);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const p=this.is_capturing();this.consent.reset(),t||!p||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const _=null===(a=this.persistence)||void 0===a||null===(l=a._beginCookieSyncSuppression)||void 0===l?void 0:l.call(a);let v=!1;try{var m,y,b,S,w,k,C,E,x,T,I,R,P;if(null===(m=this.persistence)||void 0===m||m.clear(),null===(y=this.sessionPersistence)||void 0===y||y.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),Et(h)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:h}),null===(b=this.surveys)||void 0===b||b.reset(),null===(S=this.featureFlags)||void 0===S||S.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(k=this.logs)||void 0===k||k.reset(),null===(C=this.metrics)||void 0===C||C.reset(),null===(E=this.persistence)||void 0===E||E.set_property("$user_state","anonymous"),null===(x=this.sessionManager)||void 0===x||x.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Me,$device_id:null},"");else{const t=this.config.get_device_id(va());this.register_once({distinct_id:t,$device_id:e?t:u},""),e||Et(d)||this.register({[f]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this._inCookielessMode()&&(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(I=this.featureFlags)||void 0===I||I.initialize(),!Rt(c)&&!(null===(R=this.sessionManager)||void 0===R?void 0:R.setBootstrapSessionId(c,!0))){const e=at({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var M,L;_&&(null===(M=this.persistence)||void 0===M||null===(L=M._endCookieSyncSuppression)||void 0===L||L.call(M,v))}this.reloadFeatureFlags()}shutdown(e){var t=this;return st(function*(){var e,i,s,n,r,o,a;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null===(e=t.sessionRecording)||void 0===e||e.dispose(),null===(i=t.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(s=t.metrics)||void 0===s||s.flush("sendBeacon"),null===(n=t._requestQueue)||void 0===n||n.unload(),null===(r=t._retryQueue)||void 0===r||r.unload();try{var l;null===(l=t.featureFlags)||void 0===l||l.destroy()}catch(e){Fn.error("Error while destroying feature flags",e)}null===(o=t.persistence)||void 0===o||o.destroy(),null===(a=t.sessionPersistence)||void 0===a||a.destroy()}else Fn.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null===(i=this.conversations)||void 0===i||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||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?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var n;const t=null!==(n=e.timestampLookBack)&&void 0!==n?n:10;if(!i)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(Fn.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Et(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(v,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Fn.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const t=at({},this.config);if(kt(e)){var i,s,n,r,o,a,l,c,u,d,h,p,_;$n(this.config,lS(e));const f=this._is_persistence_disabled();null===(i=this.persistence)||void 0===i||i.update_config(this.config,t,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Jy(at(at({},this.config),{},{persistence:"sessionStorage"}),f,!1);const v=this._checkLocalStorageForDebug(this.config.debug);var g;Ft(v)&&(this.config.debug=v),Ft(this.config.debug)&&(this.config.debug?(Ba.DEBUG=!0,Ca._is_supported()&&Ca._set("ph_debug",!0),Fn.info("set_config",{config:e,oldConfig:t,newConfig:at({},this.config)})):(Ba.DEBUG=!1,Ca._is_supported()&&Ca._remove("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this._shouldDisableFlags()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(l=this.tracingHeaders)||void 0===l||l.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(u=this.heatmaps)||void 0===u||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(h=this.deadClicksAutocapture)||void 0===h||h.startIfEnabledOrStop(),null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),this._sync_opt_out_with_persistence(),null===(_=this.externalIntegrations)||void 0===_||_.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Ly(this,Kb,!1)}}_overrideSDKInfo(e,t){Ba.LIB_NAME=e,Ba.LIB_VERSION=t}startSessionRecording(e){const t=!0===e,i={sampling:t||!!(null==e?void 0:e.sampling),linked_flag:t||!!(null==e?void 0:e.linked_flag),url_trigger:t||!!(null==e?void 0:e.url_trigger),event_trigger:t||!!(null==e?void 0:e.event_trigger)};var s,n,r,o,a;Object.values(i).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),i.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),i.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),i.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),i.event_trigger&&(null===(a=this.sessionRecording)||void 0===a||a.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(null===(e=this.sessionRecording)||void 0===e?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(at(at({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var e,i;return null!==(e=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==e?e:t._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:sS;return t!==sS&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?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()&&Ct(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0: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?(Fn.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Pe,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;const 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;const i=this._is_persistence_disabled();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s._onOptOut(),(null===(e=this.persistence)||void 0===e?void 0:e._disabled)!==i&&(null===(n=this.persistence)||void 0===n||n.set_disabled(i)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t._disabled)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),i}opt_in_capturing(e){var i;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var s,n,r,o,a,l;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Fb(this),this.pageViewManager=new Dy(this),this.persistence&&(this.sessionPropsManager=new Ib(this,this.sessionManager,this.persistence));const e=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=t.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var c,u;e&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new e(this)),this._lastRemoteConfig&&(null===(c=this.sessionRecording)||void 0===c||null===(u=c.onRemoteConfig)||void 0===u||u.call(c,this._lastRemoteConfig)))}var d,h;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled()),(Et(null==e?void 0:e.captureEventName)||(null==e?void 0:e.captureEventName))&&this.capture(null!==(h=null==e?void 0:e.captureEventName)&&void 0!==h?h:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Fn.warn(Zb)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Fn.warn(Zb);const e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var t,i;null==e||e.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:Me,$device_id:null}),this._removeExtension(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const 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 i?Lb(i,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){s&&("visible"===s.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Je,{title:s.title},{send_instantly:!0}),this._visibilityStateListener&&(s.removeEventListener(Ze,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),zn(s,Ze,this._visibilityStateListener)))}debug(t){!1===t?(null==e||e.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==e||e.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(){const 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?(Fn.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,i,s,n){const r=t in e&&!Rt(e[t]),o=i in e&&!Rt(e[i]);return r?e[t]:!!o&&(n&&n.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,Fn)}_runBeforeSend(e){var t;if(Rt(this.config.before_send))return e;const i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Ot),s=St(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=e;for(const t of s)try{if(n=t(n),Rt(n)){const t=`Event '${e.event}' was rejected in beforeSend function`;return At(e.event)?Fn.warn(`${t}. This can cause unexpected behavior.`):Fn.info(t),null}n.properties&&!Ct(n.properties)||Fn.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return Fn.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(const t of i)if(n.properties&&Rt(n.properties[t]))return Fn.warn(`Event '${e.event}' had its '${t}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var e;return null===(e=this.pageViewManager._currentPageview)||void 0===e?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){const t=Ft(e)&&!e,i=Ca._is_supported()&&"true"===Ca._get("ph_debug");return!t&&(!!i||e)}};uS.__defaultExtensionClasses={},uS._noopLogger=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Bn(e.prototype[t[i]])}(uS,["identify"]);var dS=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,i=kt(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==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}};const hS=Ln("[ExceptionAutocapture]"),pS=Ln("[TracingHeaders]"),_S=Ln("[Web Vitals]"),gS=9e5,fS=["CLS","FCP","INP","LCP"],vS=["INP","LCP"],mS=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],yS=Ln("[SessionRecording]"),bS=Ln("[Heatmaps]");function SS(e){return kt(e)&&"clientX"in e&&"clientY"in e&&Pt(e.clientX)&&Pt(e.clientY)}const wS=Ln("[Product Tours]"),kS=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(R))},CS=["$set_once","$set"],ES=Ln("[SiteApps]"),xS="Error while initializing PostHog app with config id ",TS=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),IS="SDK is not enabled or survey functionality is not yet loaded",RS="Disabled. Not loading surveys.";var PS=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)return;if(this._config.disableSurveys)return;if(!e.ok)return cg.warn("Remote config unavailable. Not loading surveys.");const t=e.config.surveys;if(Rt(t))return cg.warn("Flags not loaded yet. Not loading surveys.");this._isSurveysEnabled=Ft(t)?t:t.length>0,cg.info(`flags response received, isSurveysEnabled: ${this._isSurveysEnabled}`),this.loadIfEnabled()}}setup(e){if(!this._disposed)return this._initializingClient=e,TS(e.kv.initialize(),()=>{if(this._initializingClient!==e||this._disposed)return;this._initializingClient=void 0,this._client=e;const t=e.onRemoteConfig(this.onRemoteConfig);this._disposed?t.dispose():(this._remoteConfigSubscription=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,this._initializingClient=void 0,this._client=void 0,null===(e=this._remoteConfigSubscription)||void 0===e||e.dispose(),this._remoteConfigSubscription=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(s=i.dispose)||void 0===s||s.call(i),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)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(this._disposed||!this._client)return;const e=this._config;if(this._surveyManager)return;if(this._isInitializingSurveys)return void cg.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void cg.info(RS);if(e.cookielessMode&&this._configSource.isOptedOut())return void cg.info("Not loading surveys in cookieless mode without consent.");const t=this._configSource.getExtensions();if(!t)return void cg.error("PostHog Extensions not found.");if(Et(this._isSurveysEnabled)&&!e.advancedEnableSurveys)return;const i=this._isSurveysEnabled||e.advancedEnableSurveys;this._isInitializingSurveys=!0;try{const e=t.generateSurveys;if(e)return this._completeSurveyInitialization(e,i),void(this._isInitializingSurveys=!1);const s=t.loadExternalDependency;if(!s)return this._handleSurveyLoadError(Ve),void(this._isInitializingSurveys=!1);s(e=>{try{if(this._disposed)return;const t=this._configSource.getExtensions();e||!(null==t?void 0:t.generateSurveys)?this._handleSurveyLoadError("Could not load surveys script",e):this._completeSurveyInitialization(t.generateSurveys,i)}finally{this._isInitializingSurveys=!1}})}catch(e){throw this._isInitializingSurveys=!1,this._handleSurveyLoadError("Error initializing surveys",e),e}}_completeSurveyInitialization(e,t){this._disposed||(this._surveyManager=e(t),this._surveyEventReceiver=this._configSource.createEventReceiver(),cg.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0}))}_handleSurveyLoadError(e,t){cg.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=!1){var i;const s=null!==(i=this._client)&&void 0!==i?i:this._initialClientState;if(!s||this._disposed)return;if(this._config.disableSurveys)return cg.info(RS),e([]);const n=s.kv.get(le);if(n&&!t)return e(n,{isLoaded:!0}),void(this._shouldBackgroundRefreshSurveys()&&this.getSurveys(()=>{},!0));if(this._getSurveysInFlightPromise)return void this._getSurveysInFlightPromise.then(({surveys:t,context:i})=>{this._disposed||e(t,i)}).catch(e=>cg.error("Error in survey callback",e));const r=this._sendSurveysRequest("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this._config.requestTimeoutMs}).then(e=>{try{return this._handleSurveyResponse(s,e)}catch(e){return cg.error("Error processing surveys response",e),this._handleSurveyResponse(s,{statusCode:0,error:e})}},e=>this._handleSurveyResponse(s,{statusCode:0,error:e}));this._getSurveysInFlightPromise=r;const o=()=>{this._getSurveysInFlightPromise===r&&(this._getSurveysInFlightPromise=null)};r.then(t=>{o(),this._disposed||e(t.surveys,t.context)},o).catch(e=>cg.error("Error in survey callback",e))}_sendSurveysRequest(e,t){const i=this._client;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:new Error(IS)}))}_handleSurveyResponse(e,t){if(this._disposed)return{surveys:[],context:{isLoaded:!1,error:IS}};const i=t.statusCode;if(200!==i||!t.json){const e=`Surveys API could not be loaded, status: ${i}`;return 0!==i?cg.error(e):t.error||cg.warn(e),this._lastSurveyRefreshFailedAt=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this._lastSurveyRefreshFailedAt=null;const s=t.json.surveys||[],n=s.filter(e=>hg(e)&&(Ja(e)||pg(e)));var r;return n.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(n)),e.kv.set({[le]:s,[ce]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}_shouldBackgroundRefreshSurveys(){return this._isSurveyCacheStale()&&!this._getSurveysInFlightPromise&&!this._isSurveyRefreshBackingOff()}_isSurveyCacheStale(){var e,t;const i=null===(e=null!==(t=this._client)&&void 0!==t?t:this._initialClientState)||void 0===e?void 0:e.kv.get(ce);return Pt(i)&&Date.now()-i>3e5}_isSurveyRefreshBackingOff(){return Pt(this._lastSurveyRefreshFailedAt)&&3e5>Date.now()-this._lastSurveyRefreshFailedAt}markSurveyAsSeen(e,t){var i;const s={id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null};fg(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}_notifySurveyCallbacks(e){for(const t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){cg.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t=!1){if(!Rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);cg.warn("init was not called")}_getSurveyById(e){let t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}_checkSurveyEligibility(e){if(Rt(this._surveyManager))return{eligible:!1,reason:IS};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}_checkSurveyRenderability(e){if(!this._configSource.isCapturing())return{eligible:!1,reason:ug};if(Rt(this._surveyManager))return{eligible:!1,reason:IS};const t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Rt(this._surveyManager))return cg.warn("init was not called"),{visible:!1,disabledReason:IS};const t=this._checkSurveyRenderability(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Rt(this._surveyManager)?(cg.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:IS})):new Promise(i=>{this.getSurveys(t=>{var s;const n=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(n){const e=this._checkSurveyRenderability(n);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var n;if(!this._configSource.isCapturing())return;if(Rt(this._surveyManager))return void cg.warn("init was not called");const r="string"==typeof e?this._getSurveyById(e):e;if(!(null==r?void 0:r.id))return void cg.warn("Survey not found");if(!vg.includes(r.type))return void cg.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==s?void 0:s.querySelector(t);if(o){if(null===(n=r.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds){cg.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const e=setTimeout(()=>{var t,s;this._renderTimeouts.delete(e),!this._disposed&&this._configSource.isCapturing()&&(cg.info(`Rendering survey ${r.id} with delay of ${null===(t=r.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(r,o,i),cg.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this._renderTimeouts.add(e)}this._surveyManager.renderSurvey(r,o,i)}else cg.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this._configSource.isCapturing())return;if(Rt(this._surveyManager))return void cg.warn("init was not called");const s=this._getSurveyById(e);if(!s)return void cg.warn("Survey not found");let n=s;if((null===(i=s.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(n=at(at({},s),{},{appearance:at(at({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==ag.Popover&&t.initialResponses&&cg.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){const e=this._checkSurveyEligibility(s);if(!e.eligible)return void cg.warn("Survey is not eligible to be displayed: ",e.reason)}t.displayType!==ag.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){Rt(this._surveyManager)?cg.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}};function MS(e,t,i){if(Rt(e))return!1;switch(i){case"exact":return e===t;case"contains":{const 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 FS=class{constructor(e){this._instance=e,this._actionRegistry=new Set,this._actionEvents=new Set,this._debugEventEmitter=new Rb,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?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;Et(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this._captureHookUnsubscribe=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null===(e=this._captureHookUnsubscribe)||void 0===e||e.call(this),this._captureHookUnsubscribe=void 0,this._debugEventEmitter=new Rb}register(e){var t,i;if(!Et(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t;this._actionRegistry.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this._actionEvents.add((null==e?void 0:e.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const e=new Set;this._actionRegistry.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}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(const i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(e,t){if(null==t?void 0:t.url){var i;const s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!s||"string"!=typeof s)return!1;if(!MS(s,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 i;if(!(null==t?void 0:t.href))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>MS(e.href,t.href,t.href_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&MS(function(e){const t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(n),t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(!(null==t?void 0:t.text))return!0;const s=this._getElementsList(e);if(s.length>0)return s.some(e=>MS(e.text,t.text,t.text_matching||"exact")||MS(e.$el_text,t.text,t.text_matching||"exact"));const n=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!n&&(r=function(e){const t=[],i=/(?::|")text="(.*?)"/g;let s;for(;!Rt(s=i.exec(e));)t.includes(s[1])||t.push(s[1]);return t}(n),o=t.text,a=t.text_matching||"exact",r.some(e=>MS(e,o,a)));var r,o,a}_checkStepSelector(e,t){var i,s;if(!(null==t?void 0:t.selector))return!0;const n=null==e||null===(i=e.properties)||void 0===i?void 0:i.$element_selectors;if(null==n?void 0:n.includes(t.selector))return!0;const r=(null==e||null===(s=e.properties)||void 0===s?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch(e){return!1}return!1}_getElementsList(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||sl(t.properties.reduce((e,t)=>{const i=St(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}},LS=class{constructor(e){var t,i;this._pendingActivatedItems=[],this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map,this._sessionIdUnsubscribe=null===(t=this._instance)||void 0===t||null===(i=t.onSessionId)||void 0===i?void 0:i.call(t,e=>this._onSessionIdChanged(e))}_shouldPersistArmedActivation(e){return!1}_getActivationTimestampsKey(){return null}_writeActivationTimestamps(e){}_clearActivationTimestampsStore(){}_doesEventMatchFilter(e,t){return!!e&&sl(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(e,t){const i=new Map;return e.forEach(e=>{var s;null===(s=e.conditions)||void 0===s||null===(s=s[t])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(t=>{if(null==t?void 0:t.name){const s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}_getMatchingItems(e,t,i){const s=(i===Y_.Activation?this._eventToItems:this._cancelEventToItems).get(e);let n=[];return this._getItems(e=>{n=e.filter(e=>null==s?void 0:s.includes(e.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[i])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(t=>t.name===e);return this._doesEventMatchFilter(r,t)})}register(e){this._register(e,!1)}replace(e){this._register(e,!0)}_register(e,t){var i;Et(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this._setupEventBasedItems(e,t),this._setupActionBasedItems(e,t))}_setupActionBasedItems(e,t){const i=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});var s;if(t&&this._actionToItems.clear(),0===i.length)return void(t&&(null===(s=this._actionMatcher)||void 0===s||s.replace([])));this._actionMatcher||(this._actionMatcher=new FS(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook(e=>this.onAction(e)));const n=[];i.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEach(t=>{if(n.push(t),t.name){var i;const s=null!==(i=this._actionToItems.get(t.name))&&void 0!==i?i:[];s.includes(e.id)||s.push(e.id),this._actionToItems.set(t.name,s)}})}),t?this._actionMatcher.replace(n):this._actionMatcher.register(n)}_mergeItemMaps(e,t){t.forEach((t,i)=>{var s;const n=null!==(s=e.get(i))&&void 0!==s?s:[];t.forEach(e=>{n.includes(e)||n.push(e)}),e.set(i,n)})}_setupEventBasedItems(e,t){var i,s;const n=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this._buildEventToItemMap(e,Y_.Activation),a=this._buildEventToItemMap(e,Y_.Cancellation);t?(this._eventToItems=o,this._cancelEventToItems=a):(this._mergeItemMaps(this._eventToItems,o),this._mergeItemMaps(this._cancelEventToItems,a)),(0!==n.length||0!==r.length)&&(null!==(i=this._captureHookUnsubscribe)&&void 0!==i||(this._captureHookUnsubscribe=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;const n=this._getLogger(),r=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(s=t.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const t=this._activationOutcome(e,r);if("consume"===t)return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this._deactivateItems([r]);if("persist"===t)return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this._persistActivation(r),void this._clearActivationTimestamps([r])}if(this._cancelEventToItems.has(e)){const i=this._getMatchingItems(e,t,Y_.Cancellation);i.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._deactivateItems(i.map(e=>e.id)),i.forEach(e=>this._cancelPendingItem(e.id)))}if(!this._eventToItems.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});const o=this._getMatchingItems(e,t,Y_.Activation);this._activateItems(o.map(e=>e.id))}onAction(e){this._actionToItems.has(e)&&this._activateItems(this._actionToItems.get(e)||[])}_activateItems(e){var t,i;if(0===e.length)return;const s=!!(null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t)),n=[];for(const t of e)s&&this._shouldPersistArmedActivation(t)?this._persistActivation(t)&&this._recordActivationTimestamp(t):n.push(t);n.length>0&&(this._pendingActivatedItems=[...new Set([...this._pendingActivatedItems,...n])]),this._getLogger().info("updating activated items",{activatedItems:this.getActivatedIds()})}_persistActivation(e){this._pendingActivatedItems=this._pendingActivatedItems.filter(t=>t!==e);const t=this._getPersistedActivatedIds();return!t.includes(e)&&(this._setActivatedItems([...t,e]),this._stampActivationSession(),!0)}_deactivateItems(e){const t=new Set(e);this._pendingActivatedItems=this._pendingActivatedItems.filter(e=>!t.has(e));const i=this._getRawPersistedActivatedIds(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this._setActivatedItems(s),0===s.length&&this._clearActivationSession()),this._clearActivationTimestamps(e)}_getRawActivationTimestamps(){var e;const t=this._getActivationTimestampsKey();if(!t)return{};const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t];return i&&"object"==typeof i?i:{}}_recordActivationTimestamp(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps();this._writeActivationTimestamps(at(at({},t),{},{[e]:Date.now()}))}_clearActivationTimestamps(e){if(!this._getActivationTimestampsKey())return;const t=this._getRawActivationTimestamps(),i={};let s=!1;for(const[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(Ct(i)?this._clearActivationTimestampsStore():this._writeActivationTimestamps(i))}_clearAllActivationTimestamps(){this._getActivationTimestampsKey()&&this._clearActivationTimestampsStore()}getActivationTimestamp(e){if(!this._getPersistedActivatedIds().includes(e))return;const t=this._getRawActivationTimestamps()[e];return Pt(t)?t:void 0}_getRawPersistedActivatedIds(){var e;const t=this._getActivatedKey();return(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t])||[]}_getPersistedActivatedIds(){var e,t,i;const s=this._getRawPersistedActivatedIds();if(0===s.length)return[];const n=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this._getActivatedSessionKey()],r=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);return r&&n===r?s:[]}_stampActivationSession(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(t=e.get_session_id)||void 0===t?void 0:t.call(e);i&&this._setActivatedSession(i)}_clearActivationSession(){this._clearActivatedSession()}_onSessionIdChanged(e){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this._getActivatedSessionKey()];if(i&&i!==e){const e=this._getRawPersistedActivatedIds(),t=this._getRawActivationTimestamps();e.length>0&&(this._setActivatedItems([]),e.filter(e=>Pt(t[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,i;null===(e=this._sessionIdUnsubscribe)||void 0===e||e.call(this),this._sessionIdUnsubscribe=void 0,null===(t=this._captureHookUnsubscribe)||void 0===t||t.call(this),this._captureHookUnsubscribe=void 0,null===(i=this._actionMatcher)||void 0===i||i.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}},AS=class extends LS{constructor(e){super(e)}_getActivatedKey(){return ue}_getActivatedSessionKey(){return de}_getActivationTimestampsKey(){return he}_writeActivationTimestamps(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_timestamps:e})}_clearActivationTimestampsStore(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_timestamps")}_shouldPersistArmedActivation(e){var t;let i;this._getItems(t=>{i=t.find(t=>t.id===e)});const s=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return Pt(s)&&s>0}_getShownEventName(){return rg.SHOWN}_getItems(e){var t;null===(t=this._instance)||void 0===t||t.getSurveys(e)}_cancelPendingItem(e){var t;null===(t=this._instance)||void 0===t||t.cancelPendingSurvey(e)}_getLogger(){return cg}_setActivatedItems(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated:e})}_setActivatedSession(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_session:e})}_clearActivatedSession(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_session")}_isItemPermanentlyIneligible(){return!1}_activationOutcome(e,t){let i;return this._getItems(e=>{i=e.find(e=>e.id===t)}),!i||Xa(i)?e===rg.SHOWN?"consume":"ignore":e===rg.SHOWN?"persist":e===rg.DISMISSED||e===rg.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},OS=class{constructor(e){this._instance=e}initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);const t={};for(const i of e){const e=this._instance.get_property(i);Et(e)||(t[i]=e)}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)}},$S=class{constructor(e){this._instance=e}get(){const 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()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}createEventReceiver(){return new AS(this._instance)}};const DS=(null==e?void 0:e.location)?Jn(e.location.hash,"__posthog")||Jn(location.hash,"state"):null,NS="_postHogToolbarParams",BS=Ln("[Toolbar]"),qS=Ln("[FeatureFlags]");var HS=class{constructor(e,t=!1){this._loggedEvaluationEnvironmentsDeprecation=!1,this.update(e,t)}update(e,t){this._snapshot=((e,t)=>{var i,s,n,r,o,a,l;return{bootstrap:{featureFlags:null!==(i=null===(s=e.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},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!==(o=e.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(l=e.evaluation_contexts)&&void 0!==l?l:e.evaluation_environments)&&void 0!==a?a:[],flagKeys:St(e.flag_keys)?e.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this._loggedEvaluationEnvironmentsDeprecation||(qS.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._loggedEvaluationEnvironmentsDeprecation=!0),Et(e.flag_keys)||St(e.flag_keys)||qS.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this._snapshot}};const US=Ln("[FeatureFlags]"),WS=Ln("[FeatureFlags]",{debugEnabled:!0}),zS="\" failed. Feature flags didn't load in time.",jS="connection_error",VS=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},GS=e=>{const t={};for(const[i,s]of Dn(e||{}))s&&(t[i]=s);return t},QS="Refusing to render web experiment since the viewer is a likely bot",KS={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>el(t,e),not_regex:(e,t)=>!el(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},ZS=Ln("[Conversations]"),YS="Conversations not available yet.";function JS(e,t){var s,n,r,o,a,l,c;const u=null!==(s=null==e?void 0:e.flushIntervalMs)&&void 0!==s?s:3e3,d=null!==(n=null==e?void 0:e.maxBufferSize)&&void 0!==n?n:100,h=(null==t?void 0:t.consoleCapture)?void 0:null!==(r=null==e?void 0:e.maxLogsPerInterval)&&void 0!==r?r:1e3,p=Et(h)?Math.max(d,2048):Math.max(d,h),_=at(at({},function(){let e="",t="";try{const s=null==i?void 0:i.userAgent;s&&([e,t]=Vi(s))}catch(e){}return function(e,t){const i=function(e){if(e)return{}.hasOwnProperty.call(fn,e)?fn[e]:e}(e);return at(at({},i?{"os.name":i}:{}),t?{"os.version":t}:{})}(e,t)}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==_?void 0:_["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==_?void 0:_["service.version"])&&void 0!==l?l:null==e?void 0:e.serviceVersion,environment:null!==(c=null==_?void 0:_["deployment.environment"])&&void 0!==c?c:null==e?void 0:e.environment,resourceAttributes:_,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const XS=["debug","log","warn","error","info"],ew="console",tw="__posthogHandledLogsRequestError",iw=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[tw]=!0,i},sw=e=>!!e&&"object"==typeof e&&!0===e[tw],nw={featureFlags:class{constructor(e){this.name="featureFlags",this._override_warning=!1,this.featureFlagEventHandlers=[],this._logger=US,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=()=>{const e=this._hasStatusZeroCircuitBreakerTripped();this._consecutiveStatusZeroFailures=0,e&&this.reloadFeatureFlags()},this._refreshIfDue=()=>{var e;const t=this._refreshIntervalMs;Et(t)||this._config.remoteRequestsDisabled||!s||"hidden"===s.visibilityState||Date.now()-(null!==(e=this._lastRefreshAt)&&void 0!==e?e:0)<t||(this.reloadFeatureFlags(),this._scheduleNextRefresh())},this._onVisibilityChange=()=>{"visible"===(null==s?void 0:s.visibilityState)&&this._refreshIfDue()},"get"in e?this._configSource=e:(this._instance=e,this._mutableConfigSource=new HS(e.config,e._shouldDisableFlags()),this._configSource=this._mutableConfigSource)}updateConfig(e,t){var i;null===(i=this._mutableConfigSource)||void 0===i||i.update(e,t),this._client&&this._syncAutomaticRefresh()}setup(e){return this._initializingClient=e,this._logger=e.logger.createLogger("[FeatureFlags]"),TS(e.kv.initialize(),()=>{this._initializingClient===e&&(this._initializingClient=void 0,this._client=e,this._finishSetup(e))})}_finishSetup(t){var i;if(this._client===t)return e&&zn(e,"online",this._onOnline),this._syncAutomaticRefresh(),this._dynamicProperties=t.registerDynamicEventProperties(()=>this._isCacheStale()?this._baseEventProperties:this._eventPropertiesWithFlagValues),this._crossTabPersistenceUnsubscribe=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this._clearBootstrapState(),this._rebuildEventProperties(),this._fireFeatureFlagsCallbacks()}),this._rebuildEventProperties(),this.initialize()}_syncAutomaticRefresh(){const e=this._config.refreshIntervalMs,t=!this._config.remoteRequestsDisabled&&s&&!Et(e)&&e>0?e:void 0;t!==this._refreshIntervalMs&&(this._stopAutomaticRefresh(),Et(t)||(this._refreshIntervalMs=t,this._scheduleNextRefresh(),(null==s?void 0:s.addEventListener)&&zn(s,Ze,this._onVisibilityChange)))}_scheduleNextRefresh(){Et(this._refreshIntervalMs)||(Et(this._refreshInterval)||clearInterval(this._refreshInterval),this._lastRefreshAt=Date.now(),this._refreshInterval=setInterval(this._refreshIfDue,this._refreshIntervalMs))}_stopAutomaticRefresh(){var e;Et(this._refreshInterval)||(clearInterval(this._refreshInterval),this._refreshInterval=void 0,null==s||null===(e=s.removeEventListener)||void 0===e||e.call(s,"visibilitychange",this._onVisibilityChange)),this._refreshIntervalMs=void 0,this._lastRefreshAt=void 0}destroy(){this._dispose()}dispose(){this._dispose()}_dispose(){var t,i;this._stopAutomaticRefresh(),this._requestGeneration++,this._additionalReloadRequested=!1,this._initializingClient=void 0,this._client&&(this._clearDebouncer(),null===(t=this._dynamicProperties)||void 0===t||t.dispose(),this._dynamicProperties=void 0,null===(i=this._crossTabPersistenceUnsubscribe)||void 0===i||i.call(this),this._crossTabPersistenceUnsubscribe=void 0,this._reloadingHandlers=[],null==e||e.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?void 0:t.kv.get(e)}_clearBootstrapState(){return!!this._bootstrapState&&(this._bootstrapState=void 0,!0)}_fallBackToPersistedFlags(){var e;return!Et(null===(e=this._client)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this._clearBootstrapState()}_set(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.set(e)})}_markCrossTabFeatureFlagSnapshot(e,t,i){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!e.$enabled_feature_flags)return;const n=this._prop("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,c=l?a:i&&!St(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(n),...Object.keys(r)])),u=this._prop("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},h=l||i?c:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),p=!l&&!i,_=!!p||c,g=!!p||h,f={[Y]:_,[Z]:_,[ee]:g};e.$feature_flag_details&&(f[X]=_);for(const t of[te,ke,ie])Et(e[t])||(f[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(f)}_remove(e){this._persist(()=>{var t;return null===(t=this._client)||void 0===t?void 0:t.kv.remove(e)})}_persist(e){try{e()}catch(e){this._logger.error("Failed to update feature flag persistence",e)}}_rebuildEventProperties(){const e={};for(const t of[Y,ee,te,se]){const i=this._prop(t);Et(i)||(e[t]=i)}this._baseEventProperties=e;const t=at({},e),i=this._prop(Z);if(i)for(const[e,s]of Object.entries(i))t[`$feature/${e}`]=s;this._eventPropertiesWithFlagValues=t}_isCacheStale(){const e=this._config.cacheTtlMs;if(!e||0>=e)return!1;const t=this._prop(ke);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(){const e=this._config.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{const 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(){const e=this._config.flagKeys;if(!Et(e))return e.filter(e=>{const 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;const i=this._config,s=null!==(e=null===(t=i.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var n,r;const e=null!==(n=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},t=Object.keys(s).filter(e=>!Et(s[e])).reduce((e,t)=>(e[t]=s[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this._receivedFeatureFlags({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;const r=(null==i?void 0:i.merge)&&null!==(s=this._prop("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==i?void 0:i.merge)&&null!==(n=this._prop("$feature_flag_payloads"))&&void 0!==n?n:{},a=at(at({},r),e),l=at(at({},o),t),c={};for(const[e,t]of Object.entries(a))c[e]={key:e,enabled:Qs(t),variant:Ks(t),reason:void 0,metadata:Et(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this._receivedFeatureFlags({flags:c})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this._prop(X),t=this._prop(se),i=this._prop(ne);if(!i&&!t)return e||{};const s=$n({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const e of n){var r;const n=s[e],a=null==t?void 0:t[e],l=Et(a)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!a,c=Et(a)?null==n?void 0:n.variant:"string"==typeof a?a:void 0,u=null==i?void 0:i[e],d=at(at({},n),{},{enabled:l,variant:l?null!=c?c:null==n?void 0:n.variant:void 0});var o;l!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),c!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),u&&(d.metadata=at(at({},null==n?void 0:n.metadata),{},{payload:u,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[e]=d}return this._override_warning||(this._logger.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this._override_warning=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:Qs(s),variant:Ks(s),payload:Gs(t[i])}})}getFlagVariants(){const e=this._prop(Z),t=this._prop(se);if(!t)return e||{};const i=$n({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){const e=this._prop(ee),t=this._prop(ne);if(!t)return e||{};const i=$n({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this._override_warning||(this._logger.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}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(be)}_callFlagsEndpoint(e){this._clearDebouncer();const t=this._client;if(!t||this._config.remoteRequestsDisabled||this._hasStatusZeroCircuitBreakerTripped())return;if(this._requestInFlight)return void(this._additionalReloadRequested=!0);const i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:at(at(at({},t.initialPersonProperties),this._prop("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this._prop(oe),timezone:El()};Et(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this._config.featureFlagsDisabled)&&(i.disable_flags=!0);const s=this._getValidEvaluationEnvironments();s.length&&(i.evaluation_contexts=s);const n=this._getValidFlagKeys();Et(n)||(i.flag_keys=n);const r=this._config.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this._requestGeneration;this._requestInFlight=!0;const l=()=>{this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())},c=e=>{var t,s;const n=null!==(t=e.json)&&void 0!==t?t:{},o=200!==e.statusCode;if(this._requestInFlight=!1,a!==this._requestGeneration)return void l();if(this._trackStatusZeroReachability(e.statusCode),o||this._additionalReloadRequested||(this.$anon_distinct_id=void 0),i.disable_flags&&!this._additionalReloadRequested)return;this._flagsLoadedFromRemote=!o;const c=[];e.error?c.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?jS:"unknown_error"):200!==e.statusCode&&c.push(`api_error_${e.statusCode}`),n.errorsWhileComputingFlags&&c.push("errors_while_computing_flags");const u=!!(null===(s=n.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));u&&c.push("quota_limited"),this._set({[we]:c}),u?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."):i.disable_flags||this._receivedFeatureFlags(n,o,{partialResponse:r}),l()},u=e=>{this._requestInFlight=!1,a===this._requestGeneration?(this._set({[we]:[jS]}),this._logger.error("Feature flag request failed",e),this._fallBackToPersistedFlags()&&this._fireFeatureFlagsCallbacks(!0),l()):l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this._config.compression,sentAt:"body",timeoutMs:this._config.requestTimeoutMs}).then(c).catch(u)}catch(e){u(e)}}_hasStatusZeroCircuitBreakerTripped(){return Xn(this._consecutiveStatusZeroFailures,3)}_trackStatusZeroReachability(e){this._consecutiveStatusZeroFailures=er(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 i;if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlag for key "'+e+zS);if(this._checkAndTriggerStaleRefresh())return;const s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return void this._logger.warn('getFeatureFlagResult for key "'+e+zS);if(this._checkAndTriggerStaleRefresh())return;const i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this._prop("$feature_flag_request_id")||void 0,l=this._prop("$feature_flag_evaluated_at")||void 0;let c,u=this._prop("$flag_call_reported")||{};if(this._config.deduplicateCallsPerSession){var d;const e=null===(d=this._client)||void 0===d?void 0:d.session.sessionId,t=this._prop(Se);e&&e!==t&&(u={},c=e)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))c&&this._set({[be]:u,[Se]:c});else{var h,p,_,g,f,v,m,y,b,S,w,k;St(u[e])?u[e].push(o):u[e]=[o],this._set(at({[be]:u},c?{[Se]:c}:{}));const t=this.getFeatureFlagDetails(e),i=[...null!==(h=this._prop("$feature_flag_errors"))&&void 0!==h?h:[]];Et(n)&&i.push("flag_missing");const s={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(p=null===(_=this._config.bootstrap)||void 0===_||null===(_=_.featureFlags)||void 0===_?void 0:_[e])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(g=null===(f=this._config.bootstrap)||void 0===f||null===(f=f.featureFlagPayloads)||void 0===f?void 0:f[e])&&void 0!==g?g:null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Et(null==t||null===(v=t.metadata)||void 0===v?void 0:v.has_experiment)||(s.$feature_flag_has_experiment=t.metadata.has_experiment),Et(null==t||null===(m=t.metadata)||void 0===m?void 0:m.version)||(s.$feature_flag_version=t.metadata.version);const d=null!==(y=null==t||null===(b=t.reason)||void 0===b?void 0:b.description)&&void 0!==y?y:null==t||null===(S=t.reason)||void 0===S?void 0:S.code;var C;d&&(s.$feature_flag_reason=d),(null==t||null===(w=t.metadata)||void 0===w?void 0:w.id)&&(s.$feature_flag_id=t.metadata.id),Et(null==t?void 0:t.original_variant)&&Et(null==t?void 0:t.original_enabled)||(s.$feature_flag_original_response=Et(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(k=t.metadata)||void 0===k?void 0:k.original_payload)&&(s.$feature_flag_original_payload=null==t||null===(C=t.metadata)||void 0===C?void 0:C.original_payload),i.length&&(s.$feature_flag_error=i.join(",")),this._captureFeatureFlagCalled(s)}else c&&this._set({[be]:u,[Se]:c});return s?{key:e,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:Gs(r)}:void 0}_captureFeatureFlagCalled(e){try{var t;null===(t=this._client)||void 0===t||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 i=this;return st(function*(){const s=i._client;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i._getValidEvaluationEnvironments();r.length&&(n.evaluation_contexts=r);const o=i._getValidFlagKeys();let a;Et(o)||(n.flag_keys=o);try{var l;const t=null===(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i._config.compression,sentAt:"body",timeoutMs:i._config.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==t?void 0:t[e])||void 0}catch(e){return void i._logger.error("Remote config feature flag request failed",e)}try{t(a)}catch(e){i._logger.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._flagsLoadedFromRemote)return t.defaultValue;if(!(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0))return this._logger.warn('isFeatureEnabled for key "'+e+zS),t.defaultValue;const i=this.getFeatureFlag(e,t);return Et(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this._receivedFeatureFlags(e,t,i)}_receivedFeatureFlags(e,t,i){if(!this._client)return;this._hasLoadedFlags=!0;const s=((e,t={},i={},s={},n,r=US)=>{const o=((e,t)=>{const i=e.flags;if(i){const t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!==(t=i[e].variant)&&void 0!==t?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!Et(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return at(at({},e),{},{featureFlags:t,featureFlagPayloads:s})}return e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e,r),a=o.flags,l=o.featureFlags,c=o.featureFlagPayloads;if(!l)return;const u=e.requestId,d=e.evaluatedAt;if(St(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[Y]:l,[Z]:e,[ie]:!1}}let h=l,p=c,_=a;if(null==n?void 0:n.partialResponse){const e=Object.keys(h),n=p||{};h=at(at({},t),h),p=at(at({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=at(at({},s),_)}else if(e.errorsWhileComputingFlags)if(a){const e=new Set(Object.keys(a).filter(e=>{var t;return!(null===(t=a[e])||void 0===t?void 0:t.failed)}));h=at(at({},t),Object.fromEntries(Object.entries(h).filter(([t])=>e.has(t))));const n=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=at(at({},i),n),e.forEach(e=>{e in n||null==p||delete p[e]}),_=at(at({},s),Object.fromEntries(Object.entries(_||{}).filter(([t])=>e.has(t))))}else h=at(at({},t),h),p=at(at({},i),p),_=at(at({},s),_);return at(at({[Y]:Object.keys(GS(h)),[Z]:h||{},[ee]:p||{},[X]:_||{},[ie]:!0===e.minimalFlagCalledEvents},u?{[te]:u}:{}),d?{[ke]:d}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this._logger);if(s)if(!1===(null==i?void 0:i.persist)){const e=!Et(this._client.kv.get(Z));this._bootstrapState=s,e||this._set(s)}else this._clearBootstrapState(),this._markCrossTabFeatureFlagSnapshot(s,e,!!(null==i?void 0:i.partialResponse)),this._set(s);else t&&this._fallBackToPersistedFlags();t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}override(e,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([se,ne]),this._fireFeatureFlagsCallbacks(),void WS.info("All overrides cleared");if(St(e))return this._set({[se]:VS(e)}),this._fireFeatureFlagsCallbacks(),void WS.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;const i=e;this._override_warning=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t);const s={},n=i.flags,r=i.payloads;return n&&(s[se]=St(n)?VS(n):n),r&&(s[ne]=r),Object.keys(s).length&&this._set(s),!1===n&&!1===r?this._remove([se,ne]):!1===n?this._remove(se):!1===r&&this._remove(ne),this._fireFeatureFlagsCallbacks(),!1===n?WS.info("Flag overrides cleared"):n&&WS.info("Flag overrides set",{flags:n}),void(!1===r?WS.info("Payload overrides cleared"):r&&WS.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this._set({[se]:e}),this._fireFeatureFlagsCallbacks(),void WS.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){const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();try{e(t,i)}catch(e){this._logger.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const n=(this._prop("$early_access_features")||[]).find(t=>t.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);const a=at(at({},this.getFlagVariants()),{},{[e]:t});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this._set({[Y]:Object.keys(GS(a)),[Z]:a,[re]:at(at({},this._prop("$stored_person_properties")||{}),r)}),this._fireFeatureFlagsCallbacks();try{var l;null===(l=this._client)||void 0===l||l.capture("$feature_enrollment_update",o).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=!1,i){const s=this._prop(J);!s||t?this._getEarlyAccessFeatures(e,i):e(s)}_getEarlyAccessFeatures(e,t){var i=this;return st(function*(){const s=i._client;if(!s)return;const n=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";let r;try{const e=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;r=e.json.earlyAccessFeatures,i._set({[J]:r})}catch(e){return void i._logger.error("Early access feature request failed",e)}try{e(r)}catch(e){i._logger.error("Early access feature callback failed",e)}})()}_prepareFeatureFlagsForCallbacks(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}_fireFeatureFlagsCallbacks(e){this._rebuildEventProperties();const{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this._logger.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t=!0){this._setPersonPropertiesForFlags(e,t)}_setPersonPropertiesForFlags(e,t=!0){const i=this._prop("$stored_person_properties")||{},s=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),n=null==e?void 0:e.$set_once,r={};if(n)for(const e in n)({}).hasOwnProperty.call(n,e)&&(e in i||(r[e]=n[e]));this._set({[re]:at(at(at({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=at({},this._prop("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this._set({[re]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this._remove(re),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this._prop("$stored_group_properties")||{},s=at({},i);for(const t of Object.keys(e))s[t]=at(at({},i[t]),e[t]);this._set({[oe]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this._prop("$stored_group_properties")||{};this._set({[oe]:at(at({},t),{},{[e]:{}})})}else this._remove(oe)}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}}},rw={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!!(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0: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?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=eo,this._persistFlagsOnSessionListener=void 0,this._sessionRecordingDisposed=!1,this._documentWasEverVisible=(()=>{var t,i;if(!(null==s?void 0:s.visibilityState)||"visible"===s.visibilityState)return!0;const n=null==e||null===(t=e.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==n?void 0:n.length)||n.some(e=>"visible"===e.name)})(),this._onVisibilityChange=()=>{var e,t;"visible"===(null==s?void 0:s.visibilityState)&&(this._documentWasEverVisible=!0,null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw yS.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==s?void 0:s.addEventListener)&&zn(s,"visibilitychange",this._onVisibilityChange)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._sessionRecordingDisposed=!0,null==s||null===(t=s.removeEventListener)||void 0===t||t.call(s,"visibilitychange",this._onVisibilityChange),e?this._discardRecording(!0):this.stopRecording()}get _isRecordingEnabled(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),s=!this._config.disable_session_recording,n=this._config.disable_session_recording||this._instance.consent.isOptedOut();return e&&i&&s&&!n}startIfEnabledOrStop(e){var t;if(this._sessionRecordingDisposed)return;if(this._isRecordingEnabled&&(null===(t=this._lazyLoadedSessionRecording)||void 0===t?void 0:t.isStarted))return;const i=!Et(Object.assign)&&!Et(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),yS.info("starting")):(this._recordingStatus=eo,this.stopRecording())}_lazyLoadAndStart(e){var t,i;if(this._isRecordingEnabled)if("awaiting_config"!==this._recordingStatus&&"missing_config"!==this._recordingStatus&&(this._recordingStatus=ro),(null==h||null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=h.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this._onScriptLoaded(e);else{var s,n;const t=this._instance.sessionManager;null===(s=h.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this._scriptName,i=>{if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),yS.error("could not load recorder",i)):void this._onScriptLoaded(e);this._recordingStatus="disabled"})}}stopRecording(){var e,t;null===(e=this._persistFlagsOnSessionListener)||void 0===e||e.call(this),this._persistFlagsOnSessionListener=void 0,null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.stop()}_discardRecording(e=!1){var t,i;null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=void 0,null===(i=this._lazyLoadedSessionRecording)||void 0===i||i.discard({discardProducerEvents:e})}_resetSampling(){var e,t;null===(e=this._persistence)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this._persistence)||void 0===t||t.unregister("$replay_sample_rate")}_validateSampleRate(e,t){if(Rt(e))return null;const i=Pt(e)?e:parseFloat(e);return"number"!=typeof(s=i)||!Number.isFinite(s)||0>s||s>1?(yS.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}_persistRemoteConfig(e){if(this._persistence){var t,i;const s=this._persistence,n=()=>{var t;const i=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null===(t=this._config.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),r=this._validateSampleRate(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=n?n:r;Rt(o)&&this._resetSampling();const a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[F]:at(at({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:at({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Et(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};n(),null===(t=this._persistFlagsOnSessionListener)||void 0===t||t.call(this),this._persistFlagsOnSessionListener=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(n)}}onRemoteConfig(e){const 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",yS.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.log)?this._lazyLoadedSessionRecording.log(e,t):yS.warn("log called before recorder was ready")}get _scriptName(){var e,t;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(F);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){const e=this._instance.get_property(F);if(!e)return!1;let t;try{t="object"==typeof e?e:JSON.parse(e)}catch(e){return yS.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!Rt(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}_onScriptLoaded(e){var t,i,s;if(!this._sessionRecordingDisposed&&this._isRecordingEnabled&&this._instance.sessionManager){if(!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return yS.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Oe]:!0});var n;if(this._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null===(n=h.__PosthogExtensions__)||void 0===n?void 0:n.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",yS.info("persisted remote config is stale, requesting fresh config before starting"),void new rb(this._instance).load()}this._recordingStatus=ro,null===(i=(s=this._lazyLoadedSessionRecording).setDocumentWasEverVisible)||void 0===i||i.call(s,this._documentWasEverVisible),this._lazyLoadedSessionRecording.start(e)}else this._recordingStatus=eo}onRRwebEmit(e){var t,i;null===(t=this._lazyLoadedSessionRecording)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null===(t=this._persistence)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this._lazyLoadedSessionRecording)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null===(i=this._persistence)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(t=this._lazyLoadedSessionRecording)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null===(e=this._lazyLoadedSessionRecording)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(null===(i=this._lazyLoadedSessionRecording)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this._lazyLoadedSessionRecording)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}},ow={autocapture:class extends vy{constructor(e){super(new dS(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this._lastLocation=this._getCurrentLocation()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this._getCaptureOptions();return!!(e.path||e.search||this._shouldCaptureHashChanges(e))}startIfEnabled(){this.isEnabled&&(Fn.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,Fn.info("History API monitoring stopped")}monitorHistoryChanges(){e&&e.history&&(this._patchHistoryMethod("pushState"),this._patchHistoryMethod("replaceState"),this._setupPopstateListener(),this._shouldCaptureHashChanges()&&this._setupHashchangeListener())}_patchHistoryMethod(t){var i;if(!e||(null===(i=e.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const s=this;lp(e.history,t,e=>function(i,n,r){e.call(this,i,n,r),s._capturePageview(t)})}_getCurrentLocation(){const t=null==e?void 0:e.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}_getCaptureOptions(){const e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:kt(e)?e:{}}_shouldCaptureHashChanges(e=this._getCaptureOptions()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}_hasLocationChanged(e){const t=this._getCaptureOptions(),i=this._lastLocation;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this._shouldCaptureHashChanges(t)&&e.hash!==i.hash))}_capturePageview(e){try{const t=this._getCurrentLocation();if(!t)return;this._hasLocationChanged(t)&&this._instance.capture(Je,{navigation_type:e}),this._lastLocation=t}catch(t){Fn.error(`Error capturing ${e} pageview`,t)}}_setupPopstateListener(){if(this._popstateListener)return;const t=()=>{this._capturePageview("popstate")};zn(e,"popstate",t),this._popstateListener=()=>{e&&e.removeEventListener("popstate",t)}}_setupHashchangeListener(){if(this._hashchangeListener)return;const t=()=>{this._capturePageview("hashchange")};zn(e,"hashchange",t),this._hashchangeListener=()=>{e&&e.removeEventListener("hashchange",t)}}},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)||void 0===t?void 0:t.props[k]),this.rageclicks=new dy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return kt(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Rt(this._config.capture_heatmaps)?Rt(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;bS.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)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[k]:i}),this._enabledServerSide=i,this.startIfEnabled()}getAndClearBuffer(){const e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){SS(e.originalEvent)&&this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==s?void 0:s.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){e&&s&&(this._flushHandler=this._flush.bind(this),zn(e,Ye,this._flushHandler),this._onClickHandler=t=>this._onClick(t||(null==e?void 0:e.event)),zn(s,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=t=>this._onMouseMove(t||(null==e?void 0:e.event)),zn(s,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new My(this.instance,Ry,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),zn(s,Ze,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var t;e&&s&&(this._flushHandler&&e.removeEventListener(Ye,this._flushHandler),this._onClickHandler&&s.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&s.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&s.removeEventListener(Ze,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null===(t=this._deadClicksCapture)||void 0===t||t.stop(),this._initialized=!1)}_getProperties(t,i){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(t,i,s){let n=t;for(;n&&nr(n)&&!rr(n,"body");){if(n===s)return!1;let t;try{var r,o,a;t=null===(r=null!==(o=null===(a=n.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:e)||void 0===r?void 0:r.getComputedStyle(n).position}catch(e){return!1}if(_t(i,t))return!0;n=vr(n)}return!1}(pr(t),["fixed","sticky"],r);return{x:t.clientX+(o?0:n),y:t.clientY+(o?0:s),target_fixed:o,type:i}}_onClick(e,t="click"){var i;if(sr(e.target)||!SS(e))return;const s=this._getProperties(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&xr(pr(e),this.instance.config.rageclick)&&this._capture(at(at({},s),{},{type:"rageclick"})),this._capture(s)}_onMouseMove(e){!sr(e.target)&&SS(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(t){if(!e)return;const i=this._config.disable_capture_url_hashes?ss(e.location.href):e.location.href,s=this._config.custom_personal_data_properties,n=this._config.mask_personal_data_properties?[...hl,...s||[]]:[],r=Yn(i,n,_l);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(t)}_flush(){this._buffer&&!Ct(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:My,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",at({$current_url:this._buffer.url},this._buffer.metrics.reduce((e,t)=>at(at({},e),{},{[`$web_vitals_${t.name}_event`]:at({},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},Rt(null==e?void 0:e.name)||Rt(null==e?void 0:e.value))return void _S.error("Invalid metric received",e);const i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this._maskedURL(i);if(Et(s))return;const n=Pt(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${s}`;if(this._maxAllowedValue&&e.value>=this._maxAllowedValue)return void _S.error("Ignoring metric with value >= "+this._maxAllowedValue,e);this._buffer.navigationKey!==n&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Et(this._buffer.navigationKey)&&(this._buffer.navigationKey=n,this._buffer.url=s),this._buffer.firstMetricTimestamp=Et(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp;const r=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=at(at(at({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,kt(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){const t={};for(const i of mS){const s="url"===i&&"string"==typeof e.attribution[i]?this._maskedURL(e.attribution[i]):e.attribution[i];Et(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;Et(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this._buffer.metrics.push(o),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()},this._startCapturing=()=>{if(this._initialized)return;let e,t,i,s,n=!1;const r=h.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this._callbackFlavor])||("web-vitals"===this._callbackFlavor&&Et(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Et(a)){const r=a.withoutAttribution,o=this.attributionMetrics;n=!Et(r),e=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,t=o.indexOf("CLS")>-1?a.onCLS:(null==r?void 0:r.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==r?void 0:r.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(e&&t&&i&&s))return void _S.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},c=n&&this.attributionMetrics.indexOf("INP")>-1?at(at({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this),c),this._initialized=!0},this._enabledServerSide=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[T]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=kt(this._perfConfig)?null===(e=this._perfConfig)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return Rt(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||fS:i}get flushToCaptureTimeoutMs(){return(kt(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=kt(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return Ft(e)?e?fS:[]:St(e)?e:vS}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=kt(this._perfConfig)?this._perfConfig.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get _maxAllowedValue(){const e=kt(this._perfConfig)&&Pt(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:gS;return e>0&&6e4>=e?gS:e}get isEnabled(){const e=null==n?void 0:n.protocol;if("http:"!==e&&"https:"!==e)return _S.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=kt(this._perfConfig)?this._perfConfig.web_vitals:Ft(this._perfConfig)?this._perfConfig:void 0;return Ft(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(_S.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=kt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=kt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[T]:i}),this._instance.persistence.register({[M]:s})),this._enabledServerSide=i,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;const i=h.__PosthogExtensions__,s=this._callbackFlavor,n=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&Et(n)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,s,t=>{t?_S.error("failed to load script",t):e()})}_maskedURL(t){const i=t||(null==e?void 0:e.location.href);if(!i)return void _S.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?ss(i):i,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...hl,...n||[]]:[];return Yn(s,r,_l)}}},aw={exceptionObserver:class{constructor(t){var i;this._startCapturing=()=>{var t;if(!e||!this.isEnabled||!(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=i(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=s(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=n(this.captureException.bind(this)))}catch(e){hS.error("failed to start",e),this._stopCapturing()}},this._instance=t,this._remoteEnabled=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[C]),this._rateLimiter=new Gt(at(at({},function(e={}){var t,i,s,n;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(s=null!==(n=e.exceptionRateLimiterBucketSize)&&void 0!==n?n:e.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,_logger:hS})),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return kt(e)?t=at(at({},t),e):(Et(e)?this._remoteEnabled:e)&&(t=at(at({},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?(hS.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return hS.error("failed to load script",t);e()})}_stopCapturing(){var e,t,i;null===(e=this._unwrapOnError)||void 0===e||e.call(this),this._unwrapOnError=void 0,null===(t=this._unwrapUnhandledRejection)||void 0===t||t.call(this),this._unwrapUnhandledRejection=void 0,null===(i=this._unwrapConsoleError)||void 0===i||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this._remoteEnabled=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[C]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){try{var t,i,s;const n=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this._rateLimiter.consumeRateLimit(n))return void hS.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this._suppressionRules=[],this._errorPropertiesBuilder=lv(),this._instance=e,this._suppressionRules=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this._exceptionStepsConfig=zs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer=new js(this._exceptionStepsConfig)}onConfigChange(){this._exceptionStepsConfig=zs(this._getExceptionStepsConfig()),this._exceptionStepsBuffer.setConfig(this._exceptionStepsConfig)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const n=e.config;if(!("errorTracking"in n))return;const r=null!==(t=null===(i=n.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[E]:this._suppressionRules,[x]:o})}get _captureExtensionExceptions(){var e;const t=!!this._instance.get_property(x),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&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(!xt(e)||0===e.trim().length)return void sv.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};const t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>Us.has(s)?(t.push(s),i):(i[s]=e[s],i),{}),droppedKeys:t}}(this._coerceExceptionStepProperties(t));s.length>0&&sv.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._exceptionStepsBuffer.add(at({[qs]:e,[Hs]:(new Date).toISOString()},i))}catch(e){sv.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this._isExceptionList(t)){if(this._matchesSuppressionRule(t))return this._addDroppedExceptionStep("Exception dropped: matched a suppression rule"),void sv.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 sv.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 sv.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 sv.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this._exceptionStepsConfig.enabled&&Rt(e.$exception_steps)?this._addBufferedExceptionSteps(e):e,s=function(){const e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();s&&(i.$release_id=s);try{const e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0});return e&&this._exceptionStepsBuffer.clear(),e}catch(e){return iv(e)||sv.error("Failed to capture exception event. Dropping this exception.",e),void this._exceptionStepsBuffer.clear()}}catch(e){return void(iv(e)||sv.error("Failed to process exception event. Ignoring this exception.",e))}}_addBufferedExceptionSteps(e){try{const t=this._exceptionStepsBuffer.getAttachable();return 0===t.length?e:at(at({},e),{},{$exception_steps:t})}catch(t){return sv.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}_addDroppedExceptionStep(e){this._exceptionStepsConfig.enabled&&this._exceptionStepsBuffer.add({[qs]:e,[Hs]:(new Date).toISOString()})}_coerceExceptionStepProperties(e){return kt(e)?at({},e):{}}_getExceptionStepsConfig(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}_matchesSuppressionRule(e){if(0===e.length)return!1;try{const t=e.reduce((e,{type:t,value:i})=>(xt(t)&&t.length>0&&e.$exception_types.push(t),xt(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some(e=>{const i=e.values.map(e=>{const i=il[e.operator],s=t[e.key];if(!i||!s)return!1;const n=St(e.value)?e.value:[e.value];return n.length>0&&i(n,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return sv.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}_isExtensionException(e){const t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&ov.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(nv))||e.some(({type:e,value:t})=>"NoResponse"===e||xt(t)&&rv.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(nv))))}_isInjectedBrowserScriptException(e){return e.some(({value:e})=>xt(e)&&av.some(t=>e.includes(t)))}_isPostHogException(e){if(e.length>0){var t,i,s,n;const r=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}_isExceptionList(e){return!Rt(e)&&St(e)}}},lw=at({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)return;const t=e.config;if("productTours"in t){var i,s;if(this._persistence&&this._persistence.register({[R]:!!t.productTours}),!kS(this._instance))return!this._productTourManager&&Rt(null===(i=this._persistence)||void 0===i?void 0:i.props.ph_product_tours)||wS.info("product tours disabled; stopping and clearing cached tours"),null===(s=this._productTourManager)||void 0===s||s.stop(),this._productTourManager=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this._productTourManager&&kS(this._instance)&&this._loadScript(()=>this._startProductTours())}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"product-tours",t=>{t?wS.error("Could not load product tours script",t):e()})}_startProductTours(){var e;!this._productTourManager&&(null===(e=h.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this._productTourManager=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(St(this._cachedTours)&&!t)return void e(this._cachedTours,{isLoaded:!0});const i=this._persistence;if(i){const s=i.props[pe];if(St(s)&&!t)return this._cachedTours=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:t=>{if(!kS(this._instance))return void e([],{isLoaded:!0});const s=t.statusCode;if(200!==s||!t.json){const i=`Product Tours API could not be loaded, status: ${s}`;return 0===s?t.error||wS.warn(i):wS.error(i),void e([],{isLoaded:!1,error:i})}const n=St(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[pe]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){Rt(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript(()=>{var t;this._startProductTours(),null===(t=this._productTourManager)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this._productTourManager)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this._productTourManager)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this._productTourManager)||void 0===e||e.previousStep()}clearCache(){var e;this._cachedTours=null,null===(e=this._persistence)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this._productTourManager)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this._productTourManager)||void 0===t||t.cancelPendingTour(e)}}},nw),cw={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)return;const i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}get siteAppLoaders(){var e;return null===(e=h._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");const l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[e,t]of Object.entries(u))l[e]={id:c[e],type:e,properties:t};const{$set_once:d,$set:h}=e;return{event:at(at({},cn(e,CS)),{},{properties:at(at(at({},e.properties),h?{$set:at(at({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:at(at({},null!==(s=null===(n=e.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),elements_chain:null!==(r=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}_prepareElementForSiteApp(e){var t;const i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(e)||(ES.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(e)||(ES.error("prepare_external_dependency_script returned null"),null)}return e}_patchSiteAppElementInsertionMethods(){var e,t,i,n,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=null==s?void 0:s.defaultView,u=null==c||null===(e=c.Node)||void 0===e?void 0:e.prototype;if(!c||!u)return()=>{};if(this._siteAppElementPatchCount++,this._restoreSiteAppElementPatches)return this._releaseSiteAppElementPatches();const d=[],h=this,p=new WeakSet,_=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;const s=e[t];e[t]=i(s),d.push(()=>{e[t]=s})},g=e=>{if(p.has(e))return e;const t=h._prepareElementForSiteApp(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!It(e));return _(u,"appendChild",e=>function(t){const i=g(t);return i?e.call(this,i):t}),_(u,"insertBefore",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):t}),_(u,"replaceChild",e=>function(t,i){const s=g(t);return s?e.call(this,s,i):i}),[null===(t=c.Element)||void 0===t?void 0:t.prototype,null===(i=c.Document)||void 0===i?void 0:i.prototype,null===(n=c.DocumentFragment)||void 0===n?void 0:n.prototype].forEach(e=>{_(e,"append",e=>function(...t){return e.apply(this,f(t))}),_(e,"prepend",e=>function(...t){return e.apply(this,f(t))})}),[null===(r=c.Element)||void 0===r?void 0:r.prototype,null===(o=c.CharacterData)||void 0===o?void 0:o.prototype,null===(a=c.DocumentType)||void 0===a?void 0:a.prototype].forEach(e=>{_(e,"before",e=>function(...t){return e.apply(this,f(t))}),_(e,"after",e=>function(...t){return e.apply(this,f(t))}),_(e,"replaceWith",e=>function(...t){const i=f(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),_(null===(l=c.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",e=>function(t,i){const s=g(i);return s?e.call(this,t,s):null}),this._restoreSiteAppElementPatches=()=>{d.forEach(e=>e()),this._restoreSiteAppElementPatches=void 0},this._releaseSiteAppElementPatches()}_releaseSiteAppElementPatches(){let e=!1;return()=>{var t;e||(e=!0,this._siteAppElementPatchCount--,0===this._siteAppElementPatchCount&&(null===(t=this._restoreSiteAppElementPatches)||void 0===t||t.call(this)))}}_runWithPreparedSiteAppElements(e,t=!0){const i=this._patchSiteAppElementInsertionMethods();try{const s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(ES.info(`Processing ${this._bufferedInvocations.length} events for site app with id ${e.id}`),this._bufferedInvocations.forEach(e=>this._runWithPreparedSiteAppElements(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this._stopBuffering)||void 0===i||i.call(this))};let s=!1;const n=n=>{t.errored=!n,t.loaded=!0,ES.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:i}=this._runWithPreparedSiteAppElements(t=>e.init({posthog:this._instance,callback(e){t(),n(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){ES.error(xS+e.id,t),n(!1)}if(s&&t.loaded)try{i()}catch(i){ES.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}_setupSiteApps(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}_onCapturedEvent(e){if(0===Object.keys(this.apps).length)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this._runWithPreparedSiteAppElements(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){ES.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,s;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this._setupSiteApps(),void this._instance.on("eventCaptured",e=>this._onCapturedEvent(e))):void ES.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this._stopBuffering)||void 0===i||i.call(this),!e.ok)return;const n=e.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:e,url:t}of n.siteApps){var r,o;h[`__$$ph_site_app_${e}`]=this._instance,null===(r=h.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,t,t=>{if(t)return ES.error(xS+e,t)})}else ES.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},uw={tracingHeaders:class{constructor(e){this._instance=e,this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._hostnamesForPatch=void 0,this._startCapturing=()=>{const e=this._syncHostnamesForPatch();var t,i;e?(Et(this._restoreXHRPatch)&&(this._restoreXHRPatch=null===(t=h.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Et(this._restoreFetchPatch)&&(this._restoreFetchPatch=null===(i=h.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this._stopCapturing()}}initialize(){this.startIfEnabledOrStop()}_loadScript(e){var t,i,s;(null===(t=h.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=h.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"tracing-headers",t=>{if(t)return pS.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(){const e=this._getConfiguredHostnames();return St(e)?(St(this._hostnamesForPatch)?this._hostnamesForPatch.splice(0,this._hostnamesForPatch.length,...e):this._hostnamesForPatch=[...e],e.length>0?this._hostnamesForPatch:void 0):(St(this._hostnamesForPatch)&&this._hostnamesForPatch.splice(0),this._hostnamesForPatch=e||void 0,this._hostnamesForPatch)}_stopCapturing(){var e,t;null===(e=this._restoreXHRPatch)||void 0===e||e.call(this),null===(t=this._restoreFetchPatch)||void 0===t||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0}startIfEnabledOrStop(){this._syncHostnamesForPatch()?this._loadScript(this._startCapturing):this._stopCapturing()}}},dw=at({surveys:class extends PS{constructor(e){var t;super(new $S(e),(t=e,{get projectToken(){return t.config.token},kv:new OS(t)})),this._instance=e}_sendSurveysRequest(e,t){const i=t.query?db(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!==(s=t.target)&&void 0!==s?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}},nw),hw={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){h.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=h.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,n=void 0){var r,o;if(jn(this.instance.config))return!1;if(!e||!s)return!1;t=null!==(r=t)&&void 0!==r?r:e.location,n=null!==(o=n)&&void 0!==o?o:e.history;try{if(!i){try{e.localStorage.setItem("test","test"),e.localStorage.removeItem("test")}catch(e){return!1}i=null==e?void 0:e.localStorage}const s=DS||Jn(t.hash,"__posthog")||Jn(t.hash,"state");let r;const o=s?Nn(()=>JSON.parse(atob(decodeURIComponent(s))))||Nn(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?t.hash=o.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):(r=JSON.parse(i.getItem(NS)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}_callLoadToolbar(e){const t=h.ph_load_toolbar||h.ph_load_editor;!Rt(t)&&wt(t)?t(e,this.instance):BS.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==s?void 0:s.getElementById("__POSTHOG_TOOLBAR__"));if(!e||i)return!1;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=at(at({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(e.localStorage.setItem(NS,JSON.stringify(at(at({},r),{},{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var o,a;this._setToolbarState(1),null===(o=h.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",e=>{if(e)return BS.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)}),zn(e,"turbolinks:load",()=>{this._setToolbarState(0),this.loadToolbar(r)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},pw=at({experiments:class t{get _config(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(e=!1)=>{this.getWebExperiments(e=>{t._logInfo("retrieved web experiments from the server"),this._flagToExperiments=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;this._flagToExperiments&&(t._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null===(i=this._flagToExperiments)||void 0===i||i.set(e.feature_flag_key,e));const s=this._instance.getFeatureFlag(e.feature_flag_key);xt(s)&&e.variants[s]&&this._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(const i in e.variants){const s=e.variants[i];t._matchesTestVariant(s,this._instance)&&this._applyTransforms(e.name,i,s.transforms)}})},e)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())t._logInfo(QS);else if(!this._config.disable_web_experiments){if(Rt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t._logInfo("applying feature flags",e),e.forEach(e=>{var t;if(this._flagToExperiments&&(null===(t=this._flagToExperiments)||void 0===t?void 0:t.has(e))){var i;const t=this._instance.getFeatureFlag(e),s=null===(i=this._flagToExperiments)||void 0===i?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this._applyTransforms(s.name,t,s.variants[t].transforms)}})}}previewWebExperiment(){const e=t.getWindowLocation();if(null==e?void 0:e.search){const i=Zn(null==e?void 0:e.search,"__experiment_id"),s=Zn(null==e?void 0:e.search,"__experiment_variant");i&&s&&(t._logInfo(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(e=>{this._showPreviewWebExperiment(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);const s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);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(e,i,s){const n=s.filter(t=>t.id===e);n&&n.length>0&&(t._logInfo(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this._applyTransforms(n[0].name,i,n[0].variants[i].transforms))}static _matchesTestVariant(e,i){return!Rt(e.conditions)&&t._matchUrlConditions(e,i)&&t._matchUTMConditions(e)}static _matchUrlConditions(e,i){var s;if(Rt(e.conditions)||Rt(null===(s=e.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,a;const t=tr(i,n.href);return!(null===(r=e.conditions)||void 0===r?void 0:r.url)||KS[null!==(o=null===(a=e.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](e.conditions.url,t)}return!1}static getWindowLocation(){return null==e?void 0:e.location}static _matchUTMConditions(e){var t;if(Rt(e.conditions)||Rt(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;const i=fl();if(i.utm_source){var s,n,r,o,a,l,c,u;const t=!(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==i.utm_campaign,d=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==i.utm_source,h=!(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.utm_medium,p=!(null===(c=e.conditions)||void 0===c||null===(c=c.utm)||void 0===c?void 0:c.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==i.utm_term;return t&&h&&p&&d}return!1}static _logInfo(e,...t){Fn.info(`[WebExperiments] ${e}`,t)}_applyTransforms(e,i,s){this._is_bot()?t._logInfo(QS):"control"!==i?s.forEach(s=>{if(s.selector){var n;t._logInfo(`applying transform of variant ${i} for experiment ${e} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(e=>{const t=e;s.html&&(t.innerHTML=s.html),s.css&&t.setAttribute("style",s.css)})}}):t._logInfo("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Lb(i,this._config.custom_blocked_useragents):void 0}}},nw),_w={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)return;if(this._remoteConfigSuccessful=e.ok,!e.ok)return;const t=e.config.conversations;Rt(t)||(Ft(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null,this._remoteConfigSuccessful=void 0,this._loadFailed=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this._isInitializing)return;if(this._instance.config.disable_conversations)return;if(jn(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=null==h?void 0:h.__PosthogExtensions__;if(e&&!Et(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{const t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);const i=e.loadExternalDependency;if(!i)return void this._handleLoadError(Ve);i(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 ZS.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,ZS.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else ZS.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){ZS.error(e,t),this._conversationsManager=null,this._isInitializing=!1,this._loadFailed=!0}show(){this._conversationsManager?this._conversationsManager.show():ZS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!It(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":jn(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this._remoteConfigSuccessful?"remote_config_failed":Et(this._isConversationsEnabled)?this._remoteConfigSuccessful?"disabled_in_project":"remote_config_pending":this._isConversationsEnabled?Rt(this._remoteConfig)||!this._remoteConfig.token?"missing_token":(null==h?void 0:h.__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?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,t,i){var s=this;return st(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(ZS.warn(YS),null)})()}getMessages(e,t){var i=this;return st(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(ZS.warn(YS),null)})()}markAsRead(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(ZS.warn(YS),null)})()}getTickets(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(ZS.warn(YS),null)})()}requestRestoreLink(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(ZS.warn(YS),null)})()}restoreFromToken(e){var t=this;return st(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(ZS.warn(YS),null)})()}restoreFromUrlToken(){var e=this;return st(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(ZS.warn(YS),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}_onIdentityCleared(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}},gw={logs:class{constructor(t){var i;this._instance=t,this.name=yg,this._isLogsEnabled=!1,this._isLoaded=!1,this._isLoading=!1,this._logger=Ln("[logs]"),this._coreLogger=at(at({},this._logger),{},{error:(...e)=>{e.some(sw)||this._logger.error(...e)}}),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)||void 0===e||e.onReconnect(),null===(t=this._consoleCore)||void 0===t||t.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this._isLogsEnabled=!0),e&&zn(e,"online",this._onReconnect)}_buildCore(e,t,i,s){var n;const r=JS(null===(n=this._instance)||void 0===n||null===(n=n.config)||void 0===n?void 0:n.logs,i);return[new kn(this._createHost(e,t),r,this._coreLogger,()=>this._getSdkContext(),e=>e(),void 0,s),r]}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,[this._core,this._resolvedConfig]=this._buildCore(()=>this._queue,e=>{this._queue=e})),this._core}_getConsoleCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;var i;return this._consoleCore&&this._consoleResolvedFrom===t||(null===(i=this._consoleCore)||void 0===i||i.reset(),this._consoleResolvedFrom=t,[this._consoleCore,this._consoleResolvedConfig]=this._buildCore(()=>this._consoleQueue,e=>{this._consoleQueue=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ew)),this._consoleCore}setup(e){var t;if(this._disposed)return;this._client=e,(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this._isLogsEnabled=!0),(this._isLogsEnabled||this._remoteConfigWillArrive()&&this._persistedCaptureHint())&&this._startConsoleRecorder();let i=!1;const s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this._disposed?s.dispose():(this._remoteConfigSubscription=s,i||this.loadIfEnabled())}dispose(){var t,i,s,n;this._disposed||(this._disposed=!0,this._stopConsoleRecorder(),null===(t=this._remoteConfigSubscription)||void 0===t||t.dispose(),this._remoteConfigSubscription=void 0,this._client=void 0,this._isLoading=!1,null==e||e.removeEventListener("online",this._onReconnect),null===(i=this._consoleLogsDispose)||void 0===i||i.call(this),this._consoleLogsDispose=void 0,null===(s=this._core)||void 0===s||s.reset(),null===(n=this._consoleCore)||void 0===n||n.reset())}onRemoteConfig(e){var t,i;if(this._disposed)return;const s=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;Rt(s)?this._stopRecorderStartedByPersistedHint():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!s}),s?(this._isLogsEnabled=!0,this._isLoaded||this._startConsoleRecorder(),this.loadIfEnabled()):this._stopRecorderStartedByPersistedHint())}reset(){var e,t,i,s;this._stopConsoleRecorder(),null===(e=this._core)||void 0===e||e.clearQueue(),this._queue=[],null===(t=this._core)||void 0===t||t.reset(),null===(i=this._consoleCore)||void 0===i||i.clearQueue(),this._consoleQueue=[],null===(s=this._consoleCore)||void 0===s||s.reset(),this._consecutiveStatusZeroFailures=0}captureLog(e){this._disposed||this._getCore().captureLog(e)}captureConsoleLog(e){this._disposed||this._getConsoleCore().captureLog(e)}captureBufferedConsoleLog(e,t,i){this._disposed||this._getConsoleCore().captureLog(e,{context:t,occurredAtMs:i})}_persistedCaptureHint(){var e;return!!(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e[P])}_remoteConfigWillArrive(){var e,t,i;return!(null===(e=this._instance)||void 0===e||null===(t=e._shouldDisableFlags)||void 0===t?void 0:t.call(e))||!!(null===(i=h._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}_onOptOut(){var e;this._stopConsoleRecorder(),null===(e=this._consoleCore)||void 0===e||e.clearQueue(),this._consoleQueue=[]}_stopRecorderStartedByPersistedHint(){this._isLogsEnabled||this._stopConsoleRecorder()}_startConsoleRecorder(){var e;if(this._isRecordingConsole||!(null==h?void 0:h.console))return;const t=JS(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs).maxBufferSize;for(const e of XS){let i;try{i=Wf(h.console[e])}catch(e){continue}i&&this._consoleRecorderUnpatchers.push(lp(h.console,e,s=>{const n=(...i)=>{try{this._recordConsoleEntry(e,i,t)}catch(e){}return s.apply(h.console,i)};return n.__rrweb_original__=i,n}))}this._isRecordingConsole=!0,this._consoleRecorderTimeout=setTimeout(()=>{this._stopConsoleRecorder()},3e4)}_recordConsoleEntry(e,t,i){var s;if(this._isRecordingConsole&&!this._isRecordingConsoleEntry&&0!==t.length)if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(i>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){this._isRecordingConsole=!1,this._consoleRecorderTimeout&&(clearTimeout(this._consoleRecorderTimeout),this._consoleRecorderTimeout=void 0);for(const e of this._consoleRecorderUnpatchers)e();this._consoleRecorderUnpatchers=[]}}_takeConsoleBuffer(){const 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){sw(e)||this._logger.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this._disposed||!this._isLogsEnabled||this._isLoaded||this._isLoading)return;const e=null==h?void 0:h.__PosthogExtensions__;if(!e)return this._logger.error("PostHog Extensions not found."),void this._stopConsoleRecorder();const t=e.loadExternalDependency;if(!t)return this._logger.error(Ve),void this._stopConsoleRecorder();this._isLoading=!0;try{t(this._instance,"logs",t=>{if(this._isLoading=!1,this._disposed||!this._isLogsEnabled)return;const i=e.logs;if(t||!(null==i?void 0:i.initializeLogs))this._logger.error("Could not load logs script",t),this._stopConsoleRecorder();else{var s;const e=this._takeConsoleBuffer();var n,r;this._consoleLogsDispose=i.initializeLogs(null!==(s=this._client)&&void 0!==s?s:this._instance),this._isLoaded=!0,e.length>0&&(null===(n=i.replayConsoleBuffer)||void 0===n||n.call(i,null!==(r=this._client)&&void 0!==r?r:this._instance,e))}})}catch(e){throw this._isLoading=!1,e}}_createHost(e,t){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===lt.LogsQueue?e():void 0,setPersistedProperty(e,i){var s;e===lt.LogsQueue&&t(null!==(s=i)&&void 0!==s?s:[])},_sendLogsBatch:e=>this._sendLogsBatch(e),getLibraryId:()=>Ba.LIB_NAME,getLibraryVersion:()=>Ba.LIB_VERSION}}_sendLogsBatch(e){return new Promise(t=>{if(Xn(this._consecutiveStatusZeroFailures,3))return void t({kind:"fatal",error:iw(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=e=>{i||(i=!0,clearTimeout(n),t(e))},n=setTimeout(()=>{this._logger.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:iw(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=>{const t=e.statusCode;if(this._trackEndpointReachability(t),t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:new Error(`logs request failed with status ${t}`)});else{var i;0===t?(e.error||this._logger.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:iw(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`logs request failed with status ${t}`)})}}})})}_trackEndpointReachability(e){(0!==e||this._instance.__loaded)&&(this._consecutiveStatusZeroFailures=er(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,ew,e=>{this._consoleQueue=e})}_drainQueueViaTransport(e,t,i,s,n){if(0===t.length)return;const r=t.map(e=>e.record);n([]);const o=wn(r,Sn(i,Ba.LIB_NAME,Ba.LIB_VERSION),s,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;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:e,windowId:i,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=i,Rt(s)||(t.sessionStartTimestamp=s),Rt(n)||(t.lastActivityTimestamp=n)}if((null==h||null===(e=h.location)||void 0===e?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ss(h.location.href):h.location.href),this._instance.featureFlags){const e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}},fw={metrics:class{constructor(e){this._instance=e,this._logger=Ln("[metrics]")}initialize(){}_getCore(){var e;const t=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;var i;return this._core&&this._resolvedFrom===t||(null===(i=this._core)||void 0===i||i.reset(),this._resolvedFrom=t,this._core=new Tn(this._createHost(),function(e){var t,i,s,n,r;const 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!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!==(n=null==e?void 0:e.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(t),this._logger)),this._core}count(e,t=1,i){this._getCore().count(e,t,i)}gauge(e,t,i){this._getCore().gauge(e,t,i)}histogram(e,t,i){this._getCore().histogram(e,t,i)}flush(e){if(!this._core)return Promise.resolve();if(e){const 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)||void 0===e||e.reset()}_createHost(){const 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(i=>{let s=!1;const n=e=>{s||(s=!0,clearTimeout(r),i(e))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(at(at({method:"POST",url:this._metricsUrl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){const t=e.statusCode;if(t>=200&&300>t)n({kind:"ok"});else if(413===t)n({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)n({kind:"fatal",error:new Error(`metrics request failed with status ${t}`)});else{var i;n({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:new Error(`metrics request failed with status ${t}`)})}}}))})}_metricsUrl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};uS.__defaultExtensionClasses=at({},at(at(at(at(at(at(at(at(at(at(at(at(at({},nw),rw),ow),aw),lw),cw),dw),uw),hw),pw),_w),gw),fw));const vw=function(){Ba.SDK_DIST_CHANNEL="npm";const t=Gb[sS]=new uS;return function(){function t(){t.done||(t.done=!0,nS=!1,On(Gb,function(e){e._dom_loaded()}))}(null==s?void 0:s.addEventListener)?"complete"===s.readyState?t():zn(s,"DOMContentLoaded",t,{capture:!1}):e&&Fn.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();var mw=vw;export{Z_ as Compression,Xy as DEFAULT_PRODUCT_TOUR_APPEARANCE,ag as DisplaySurveyType,uS as PostHog,eb as ProductTourEventName,tb as ProductTourEventProperties,rg as SurveyEventName,og as SurveyEventProperties,Y_ as SurveyEventType,X_ as SurveyPosition,sg as SurveyQuestionBranchingType,ig as SurveyQuestionType,ng as SurveySchedule,eg as SurveyTabPosition,tg as SurveyType,J_ as SurveyWidgetType,mw as default,vw as posthog,ob as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.full.no-external.js.map
|