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.
Files changed (61) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/conversations.js +1 -1
  14. package/dist/customizations.d.ts +2 -0
  15. package/dist/customizations.full.js +1 -1
  16. package/dist/customizations.js +1 -1
  17. package/dist/dead-clicks-autocapture.js +1 -1
  18. package/dist/default-extensions.js +1 -1
  19. package/dist/default-extensions.js.map +1 -1
  20. package/dist/exception-autocapture.js +1 -1
  21. package/dist/extension-bundles.js +1 -1
  22. package/dist/extension-bundles.js.map +1 -1
  23. package/dist/lazy-recorder.js +1 -1
  24. package/dist/main.d.ts +2 -0
  25. package/dist/main.js +1 -1
  26. package/dist/main.js.map +1 -1
  27. package/dist/module.d.ts +2 -0
  28. package/dist/module.full.d.ts +2 -0
  29. package/dist/module.full.js +1 -1
  30. package/dist/module.full.js.map +1 -1
  31. package/dist/module.full.no-external.d.ts +2 -0
  32. package/dist/module.full.no-external.js +1 -1
  33. package/dist/module.full.no-external.js.map +1 -1
  34. package/dist/module.js +1 -1
  35. package/dist/module.js.map +1 -1
  36. package/dist/module.mjs +1 -1
  37. package/dist/module.mjs.map +1 -1
  38. package/dist/module.no-external.d.ts +2 -0
  39. package/dist/module.no-external.js +1 -1
  40. package/dist/module.no-external.js.map +1 -1
  41. package/dist/module.slim.js +1 -1
  42. package/dist/module.slim.js.map +1 -1
  43. package/dist/module.slim.no-external.d.ts +2 -0
  44. package/dist/module.slim.no-external.js +1 -1
  45. package/dist/module.slim.no-external.js.map +1 -1
  46. package/dist/posthog-recorder.js +1 -1
  47. package/dist/product-tours.js +1 -1
  48. package/dist/src/extensions/surveys.d.ts +2 -0
  49. package/dist/surveys-preview.js.map +1 -1
  50. package/dist/surveys.d.ts +2 -0
  51. package/dist/surveys.js +1 -1
  52. package/dist/surveys.js.map +1 -1
  53. package/lib/package.json +1 -1
  54. package/lib/src/extensions/surveys.d.ts +2 -0
  55. package/lib/src/extensions/surveys.js +18 -1
  56. package/lib/src/extensions/surveys.js.map +1 -1
  57. package/lib/src/feature-flags-config.js +5 -5
  58. package/lib/src/feature-flags-config.js.map +1 -1
  59. package/lib/src/posthog-core.js +3 -7
  60. package/lib/src/posthog-core.js.map +1 -1
  61. package/package.json +4 -4
@@ -1,2 +1,2 @@
1
- var e,t=["retriesPerformedSoFar"];function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}function s(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function r(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var o=e.apply(t,i);function a(e){s(o,r,n,a,l,"next",e)}function l(e){s(o,r,n,a,l,"throw",e)}a(void 0)})}}var n="0.8.2",o={DEBUG:(!1,!1),LIB_VERSION:(n,"1.429.2"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:n},a=o,l="$people_distinct_id",d="distinct_id",u="$device_id",_="$device_model",c="__alias",h="__cmpns",p="$fbc",g="$fbc_persistence",v="__timers",f="$autocapture_disabled_server_side",m="$heatmaps_enabled_server_side",y="$exception_capture_enabled_server_side",b="$error_tracking_suppression_rules",w="$error_tracking_capture_extension_exceptions",S="$web_vitals_enabled_server_side",P="$dead_clicks_enabled_server_side",E="$product_tours_enabled_server_side",k="$logs_capture_enabled_server_side",C="$web_vitals_allowed_metrics",x="$session_recording_remote_config",T="$session_recording_enabled_server_side",I="$replay_sample_rate",F="$replay_override_sampling",R="$replay_override_linked_flag",O="$replay_override_url_trigger",A="$replay_override_event_trigger",M="$sesid",D="$session_is_sampled",L="$session_past_minimum_duration",N="$session_recording_url_trigger_activated_session",B="$session_recording_event_trigger_activated_session",U="$debug_first_full_snapshot_timestamp",q="$sess_rec_flush_size",H="$enabled_feature_flags",G="$active_feature_flags",W="$early_access_features",V="$feature_flag_details",j="$feature_flag_payloads",z="$feature_flag_request_id",K="$minimal_flag_called_events",J="$override_feature_flags",Y="$override_feature_flag_payloads",Q="$stored_person_properties",X="$stored_group_properties",Z="$groups",ee="$surveys",te="$surveys_loaded_at",ie="$surveys_activated",se="$surveys_activated_session",re="$surveys_activated_timestamps",ne="ph_product_tours",oe="$product_tours_activated",ae="$product_tours_activated_session",le="$conversations_widget_session_id",de="$conversations_ticket_id",ue="$conversations_widget_state",_e="$conversations_user_traits",ce="$flag_call_reported",he="$flag_call_reported_session_id",pe="$feature_flag_errors",ge="$feature_flag_evaluated_at",ve="$user_state",fe="$client_session_props",me="$capture_rate_limit",ye="$initial_campaign_params",be="$initial_referrer_info",we="$initial_person_info",Se="$epp",Pe="$posthog_cookieless",Ee="$cookieless_mode",ke="$sdk_debug_extensions_init_method",Ce="$sdk_debug_extensions_init_time_ms",xe="$sdk_debug_recording_script_not_loaded",Te="$sdk_debug_replay_event_trigger_status",Ie="$sdk_debug_replay_linked_flag_trigger_status",$e="$sdk_debug_replay_matched_recording_trigger_groups",Fe="$sdk_debug_replay_pending_trigger_conditions",Re="$sdk_debug_replay_remote_trigger_matching_config",Oe="$sdk_debug_replay_trigger_groups_count",Ae="$sdk_debug_replay_url_trigger_status",Me="$session_recording_start_reason",De="anonymous",Le="identified",Ne="identified_only",Be="visibilitychange",Ue="beforeunload",qe="$pageview",He="$pageleave",Ge="$identify",We="$groupidentify",Ve="u">typeof window?window:void 0,je="u">typeof globalThis?globalThis:Ve,ze=null==je?void 0:je.navigator,Ke=null==je?void 0:je.document,Je=null==je?void 0:je.location,Ye=null==je?void 0:je.fetch,Qe=null!=je&&je.XMLHttpRequest&&"withCredentials"in new je.XMLHttpRequest?je.XMLHttpRequest:void 0,Xe=null==je?void 0:je.AbortController,Ze=null==je?void 0:je.CompressionStream,et=null==ze?void 0:ze.userAgent,tt="undefined"!=typeof globalThis?globalThis:Ve;tt&&"undefined"==typeof self&&(tt.self=tt),tt&&"undefined"==typeof File&&(tt.File=function(){});var it=null!=Ve?Ve:{},st=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),rt=["$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"],nt=["token"];function ot(e,t){return-1!==e.indexOf(t)}var at=function(e){return e.replace(/^\$/,"")},lt=Object.prototype,dt=lt.hasOwnProperty,ut=lt.toString,_t=Array.isArray||function(e){return"[object Array]"===ut.call(e)},ct=e=>"function"==typeof e,ht=e=>e===Object(e)&&!_t(e),pt=e=>{if(ht(e)){for(var t in e)if(dt.call(e,t))return!1;return!0}return!1},gt=e=>void 0===e,vt=e=>"[object String]"==ut.call(e),ft=e=>vt(e)&&0===e.trim().length,mt=e=>null===e,yt=e=>gt(e)||mt(e),bt=e=>"[object Number]"==ut.call(e)&&e==e,wt=e=>bt(e)&&e>0,St=e=>"[object Boolean]"===ut.call(e),Pt=e=>ot(rt,e),Et=e=>ot(nt,e);function kt(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 function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Error)}}var Ct=[!0,"true",1,"1","yes"],xt=e=>ot(Ct,e),Tt=[!1,"false",0,"0","no"],It=["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"],$t=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return It.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function Ft(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),bt(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: "+r),Ft(null!=r?r:i,t,i,s))}var Rt="Mobile",Ot="Android",At="Tablet",Mt="Android Tablet",Dt="iPad",Lt="Apple Watch",Nt="Safari",Bt="BlackBerry",Ut="Samsung Internet",qt="Chrome",Ht="Chrome iOS",Gt="Internet Explorer",Wt="Internet Explorer Mobile",Vt="Opera",jt="Microsoft Edge",zt="Firefox",Kt="Firefox iOS",Jt="Nintendo",Yt="PlayStation",Qt="Xbox",Xt="Android Mobile",Zt="Mobile Safari",ei="Windows",ti="Windows Phone",ii="Nokia",si="Ouya",ri="Generic "+Rt.toLowerCase(),ni="Generic "+At.toLowerCase(),oi="Konqueror",ai="Oculus Browser",li="Vivaldi",di="Yandex",ui="Whale",_i="DuckDuckGo",ci="Pale Moon",hi="Waterfox",pi="Brave",gi="Claude",vi="Codex",fi="ChatGPT",mi="Google Search App",yi=new RegExp("Version/(\\d+(\\.\\d+)?)"),bi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),wi=new RegExp(Qt,"i"),Si=new RegExp("PlayStation \\w+","i"),Pi=new RegExp("Nintendo \\w+","i"),Ei=new RegExp("BlackBerry|PlayBook|BB10","i"),ki={"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"},Ci=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?pi:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&ot(e,"GSA/")?mi:ot(e," OPR/")&&ot(e,"Mini")?"Opera Mini":ot(e," OPR/")?Vt:Ei.test(e)?Bt:ot(e,"IEMobile")||ot(e,"WPDesktop")?Wt:ot(e,"OculusBrowser")?ai:ot(e,"SamsungBrowser")?Ut:ot(e,"Edge")||ot(e,"Edg/")?jt:ot(e,"Vivaldi/")?li:ot(e,"YaBrowser/")?di:ot(e,"Whale/")?ui:ot(e,"DuckDuckGo/")||ot(e,"Ddg/")?_i:ot(e,"Claude/")?gi:ot(e,"Codex/")?vi:ot(e,"ChatGPT/")?fi:ot(e,"FBIOS")?"Facebook Mobile":ot(e,"UCWEB")||ot(e,"UCBrowser")?"UC Browser":ot(e,"CriOS")?Ht:ot(e,"CrMo")||ot(e,qt)?qt:ot(e,Ot)&&ot(e,Nt)?Xt:ot(e,"FxiOS")?Kt:ot(e.toLowerCase(),oi.toLowerCase())?oi:ot(e,"Brave/")?pi:((e,t)=>t&&ot(t,"Apple")||function(e){return ot(e,Nt)&&!ot(e,qt)&&!ot(e,Ot)}(e))(e,t)?ot(e,Rt)?Zt:Nt:ot(e,"PaleMoon/")?ci:ot(e,"Waterfox/")?hi:ot(e,zt)?zt:ot(e,"MSIE")||ot(e,"Trident/")?Gt:ot(e,"Gecko")?zt:"")},xi={[Wt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[jt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[qt]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Ht]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Nt]:[yi],[Zt]:[yi],[Vt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Kt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Bt]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),yi],[Xt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ut]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[pi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[gi]:[bi],[vi]:[bi],[fi]:[bi],[_i]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[mi]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Gt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ti=function(e,t,i,s){var r=xi[Ci(e,t,i,s)];if(gt(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},Ii=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Qt,e&&e[1]||""]],[new RegExp(Jt,"i"),[Jt,""]],[new RegExp(Yt,"i"),[Yt,""]],[Ei,[Bt,""]],[new RegExp(ei,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ti,""];if(new RegExp(Rt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=ki[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ei,s]}return[ei,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=gt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Ot,[e[2],e[3],e[4]||"0"].join(".")]:[Ot,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],$i=function(e){return Pi.test(e)?Jt:Si.test(e)?Yt:wi.test(e)?Qt:new RegExp(si,"i").test(e)?si:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?ti:/iPad/.test(e)?Dt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Lt:Ei.test(e)?Bt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ii,"i").test(e)?ii:/(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(Rt).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)?Ot:Mt:new RegExp("(pda|Mobile)","i").test(e)?ri:new RegExp(At,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?ni:""},Fi=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ri=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Fi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Fi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Fi],[/\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"]],Oi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ai(e,t){return"string"==typeof(i=e)&&Oi.test(i)?e:t();var i}function Mi(e,t){var i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function Di(e){return e?e.split("#")[0]:e}var Li,Ni=["$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"],Bi="NativeGzipValidationError",Ui=e=>e.length>=2&&31===e[0]&&139===e[1],qi=(e,t)=>e===st.GZipJS||t===st.GZipJS||"gzip"===t,Hi=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Gi=e=>{throw Mi(Bi,"Native gzip produced invalid output: "+e)},Wi=function(){var e=r(function*(e,t){18>e.size&&Gi("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ui(i)&&8===i[2]||Gi("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Li)return Li;Li=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;Li[e]=t>>>0}return Li})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&Gi("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&Gi("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function Vi(){return Vi=r(function*(e,t,i){void 0===t&&(t=!0);try{var s=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then(()=>o.close()).catch(function(){var e=r(function*(e){try{yield o.abort(e)}catch(e){}throw e});return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),d=(yield Promise.all([l,a]))[0];return yield Wi(d,s),d}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}}),Vi.apply(this,arguments)}var ji=function(e,t){var i=(void 0===t?{}:t).debugEnabled,s={_log(t){for(var s=arguments.length,r=new Array(s>1?s-1:0),n=1;s>n;n++)r[n-1]=arguments[n];Ve&&(o.DEBUG||Ve.POSTHOG_DEBUG||i)&&!gt(Ve.console)&&Ve.console&&("__rrweb_original__"in Ve.console[t]?Ve.console[t].__rrweb_original__:Ve.console[t])(e,...r)},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ji(e+" "+t,i)};return s},zi=ji("[PostHog.js]"),Ki=zi.createLogger;function Ji(e,t){_t(e)&&e.forEach(t)}function Yi(e,t){if(!yt(e))if(_t(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)dt.call(e,i)&&t(e[i],i)}var Qi=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},Xi=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){zi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),zi.critical(e)}}},Zi=function(e){var t={};return Yi(e,function(e,i){(vt(e)&&e.length>0||bt(e))&&(t[i]=e)}),t};function es(e){var t=i({},e);for(var s of["name","message","stack","cause","errors"])try{s in e&&(t[s]=e[s])}catch(e){}return t}var ts=["herokuapp.com","vercel.app","netlify.app"];function is(e){var t=null==e?void 0:e.hostname;if(!vt(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of ts)if(i===s)return!1;return!0}function ss(e,t,i,s){var r=null!=s?s:{},n=r.capture,o=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var rs=e=>{if(Ke){try{for(var t=e+"=",i=Ke.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.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 bt(e)&&isFinite(e)&&Math.floor(e)===e});var ns=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},os=class{generate(){var e=this.generateOrAbort();if(!gt(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(gt(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e,t=(e=Date.now(),bt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0);if(t>this._timestamp)this._timestamp=t,this._resetCounter();else{if(this._timestamp>=t+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ns.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 ds}},as=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Ve&&!gt(Ve.crypto)&&crypto.getRandomValues&&(as=e=>crypto.getRandomValues(e));var ls,ds=class{nextUint32(){return this._buffer.length>this._cursor||(as(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}},us=()=>_s().toString(),_s=()=>(ls||(ls=new os)).generate(),cs="",hs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ps=null,gs={_is_supported(){if(!mt(ps))return ps;if(ps=!1,Ke)try{var e="__ph_cookie_support_"+us();gs._set(e,"xyz"),ps='"xyz"'===rs(e),gs._remove(e)}catch(e){ps=!1}return ps},_error(e){zi.error("cookieStore error: "+e)},_get:rs,_parse(e){var t;try{t=JSON.parse(gs._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!Ke)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=Ke),cs)return cs;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+us();!cs&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",cs=n)}return cs}(e);if(!i){var s=(e=>{var t=e.match(hs);return t?t[0]:""})(e);s!==i&&zi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(Ke.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return d.length>3686.4&&zi.warn("cookieStore warning: large cookie, len="+d.length),Ke.cookie=d,!0}catch(e){return!1}},_remove(e,t){if(null!=Ke&&Ke.cookie)try{gs._set(e,"",-1,t)}catch(e){return}}},vs=null,fs={_is_supported(){if(!mt(vs))return vs;var e=!0;if(gt(Ve))e=!1;else try{var t="__mplssupport__";fs._set(t,"xyz"),'"xyz"'!==fs._get(t)&&(e=!1),fs._remove(t)}catch(t){e=!1}return e||zi.error("localStorage unsupported; falling back to cookie store"),vs=e,e},_error(e){zi.error("localStorage error: "+e)},_get(e){try{return null==Ve?void 0:Ve.localStorage.getItem(e)}catch(e){fs._error(e)}return null},_parse(e){try{return JSON.parse(fs._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==Ve||Ve.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){fs._error(e)}return!1},_remove(e){try{null==Ve||Ve.localStorage.removeItem(e)}catch(e){fs._error(e)}}},ms=[Q,G,H,V,j,z,ge,pe,ce],ys=[u,d,M,D,Se,we,g,ve],bs=e=>e+"_cpm",ws=["__proto__","constructor","prototype"],Ss=e=>{if(!ht(e))return{};var t={};return Object.keys(e).forEach(i=>{-1===ws.indexOf(i)&&(t[i]=e[i])}),t},Ps=function(e,t){void 0===t&&(t=[]);var i={};return[...ys,...t].forEach(t=>{var s=e[t];gt(s)||mt(s)||""===s||(i[t]=s)}),i},Es=e=>{for(var t=5381,i=2166136261,s=0;e.length>s;s++){var r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},ks=(e,t)=>({p:t,f:Es(JSON.stringify(e))}),Cs=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var i=gs._parse(bs(e)),s=(null==i?void 0:i.f)===Es(t)&&_t(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},xs=(e,t)=>t+"|"+(gs._get(bs(e))||""),Ts={},Is={_is_supported:()=>!0,_error(e){zi.error("memoryStorage error: "+e)},_get:e=>e in Ts?Ts[e]:null,_parse:e=>e in Ts?Ts[e]:null,_set:(e,t)=>(Ts[e]=t,!0),_remove(e){delete Ts[e]}},$s=null,Fs={_is_supported(){if(!mt($s))return $s;if($s=!0,gt(Ve))$s=!1;else try{var e="__support__";Fs._set(e,"xyz"),'"xyz"'!==Fs._get(e)&&($s=!1),Fs._remove(e)}catch(e){$s=!1}return $s},_error(e){zi.error("sessionStorage error: ",e)},_get(e){try{return null==Ve?void 0:Ve.sessionStorage.getItem(e)}catch(e){Fs._error(e)}return null},_parse(e){try{return JSON.parse(Fs._get(e))||null}catch(e){}return null},_set(e,t){try{return null==Ve||Ve.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Fs._error(e)}return!1},_remove(e){try{null==Ve||Ve.sessionStorage.removeItem(e)}catch(e){Fs._error(e)}}},Rs=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return xt(e)?1:ot(Tt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?fs:gs,i=t._is_supported()?t:Is;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;var s="localStorage"===e?gs:fs;s._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(xt(s._get(this._storageKey))),s._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==ze?void 0:ze.doNotTrack,null==ze?void 0:ze.msDoNotTrack,it.doNotTrack,null==ze?void 0:ze.globalPrivacyControl].some(e=>xt(e))}},Os=["next","previous","prev",">","<","+","-","−","–"];Ki("[Dead Clicks]");var As=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(P)),s=e.instance.config.capture_dead_clicks;return St(s)?s:!!ht(s)||i},Ms=Ki("[SegmentIntegration]");function Ds(e,t,s){void 0===s&&(s=!0);var r=e.config.segment;if(!r)return t();var n,o=(e=>ct(e.register))(n=r)?{analytics:n}:n,a=o.analytics,l=o.filterProperties;!function(e,t,i,s){var r=t=>{var r=()=>t.anonymousId()||us();e.config.get_device_id=r,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:r()}),e.persistence.set_property(ve,Le)),i(s?void 0:t.anonymousId()||void 0)},n=t.user();"then"in n&&ct(n.then)?n.then(r):r(n)}(e,a,s=>{a.register(function(e,t,s){var r=(void 0===s?{}:s).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||Ms.warn("This browser does not have Promise support, and can not use the segment integration");var n=(s,n)=>{if(!n)return s;var o=!!t&&s.event.anonymousId===t&&!s.event.userId;o||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(Ms.info("No userId set, resetting PostHog"),e.reset()),o||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(Ms.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));var a=e.calculateEventProperties(n,s.event.properties);if(!yt(r)){var l=s.event.properties||{},d={};for(var u of Object.keys(a))dt.call(l,u)||(d[u]=a[u]);var _=((e,t)=>{var s=_t(e)?e:[e],r=i({},t);for(var n of s)try{if(r=n(r),yt(r))return null}catch(e){return Ms.error("Error in Segment filterProperties:",e),null}return r})(r,d);if(yt(_))return s;a=_}return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return n(e,e.event.event)},page(e){return n(e,qe)},identify(e){return n(e,Ge)},screen(e){return n(e,"$screen")}}}(e,s,{filterProperties:l})).then(()=>{t()},e=>{Ms.error("Failed to register the Segment integration",e),t()})},s)}var Ls="posthog-js";function Ns(e,t){var s=void 0===t?{}:t,r=s.organization,n=s.projectId,o=s.prefix,a=s.severityAllowList,l=void 0===a?["error"]:a,d=s.sendExceptionsToPostHog,u=void 0===d||d;return t=>{var s,a,d,_,c,h;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=(null==(s=t.exception)?void 0:s.values)||[],v=g.map(e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>i({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(d=g[0])?void 0:d.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return r&&n&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+t.event_id),u&&(null==(h=e.exceptions)||h.sendExceptionEvent(f)),t}}var Bs=class{constructor(e,t,i,s,r,n){this.name=Ls,this.setupOnce=function(o){o(Ns(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},Us=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(zi.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.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==Ve?void 0:Ve.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,d=r.lastContentY,u=r.maxContentY;if(!(gt(n)||gt(o)||gt(a)||gt(l)||gt(d)||gt(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),d=Math.ceil(d),u=Math.ceil(u);var _=n>1?Ft(o/n,0,1,zi):1,c=n>1?Ft(a/n,0,1,zi):1,h=l>1?Ft(d/l,0,1,zi):1,p=l>1?Ft(u/l,0,1,zi):1;s=Qi(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:_,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},qs=["flags","surveys"],Hs={[l]:{exposure:"hidden"},[c]:{exposure:"hidden"},[h]:{exposure:"hidden"},[v]:{exposure:"hidden"},[g]:{exposure:"hidden"},[f]:{exposure:"event"},[m]:{exposure:"hidden"},[k]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},[w]:{exposure:"event"},[S]:{exposure:"event"},[P]:{exposure:"event"},[E]:{exposure:"hidden"},[C]:{exposure:"event"},[x]:{exposure:"hidden"},[T]:{exposure:"hidden"},[M]:{exposure:"hidden"},[D]:{exposure:"event"},[I]:{exposure:"event",shouldSkipFromEventProperties:e=>mt(e)},[L]:{exposure:"event"},[N]:{exposure:"event"},[B]:{exposure:"event"},[U]:{exposure:"event"},[q]:{exposure:"hidden"},[H]:{exposure:"hidden",storageGroup:"flags"},[G]:{exposure:"hidden",storageGroup:"flags"},[W]:{exposure:"hidden"},[V]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden",storageGroup:"flags"},[z]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[K]:{exposure:"hidden",storageGroup:"flags"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[ee]:{exposure:"hidden",storageGroup:"surveys"},[te]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ie]:{exposure:"event"},[se]:{exposure:"hidden"},[re]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[oe]:{exposure:"hidden"},[ae]:{exposure:"hidden"},[le]:{exposure:"event"},[de]:{exposure:"event"},[ue]:{exposure:"event"},[_e]:{exposure:"event"},[ce]:{exposure:"hidden"},[he]:{exposure:"hidden"},[Z]:{exposure:"event"},[pe]:{exposure:"hidden"},[ge]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ve]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[me]:{exposure:"hidden"},[ye]:{exposure:"hidden"},[be]:{exposure:"hidden"},[we]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[F]:{exposure:"event"},[R]:{exposure:"event"},[O]:{exposure:"event"},[A]:{exposure:"event"},[ke]:{exposure:"event"},[Ce]:{exposure:"event"},[xe]:{exposure:"event"},[Te]:{exposure:"event"},[Ie]:{exposure:"event"},[$e]:{exposure:"event"},[Fe]:{exposure:"event"},[Re]:{exposure:"event"},[Oe]:{exposure:"event"},[Ae]:{exposure:"event"},[Me]:{exposure:"event"}},Gs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ws=e=>{var t=Hs[e];if(t)return t;for(var i of Gs){var s=i[1];if(0===e.indexOf(i[0]))return s}},Vs=(e,t)=>{try{var i;return JSON.stringify(e,(e,t)=>kt(t)?(null!=i||(i=new WeakMap),i.has(t)||i.set(t,es(t)),i.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return r=[],null!==(s=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}}))&&void 0!==s?s:"null"}var s,r},js=e=>{var t=null==Ke?void 0:Ke.createElement("a");return gt(t)?null:(t.href=e,t)},zs=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!_t(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){zi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ks=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),d=[],u=0;l.length>u;u++){var _=l[u].split("=");_t(_)&&(t.includes(_[0])?d.push(_[0]+"="+i):d.push(l[u]))}var c=a;return null!=o&&(c+="?"+d.join("&")),null!=r&&(c+="#"+r),c},Js=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ys=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Js],Qs="<masked>",Xs=["li_fat_id"];function Zs(e,t){var i=Ys.concat(t||[]),s={};return Yi(i,function(t){var i=zs(e,t);s[t]=i||null}),s}function er(e){var t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!mt(t)){s.$search_engine=t;var r=Ke?zs(Ke.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function tr(){return navigator.language||navigator.userLanguage}var ir="$direct";function sr(){return(null==Ke?void 0:Ke.referrer)||ir}function rr(e,t,i){var s;void 0===i&&(i=!1);var r=e?[...Js,...t||[]]:[],n=null==(s=i?Di(null==Je?void 0:Je.href):null==Je?void 0:Je.href)?void 0:s.substring(0,1e3);return{r:sr().substring(0,1e3),u:n?Ks(n,r,Qs):void 0}}function nr(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Di(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==ir?ir:null==(i=js(s))?void 0:i.host};if(n){o.$current_url=n;var a=js(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,Qi(o,Zs(n))}return s&&Qi(o,er(s)),o}function or(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function ar(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var lr={flags:ge,surveys:te},dr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ur=e=>e+"_cookie_identity_change_pending",_r=e=>{var t="",i=0;for(var s of e){var r=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+r>1e3)break;t+=s,i+=r}return t},cr="main",hr=[H,G,V,j,z,ge,K,Q],pr=e=>-1!==hr.indexOf(e),gr=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},vr=e=>{if(!e)return{};var t=JSON.parse(e);return ht(t)?t:{}},fr=(e,t)=>{Yi(e,(i,s)=>{var r=Ws(s);r&&"event"!==r.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})},mr=class{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._facebookClickIdChangePending=!1,this._crossTabFeatureFlagHandlers=new Set,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),e.debug&&zi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),Ve){var r=()=>this.flush();ss(Ve,"beforeunload",r,{capture:!1}),ss(Ve,"pagehide",r,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==Ve?void 0:Ve.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=qs.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,cr)},ss(Ve,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],i=e[1],s=this._pendingCrossTabFeatureFlagChanges.get(t);if(pr(t)&&!0!==s)if(!0!==i){var r=new Set(s||[]);i.forEach(e=>r.add(e)),r.size&&this._setCrossTabFeatureFlagChangesPending(t,r)}else this._setCrossTabFeatureFlagChangesPending(t,!0)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&Ve&&(Ve.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i){if(void 0===i&&(i=!0),this._disabled)return!1;var s,r;try{if(r=fs._get(e),mt(r)){var n=this._slotWriteState(t);return n.storageValue=null,t!==cr&&(n.persisted=!1),!1}s=vr(r)}catch(e){return!1}var o=t===cr?s:fs._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===cr&&this._splitStorage&&!gr(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,r),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[d],i=e[d];return!gt(t)&&!gt(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){var r=this._slotWriteState(t);r.storageValue=s,t!==cr&&(r.persisted=i);try{r.fingerprint=this._entryFingerprint(e,t)}catch(e){r.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){var s=!1;return hr.forEach(i=>{var r,n=null==(r=Ws(i))?void 0:r.storageGroup;if(!(t===cr&&this._splitStorage&&n||t!==cr&&n!==t)){var 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&&gr(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;var e,t=fs._get(this._name),i=this._slotWriteState(cr),s=!1,r=!1;if(t!==i.storageValue)if(mt(t))i.storageValue=null;else{if(e=vr(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;r=this._mergeCrossTabFeatureFlagProperties(e,cr,!1),!this._splitStorage||gr(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,cr,!0,t):i.storageValue=t,s=!0}return this._splitStorage&&qs.forEach(t=>{var i=fs._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=s&&hr.some(e=>{var i;return(null==(i=Ws(e))?void 0:i.storageGroup)===t&&e in o});if(i!==n.storageValue||a){if(mt(i))return n.storageValue=null,n.persisted=!1,void(a&&(r=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||r));var l=vr(i);r=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||r,this._rememberCrossTabStorageFingerprint(l,t,!0,i)}}),r}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var i=Ws(e);null!=i&&i.volatile||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||cr).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){hr.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=fs._get(this._name),t=vr(e);this._slotWriteState(cr).storageValue=e,hr.forEach(e=>{var i,s=this._splitStorage?null==(i=Ws(e))?void 0:i.storageGroup:void 0,r=s?fs._get(this._groupEntryName(s)):null;if(s){var n=this._slotWriteState(s);n.storageValue=r,n.persisted=!mt(r)}var o=s&&!mt(r)?vr(r):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!s)return t;if(!0===s)return this.props[e];if("$active_feature_flags"===e){var r=new Set(_t(t)?t:[]),n=new Set(_t(this.props[e])?this.props[e]:[]);return s.forEach(e=>n.has(e)?r.add(e):r.delete(e)),Array.from(r)}var o=ht(t)?i({},t):{},a=ht(this.props[e])?this.props[e]:{};return s.forEach(e=>{e in a?o[e]=a[e]:delete o[e]}),o}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(pr(e)){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==s){var r=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Ws(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;r=vr(fs._get(a))[e]}catch(e){}var l=new Set(s||[]);if("$active_feature_flags"===e){if(!gt(t)&&!_t(t)||!gt(r)&&!_t(r)||!_t(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var d=new Set(t||[]),u=new Set(r||[]),_=new Set(i);new Set([...d,..._]).forEach(e=>{d.has(e)!==_.has(e)&&l.add(e)}),l.forEach(e=>{u.has(e)===_.has(e)&&l.delete(e)})}else{if(!ht(i))return void(gr(r,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!gt(t)&&!ht(t)||gt(t)&&pt(i)&&gt(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var c=ht(t)?t:{},h=ht(r)?r:{};new Set([...Object.keys(c),...Object.keys(i)]).forEach(e=>{e in c==e in i&&gr(c[e],i[e])||l.add(e)}),l.forEach(e=>{e in h==e in i&&gr(h[e],i[e])&&l.delete(e)})}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return bt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=Ps(e,this._config.cookie_persisted_properties||[]),i=ks(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=gs._get(this._name)||void 0;r&&xs(this._name,r)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r)}catch(e){}else try{var n=gs._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?xs(this._name,n):void 0,this._lastSeenMainCookieValue=n}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var i;try{i=gs._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;var s,r=xs(this._name,i);try{s=Ss(JSON.parse(i))}catch(e){return!1}if((gs._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=r,this._lastSeenMainCookieValue=i;var n=Cs(this._name,i),o=[...ys,...n.properties],a={};if(Object.keys(s).forEach(e=>{var t=s[e];(gt(t)||mt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),pt(s))return!1;var l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,_=u[d],h=u[ve],p=Qi({},u);[...ys,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=p[e];(n.isValid||-1===ys.indexOf(e)||!1!==t&&0!==t)&&delete p[e]}}),this.props=Qi(p,s),hr.forEach(e=>{var t=e in this.props;e in u===t&&gr(u[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,u[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this._setProp(ve,De);var g=this.props[d],v=this.props[ve];return!l||g===_&&v===h||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Fs._set(ur(this._name),!0),this._deleteProp(Q),this._deleteProp(G),this._deleteProp(H),this._deleteProp(V),this._deleteProp(j),this._deleteProp(z),this._deleteProp(ge),this._deleteProp(pe),this._deleteProp(ce),"anonymous"!==v||"identified"!==h&&"anonymous"!==s.$user_state&&(gt(_)||g===_)||(fr(this.props,s),this._deleteProp(X)),"identified"===v?this.props.$user_id=g:delete this.props.$user_id,this._deleteProp(c)),!0}consumeCookieIdentityChange(){var e=ur(this._name),t=this._cookieIdentityChangePending||!!Fs._get(e);return this._cookieIdentityChangePending=!1,t&&Fs._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[cr],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(e){-1===dr.indexOf(e.persistence.toLowerCase())&&(zi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...ys,...e];return i({},fs,{_parse(e){try{var i,r={};try{i=gs._get(e)||void 0,r=i?Ss(JSON.parse(i)):{}}catch(e){}var n,o=JSON.parse(fs._get(e)||"{}");if(t){var a=Cs(e,i),l=[...ys,...a.properties],u={};Object.keys(r).forEach(e=>{var t=r[e];mt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});var _="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var c,h=o[d],p=null!==(c=o.$user_state)&&void 0!==c?c:"anonymous";s.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in r)&&(_||"distinct_id"!==e&&"$user_state"!==e)){var t=o[e];(a.isValid||-1===ys.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!_||"$user_state"in r||"$user_state"in o||(o[ve]=De),!_||("distinct_id"in u?u[d]:o[d])===h&&("$user_state"in u?u[ve]:o[ve])===p||(ms.forEach(e=>delete o[e]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[d]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[Z],delete o[X]),delete o.__alias)}n=Qi(o,u)}else n=Qi(r,o);return fs._set(e,n),n}catch(e){}return null},_set(i,s,r,n,o,a){var l=fs._set(i,s,void 0,void 0,a);try{var d=Ps(s,e);if(Object.keys(d).length){if(t){var u=bs(i),_=ks(d,e);if(gs._set(u,_,r,n,o,a),gs._get(u)!==JSON.stringify(_)){gs._remove(u,n);var c=Ps(s);return gs._set(i,c,r,n,o,a),l}}gs._set(i,d,r,n,o,a)}}catch(e){fs._error(e)}return l},_remove(e,t){try{null==Ve||Ve.localStorage.removeItem(e),gs._remove(e,t),gs._remove(bs(e),t)}catch(e){fs._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,n=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&fs._is_supported()?(t=fs,n=!0):"localstorage+cookie"===o&&s._is_supported()?(t=s,n=!0,r=!0):"sessionstorage"===o&&Fs._is_supported()?t=Fs:"memory"===o?t=Is:"cookie"===o&&gs._is_supported()?(t=gs,r=!0):s._is_supported()?(t=s,n=!0,r=!0):gs._is_supported()?(t=gs,r=!0):t=Is,this._splitStorageEligible=n,this._storesIdentityInCookie=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return Yi(this.props,(t,i)=>{var s=Ws(i);if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t))return;e[i]=t}}),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?fs._parse(this._name):null,s={};if(t)try{Yi(s=Ss(gs._parse(this._name)),(e,t)=>{(gt(e)||mt(e)||""===e)&&delete s[t]})}catch(e){}var r=this._storage._parse(this._name);if(r&&(this.props=Qi({},r)),this._splitStorage&&this._loadGroupEntries(),t&&r){var n,o,a=null==i?void 0:i[d],l=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",u=r[d],_=null!==(o=r.$user_state)&&void 0!==o?o:"anonymous";if(u!==a||_!==l){this._cookieIdentityChangePending=!0,Fs._set(ur(this._name),!0);var c=Qi({},this.props);ms.forEach(e=>delete c[e]),"anonymous"!==_||"identified"!==l&&"anonymous"!==s.$user_state&&(gt(a)||u===a)||(fr(c,s),delete c[X]),this.props=c;var h=new Set;ms.forEach(e=>{var t,i=null==(t=Ws(e))?void 0:t.storageGroup;i&&h.add(i)}),h.forEach(e=>{var t={};Yi(this.props,(i,s)=>{var r;(null==(r=Ws(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),pt(t)?(fs._remove(this._groupEntryName(e)),this._slotState[e]={}):fs._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Fs._get(ur(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of qs){var t=fs._parse(this._groupEntryName(e));if(t&&!pt(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Qi(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=Ws(t))?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){var i=lr[e];if(!i)return!1;var s=t[i],r=this.props[i];return bt(s)&&bt(r)&&r>s}refreshKey(e){var t;if(!(this._disabled||"$fbc_persistence"===e&&this._facebookClickIdChangePending)){var i=this._splitStorage?null==(t=Ws(e))?void 0:t.storageGroup:void 0,s=i?fs._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e],!1)}this._deleteProp(e,!1)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?gt(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}}flush(){gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||(this.syncCookieProperties(),this._facebookClickIdChangePending||this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshKey(g));var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&zi.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));var s=this._writeEntry(this._storage,this._name,this.props,cr);"written"===s&&this._rememberCurrentCookieProperties(this.props),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}}}_writeNowSplit(){var e=this,t=this._partitionProps(),i=t.main,s=t.groups,r=this._writeEntry(this._storage,this._name,i,cr);"written"===r&&this._rememberCurrentCookieProperties(i),"failed"!==r&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,hr.forEach(e=>{var t;null!=(t=Ws(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)}));var n=function(t){var i,r=s[t];if(pt(r)&&(null==(i=e._slotState[t])||!i.persisted))return hr.forEach(i=>{var s;(null==(s=Ws(i))?void 0:s.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(i)}),1;var n=e._writeEntry(fs,e._groupEntryName(t),r,t);"failed"!==n&&hr.forEach(i=>{var s=Ws(i);(null==s?void 0:s.storageGroup)!==t||"written"!==n&&s.volatile||e._pendingCrossTabFeatureFlagChanges.delete(i)})};for(var o of qs)if(n(o))continue}_partitionProps(){var e={},t={flags:{},surveys:{}};return Yi(this.props,(i,s)=>{var r,n=null==(r=Ws(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===cr)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Yi(e,(e,t)=>{var s;i[t]=null!=(s=Ws(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){var r,n=this._slotWriteState(s);if(s!==cr&&!n.dirty&&!gt(n.fingerprint))return"skipped";try{if((r=this._entryFingerprint(i,s))===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!==cr&&(n.persisted=!0),gt(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=fs._get(t)),"written"):(this._config.debug&&zi.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!i&&this._ownsSplitStorage)for(var s of qs)fs._remove(this._groupEntryName(s));i?delete this._slotState[cr]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ht(e)){this.syncCookieProperties(),gt(t)&&(t="None"),this._expire_days=gt(i)?this._default_expiry:i;var s=!1;if(Yi(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(ht(e)){this.syncCookieProperties(),this._expire_days=gt(t)?this._default_expiry:t;var i=!1;if(Yi(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||ht(t)||_t(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,i=!1;for(var s of t)s in this.props&&(this._deleteProp(s),i=!0);i&&this.save()}update_campaign_params(){var e=null==Ke?void 0:Ke.URL;if(e!==this._campaign_params_url){var t=function(e,t,i){if(!Ke)return{};var s,r=t?[...Js,...i||[]]:[],n=Zs(Ks(Ke.URL,r,Qs),e);return Qi((s={},Yi(Xs,function(e){var t=rs(e);s[e]=t||null}),s),n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!pt(Zi(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}}update_search_keyword(){var e;this.register((e=null==Ke?void 0:Ke.referrer)?er(e):{})}update_referrer_info(){var e;this.register_once({$referrer:sr(),$referring_domain:null!=Ke&&Ke.referrer&&(null==(e=js(Ke.referrer))?void 0:e.host)||ir},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var e=rr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[we]:this._storesIdentityInCookie?{r:_r(e.r),u:e.u?_r(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};Yi([be,ye],t=>{var i=this.props[t];i&&Yi(i,function(t,i){e["$initial_"+at(i)]=t})});var t=this.props[we];return t&&Qi(e,function(e,t){void 0===t&&(t=!1);var i=nr(e,t),s={};return Yi(i,function(e,t){s["$initial_"+at(t)]=e}),s}(t,this._config.disable_capture_url_hashes)),e}safe_merge(e){return Yi(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,s){var r=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=r||n,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!s,d=!!this._disabled&&!l;l||this._syncCookieProperties(t,d),this._config=e,!l&&(r||n||a)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(i({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),d));var u=o||a?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();var _=this._resolveSplitStorage(e),c=o||_!==this._splitStorage,h=!l&&(c||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(d);this._storageMigrationInProgress=c;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){var p=this.props;this.clear(),this._storage=u,this._splitStorage=_,this.props=p,this.save()}else a&&(this._storage=u,l||(delete this._slotState[cr],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[we];if(this._storesIdentityInCookie&&ht(e)&&"string"==typeof e.r){var t=_r(e.r),s="string"==typeof e.u?_r(e.u):e.u;t===e.r&&s===e.u||this._setProp(we,i({},e,{r:t,u:s}))}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props.__timers||{};i[e]=t,this._setProp(v,i),this.save()}remove_event_timer(e){var t=this.props.__timers||{},i=t[e];return gt(i)||(delete t[e],this._setProp(v,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){var s;void 0===i&&(i=!0);var r=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this._localIdentityChangePending=!0),"$fbc_persistence"!==e||gr(r,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,r,t),null!=(s=Ws(e))&&s.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(pr(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),"$fbc_persistence"===e&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,i=null==(t=Ws(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}},yr={GZipJS:"gzip-js",Base64:"base64"},br={Activation:"events",Cancellation:"cancelEvents"},wr={Button:"button",Tab:"tab",Selector:"selector"},Sr={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"},Pr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Er={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},kr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Cr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},xr={Once:"once",Recurring:"recurring",Always:"always"},Tr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ir={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"},$r={Popover:"popover",Inline:"inline"};function Fr(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&ct(i.then)&&i.then(void 0,()=>{})}}}}var Rr={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},Or={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"},Ar={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"},Mr=Ki("[RateLimiter]"),Dr=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Mr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Mr.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){var d=(bt(a.dropped)?a.dropped:0)+1;a.dropped=d,!this.lastEventRateLimited&&this._captureWarning(d)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(me,a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!_t(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=Je&&Je.pathname)return""+(null!==(e=Je.origin)&&void 0!==e?e:"")+Je.pathname}_captureWarning(e){var t,i,s=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,n=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(i=this.instance).get_session_id)?void 0:t.call(i):void 0,a=[e+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+r+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},Lr=Ki("[RemoteConfig]"),Nr=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=it._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=it.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=it.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return Lr.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Lr.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Lr.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){Lr.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Lr.warn("Failed to fetch remote config from PostHog."):Lr.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Lr.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)||i.ensureFlagsLoaded()}catch(e){Lr.error("Error loading feature flags",e)}}},Br=["fatal","error","warning","log","info","debug"],Ur=Uint8Array,qr=Uint16Array,Hr=Uint32Array,Gr=new Ur([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]),Wr=new Ur([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]),Vr=new Ur([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jr=function(e,t){for(var i=new qr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Hr(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},zr=jr(Gr,2),Kr=zr[1];zr[0][28]=258,Kr[258]=28;for(var Jr=jr(Wr,0)[1],Yr=new qr(32768),Qr=0;32768>Qr;++Qr){var Xr=(43690&Qr)>>>1|(21845&Qr)<<1;Yr[Qr]=((65280&(Xr=(61680&(Xr=(52428&Xr)>>>2|(13107&Xr)<<2))>>>4|(3855&Xr)<<4))>>>8|(255&Xr)<<8)>>>1}var Zr=function(e,t,i){for(var s=e.length,r=0,n=new qr(t);s>r;++r)++n[e[r]-1];var o,a=new qr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new qr(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var d=r<<4|e[r],u=t-e[r],_=a[e[r]-1]++<<u,c=_|(1<<u)-1;c>=_;++_)o[Yr[_]>>>l]=d}else for(o=new qr(s),r=0;s>r;++r)o[r]=Yr[a[e[r]-1]++]>>>15-e[r];return o},en=new Ur(288);for(Qr=0;144>Qr;++Qr)en[Qr]=8;for(Qr=144;256>Qr;++Qr)en[Qr]=9;for(Qr=256;280>Qr;++Qr)en[Qr]=7;for(Qr=280;288>Qr;++Qr)en[Qr]=8;var tn=new Ur(32);for(Qr=0;32>Qr;++Qr)tn[Qr]=5;var sn=Zr(en,9,0),rn=Zr(tn,5,0),nn=function(e){return(e/8|0)+(7&e&&1)},on=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof qr?qr:e instanceof Hr?Hr:Ur)(i-t);return s.set(e.subarray(t,i)),s},an=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},ln=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},dn=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new Ur(0),0];if(1==r){var o=new Ur(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],d=0,u=1,_=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[_].f>i[d].f?d++:_++],l=i[d!=u&&i[_].f>i[d].f?d++:_++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new qr(c+1),p=un(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new Ur(h),p]},un=function(e,t,i){return-1==e.s?Math.max(un(e.l,t,i+1),un(e.r,t,i+1)):t[e.s]=i},_n=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new qr(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},cn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},hn=function(e,t,i){var s=i.length,r=nn(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},pn=function(e,t,i,s,r,n,o,a,l,d,u){an(t,u++,i),++r[256];for(var _=dn(r,15),c=_[0],h=_[1],p=dn(n,15),g=p[0],v=p[1],f=_n(c),m=f[0],y=f[1],b=_n(g),w=b[0],S=b[1],P=new qr(19),E=0;m.length>E;++E)P[31&m[E]]++;for(E=0;w.length>E;++E)P[31&w[E]]++;for(var k=dn(P,7),C=k[0],x=k[1],T=19;T>4&&!C[Vr[T-1]];--T);var I,F,R,O,A=d+5<<3,M=cn(r,en)+cn(n,tn)+o,D=cn(r,c)+cn(n,g)+o+14+3*T+cn(P,C)+(2*P[16]+3*P[17]+7*P[18]);if(M>=A&&D>=A)return hn(t,u,e.subarray(l,l+d));if(an(t,u,1+(M>D)),u+=2,M>D){I=Zr(c,h,0),F=c,R=Zr(g,v,0),O=g;var L=Zr(C,x,0);for(an(t,u,y-257),an(t,u+5,S-1),an(t,u+10,T-4),u+=14,E=0;T>E;++E)an(t,u+3*E,C[Vr[E]]);u+=3*T;for(var N=[m,w],B=0;2>B;++B){var U=N[B];for(E=0;U.length>E;++E)an(t,u,L[q=31&U[E]]),u+=C[q],q>15&&(an(t,u,U[E]>>>5&127),u+=U[E]>>>12)}}else I=sn,F=en,R=rn,O=tn;for(E=0;a>E;++E)if(s[E]>255){var q;ln(t,u,I[257+(q=s[E]>>>18&31)]),u+=F[q+257],q>7&&(an(t,u,s[E]>>>23&31),u+=Gr[q]);var H=31&s[E];ln(t,u,R[H]),u+=O[H],H>3&&(ln(t,u,s[E]>>>5&8191),u+=Wr[H])}else ln(t,u,I[s[E]]),u+=F[s[E]];return ln(t,u,I[256]),u+F[256]},gn=new Hr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vn=new Ur(0),fn=function(){for(var e=new Hr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),mn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function yn(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=fn[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,d,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new Ur(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),d=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var _=u+65535;o>_?d=hn(l,d,e.subarray(u,_)):(l[u]=n,d=hn(l,d,e.subarray(u,o)))}else{for(var c=gn[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new qr(32768),f=new qr(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},w=new Hr(25e3),S=new qr(288),P=new qr(32),E=0,k=0,C=(u=0,0),x=0,T=0;o>u;++u){var I=b(u),F=32767&u,R=f[I];if(v[F]=R,f[I]=F,u>=x){var O=o-u;if((E>7e3||C>24576)&&O>423){d=pn(e,l,0,w,S,P,k,C,T,u-T,d),C=E=k=0,T=u;for(var A=0;286>A;++A)S[A]=0;for(A=0;30>A;++A)P[A]=0}var M=2,D=0,L=p,N=F-R&32767;if(O>2&&I==b(u-N))for(var B=Math.min(h,O)-1,U=Math.min(32767,u),q=Math.min(258,O);U>=N&&--L&&F!=R;){if(e[u+M]==e[u+M-N]){for(var H=0;q>H&&e[u+H]==e[u+H-N];++H);if(H>M){if(M=H,D=N,H>B)break;var G=Math.min(N,H-2),W=0;for(A=0;G>A;++A){var V=u-N+A+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,R=V)}}}N+=(F=R)-(R=v[F])+32768&32767}if(D){w[C++]=268435456|Kr[M]<<18|Jr[D];var z=31&Kr[M],K=31&Jr[D];k+=Gr[z]+Wr[K],++S[257+z],++P[K],x=u+M,++E}else w[C++]=e[u],++S[e[u]]}}d=pn(e,l,n,w,S,P,k,C,T,u-T,d),n||(d=hn(l,d,vn))}return on(a,0,s+nn(d)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!d)),_=u.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&&mn(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)}}(u,t),mn(u,_-8,i.d()),mn(u,_-4,s),u}var bn=!!Qe||!!Ye,wn="text/plain",Sn=!1,Pn=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},En=function(e,t,s){var r;void 0===s&&(s=!0);var n=e.split("?"),o=n[0],a=n[1],l=i({},t),d=null!==(r=null==a?void 0:a.split("&").map(e=>{var t,i=e.split("="),r=i[0],n=s&&null!==(t=l[r])&&void 0!==t?t:i[1];return delete l[r],r+"="+n}))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Yi(e,function(e,t){gt(e)||gt(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(l);return u&&d.push(u),d.length>0?o+"?"+d.join("&"):o},kn=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===yr.GZipJS){var s=yn(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Ur(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new Ur(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return on(i,0,s)}(Vs(t)),{mtime:0});return{contentType:wn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===yr.Base64){var r=(e=>"data="+encodeURIComponent("string"==typeof e?e:Vs(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(Vs(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}var n=Vs(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Cn=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:En(e.url,{compression:yr.Base64}),encodedBody:kn(i({},e,{compression:yr.Base64,_encodedBody:void 0}))}:{url:Pn(e.url,"compression"),encodedBody:kn(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=kn(e)}catch(t){if(qi(e.compression,zs(e.url,"compression")))return zi.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&qi(e.compression,zs(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?Ui(new Uint8Array(s)):ArrayBuffer.isView(s)&&Ui(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Sn=!0,r()):{url:e.url,encodedBody:t}},xn=e=>{try{return Cn(e)}catch(t){return zi.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},Tn=function(){var e=r(function*(e){var t=yield function(e,t,i){return Vi.apply(this,arguments)}(Vs(e.data),a.DEBUG,{rethrow:!0});if(!t)return e;var s=yield t.arrayBuffer();return i({},e,{_encodedBody:{contentType:wn,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}}(),In=/Failed to fetch|NetworkError|Load failed/i,$n=e=>"TypeError"===(null==e?void 0:e.name)&&In.test((null==e?void 0:e.message)||""),Fn=e=>{var t=xn(e);if(t){var i=new Qe,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,o=r.body;Yi(e.headers,function(e,t){i.setRequestHeader(t,e)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(o)}},Rn=e=>{var t=xn(e);if(t){var s=t.url,r=t.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,d=new Headers;Yi(e.headers,function(e,t){d.append(t,e)}),o&&d.append("Content-Type",o);var u=null,_=!1;if(Xe){var c=new Xe;u={signal:c.signal,timeout:setTimeout(()=>{var t;_=!0,c.abort(Mi("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))},e.timeout)}}var h=t=>{_&&"AbortError"===(null==t?void 0:t.name)||$n(t)?zi.warn(t):zi.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var p;Ye(s,i({method:(null==e?void 0:e.method)||"GET",headers:d,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(p=u)?void 0:p.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){zi.error(e)}null==e.callback||e.callback(s)})).catch(h).finally(()=>u?clearTimeout(u.timeout):null)}catch(e){u&&clearTimeout(u.timeout),h(e)}}},On=e=>{try{var t,s=Cn(e),r=s.url,n=s.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var d=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(ze.sendBeacon(r,d))return;var u=_t(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(_t(u)&&u.length>1&&(null!=l?l:0)>16384){var _=Math.ceil(u.length/2),c=t=>_t(e.data)?t:i({},e.data,{batch:t});return On(i({},e,{data:c(u.slice(0,_))})),void On(i({},e,{data:c(u.slice(_))}))}zi.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(Ye?"fetch":"XHR")),Ye?Rn(i({},e,{_keepaliveDisabled:!0})):Fn(e)}catch(e){zi.warn("Beacon send failed",e)}},An=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return En(s===yr.GZipJS?Pn(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===yr.GZipJS?{}:{compression:s}))},Mn=(()=>{var e=[];return Ye&&e.push({transport:"fetch",method:Rn}),Qe&&e.push({transport:"XHR",method:Fn}),null!=ze&&ze.sendBeacon&&e.push({transport:"sendBeacon",method:On}),e})(),Dn=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Ft((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,zi.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(i({},e,{transport:"sendBeacon"}))})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&_t(i.data)&&Yi(i.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e._sendRequestSafely(i)};for(var s in t)i()}},this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){zi.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Yi(this._queue,t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;gt(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)}),this._queue=[],e}},Ln=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!gt(Ve)&&"onLine"in Ve.navigator){if(this._areWeOnline=Ve.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ss(Ve,"online",this._onlineListener),ss(Ve,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e){var s=e.retriesPerformedSoFar,r=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,t);wt(s)&&(r.url=En(r.url,{retry_count:s})),this._instance._send_request(i({},r,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=s?s:0))return void this._enqueue(i({retriesPerformedSoFar:s},r));0===e.statusCode&&zi.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!=s?s:0)+" retries.")}null==r.callback||r.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=(Math.random()-.5)*(s-i);return Math.ceil(s+r)}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),zi.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,gt(Ve)||(this._onlineListener&&(Ve.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(Ve.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(e){zi.error(e)}}this._queue=[]}},Nn=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(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(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ss(Ve,"scroll",this._updateScrollData,{capture:!0}),ss(Ve,"scrollend",this._updateScrollData,{capture:!0}),ss(Ve,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==Ve||null==(e=Ve.document)?void 0:e.documentElement;for(var t of _t(this._scrollRoot)?this._scrollRoot:[this._scrollRoot]){var i,s=null==Ve||null==(i=Ve.document)?void 0:i.querySelector(t);if(s)return s}}_scrollPosition(e){var t,i,s="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[s]||0}return Ve?"y"===e?Ve.scrollY||Ve.pageYOffset||(null==(t=Ve.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:Ve.scrollX||Ve.pageXOffset||(null==(i=Ve.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}},Bn=e=>rr(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),Un=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[fe]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||Bn,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[fe]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?nr(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Yi(Zi(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+at(i)]=t}),e}},qn=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}constructor(){this._events={}}},Hn=Ki("[SessionId]"),Gn=864e5,Wn=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 qn,this._sessionHasBeenIdleTooLong=(e,t)=>!(!wt(e)||!wt(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||us,this._windowIdGenerator=i||us;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Ft(this._config.session_idle_timeout_seconds||1800,60,36e3,Hn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=Fs._parse(this._window_id_storage_key),o=Fs._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Fs._remove(this._window_id_storage_key),Fs._set(this._primary_window_exists_storage_key,!0)}null!=(s=this._config.bootstrap)&&s.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return gt(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&&Fs._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Fs._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Fs._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!mt(t)&&!mt(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[M]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return wt(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(M):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!mt(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[M]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=wt(e)?e:0,i=wt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[M];return _t(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var i=function(e,t){void 0===t&&(t=(new Date).getTime());try{var i=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void Hn.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void Hn.error("Invalid sessionID in bootstrap",e)}}(e);return!gt(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&&Ve&&(Ve.removeEventListener(Ue,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Fs._remove(this._primary_window_exists_storage_key)},ss(Ve,Ue,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===i&&(i=!1),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||(new Date).getTime(),r=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(mt(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=s}var a=this._getSessionId(),l=a[1],d=a[2],u=!gt(r)&&l!==r,_=this._freshestActivityTimestamp(),c=this._getWindowId(),h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>Gn),g=h?p:wt(d)&&Math.abs(s-d)>Gn,v=!1,f=u,m=!l||!!h,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(s,_);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(s))||Hn.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this._getSessionId();l=w[1],d=w[2]}if(m||b||g){f=!1;var S=h&&!p;l=S?h.sessionId:this._sessionIdGenerator(),c=this._windowIdGenerator(),Hn.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),d=S?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,v=!0}else c||(c=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(Hn.info("adopted cross-tab session id",{sessionId:l,windowId:c}),v=!0);var P=wt(_)&&e&&!g?_:s,E=wt(d)?d:(new Date).getTime();this._setWindowId(c),this._setSessionId(l,P,E),e||this._resetIdleTimer();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach(e=>e(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:E,changeReason:v?k:void 0,lastActivityTimestamp:_}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};function Vn(){return(Vn=r(function*(){var e=null==ze?void 0:ze.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t,i=null==(t=yield e.getHighEntropyValues(["model"]))?void 0:t.model;return vt(i)&&i.length>0?i:void 0}catch(e){return void zi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function jn(e,t){var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i}function zn(e,t,i){return Vs({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Kn,Jn="custom",Yn="i.posthog.com",Qn=/^\/static\//,Xn=["/s/","/e/","/i/"],Zn=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Yn,".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":Jn),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Qn.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=js(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;var s=i,r=this.instance.config.rewriteRequestPath;if(r){var n,o=(null==(n=js(i))?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&"api"===e&&Xn.some(e=>0===t.indexOf(e))){var a=this._urlKey(s);if(a){var l,d=this.apiHost,u=this._ingestionEndpoints;(null==(l=u)?void 0:l.apiHost)===d&&u.rewriteRequestPath===r||(this._ingestionEndpoints=u={apiHost:d,rewriteRequestPath:r,urls:new Set}),u.urls.add(a)}}return s}isIngestionEndpoint(e){var 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(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,""+i+t)}if(this.region===Jn)return this._prepareEndpoint(e,t,this.apiHost+t);var s=Yn+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+s);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+s)}}},eo=Ki("[Surveys]"),to={ignoreConditions:!1,ignoreDelay:!1,displayType:$r.Popover},io=Ki("[PostHog ExternalIntegrations]"),so={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},ro=class{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=it.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return io.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(){var t,s,r,n=i[0],o=i[1];!o||null!=(t=it.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(so[n],()=>{var t;null==(t=it.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(s=it.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=it.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())};for(var i of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t()}}},no=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return r(function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t._extensions.set(e.name,e);try{var i=e.setup(t._client);i&&(yield i)}catch(i){var 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){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&ct(t.then)&&t.then(void 0,t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)})}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}},oo=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var i={};for(var s of e){var r=null==t?void 0:t.get_property(s);gt(r)||(i[s]=r)}return i}set(e,t){var i;null==(i=this._instance.persistence)||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}},ao="extensionsRemoteConfig",lo=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=zi,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new oo(e),this.onEvent=e=>Fr(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 Fr(()=>{});var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(ao,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Fr(i)},this._runtime=new no(zi.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(u);return"string"==typeof e?e:void 0}get library(){return{name:a.LIB_NAME,version:a.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s,r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==r?void 0:r.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==r?void 0:r.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.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 r(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 Fr(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(ao,e))}sendRequest(e,t){var i=this;return r(function*(){var s;void 0===t&&(t={});var r=i.instance.requestRouter.endpointFor(null!==(s=t.target)&&void 0!==s?s:"api",e),n={method:t.method,url:t.query?En(r,t.query):r,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?st.Base64:void 0,timestampMode:t.sentAt};return"sendBeacon"===t.transport?(i.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,i.instance._send_request(n)})})()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}},uo={},_o=0,co=()=>{},ho='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',po="Surveys module not available",go="sanitize_properties is deprecated. Use before_send instead",vo="Invalid value for property_denylist config: ",fo=/^[A-Za-z0-9_-]{1,400}$/,mo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,yo=["token","distinct_id",Ee],bo="posthog",wo=!bn&&-1===(null==et?void 0:et.indexOf("MSIE"))&&-1===(null==et?void 0:et.indexOf("Mozilla")),So=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},Po=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:is(null==Ke?void 0:Ke.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:co,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Je&&vt(null==Je?void 0:Je.search)&&-1!==Je.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==Ve||null==(t=Ve.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){zi.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:Ne,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:co},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Os,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:So(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},Eo=[["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"]],ko=e=>{var t={};for(var i of Eo){var s=i[0],r=i[1];gt(e[s])||(t[r]=e[s])}var n=Qi({},t,e),o=e.__preview_external_dependency_versioned_paths;return gt(o)||(gt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),vt(o)&&gt(e.asset_host)&&(n.asset_host=o)),_t(e.property_blacklist)&&(gt(e.property_denylist)?n.property_denylist=e.property_blacklist:_t(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:zi.error(vo+e.property_denylist)),n},Co=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){zi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},xo=(e=class e{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(!(this._hasWarnedAboutVolatileIdentity||this.config.reuseAnonymousId||this.config.segment||this._inCookielessMode())){var e,t,i,s="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(s||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(s?(e="persistence is set to '"+this.config.persistence+"'",t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&"$posthog_cookieless"===this.get_distinct_id()){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){var i=this.config.get_device_id(us());this.register({distinct_id:i,$device_id:i}),e.set_property(ve,De)}this._sync_opt_out_with_persistence()}}}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new Co,this._personProcessingSetOncePropertiesSent=!1,this.version=a.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new qn,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Po(),this.SentryIntegration=Bs,this.sentryIntegration=e=>function(e,t){var i=Ns(e,t);return{name:Ls,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 Nn(this),this.pageViewManager=new Us(this),this.rateLimiter=new Dr(this),this.requestRouter=new Zn(this),this.consent=new Rs(this),this.externalIntegrations=new ro(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var s=vt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=vt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>zi.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,s){if(s&&s!==bo){var r,n=null!==(r=uo[s])&&void 0!==r?r:new e;return n._init(t,i,s),uo[s]=n,uo[bo][s]=n,n}return this._init(t,i,s)}_init(e,t,s){var r,n,o;void 0===t&&(t={});var l,d=vt(e)?e.trim():"";if(!d)return zi.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return d!==(null==(l=this.config)?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('"+d+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Po(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var u=Po(t.defaults),c=ko(t),h=Qi({},u,c,{name:s,token:d});ht(u.rageclick)&&ht(c.rageclick)&&(h.rageclick=Qi({},u.rageclick,c.rageclick)),ht(u.session_recording)&&ht(c.session_recording)&&(h.session_recording=Qi({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&zi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:yr.GZipJS;var p=this._is_persistence_disabled();if(this.persistence=new mr(this.config,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mr(i({},this.config,{persistence:"sessionStorage"}),p,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!p&&Fs._is_supported()){var g=Fs._parse(this._sessionRegisteredPropertiesStorageKey);_t(g)&&g.forEach(e=>{vt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Fs._remove(this._sessionRegisteredPropertiesStorageKey);var v=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Dn(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new Ln(this),this.__request_queue=[];var m=this._inCookielessMode();m||(this.sessionManager=new Wn(this),this.sessionPropsManager=new Un(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(zi.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(m)},0)):(zi.info("Initializing extensions synchronously"),this._initExtensions(m)),a.DEBUG=a.DEBUG||this.config.debug,a.DEBUG&&zi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:v,s:f}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var y=null==(n=t.bootstrap)?void 0:n.distinctID;if(this._hasStableInitialDistinctId=!!y&&!ft(y),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var b=t.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(ve);if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"anonymous"===S)this.identify(b);else if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"identified"===S)zi.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var P=this.config.get_device_id(us()),E=t.bootstrap.isIdentifiedID?P:b;this.persistence.set_property(ve,t.bootstrap.isIdentifiedID?Le:De),this.register({distinct_id:b,$device_id:E})}}if(m)this.register_once({distinct_id:Pe,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(us());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(ve,De)}return ss(Ve,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ss(Ve,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null==(e=this._retryQueue)||e.resume()}),t.segment?Ds(this,()=>this._loaded()):this._loaded(),ct(this.config._onCapture)&&this.config._onCapture!==co&&(zi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&zi.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 Vn.apply(this,arguments)}().then(e=>{e&&this.register({[_]:e})}).catch(co),this}_isSharedExtension(e){var t=e;return vt(t.name)&&ct(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>null==e.dispose?void 0:e.dispose()).catch(t=>{zi.error('Failed to dispose browser extension "'+e.name+'"',t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var t,i,s,r,n,o,a=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(s=e.__defaultExtensionClasses)?void 0:s.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this._featureFlagsReloadingUnsubscribe)||o.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new a(this)),ct(this.featureFlags.onReloading)&&ct(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null==(r=(n=this.featureFlags).initialize)||r.call(n))}_initExtensions(t){var s,r,n,o,a,l,d,u=performance.now(),_=i({},e.__defaultExtensionClasses,this.config.__extensionClasses),c=[];_.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new _.exceptions(this)),_.historyAutocapture&&this._extensions.push(this.historyAutocapture=new _.historyAutocapture(this)),_.tracingHeaders&&this._extensions.push(this.tracingHeaders=new _.tracingHeaders(this)),_.siteApps&&this._extensions.push(this.siteApps=new _.siteApps(this)),_.sessionRecording&&!t&&this._extensions.push(this.sessionRecording=new _.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),_.autocapture&&this._enrollExtension(this.autocapture=new _.autocapture(this),c),_.surveys&&this._enrollExtension(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new _.surveys(this),c),_.logs&&this._enrollExtension(this.logs=null!==(n=this.logs)&&void 0!==n?n:new _.logs(this),c),_.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new _.metrics(this)),_.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new _.conversations(this)),_.productTours&&this._extensions.push(this.productTours=new _.productTours(this)),_.heatmaps&&this._extensions.push(this.heatmaps=new _.heatmaps(this)),_.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new _.webVitalsAutocapture(this)),_.exceptionObserver&&this._extensions.push(this.exceptionObserver=new _.exceptionObserver(this)),_.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new _.deadClicksAutocapture(this,As)),_.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new _.toolbar(this)),_.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new _.experiments(this)),this._extensions.forEach(e=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this._processInitTaskQueue(c,u)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){zi.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[ke]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ce]:s}),this.config.__preview_deferred_init_extensions&&zi.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!Ke||!Ke.body)return zi.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,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=ot(s.supportedCompression,yr.GZipJS)?yr.GZipJS:ot(s.supportedCompression,yr.Base64)?yr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Ne}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}_loaded(){try{this.config.loaded(this)}catch(e){zi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=Je&&Je.hostname){var e=Je.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 Nr(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Ji(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,r;this._isPageUnloading=!0,null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(He),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(He,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?wo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(gt(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,s,r,n=i({},e);n.timeout=n.timeout||6e4;var o,a,l,d,u,_=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===_&&gt(n.compression)&&n.data&&(n.compression=yr.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(d=(_t(o=n.data)?o:[o]).map(e=>i({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:d,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),_t(e)?e.map(e=>i({},e,{sent_at:t})):i({},e,{sent_at:t})}(n.data))),n.url=An(n.url,n.method,n.compression,n.timestampMode);var c=Mn.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),h=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(t(e[i]))return e[i]}(c,e=>e.transport===_))?void 0:r.method)&&void 0!==s?s:c[0].method;if(!h)throw new Error("No available transport method");var p=e=>{try{h(e)}catch(e){$n(e)?zi.warn(e):zi.error(e),null==n.callback||n.callback({statusCode:0,error:e})}};"sendBeacon"!==_&&n.data&&n.compression===yr.GZipJS&&Ze&&"undefined"!=typeof Promise&&!Sn?Tn(n).then(e=>{p(e)}).catch(t=>{if(Hi(t))return Sn=!0,void p(i({},n,{compression:void 0,url:An(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Hi(e)||t===Bi})(t)&&(Sn=!0),p(n)}):h(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){_o++;try{var t,i=[],s=[],r=[];Ji(e,e=>{if(e)if(_t(t=e[0]))r.push(e);else if(ct(e))try{e.call(this)}catch(t){zi.error("Error executing queued PostHog call",e,t)}else _t(e)&&"alias"===t?i.push(e):_t(e)&&-1!==t.indexOf("capture")&&ct(this[t])?r.push(e):s.push(e)});var n=function(e,t){Ji(e,function(e){try{if(_t(e[0])){var i=t;Yi(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){zi.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{_o--}}push(t){if(_o>0&&_t(t)&&vt(t[0])){var i=e.prototype[t[0]];ct(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}_getPersistedFacebookClickId(){var e,t=null==(e=this.persistence)?void 0:e.get_property(g);return vt(t)&&mo.test(t)?{value:t,delivered:!1}:ht(t)&&vt(t.value)&&mo.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,i,s){if(this.persistence){this.persistence.refreshKey(g);var r=this._getPersistedFacebookClickId();if(!s){if(i)return vt(t)&&mo.test(t)?(t!==(null==r?void 0:r.value)&&this.persistence.register({[g]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==r?void 0:r.value)||!r.delivered}):void this.persistence.unregister(g);if(vt(e)&&fo.test(e)){if((null==r?void 0:r.value.split(".")[3])===e)return{value:r.value,pending:!r.delivered};var n="fb.1."+Date.now()+"."+e;return this.persistence.register({[g]:{value:n,delivered:!1}}),{value:n,pending:!0}}return r?{value:r.value,pending:!r.delivered}:void 0}this.persistence.unregister(g)}}_markFacebookClickIdDelivered(e){if(this.persistence){this.persistence.refreshKey(g);var t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[g]:{value:e,delivered:!0}})}}capture(e,t,s){var r,n,o,a,l,d,u,_,c,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!gt(e)&&vt(e)){this._healCookielessSentinelDistinctId();var g=!this.config.opt_out_useragent_filter&&this._is_bot();if(!g||this.config.__preview_capture_bot_pageviews){var v=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==v||!v.isRateLimited){var f;null!=t&&t.$current_url&&!vt(null==t?void 0:t.$current_url)&&(zi.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!=s&&s._originatedFromCaptureException||zi.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&&(f=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var m=new Date,y=(null==s?void 0:s.timestamp)||m,b=Ai(null==s?void 0:s.uuid,us),w={uuid:b,event:e,properties:this.calculateEventProperties(e,t||{},y,b)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&g&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),v&&(w.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);var S="$feature_flag_called"===e&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=s&&s.$set&&!S&&(w.$set=null==s?void 0:s.$set);var P=ht(null==t?void 0:t.$set)?t.$set:void 0,E=!(null==s||!s.$set)&&"$fbc"in s.$set,k=E||!!P&&"$fbc"in P,C=E?null==s||null==(r=s.$set)?void 0:r[p]:null==P?void 0:P[p],x=_t(null==t?void 0:t.$unset)?t.$unset:[],T=(null==s?void 0:s.$unset)||[],I=-1!==x.indexOf("$fbc")||-1!==T.indexOf("$fbc"),F=this._updateFacebookClickId(null==(n=f)?void 0:n.fbclid,C,k,I);F&&!0===w.properties.$process_person_profile&&F.pending&&!k&&!S&&(w.$set=i({[p]:F.value},w.$set));var R=null==s?void 0:s.$unset;R&&(w.$unset=R);var O=S?void 0:this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==We,e===Ge);if(O&&(w.$set_once=O),null!=s&&s._noTruncate||(u=this.config.properties_string_max_length,_=w,c=e=>vt(e)?e.slice(0,u):e,h=new Set,w=function e(t,i){if(t!==Object(t))return c?c(t):t;if(!h.has(t)){var s;if(h.add(t),_t(t))s=[],Ji(t,t=>{s.push(e(t))});else{var r={};Yi(kt(t)?es(t):t,(t,i)=>{h.has(t)||(r[i]=e(t,i))}),s=r}return s}}(_)),w.timestamp=y,gt(null==s?void 0:s.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),S&&(w.properties=function(e,t){void 0===t&&(t=[]);var i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return Ni.forEach(s),t.forEach(s),i}(w.properties,yo)),e===Tr.DISMISSED||e===Tr.SENT){var A=null==t?void 0:t[Ir.SURVEY_ID],M=null==t?void 0:t[Ir.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>"seenSurvey_"+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t))(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){eo.error("Failed to persist survey seen state",e)}})({id:A,current_iteration:M}),w.$set=i({},w.$set,{[jn({id:A,current_iteration:M},e===Tr.SENT?"responded":"dismissed")]:!0})}else e===Tr.SHOWN&&(w.$set=i({},w.$set,{[Ir.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Or.SHOWN){var D=null==t?void 0:t[Ar.TOUR_TYPE];D&&(w.$set=i({},w.$set,{[Ar.TOUR_LAST_SEEN_DATE+"/"+D]:(new Date).toISOString()}))}var L=i({},w.properties.$set,w.$set);if(pt(L)||this.setPersonPropertiesForFlags(L),!yt(this.config.before_send)){var N=this._runBeforeSend(w);if(!N)return;(w=N).uuid=Ai(w.uuid,us)}var B=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:ht(null==(l=w.properties)?void 0:l.$set)?w.properties.$set.$fbc:void 0,U=null!=F&&F.pending&&B===F.value?F.value:void 0;this._internalEventEmitter.emit("eventCaptured",w);var q,H=null!==(d=null==s?void 0:s._url)&&void 0!==d?d:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=i({method:"POST",url:H,data:w,compression:"best-available",timestampMode:"recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(H)?"body":"capture-body",batchKey:null==s?void 0:s._batchKey},null!=s&&s.transport?{transport:s.transport}:{},U?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markFacebookClickIdDelivered(U)}}:{});return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly||U?(!G.transport&&!G.callback&&pt(null!==(q=this.config.request_headers)&&void 0!==q?q:{})&&this._isPageUnloading&&(G.transport="sendBeacon"),this._send_retriable_request(G)):this._requestQueue.enqueue(G),w}zi.critical("This capture call is ignored due to client rate limiting.")}}else zi.error("No event name provided to posthog.capture")}else zi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new lo(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}}_processCookieIdentityChange(e){var t,i,s;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(s=this.sessionPersistence)||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var a=n?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l[Ee]=!0),"$snapshot"===e){var d=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=d.distinct_id,(!vt(l.distinct_id)&&!bt(l.distinct_id)||ft(l.distinct_id))&&zi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,_=function(e,t,i,s){var r,n,a,l;if(void 0===s&&(s=!1),!et)return{};var d,u=e?[...Js,...t||[]]:[],_=function(e){for(var t=0;Ii.length>t;t++){var i=Ii[t],s=i[1],r=i[0].exec(e),n=r&&(ct(s)?s(r,e):s);if(n)return n}return["",""]}(et),c=_[0],h=_[1],p=function(e){for(var t=0;Ri.length>t;t++){var i,s=Ri[t],r=s[1],n=s[2],o=e.match(s[0]);if(o)return[r,(null==(i=n&&e.match(n)||o)?void 0:i[1])||""]}return["",""]}(et),g=p[0],v=p[1],f=null!=(d="u">typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};gt(i)||(m.detectGoogleSearchApp=i);var y={},b=null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,w=null==(n=navigator)?void 0:n.maxTouchPoints,S=null==Ve||null==(a=Ve.screen)?void 0:a.width,P=null==Ve||null==(l=Ve.screen)?void 0:l.height,E=null==Ve?void 0:Ve.devicePixelRatio;gt(b)||(y.userAgentDataPlatform=b),gt(w)||(y.maxTouchPoints=w),gt(S)||(y.screenWidth=S),gt(P)||(y.screenHeight=P),gt(E)||(y.devicePixelRatio=E);var k,C,x,T,I,F,R,O,A=Qi(Zi({$os:c,$os_version:h,$browser:Ci(et,navigator.vendor,f,m),$webview_app:g,$webview_app_version:v,$device:$i(et),$device_type:(C=et,x=y,O=$i(C),O===Dt||O===Mt||"Kobo"===O||"Kindle Fire"===O||O===ni?At:O===Jt||O===Qt||O===Yt||O===si?"Console":O===Lt?"Wearable":O?Rt:"Android"===(null==x?void 0:x.userAgentDataPlatform)&&(null!==(T=null==x?void 0:x.maxTouchPoints)&&void 0!==T?T:0)>0?600>Math.min(null!==(I=null==x?void 0:x.screenWidth)&&void 0!==I?I:0,null!==(F=null==x?void 0:x.screenHeight)&&void 0!==F?F:0)/(null!==(R=null==x?void 0:x.devicePixelRatio)&&void 0!==R?R:1)?Rt:At:"Desktop"),$timezone:or(),$timezone_offset:ar()}),{$current_url:Ks(s?Di(null==Je?void 0:Je.href):null==Je?void 0:Je.href,u,Qs),$host:null==Je?void 0:Je.host,$pathname:null==Je?void 0:Je.pathname,$raw_user_agent:et.length>1e3?et.substring(0,997)+"...":et,$browser_version:Ti(et,navigator.vendor,f,m),$browser_language:tr(),$browser_language_prefix:(k=tr(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==Ve?void 0:Ve.screen.height,$screen_width:null==Ve?void 0:Ve.screen.width,$viewport_height:null==Ve?void 0:Ve.innerHeight,$viewport_width:null==Ve?void 0:Ve.innerWidth,$lib:o.LIB_NAME,$lib_version:o.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return o.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=o.SDK_DIST_CHANNEL),A}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0),h=c.windowId;l.$session_id=c.sessionId,l.$window_id=h}this.sessionPropsManager&&Qi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Qi(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Jn&&(l.$lib_custom_api_host=this.config.api_host),u="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=Qi(l,u),"$pageview"===e&&Ke&&(l.title=Ke.title),!gt(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}et&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var v=this.persistence.properties(),f=this.sessionPersistence.properties(),m=l.$groups,y=v.$groups;ht(m)&&!pt(m)&&(l.$groups=i({},ht(y)?y:{},m)),Yi(["$referrer","$referring_domain"],e=>{e in v&&delete f[e]});var b={};if(this._extensionEventPropertyProducers.length>0)for(var w of this._extensionEventPropertyProducers.slice())try{Qi(b,w())}catch(e){zi.error("Failed to produce browser extension event properties",e)}(l=Qi({},_,v,f,i({},b,l))).$is_identified=this._isIdentified(),_t(this.config.property_denylist)?Yi(this.config.property_denylist,function(e){delete l[e]}):zi.error(vo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(zi.error(go),l=S(l,e));var P=this._hasPersonProcessing();return l.$process_person_profile=P,P&&!n&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=Qi({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(zi.error(go),r=n(r,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),pt(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t,i;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(i=this.sessionPersistence)||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!Fs._is_supported())Fs._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Fs._set(this._sessionRegisteredPropertiesStorageKey,t):Fs._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?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:po}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:po})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:po})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=to),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:po}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:po})}_validateIdentifyId(e){return!e||ft(e)?(zi.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(zi.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())||(zi.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 zi.uninitializedWarning("posthog.identify");if(bt(e)&&(e=e.toString(),zi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._healCookielessSentinelDistinctId();var s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(c),this.register({distinct_id:e}));var d=(this.persistence.get_property("$user_state")||"anonymous")===De,u=e!==l,_=!u&&d;if(u&&d){var h,p=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(ve,Le),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(Ge,p,{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=zn(e,t,i),null==(h=this.featureFlags)||h.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(_){this.persistence.set_property(ve,Le);var g=t||{},v=i||{};this.setPersonPropertiesForFlags({$set:g,$set_once:v},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:g,$set_once:v}),this._cachedPersonProperties=zn(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);u||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ce)):_&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=zn(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):zi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(_t(e)?e:[e]).filter(e=>vt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){var r;if(e&&t){null==(r=this.persistence)||r.syncCookieProperties(),this._processCookieIdentityChange();var n=this.getGroups(),o=n[e]!==t;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},n,{[e]:t})}),(o||s)&&this._hasPersonProcessing()){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(We,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),o&&!s&&this.reloadFeatureFlags()}else zi.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=St(e)?e:null==e?void 0:e.resetDeviceID,i=St(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t,s){var r,n,o,a;if(void 0===t&&(t=!1),zi.info("reset"),!this.__loaded)return zi.uninitializedWarning("posthog.reset");var l=null==s?void 0:s.sessionID;this.config.bootstrap=s||(null==(r=this._originalUserConfig)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var d=this.get_property(u),c=this.get_property(_),h=this.get_property(x);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var 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.");var g=null==(a=this.persistence)||null==a._beginCookieSyncSuppression?void 0:a._beginCookieSyncSuppression(),v=!1;try{var f,m,y,b,w,S,P,E,k,C,T,I,F;if(null==(f=this.persistence)||f.clear(),null==(m=this.sessionPersistence)||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),gt(h)||null==(y=this.persistence)||y.register({[x]:h}),null==(b=this.surveys)||b.reset(),null==(w=this.featureFlags)||w.reset(),null==(S=this.conversations)||S.reset(),null==(P=this.logs)||P.reset(),null==(E=this.metrics)||E.reset(),null==(k=this.persistence)||k.set_property(ve,De),null==(C=this.sessionManager)||C.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pe,$device_id:null},"");else{var R=this.config.get_device_id(us());this.register_once({distinct_id:R,$device_id:e?R:d},""),e||gt(c)||this.register({[_]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),s)if(void 0===s.distinctID||this._inCookielessMode()||(null==(F=this.persistence)||F.set_property(ve,s.isIdentifiedID?Le:De),this.register({distinct_id:s.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(gt(l)||null!=(I=this.sessionManager)&&I.setBootstrapSessionId(l,!0))){var O=i({},s);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var A;g&&(null==(A=this.persistence)||null==A._endCookieSyncSuppression||A._endCookieSyncSuppression(v))}this.reloadFeatureFlags()}shutdown(e){var t=this;return r(function*(){var e,i,s,r,n,o,a;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(i=t.logs)||i.flushLogs("sendBeacon"),null==(s=t.metrics)||s.flush("sendBeacon"),null==(r=t._requestQueue)||r.unload(),null==(n=t._retryQueue)||n.unload();try{var l;null==(l=t.featureFlags)||l.destroy()}catch(e){zi.error("Error while destroying feature flags",e)}null==(o=t.persistence)||o.destroy(),null==(a=t.sessionPersistence)||a.destroy()}else zi.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)||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)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(zi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(gt(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(c,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(zi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(ht(e)){var s,r,n,o,l,d,u,_,c,h,p,g,v;Qi(this.config,ko(e));var f=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mr(i({},this.config,{persistence:"sessionStorage"}),f,!1);var m=this._checkLocalStorageForDebug(this.config.debug);St(m)&&(this.config.debug=m),St(this.config.debug)&&(this.config.debug?(a.DEBUG=!0,fs._is_supported()&&fs._set("ph_debug",!0),zi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(a.DEBUG=!1,fs._is_supported()&&fs._remove("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(d=this.tracingHeaders)||d.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(_=this.heatmaps)||_.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(c=this.historyAutocapture)||c.startIfEnabledOrStop()),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(p=this.deadClicksAutocapture)||p.startIfEnabledOrStop(),null==(g=this.surveys)||g.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(v=this.externalIntegrations)||v.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Ds(this,co,!1)}}_overrideSDKInfo(e,t){a.LIB_NAME=e,a.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){try{if(!this.exceptions)return;var s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},s,t))}catch(e){return}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:e._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:bo;return t!==bo&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&pt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e.__alias)&&(null==(t=this.persistence)||null==(t=t.props)||!t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(zi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Se,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t,i,s,r,n=this._is_persistence_disabled();return this.is_capturing()||null==(e=this.logs)||e._onOptOut(),(null==(t=this.persistence)?void 0:t._disabled)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(s=this.sessionPersistence)?void 0:s._disabled)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(t){var i,s,r;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var n,o,a,l,d,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Wn(this),this.pageViewManager=new Us(this),this.persistence&&(this.sessionPropsManager=new Un(this,this.sessionManager,this.persistence));var _,c=null!==(l=null==(d=this.config.__extensionClasses)?void 0:d.sessionRecording)&&void 0!==l?l:null==(u=e.__defaultExtensionClasses)?void 0:u.sessionRecording;c&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new c(this)),this._lastRemoteConfig&&(null==(_=this.sessionRecording)||null==_.onRemoteConfig||_.onRemoteConfig(this._lastRemoteConfig)))}this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(s=this.surveys)||s.loadIfEnabled()),(gt(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(r=null==t?void 0:t.captureEventName)&&void 0!==r?r:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else zi.warn(ho)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var e,t,i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.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:Pe,$device_id:null}),this._removeExtension(i),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}else zi.warn(ho)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return ze?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&$t(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>$t(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}(ze,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Ke&&("visible"===Ke.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(qe,{title:Ke.title},{send_instantly:!0}),this._visibilityStateListener&&(Ke.removeEventListener(Be,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ss(Ke,Be,this._visibilityStateListener)))}debug(e){!1===e?(null==Ve||Ve.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Ve||Ve.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(zi.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,r){var n=t in e&&!yt(e[t]),o=i in e&&!yt(e[i]);return n?e[t]:!!o&&(r&&r.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,zi)}_runBeforeSend(e){var t;if(yt(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Et),s=_t(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s)try{if(r=n(r),yt(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Pt(e.event)?zi.warn(o+". This can cause unexpected behavior."):zi.info(o),null}r.properties&&!pt(r.properties)||zi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return zi.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of i)if(r.properties&&yt(r.properties[a]))return zi.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=St(e)&&!e,i=fs._is_supported()&&"true"===fs._get("ph_debug");return!t&&(!!i||e)}},e.__defaultExtensionClasses={},e._noopLogger={trace:Kn=()=>{},debug:Kn,info:Kn,warn:Kn,error:Kn,fatal:Kn},e);!function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Xi(e.prototype[t[i]])}(xo,["identify"]);var To=function(){a.SDK_DIST_CHANNEL="npm";var e=uo[bo]=new xo;return function(){function e(){e.done||(e.done=!0,wo=!1,Yi(uo,function(e){e._dom_loaded()}))}null!=Ke&&Ke.addEventListener?"complete"===Ke.readyState?e():ss(Ke,"DOMContentLoaded",e,{capture:!1}):Ve&&zi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{yr as Compression,Rr as DEFAULT_PRODUCT_TOUR_APPEARANCE,$r as DisplaySurveyType,xo as PostHog,Or as ProductTourEventName,Ar as ProductTourEventProperties,Tr as SurveyEventName,Ir as SurveyEventProperties,br as SurveyEventType,Sr as SurveyPosition,Cr as SurveyQuestionBranchingType,kr as SurveyQuestionType,xr as SurveySchedule,Pr as SurveyTabPosition,Er as SurveyType,wr as SurveyWidgetType,To as default,To as posthog,Br as severityLevels};
1
+ var e,t=["retriesPerformedSoFar"];function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},i.apply(null,arguments)}function s(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function r(e){return function(){var t=this,i=arguments;return new Promise(function(r,n){var o=e.apply(t,i);function a(e){s(o,r,n,a,l,"next",e)}function l(e){s(o,r,n,a,l,"throw",e)}a(void 0)})}}var n="0.8.2",o={DEBUG:(!1,!1),LIB_VERSION:(n,"1.429.3"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:n},a=o,l="$people_distinct_id",d="distinct_id",u="$device_id",_="$device_model",c="__alias",h="__cmpns",p="$fbc",g="$fbc_persistence",v="__timers",f="$autocapture_disabled_server_side",m="$heatmaps_enabled_server_side",y="$exception_capture_enabled_server_side",b="$error_tracking_suppression_rules",w="$error_tracking_capture_extension_exceptions",S="$web_vitals_enabled_server_side",P="$dead_clicks_enabled_server_side",E="$product_tours_enabled_server_side",k="$logs_capture_enabled_server_side",C="$web_vitals_allowed_metrics",x="$session_recording_remote_config",T="$session_recording_enabled_server_side",I="$replay_sample_rate",F="$replay_override_sampling",R="$replay_override_linked_flag",O="$replay_override_url_trigger",A="$replay_override_event_trigger",M="$sesid",D="$session_is_sampled",L="$session_past_minimum_duration",N="$session_recording_url_trigger_activated_session",B="$session_recording_event_trigger_activated_session",U="$debug_first_full_snapshot_timestamp",q="$sess_rec_flush_size",H="$enabled_feature_flags",G="$active_feature_flags",W="$early_access_features",V="$feature_flag_details",j="$feature_flag_payloads",z="$feature_flag_request_id",K="$minimal_flag_called_events",J="$override_feature_flags",Y="$override_feature_flag_payloads",Q="$stored_person_properties",X="$stored_group_properties",Z="$groups",ee="$surveys",te="$surveys_loaded_at",ie="$surveys_activated",se="$surveys_activated_session",re="$surveys_activated_timestamps",ne="ph_product_tours",oe="$product_tours_activated",ae="$product_tours_activated_session",le="$conversations_widget_session_id",de="$conversations_ticket_id",ue="$conversations_widget_state",_e="$conversations_user_traits",ce="$flag_call_reported",he="$flag_call_reported_session_id",pe="$feature_flag_errors",ge="$feature_flag_evaluated_at",ve="$user_state",fe="$client_session_props",me="$capture_rate_limit",ye="$initial_campaign_params",be="$initial_referrer_info",we="$initial_person_info",Se="$epp",Pe="$posthog_cookieless",Ee="$cookieless_mode",ke="$sdk_debug_extensions_init_method",Ce="$sdk_debug_extensions_init_time_ms",xe="$sdk_debug_recording_script_not_loaded",Te="$sdk_debug_replay_event_trigger_status",Ie="$sdk_debug_replay_linked_flag_trigger_status",$e="$sdk_debug_replay_matched_recording_trigger_groups",Fe="$sdk_debug_replay_pending_trigger_conditions",Re="$sdk_debug_replay_remote_trigger_matching_config",Oe="$sdk_debug_replay_trigger_groups_count",Ae="$sdk_debug_replay_url_trigger_status",Me="$session_recording_start_reason",De="anonymous",Le="identified",Ne="identified_only",Be="visibilitychange",Ue="beforeunload",qe="$pageview",He="$pageleave",Ge="$identify",We="$groupidentify",Ve="u">typeof window?window:void 0,je="u">typeof globalThis?globalThis:Ve,ze=null==je?void 0:je.navigator,Ke=null==je?void 0:je.document,Je=null==je?void 0:je.location,Ye=null==je?void 0:je.fetch,Qe=null!=je&&je.XMLHttpRequest&&"withCredentials"in new je.XMLHttpRequest?je.XMLHttpRequest:void 0,Xe=null==je?void 0:je.AbortController,Ze=null==je?void 0:je.CompressionStream,et=null==ze?void 0:ze.userAgent,tt="undefined"!=typeof globalThis?globalThis:Ve;tt&&"undefined"==typeof self&&(tt.self=tt),tt&&"undefined"==typeof File&&(tt.File=function(){});var it=null!=Ve?Ve:{},st=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),rt=["$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"],nt=["token"];function ot(e,t){return-1!==e.indexOf(t)}var at=function(e){return e.replace(/^\$/,"")},lt=Object.prototype,dt=lt.hasOwnProperty,ut=lt.toString,_t=Array.isArray||function(e){return"[object Array]"===ut.call(e)},ct=e=>"function"==typeof e,ht=e=>e===Object(e)&&!_t(e),pt=e=>{if(ht(e)){for(var t in e)if(dt.call(e,t))return!1;return!0}return!1},gt=e=>void 0===e,vt=e=>"[object String]"==ut.call(e),ft=e=>vt(e)&&0===e.trim().length,mt=e=>null===e,yt=e=>gt(e)||mt(e),bt=e=>"[object Number]"==ut.call(e)&&e==e,wt=e=>bt(e)&&e>0,St=e=>"[object Boolean]"===ut.call(e),Pt=e=>ot(rt,e),Et=e=>ot(nt,e);function kt(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 function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Error)}}var Ct=[!0,"true",1,"1","yes"],xt=e=>ot(Ct,e),Tt=[!1,"false",0,"0","no"],It=["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"],$t=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return It.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function Ft(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),bt(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: "+r),Ft(null!=r?r:i,t,i,s))}var Rt="Mobile",Ot="Android",At="Tablet",Mt="Android Tablet",Dt="iPad",Lt="Apple Watch",Nt="Safari",Bt="BlackBerry",Ut="Samsung Internet",qt="Chrome",Ht="Chrome iOS",Gt="Internet Explorer",Wt="Internet Explorer Mobile",Vt="Opera",jt="Microsoft Edge",zt="Firefox",Kt="Firefox iOS",Jt="Nintendo",Yt="PlayStation",Qt="Xbox",Xt="Android Mobile",Zt="Mobile Safari",ei="Windows",ti="Windows Phone",ii="Nokia",si="Ouya",ri="Generic "+Rt.toLowerCase(),ni="Generic "+At.toLowerCase(),oi="Konqueror",ai="Oculus Browser",li="Vivaldi",di="Yandex",ui="Whale",_i="DuckDuckGo",ci="Pale Moon",hi="Waterfox",pi="Brave",gi="Claude",vi="Codex",fi="ChatGPT",mi="Google Search App",yi=new RegExp("Version/(\\d+(\\.\\d+)?)"),bi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),wi=new RegExp(Qt,"i"),Si=new RegExp("PlayStation \\w+","i"),Pi=new RegExp("Nintendo \\w+","i"),Ei=new RegExp("BlackBerry|PlayBook|BB10","i"),ki={"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"},Ci=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?pi:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&ot(e,"GSA/")?mi:ot(e," OPR/")&&ot(e,"Mini")?"Opera Mini":ot(e," OPR/")?Vt:Ei.test(e)?Bt:ot(e,"IEMobile")||ot(e,"WPDesktop")?Wt:ot(e,"OculusBrowser")?ai:ot(e,"SamsungBrowser")?Ut:ot(e,"Edge")||ot(e,"Edg/")?jt:ot(e,"Vivaldi/")?li:ot(e,"YaBrowser/")?di:ot(e,"Whale/")?ui:ot(e,"DuckDuckGo/")||ot(e,"Ddg/")?_i:ot(e,"Claude/")?gi:ot(e,"Codex/")?vi:ot(e,"ChatGPT/")?fi:ot(e,"FBIOS")?"Facebook Mobile":ot(e,"UCWEB")||ot(e,"UCBrowser")?"UC Browser":ot(e,"CriOS")?Ht:ot(e,"CrMo")||ot(e,qt)?qt:ot(e,Ot)&&ot(e,Nt)?Xt:ot(e,"FxiOS")?Kt:ot(e.toLowerCase(),oi.toLowerCase())?oi:ot(e,"Brave/")?pi:((e,t)=>t&&ot(t,"Apple")||function(e){return ot(e,Nt)&&!ot(e,qt)&&!ot(e,Ot)}(e))(e,t)?ot(e,Rt)?Zt:Nt:ot(e,"PaleMoon/")?ci:ot(e,"Waterfox/")?hi:ot(e,zt)?zt:ot(e,"MSIE")||ot(e,"Trident/")?Gt:ot(e,"Gecko")?zt:"")},xi={[Wt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[jt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[qt]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Ht]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Nt]:[yi],[Zt]:[yi],[Vt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Kt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Bt]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),yi],[Xt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ut]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[ui]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[pi]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[gi]:[bi],[vi]:[bi],[fi]:[bi],[_i]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[hi]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[mi]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Gt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Ti=function(e,t,i,s){var r=xi[Ci(e,t,i,s)];if(gt(r))return null;for(var n=0;r.length>n;n++){var o=e.match(r[n]);if(o)return parseFloat(o[o.length-2])}return null},Ii=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Qt,e&&e[1]||""]],[new RegExp(Jt,"i"),[Jt,""]],[new RegExp(Yt,"i"),[Yt,""]],[Ei,[Bt,""]],[new RegExp(ei,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ti,""];if(new RegExp(Rt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=ki[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ei,s]}return[ei,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=gt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Ot,[e[2],e[3],e[4]||"0"].join(".")]:[Ot,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],$i=function(e){return Pi.test(e)?Jt:Si.test(e)?Yt:wi.test(e)?Qt:new RegExp(si,"i").test(e)?si:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?ti:/iPad/.test(e)?Dt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Lt:Ei.test(e)?Bt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ii,"i").test(e)?ii:/(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(Rt).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)?Ot:Mt:new RegExp("(pda|Mobile)","i").test(e)?ri:new RegExp(At,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?ni:""},Fi=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ri=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Fi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Fi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Fi],[/\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"]],Oi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ai(e,t){return"string"==typeof(i=e)&&Oi.test(i)?e:t();var i}function Mi(e,t){var i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function Di(e){return e?e.split("#")[0]:e}var Li,Ni=["$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"],Bi="NativeGzipValidationError",Ui=e=>e.length>=2&&31===e[0]&&139===e[1],qi=(e,t)=>e===st.GZipJS||t===st.GZipJS||"gzip"===t,Hi=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Gi=e=>{throw Mi(Bi,"Native gzip produced invalid output: "+e)},Wi=function(){var e=r(function*(e,t){18>e.size&&Gi("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());Ui(i)&&8===i[2]||Gi("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Li)return Li;Li=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;Li[e]=t>>>0}return Li})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&Gi("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&Gi("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function Vi(){return Vi=r(function*(e,t,i){void 0===t&&(t=!0);try{var s=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then(()=>o.close()).catch(function(){var e=r(function*(e){try{yield o.abort(e)}catch(e){}throw e});return function(t){return e.apply(this,arguments)}}()),l=new Response(n.readable).blob(),d=(yield Promise.all([l,a]))[0];return yield Wi(d,s),d}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}}),Vi.apply(this,arguments)}var ji=function(e,t){var i=(void 0===t?{}:t).debugEnabled,s={_log(t){for(var s=arguments.length,r=new Array(s>1?s-1:0),n=1;s>n;n++)r[n-1]=arguments[n];Ve&&(o.DEBUG||Ve.POSTHOG_DEBUG||i)&&!gt(Ve.console)&&Ve.console&&("__rrweb_original__"in Ve.console[t]?Ve.console[t].__rrweb_original__:Ve.console[t])(e,...r)},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ji(e+" "+t,i)};return s},zi=ji("[PostHog.js]"),Ki=zi.createLogger;function Ji(e,t){_t(e)&&e.forEach(t)}function Yi(e,t){if(!yt(e))if(_t(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,i)=>t(e,i));else for(var i in e)dt.call(e,i)&&t(e[i],i)}var Qi=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e},Xi=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){zi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),zi.critical(e)}}},Zi=function(e){var t={};return Yi(e,function(e,i){(vt(e)&&e.length>0||bt(e))&&(t[i]=e)}),t};function es(e){var t=i({},e);for(var s of["name","message","stack","cause","errors"])try{s in e&&(t[s]=e[s])}catch(e){}return t}var ts=["herokuapp.com","vercel.app","netlify.app"];function is(e){var t=null==e?void 0:e.hostname;if(!vt(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of ts)if(i===s)return!1;return!0}function ss(e,t,i,s){var r=null!=s?s:{},n=r.capture,o=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===o||o})}var rs=e=>{if(Ke){try{for(var t=e+"=",i=Ke.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.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 bt(e)&&isFinite(e)&&Math.floor(e)===e});var ns=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}},os=class{generate(){var e=this.generateOrAbort();if(!gt(e))return e;this._timestamp=0;var t=this.generateOrAbort();if(gt(t))throw new Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e,t=(e=Date.now(),bt(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0);if(t>this._timestamp)this._timestamp=t,this._resetCounter();else{if(this._timestamp>=t+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return ns.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 ds}},as=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Ve&&!gt(Ve.crypto)&&crypto.getRandomValues&&(as=e=>crypto.getRandomValues(e));var ls,ds=class{nextUint32(){return this._buffer.length>this._cursor||(as(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}},us=()=>_s().toString(),_s=()=>(ls||(ls=new os)).generate(),cs="",hs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ps=null,gs={_is_supported(){if(!mt(ps))return ps;if(ps=!1,Ke)try{var e="__ph_cookie_support_"+us();gs._set(e,"xyz"),ps='"xyz"'===rs(e),gs._remove(e)}catch(e){ps=!1}return ps},_error(e){zi.error("cookieStore error: "+e)},_get:rs,_parse(e){var t;try{t=JSON.parse(gs._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!Ke)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=Ke),cs)return cs;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+us();!cs&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",cs=n)}return cs}(e);if(!i){var s=(e=>{var t=e.match(hs);return t?t[0]:""})(e);s!==i&&zi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(Ke.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return d.length>3686.4&&zi.warn("cookieStore warning: large cookie, len="+d.length),Ke.cookie=d,!0}catch(e){return!1}},_remove(e,t){if(null!=Ke&&Ke.cookie)try{gs._set(e,"",-1,t)}catch(e){return}}},vs=null,fs={_is_supported(){if(!mt(vs))return vs;var e=!0;if(gt(Ve))e=!1;else try{var t="__mplssupport__";fs._set(t,"xyz"),'"xyz"'!==fs._get(t)&&(e=!1),fs._remove(t)}catch(t){e=!1}return e||zi.error("localStorage unsupported; falling back to cookie store"),vs=e,e},_error(e){zi.error("localStorage error: "+e)},_get(e){try{return null==Ve?void 0:Ve.localStorage.getItem(e)}catch(e){fs._error(e)}return null},_parse(e){try{return JSON.parse(fs._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==Ve||Ve.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){fs._error(e)}return!1},_remove(e){try{null==Ve||Ve.localStorage.removeItem(e)}catch(e){fs._error(e)}}},ms=[Q,G,H,V,j,z,ge,pe,ce],ys=[u,d,M,D,Se,we,g,ve],bs=e=>e+"_cpm",ws=["__proto__","constructor","prototype"],Ss=e=>{if(!ht(e))return{};var t={};return Object.keys(e).forEach(i=>{-1===ws.indexOf(i)&&(t[i]=e[i])}),t},Ps=function(e,t){void 0===t&&(t=[]);var i={};return[...ys,...t].forEach(t=>{var s=e[t];gt(s)||mt(s)||""===s||(i[t]=s)}),i},Es=e=>{for(var t=5381,i=2166136261,s=0;e.length>s;s++){var r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},ks=(e,t)=>({p:t,f:Es(JSON.stringify(e))}),Cs=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var i=gs._parse(bs(e)),s=(null==i?void 0:i.f)===Es(t)&&_t(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},xs=(e,t)=>t+"|"+(gs._get(bs(e))||""),Ts={},Is={_is_supported:()=>!0,_error(e){zi.error("memoryStorage error: "+e)},_get:e=>e in Ts?Ts[e]:null,_parse:e=>e in Ts?Ts[e]:null,_set:(e,t)=>(Ts[e]=t,!0),_remove(e){delete Ts[e]}},$s=null,Fs={_is_supported(){if(!mt($s))return $s;if($s=!0,gt(Ve))$s=!1;else try{var e="__support__";Fs._set(e,"xyz"),'"xyz"'!==Fs._get(e)&&($s=!1),Fs._remove(e)}catch(e){$s=!1}return $s},_error(e){zi.error("sessionStorage error: ",e)},_get(e){try{return null==Ve?void 0:Ve.sessionStorage.getItem(e)}catch(e){Fs._error(e)}return null},_parse(e){try{return JSON.parse(Fs._get(e))||null}catch(e){}return null},_set(e,t){try{return null==Ve||Ve.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Fs._error(e)}return!1},_remove(e){try{null==Ve||Ve.sessionStorage.removeItem(e)}catch(e){Fs._error(e)}}},Rs=class{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return"always"===this._config.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._config.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._config.opt_out_capturing_by_default}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get _storedConsent(){var e=this._storage._get(this._storageKey);return xt(e)?1:ot(Tt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?fs:gs,i=t._is_supported()?t:Is;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;var s="localStorage"===e?gs:fs;s._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(xt(s._get(this._storageKey))),s._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==ze?void 0:ze.doNotTrack,null==ze?void 0:ze.msDoNotTrack,it.doNotTrack,null==ze?void 0:ze.globalPrivacyControl].some(e=>xt(e))}},Os=["next","previous","prev",">","<","+","-","−","–"];Ki("[Dead Clicks]");var As=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(P)),s=e.instance.config.capture_dead_clicks;return St(s)?s:!!ht(s)||i},Ms=Ki("[SegmentIntegration]");function Ds(e,t,s){void 0===s&&(s=!0);var r=e.config.segment;if(!r)return t();var n,o=(e=>ct(e.register))(n=r)?{analytics:n}:n,a=o.analytics,l=o.filterProperties;!function(e,t,i,s){var r=t=>{var r=()=>t.anonymousId()||us();e.config.get_device_id=r,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:r()}),e.persistence.set_property(ve,Le)),i(s?void 0:t.anonymousId()||void 0)},n=t.user();"then"in n&&ct(n.then)?n.then(r):r(n)}(e,a,s=>{a.register(function(e,t,s){var r=(void 0===s?{}:s).filterProperties;"undefined"!=typeof Promise&&Promise.resolve||Ms.warn("This browser does not have Promise support, and can not use the segment integration");var n=(s,n)=>{if(!n)return s;var o=!!t&&s.event.anonymousId===t&&!s.event.userId;o||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(Ms.info("No userId set, resetting PostHog"),e.reset()),o||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(Ms.info("UserId set, identifying with PostHog"),e.identify(s.event.userId));var a=e.calculateEventProperties(n,s.event.properties);if(!yt(r)){var l=s.event.properties||{},d={};for(var u of Object.keys(a))dt.call(l,u)||(d[u]=a[u]);var _=((e,t)=>{var s=_t(e)?e:[e],r=i({},t);for(var n of s)try{if(r=n(r),yt(r))return null}catch(e){return Ms.error("Error in Segment filterProperties:",e),null}return r})(r,d);if(yt(_))return s;a=_}return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return n(e,e.event.event)},page(e){return n(e,qe)},identify(e){return n(e,Ge)},screen(e){return n(e,"$screen")}}}(e,s,{filterProperties:l})).then(()=>{t()},e=>{Ms.error("Failed to register the Segment integration",e),t()})},s)}var Ls="posthog-js";function Ns(e,t){var s=void 0===t?{}:t,r=s.organization,n=s.projectId,o=s.prefix,a=s.severityAllowList,l=void 0===a?["error"]:a,d=s.sendExceptionsToPostHog,u=void 0===d||d;return t=>{var s,a,d,_,c,h;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var p=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var g=(null==(s=t.exception)?void 0:s.values)||[],v=g.map(e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>i({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(a=g[0])?void 0:a.value)||t.message,$exception_type:null==(d=g[0])?void 0:d.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(_=g[0])?void 0:_.value)||t.message,$sentry_exception_type:null==(c=g[0])?void 0:c.type,$sentry_tags:t.tags};return r&&n&&(f.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+t.event_id),u&&(null==(h=e.exceptions)||h.sendExceptionEvent(f)),t}}var Bs=class{constructor(e,t,i,s,r,n){this.name=Ls,this.setupOnce=function(o){o(Ns(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},Us=class{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(zi.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.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==Ve?void 0:Ve.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,l=r.maxContentHeight,d=r.lastContentY,u=r.maxContentY;if(!(gt(n)||gt(o)||gt(a)||gt(l)||gt(d)||gt(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),d=Math.ceil(d),u=Math.ceil(u);var _=n>1?Ft(o/n,0,1,zi):1,c=n>1?Ft(a/n,0,1,zi):1,h=l>1?Ft(d/l,0,1,zi):1,p=l>1?Ft(u/l,0,1,zi):1;s=Qi(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:_,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:c,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},qs=["flags","surveys"],Hs={[l]:{exposure:"hidden"},[c]:{exposure:"hidden"},[h]:{exposure:"hidden"},[v]:{exposure:"hidden"},[g]:{exposure:"hidden"},[f]:{exposure:"event"},[m]:{exposure:"hidden"},[k]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},[w]:{exposure:"event"},[S]:{exposure:"event"},[P]:{exposure:"event"},[E]:{exposure:"hidden"},[C]:{exposure:"event"},[x]:{exposure:"hidden"},[T]:{exposure:"hidden"},[M]:{exposure:"hidden"},[D]:{exposure:"event"},[I]:{exposure:"event",shouldSkipFromEventProperties:e=>mt(e)},[L]:{exposure:"event"},[N]:{exposure:"event"},[B]:{exposure:"event"},[U]:{exposure:"event"},[q]:{exposure:"hidden"},[H]:{exposure:"hidden",storageGroup:"flags"},[G]:{exposure:"hidden",storageGroup:"flags"},[W]:{exposure:"hidden"},[V]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden",storageGroup:"flags"},[z]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[K]:{exposure:"hidden",storageGroup:"flags"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[ee]:{exposure:"hidden",storageGroup:"surveys"},[te]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ie]:{exposure:"event"},[se]:{exposure:"hidden"},[re]:{exposure:"hidden"},[ne]:{exposure:"hidden"},[oe]:{exposure:"hidden"},[ae]:{exposure:"hidden"},[le]:{exposure:"event"},[de]:{exposure:"event"},[ue]:{exposure:"event"},[_e]:{exposure:"event"},[ce]:{exposure:"hidden"},[he]:{exposure:"hidden"},[Z]:{exposure:"event"},[pe]:{exposure:"hidden"},[ge]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ve]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[me]:{exposure:"hidden"},[ye]:{exposure:"hidden"},[be]:{exposure:"hidden"},[we]:{exposure:"hidden"},[Se]:{exposure:"hidden"},[F]:{exposure:"event"},[R]:{exposure:"event"},[O]:{exposure:"event"},[A]:{exposure:"event"},[ke]:{exposure:"event"},[Ce]:{exposure:"event"},[xe]:{exposure:"event"},[Te]:{exposure:"event"},[Ie]:{exposure:"event"},[$e]:{exposure:"event"},[Fe]:{exposure:"event"},[Re]:{exposure:"event"},[Oe]:{exposure:"event"},[Ae]:{exposure:"event"},[Me]:{exposure:"event"}},Gs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ws=e=>{var t=Hs[e];if(t)return t;for(var i of Gs){var s=i[1];if(0===e.indexOf(i[0]))return s}},Vs=(e,t)=>{try{var i;return JSON.stringify(e,(e,t)=>kt(t)?(null!=i||(i=new WeakMap),i.has(t)||i.set(t,es(t)),i.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return r=[],null!==(s=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(t))return"[Circular]";r.push(t)}return t}}))&&void 0!==s?s:"null"}var s,r},js=e=>{var t=null==Ke?void 0:Ke.createElement("a");return gt(t)?null:(t.href=e,t)},zs=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!_t(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){zi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ks=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),d=[],u=0;l.length>u;u++){var _=l[u].split("=");_t(_)&&(t.includes(_[0])?d.push(_[0]+"="+i):d.push(l[u]))}var c=a;return null!=o&&(c+="?"+d.join("&")),null!=r&&(c+="#"+r),c},Js=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ys=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Js],Qs="<masked>",Xs=["li_fat_id"];function Zs(e,t){var i=Ys.concat(t||[]),s={};return Yi(i,function(t){var i=zs(e,t);s[t]=i||null}),s}function er(e){var t=function(e){return e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!mt(t)){s.$search_engine=t;var r=Ke?zs(Ke.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function tr(){return navigator.language||navigator.userLanguage}var ir="$direct";function sr(){return(null==Ke?void 0:Ke.referrer)||ir}function rr(e,t,i){var s;void 0===i&&(i=!1);var r=e?[...Js,...t||[]]:[],n=null==(s=i?Di(null==Je?void 0:Je.href):null==Je?void 0:Je.href)?void 0:s.substring(0,1e3);return{r:sr().substring(0,1e3),u:n?Ks(n,r,Qs):void 0}}function nr(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Di(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==ir?ir:null==(i=js(s))?void 0:i.host};if(n){o.$current_url=n;var a=js(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,Qi(o,Zs(n))}return s&&Qi(o,er(s)),o}function or(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function ar(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var lr={flags:ge,surveys:te},dr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ur=e=>e+"_cookie_identity_change_pending",_r=e=>{var t="",i=0;for(var s of e){var r=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+r>1e3)break;t+=s,i+=r}return t},cr="main",hr=[H,G,V,j,z,ge,K,Q],pr=e=>-1!==hr.indexOf(e),gr=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},vr=e=>{if(!e)return{};var t=JSON.parse(e);return ht(t)?t:{}},fr=(e,t)=>{Yi(e,(i,s)=>{var r=Ws(s);r&&"event"!==r.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})},mr=class{constructor(e,t,s){if(void 0===s&&(s=!0),this._slotState={},this._splitStorageEligible=!1,this._storesIdentityInCookie=!1,this._splitStorage=!1,this._cookieIdentityChangePending=!1,this._cookieSyncSuppressed=!1,this._pendingCrossTabFeatureFlagChanges=new Map,this._storageMigrationInProgress=!1,this._localIdentityChangePending=!1,this._crossTabFeatureFlagIdentityMismatch=!1,this._facebookClickIdChangePending=!1,this._crossTabFeatureFlagHandlers=new Set,this._config=e,this._ownsSplitStorage=s,this.props={},this._campaign_params_url=void 0,this._name=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this._storage=this._buildStorage(e),this._splitStorage=this._resolveSplitStorage(e),this.load(),this._markLoadedCrossTabFeatureFlagChangesPending(),e.debug&&zi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),Ve){var r=()=>this.flush();ss(Ve,"beforeunload",r,{capture:!1}),ss(Ve,"pagehide",r,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==Ve?void 0:Ve.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=qs.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,cr)},ss(Ve,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],i=e[1],s=this._pendingCrossTabFeatureFlagChanges.get(t);if(pr(t)&&!0!==s)if(!0!==i){var r=new Set(s||[]);i.forEach(e=>r.add(e)),r.size&&this._setCrossTabFeatureFlagChangesPending(t,r)}else this._setCrossTabFeatureFlagChangesPending(t,!0)})}onCrossTabFeatureFlagChange(e){return this._crossTabFeatureFlagHandlers.add(e),()=>this._crossTabFeatureFlagHandlers.delete(e)}destroy(){this._onStorage&&Ve&&(Ve.removeEventListener("storage",this._onStorage),this._onStorage=void 0),this._crossTabFeatureFlagHandlers.clear()}_syncCrossTabFeatureFlagProperties(e,t,i){if(void 0===i&&(i=!0),this._disabled)return!1;var s,r;try{if(r=fs._get(e),mt(r)){var n=this._slotWriteState(t);return n.storageValue=null,t!==cr&&(n.persisted=!1),!1}s=vr(r)}catch(e){return!1}var o=t===cr?s:fs._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===cr&&this._splitStorage&&!gr(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,r),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[d],i=e[d];return!gt(t)&&!gt(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){var r=this._slotWriteState(t);r.storageValue=s,t!==cr&&(r.persisted=i);try{r.fingerprint=this._entryFingerprint(e,t)}catch(e){r.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){var s=!1;return hr.forEach(i=>{var r,n=null==(r=Ws(i))?void 0:r.storageGroup;if(!(t===cr&&this._splitStorage&&n||t!==cr&&n!==t)){var 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&&gr(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;var e,t=fs._get(this._name),i=this._slotWriteState(cr),s=!1,r=!1;if(t!==i.storageValue)if(mt(t))i.storageValue=null;else{if(e=vr(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;r=this._mergeCrossTabFeatureFlagProperties(e,cr,!1),!this._splitStorage||gr(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,cr,!0,t):i.storageValue=t,s=!0}return this._splitStorage&&qs.forEach(t=>{var i=fs._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=s&&hr.some(e=>{var i;return(null==(i=Ws(e))?void 0:i.storageGroup)===t&&e in o});if(i!==n.storageValue||a){if(mt(i))return n.storageValue=null,n.persisted=!1,void(a&&(r=this._mergeCrossTabFeatureFlagProperties(o,t,!1)||r));var l=vr(i);r=this._mergeCrossTabFeatureFlagProperties(l,t,!1)||r,this._rememberCrossTabStorageFingerprint(l,t,!0,i)}}),r}catch(e){return!1}}_setCrossTabFeatureFlagChangesPending(e,t){this._pendingCrossTabFeatureFlagChanges.set(e,t);var i=Ws(e);null!=i&&i.volatile||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||cr).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){hr.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=fs._get(this._name),t=vr(e);this._slotWriteState(cr).storageValue=e,hr.forEach(e=>{var i,s=this._splitStorage?null==(i=Ws(e))?void 0:i.storageGroup:void 0,r=s?fs._get(this._groupEntryName(s)):null;if(s){var n=this._slotWriteState(s);n.storageValue=r,n.persisted=!mt(r)}var o=s&&!mt(r)?vr(r):t;e in this.props?this._markPendingCrossTabFeatureFlagChanges(e,o[e],this.props[e]):e in o&&this._setCrossTabFeatureFlagChangesPending(e,!0)})}catch(e){}}_mergePendingCrossTabFeatureFlagChanges(e,t){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!s)return t;if(!0===s)return this.props[e];if("$active_feature_flags"===e){var r=new Set(_t(t)?t:[]),n=new Set(_t(this.props[e])?this.props[e]:[]);return s.forEach(e=>n.has(e)?r.add(e):r.delete(e)),Array.from(r)}var o=ht(t)?i({},t):{},a=ht(this.props[e])?this.props[e]:{};return s.forEach(e=>{e in a?o[e]=a[e]:delete o[e]}),o}_markPendingCrossTabFeatureFlagChanges(e,t,i){if(pr(e)){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==s){var r=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Ws(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;r=vr(fs._get(a))[e]}catch(e){}var l=new Set(s||[]);if("$active_feature_flags"===e){if(!gt(t)&&!_t(t)||!gt(r)&&!_t(r)||!_t(i))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var d=new Set(t||[]),u=new Set(r||[]),_=new Set(i);new Set([...d,..._]).forEach(e=>{d.has(e)!==_.has(e)&&l.add(e)}),l.forEach(e=>{u.has(e)===_.has(e)&&l.delete(e)})}else{if(!ht(i))return void(gr(r,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!gt(t)&&!ht(t)||gt(t)&&pt(i)&&gt(r))return void this._setCrossTabFeatureFlagChangesPending(e,!0);var c=ht(t)?t:{},h=ht(r)?r:{};new Set([...Object.keys(c),...Object.keys(i)]).forEach(e=>{e in c==e in i&&gr(c[e],i[e])||l.add(e)}),l.forEach(e=>{e in h==e in i&&gr(h[e],i[e])&&l.delete(e)})}l.size?this._setCrossTabFeatureFlagChangesPending(e,l):this._pendingCrossTabFeatureFlagChanges.delete(e)}}}_saveDebounceMs(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return bt(t)&&t>0?t:0}_rememberCurrentCookieProperties(e){if(this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase())if(e)try{var t=Ps(e,this._config.cookie_persisted_properties||[]),i=ks(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=gs._get(this._name)||void 0;r&&xs(this._name,r)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r)}catch(e){}else try{var n=gs._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?xs(this._name,n):void 0,this._lastSeenMainCookieValue=n}catch(e){}}syncCookieProperties(){return this._syncCookieProperties(this._config)}_syncCookieProperties(e,t){if(void 0===t&&(t=!1),this._disabled&&!t||this._cookieSyncSuppressed||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;var i;try{i=gs._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;var s,r=xs(this._name,i);try{s=Ss(JSON.parse(i))}catch(e){return!1}if((gs._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=r,this._lastSeenMainCookieValue=i;var n=Cs(this._name,i),o=[...ys,...n.properties],a={};if(Object.keys(s).forEach(e=>{var t=s[e];(gt(t)||mt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),pt(s))return!1;var l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,_=u[d],h=u[ve],p=Qi({},u);[...ys,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=p[e];(n.isValid||-1===ys.indexOf(e)||!1!==t&&0!==t)&&delete p[e]}}),this.props=Qi(p,s),hr.forEach(e=>{var t=e in this.props;e in u===t&&gr(u[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,u[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this._setProp(ve,De);var g=this.props[d],v=this.props[ve];return!l||g===_&&v===h||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Fs._set(ur(this._name),!0),this._deleteProp(Q),this._deleteProp(G),this._deleteProp(H),this._deleteProp(V),this._deleteProp(j),this._deleteProp(z),this._deleteProp(ge),this._deleteProp(pe),this._deleteProp(ce),"anonymous"!==v||"identified"!==h&&"anonymous"!==s.$user_state&&(gt(_)||g===_)||(fr(this.props,s),this._deleteProp(X)),"identified"===v?this.props.$user_id=g:delete this.props.$user_id,this._deleteProp(c)),!0}consumeCookieIdentityChange(){var e=ur(this._name),t=this._cookieIdentityChangePending||!!Fs._get(e);return this._cookieIdentityChangePending=!1,t&&Fs._remove(e),t}_beginCookieSyncSuppression(e){return void 0===e&&(e=!1),!(this._cookieSyncSuppressed||this._disabled&&!e||!this._config.cookieWinsOnConflict||"localstorage+cookie"!==this._config.persistence.toLowerCase()||(this._cookieSyncSuppressed=!0,0))}_publishSuppressedCookieSnapshot(){this._cookieSyncSuppressed&&(gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),delete this._slotState[cr],this._writeNow(!0))}_endCookieSyncSuppression(e){if(void 0===e&&(e=!0),this._cookieSyncSuppressed)try{e?this._publishSuppressedCookieSnapshot():gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0)}finally{this._cookieSyncSuppressed=!1}}isDisabled(){return!!this._disabled}_buildStorage(e){-1===dr.indexOf(e.persistence.toLowerCase())&&(zi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!1);var s=[...ys,...e];return i({},fs,{_parse(e){try{var i,r={};try{i=gs._get(e)||void 0,r=i?Ss(JSON.parse(i)):{}}catch(e){}var n,o=JSON.parse(fs._get(e)||"{}");if(t){var a=Cs(e,i),l=[...ys,...a.properties],u={};Object.keys(r).forEach(e=>{var t=r[e];mt(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});var _="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var c,h=o[d],p=null!==(c=o.$user_state)&&void 0!==c?c:"anonymous";s.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in r)&&(_||"distinct_id"!==e&&"$user_state"!==e)){var t=o[e];(a.isValid||-1===ys.indexOf(e)||!1!==t&&0!==t)&&delete o[e]}}),!_||"$user_state"in r||"$user_state"in o||(o[ve]=De),!_||("distinct_id"in u?u[d]:o[d])===h&&("$user_state"in u?u[ve]:o[ve])===p||(ms.forEach(e=>delete o[e]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[d]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[Z],delete o[X]),delete o.__alias)}n=Qi(o,u)}else n=Qi(r,o);return fs._set(e,n),n}catch(e){}return null},_set(i,s,r,n,o,a){var l=fs._set(i,s,void 0,void 0,a);try{var d=Ps(s,e);if(Object.keys(d).length){if(t){var u=bs(i),_=ks(d,e);if(gs._set(u,_,r,n,o,a),gs._get(u)!==JSON.stringify(_)){gs._remove(u,n);var c=Ps(s);return gs._set(i,c,r,n,o,a),l}}gs._set(i,d,r,n,o,a)}}catch(e){fs._error(e)}return l},_remove(e,t){try{null==Ve||Ve.localStorage.removeItem(e),gs._remove(e,t),gs._remove(bs(e),t)}catch(e){fs._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,n=!1,o=e.persistence.toLowerCase();return"localstorage"===o&&fs._is_supported()?(t=fs,n=!0):"localstorage+cookie"===o&&s._is_supported()?(t=s,n=!0,r=!0):"sessionstorage"===o&&Fs._is_supported()?t=Fs:"memory"===o?t=Is:"cookie"===o&&gs._is_supported()?(t=gs,r=!0):s._is_supported()?(t=s,n=!0,r=!0):gs._is_supported()?(t=gs,r=!0):t=Is,this._splitStorageEligible=n,this._storesIdentityInCookie=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return Yi(this.props,(t,i)=>{var s=Ws(i);if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t))return;e[i]=t}}),e}load(e){if(void 0===e&&(e=!1),!this._disabled||e){var t=this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase(),i=t?fs._parse(this._name):null,s={};if(t)try{Yi(s=Ss(gs._parse(this._name)),(e,t)=>{(gt(e)||mt(e)||""===e)&&delete s[t]})}catch(e){}var r=this._storage._parse(this._name);if(r&&(this.props=Qi({},r)),this._splitStorage&&this._loadGroupEntries(),t&&r){var n,o,a=null==i?void 0:i[d],l=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:"anonymous",u=r[d],_=null!==(o=r.$user_state)&&void 0!==o?o:"anonymous";if(u!==a||_!==l){this._cookieIdentityChangePending=!0,Fs._set(ur(this._name),!0);var c=Qi({},this.props);ms.forEach(e=>delete c[e]),"anonymous"!==_||"identified"!==l&&"anonymous"!==s.$user_state&&(gt(a)||u===a)||(fr(c,s),delete c[X]),this.props=c;var h=new Set;ms.forEach(e=>{var t,i=null==(t=Ws(e))?void 0:t.storageGroup;i&&h.add(i)}),h.forEach(e=>{var t={};Yi(this.props,(i,s)=>{var r;(null==(r=Ws(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),pt(t)?(fs._remove(this._groupEntryName(e)),this._slotState[e]={}):fs._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Fs._get(ur(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of qs){var t=fs._parse(this._groupEntryName(e));if(t&&!pt(t)){var i=this._slotWriteState(e);i.persisted=!0,this._mainCarriesGroupKey(e)||(i.fingerprint=this._entryFingerprint(t,e)),this._groupEntryIsStale(e,t)||Qi(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=Ws(t))?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){var i=lr[e];if(!i)return!1;var s=t[i],r=this.props[i];return bt(s)&&bt(r)&&r>s}refreshKey(e){var t;if(!(this._disabled||"$fbc_persistence"===e&&this._facebookClickIdChangePending)){var i=this._splitStorage?null==(t=Ws(e))?void 0:t.storageGroup:void 0,s=i?fs._parse(this._groupEntryName(i)):this._storage._parse(this._name);if(s&&e in s)this._setProp(e,s[e],!1);else{if(i){var r=this._storage._parse(this._name);if(r&&e in r)return void this._setProp(e,r[e],!1)}this._deleteProp(e,!1)}}}save(){if(!this._disabled){var e=this._saveDebounceMs();e>0?gt(this._pendingSaveTimer)&&(this._pendingSaveTimer=setTimeout(()=>{this._pendingSaveTimer=void 0,this._writeNow()},e)):this._writeNow()}}flush(){gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0,this._writeNow())}_writeNow(e){if(void 0===e&&(e=!1),!(this._disabled||this._cookieSyncSuppressed&&!e)){e||(this.syncCookieProperties(),this._facebookClickIdChangePending||this._config.cookieWinsOnConflict&&"localstorage+cookie"===this._config.persistence.toLowerCase()||this.refreshKey(g));var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&zi.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this._splitStorage)return this._writeNowSplit(),void(i&&this._crossTabFeatureFlagHandlers.forEach(e=>e()));var s=this._writeEntry(this._storage,this._name,this.props,cr);"written"===s&&this._rememberCurrentCookieProperties(this.props),"failed"!==s&&(this._pendingCrossTabFeatureFlagChanges.clear(),this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1),i&&this._crossTabFeatureFlagHandlers.forEach(e=>e())}}}_writeNowSplit(){var e=this,t=this._partitionProps(),i=t.main,s=t.groups,r=this._writeEntry(this._storage,this._name,i,cr);"written"===r&&this._rememberCurrentCookieProperties(i),"failed"!==r&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,hr.forEach(e=>{var t;null!=(t=Ws(e))&&t.storageGroup||this._pendingCrossTabFeatureFlagChanges.delete(e)}));var n=function(t){var i,r=s[t];if(pt(r)&&(null==(i=e._slotState[t])||!i.persisted))return hr.forEach(i=>{var s;(null==(s=Ws(i))?void 0:s.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(i)}),1;var n=e._writeEntry(fs,e._groupEntryName(t),r,t);"failed"!==n&&hr.forEach(i=>{var s=Ws(i);(null==s?void 0:s.storageGroup)!==t||"written"!==n&&s.volatile||e._pendingCrossTabFeatureFlagChanges.delete(i)})};for(var o of qs)if(n(o))continue}_partitionProps(){var e={},t={flags:{},surveys:{}};return Yi(this.props,(i,s)=>{var r,n=null==(r=Ws(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===cr)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return Yi(e,(e,t)=>{var s;i[t]=null!=(s=Ws(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){var r,n=this._slotWriteState(s);if(s!==cr&&!n.dirty&&!gt(n.fingerprint))return"skipped";try{if((r=this._entryFingerprint(i,s))===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!==cr&&(n.persisted=!0),gt(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=fs._get(t)),"written"):(this._config.debug&&zi.warn('failed to persist storage entry "'+t+'"; will retry on next save'),"failed")}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(this._markAllCrossTabFeatureFlagChangesPending(),gt(this._pendingSaveTimer)||(clearTimeout(this._pendingSaveTimer),this._pendingSaveTimer=void 0),this._storage._remove(this._name,!1),this._storage._remove(this._name,!0),!i&&this._ownsSplitStorage)for(var s of qs)fs._remove(this._groupEntryName(s));i?delete this._slotState[cr]:this._slotState={},this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ht(e)){this.syncCookieProperties(),gt(t)&&(t="None"),this._expire_days=gt(i)?this._default_expiry:i;var s=!1;if(Yi(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(ht(e)){this.syncCookieProperties(),this._expire_days=gt(t)?this._default_expiry:t;var i=!1;if(Yi(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||ht(t)||_t(t))&&(this._setProp(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();var t="string"==typeof e?[e]:e,i=!1;for(var s of t)s in this.props&&(this._deleteProp(s),i=!0);i&&this.save()}update_campaign_params(){var e=null==Ke?void 0:Ke.URL;if(e!==this._campaign_params_url){var t=function(e,t,i){if(!Ke)return{};var s,r=t?[...Js,...i||[]]:[],n=Zs(Ks(Ke.URL,r,Qs),e);return Qi((s={},Yi(Xs,function(e){var t=rs(e);s[e]=t||null}),s),n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!pt(Zi(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}}update_search_keyword(){var e;this.register((e=null==Ke?void 0:Ke.referrer)?er(e):{})}update_referrer_info(){var e;this.register_once({$referrer:sr(),$referring_domain:null!=Ke&&Ke.referrer&&(null==(e=js(Ke.referrer))?void 0:e.host)||ir},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var e=rr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[we]:this._storesIdentityInCookie?{r:_r(e.r),u:e.u?_r(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};Yi([be,ye],t=>{var i=this.props[t];i&&Yi(i,function(t,i){e["$initial_"+at(i)]=t})});var t=this.props[we];return t&&Qi(e,function(e,t){void 0===t&&(t=!1);var i=nr(e,t),s={};return Yi(i,function(e,t){s["$initial_"+at(t)]=e}),s}(t,this._config.disable_capture_url_hashes)),e}safe_merge(e){return Yi(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,s){var r=e.persistence!==t.persistence,n=!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),o=r||n,a=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,l=e.disable_persistence||!!s,d=!!this._disabled&&!l;l||this._syncCookieProperties(t,d),this._config=e,!l&&(r||n||a)&&(this._lastSeenCookiePropertiesFingerprint=void 0,this._lastSeenMainCookieValue=void 0,this._syncCookieProperties(i({},e,{cookie_persisted_properties:t.cookie_persisted_properties}),d));var u=o||a?this._buildStorage(e):this._storage;this._truncateExistingPersonInfoForCookie();var _=this._resolveSplitStorage(e),c=o||_!==this._splitStorage,h=!l&&(c||e.cross_subdomain_cookie!==this._cross_subdomain||e.secure_cookie!==this._secure)&&this._beginCookieSyncSuppression(d);this._storageMigrationInProgress=c;try{if(this._default_expiry=this._expire_days=e.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){var p=this.props;this.clear(),this._storage=u,this._splitStorage=_,this.props=p,this.save()}else a&&(this._storage=u,l||(delete this._slotState[cr],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[we];if(this._storesIdentityInCookie&&ht(e)&&"string"==typeof e.r){var t=_r(e.r),s="string"==typeof e.u?_r(e.u):e.u;t===e.r&&s===e.u||this._setProp(we,i({},e,{r:t,u:s}))}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props.__timers||{};i[e]=t,this._setProp(v,i),this.save()}remove_event_timer(e){var t=this.props.__timers||{},i=t[e];return gt(i)||(delete t[e],this._setProp(v,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){var s;void 0===i&&(i=!0);var r=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this._localIdentityChangePending=!0),"$fbc_persistence"!==e||gr(r,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,r,t),null!=(s=Ws(e))&&s.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(pr(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),"$fbc_persistence"===e&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,i=null==(t=Ws(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}},yr={GZipJS:"gzip-js",Base64:"base64"},br={Activation:"events",Cancellation:"cancelEvents"},wr={Button:"button",Tab:"tab",Selector:"selector"},Sr={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"},Pr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Er={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},kr={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Cr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},xr={Once:"once",Recurring:"recurring",Always:"always"},Tr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ir={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"},$r={Popover:"popover",Inline:"inline"};function Fr(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&ct(i.then)&&i.then(void 0,()=>{})}}}}var Rr={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},Or={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"},Ar={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"},Mr=Ki("[RateLimiter]"),Dr=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Mr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Mr.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;void 0===e&&(e=!1);var r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){var d=(bt(a.dropped)?a.dropped:0)+1;a.dropped=d,!this.lastEventRateLimited&&this._captureWarning(d)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(me,a),{isRateLimited:l,remainingTokens:a.tokens}}_isPropertyAllowed(e){var t=this.instance.config.property_denylist;return!_t(t)||!t.includes(e)}_triggeringPage(){var e;if(this._isPropertyAllowed("$current_url")&&this._isPropertyAllowed("$pathname")&&null!=Je&&Je.pathname)return""+(null!==(e=Je.origin)&&void 0!==e?e:"")+Je.pathname}_captureWarning(e){var t,i,s=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,n=this._triggeringPage(),o=this._isPropertyAllowed("$session_id")?null==(t=(i=this.instance).get_session_id)?void 0:t.call(i):void 0,a=[e+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+r+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}},Lr=Ki("[RemoteConfig]"),Nr=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=it._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=it.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=it.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}_loadRemoteConfigJSON(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:e})}load(){try{if(this.remoteConfig)return Lr.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Lr.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Lr.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){Lr.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Lr.warn("Failed to fetch remote config from PostHog."):Lr.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Lr.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)||i.ensureFlagsLoaded()}catch(e){Lr.error("Error loading feature flags",e)}}},Br=["fatal","error","warning","log","info","debug"],Ur=Uint8Array,qr=Uint16Array,Hr=Uint32Array,Gr=new Ur([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]),Wr=new Ur([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]),Vr=new Ur([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jr=function(e,t){for(var i=new qr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Hr(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},zr=jr(Gr,2),Kr=zr[1];zr[0][28]=258,Kr[258]=28;for(var Jr=jr(Wr,0)[1],Yr=new qr(32768),Qr=0;32768>Qr;++Qr){var Xr=(43690&Qr)>>>1|(21845&Qr)<<1;Yr[Qr]=((65280&(Xr=(61680&(Xr=(52428&Xr)>>>2|(13107&Xr)<<2))>>>4|(3855&Xr)<<4))>>>8|(255&Xr)<<8)>>>1}var Zr=function(e,t,i){for(var s=e.length,r=0,n=new qr(t);s>r;++r)++n[e[r]-1];var o,a=new qr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new qr(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var d=r<<4|e[r],u=t-e[r],_=a[e[r]-1]++<<u,c=_|(1<<u)-1;c>=_;++_)o[Yr[_]>>>l]=d}else for(o=new qr(s),r=0;s>r;++r)o[r]=Yr[a[e[r]-1]++]>>>15-e[r];return o},en=new Ur(288);for(Qr=0;144>Qr;++Qr)en[Qr]=8;for(Qr=144;256>Qr;++Qr)en[Qr]=9;for(Qr=256;280>Qr;++Qr)en[Qr]=7;for(Qr=280;288>Qr;++Qr)en[Qr]=8;var tn=new Ur(32);for(Qr=0;32>Qr;++Qr)tn[Qr]=5;var sn=Zr(en,9,0),rn=Zr(tn,5,0),nn=function(e){return(e/8|0)+(7&e&&1)},on=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof qr?qr:e instanceof Hr?Hr:Ur)(i-t);return s.set(e.subarray(t,i)),s},an=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},ln=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},dn=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new Ur(0),0];if(1==r){var o=new Ur(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],d=0,u=1,_=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=i[i[_].f>i[d].f?d++:_++],l=i[d!=u&&i[_].f>i[d].f?d++:_++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var h=new qr(c+1),p=un(i[u-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort(function(e,t){return h[t.s]-h[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new Ur(h),p]},un=function(e,t,i){return-1==e.s?Math.max(un(e.l,t,i+1),un(e.r,t,i+1)):t[e.s]=i},_n=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new qr(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},cn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},hn=function(e,t,i){var s=i.length,r=nn(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},pn=function(e,t,i,s,r,n,o,a,l,d,u){an(t,u++,i),++r[256];for(var _=dn(r,15),c=_[0],h=_[1],p=dn(n,15),g=p[0],v=p[1],f=_n(c),m=f[0],y=f[1],b=_n(g),w=b[0],S=b[1],P=new qr(19),E=0;m.length>E;++E)P[31&m[E]]++;for(E=0;w.length>E;++E)P[31&w[E]]++;for(var k=dn(P,7),C=k[0],x=k[1],T=19;T>4&&!C[Vr[T-1]];--T);var I,F,R,O,A=d+5<<3,M=cn(r,en)+cn(n,tn)+o,D=cn(r,c)+cn(n,g)+o+14+3*T+cn(P,C)+(2*P[16]+3*P[17]+7*P[18]);if(M>=A&&D>=A)return hn(t,u,e.subarray(l,l+d));if(an(t,u,1+(M>D)),u+=2,M>D){I=Zr(c,h,0),F=c,R=Zr(g,v,0),O=g;var L=Zr(C,x,0);for(an(t,u,y-257),an(t,u+5,S-1),an(t,u+10,T-4),u+=14,E=0;T>E;++E)an(t,u+3*E,C[Vr[E]]);u+=3*T;for(var N=[m,w],B=0;2>B;++B){var U=N[B];for(E=0;U.length>E;++E)an(t,u,L[q=31&U[E]]),u+=C[q],q>15&&(an(t,u,U[E]>>>5&127),u+=U[E]>>>12)}}else I=sn,F=en,R=rn,O=tn;for(E=0;a>E;++E)if(s[E]>255){var q;ln(t,u,I[257+(q=s[E]>>>18&31)]),u+=F[q+257],q>7&&(an(t,u,s[E]>>>23&31),u+=Gr[q]);var H=31&s[E];ln(t,u,R[H]),u+=O[H],H>3&&(ln(t,u,s[E]>>>5&8191),u+=Wr[H])}else ln(t,u,I[s[E]]),u+=F[s[E]];return ln(t,u,I[256]),u+F[256]},gn=new Hr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vn=new Ur(0),fn=function(){for(var e=new Hr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),mn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function yn(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=fn[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,d,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new Ur(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),d=0;if(!t||8>o)for(var u=0;o>=u;u+=65535){var _=u+65535;o>_?d=hn(l,d,e.subarray(u,_)):(l[u]=n,d=hn(l,d,e.subarray(u,o)))}else{for(var c=gn[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new qr(32768),f=new qr(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},w=new Hr(25e3),S=new qr(288),P=new qr(32),E=0,k=0,C=(u=0,0),x=0,T=0;o>u;++u){var I=b(u),F=32767&u,R=f[I];if(v[F]=R,f[I]=F,u>=x){var O=o-u;if((E>7e3||C>24576)&&O>423){d=pn(e,l,0,w,S,P,k,C,T,u-T,d),C=E=k=0,T=u;for(var A=0;286>A;++A)S[A]=0;for(A=0;30>A;++A)P[A]=0}var M=2,D=0,L=p,N=F-R&32767;if(O>2&&I==b(u-N))for(var B=Math.min(h,O)-1,U=Math.min(32767,u),q=Math.min(258,O);U>=N&&--L&&F!=R;){if(e[u+M]==e[u+M-N]){for(var H=0;q>H&&e[u+H]==e[u+H-N];++H);if(H>M){if(M=H,D=N,H>B)break;var G=Math.min(N,H-2),W=0;for(A=0;G>A;++A){var V=u-N+A+32768&32767,j=V-v[V]+32768&32767;j>W&&(W=j,R=V)}}}N+=(F=R)-(R=v[F])+32768&32767}if(D){w[C++]=268435456|Kr[M]<<18|Jr[D];var z=31&Kr[M],K=31&Jr[D];k+=Gr[z]+Wr[K],++S[257+z],++P[K],x=u+M,++E}else w[C++]=e[u],++S[e[u]]}}d=pn(e,l,n,w,S,P,k,C,T,u-T,d),n||(d=hn(l,d,vn))}return on(a,0,s+nn(d)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!d)),_=u.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&&mn(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)}}(u,t),mn(u,_-8,i.d()),mn(u,_-4,s),u}var bn=!!Qe||!!Ye,wn="text/plain",Sn=!1,Pn=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],o=r[1];if(!o)return e;var a=o.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(a?"?"+a:"")+(s?"#"+s:"")},En=function(e,t,s){var r;void 0===s&&(s=!0);var n=e.split("?"),o=n[0],a=n[1],l=i({},t),d=null!==(r=null==a?void 0:a.split("&").map(e=>{var t,i=e.split("="),r=i[0],n=s&&null!==(t=l[r])&&void 0!==t?t:i[1];return delete l[r],r+"="+n}))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return Yi(e,function(e,t){gt(e)||gt(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(l);return u&&d.push(u),d.length>0?o+"?"+d.join("&"):o},kn=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===yr.GZipJS){var s=yn(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Ur(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new Ur(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):2048>a?(r(192|a>>>6),r(128|63&a)):a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63),r(128|a>>>6&63),r(128|63&a)):(r(224|a>>>12),r(128|a>>>6&63),r(128|63&a))}return on(i,0,s)}(Vs(t)),{mtime:0});return{contentType:wn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===yr.Base64){var r=(e=>"data="+encodeURIComponent("string"==typeof e?e:Vs(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(Vs(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}var n=Vs(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Cn=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:En(e.url,{compression:yr.Base64}),encodedBody:kn(i({},e,{compression:yr.Base64,_encodedBody:void 0}))}:{url:Pn(e.url,"compression"),encodedBody:kn(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=kn(e)}catch(t){if(qi(e.compression,zs(e.url,"compression")))return zi.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&qi(e.compression,zs(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?Ui(new Uint8Array(s)):ArrayBuffer.isView(s)&&Ui(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Sn=!0,r()):{url:e.url,encodedBody:t}},xn=e=>{try{return Cn(e)}catch(t){return zi.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},Tn=function(){var e=r(function*(e){var t=yield function(e,t,i){return Vi.apply(this,arguments)}(Vs(e.data),a.DEBUG,{rethrow:!0});if(!t)return e;var s=yield t.arrayBuffer();return i({},e,{_encodedBody:{contentType:wn,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}}(),In=/Failed to fetch|NetworkError|Load failed/i,$n=e=>"TypeError"===(null==e?void 0:e.name)&&In.test((null==e?void 0:e.message)||""),Fn=e=>{var t=xn(e);if(t){var i=new Qe,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,o=r.body;Yi(e.headers,function(e,t){i.setRequestHeader(t,e)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(o)}},Rn=e=>{var t=xn(e);if(t){var s=t.url,r=t.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,d=new Headers;Yi(e.headers,function(e,t){d.append(t,e)}),o&&d.append("Content-Type",o);var u=null,_=!1;if(Xe){var c=new Xe;u={signal:c.signal,timeout:setTimeout(()=>{var t;_=!0,c.abort(Mi("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))},e.timeout)}}var h=t=>{_&&"AbortError"===(null==t?void 0:t.name)||$n(t)?zi.warn(t):zi.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var p;Ye(s,i({method:(null==e?void 0:e.method)||"GET",headers:d,keepalive:"POST"===e.method&&!e._keepaliveDisabled&&52428.8>(l||0),body:a,signal:null==(p=u)?void 0:p.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){zi.error(e)}null==e.callback||e.callback(s)})).catch(h).finally(()=>u?clearTimeout(u.timeout):null)}catch(e){u&&clearTimeout(u.timeout),h(e)}}},On=e=>{try{var t,s=Cn(e),r=s.url,n=s.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var d=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(ze.sendBeacon(r,d))return;var u=_t(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(_t(u)&&u.length>1&&(null!=l?l:0)>16384){var _=Math.ceil(u.length/2),c=t=>_t(e.data)?t:i({},e.data,{batch:t});return On(i({},e,{data:c(u.slice(0,_))})),void On(i({},e,{data:c(u.slice(_))}))}zi.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(Ye?"fetch":"XHR")),Ye?Rn(i({},e,{_keepaliveDisabled:!0})):Fn(e)}catch(e){zi.warn("Beacon send failed",e)}},An=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return En(s===yr.GZipJS?Pn(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===yr.GZipJS?{}:{compression:s}))},Mn=(()=>{var e=[];return Ye&&e.push({transport:"fetch",method:Rn}),Qe&&e.push({transport:"XHR",method:Fn}),null!=ze&&ze.sendBeacon&&e.push({transport:"sendBeacon",method:On}),e})(),Dn=class{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Ft((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,zi.createLogger("flush interval"),3e3),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this._sendRequestSafely(i({},e,{transport:"sendBeacon"}))})}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout(()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&_t(i.data)&&Yi(i.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e._sendRequestSafely(i)};for(var s in t)i()}},this._flushTimeoutMs))}_sendRequestSafely(e){try{this._sendRequest(e)}catch(e){zi.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return Yi(this._queue,t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;gt(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)}),this._queue=[],e}},Ln=class{constructor(e){this._instance=e,this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._queue=[],this._areWeOnline=!0,this.resume()}resume(){if(!gt(Ve)&&"onLine"in Ve.navigator){if(this._areWeOnline=Ve.navigator.onLine,this._onlineListener)return;this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ss(Ve,"online",this._onlineListener),ss(Ve,"offline",this._offlineListener)}}get length(){return this._queue.length}retriableRequest(e){var s=e.retriesPerformedSoFar,r=function(e,t){if(null==e)return{};var i={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}(e,t);wt(s)&&(r.url=En(r.url,{retry_count:s})),this._instance._send_request(i({},r,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=s?s:0))return void this._enqueue(i({retriesPerformedSoFar:s},r));0===e.statusCode&&zi.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!=s?s:0)+" retries.")}null==r.callback||r.callback(e)}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=(Math.random()-.5)*(s-i);return Math.ceil(s+r)}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),zi.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()},this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter(i=>e>i.retryAt||(t.push(i),!1));if(this._queue=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,gt(Ve)||(this._onlineListener&&(Ve.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(Ve.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue)){var t=e.requestOptions;try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(e){zi.error(e)}}this._queue=[]}},Nn=class{constructor(e){this._instance=e,this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(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(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ss(Ve,"scroll",this._updateScrollData,{capture:!0}),ss(Ve,"scrollend",this._updateScrollData,{capture:!0}),ss(Ve,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==Ve||null==(e=Ve.document)?void 0:e.documentElement;for(var t of _t(this._scrollRoot)?this._scrollRoot:[this._scrollRoot]){var i,s=null==Ve||null==(i=Ve.document)?void 0:i.querySelector(t);if(s)return s}}_scrollPosition(e){var t,i,s="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[s]||0}return Ve?"y"===e?Ve.scrollY||Ve.pageYOffset||(null==(t=Ve.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:Ve.scrollX||Ve.pageXOffset||(null==(i=Ve.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}},Bn=e=>rr(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),Un=class{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[fe]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||Bn,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[fe]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?nr(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return Yi(Zi(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+at(i)]=t}),e}},qn=class{on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter(e=>e!==t)}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}constructor(){this._events={}}},Hn=Ki("[SessionId]"),Gn=864e5,Wn=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 qn,this._sessionHasBeenIdleTooLong=(e,t)=>!(!wt(e)||!wt(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||us,this._windowIdGenerator=i||us;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Ft(this._config.session_idle_timeout_seconds||1800,60,36e3,Hn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=Fs._parse(this._window_id_storage_key),o=Fs._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Fs._remove(this._window_id_storage_key),Fs._set(this._primary_window_exists_storage_key,!0)}null!=(s=this._config.bootstrap)&&s.sessionID&&this.setBootstrapSessionId(this._config.bootstrap.sessionID),this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return gt(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&&Fs._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Fs._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Fs._parse(this._window_id_storage_key):null}_isActivityChangeBelowGranularity(e){var t=this._lastPersistedActivityTimestamp;return!mt(t)&&!mt(e)&&5e3>Math.abs(e-t)}_setSessionId(e,t,i){var s=t!==this._sessionActivityTimestamp,r=!(e!==this._sessionId||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,r&&!s||r&&this._isActivityChangeBelowGranularity(t)||(this._lastPersistedActivityTimestamp=t,this._persistence.register({[M]:[t,e,i]}))}_useCrossTabRefreshHardening(){var e,t=null==(e=this._config)?void 0:e.persistence_save_debounce_ms;return wt(t)&&t>0}_refreshSessionIdFromStorage(){this._useCrossTabRefreshHardening()?this._persistence.refreshKey(M):(this._persistence.flush(),this._persistence.load())}_flushPendingActivityTimestamp(){var e;if(!mt(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this._lastPersistedActivityTimestamp){this._refreshSessionIdFromStorage();var t=this._getSessionId();t[1]===this._sessionId&&t[2]===this._sessionStartTimestamp&&(this._lastPersistedActivityTimestamp=this._sessionActivityTimestamp,this._persistence.register({[M]:[this._sessionActivityTimestamp,null!==(e=this._sessionId)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this._persistence.flush())}}_freshestActivityTimestamp(){var e=this._getSessionId()[0],t=wt(e)?e:0,i=wt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}_isSessionIdleAfterCrossTabRefresh(e){return this._refreshSessionIdFromStorage(),this._sessionHasBeenIdleTooLong(e,this._freshestActivityTimestamp())}_getSessionId(){var e=this._persistence.props[M];return _t(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._lastPersistedActivityTimestamp=null,this._pendingBootstrapSession=void 0,clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._setSessionId(null,null,null)}setBootstrapSessionId(e,t){void 0===t&&(t=!1);var i=function(e,t){void 0===t&&(t=(new Date).getTime());try{var i=(e=>{var t=e.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void Hn.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void Hn.error("Invalid sessionID in bootstrap",e)}}(e);return!gt(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&&Ve&&(Ve.removeEventListener(Ue,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Fs._remove(this._primary_window_exists_storage_key)},ss(Ve,Ue,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===i&&(i=!1),"always"===this._config.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||(new Date).getTime(),r=this._sessionId;if(i)this._lastCookieSyncTimestamp=s;else if(mt(this._lastCookieSyncTimestamp)||this._lastCookieSyncTimestamp>s||s-this._lastCookieSyncTimestamp>=1e3){var n,o;null==(n=(o=this._persistence).syncCookieProperties)||n.call(o),this._lastCookieSyncTimestamp=s}var a=this._getSessionId(),l=a[1],d=a[2],u=!gt(r)&&l!==r,_=this._freshestActivityTimestamp(),c=this._getWindowId(),h=this._pendingBootstrapSession,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>Gn),g=h?p:wt(d)&&Math.abs(s-d)>Gn,v=!1,f=u,m=!l||!!h,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(s,_);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(s))||Hn.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this._getSessionId();l=w[1],d=w[2]}if(m||b||g){f=!1;var S=h&&!p;l=S?h.sessionId:this._sessionIdGenerator(),c=this._windowIdGenerator(),Hn.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g}}),d=S?h.sessionStartTimestamp:s,this._pendingBootstrapSession=void 0,v=!0}else c||(c=this._windowIdGenerator(),v=!0),(f=f||l!==y)&&(Hn.info("adopted cross-tab session id",{sessionId:l,windowId:c}),v=!0);var P=wt(_)&&e&&!g?_:s,E=wt(d)?d:(new Date).getTime();this._setWindowId(c),this._setSessionId(l,P,E),e||this._resetIdleTimer();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach(e=>e(l,c,k)),{sessionId:l,windowId:c,sessionStartTimestamp:E,changeReason:v?k:void 0,lastActivityTimestamp:_}}_resetIdleTimer(){this._destroyed||(clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{if(!this._destroyed)if(this._isSessionIdleAfterCrossTabRefresh((new Date).getTime())){var e=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:e})}else this._resetIdleTimer()},1.1*this.sessionTimeoutMs))}};function Vn(){return(Vn=r(function*(){var e=null==ze?void 0:ze.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t,i=null==(t=yield e.getHighEntropyValues(["model"]))?void 0:t.model;return vt(i)&&i.length>0?i:void 0}catch(e){return void zi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function jn(e,t){var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i}function zn(e,t,i){return Vs({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Kn,Jn="custom",Yn="i.posthog.com",Qn=/^\/static\//,Xn=["/s/","/e/","/i/"],Zn=class{constructor(e){this._regionCache={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Yn,".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":Jn),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(Qn.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=js(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}_prepareEndpoint(e,t,i){if("ui"===e)return i;var s=i,r=this.instance.config.rewriteRequestPath;if(r){var n,o=(null==(n=js(i))?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&"api"===e&&Xn.some(e=>0===t.indexOf(e))){var a=this._urlKey(s);if(a){var l,d=this.apiHost,u=this._ingestionEndpoints;(null==(l=u)?void 0:l.apiHost)===d&&u.rewriteRequestPath===r||(this._ingestionEndpoints=u={apiHost:d,rewriteRequestPath:r,urls:new Set}),u.urls.add(a)}}return s}isIngestionEndpoint(e){var 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(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this._prepareEndpoint(e,t,this.uiHost+t);if("flags"===e)return this._prepareEndpoint(e,t,this.flagsApiHost+t);if("assets"===e){var i=this._staticAssetHostOverride(t);if(i)return this._prepareEndpoint(e,t,""+i+t)}if(this.region===Jn)return this._prepareEndpoint(e,t,this.apiHost+t);var s=Yn+t;switch(e){case"assets":return this._prepareEndpoint(e,t,"https://"+this.region+"-assets."+s);case"api":return this._prepareEndpoint(e,t,"https://"+this.region+"."+s)}}},eo=Ki("[Surveys]"),to={ignoreConditions:!1,ignoreDelay:!1,displayType:$r.Popover},io=Ki("[PostHog ExternalIntegrations]"),so={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},ro=class{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=it.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return io.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(){var t,s,r,n=i[0],o=i[1];!o||null!=(t=it.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(so[n],()=>{var t;null==(t=it.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(s=it.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=it.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())};for(var i of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t()}}},no=class{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var t=this;return r(function*(){if(t._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');t._extensions.set(e.name,e);try{var i=e.setup(t._client);i&&(yield i)}catch(i){var 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){this._disposed=!0;var e=Array.from(this._extensions.values()).reverse();for(var t of(this._extensions.clear(),e))this._disposeExtension(t)}}_disposeExtension(e){try{var t=null==e.dispose?void 0:e.dispose();t&&ct(t.then)&&t.then(void 0,t=>{this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)})}catch(t){this._logger.error('Failed to dispose browser extension "'+e.name+'"',t)}}},oo=class{constructor(e){this._instance=e}initialize(){}get(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var i={};for(var s of e){var r=null==t?void 0:t.get_property(s);gt(r)||(i[s]=r)}return i}set(e,t){var i;null==(i=this._instance.persistence)||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}},ao="extensionsRemoteConfig",lo=class{constructor(e){this.instance=e,this._disposed=!1,this._logger=zi,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new oo(e),this.onEvent=e=>Fr(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 Fr(()=>{});var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(ao,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Fr(i)},this._runtime=new no(zi.createLogger("[BrowserExtensions]"),this)}get logger(){return this._logger}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(u);return"string"==typeof e?e:void 0}get library(){return{name:a.LIB_NAME,version:a.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s,r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==r?void 0:r.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==r?void 0:r.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.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 r(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 Fr(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(ao,e))}sendRequest(e,t){var i=this;return r(function*(){var s;void 0===t&&(t={});var r=i.instance.requestRouter.endpointFor(null!==(s=t.target)&&void 0!==s?s:"api",e),n={method:t.method,url:t.query?En(r,t.query):r,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:"flags"===t.target&&"best-available"===t.compression?st.Base64:void 0,timestampMode:t.sentAt};return"sendBeacon"===t.transport?(i.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,i.instance._send_request(n)})})()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}},uo={},_o=0,co=()=>{},ho='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',po="Surveys module not available",go="sanitize_properties is deprecated. Use before_send instead",vo="Invalid value for property_denylist config: ",fo=/^[A-Za-z0-9_-]{1,400}$/,mo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,yo=["token","distinct_id",Ee],bo="posthog",wo=!bn&&-1===(null==et?void 0:et.indexOf("MSIE"))&&-1===(null==et?void 0:et.indexOf("Mozilla")),So=e=>{var t={};return e&&"unset"!==e?("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0),t):t},Po=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:is(null==Ke?void 0:Ke.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:co,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Je&&vt(null==Je?void 0:Je.search)&&-1!==Je.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==Ve||null==(t=Ve.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){zi.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:Ne,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:co},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Os,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:So(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},Eo=[["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"]],ko=e=>{var t={};for(var i of Eo){var s=i[0],r=i[1];gt(e[s])||(t[r]=e[s])}var n=Qi({},t,e),o=e.__preview_external_dependency_versioned_paths;return gt(o)||(gt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),vt(o)&&gt(e.asset_host)&&(n.asset_host=o)),_t(e.property_blacklist)&&(gt(e.property_denylist)?n.property_denylist=e.property_blacklist:_t(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:zi.error(vo+e.property_denylist)),n},Co=class{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){zi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},xo=(e=class e{_removeExtension(e){if(e){var t=this._extensions.indexOf(e);-1!==t&&this._extensions.splice(t,1)}}_replaceExtension(e,t){return this._removeExtension(e),this._extensions.push(t),null==t.initialize||t.initialize(),t}_inCookielessMode(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_warnIfVolatileIdentityWithoutStableId(){if(!(this._hasWarnedAboutVolatileIdentity||this.config.reuseAnonymousId||this.config.segment||this._inCookielessMode())){var e,t,i,s="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(s||this.config.disable_persistence)&&(this._hasStableInitialDistinctId||(s?(e="persistence is set to '"+this.config.persistence+"'",t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._hasWarnedAboutVolatileIdentity=!0,console.warn("[PostHog.js]",e+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+t+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+i)))}}_healCookielessSentinelDistinctId(){if(!this._inCookielessMode()&&"$posthog_cookieless"===this.get_distinct_id()){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){var i=this.config.get_device_id(us());this.register({distinct_id:i,$device_id:i}),e.set_property(ve,De)}this._sync_opt_out_with_persistence()}}}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this._isPageUnloading=!1,this._isShutdown=!1,this.webPerformance=new Co,this._personProcessingSetOncePropertiesSent=!1,this.version=a.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new qn,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Po(),this.SentryIntegration=Bs,this.sentryIntegration=e=>function(e,t){var i=Ns(e,t);return{name:Ls,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 Nn(this),this.pageViewManager=new Us(this),this.rateLimiter=new Dr(this),this.requestRouter=new Zn(this),this.consent=new Rs(this),this.externalIntegrations=new ro(this);var i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{var s=vt(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=vt(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>zi.info('send "'+(null==e?void 0:e.event)+'"',e))}init(t,i,s){if(s&&s!==bo){var r,n=null!==(r=uo[s])&&void 0!==r?r:new e;return n._init(t,i,s),uo[s]=n,uo[bo][s]=n,n}return this._init(t,i,s)}_init(e,t,s){var r,n,o;void 0===t&&(t={});var l,d=vt(e)?e.trim():"";if(!d)return zi.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return d!==(null==(l=this.config)?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('"+d+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Po(t.defaults),t.debug=this._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person);var u=Po(t.defaults),c=ko(t),h=Qi({},u,c,{name:s,token:d});ht(u.rageclick)&&ht(c.rageclick)&&(h.rageclick=Qi({},u.rageclick,c.rageclick)),ht(u.session_recording)&&ht(c.session_recording)&&(h.session_recording=Qi({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&zi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:yr.GZipJS;var p=this._is_persistence_disabled();if(this.persistence=new mr(this.config,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mr(i({},this.config,{persistence:"sessionStorage"}),p,!1),this._sessionRegisteredPropertiesStorageKey="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!p&&Fs._is_supported()){var g=Fs._parse(this._sessionRegisteredPropertiesStorageKey);_t(g)&&g.forEach(e=>{vt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Fs._remove(this._sessionRegisteredPropertiesStorageKey);var v=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Dn(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new Ln(this),this.__request_queue=[];var m=this._inCookielessMode();m||(this.sessionManager=new Wn(this),this.sessionPropsManager=new Un(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this._clearSessionRegisteredProps()})),this._enrollFeatureFlags(),this.config.__preview_deferred_init_extensions?(zi.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(m)},0)):(zi.info("Initializing extensions synchronously"),this._initExtensions(m)),a.DEBUG=a.DEBUG||this.config.debug,a.DEBUG&&zi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:v,s:f}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var y=null==(n=t.bootstrap)?void 0:n.distinctID;if(this._hasStableInitialDistinctId=!!y&&!ft(y),null!=(o=t.bootstrap)&&o.distinctID){var b=t.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(ve);if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"anonymous"===S)this.identify(b);else if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&"identified"===S)zi.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var P=this.config.get_device_id(us()),E=t.bootstrap.isIdentifiedID?P:b;this.persistence.set_property(ve,t.bootstrap.isIdentifiedID?Le:De),this.register({distinct_id:b,$device_id:E})}}if(m)this.register_once({distinct_id:Pe,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(us());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(ve,De)}return ss(Ve,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ss(Ve,"pageshow",()=>{var e;this._isPageUnloading=!1,this._isShutdown||null==(e=this._retryQueue)||e.resume()}),t.segment?Ds(this,()=>this._loaded()):this._loaded(),ct(this.config._onCapture)&&this.config._onCapture!==co&&(zi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&zi.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 Vn.apply(this,arguments)}().then(e=>{e&&this.register({[_]:e})}).catch(co),this}_isSharedExtension(e){var t=e;return vt(t.name)&&ct(t.setup)}_enrollExtension(e,t){this._isSharedExtension(e)?t.push(()=>{this._getBrowserClientAdapter().add(e).catch(()=>null==e.dispose?void 0:e.dispose()).catch(t=>{zi.error('Failed to dispose browser extension "'+e.name+'"',t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var t,i,s,r,n,o,a=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(s=e.__defaultExtensionClasses)?void 0:s.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this._featureFlagsReloadingUnsubscribe)||o.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new a(this)),ct(this.featureFlags.onReloading)&&ct(this.featureFlags.setup)?this._featureFlagsReloadingUnsubscribe||(this._featureFlagsReloadingUnsubscribe=this.featureFlags.onReloading(()=>{this._internalEventEmitter.emit("featureFlagsReloading",!0)}),this._getBrowserClientAdapter().add(this.featureFlags)):null==(r=(n=this.featureFlags).initialize)||r.call(n))}_initExtensions(t){var s,r,n,o,a,l,d,u=performance.now(),_=i({},e.__defaultExtensionClasses,this.config.__extensionClasses),c=[];_.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new _.exceptions(this)),_.historyAutocapture&&this._extensions.push(this.historyAutocapture=new _.historyAutocapture(this)),_.tracingHeaders&&this._extensions.push(this.tracingHeaders=new _.tracingHeaders(this)),_.siteApps&&this._extensions.push(this.siteApps=new _.siteApps(this)),_.sessionRecording&&!t&&this._extensions.push(this.sessionRecording=new _.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),_.autocapture&&this._enrollExtension(this.autocapture=new _.autocapture(this),c),_.surveys&&this._enrollExtension(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new _.surveys(this),c),_.logs&&this._enrollExtension(this.logs=null!==(n=this.logs)&&void 0!==n?n:new _.logs(this),c),_.metrics&&this._extensions.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new _.metrics(this)),_.conversations&&this._extensions.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new _.conversations(this)),_.productTours&&this._extensions.push(this.productTours=new _.productTours(this)),_.heatmaps&&this._extensions.push(this.heatmaps=new _.heatmaps(this)),_.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new _.webVitalsAutocapture(this)),_.exceptionObserver&&this._extensions.push(this.exceptionObserver=new _.exceptionObserver(this)),_.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new _.deadClicksAutocapture(this,As)),_.toolbar&&this._extensions.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new _.toolbar(this)),_.experiments&&this._extensions.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new _.experiments(this)),this._extensions.forEach(e=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this._processInitTaskQueue(c,u)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){zi.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[ke]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ce]:s}),this.config.__preview_deferred_init_extensions&&zi.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!Ke||!Ke.body)return zi.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,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=ot(s.supportedCompression,yr.GZipJS)?yr.GZipJS:ot(s.supportedCompression,yr.Base64)?yr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Ne}),null==(t=this._browserClientAdapter)||t.handleRemoteConfig(e),this._extensions.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}_loaded(){try{this.config.loaded(this)}catch(e){zi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=Je&&Je.hostname){var e=Je.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 Nr(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&Ji(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,r;this._isPageUnloading=!0,null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(He),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(He,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?wo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=i({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(gt(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,s,r,n=i({},e);n.timeout=n.timeout||6e4;var o,a,l,d,u,_=null!==(t=n.transport)&&void 0!==t?t:"fetch";"sendBeacon"===_&&gt(n.compression)&&n.data&&(n.compression=yr.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(d=(_t(o=n.data)?o:[o]).map(e=>i({},e,e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:d,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(e,t){return void 0===t&&(t=(new Date).toISOString()),_t(e)?e.map(e=>i({},e,{sent_at:t})):i({},e,{sent_at:t})}(n.data))),n.url=An(n.url,n.method,n.compression,n.timestampMode);var c=Mn.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),h=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(t(e[i]))return e[i]}(c,e=>e.transport===_))?void 0:r.method)&&void 0!==s?s:c[0].method;if(!h)throw new Error("No available transport method");var p=e=>{try{h(e)}catch(e){$n(e)?zi.warn(e):zi.error(e),null==n.callback||n.callback({statusCode:0,error:e})}};"sendBeacon"!==_&&n.data&&n.compression===yr.GZipJS&&Ze&&"undefined"!=typeof Promise&&!Sn?Tn(n).then(e=>{p(e)}).catch(t=>{if(Hi(t))return Sn=!0,void p(i({},n,{compression:void 0,url:An(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return Hi(e)||t===Bi})(t)&&(Sn=!0),p(n)}):h(n)})(i({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){_o++;try{var t,i=[],s=[],r=[];Ji(e,e=>{if(e)if(_t(t=e[0]))r.push(e);else if(ct(e))try{e.call(this)}catch(t){zi.error("Error executing queued PostHog call",e,t)}else _t(e)&&"alias"===t?i.push(e):_t(e)&&-1!==t.indexOf("capture")&&ct(this[t])?r.push(e):s.push(e)});var n=function(e,t){Ji(e,function(e){try{if(_t(e[0])){var i=t;Yi(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){zi.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{_o--}}push(t){if(_o>0&&_t(t)&&vt(t[0])){var i=e.prototype[t[0]];ct(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}_getPersistedFacebookClickId(){var e,t=null==(e=this.persistence)?void 0:e.get_property(g);return vt(t)&&mo.test(t)?{value:t,delivered:!1}:ht(t)&&vt(t.value)&&mo.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,i,s){if(this.persistence){this.persistence.refreshKey(g);var r=this._getPersistedFacebookClickId();if(!s){if(i)return vt(t)&&mo.test(t)?(t!==(null==r?void 0:r.value)&&this.persistence.register({[g]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==r?void 0:r.value)||!r.delivered}):void this.persistence.unregister(g);if(vt(e)&&fo.test(e)){if((null==r?void 0:r.value.split(".")[3])===e)return{value:r.value,pending:!r.delivered};var n="fb.1."+Date.now()+"."+e;return this.persistence.register({[g]:{value:n,delivered:!1}}),{value:n,pending:!0}}return r?{value:r.value,pending:!r.delivered}:void 0}this.persistence.unregister(g)}}_markFacebookClickIdDelivered(e){if(this.persistence){this.persistence.refreshKey(g);var t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[g]:{value:e,delivered:!0}})}}capture(e,t,s){var r,n,o,a,l,d,u,_,c,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!gt(e)&&vt(e)){this._healCookielessSentinelDistinctId();var g=!this.config.opt_out_useragent_filter&&this._is_bot();if(!g||this.config.__preview_capture_bot_pageviews){var v=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==v||!v.isRateLimited){var f;null!=t&&t.$current_url&&!vt(null==t?void 0:t.$current_url)&&(zi.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!=s&&s._originatedFromCaptureException||zi.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&&(f=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var m=new Date,y=(null==s?void 0:s.timestamp)||m,b=Ai(null==s?void 0:s.uuid,us),w={uuid:b,event:e,properties:this.calculateEventProperties(e,t||{},y,b)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&g&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),v&&(w.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);var S="$feature_flag_called"===e&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=s&&s.$set&&!S&&(w.$set=null==s?void 0:s.$set);var P=ht(null==t?void 0:t.$set)?t.$set:void 0,E=!(null==s||!s.$set)&&"$fbc"in s.$set,k=E||!!P&&"$fbc"in P,C=E?null==s||null==(r=s.$set)?void 0:r[p]:null==P?void 0:P[p],x=_t(null==t?void 0:t.$unset)?t.$unset:[],T=(null==s?void 0:s.$unset)||[],I=-1!==x.indexOf("$fbc")||-1!==T.indexOf("$fbc"),F=this._updateFacebookClickId(null==(n=f)?void 0:n.fbclid,C,k,I);F&&!0===w.properties.$process_person_profile&&F.pending&&!k&&!S&&(w.$set=i({[p]:F.value},w.$set));var R=null==s?void 0:s.$unset;R&&(w.$unset=R);var O=S?void 0:this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==We,e===Ge);if(O&&(w.$set_once=O),null!=s&&s._noTruncate||(u=this.config.properties_string_max_length,_=w,c=e=>vt(e)?e.slice(0,u):e,h=new Set,w=function e(t,i){if(t!==Object(t))return c?c(t):t;if(!h.has(t)){var s;if(h.add(t),_t(t))s=[],Ji(t,t=>{s.push(e(t))});else{var r={};Yi(kt(t)?es(t):t,(t,i)=>{h.has(t)||(r[i]=e(t,i))}),s=r}return s}}(_)),w.timestamp=y,gt(null==s?void 0:s.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),S&&(w.properties=function(e,t){void 0===t&&(t=[]);var i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return Ni.forEach(s),t.forEach(s),i}(w.properties,yo)),e===Tr.DISMISSED||e===Tr.SENT){var A=null==t?void 0:t[Ir.SURVEY_ID],M=null==t?void 0:t[Ir.SURVEY_ITERATION];(e=>{try{var t=(e=>((e,t)=>"seenSurvey_"+function(e){return e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id}(t))(0,e))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){eo.error("Failed to persist survey seen state",e)}})({id:A,current_iteration:M}),w.$set=i({},w.$set,{[jn({id:A,current_iteration:M},e===Tr.SENT?"responded":"dismissed")]:!0})}else e===Tr.SHOWN&&(w.$set=i({},w.$set,{[Ir.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Or.SHOWN){var D=null==t?void 0:t[Ar.TOUR_TYPE];D&&(w.$set=i({},w.$set,{[Ar.TOUR_LAST_SEEN_DATE+"/"+D]:(new Date).toISOString()}))}var L=i({},w.properties.$set,w.$set);if(pt(L)||this.setPersonPropertiesForFlags(L),!yt(this.config.before_send)){var N=this._runBeforeSend(w);if(!N)return;(w=N).uuid=Ai(w.uuid,us)}var B=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:ht(null==(l=w.properties)?void 0:l.$set)?w.properties.$set.$fbc:void 0,U=null!=F&&F.pending&&B===F.value?F.value:void 0;this._internalEventEmitter.emit("eventCaptured",w);var q,H=null!==(d=null==s?void 0:s._url)&&void 0!==d?d:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=i({method:"POST",url:H,data:w,compression:"best-available",timestampMode:"recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(H)?"body":"capture-body",batchKey:null==s?void 0:s._batchKey},null!=s&&s.transport?{transport:s.transport}:{},U?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this._markFacebookClickIdDelivered(U)}}:{});return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly||U?(!G.transport&&!G.callback&&pt(null!==(q=this.config.request_headers)&&void 0!==q?q:{})&&this._isPageUnloading&&(G.transport="sendBeacon"),this._send_retriable_request(G)):this._requestQueue.enqueue(G),w}zi.critical("This capture call is ignored due to client rate limiting.")}}else zi.error("No event name provided to posthog.capture")}else zi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this._browserClientAdapter)?void 0:t.getExtension(e)}_getBrowserClientAdapter(){var e;return null!==(e=this._browserClientAdapter)&&void 0!==e?e:this._browserClientAdapter=new lo(this)}_registerExtensionEventProperties(e){this._extensionEventPropertyProducers.push(e);var t=!0;return()=>{if(t){t=!1;var i=this._extensionEventPropertyProducers.indexOf(e);-1!==i&&this._extensionEventPropertyProducers.splice(i,1)}}}_processCookieIdentityChange(e){var t,i,s;return void 0===e&&(e=!0),!(null==(t=this.persistence)||!t.consumeCookieIdentityChange())&&(this._cachedPersonProperties=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(s=this.sessionPersistence)||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var a=n?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this._inCookielessMode()&&(l[Ee]=!0),"$snapshot"===e){var d=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=d.distinct_id,(!vt(l.distinct_id)&&!bt(l.distinct_id)||ft(l.distinct_id))&&zi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,_=function(e,t,i,s){var r,n,a,l;if(void 0===s&&(s=!1),!et)return{};var d,u=e?[...Js,...t||[]]:[],_=function(e){for(var t=0;Ii.length>t;t++){var i=Ii[t],s=i[1],r=i[0].exec(e),n=r&&(ct(s)?s(r,e):s);if(n)return n}return["",""]}(et),c=_[0],h=_[1],p=function(e){for(var t=0;Ri.length>t;t++){var i,s=Ri[t],r=s[1],n=s[2],o=e.match(s[0]);if(o)return[r,(null==(i=n&&e.match(n)||o)?void 0:i[1])||""]}return["",""]}(et),g=p[0],v=p[1],f=null!=(d="u">typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};gt(i)||(m.detectGoogleSearchApp=i);var y={},b=null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,w=null==(n=navigator)?void 0:n.maxTouchPoints,S=null==Ve||null==(a=Ve.screen)?void 0:a.width,P=null==Ve||null==(l=Ve.screen)?void 0:l.height,E=null==Ve?void 0:Ve.devicePixelRatio;gt(b)||(y.userAgentDataPlatform=b),gt(w)||(y.maxTouchPoints=w),gt(S)||(y.screenWidth=S),gt(P)||(y.screenHeight=P),gt(E)||(y.devicePixelRatio=E);var k,C,x,T,I,F,R,O,A=Qi(Zi({$os:c,$os_version:h,$browser:Ci(et,navigator.vendor,f,m),$webview_app:g,$webview_app_version:v,$device:$i(et),$device_type:(C=et,x=y,O=$i(C),O===Dt||O===Mt||"Kobo"===O||"Kindle Fire"===O||O===ni?At:O===Jt||O===Qt||O===Yt||O===si?"Console":O===Lt?"Wearable":O?Rt:"Android"===(null==x?void 0:x.userAgentDataPlatform)&&(null!==(T=null==x?void 0:x.maxTouchPoints)&&void 0!==T?T:0)>0?600>Math.min(null!==(I=null==x?void 0:x.screenWidth)&&void 0!==I?I:0,null!==(F=null==x?void 0:x.screenHeight)&&void 0!==F?F:0)/(null!==(R=null==x?void 0:x.devicePixelRatio)&&void 0!==R?R:1)?Rt:At:"Desktop"),$timezone:or(),$timezone_offset:ar()}),{$current_url:Ks(s?Di(null==Je?void 0:Je.href):null==Je?void 0:Je.href,u,Qs),$host:null==Je?void 0:Je.host,$pathname:null==Je?void 0:Je.pathname,$raw_user_agent:et.length>1e3?et.substring(0,997)+"...":et,$browser_version:Ti(et,navigator.vendor,f,m),$browser_language:tr(),$browser_language_prefix:(k=tr(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==Ve?void 0:Ve.screen.height,$screen_width:null==Ve?void 0:Ve.screen.width,$viewport_height:null==Ve?void 0:Ve.innerHeight,$viewport_width:null==Ve?void 0:Ve.innerWidth,$lib:o.LIB_NAME,$lib_version:o.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return o.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=o.SDK_DIST_CHANNEL),A}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var c=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0),h=c.windowId;l.$session_id=c.sessionId,l.$window_id=h}this.sessionPropsManager&&Qi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Qi(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Jn&&(l.$lib_custom_api_host=this.config.api_host),u="$pageview"!==e||n?"$pageleave"!==e||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=Qi(l,u),"$pageview"===e&&Ke&&(l.title=Ke.title),!gt(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}et&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var v=this.persistence.properties(),f=this.sessionPersistence.properties(),m=l.$groups,y=v.$groups;ht(m)&&!pt(m)&&(l.$groups=i({},ht(y)?y:{},m)),Yi(["$referrer","$referring_domain"],e=>{e in v&&delete f[e]});var b={};if(this._extensionEventPropertyProducers.length>0)for(var w of this._extensionEventPropertyProducers.slice())try{Qi(b,w())}catch(e){zi.error("Failed to produce browser extension event properties",e)}(l=Qi({},_,v,f,i({},b,l))).$is_identified=this._isIdentified(),_t(this.config.property_denylist)?Yi(this.config.property_denylist,function(e){delete l[e]}):zi.error(vo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(zi.error(go),l=S(l,e));var P=this._hasPersonProcessing();return l.$process_person_profile=P,P&&!n&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=Qi({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(zi.error(go),r=n(r,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),pt(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t,i;null==(t=this.persistence)||t.syncCookieProperties(),this._processCookieIdentityChange(),null==(i=this.sessionPersistence)||i.register(e),Object.keys(e).forEach(e=>this._sessionRegisteredPropKeys.add(e)),this._persistSessionRegisteredPropKeys()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this._sessionRegisteredPropKeys.delete(e),this._persistSessionRegisteredPropKeys()}_register_single(e,t){this.register({[e]:t})}_clearSessionRegisteredProps(){this._sessionRegisteredPropKeys.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()}_persistSessionRegisteredPropKeys(){var e;if(this._sessionRegisteredPropertiesStorageKey)if("memory"===this.config.persistence||null!=(e=this.sessionPersistence)&&e._disabled||!Fs._is_supported())Fs._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Fs._set(this._sessionRegisteredPropertiesStorageKey,t):Fs._remove(this._sessionRegisteredPropertiesStorageKey)}}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?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:po}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:po})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:po})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=to),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:po}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:po})}_validateIdentifyId(e){return!e||ft(e)?(zi.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(zi.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())||(zi.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 zi.uninitializedWarning("posthog.identify");if(bt(e)&&(e=e.toString(),zi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){this._healCookielessSentinelDistinctId();var s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this._processCookieIdentityChange(!1),o=this.persistence._beginCookieSyncSuppression(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(c),this.register({distinct_id:e}));var d=(this.persistence.get_property("$user_state")||"anonymous")===De,u=e!==l,_=!u&&d;if(u&&d){var h,p=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(ve,Le),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(Ge,p,{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=zn(e,t,i),null==(h=this.featureFlags)||h.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(_){this.persistence.set_property(ve,Le);var g=t||{},v=i||{};this.setPersonPropertiesForFlags({$set:g,$set_once:v},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:g,$set_once:v}),this._cachedPersonProperties=zn(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);u||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ce)):_&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence._endCookieSyncSuppression(a)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=zn(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):zi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(_t(e)?e:[e]).filter(e=>vt(e)&&e.length>0);0!==i.length&&this._requirePersonProcessing("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this._cachedPersonProperties=null)}group(e,t,s){var r;if(e&&t){null==(r=this.persistence)||r.syncCookieProperties(),this._processCookieIdentityChange();var n=this.getGroups(),o=n[e]!==t;if(o&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},n,{[e]:t})}),(o||s)&&this._hasPersonProcessing()){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(We,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),o&&!s&&this.reloadFeatureFlags()}else zi.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t=St(e)?e:null==e?void 0:e.resetDeviceID,i=St(e)||null==e?void 0:e.bootstrap;this._reset(t,!1,i)}_reset(e,t,s){var r,n,o,a;if(void 0===t&&(t=!1),zi.info("reset"),!this.__loaded)return zi.uninitializedWarning("posthog.reset");var l=null==s?void 0:s.sessionID;this.config.bootstrap=s||(null==(r=this._originalUserConfig)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags());var d=this.get_property(u),c=this.get_property(_),h=this.get_property(x);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var 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.");var g=null==(a=this.persistence)||null==a._beginCookieSyncSuppression?void 0:a._beginCookieSyncSuppression(),v=!1;try{var f,m,y,b,w,S,P,E,k,C,T,I,F;if(null==(f=this.persistence)||f.clear(),null==(m=this.sessionPersistence)||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),gt(h)||null==(y=this.persistence)||y.register({[x]:h}),null==(b=this.surveys)||b.reset(),null==(w=this.featureFlags)||w.reset(),null==(S=this.conversations)||S.reset(),null==(P=this.logs)||P.reset(),null==(E=this.metrics)||E.reset(),null==(k=this.persistence)||k.set_property(ve,De),null==(C=this.sessionManager)||C.resetSessionId(),this._cachedPersonProperties=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Pe,$device_id:null},"");else{var R=this.config.get_device_id(us());this.register_once({distinct_id:R,$device_id:e?R:d},""),e||gt(c)||this.register({[_]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),s)if(s.distinctID&&!this._inCookielessMode()&&(null==(F=this.persistence)||F.set_property(ve,s.isIdentifiedID?Le:De),this.register({distinct_id:s.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(yt(l)||null!=(I=this.sessionManager)&&I.setBootstrapSessionId(l,!0))){var O=i({},s);delete O.sessionID,this.config.bootstrap=O}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var A;g&&(null==(A=this.persistence)||null==A._endCookieSyncSuppression||A._endCookieSyncSuppression(v))}this.reloadFeatureFlags()}shutdown(e){var t=this;return r(function*(){var e,i,s,r,n,o,a;if(t.__loaded){t._isShutdown=!0,t._getBrowserClientAdapter().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(i=t.logs)||i.flushLogs("sendBeacon"),null==(s=t.metrics)||s.flush("sendBeacon"),null==(r=t._requestQueue)||r.unload(),null==(n=t._retryQueue)||n.unload();try{var l;null==(l=t.featureFlags)||l.destroy()}catch(e){zi.error("Error while destroying feature flags",e)}null==(o=t.persistence)||o.destroy(),null==(a=t.sessionPersistence)||a.destroy()}else zi.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)||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)||e._onIdentityCleared()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(zi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(gt(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(c,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(zi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(ht(e)){var s,r,n,o,l,d,u,_,c,h,p,g,v;Qi(this.config,ko(e));var f=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new mr(i({},this.config,{persistence:"sessionStorage"}),f,!1);var m=this._checkLocalStorageForDebug(this.config.debug);St(m)&&(this.config.debug=m),St(this.config.debug)&&(this.config.debug?(a.DEBUG=!0,fs._is_supported()&&fs._set("ph_debug",!0),zi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(a.DEBUG=!1,fs._is_supported()&&fs._remove("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this._shouldDisableFlags()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(d=this.tracingHeaders)||d.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(_=this.heatmaps)||_.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(c=this.historyAutocapture)||c.startIfEnabledOrStop()),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(p=this.deadClicksAutocapture)||p.startIfEnabledOrStop(),null==(g=this.surveys)||g.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(v=this.externalIntegrations)||v.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Ds(this,co,!1)}}_overrideSDKInfo(e,t){a.LIB_NAME=e,a.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){try{if(!this.exceptions)return;var s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(i({},s,t))}catch(e){return}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:e._noopLogger}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!==(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:bo;return t!==bo&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&pt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e.__alias)&&(null==(t=this.persistence)||null==(t=t.props)||!t.$epp))}_shouldCapturePageleave(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(zi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(Se,!0),!0)}_is_persistence_disabled(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_sync_opt_out_with_persistence(){var e,t,i,s,r,n=this._is_persistence_disabled();return this.is_capturing()||null==(e=this.logs)||e._onOptOut(),(null==(t=this.persistence)?void 0:t._disabled)!==n&&(null==(i=this.persistence)||i.set_disabled(n)),(null==(s=this.sessionPersistence)?void 0:s._disabled)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(t){var i,s,r;if("always"!==this.config.cookieless_mode){if(this._inCookielessMode()){var n,o,a,l,d,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Wn(this),this.pageViewManager=new Us(this),this.persistence&&(this.sessionPropsManager=new Un(this,this.sessionManager,this.persistence));var _,c=null!==(l=null==(d=this.config.__extensionClasses)?void 0:d.sessionRecording)&&void 0!==l?l:null==(u=e.__defaultExtensionClasses)?void 0:u.sessionRecording;c&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new c(this)),this._lastRemoteConfig&&(null==(_=this.sessionRecording)||null==_.onRemoteConfig||_.onRemoteConfig(this._lastRemoteConfig)))}this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(s=this.surveys)||s.loadIfEnabled()),(gt(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(r=null==t?void 0:t.captureEventName)&&void 0!==r?r:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else zi.warn(ho)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var e,t,i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.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:Pe,$device_id:null}),this._removeExtension(i),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._captureInitialPageview(),this._start_queue_if_opted_in())}else zi.warn(ho)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return ze?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&$t(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>$t(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}(ze,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Ke&&("visible"===Ke.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(qe,{title:Ke.title},{send_instantly:!0}),this._visibilityStateListener&&(Ke.removeEventListener(Be,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ss(Ke,Be,this._visibilityStateListener)))}debug(e){!1===e?(null==Ve||Ve.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Ve||Ve.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}_shouldDisableFlags(){var e=this._originalUserConfig||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(zi.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,r){var n=t in e&&!yt(e[t]),o=i in e&&!yt(e[i]);return n?e[t]:!!o&&(r&&r.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,zi)}_runBeforeSend(e){var t;if(yt(this.config.before_send))return e;var i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(Et),s=_t(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s)try{if(r=n(r),yt(r)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Pt(e.event)?zi.warn(o+". This can cause unexpected behavior."):zi.info(o),null}r.properties&&!pt(r.properties)||zi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return zi.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of i)if(r.properties&&yt(r.properties[a]))return zi.warn("Event '"+e.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}_checkLocalStorageForDebug(e){var t=St(e)&&!e,i=fs._is_supported()&&"true"===fs._get("ph_debug");return!t&&(!!i||e)}},e.__defaultExtensionClasses={},e._noopLogger={trace:Kn=()=>{},debug:Kn,info:Kn,warn:Kn,error:Kn,fatal:Kn},e);!function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=Xi(e.prototype[t[i]])}(xo,["identify"]);var To=function(){a.SDK_DIST_CHANNEL="npm";var e=uo[bo]=new xo;return function(){function e(){e.done||(e.done=!0,wo=!1,Yi(uo,function(e){e._dom_loaded()}))}null!=Ke&&Ke.addEventListener?"complete"===Ke.readyState?e():ss(Ke,"DOMContentLoaded",e,{capture:!1}):Ve&&zi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{yr as Compression,Rr as DEFAULT_PRODUCT_TOUR_APPEARANCE,$r as DisplaySurveyType,xo as PostHog,Or as ProductTourEventName,Ar as ProductTourEventProperties,Tr as SurveyEventName,Ir as SurveyEventProperties,br as SurveyEventType,Sr as SurveyPosition,Cr as SurveyQuestionBranchingType,kr as SurveyQuestionType,xr as SurveySchedule,Pr as SurveyTabPosition,Er as SurveyType,wr as SurveyWidgetType,To as default,To as posthog,Br as severityLevels};
2
2
  //# sourceMappingURL=module.slim.no-external.js.map