posthog-js 1.428.1 → 1.428.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.full.js.map +1 -1
- package/dist/customizations.js +1 -1
- package/dist/customizations.js.map +1 -1
- package/dist/dead-clicks-autocapture.js.map +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(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 t(t){return function(){var i=this,s=arguments;return new Promise(function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)})}}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)}var s={DEBUG:!1,LIB_VERSION:"0.8.1",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.428.1",s.LIB_NAME="web";var r="$people_distinct_id",n="distinct_id",o="$device_id",a="$device_model",l="__alias",d="__cmpns",u="$fbc",_="$fbc_persistence",c="__timers",h="$autocapture_disabled_server_side",p="$heatmaps_enabled_server_side",g="$exception_capture_enabled_server_side",v="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",m="$web_vitals_enabled_server_side",y="$dead_clicks_enabled_server_side",b="$product_tours_enabled_server_side",w="$logs_capture_enabled_server_side",S="$web_vitals_allowed_metrics",P="$session_recording_remote_config",E="$session_recording_enabled_server_side",C="$replay_sample_rate",k="$replay_override_sampling",x="$replay_override_linked_flag",I="$replay_override_url_trigger",T="$replay_override_event_trigger",F="$sesid",R="$session_is_sampled",O="$session_past_minimum_duration",A="$session_recording_url_trigger_activated_session",M="$session_recording_event_trigger_activated_session",D="$debug_first_full_snapshot_timestamp",L="$sess_rec_flush_size",N="$enabled_feature_flags",B="$active_feature_flags",U="$early_access_features",q="$feature_flag_details",H="$feature_flag_payloads",G="$feature_flag_request_id",W="$minimal_flag_called_events",V="$override_feature_flags",z="$override_feature_flag_payloads",j="$stored_person_properties",K="$stored_group_properties",Y="$groups",J="$surveys",Q="$surveys_loaded_at",Z="$surveys_activated",X="$surveys_activated_session",ee="$surveys_activated_timestamps",te="ph_product_tours",ie="$product_tours_activated",se="$product_tours_activated_session",re="$conversations_widget_session_id",ne="$conversations_ticket_id",oe="$conversations_widget_state",ae="$conversations_user_traits",le="$flag_call_reported",de="$flag_call_reported_session_id",ue="$feature_flag_errors",_e="$feature_flag_evaluated_at",ce="$user_state",he="$client_session_props",pe="$capture_rate_limit",ge="$initial_campaign_params",ve="$initial_referrer_info",fe="$initial_person_info",me="$epp",ye="$posthog_cookieless",be="$cookieless_mode",we="$sdk_debug_extensions_init_method",Se="$sdk_debug_extensions_init_time_ms",Pe="$sdk_debug_recording_script_not_loaded",Ee="$sdk_debug_replay_event_trigger_status",Ce="$sdk_debug_replay_linked_flag_trigger_status",ke="$sdk_debug_replay_matched_recording_trigger_groups",xe="$sdk_debug_replay_pending_trigger_conditions",Ie="$sdk_debug_replay_remote_trigger_matching_config",Te="$sdk_debug_replay_trigger_groups_count",Fe="$sdk_debug_replay_url_trigger_status",$e="$session_recording_start_reason",Re="on_reject",Oe="always",Ae="anonymous",Me="identified",De="identified_only",Le="visibilitychange",Ne="beforeunload",Be="$pageview",Ue="$pageleave",qe="$identify",He="$groupidentify",Ge="u">typeof window?window:void 0,We="u">typeof globalThis?globalThis:Ge,Ve=null==We?void 0:We.navigator,ze=null==We?void 0:We.document,je=null==We?void 0:We.location,Ke=null==We?void 0:We.fetch,Ye=null!=We&&We.XMLHttpRequest&&"withCredentials"in new We.XMLHttpRequest?We.XMLHttpRequest:void 0,Je=null==We?void 0:We.AbortController,Qe=null==We?void 0:We.CompressionStream,Ze=null==Ve?void 0:Ve.userAgent,Xe="undefined"!=typeof globalThis?globalThis:Ge;Xe&&"undefined"==typeof self&&(Xe.self=Xe),Xe&&"undefined"==typeof File&&(Xe.File=function(){});var et=null!=Ge?Ge:{},tt=["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"],it=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return tt.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function st(e,t){return-1!==e.indexOf(t)}var rt=function(e){return e.replace(/^\$/,"")},nt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ot=["$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"],at=["token"],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=>st(ot,e),Et=e=>st(at,e),Ct=[!0,"true",1,"1","yes"],kt=e=>st(Ct,e),xt=[!1,"false",0,"0","no"];function It(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),It(null!=r?r:i,t,i,s))}var Tt="Mobile",Ft="iOS",$t="Android",Rt="Tablet",Ot=$t+" "+Rt,At="iPad",Mt="Apple",Dt=Mt+" Watch",Lt="Safari",Nt="BlackBerry",Bt="Samsung",Ut=Bt+"Browser",qt=Bt+" Internet",Ht="Chrome",Gt=Ht+" OS",Wt=Ht+" "+Ft,Vt="Internet Explorer",zt=Vt+" "+Tt,jt="Opera",Kt=jt+" Mini",Yt="Edge",Jt="Microsoft "+Yt,Qt="Firefox",Zt=Qt+" "+Ft,Xt="Nintendo",ei="PlayStation",ti="Xbox",ii=$t+" "+Tt,si=Tt+" "+Lt,ri="Windows",ni=ri+" Phone",oi="Nokia",ai="Ouya",li="Generic",di=li+" "+Tt.toLowerCase(),ui=li+" "+Rt.toLowerCase(),_i="Konqueror",ci="Oculus Browser",hi="Vivaldi",pi="Yandex",gi="Whale",vi="DuckDuckGo",fi="Pale Moon",mi="Waterfox",yi="Brave",bi="Claude",wi="Codex",Si="ChatGPT",Pi="Google Search App",Ei="(\\d+(\\.\\d+)?)",Ci=new RegExp("Version/"+Ei),ki=new RegExp("("+bi+"|"+wi+"|"+Si+")\\/"+Ei),xi=new RegExp(ti,"i"),Ii=new RegExp(ei+" \\w+","i"),Ti=new RegExp(Xt+" \\w+","i"),Fi=new RegExp(Nt+"|PlayBook|BB10","i"),$i={"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"},Ri=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?yi:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&st(e,"GSA/")?Pi:st(e," OPR/")&&st(e,"Mini")?Kt:st(e," OPR/")?jt:Fi.test(e)?Nt:st(e,"IE"+Tt)||st(e,"WPDesktop")?zt:st(e,"OculusBrowser")?ci:st(e,Ut)?qt:st(e,Yt)||st(e,"Edg/")?Jt:st(e,hi+"/")?hi:st(e,"YaBrowser/")?pi:st(e,gi+"/")?gi:st(e,vi+"/")||st(e,"Ddg/")?vi:st(e,bi+"/")?bi:st(e,wi+"/")?wi:st(e,Si+"/")?Si:st(e,"FBIOS")?"Facebook "+Tt:st(e,"UCWEB")||st(e,"UCBrowser")?"UC Browser":st(e,"CriOS")?Wt:st(e,"CrMo")||st(e,Ht)?Ht:st(e,$t)&&st(e,Lt)?ii:st(e,"FxiOS")?Zt:st(e.toLowerCase(),_i.toLowerCase())?_i:st(e,yi+"/")?yi:((e,t)=>t&&st(t,Mt)||function(e){return st(e,Lt)&&!st(e,Ht)&&!st(e,$t)}(e))(e,t)?st(e,Tt)?si:Lt:st(e,"PaleMoon/")?fi:st(e,mi+"/")?mi:st(e,Qt)?Qt:st(e,"MSIE")||st(e,"Trident/")?Vt:st(e,"Gecko")?Qt:"")},Oi={[zt]:[new RegExp("rv:"+Ei)],[Jt]:[new RegExp(Yt+"?\\/"+Ei)],[Ht]:[new RegExp("("+Ht+"|CrMo)\\/"+Ei)],[Wt]:[new RegExp("CriOS\\/"+Ei)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ei)],[Lt]:[Ci],[si]:[Ci],[jt]:[new RegExp("(Opera|OPR)\\/"+Ei)],[Qt]:[new RegExp(Qt+"\\/"+Ei)],[Zt]:[new RegExp("FxiOS\\/"+Ei)],[_i]:[new RegExp("Konqueror[:/]?"+Ei,"i")],[Nt]:[new RegExp(Nt+" "+Ei),Ci],[ii]:[new RegExp("android\\s"+Ei,"i")],[qt]:[new RegExp(Ut+"\\/"+Ei)],[ci]:[new RegExp("OculusBrowser\\/"+Ei)],[hi]:[new RegExp(hi+"\\/"+Ei)],[pi]:[new RegExp("YaBrowser\\/"+Ei)],[gi]:[new RegExp(gi+"\\/"+Ei)],[yi]:[new RegExp(yi+"\\/"+Ei)],[bi]:[ki],[wi]:[ki],[Si]:[ki],[vi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ei)],[fi]:[new RegExp("PaleMoon\\/"+Ei)],[mi]:[new RegExp(mi+"\\/"+Ei)],[Pi]:[new RegExp("GSA\\/"+Ei)],[Vt]:[new RegExp("(rv:|MSIE )"+Ei)],Mozilla:[new RegExp("rv:"+Ei)]},Ai=function(e,t,i,s){var r=Ri(e,t,i,s),n=Oi[r];if(gt(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Mi=[[new RegExp(ti+"; "+ti+" (.*?)[);]","i"),e=>[ti,e&&e[1]||""]],[new RegExp(Xt,"i"),[Xt,""]],[new RegExp(ei,"i"),[ei,""]],[Fi,[Nt,""]],[new RegExp(ri,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ni,""];if(new RegExp(Tt).test(t)&&!/IEMobile\b/.test(t))return[ri+" "+Tt,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=$i[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ri,s]}return[ri,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ft,[e[3],e[4],e[5]||"0"].join(".")]:[Ft,""]],[/(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("("+$t+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+$t+")","i"),e=>e&&e[2]?[$t,[e[2],e[3],e[4]||"0"].join(".")]:[$t,""]],[/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/,[Gt,""]],[/Linux|debian/i,["Linux",""]]],Di=function(e){return Ti.test(e)?Xt:Ii.test(e)?ei:xi.test(e)?ti:new RegExp(ai,"i").test(e)?ai:new RegExp("("+ni+"|WPDesktop)","i").test(e)?ni:/iPad/.test(e)?At:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Dt:Fi.test(e)?Nt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(oi,"i").test(e)?oi:/(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(Tt).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)?$t:Ot:new RegExp("(pda|"+Tt+")","i").test(e)?di:new RegExp(Rt,"i").test(e)&&!new RegExp(Rt+" pc","i").test(e)?ui:""},Li=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ni=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Li],[/\bFBAN\/EMA\b/i,"Facebook Lite",Li],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Li],[/\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"]],Bi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ui(e,t){return"string"==typeof(i=e)&&Bi.test(i)?e:t();var i}function qi(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 Hi(e){return e?e.split("#")[0]:e}var Gi,Wi=["$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"],Vi="NativeGzipValidationError",zi=e=>e.length>=2&&31===e[0]&&139===e[1],ji=(e,t)=>e===nt.GZipJS||t===nt.GZipJS||"gzip"===t,Ki=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Yi=e=>{throw qi(Vi,"Native gzip produced invalid output: "+e)},Ji=function(){var e=t(function*(e,t){18>e.size&&Yi("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());zi(i)&&8===i[2]||Yi("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Gi)return Gi;Gi=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;Gi[e]=t>>>0}return Gi})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&Yi("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&Yi("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function Qi(){return Qi=t(function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var e=t(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 Ji(d,r),d}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}}),Qi.apply(this,arguments)}var Zi=function(e,t){var i=(void 0===t?{}:t).debugEnabled,r={_log(t){if(Ge&&(s.DEBUG||Ge.POSTHOG_DEBUG||i)&&!gt(Ge.console)&&Ge.console){for(var r=("__rrweb_original__"in Ge.console[t]?Ge.console[t].__rrweb_original__:Ge.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._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){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Zi(e+" "+t,i)};return r},Xi=Zi("[PostHog.js]"),es=Xi.createLogger;function ts(e,t){_t(e)&&e.forEach(t)}function is(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 ss=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},rs=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){Xi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Xi.critical(e)}}},ns=function(e){var t={};return is(e,function(e,i){(vt(e)&&e.length>0||bt(e))&&(t[i]=e)}),t};var os=["herokuapp.com","vercel.app","netlify.app"];function as(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 os)if(i===s)return!1;return!0}function ls(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 ds=e=>{if(ze){try{for(var t=e+"=",i=ze.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});class us{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new us(r)}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 us(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}}class _s{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 us.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 ps}}var cs,hs=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};Ge&&!gt(Ge.crypto)&&crypto.getRandomValues&&(hs=e=>crypto.getRandomValues(e));class ps{nextUint32(){return this._buffer.length>this._cursor||(hs(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var gs=()=>vs().toString(),vs=()=>(cs||(cs=new _s)).generate(),fs="",ms=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ys=null,bs={_is_supported(){if(!mt(ys))return ys;if(ys=!1,ze)try{var e="__ph_cookie_support_"+gs();bs._set(e,"xyz"),ys='"xyz"'===ds(e),bs._remove(e)}catch(e){ys=!1}return ys},_error(e){Xi.error("cookieStore error: "+e)},_get:ds,_parse(e){var t;try{t=JSON.parse(bs._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!ze)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=ze),fs)return fs;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_"+gs();!fs&&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",fs=n)}return fs}(e);if(!i){var s=(e=>{var t=e.match(ms);return t?t[0]:""})(e);s!==i&&Xi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(ze.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&&Xi.warn("cookieStore warning: large cookie, len="+d.length),ze.cookie=d,!0}catch(e){return!1}},_remove(e,t){if(null!=ze&&ze.cookie)try{bs._set(e,"",-1,t)}catch(e){return}}},ws=null,Ss={_is_supported(){if(!mt(ws))return ws;var e=!0;if(gt(Ge))e=!1;else try{var t="__mplssupport__";Ss._set(t,"xyz"),'"xyz"'!==Ss._get(t)&&(e=!1),Ss._remove(t)}catch(t){e=!1}return e||Xi.error("localStorage unsupported; falling back to cookie store"),ws=e,e},_error(e){Xi.error("localStorage error: "+e)},_get(e){try{return null==Ge?void 0:Ge.localStorage.getItem(e)}catch(e){Ss._error(e)}return null},_parse(e){try{return JSON.parse(Ss._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==Ge||Ge.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Ss._error(e)}return!1},_remove(e){try{null==Ge||Ge.localStorage.removeItem(e)}catch(e){Ss._error(e)}}},Ps=[j,B,N,q,H,G,_e,ue,le],Es=[o,n,F,R,me,fe,_,ce],Cs=e=>e+"_cpm",ks=["__proto__","constructor","prototype"],xs=e=>{if(!ht(e))return{};var t={};return Object.keys(e).forEach(i=>{-1===ks.indexOf(i)&&(t[i]=e[i])}),t},Is=function(e,t){void 0===t&&(t=[]);var i={};return[...Es,...t].forEach(t=>{var s=e[t];gt(s)||mt(s)||""===s||(i[t]=s)}),i},Ts=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)},Fs=(e,t)=>({p:t,f:Ts(JSON.stringify(e))}),$s=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var i=bs._parse(Cs(e)),s=(null==i?void 0:i.f)===Ts(t)&&_t(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},Rs=(e,t)=>t+"|"+(bs._get(Cs(e))||""),Os={},As={_is_supported:()=>!0,_error(e){Xi.error("memoryStorage error: "+e)},_get:e=>e in Os?Os[e]:null,_parse:e=>e in Os?Os[e]:null,_set:(e,t)=>(Os[e]=t,!0),_remove(e){delete Os[e]}},Ms=null,Ds={_is_supported(){if(!mt(Ms))return Ms;if(Ms=!0,gt(Ge))Ms=!1;else try{var e="__support__";Ds._set(e,"xyz"),'"xyz"'!==Ds._get(e)&&(Ms=!1),Ds._remove(e)}catch(e){Ms=!1}return Ms},_error(e){Xi.error("sessionStorage error: ",e)},_get(e){try{return null==Ge?void 0:Ge.sessionStorage.getItem(e)}catch(e){Ds._error(e)}return null},_parse(e){try{return JSON.parse(Ds._get(e))||null}catch(e){}return null},_set(e,t){try{return null==Ge||Ge.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Ds._error(e)}return!1},_remove(e){try{null==Ge||Ge.sessionStorage.removeItem(e)}catch(e){Ds._error(e)}}};class Ls{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===Oe||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Re}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 kt(e)?1:st(xt,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ss:bs,i=t._is_supported()?t:As;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;var s="localStorage"===e?bs:Ss;s._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(kt(s._get(this._storageKey))),s._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==Ve?void 0:Ve.doNotTrack,null==Ve?void 0:Ve.msDoNotTrack,et.doNotTrack,null==Ve?void 0:Ve.globalPrivacyControl].some(e=>kt(e))}}var Ns=["next","previous","prev",">","<","+","-","−","–"];es("[Dead Clicks]");var Bs=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(y)),s=e.instance.config.capture_dead_clicks;return St(s)?s:!!ht(s)||i},Us=es("[SegmentIntegration]");function qs(e,t,i){void 0===i&&(i=!0);var s=e.config.segment;if(!s)return t();!function(e,t,i){var s=e.config.segment;if(!s)return t();var r=s=>{var r=()=>s.anonymousId()||gs();e.config.get_device_id=r,i&&s.id()&&(e.register({distinct_id:s.id(),$device_id:r()}),e.persistence.set_property(ce,Me)),t(i?void 0:s.anonymousId()||void 0)},n=s.user();"then"in n&&ct(n.then)?n.then(r):r(n)}(e,i=>{s.register(((e,t)=>{"undefined"!=typeof Promise&&Promise.resolve||Us.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,s)=>{if(!s)return i;var r=!!t&&i.event.anonymousId===t&&!i.event.userId;r||i.event.userId||i.event.anonymousId===e.get_distinct_id()||(Us.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),i.event.userId&&i.event.userId!==e.get_distinct_id()&&(Us.info("UserId set, identifying with PostHog"),e.identify(i.event.userId));var n=e.calculateEventProperties(s,i.event.properties);return i.event.properties=Object.assign({},n,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return i(e,e.event.event)},page(e){return i(e,Be)},identify(e){return i(e,qe)},screen(e){return i(e,"$screen")}}})(e,i)).then(()=>{t()},e=>{Us.error("Failed to register the Segment integration",e),t()})},i)}var Hs="posthog-js";function Gs(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;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,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==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Ws{constructor(e,t,i,s,r,n){this.name=Hs,this.setupOnce=function(o){o(Gs(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Vs{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Xi.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==Ge?void 0:Ge.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?It(o/n,0,1,Xi):1,c=n>1?It(a/n,0,1,Xi):1,h=l>1?It(d/l,0,1,Xi):1,p=l>1?It(u/l,0,1,Xi):1;s=ss(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}}var zs=["flags","surveys"],js={[r]:{exposure:"hidden"},[l]:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"hidden"},[_]:{exposure:"hidden"},[h]:{exposure:"event"},[p]:{exposure:"hidden"},[w]:{exposure:"hidden"},[g]:{exposure:"event"},[v]:{exposure:"hidden"},[f]:{exposure:"event"},[m]:{exposure:"event"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},[S]:{exposure:"event"},[P]:{exposure:"hidden"},[E]:{exposure:"hidden"},[F]:{exposure:"hidden"},[R]:{exposure:"event"},[C]:{exposure:"event",shouldSkipFromEventProperties:e=>mt(e)},[O]:{exposure:"event"},[A]:{exposure:"event"},[M]:{exposure:"event"},[D]:{exposure:"event"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden",storageGroup:"flags"},[B]:{exposure:"hidden",storageGroup:"flags"},[U]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"flags"},[H]:{exposure:"hidden",storageGroup:"flags"},[G]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[W]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden"},[z]:{exposure:"hidden"},[j]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden",storageGroup:"surveys"},[Q]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Z]:{exposure:"event"},[X]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[te]:{exposure:"hidden"},[ie]:{exposure:"hidden"},[se]:{exposure:"hidden"},[re]:{exposure:"event"},[ne]:{exposure:"event"},[oe]:{exposure:"event"},[ae]:{exposure:"event"},[le]:{exposure:"hidden"},[de]:{exposure:"hidden"},[Y]:{exposure:"event"},[ue]:{exposure:"hidden"},[_e]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ce]:{exposure:"hidden"},[he]:{exposure:"hidden"},[pe]:{exposure:"hidden"},[ge]:{exposure:"hidden"},[ve]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[me]:{exposure:"hidden"},[k]:{exposure:"event"},[x]:{exposure:"event"},[I]:{exposure:"event"},[T]:{exposure:"event"},[we]:{exposure:"event"},[Se]:{exposure:"event"},[Pe]:{exposure:"event"},[Ee]:{exposure:"event"},[Ce]:{exposure:"event"},[ke]:{exposure:"event"},[xe]:{exposure:"event"},[Ie]:{exposure:"event"},[Te]:{exposure:"event"},[Fe]:{exposure:"event"},[$e]:{exposure:"event"}},Ks=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Ys=e=>{var t=js[e];if(t)return t;for(var i of Ks){var s=i[1];if(0===e.indexOf(i[0]))return s}},Js=(e,t)=>{try{return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t)}catch(t){return s=[],null!==(i=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(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(t))return"[Circular]";s.push(t)}return t}}))&&void 0!==i?i:"null"}var i,s},Qs=e=>{var t=null==ze?void 0:ze.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){Xi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Xs=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},er="https?://(.*)",tr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ir=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...tr],sr="<masked>",rr=["li_fat_id"];function nr(e,t){var i=ir.concat(t||[]),s={};return is(i,function(t){var i=Zs(e,t);s[t]=i||null}),s}function or(e){var t=function(e){return e?0===e.search(er+"google.([^/?]*)")?"google":0===e.search(er+"bing.com")?"bing":0===e.search(er+"yahoo.com")?"yahoo":0===e.search(er+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!mt(t)){s.$search_engine=t;var r=ze?Zs(ze.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function ar(){return navigator.language||navigator.userLanguage}var lr="$direct";function dr(){return(null==ze?void 0:ze.referrer)||lr}function ur(e,t,i){void 0===i&&(i=!1);var s=e?[...tr,...t||[]]:[],r=i?Hi(null==je?void 0:je.href):null==je?void 0:je.href,n=null==r?void 0:r.substring(0,1e3);return{r:dr().substring(0,1e3),u:n?Xs(n,s,sr):void 0}}function _r(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Hi(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==lr?lr:null==(i=Qs(s))?void 0:i.host};if(n){o.$current_url=n;var a=Qs(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=nr(n);ss(o,l)}if(s){var d=or(s);ss(o,d)}return o}function cr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function hr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var pr={flags:_e,surveys:Q},gr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],vr=e=>e+"_cookie_identity_change_pending",fr=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},mr="main",yr=[N,B,q,H,G,_e,W,j],br=e=>-1!==yr.indexOf(e),wr=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Sr=e=>{if(!e)return{};var t=JSON.parse(e);return ht(t)?t:{}},Pr=(e,t)=>{is(e,(i,s)=>{var r=Ys(s);r&&"event"!==r.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})};class Er{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&&Xi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),Ge){var r=()=>this.flush();ls(Ge,"beforeunload",r,{capture:!1}),ls(Ge,"pagehide",r,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==Ge?void 0:Ge.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=zs.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,mr)},ls(Ge,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],i=e[1],s=this._pendingCrossTabFeatureFlagChanges.get(t);if(br(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&&Ge&&(Ge.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=Ss._get(e),mt(r)){var n=this._slotWriteState(t);return n.storageValue=null,t!==mr&&(n.persisted=!1),!1}s=Sr(r)}catch(e){return!1}var o=t===mr?s:Ss._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===mr&&this._splitStorage&&!wr(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,r),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[n],i=e[n];return!gt(t)&&!gt(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){var r=this._slotWriteState(t);r.storageValue=s,t!==mr&&(r.persisted=i);try{r.fingerprint=this._entryFingerprint(e,t)}catch(e){r.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){var s=!1;return yr.forEach(i=>{var r,n=null==(r=Ys(i))?void 0:r.storageGroup;if(!(t===mr&&this._splitStorage&&n||t!==mr&&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&&wr(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=Ss._get(this._name),i=this._slotWriteState(mr),s=!1,r=!1;if(t!==i.storageValue)if(mt(t))i.storageValue=null;else{if(e=Sr(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;r=this._mergeCrossTabFeatureFlagProperties(e,mr,!1),!this._splitStorage||wr(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,mr,!0,t):i.storageValue=t,s=!0}return this._splitStorage&&zs.forEach(t=>{var i=Ss._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=s&&yr.some(e=>{var i;return(null==(i=Ys(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=Sr(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=Ys(e);null!=i&&i.volatile||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||mr).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){yr.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=Ss._get(this._name),t=Sr(e);this._slotWriteState(mr).storageValue=e,yr.forEach(e=>{var i,s=this._splitStorage?null==(i=Ys(e))?void 0:i.storageGroup:void 0,r=s?Ss._get(this._groupEntryName(s)):null;if(s){var n=this._slotWriteState(s);n.storageValue=r,n.persisted=!mt(r)}var o=s&&!mt(r)?Sr(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(e===B){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(br(e)){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==s){var r=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Ys(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;r=Sr(Ss._get(a))[e]}catch(e){}var l=new Set(s||[]);if(e===B){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(wr(r,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!gt(t)&&!ht(t)||gt(t)&&pt(i)&>(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&&wr(c[e],i[e])||l.add(e)}),l.forEach(e=>{e in h==e in i&&wr(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=Is(e,this._config.cookie_persisted_properties||[]),i=Fs(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=bs._get(this._name)||void 0;r&&Rs(this._name,r)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r)}catch(e){}else try{var n=bs._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?Rs(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=bs._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;var s,r=Rs(this._name,i);try{s=xs(JSON.parse(i))}catch(e){return!1}if((bs._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=r,this._lastSeenMainCookieValue=i;var o=$s(this._name,i),a=[...Es,...o.properties],d={};if(Object.keys(s).forEach(e=>{var t=s[e];(gt(t)||mt(t)||""===t||e===ce&&t!==Ae&&t!==Me)&&(d[e]=!0,delete s[e])}),pt(s))return!1;var u=n in s||s[ce]===Ae||s[ce]===Me,_=this.props,c=_[n],h=_[ce],p=ss({},_);[...Es,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==a.indexOf(e)&&!(e in s)&&!d[e]&&(u||e!==n&&e!==ce)){var t=p[e];!o.isValid&&-1!==Es.indexOf(e)&&(!1===t||0===t)||delete p[e]}}),this.props=ss(p,s),yr.forEach(e=>{var t=e in this.props;e in _===t&&wr(_[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,_[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!u||ce in s||ce in this.props||this._setProp(ce,Ae);var g=this.props[n],v=this.props[ce];return!u||g===c&&v===h||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Ds._set(vr(this._name),!0),this._deleteProp(j),this._deleteProp(B),this._deleteProp(N),this._deleteProp(q),this._deleteProp(H),this._deleteProp(G),this._deleteProp(_e),this._deleteProp(ue),this._deleteProp(le),v===Ae&&(h===Me||s[ce]===Ae||!gt(c)&&g!==c)&&(Pr(this.props,s),this._deleteProp(K)),v===Me?this.props.$user_id=g:delete this.props.$user_id,this._deleteProp(l)),!0}consumeCookieIdentityChange(){var e=vr(this._name),t=this._cookieIdentityChangePending||!!Ds._get(e);return this._cookieIdentityChangePending=!1,t&&Ds._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[mr],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===gr.indexOf(e.persistence.toLowerCase())&&(Xi.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=[...Es,...e];return i({},Ss,{_parse(e){try{var i,r={};try{i=bs._get(e)||void 0,r=i?xs(JSON.parse(i)):{}}catch(e){}var o,a=JSON.parse(Ss._get(e)||"{}");if(t){var l=$s(e,i),d=[...Es,...l.properties],u={};Object.keys(r).forEach(e=>{var t=r[e];mt(t)||""===t||e===ce&&t!==Ae&&t!==Me||(u[e]=t)});var _=n in u||u[ce]===Ae||u[ce]===Me;if(Object.keys(u).length>0){var c,h=a[n],p=null!==(c=a[ce])&&void 0!==c?c:Ae;s.forEach(e=>{if(-1!==d.indexOf(e)&&!(e in r)&&(_||e!==n&&e!==ce)){var t=a[e];!l.isValid&&-1!==Es.indexOf(e)&&(!1===t||0===t)||delete a[e]}}),!_||ce in r||ce in a||(a[ce]=Ae),!_||(n in u?u[n]:a[n])===h&&(ce in u?u[ce]:a[ce])===p||(Ps.forEach(e=>delete a[e]),u[ce]===Me&&n in u?a.$user_id=u[n]:delete a.$user_id,u[ce]!==Me&&(delete a[Y],delete a[K]),delete a.__alias)}o=ss(a,u)}else o=ss(r,a);return Ss._set(e,o),o}catch(e){}return null},_set(i,s,r,n,o,a){var l=Ss._set(i,s,void 0,void 0,a);try{var d=Is(s,e);if(Object.keys(d).length){if(t){var u=Cs(i),_=Fs(d,e);if(bs._set(u,_,r,n,o,a),bs._get(u)!==JSON.stringify(_)){bs._remove(u,n);var c=Is(s);return bs._set(i,c,r,n,o,a),l}}bs._set(i,d,r,n,o,a)}}catch(e){Ss._error(e)}return l},_remove(e,t){try{null==Ge||Ge.localStorage.removeItem(e),bs._remove(e,t),bs._remove(Cs(e),t)}catch(e){Ss._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,o=!1,a=e.persistence.toLowerCase();return"localstorage"===a&&Ss._is_supported()?(t=Ss,o=!0):"localstorage+cookie"===a&&s._is_supported()?(t=s,o=!0,r=!0):"sessionstorage"===a&&Ds._is_supported()?t=Ds:"memory"===a?t=As:"cookie"===a&&bs._is_supported()?(t=bs,r=!0):s._is_supported()?(t=s,o=!0,r=!0):bs._is_supported()?(t=bs,r=!0):t=As,this._splitStorageEligible=o,this._storesIdentityInCookie=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return is(this.props,(t,i)=>{var s=Ys(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?Ss._parse(this._name):null,s={};if(t)try{is(s=xs(bs._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=ss({},r)),this._splitStorage&&this._loadGroupEntries(),t&&r){var o,a,l=null==i?void 0:i[n],d=null!==(o=null==i?void 0:i[ce])&&void 0!==o?o:Ae,u=r[n],_=null!==(a=r[ce])&&void 0!==a?a:Ae;if(u!==l||_!==d){this._cookieIdentityChangePending=!0,Ds._set(vr(this._name),!0);var c=ss({},this.props);Ps.forEach(e=>delete c[e]),_===Ae&&(d===Me||s[ce]===Ae||!gt(l)&&u!==l)&&(Pr(c,s),delete c[K]),this.props=c;var h=new Set;Ps.forEach(e=>{var t,i=null==(t=Ys(e))?void 0:t.storageGroup;i&&h.add(i)}),h.forEach(e=>{var t={};is(this.props,(i,s)=>{var r;(null==(r=Ys(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),pt(t)?(Ss._remove(this._groupEntryName(e)),this._slotState[e]={}):Ss._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Ds._get(vr(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of zs){var t=Ss._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)||ss(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=Ys(t))?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){var i=pr[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||e===_&&this._facebookClickIdChangePending)){var i=this._splitStorage?null==(t=Ys(e))?void 0:t.storageGroup:void 0,s=i?Ss._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(_));var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&Xi.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,mr);"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,mr);"written"===r&&this._rememberCurrentCookieProperties(i),"failed"!==r&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,yr.forEach(e=>{var t;null!=(t=Ys(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 yr.forEach(i=>{var s;(null==(s=Ys(i))?void 0:s.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(i)}),1;var n=e._writeEntry(Ss,e._groupEntryName(t),r,t);"failed"!==n&&yr.forEach(i=>{var s=Ys(i);(null==s?void 0:s.storageGroup)!==t||"written"!==n&&s.volatile||e._pendingCrossTabFeatureFlagChanges.delete(i)})};for(var o of zs)n(o)}_partitionProps(){var e={},t={flags:{},surveys:{}};return is(this.props,(i,s)=>{var r,n=null==(r=Ys(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===mr)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return is(e,(e,t)=>{var s;i[t]=null!=(s=Ys(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){var r,n=this._slotWriteState(s);if(s!==mr&&!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!==mr&&(n.persisted=!0),gt(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=Ss._get(t)),"written"):(this._config.debug&&Xi.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 zs)Ss._remove(this._groupEntryName(s));i?delete this._slotState[mr]: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(is(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(is(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==ze?void 0:ze.URL;if(e!==this._campaign_params_url){var t=function(e,t,i){if(!ze)return{};var s,r=t?[...tr,...i||[]]:[],n=nr(Xs(ze.URL,r,sr),e),o=(s={},is(rr,function(e){var t=ds(e);s[e]=t||null}),s);return ss(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!pt(ns(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}}update_search_keyword(){var e;this.register((e=null==ze?void 0:ze.referrer)?or(e):{})}update_referrer_info(){var e;this.register_once({$referrer:dr(),$referring_domain:null!=ze&&ze.referrer&&(null==(e=Qs(ze.referrer))?void 0:e.host)||lr},void 0)}set_initial_person_info(){if(!this.props[ge]&&!this.props[ve]){var e=ur(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[fe]:this._storesIdentityInCookie?{r:fr(e.r),u:e.u?fr(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};is([ve,ge],t=>{var i=this.props[t];i&&is(i,function(t,i){e["$initial_"+rt(i)]=t})});var t=this.props[fe];if(t){var i=function(e,t){void 0===t&&(t=!1);var i=_r(e,t),s={};return is(i,function(e,t){s["$initial_"+rt(t)]=e}),s}(t,this._config.disable_capture_url_hashes);ss(e,i)}return e}safe_merge(e){return is(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[mr],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[fe];if(this._storesIdentityInCookie&&ht(e)&&"string"==typeof e.r){var t=fr(e.r),s="string"==typeof e.u?fr(e.u):e.u;t===e.r&&s===e.u||this._setProp(fe,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[c]||{};i[e]=t,this._setProp(c,i),this.save()}remove_event_timer(e){var t=this.props[c]||{},i=t[e];return gt(i)||(delete t[e],this._setProp(c,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&&(e!==n&&e!==ce||r===t||(this._localIdentityChangePending=!0),e!==_||wr(r,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,r,t),null!=(s=Ys(e))&&s.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(br(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),e===_&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,i=null==(t=Ys(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var Cr={GZipJS:"gzip-js",Base64:"base64"},kr={Activation:"events",Cancellation:"cancelEvents"},xr={Button:"button",Tab:"tab",Selector:"selector"},Ir={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"},Tr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Fr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},$r={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Rr={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Or={Once:"once",Recurring:"recurring",Always:"always"},Ar={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Mr={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"},Dr={Popover:"popover",Inline:"inline"};function Lr(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&ct(i.then)&&i.then(void 0,()=>{})}}}}var Nr={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},Br={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"},Ur={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"},qr=es("[RateLimiter]");class Hr{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=>{qr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void qr.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(pe))&&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(pe,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}}var Gr=es("[RemoteConfig]");class Wr{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=et._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=et.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=et.__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 Gr.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Gr.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Gr.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){Gr.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Gr.warn("Failed to fetch remote config from PostHog."):Gr.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Gr.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){Gr.error("Error loading feature flags",e)}}}var Vr=["fatal","error","warning","log","info","debug"],zr=Uint8Array,jr=Uint16Array,Kr=Uint32Array,Yr=new zr([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]),Jr=new zr([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]),Qr=new zr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zr=function(e,t){for(var i=new jr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Kr(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]},Xr=Zr(Yr,2),en=Xr[1];Xr[0][28]=258,en[258]=28;for(var tn=Zr(Jr,0)[1],sn=new jr(32768),rn=0;32768>rn;++rn){var nn=(43690&rn)>>>1|(21845&rn)<<1;sn[rn]=((65280&(nn=(61680&(nn=(52428&nn)>>>2|(13107&nn)<<2))>>>4|(3855&nn)<<4))>>>8|(255&nn)<<8)>>>1}var on=function(e,t,i){for(var s=e.length,r=0,n=new jr(t);s>r;++r)++n[e[r]-1];var o,a=new jr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new jr(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[sn[_]>>>l]=d}else for(o=new jr(s),r=0;s>r;++r)o[r]=sn[a[e[r]-1]++]>>>15-e[r];return o},an=new zr(288);for(rn=0;144>rn;++rn)an[rn]=8;for(rn=144;256>rn;++rn)an[rn]=9;for(rn=256;280>rn;++rn)an[rn]=7;for(rn=280;288>rn;++rn)an[rn]=8;var ln=new zr(32);for(rn=0;32>rn;++rn)ln[rn]=5;var dn=on(an,9,0),un=on(ln,5,0),_n=function(e){return(e/8|0)+(7&e&&1)},cn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof jr?jr:e instanceof Kr?Kr:zr)(i-t);return s.set(e.subarray(t,i)),s},hn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},pn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},gn=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 zr(0),0];if(1==r){var o=new zr(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 jr(c+1),p=vn(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 zr(h),p]},vn=function(e,t,i){return-1==e.s?Math.max(vn(e.l,t,i+1),vn(e.r,t,i+1)):t[e.s]=i},fn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new jr(++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]},mn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},yn=function(e,t,i){var s=i.length,r=_n(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)},bn=function(e,t,i,s,r,n,o,a,l,d,u){hn(t,u++,i),++r[256];for(var _=gn(r,15),c=_[0],h=_[1],p=gn(n,15),g=p[0],v=p[1],f=fn(c),m=f[0],y=f[1],b=fn(g),w=b[0],S=b[1],P=new jr(19),E=0;m.length>E;++E)P[31&m[E]]++;for(E=0;w.length>E;++E)P[31&w[E]]++;for(var C=gn(P,7),k=C[0],x=C[1],I=19;I>4&&!k[Qr[I-1]];--I);var T,F,R,O,A=d+5<<3,M=mn(r,an)+mn(n,ln)+o,D=mn(r,c)+mn(n,g)+o+14+3*I+mn(P,k)+(2*P[16]+3*P[17]+7*P[18]);if(M>=A&&D>=A)return yn(t,u,e.subarray(l,l+d));if(hn(t,u,1+(M>D)),u+=2,M>D){T=on(c,h,0),F=c,R=on(g,v,0),O=g;var L=on(k,x,0);for(hn(t,u,y-257),hn(t,u+5,S-1),hn(t,u+10,I-4),u+=14,E=0;I>E;++E)hn(t,u+3*E,k[Qr[E]]);u+=3*I;for(var N=[m,w],B=0;2>B;++B){var U=N[B];for(E=0;U.length>E;++E)hn(t,u,L[q=31&U[E]]),u+=k[q],q>15&&(hn(t,u,U[E]>>>5&127),u+=U[E]>>>12)}}else T=dn,F=an,R=un,O=ln;for(E=0;a>E;++E)if(s[E]>255){var q;pn(t,u,T[257+(q=s[E]>>>18&31)]),u+=F[q+257],q>7&&(hn(t,u,s[E]>>>23&31),u+=Yr[q]);var H=31&s[E];pn(t,u,R[H]),u+=O[H],H>3&&(pn(t,u,s[E]>>>5&8191),u+=Jr[H])}else pn(t,u,T[s[E]]),u+=F[s[E]];return pn(t,u,T[256]),u+F[256]},wn=new Kr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Sn=function(){for(var e=new Kr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Pn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function En(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=Sn[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=(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 zr(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=yn(l,d,e.subarray(u,_)):(l[u]=n,d=yn(l,d,e.subarray(u,o)))}else{for(var c=wn[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new jr(32768),f=new jr(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 Kr(25e3),S=new jr(288),P=new jr(32),E=0,C=0,k=(u=0,0),x=0,I=0;o>u;++u){var T=b(u),F=32767&u,R=f[T];if(v[F]=R,f[T]=F,u>=x){var O=o-u;if((E>7e3||k>24576)&&O>423){d=bn(e,l,0,w,S,P,C,k,I,u-I,d),k=E=C=0,I=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&&T==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,z=V-v[V]+32768&32767;z>W&&(W=z,R=V)}}}N+=(F=R)-(R=v[F])+32768&32767}if(D){w[k++]=268435456|en[M]<<18|tn[D];var j=31&en[M],K=31&tn[D];C+=Yr[j]+Jr[K],++S[257+j],++P[K],x=u+M,++E}else w[k++]=e[u],++S[e[u]]}}d=bn(e,l,n,w,S,P,C,k,I,u-I,d)}return cn(a,0,s+_n(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,!0)),u=d.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&&Pn(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)}}(d,t),Pn(d,u-8,i.d()),Pn(d,u-4,s),d}var Cn=!!Ye||!!Ke,kn="text/plain",xn=!1,In=(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:"")},Tn=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 is(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},Fn=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===Cr.GZipJS){var s=En(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new zr(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 zr(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 cn(i,0,s)}(Js(t)),{mtime:0});return{contentType:kn,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===Cr.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(Js(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Js(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Js(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},$n=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:Tn(e.url,{compression:Cr.Base64}),encodedBody:Fn(i({},e,{compression:Cr.Base64,_encodedBody:void 0}))}:{url:In(e.url,"compression"),encodedBody:Fn(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=Fn(e)}catch(t){if(ji(e.compression,Zs(e.url,"compression")))return Xi.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&ji(e.compression,Zs(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?zi(new Uint8Array(s)):ArrayBuffer.isView(s)&&zi(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(xn=!0,r()):{url:e.url,encodedBody:t}},Rn=e=>{try{return $n(e)}catch(t){return Xi.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},On=function(){var e=t(function*(e){var t=Js(e.data),r=yield function(e,t,i){return Qi.apply(this,arguments)}(t,s.DEBUG,{rethrow:!0});if(!r)return e;var n=yield r.arrayBuffer();return i({},e,{_encodedBody:{contentType:kn,body:n,estimatedSize:n.byteLength}})});return function(t){return e.apply(this,arguments)}}(),An=/Failed to fetch|NetworkError|Load failed/i,Mn=e=>"TypeError"===(null==e?void 0:e.name)&&An.test((null==e?void 0:e.message)||""),Dn=e=>{var t=Rn(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;is(e.headers,function(e,t){d.append(t,e)}),o&&d.append("Content-Type",o);var u=null,_=!1;if(Je){var c=new Je;u={signal:c.signal,timeout:setTimeout(()=>{var t;_=!0,c.abort(qi("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))},e.timeout)}}var h=t=>{_&&"AbortError"===(null==t?void 0:t.name)||Mn(t)?Xi.warn(t):Xi.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var p;Ke(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){Xi.error(e)}null==e.callback||e.callback(s)})).catch(h).finally(()=>u?clearTimeout(u.timeout):null)}catch(e){u&&clearTimeout(u.timeout),h(e)}}},Ln=e=>{try{var t,s=$n(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(Ve.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 Ln(i({},e,{data:c(u.slice(0,_))})),void Ln(i({},e,{data:c(u.slice(_))}))}Xi.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Dn(i({},e,{_keepaliveDisabled:!0}))}catch(e){Xi.warn("Beacon send failed",e)}},Nn=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return Tn(s===Cr.GZipJS?In(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===Cr.GZipJS?{}:{compression:s}))},Bn=[];Ke&&Bn.push({transport:"fetch",method:Dn}),Ye&&Bn.push({transport:"XHR",method(e){var t=Rn(e);if(t){var i=new Ye,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,o=r.body;is(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)}}}),null!=Ve&&Ve.sendBeacon&&Bn.push({transport:"sendBeacon",method:Ln});var Un=3e3;class qn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=It((null==t?void 0:t.flush_interval_ms)||Un,250,5e3,Xi.createLogger("flush interval"),Un),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)&&is(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){Xi.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return is(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}}var Hn=["retriesPerformedSoFar"];class Gn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!gt(Ge)&&"onLine"in Ge.navigator&&(this._areWeOnline=Ge.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ls(Ge,"online",this._onlineListener),ls(Ge,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=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,Hn);wt(t)&&(s.url=Tn(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&Xi.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.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;return Math.ceil(s+r*(s-i))}(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)"),Xi.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(Ge)||(this._onlineListener&&(Ge.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(Ge.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){Xi.error(e)}}this._queue=[]}}class Wn{constructor(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)},this._instance=e}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(){ls(Ge,"scroll",this._updateScrollData,{capture:!0}),ls(Ge,"scrollend",this._updateScrollData,{capture:!0}),ls(Ge,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==Ge||null==(e=Ge.document)?void 0:e.documentElement;var t=_t(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var i of t){var s,r=null==Ge||null==(s=Ge.document)?void 0:s.querySelector(i);if(r)return r}}_scrollPosition(e){var t,i,s="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[s]||0}return Ge?"y"===e?Ge.scrollY||Ge.pageYOffset||(null==(t=Ge.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:Ge.scrollX||Ge.pageXOffset||(null==(i=Ge.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var Vn=e=>ur(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);class zn{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({[he]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||Vn,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[he]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?_r(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 is(ns(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+rt(i)]=t}),e}}class jn{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={}}}var Kn=es("[SessionId]"),Yn=864e5;class Jn{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 jn,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(e.config.cookieless_mode===Oe)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||gs,this._windowIdGenerator=i||gs;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*It(this._config.session_idle_timeout_seconds||1800,60,36e3,Kn.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=Ds._parse(this._window_id_storage_key),o=Ds._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Ds._remove(this._window_id_storage_key),Ds._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&&Ds._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ds._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ds._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({[F]:[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(F):(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({[F]:[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[F];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 Kn.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void Kn.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&&Ge&&(Ge.removeEventListener(Ne,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Ds._remove(this._primary_window_exists_storage_key)},ls(Ge,Ne,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===i&&(i=!1),this._config.cookieless_mode===Oe)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>Yn),g=h?p:wt(d)&&Math.abs(s-d)>Yn,v=!1,f=u,m=!l||!!h,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(s,_);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(s))||Kn.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(),Kn.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)&&(Kn.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 C={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:g,crossTabAdoption:f};return v&&this._sessionIdChangedHandlers.forEach(e=>e(l,c,C)),{sessionId:l,windowId:c,sessionStartTimestamp:E,changeReason:v?C: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 Qn(){return(Qn=t(function*(){var e=null==Ve?void 0:Ve.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return vt(i)&&i.length>0?i:void 0}catch(e){return void Xi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function Zn(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 Xn(e,t,i){return Js({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var eo="custom",to="i.posthog.com",io=/^\/static\//,so=["/s/","/e/","/i/"];class ro{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("."+to,".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":eo),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(io.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=Qs(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=Qs(i))?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&"api"===e&&so.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||(u={apiHost:d,rewriteRequestPath:r,urls:new Set},this._ingestionEndpoints=u),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===eo)return this._prepareEndpoint(e,t,this.apiHost+t);var s=to+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)}}}var no=es("[Surveys]"),oo={ignoreConditions:!1,ignoreDelay:!1,displayType:Dr.Popover},ao=es("[PostHog ExternalIntegrations]"),lo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class uo{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=et.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return ao.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=et.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(lo[n],()=>{var t;null==(t=et.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(s=et.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=et.__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()}}}class _o{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var i=this;return t(function*(){if(i._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');i._extensions.set(e.name,e);try{var t=e.setup(i._client);t&&(yield t)}catch(t){var s=i._extensions.get(e.name)===e;s&&i._extensions.delete(e.name),i._logger.error('Failed to set up browser extension "'+e.name+'"',t),s&&i._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)}}}class co{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)}}var ho="extensionsRemoteConfig";class po{constructor(e){this._disposed=!1,this.instance=e,this._logger=Xi,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new co(e),this.onEvent=e=>Lr(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 Lr(()=>{});var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(ho,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Lr(i)},this._runtime=new _o(Xi.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(o))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(o);return"string"==typeof e?e:void 0}get library(){return{name:s.LIB_NAME,version:s.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,i,s){var r=this;return t(function*(){s?r.instance.capture(e,i,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):r.instance.capture(e,i)})()}registerDynamicEventProperties(e){return Lr(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(ho,e))}sendRequest(e,i){var s=this;return t(function*(){var t;void 0===i&&(i={});var r=s.instance.requestRouter.endpointFor(null!==(t=i.target)&&void 0!==t?t:"api",e),n={method:i.method,url:i.query?Tn(r,i.query):r,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?nt.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(s.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,s.instance._send_request(n)})})()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var go,vo={},fo=0,mo=()=>{},yo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bo="Surveys module not available",wo="sanitize_properties is deprecated. Use before_send instead",So="Invalid value for property_denylist config: ",Po=/^[A-Za-z0-9_-]{1,400}$/,Eo=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Co=["token","distinct_id",be],ko="posthog",xo=!Cn&&-1===(null==Ze?void 0:Ze.indexOf("MSIE"))&&-1===(null==Ze?void 0:Ze.indexOf("Mozilla")),Io=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},To=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:as(null==ze?void 0:ze.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mo,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==Ge||null==(t=Ge.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){Xi.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:De,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Un},error_tracking:{},_onCapture:mo},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Ns,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:Io(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))},Fo=[["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"]],$o=e=>{var t={};for(var i of Fo){var s=i[0],r=i[1];gt(e[s])||(t[r]=e[s])}var n=ss({},t,e),o=e.__preview_external_dependency_versioned_paths;return gt(o)||(gt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),vt(o)&>(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]:Xi.error(So+e.property_denylist)),n};class Ro{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){Xi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Oo{_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 this.config.cookieless_mode===Oe||this.config.cookieless_mode===Re&&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()&&this.get_distinct_id()===ye){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||t===ye){var i=this.config.get_device_id(gs());this.register({distinct_id:i,$device_id:i}),e.set_property(ce,Ae)}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 e;this.webPerformance=new Ro,this._personProcessingSetOncePropertiesSent=!1,this.version=s.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new jn,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=To(),this.SentryIntegration=Ws,this.sentryIntegration=e=>function(e,t){var i=Gs(e,t);return{name:Hs,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 Wn(this),this.pageViewManager=new Vs(this),this.rateLimiter=new Hr(this),this.requestRouter=new ro(this),this.consent=new Ls(this),this.externalIntegrations=new uo(this);var t=null!==(e=Oo.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.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=>Xi.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==ko){var s,r=null!==(s=vo[i])&&void 0!==s?s:new Oo;return r._init(e,t,i),vo[i]=r,vo[ko][i]=r,r}return this._init(e,t,i)}_init(e,t,r){var n,o,l;void 0===t&&(t={});var d,u=vt(e)?e.trim():"";if(!u)return Xi.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return u!==(null==(d=this.config)?void 0:d.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=To(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 _=To(t.defaults),c=$o(t),h=ss({},_,c,{name:r,token:u});ht(_.rageclick)&&ht(c.rageclick)&&(h.rageclick=ss({},_.rageclick,c.rageclick)),ht(_.session_recording)&&ht(c.session_recording)&&(h.session_recording=ss({},_.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&Xi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Cr.GZipJS;var p=this._is_persistence_disabled();if(this.persistence=new Er(this.config,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Er(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&&Ds._is_supported()){var g=Ds._parse(this._sessionRegisteredPropertiesStorageKey);_t(g)&&g.forEach(e=>{vt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Ds._remove(this._sessionRegisteredPropertiesStorageKey);var v=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new qn(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new Gn(this),this.__request_queue=[];var m=this._inCookielessMode();m||(this.sessionManager=new Jn(this),this.sessionPropsManager=new zn(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?(Xi.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(m)},0)):(Xi.info("Initializing extensions synchronously"),this._initExtensions(m)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Xi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:v,s:f}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var y=null==(o=t.bootstrap)?void 0:o.distinctID;if(this._hasStableInitialDistinctId=!!y&&!ft(y),void 0!==(null==(l=t.bootstrap)?void 0:l.distinctID)){var b=t.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(ce);if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&S===Ae)this.identify(b);else if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&S===Me)Xi.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(gs()),E=t.bootstrap.isIdentifiedID?P:b;this.persistence.set_property(ce,t.bootstrap.isIdentifiedID?Me:Ae),this.register({distinct_id:b,$device_id:E})}}if(m)this.register_once({distinct_id:ye,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(gs());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(ce,Ae)}return ls(Ge,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?qs(this,()=>this._loaded()):this._loaded(),ct(this.config._onCapture)&&this.config._onCapture!==mo&&(Xi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&Xi.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 Qn.apply(this,arguments)}().then(e=>{e&&this.register({[a]:e})}).catch(mo),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=>{Xi.error('Failed to dispose browser extension "'+e.name+'"',t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var e,t,i,s,r,n,o=null!==(e=null==(t=this.config.__extensionClasses)?void 0:t.featureFlags)&&void 0!==e?e:null==(i=Oo.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(s=this._featureFlagsReloadingUnsubscribe)||s.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new o(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(e){var t,s,r,n,o,a,l,d=performance.now(),u=i({},Oo.__defaultExtensionClasses,this.config.__extensionClasses),_=[];u.exceptions&&this._extensions.push(this.exceptions=null!==(t=this.exceptions)&&void 0!==t?t:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||_.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this._enrollExtension(this.autocapture=new u.autocapture(this),_),u.surveys&&this._enrollExtension(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new u.surveys(this),_),u.logs&&this._enrollExtension(this.logs=null!==(r=this.logs)&&void 0!==r?r:new u.logs(this),_),u.metrics&&this._extensions.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Bs)),u.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this._extensions.forEach(e=>{e.initialize&&_.push(()=>{null==e.initialize||e.initialize()})}),_.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(_,d)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){Xi.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[we]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Se]:s}),this.config.__preview_deferred_init_extensions&&Xi.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!ze||!ze.body)return Xi.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=st(s.supportedCompression,Cr.GZipJS)?Cr.GZipJS:st(s.supportedCompression,Cr.Base64)?Cr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:De}),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){Xi.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 Wr(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()&&ts(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;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Ue),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(Ue,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?xo?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"===_&>(n.compression)&&n.data&&(n.compression=Cr.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=Nn(n.url,n.method,n.compression,n.timestampMode);var c=Bn.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){Mn(e)?Xi.warn(e):Xi.error(e),null==n.callback||n.callback({statusCode:0,error:e})}};"sendBeacon"!==_&&n.data&&n.compression===Cr.GZipJS&&Qe&&"undefined"!=typeof Promise&&!xn?On(n).then(e=>{p(e)}).catch(t=>{if(Ki(t))return xn=!0,void p(i({},n,{compression:void 0,url:Nn(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 Ki(e)||t===Vi})(t)&&(xn=!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){fo++;try{var t,i=[],s=[],r=[];ts(e,e=>{if(e)if(_t(t=e[0]))r.push(e);else if(ct(e))try{e.call(this)}catch(t){Xi.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){ts(e,function(e){try{if(_t(e[0])){var i=t;is(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){Xi.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{fo--}}push(e){if(fo>0&&_t(e)&&vt(e[0])){var t=Oo.prototype[e[0]];ct(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}_getPersistedFacebookClickId(){var e,t=null==(e=this.persistence)?void 0:e.get_property(_);return vt(t)&&Eo.test(t)?{value:t,delivered:!1}:ht(t)&&vt(t.value)&&Eo.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,i,s){if(this.persistence){this.persistence.refreshKey(_);var r=this._getPersistedFacebookClickId();if(!s){if(i)return vt(t)&&Eo.test(t)?(t!==(null==r?void 0:r.value)&&this.persistence.register({[_]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==r?void 0:r.value)||!r.delivered}):void this.persistence.unregister(_);if(vt(e)&&Po.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({[_]:{value:n,delivered:!1}}),{value:n,pending:!0}}return r?{value:r.value,pending:!r.delivered}:void 0}this.persistence.unregister(_)}}_markFacebookClickIdDelivered(e){if(this.persistence){this.persistence.refreshKey(_);var t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[_]:{value:e,delivered:!0}})}}capture(e,t,s){var r,n,o,a,l,d,_,c,h,p;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)&&(Xi.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||Xi.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=Ui(null==s?void 0:s.uuid,gs),w={uuid:b,event:e,properties:this.calculateEventProperties(e,t||{},y,b)};e===Be&&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(W);(null==s?void 0: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)&&u in s.$set,C=E||!!P&&u in P,k=E?null==s||null==(r=s.$set)?void 0:r[u]:null==P?void 0:P[u],x=_t(null==t?void 0:t.$unset)?t.$unset:[],I=(null==s?void 0:s.$unset)||[],T=-1!==x.indexOf(u)||-1!==I.indexOf(u),F=this._updateFacebookClickId(null==(n=f)?void 0:n.fbclid,k,C,T);F&&!0===w.properties.$process_person_profile&&F.pending&&!C&&!S&&(w.$set=i({[u]: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!==He,e===qe);if(O&&(w.$set_once=O),null!=s&&s._noTruncate||(_=this.config.properties_string_max_length,c=w,h=e=>vt(e)?e.slice(0,_):e,p=new Set,w=function e(t,i){if(t!==Object(t))return h?h(t):t;if(!p.has(t)){var s;if(p.add(t),_t(t))s=[],ts(t,t=>{s.push(e(t))});else{var r={};is(t,(t,i)=>{p.has(t)||(r[i]=e(t,i))}),s=r}return s}}(c)),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 Wi.forEach(s),t.forEach(s),i}(w.properties,Co)),e===Ar.DISMISSED||e===Ar.SENT){var A=null==t?void 0:t[Mr.SURVEY_ID],M=null==t?void 0:t[Mr.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){no.error("Failed to persist survey seen state",e)}})({id:A,current_iteration:M}),w.$set=i({},w.$set,{[Zn({id:A,current_iteration:M},e===Ar.SENT?"responded":"dismissed")]:!0})}else e===Ar.SHOWN&&(w.$set=i({},w.$set,{[Mr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Br.SHOWN){var D=null==t?void 0:t[Ur.TOUR_TYPE];D&&(w.$set=i({},w.$set,{[Ur.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=Ui(w.uuid,gs)}var B=null!==(o=null==(a=w.$set)?void 0:a[u])&&void 0!==o?o:ht(null==(l=w.properties)?void 0:l.$set)?w.properties.$set[u]:void 0,U=null!=F&&F.pending&&B===F.value?F.value:void 0;this._internalEventEmitter.emit("eventCaptured",w);var q=null!==(d=null==s?void 0:s._url)&&void 0!==d?d:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H=i({method:"POST",url:q,data:w,compression:"best-available",timestampMode:"recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(q)?"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?this._send_retriable_request(H):this._requestQueue.enqueue(H),w}Xi.critical("This capture call is ignored due to client rate limiting.")}}else Xi.error("No event name provided to posthog.capture")}else Xi.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 po(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,this.persistence.get_property(ce)===Ae&&(null==(s=this.sessionPersistence)||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var a=o?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[be]=!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))&&Xi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,_=function(e,t,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ze)return{};var d,u=e?[...tr,...t||[]]:[],_=function(e){for(var t=0;Mi.length>t;t++){var i=Mi[t],s=i[1],r=i[0].exec(e),n=r&&(ct(s)?s(r,e):s);if(n)return n}return["",""]}(Ze),c=_[0],h=_[1],p=function(e){for(var t=0;Ni.length>t;t++){var i=Ni[t],s=i[1],r=i[2],n=e.match(i[0]);if(n){var o=r&&e.match(r)||n;return[s,(null==o?void 0:o[1])||""]}}return["",""]}(Ze),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==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,w=null==(o=navigator)?void 0:o.maxTouchPoints,S=null==Ge||null==(a=Ge.screen)?void 0:a.width,P=null==Ge||null==(l=Ge.screen)?void 0:l.height,E=null==Ge?void 0:Ge.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 C,k,x,I,T,F,R,O,A=ss(ns({$os:c,$os_version:h,$browser:Ri(Ze,navigator.vendor,f,m),$webview_app:g,$webview_app_version:v,$device:Di(Ze),$device_type:(k=Ze,x=y,O=Di(k),O===At||O===Ot||"Kobo"===O||"Kindle Fire"===O||O===ui?Rt:O===Xt||O===ti||O===ei||O===ai?"Console":O===Dt?"Wearable":O?Tt:"Android"===(null==x?void 0:x.userAgentDataPlatform)&&(null!==(I=null==x?void 0:x.maxTouchPoints)&&void 0!==I?I:0)>0?600>Math.min(null!==(T=null==x?void 0:x.screenWidth)&&void 0!==T?T: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)?Tt:Rt:"Desktop"),$timezone:cr(),$timezone_offset:hr()}),{$current_url:Xs(r?Hi(null==je?void 0:je.href):null==je?void 0:je.href,u,sr),$host:null==je?void 0:je.host,$pathname:null==je?void 0:je.pathname,$raw_user_agent:Ze.length>1e3?Ze.substring(0,997)+"...":Ze,$browser_version:Ai(Ze,navigator.vendor,f,m),$browser_language:ar(),$browser_language_prefix:(C=ar(),"string"==typeof C?C.split("-")[0]:void 0),$screen_height:null==Ge?void 0:Ge.screen.height,$screen_width:null==Ge?void 0:Ge.screen.width,$viewport_height:null==Ge?void 0:Ge.innerHeight,$viewport_width:null==Ge?void 0:Ge.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=s.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(o,r.getTime(),!0),h=c.windowId;l.$session_id=c.sessionId,l.$window_id=h}this.sessionPropsManager&&ss(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&ss(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===eo&&(l.$lib_custom_api_host=this.config.api_host),u=e!==Be||o?e!==Ue||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=ss(l,u),e===Be&&ze&&(l.title=ze.title),!gt(a)){var g=r.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}Ze&&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)),is(["$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{ss(b,w())}catch(e){Xi.error("Failed to produce browser extension event properties",e)}(l=ss({},_,v,f,i({},b,l))).$is_identified=this._isIdentified(),_t(this.config.property_denylist)?is(this.config.property_denylist,function(e){delete l[e]}):Xi.error(So+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(Xi.error(wo),l=S(l,e));var P=this._hasPersonProcessing();return l.$process_person_profile=P,P&&!o&&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=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=ss({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(Xi.error(wo),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),pt(o)?void 0:o}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||!Ds._is_supported())Ds._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Ds._set(this._sessionRegisteredPropertiesStorageKey,t):Ds._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:bo}),()=>{})}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:bo})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:bo})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=oo),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:bo}}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:bo})}_validateIdentifyId(e){return!e||ft(e)?(Xi.critical("Unique user id has not been set in posthog.identify"),!1):e===ye?(Xi.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())||(Xi.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 Xi.uninitializedWarning("posthog.identify");if(bt(e)&&(e=e.toString(),Xi.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),a=this.persistence._beginCookieSyncSuppression(),d=!1;try{var u=this.get_distinct_id();this.register({$user_id:e}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),e!==u&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var _=(this.persistence.get_property(ce)||Ae)===Ae,c=e!==u,h=!c&&_;if(c&&_){var p,g=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:u};this.persistence.set_property(ce,Me),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(qe,g,{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=Xn(e,t,i),null==(p=this.featureFlags)||p.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(h){this.persistence.set_property(ce,Me);var v=t||{},f=i||{};this.setPersonPropertiesForFlags({$set:v,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:v,$set_once:f}),this._cachedPersonProperties=Xn(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);c||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(le)):h&&(t||i)&&this.reloadFeatureFlags(),d=!0}finally{a&&this.persistence._endCookieSyncSuppression(d)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=Xn(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):Xi.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(He,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),o&&!s&&this.reloadFeatureFlags()}else Xi.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,l,d;if(void 0===t&&(t=!1),Xi.info("reset"),!this.__loaded)return Xi.uninitializedWarning("posthog.reset");var u=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 _=this.get_property(o),c=this.get_property(a),h=this.get_property(P);null==(l=this.sessionRecording)||l.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==(d=this.persistence)||null==d._beginCookieSyncSuppression?void 0:d._beginCookieSyncSuppression(),v=!1;try{var f,m,y,b,w,S,E,C,k,x,I,T,F;if(null==(f=this.persistence)||f.clear(),null==(m=this.sessionPersistence)||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),gt(h)||null==(x=this.persistence)||x.register({[P]:h}),null==(y=this.surveys)||y.reset(),null==(b=this.featureFlags)||b.reset(),null==(w=this.conversations)||w.reset(),null==(S=this.logs)||S.reset(),null==(E=this.metrics)||E.reset(),null==(C=this.persistence)||C.set_property(ce,Ae),null==(k=this.sessionManager)||k.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===Oe)this.register_once({distinct_id:ye,$device_id:null},"");else{var R=this.config.get_device_id(gs());this.register_once({distinct_id:R,$device_id:e?R:_},""),e||gt(c)||this.register({[a]: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(ce,s.isIdentifiedID?Me:Ae),this.register({distinct_id:s.distinctID})),null==(I=this.featureFlags)||I.initialize(),!(gt(u)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(u,!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 i=this;return t(function*(){var e,t,s,r,n,o,a;if(i.__loaded){i._getBrowserClientAdapter().dispose(),null==(e=i.sessionRecording)||e.dispose(),null==(t=i.logs)||t.flushLogs("sendBeacon"),null==(s=i.metrics)||s.flush("sendBeacon"),null==(r=i._requestQueue)||r.unload(),null==(n=i._retryQueue)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(e){Xi.error("Error while destroying feature flags",e)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else Xi.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(r)?(Xi.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(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Xi.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 r,n,o,a,l,d,u,_,c,h,p,g;ss(this.config,$o(e));var v=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Er(i({},this.config,{persistence:"sessionStorage"}),v,!1);var f,m=this._checkLocalStorageForDebug(this.config.debug);St(m)&&(this.config.debug=m),St(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Ss._is_supported()&&Ss._set("ph_debug",!0),Xi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(s.DEBUG=!1,Ss._is_supported()&&Ss._remove("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.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==(f=this.historyAutocapture)||f.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(g=this.externalIntegrations)||g.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&qs(this,mo,!1)}}_overrideSDKInfo(e,t){s.LIB_NAME=e,s.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=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,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 e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Oo._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:ko;return t!==ko&&(t=ko+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(ce))===Me||(null==(t=this.sessionPersistence)?void 0:t.get_property(ce))===Me}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===De&&!this._isIdentified()&&pt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[me]))}_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?(Xi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(me,!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&&this.config.cookieless_mode!==Re)}_sync_opt_out_with_persistence(){var e,t,i,s,r,n=this._is_persistence_disabled();return this.is_capturing()||null==(i=this.logs)||i._onOptOut(),(null==(e=this.persistence)?void 0:e._disabled)!==n&&(null==(s=this.persistence)||s.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Oe){if(this._inCookielessMode()){var i,s,r,n,o,a;null==(i=this.sessionRecording)||i.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(s=this.sessionManager)||s.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Jn(this),this.pageViewManager=new Vs(this),this.persistence&&(this.sessionPropsManager=new zn(this,this.sessionManager,this.persistence));var l,d=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Oo.__defaultExtensionClasses)?void 0:a.sessionRecording;d&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new d(this)),this._lastRemoteConfig&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this._lastRemoteConfig)))}var u,_;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==Re&&(null==(u=this.surveys)||u.loadIfEnabled()),(gt(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(_=null==e?void 0:e.captureEventName)&&void 0!==_?_:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else Xi.warn(yo)}opt_out_capturing(){if(this.config.cookieless_mode!==Oe){var e,t,i=this.config.cookieless_mode===Re?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Re&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Re&&(this.register({distinct_id:ye,$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 Xi.warn(yo)}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 this.config.cookieless_mode===Oe||(this.config.cookieless_mode===Re?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 Ve?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&it(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>it(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}(Ve,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ze&&("visible"===ze.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Be,{title:ze.title},{send_instantly:!0}),this._visibilityStateListener&&(ze.removeEventListener(Le,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ls(ze,Le,this._visibilityStateListener)))}debug(e){!1===e?(null==Ge||Ge.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Ge||Ge.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?(Xi.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,Xi)}_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)?Xi.warn(o+". This can cause unexpected behavior."):Xi.info(o),null}r.properties&&!pt(r.properties)||Xi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return Xi.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of i)if(r.properties&&yt(r.properties[a]))return Xi.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=Ss._is_supported()&&"true"===Ss._get("ph_debug");return!t&&(!!i||e)}}Oo.__defaultExtensionClasses={},Oo._noopLogger={trace:go=()=>{},debug:go,info:go,warn:go,error:go,fatal:go},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=rs(e.prototype[t[i]])}(Oo,["identify"]);var Ao=function(){s.SDK_DIST_CHANNEL="npm";var e=vo[ko]=new Oo;return function(){function e(){e.done||(e.done=!0,xo=!1,is(vo,function(e){e._dom_loaded()}))}null!=ze&&ze.addEventListener?"complete"===ze.readyState?e():ls(ze,"DOMContentLoaded",e,{capture:!1}):Ge&&Xi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{Cr as Compression,Nr as DEFAULT_PRODUCT_TOUR_APPEARANCE,Dr as DisplaySurveyType,Oo as PostHog,Br as ProductTourEventName,Ur as ProductTourEventProperties,Ar as SurveyEventName,Mr as SurveyEventProperties,kr as SurveyEventType,Ir as SurveyPosition,Rr as SurveyQuestionBranchingType,$r as SurveyQuestionType,Or as SurveySchedule,Tr as SurveyTabPosition,Fr as SurveyType,xr as SurveyWidgetType,Ao as default,Ao as posthog,Vr as severityLevels};
|
|
1
|
+
function e(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 t(t){return function(){var i=this,s=arguments;return new Promise(function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)})}}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)}var s={DEBUG:!1,LIB_VERSION:"0.8.2",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.428.2",s.LIB_NAME="web";var r="$people_distinct_id",n="distinct_id",o="$device_id",a="$device_model",l="__alias",d="__cmpns",u="$fbc",_="$fbc_persistence",c="__timers",h="$autocapture_disabled_server_side",p="$heatmaps_enabled_server_side",g="$exception_capture_enabled_server_side",v="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",m="$web_vitals_enabled_server_side",y="$dead_clicks_enabled_server_side",b="$product_tours_enabled_server_side",w="$logs_capture_enabled_server_side",S="$web_vitals_allowed_metrics",P="$session_recording_remote_config",E="$session_recording_enabled_server_side",k="$replay_sample_rate",C="$replay_override_sampling",x="$replay_override_linked_flag",I="$replay_override_url_trigger",T="$replay_override_event_trigger",F="$sesid",R="$session_is_sampled",O="$session_past_minimum_duration",A="$session_recording_url_trigger_activated_session",M="$session_recording_event_trigger_activated_session",D="$debug_first_full_snapshot_timestamp",L="$sess_rec_flush_size",N="$enabled_feature_flags",B="$active_feature_flags",U="$early_access_features",q="$feature_flag_details",H="$feature_flag_payloads",G="$feature_flag_request_id",W="$minimal_flag_called_events",V="$override_feature_flags",z="$override_feature_flag_payloads",j="$stored_person_properties",K="$stored_group_properties",Y="$groups",J="$surveys",Q="$surveys_loaded_at",Z="$surveys_activated",X="$surveys_activated_session",ee="$surveys_activated_timestamps",te="ph_product_tours",ie="$product_tours_activated",se="$product_tours_activated_session",re="$conversations_widget_session_id",ne="$conversations_ticket_id",oe="$conversations_widget_state",ae="$conversations_user_traits",le="$flag_call_reported",de="$flag_call_reported_session_id",ue="$feature_flag_errors",_e="$feature_flag_evaluated_at",ce="$user_state",he="$client_session_props",pe="$capture_rate_limit",ge="$initial_campaign_params",ve="$initial_referrer_info",fe="$initial_person_info",me="$epp",ye="$posthog_cookieless",be="$cookieless_mode",we="$sdk_debug_extensions_init_method",Se="$sdk_debug_extensions_init_time_ms",Pe="$sdk_debug_recording_script_not_loaded",Ee="$sdk_debug_replay_event_trigger_status",ke="$sdk_debug_replay_linked_flag_trigger_status",Ce="$sdk_debug_replay_matched_recording_trigger_groups",xe="$sdk_debug_replay_pending_trigger_conditions",Ie="$sdk_debug_replay_remote_trigger_matching_config",Te="$sdk_debug_replay_trigger_groups_count",Fe="$sdk_debug_replay_url_trigger_status",$e="$session_recording_start_reason",Re="on_reject",Oe="always",Ae="anonymous",Me="identified",De="identified_only",Le="visibilitychange",Ne="beforeunload",Be="$pageview",Ue="$pageleave",qe="$identify",He="$groupidentify",Ge="u">typeof window?window:void 0,We="u">typeof globalThis?globalThis:Ge,Ve=null==We?void 0:We.navigator,ze=null==We?void 0:We.document,je=null==We?void 0:We.location,Ke=null==We?void 0:We.fetch,Ye=null!=We&&We.XMLHttpRequest&&"withCredentials"in new We.XMLHttpRequest?We.XMLHttpRequest:void 0,Je=null==We?void 0:We.AbortController,Qe=null==We?void 0:We.CompressionStream,Ze=null==Ve?void 0:Ve.userAgent,Xe="undefined"!=typeof globalThis?globalThis:Ge;Xe&&"undefined"==typeof self&&(Xe.self=Xe),Xe&&"undefined"==typeof File&&(Xe.File=function(){});var et=null!=Ge?Ge:{},tt=["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"],it=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return tt.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})};function st(e,t){return-1!==e.indexOf(t)}var rt=function(e){return e.replace(/^\$/,"")},nt=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({}),ot=["$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"],at=["token"],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=>st(ot,e),Et=e=>st(at,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=>st(Ct,e),It=[!1,"false",0,"0","no"];function Tt(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),Tt(null!=r?r:i,t,i,s))}var Ft="Mobile",$t="iOS",Rt="Android",Ot="Tablet",At=Rt+" "+Ot,Mt="iPad",Dt="Apple",Lt=Dt+" Watch",Nt="Safari",Bt="BlackBerry",Ut="Samsung",qt=Ut+"Browser",Ht=Ut+" Internet",Gt="Chrome",Wt=Gt+" OS",Vt=Gt+" "+$t,zt="Internet Explorer",jt=zt+" "+Ft,Kt="Opera",Yt=Kt+" Mini",Jt="Edge",Qt="Microsoft "+Jt,Zt="Firefox",Xt=Zt+" "+$t,ei="Nintendo",ti="PlayStation",ii="Xbox",si=Rt+" "+Ft,ri=Ft+" "+Nt,ni="Windows",oi=ni+" Phone",ai="Nokia",li="Ouya",di="Generic",ui=di+" "+Ft.toLowerCase(),_i=di+" "+Ot.toLowerCase(),ci="Konqueror",hi="Oculus Browser",pi="Vivaldi",gi="Yandex",vi="Whale",fi="DuckDuckGo",mi="Pale Moon",yi="Waterfox",bi="Brave",wi="Claude",Si="Codex",Pi="ChatGPT",Ei="Google Search App",ki="(\\d+(\\.\\d+)?)",Ci=new RegExp("Version/"+ki),xi=new RegExp("("+wi+"|"+Si+"|"+Pi+")\\/"+ki),Ii=new RegExp(ii,"i"),Ti=new RegExp(ti+" \\w+","i"),Fi=new RegExp(ei+" \\w+","i"),$i=new RegExp(Bt+"|PlayBook|BB10","i"),Ri={"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"},Oi=function(e,t,i,s){t=t||"";var r=function(e){return null!=e&&e.brave?bi:null}(i);return r||(null!=s&&s.detectGoogleSearchApp&&st(e,"GSA/")?Ei:st(e," OPR/")&&st(e,"Mini")?Yt:st(e," OPR/")?Kt:$i.test(e)?Bt:st(e,"IE"+Ft)||st(e,"WPDesktop")?jt:st(e,"OculusBrowser")?hi:st(e,qt)?Ht:st(e,Jt)||st(e,"Edg/")?Qt:st(e,pi+"/")?pi:st(e,"YaBrowser/")?gi:st(e,vi+"/")?vi:st(e,fi+"/")||st(e,"Ddg/")?fi:st(e,wi+"/")?wi:st(e,Si+"/")?Si:st(e,Pi+"/")?Pi:st(e,"FBIOS")?"Facebook "+Ft:st(e,"UCWEB")||st(e,"UCBrowser")?"UC Browser":st(e,"CriOS")?Vt:st(e,"CrMo")||st(e,Gt)?Gt:st(e,Rt)&&st(e,Nt)?si:st(e,"FxiOS")?Xt:st(e.toLowerCase(),ci.toLowerCase())?ci:st(e,bi+"/")?bi:((e,t)=>t&&st(t,Dt)||function(e){return st(e,Nt)&&!st(e,Gt)&&!st(e,Rt)}(e))(e,t)?st(e,Ft)?ri:Nt:st(e,"PaleMoon/")?mi:st(e,yi+"/")?yi:st(e,Zt)?Zt:st(e,"MSIE")||st(e,"Trident/")?zt:st(e,"Gecko")?Zt:"")},Ai={[jt]:[new RegExp("rv:"+ki)],[Qt]:[new RegExp(Jt+"?\\/"+ki)],[Gt]:[new RegExp("("+Gt+"|CrMo)\\/"+ki)],[Vt]:[new RegExp("CriOS\\/"+ki)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ki)],[Nt]:[Ci],[ri]:[Ci],[Kt]:[new RegExp("(Opera|OPR)\\/"+ki)],[Zt]:[new RegExp(Zt+"\\/"+ki)],[Xt]:[new RegExp("FxiOS\\/"+ki)],[ci]:[new RegExp("Konqueror[:/]?"+ki,"i")],[Bt]:[new RegExp(Bt+" "+ki),Ci],[si]:[new RegExp("android\\s"+ki,"i")],[Ht]:[new RegExp(qt+"\\/"+ki)],[hi]:[new RegExp("OculusBrowser\\/"+ki)],[pi]:[new RegExp(pi+"\\/"+ki)],[gi]:[new RegExp("YaBrowser\\/"+ki)],[vi]:[new RegExp(vi+"\\/"+ki)],[bi]:[new RegExp(bi+"\\/"+ki)],[wi]:[xi],[Si]:[xi],[Pi]:[xi],[fi]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ki)],[mi]:[new RegExp("PaleMoon\\/"+ki)],[yi]:[new RegExp(yi+"\\/"+ki)],[Ei]:[new RegExp("GSA\\/"+ki)],[zt]:[new RegExp("(rv:|MSIE )"+ki)],Mozilla:[new RegExp("rv:"+ki)]},Mi=function(e,t,i,s){var r=Oi(e,t,i,s),n=Ai[r];if(gt(n))return null;for(var o=0;n.length>o;o++){var a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Di=[[new RegExp(ii+"; "+ii+" (.*?)[);]","i"),e=>[ii,e&&e[1]||""]],[new RegExp(ei,"i"),[ei,""]],[new RegExp(ti,"i"),[ti,""]],[$i,[Bt,""]],[new RegExp(ni,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[oi,""];if(new RegExp(Ft).test(t)&&!/IEMobile\b/.test(t))return[ni+" "+Ft,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=Ri[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[ni,s]}return[ni,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[$t,[e[3],e[4],e[5]||"0"].join(".")]:[$t,""]],[/(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("("+Rt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Rt+")","i"),e=>e&&e[2]?[Rt,[e[2],e[3],e[4]||"0"].join(".")]:[Rt,""]],[/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/,[Wt,""]],[/Linux|debian/i,["Linux",""]]],Li=function(e){return Fi.test(e)?ei:Ti.test(e)?ti:Ii.test(e)?ii:new RegExp(li,"i").test(e)?li:new RegExp("("+oi+"|WPDesktop)","i").test(e)?oi:/iPad/.test(e)?Mt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Lt:$i.test(e)?Bt:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ai,"i").test(e)?ai:/(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(Ft).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)?Rt:At:new RegExp("(pda|"+Ft+")","i").test(e)?ui:new RegExp(Ot,"i").test(e)&&!new RegExp(Ot+" pc","i").test(e)?_i:""},Ni=/\bFBAV\/(\d+(?:\.\d+)*)/i,Bi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ni],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ni],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ni],[/\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"]],Ui=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function qi(e,t){return"string"==typeof(i=e)&&Ui.test(i)?e:t();var i}function Hi(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 Gi(e){return e?e.split("#")[0]:e}var Wi,Vi=["$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"],zi="NativeGzipValidationError",ji=e=>e.length>=2&&31===e[0]&&139===e[1],Ki=(e,t)=>e===nt.GZipJS||t===nt.GZipJS||"gzip"===t,Yi=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),Ji=e=>{throw Hi(zi,"Native gzip produced invalid output: "+e)},Qi=function(){var e=t(function*(e,t){18>e.size&&Ji("too-short");var i=new Uint8Array(yield e.slice(0,10).arrayBuffer());ji(i)&&8===i[2]||Ji("invalid-header");var s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(Wi)return Wi;Wi=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?3988292384^t>>>1:t>>>1;Wi[e]=t>>>0}return Wi})(),i=4294967295,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&Ji("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&Ji("invalid-size")});return function(t,i){return e.apply(this,arguments)}}();function Zi(){return Zi=t(function*(e,i,s){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var e=t(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 Qi(d,r),d}catch(e){if(null!=s&&s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}}),Zi.apply(this,arguments)}var Xi=function(e,t){var i=(void 0===t?{}:t).debugEnabled,r={_log(t){if(Ge&&(s.DEBUG||Ge.POSTHOG_DEBUG||i)&&!gt(Ge.console)&&Ge.console){for(var r=("__rrweb_original__"in Ge.console[t]?Ge.console[t].__rrweb_original__:Ge.console[t]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(e,...o)}},debug(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("debug",...t)},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];r._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){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>Xi(e+" "+t,i)};return r},es=Xi("[PostHog.js]"),ts=es.createLogger;function is(e,t){_t(e)&&e.forEach(t)}function ss(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 rs=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},ns=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){es.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),es.critical(e)}}},os=function(e){var t={};return ss(e,function(e,i){(vt(e)&&e.length>0||bt(e))&&(t[i]=e)}),t};function as(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 ls=["herokuapp.com","vercel.app","netlify.app"];function ds(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 ls)if(i===s)return!1;return!0}function us(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 _s=e=>{if(ze){try{for(var t=e+"=",i=ze.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});class cs{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new cs(r)}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 cs(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}}class hs{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 cs.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 vs}}var ps,gs=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};Ge&&!gt(Ge.crypto)&&crypto.getRandomValues&&(gs=e=>crypto.getRandomValues(e));class vs{nextUint32(){return this._buffer.length>this._cursor||(gs(this._buffer),this._cursor=0),this._buffer[this._cursor++]}constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}}var fs=()=>ms().toString(),ms=()=>(ps||(ps=new hs)).generate(),ys="",bs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ws=null,Ss={_is_supported(){if(!mt(ws))return ws;if(ws=!1,ze)try{var e="__ph_cookie_support_"+fs();Ss._set(e,"xyz"),ws='"xyz"'===_s(e),Ss._remove(e)}catch(e){ws=!1}return ws},_error(e){es.error("cookieStore error: "+e)},_get:_s,_parse(e){var t;try{t=JSON.parse(Ss._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(!ze)return!1;try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=ze),ys)return ys;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_"+fs();!ys&&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",ys=n)}return ys}(e);if(!i){var s=(e=>{var t=e.match(bs);return t?t[0]:""})(e);s!==i&&es.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(ze.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&&es.warn("cookieStore warning: large cookie, len="+d.length),ze.cookie=d,!0}catch(e){return!1}},_remove(e,t){if(null!=ze&&ze.cookie)try{Ss._set(e,"",-1,t)}catch(e){return}}},Ps=null,Es={_is_supported(){if(!mt(Ps))return Ps;var e=!0;if(gt(Ge))e=!1;else try{var t="__mplssupport__";Es._set(t,"xyz"),'"xyz"'!==Es._get(t)&&(e=!1),Es._remove(t)}catch(t){e=!1}return e||es.error("localStorage unsupported; falling back to cookie store"),Ps=e,e},_error(e){es.error("localStorage error: "+e)},_get(e){try{return null==Ge?void 0:Ge.localStorage.getItem(e)}catch(e){Es._error(e)}return null},_parse(e){try{return JSON.parse(Es._get(e))||{}}catch(e){}return null},_set(e,t){try{return null==Ge||Ge.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Es._error(e)}return!1},_remove(e){try{null==Ge||Ge.localStorage.removeItem(e)}catch(e){Es._error(e)}}},ks=[j,B,N,q,H,G,_e,ue,le],Cs=[o,n,F,R,me,fe,_,ce],xs=e=>e+"_cpm",Is=["__proto__","constructor","prototype"],Ts=e=>{if(!ht(e))return{};var t={};return Object.keys(e).forEach(i=>{-1===Is.indexOf(i)&&(t[i]=e[i])}),t},Fs=function(e,t){void 0===t&&(t=[]);var i={};return[...Cs,...t].forEach(t=>{var s=e[t];gt(s)||mt(s)||""===s||(i[t]=s)}),i},$s=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)},Rs=(e,t)=>({p:t,f:$s(JSON.stringify(e))}),Os=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{var i=Ss._parse(xs(e)),s=(null==i?void 0:i.f)===$s(t)&&_t(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},As=(e,t)=>t+"|"+(Ss._get(xs(e))||""),Ms={},Ds={_is_supported:()=>!0,_error(e){es.error("memoryStorage error: "+e)},_get:e=>e in Ms?Ms[e]:null,_parse:e=>e in Ms?Ms[e]:null,_set:(e,t)=>(Ms[e]=t,!0),_remove(e){delete Ms[e]}},Ls=null,Ns={_is_supported(){if(!mt(Ls))return Ls;if(Ls=!0,gt(Ge))Ls=!1;else try{var e="__support__";Ns._set(e,"xyz"),'"xyz"'!==Ns._get(e)&&(Ls=!1),Ns._remove(e)}catch(e){Ls=!1}return Ls},_error(e){es.error("sessionStorage error: ",e)},_get(e){try{return null==Ge?void 0:Ge.sessionStorage.getItem(e)}catch(e){Ns._error(e)}return null},_parse(e){try{return JSON.parse(Ns._get(e))||null}catch(e){}return null},_set(e,t){try{return null==Ge||Ge.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){Ns._error(e)}return!1},_remove(e){try{null==Ge||Ge.sessionStorage.removeItem(e)}catch(e){Ns._error(e)}}};class Bs{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===Oe||this.isRejected()||-1===this.consent&&this._config.cookieless_mode===Re}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:st(It,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Es:Ss,i=t._is_supported()?t:Ds;if(!this._persistentStore||this._persistentStore!==i){this._persistentStore=i;var s="localStorage"===e?Ss:Es;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==Ve?void 0:Ve.doNotTrack,null==Ve?void 0:Ve.msDoNotTrack,et.doNotTrack,null==Ve?void 0:Ve.globalPrivacyControl].some(e=>xt(e))}}var Us=["next","previous","prev",">","<","+","-","−","–"];ts("[Dead Clicks]");var qs=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(y)),s=e.instance.config.capture_dead_clicks;return St(s)?s:!!ht(s)||i},Hs=ts("[SegmentIntegration]");function Gs(e,t,i){void 0===i&&(i=!0);var s=e.config.segment;if(!s)return t();!function(e,t,i){var s=e.config.segment;if(!s)return t();var r=s=>{var r=()=>s.anonymousId()||fs();e.config.get_device_id=r,i&&s.id()&&(e.register({distinct_id:s.id(),$device_id:r()}),e.persistence.set_property(ce,Me)),t(i?void 0:s.anonymousId()||void 0)},n=s.user();"then"in n&&ct(n.then)?n.then(r):r(n)}(e,i=>{s.register(((e,t)=>{"undefined"!=typeof Promise&&Promise.resolve||Hs.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,s)=>{if(!s)return i;var r=!!t&&i.event.anonymousId===t&&!i.event.userId;r||i.event.userId||i.event.anonymousId===e.get_distinct_id()||(Hs.info("No userId set, resetting PostHog"),e.reset()),r||(t=void 0),i.event.userId&&i.event.userId!==e.get_distinct_id()&&(Hs.info("UserId set, identifying with PostHog"),e.identify(i.event.userId));var n=e.calculateEventProperties(s,i.event.properties);return i.event.properties=Object.assign({},n,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(e){return i(e,e.event.event)},page(e){return i(e,Be)},identify(e){return i(e,qe)},screen(e){return i(e,"$screen")}}})(e,i)).then(()=>{t()},e=>{Hs.error("Failed to register the Segment integration",e),t()})},i)}var Ws="posthog-js";function Vs(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;if("*"!==l&&!l.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,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==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class zs{constructor(e,t,i,s,r,n){this.name=Ws,this.setupOnce=function(o){o(Vs(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class js{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(es.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==Ge?void 0:Ge.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?Tt(o/n,0,1,es):1,c=n>1?Tt(a/n,0,1,es):1,h=l>1?Tt(d/l,0,1,es):1,p=l>1?Tt(u/l,0,1,es):1;s=rs(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}}var Ks=["flags","surveys"],Ys={[r]:{exposure:"hidden"},[l]:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"hidden"},[_]:{exposure:"hidden"},[h]:{exposure:"event"},[p]:{exposure:"hidden"},[w]:{exposure:"hidden"},[g]:{exposure:"event"},[v]:{exposure:"hidden"},[f]:{exposure:"event"},[m]:{exposure:"event"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},[S]:{exposure:"event"},[P]:{exposure:"hidden"},[E]:{exposure:"hidden"},[F]:{exposure:"hidden"},[R]:{exposure:"event"},[k]:{exposure:"event",shouldSkipFromEventProperties:e=>mt(e)},[O]:{exposure:"event"},[A]:{exposure:"event"},[M]:{exposure:"event"},[D]:{exposure:"event"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden",storageGroup:"flags"},[B]:{exposure:"hidden",storageGroup:"flags"},[U]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"flags"},[H]:{exposure:"hidden",storageGroup:"flags"},[G]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[W]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden"},[z]:{exposure:"hidden"},[j]:{exposure:"hidden"},[K]:{exposure:"hidden"},[J]:{exposure:"hidden",storageGroup:"surveys"},[Q]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Z]:{exposure:"event"},[X]:{exposure:"hidden"},[ee]:{exposure:"hidden"},[te]:{exposure:"hidden"},[ie]:{exposure:"hidden"},[se]:{exposure:"hidden"},[re]:{exposure:"event"},[ne]:{exposure:"event"},[oe]:{exposure:"event"},[ae]:{exposure:"event"},[le]:{exposure:"hidden"},[de]:{exposure:"hidden"},[Y]:{exposure:"event"},[ue]:{exposure:"hidden"},[_e]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ce]:{exposure:"hidden"},[he]:{exposure:"hidden"},[pe]:{exposure:"hidden"},[ge]:{exposure:"hidden"},[ve]:{exposure:"hidden"},[fe]:{exposure:"hidden"},[me]:{exposure:"hidden"},[C]:{exposure:"event"},[x]:{exposure:"event"},[I]:{exposure:"event"},[T]:{exposure:"event"},[we]:{exposure:"event"},[Se]:{exposure:"event"},[Pe]:{exposure:"event"},[Ee]:{exposure:"event"},[ke]:{exposure:"event"},[Ce]:{exposure:"event"},[xe]:{exposure:"event"},[Ie]:{exposure:"event"},[Te]:{exposure:"event"},[Fe]:{exposure:"event"},[$e]:{exposure:"event"}},Js=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Qs=e=>{var t=Ys[e];if(t)return t;for(var i of Js){var s=i[1];if(0===e.indexOf(i[0]))return s}},Zs=(e,t)=>{try{var i;return JSON.stringify(e,(e,t)=>kt(t)?(null!=i||(i=new WeakMap),i.has(t)||i.set(t,as(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},Xs=e=>{var t=null==ze?void 0:ze.createElement("a");return gt(t)?null:(t.href=e,t)},er=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){es.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},tr=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},ir="https?://(.*)",sr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...sr],nr="<masked>",or=["li_fat_id"];function ar(e,t){var i=rr.concat(t||[]),s={};return ss(i,function(t){var i=er(e,t);s[t]=i||null}),s}function lr(e){var t=function(e){return e?0===e.search(ir+"google.([^/?]*)")?"google":0===e.search(ir+"bing.com")?"bing":0===e.search(ir+"yahoo.com")?"yahoo":0===e.search(ir+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!mt(t)){s.$search_engine=t;var r=ze?er(ze.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function dr(){return navigator.language||navigator.userLanguage}var ur="$direct";function _r(){return(null==ze?void 0:ze.referrer)||ur}function cr(e,t,i){void 0===i&&(i=!1);var s=e?[...sr,...t||[]]:[],r=i?Gi(null==je?void 0:je.href):null==je?void 0:je.href,n=null==r?void 0:r.substring(0,1e3);return{r:_r().substring(0,1e3),u:n?tr(n,s,nr):void 0}}function hr(e,t){var i;void 0===t&&(t=!1);var s=e.r,r=e.u,n=t?Gi(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==ur?ur:null==(i=Xs(s))?void 0:i.host};if(n){o.$current_url=n;var a=Xs(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=ar(n);rs(o,l)}if(s){var d=lr(s);rs(o,d)}return o}function pr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function gr(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var vr={flags:_e,surveys:Q},fr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],mr=e=>e+"_cookie_identity_change_pending",yr=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},br="main",wr=[N,B,q,H,G,_e,W,j],Sr=e=>-1!==wr.indexOf(e),Pr=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},Er=e=>{if(!e)return{};var t=JSON.parse(e);return ht(t)?t:{}},kr=(e,t)=>{ss(e,(i,s)=>{var r=Qs(s);r&&"event"!==r.exposure||{}.hasOwnProperty.call(t,s)||delete e[s]})};class Cr{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&&es.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save(),Ge){var r=()=>this.flush();us(Ge,"beforeunload",r,{capture:!1}),us(Ge,"pagehide",r,{capture:!1}),this._onStorage=e=>{if(this._splitStorageEligible&&(!e.storageArea||e.storageArea===(null==Ge?void 0:Ge.localStorage))&&e.key)if(e.key!==this._name){if(this._splitStorage){var t=Ks.find(t=>e.key===this._groupEntryName(t));t&&this._syncCrossTabFeatureFlagProperties(e.key,t)}}else this._syncCrossTabFeatureFlagProperties(e.key,br)},us(Ge,"storage",this._onStorage)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{var t=e[0],i=e[1],s=this._pendingCrossTabFeatureFlagChanges.get(t);if(Sr(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&&Ge&&(Ge.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=Es._get(e),mt(r)){var n=this._slotWriteState(t);return n.storageValue=null,t!==br&&(n.persisted=!1),!1}s=Er(r)}catch(e){return!1}var o=t===br?s:Es._parse(this._name);if(o&&this._hasCrossTabFeatureFlagIdentityMismatch(o))return!1;var a=this._mergeCrossTabFeatureFlagProperties(s,t,i);return t===br&&this._splitStorage&&!Pr(this._partitionProps().main,s)||this._rememberCrossTabStorageFingerprint(s,t,!0,r),a}_hasCrossTabFeatureFlagIdentityMismatch(e){var t=this.props[n],i=e[n];return!gt(t)&&!gt(i)&&t!==i}_rememberCrossTabStorageFingerprint(e,t,i,s){var r=this._slotWriteState(t);r.storageValue=s,t!==br&&(r.persisted=i);try{r.fingerprint=this._entryFingerprint(e,t)}catch(e){r.fingerprint=void 0}}_mergeCrossTabFeatureFlagProperties(e,t,i){var s=!1;return wr.forEach(i=>{var r,n=null==(r=Qs(i))?void 0:r.storageGroup;if(!(t===br&&this._splitStorage&&n||t!==br&&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&&Pr(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=Es._get(this._name),i=this._slotWriteState(br),s=!1,r=!1;if(t!==i.storageValue)if(mt(t))i.storageValue=null;else{if(e=Er(t),this._crossTabFeatureFlagIdentityMismatch=!this._localIdentityChangePending&&this._hasCrossTabFeatureFlagIdentityMismatch(e),this._crossTabFeatureFlagIdentityMismatch)return!1;r=this._mergeCrossTabFeatureFlagProperties(e,br,!1),!this._splitStorage||Pr(this._partitionProps().main,e)?this._rememberCrossTabStorageFingerprint(e,br,!0,t):i.storageValue=t,s=!0}return this._splitStorage&&Ks.forEach(t=>{var i=Es._get(this._groupEntryName(t)),n=this._slotWriteState(t),o=e||{},a=s&&wr.some(e=>{var i;return(null==(i=Qs(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=Er(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=Qs(e);null!=i&&i.volatile||(this._slotWriteState((this._splitStorage?null==i?void 0:i.storageGroup:void 0)||br).fingerprint=void 0,this._markGroupDirty(e))}_markAllCrossTabFeatureFlagChangesPending(){wr.forEach(e=>this._pendingCrossTabFeatureFlagChanges.set(e,!0))}_markLoadedCrossTabFeatureFlagChangesPending(){if(this._splitStorageEligible)try{var e=Es._get(this._name),t=Er(e);this._slotWriteState(br).storageValue=e,wr.forEach(e=>{var i,s=this._splitStorage?null==(i=Qs(e))?void 0:i.storageGroup:void 0,r=s?Es._get(this._groupEntryName(s)):null;if(s){var n=this._slotWriteState(s);n.storageValue=r,n.persisted=!mt(r)}var o=s&&!mt(r)?Er(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(e===B){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(Sr(e)){var s=this._pendingCrossTabFeatureFlagChanges.get(e);if(!0!==s){var r=t;if(this._splitStorageEligible)try{var n,o=this._splitStorage?null==(n=Qs(e))?void 0:n.storageGroup:void 0,a=o?this._groupEntryName(o):this._name;r=Er(Es._get(a))[e]}catch(e){}var l=new Set(s||[]);if(e===B){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(Pr(r,i)?this._pendingCrossTabFeatureFlagChanges.delete(e):this._setCrossTabFeatureFlagChangesPending(e,!0));if(!gt(t)&&!ht(t)||gt(t)&&pt(i)&>(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&&Pr(c[e],i[e])||l.add(e)}),l.forEach(e=>{e in h==e in i&&Pr(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=Fs(e,this._config.cookie_persisted_properties||[]),i=Rs(t,this._config.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=Ss._get(this._name)||void 0;r&&As(this._name,r)===s&&(this._lastSeenCookiePropertiesFingerprint=s,this._lastSeenMainCookieValue=r)}catch(e){}else try{var n=Ss._get(this._name)||void 0;this._lastSeenCookiePropertiesFingerprint=n?As(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=Ss._get(this._name)||void 0}catch(e){}if(!i||i===this._lastSeenMainCookieValue)return!1;var s,r=As(this._name,i);try{s=Ts(JSON.parse(i))}catch(e){return!1}if((Ss._get(this._name)||void 0)!==i)return!1;this._lastSeenCookiePropertiesFingerprint=r,this._lastSeenMainCookieValue=i;var o=Os(this._name,i),a=[...Cs,...o.properties],d={};if(Object.keys(s).forEach(e=>{var t=s[e];(gt(t)||mt(t)||""===t||e===ce&&t!==Ae&&t!==Me)&&(d[e]=!0,delete s[e])}),pt(s))return!1;var u=n in s||s[ce]===Ae||s[ce]===Me,_=this.props,c=_[n],h=_[ce],p=rs({},_);[...Cs,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==a.indexOf(e)&&!(e in s)&&!d[e]&&(u||e!==n&&e!==ce)){var t=p[e];!o.isValid&&-1!==Cs.indexOf(e)&&(!1===t||0===t)||delete p[e]}}),this.props=rs(p,s),wr.forEach(e=>{var t=e in this.props;e in _===t&&Pr(_[e],this.props[e])||(t?this._markPendingCrossTabFeatureFlagChanges(e,_[e],this.props[e]):this._setCrossTabFeatureFlagChangesPending(e,!0))}),!u||ce in s||ce in this.props||this._setProp(ce,Ae);var g=this.props[n],v=this.props[ce];return!u||g===c&&v===h||(this._localIdentityChangePending=!0,this._cookieIdentityChangePending=!0,Ns._set(mr(this._name),!0),this._deleteProp(j),this._deleteProp(B),this._deleteProp(N),this._deleteProp(q),this._deleteProp(H),this._deleteProp(G),this._deleteProp(_e),this._deleteProp(ue),this._deleteProp(le),v===Ae&&(h===Me||s[ce]===Ae||!gt(c)&&g!==c)&&(kr(this.props,s),this._deleteProp(K)),v===Me?this.props.$user_id=g:delete this.props.$user_id,this._deleteProp(l)),!0}consumeCookieIdentityChange(){var e=mr(this._name),t=this._cookieIdentityChangePending||!!Ns._get(e);return this._cookieIdentityChangePending=!1,t&&Ns._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[br],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===fr.indexOf(e.persistence.toLowerCase())&&(es.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=[...Cs,...e];return i({},Es,{_parse(e){try{var i,r={};try{i=Ss._get(e)||void 0,r=i?Ts(JSON.parse(i)):{}}catch(e){}var o,a=JSON.parse(Es._get(e)||"{}");if(t){var l=Os(e,i),d=[...Cs,...l.properties],u={};Object.keys(r).forEach(e=>{var t=r[e];mt(t)||""===t||e===ce&&t!==Ae&&t!==Me||(u[e]=t)});var _=n in u||u[ce]===Ae||u[ce]===Me;if(Object.keys(u).length>0){var c,h=a[n],p=null!==(c=a[ce])&&void 0!==c?c:Ae;s.forEach(e=>{if(-1!==d.indexOf(e)&&!(e in r)&&(_||e!==n&&e!==ce)){var t=a[e];!l.isValid&&-1!==Cs.indexOf(e)&&(!1===t||0===t)||delete a[e]}}),!_||ce in r||ce in a||(a[ce]=Ae),!_||(n in u?u[n]:a[n])===h&&(ce in u?u[ce]:a[ce])===p||(ks.forEach(e=>delete a[e]),u[ce]===Me&&n in u?a.$user_id=u[n]:delete a.$user_id,u[ce]!==Me&&(delete a[Y],delete a[K]),delete a.__alias)}o=rs(a,u)}else o=rs(r,a);return Es._set(e,o),o}catch(e){}return null},_set(i,s,r,n,o,a){var l=Es._set(i,s,void 0,void 0,a);try{var d=Fs(s,e);if(Object.keys(d).length){if(t){var u=xs(i),_=Rs(d,e);if(Ss._set(u,_,r,n,o,a),Ss._get(u)!==JSON.stringify(_)){Ss._remove(u,n);var c=Fs(s);return Ss._set(i,c,r,n,o,a),l}}Ss._set(i,d,r,n,o,a)}}catch(e){Es._error(e)}return l},_remove(e,t){try{null==Ge||Ge.localStorage.removeItem(e),Ss._remove(e,t),Ss._remove(xs(e),t)}catch(e){Es._error(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),r=!1,o=!1,a=e.persistence.toLowerCase();return"localstorage"===a&&Es._is_supported()?(t=Es,o=!0):"localstorage+cookie"===a&&s._is_supported()?(t=s,o=!0,r=!0):"sessionstorage"===a&&Ns._is_supported()?t=Ns:"memory"===a?t=Ds:"cookie"===a&&Ss._is_supported()?(t=Ss,r=!0):s._is_supported()?(t=s,o=!0,r=!0):Ss._is_supported()?(t=Ss,r=!0):t=Ds,this._splitStorageEligible=o,this._storesIdentityInCookie=r,t}_groupEntryName(e){return this._name+"__"+e}_resolveSplitStorage(e){return this._splitStorageEligible&&!!e.split_storage}properties(){var e={};return ss(this.props,(t,i)=>{var s=Qs(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?Es._parse(this._name):null,s={};if(t)try{ss(s=Ts(Ss._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=rs({},r)),this._splitStorage&&this._loadGroupEntries(),t&&r){var o,a,l=null==i?void 0:i[n],d=null!==(o=null==i?void 0:i[ce])&&void 0!==o?o:Ae,u=r[n],_=null!==(a=r[ce])&&void 0!==a?a:Ae;if(u!==l||_!==d){this._cookieIdentityChangePending=!0,Ns._set(mr(this._name),!0);var c=rs({},this.props);ks.forEach(e=>delete c[e]),_===Ae&&(d===Me||s[ce]===Ae||!gt(l)&&u!==l)&&(kr(c,s),delete c[K]),this.props=c;var h=new Set;ks.forEach(e=>{var t,i=null==(t=Qs(e))?void 0:t.storageGroup;i&&h.add(i)}),h.forEach(e=>{var t={};ss(this.props,(i,s)=>{var r;(null==(r=Qs(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),pt(t)?(Es._remove(this._groupEntryName(e)),this._slotState[e]={}):Es._set(this._groupEntryName(e),t)&&(this._slotState[e]={persisted:!0,fingerprint:this._entryFingerprint(t,e)})})}}Ns._get(mr(this._name))&&(this._cookieIdentityChangePending=!0)}}_loadGroupEntries(){for(var e of Ks){var t=Es._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)||rs(this.props,t)}}}_mainCarriesGroupKey(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=Qs(t))?void 0:i.storageGroup)===e})}_groupEntryIsStale(e,t){var i=vr[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||e===_&&this._facebookClickIdChangePending)){var i=this._splitStorage?null==(t=Qs(e))?void 0:t.storageGroup:void 0,s=i?Es._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(_));var t=!e&&!this._storageMigrationInProgress;t||(this._crossTabFeatureFlagIdentityMismatch=!1);var i=!!t&&this._reconcileCrossTabFeatureFlagPropertiesBeforeWrite();if(this._crossTabFeatureFlagIdentityMismatch)this._config.debug&&es.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,br);"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,br);"written"===r&&this._rememberCurrentCookieProperties(i),"failed"!==r&&(this._localIdentityChangePending=!1,this._facebookClickIdChangePending=!1,wr.forEach(e=>{var t;null!=(t=Qs(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 wr.forEach(i=>{var s;(null==(s=Qs(i))?void 0:s.storageGroup)===t&&e._pendingCrossTabFeatureFlagChanges.delete(i)}),1;var n=e._writeEntry(Es,e._groupEntryName(t),r,t);"failed"!==n&&wr.forEach(i=>{var s=Qs(i);(null==s?void 0:s.storageGroup)!==t||"written"!==n&&s.volatile||e._pendingCrossTabFeatureFlagChanges.delete(i)})};for(var o of Ks)n(o)}_partitionProps(){var e={},t={flags:{},surveys:{}};return ss(this.props,(i,s)=>{var r,n=null==(r=Qs(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}_entryFingerprint(e,t){if(t===br)return JSON.stringify(e)+"|"+this._expire_days+"|"+this._cross_subdomain+"|"+this._secure;var i={};return ss(e,(e,t)=>{var s;i[t]=null!=(s=Qs(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}_writeEntry(e,t,i,s){var r,n=this._slotWriteState(s);if(s!==br&&!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!==br&&(n.persisted=!0),gt(r)||(n.fingerprint=r),this._splitStorageEligible&&(n.storageValue=Es._get(t)),"written"):(this._config.debug&&es.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 Ks)Es._remove(this._groupEntryName(s));i?delete this._slotState[br]: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(ss(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(ss(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==ze?void 0:ze.URL;if(e!==this._campaign_params_url){var t=function(e,t,i){if(!ze)return{};var s,r=t?[...sr,...i||[]]:[],n=ar(tr(ze.URL,r,nr),e),o=(s={},ss(or,function(e){var t=_s(e);s[e]=t||null}),s);return rs(o,n)}(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties),i=!pt(os(t));return i&&this.register(t),this._campaign_params_url=e,i?t:void 0}}update_search_keyword(){var e;this.register((e=null==ze?void 0:ze.referrer)?lr(e):{})}update_referrer_info(){var e;this.register_once({$referrer:_r(),$referring_domain:null!=ze&&ze.referrer&&(null==(e=Xs(ze.referrer))?void 0:e.host)||ur},void 0)}set_initial_person_info(){if(!this.props[ge]&&!this.props[ve]){var e=cr(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties,this._config.disable_capture_url_hashes);this.register_once({[fe]:this._storesIdentityInCookie?{r:yr(e.r),u:e.u?yr(e.u):void 0}:e},void 0)}}get_initial_props(){var e={};ss([ve,ge],t=>{var i=this.props[t];i&&ss(i,function(t,i){e["$initial_"+rt(i)]=t})});var t=this.props[fe];if(t){var i=function(e,t){void 0===t&&(t=!1);var i=hr(e,t),s={};return ss(i,function(e,t){s["$initial_"+rt(t)]=e}),s}(t,this._config.disable_capture_url_hashes);rs(e,i)}return e}safe_merge(e){return ss(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[br],this._writeNow()))}finally{this._storageMigrationInProgress=!1,h&&this._endCookieSyncSuppression()}}_truncateExistingPersonInfoForCookie(){var e=this.props[fe];if(this._storesIdentityInCookie&&ht(e)&&"string"==typeof e.r){var t=yr(e.r),s="string"==typeof e.u?yr(e.u):e.u;t===e.r&&s===e.u||this._setProp(fe,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[c]||{};i[e]=t,this._setProp(c,i),this.save()}remove_event_timer(e){var t=this.props[c]||{},i=t[e];return gt(i)||(delete t[e],this._setProp(c,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&&(e!==n&&e!==ce||r===t||(this._localIdentityChangePending=!0),e!==_||Pr(r,t)||(this._facebookClickIdChangePending=!0),this._markPendingCrossTabFeatureFlagChanges(e,r,t),null!=(s=Qs(e))&&s.volatile||this._markGroupDirty(e))}_deleteProp(e,t){void 0===t&&(t=!0),delete this.props[e],t&&(Sr(e)&&this._setCrossTabFeatureFlagChangesPending(e,!0),e===_&&(this._facebookClickIdChangePending=!0),this._markGroupDirty(e))}_markGroupDirty(e){var t,i=null==(t=Qs(e))?void 0:t.storageGroup;i&&(this._slotWriteState(i).dirty=!0)}_slotWriteState(e){return this._slotState[e]||(this._slotState[e]={})}}var xr={GZipJS:"gzip-js",Base64:"base64"},Ir={Activation:"events",Cancellation:"cancelEvents"},Tr={Button:"button",Tab:"tab",Selector:"selector"},Fr={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"},$r={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Rr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Or={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ar={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Mr={Once:"once",Recurring:"recurring",Always:"always"},Dr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Lr={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"},Nr={Popover:"popover",Inline:"inline"};function Br(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&ct(i.then)&&i.then(void 0,()=>{})}}}}var Ur={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},qr={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"},Hr={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"},Gr=ts("[RateLimiter]");class Wr{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=>{Gr.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void Gr.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(pe))&&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(pe,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}}var Vr=ts("[RemoteConfig]");class zr{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=et._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=et.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=et.__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 Vr.info("Using preloaded remote config",this.remoteConfig),void this._onRemoteConfig(this.remoteConfig);if(this._instance._shouldDisableFlags())return void Vr.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Vr.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){Vr.error("Error loading remote config",e),this._onRemoteConfig()}}_onRemoteConfig(e,t){!e&&t&&(0===t.statusCode?t.error||Vr.warn("Failed to fetch remote config from PostHog."):Vr.error("Failed to fetch remote config from PostHog."));try{this._instance._onRemoteConfig(e?{ok:!0,config:e}:{ok:!1})}catch(e){Vr.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){Vr.error("Error loading feature flags",e)}}}var jr=["fatal","error","warning","log","info","debug"],Kr=Uint8Array,Yr=Uint16Array,Jr=Uint32Array,Qr=new Kr([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]),Zr=new Kr([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]),Xr=new Kr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),en=function(e,t){for(var i=new Yr(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new Jr(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]},tn=en(Qr,2),sn=tn[1];tn[0][28]=258,sn[258]=28;for(var rn=en(Zr,0)[1],nn=new Yr(32768),on=0;32768>on;++on){var an=(43690&on)>>>1|(21845&on)<<1;nn[on]=((65280&(an=(61680&(an=(52428&an)>>>2|(13107&an)<<2))>>>4|(3855&an)<<4))>>>8|(255&an)<<8)>>>1}var ln=function(e,t,i){for(var s=e.length,r=0,n=new Yr(t);s>r;++r)++n[e[r]-1];var o,a=new Yr(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new Yr(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[nn[_]>>>l]=d}else for(o=new Yr(s),r=0;s>r;++r)o[r]=nn[a[e[r]-1]++]>>>15-e[r];return o},dn=new Kr(288);for(on=0;144>on;++on)dn[on]=8;for(on=144;256>on;++on)dn[on]=9;for(on=256;280>on;++on)dn[on]=7;for(on=280;288>on;++on)dn[on]=8;var un=new Kr(32);for(on=0;32>on;++on)un[on]=5;var _n=ln(dn,9,0),cn=ln(un,5,0),hn=function(e){return(e/8|0)+(7&e&&1)},pn=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof Yr?Yr:e instanceof Jr?Jr:Kr)(i-t);return s.set(e.subarray(t,i)),s},gn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},vn=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},fn=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 Kr(0),0];if(1==r){var o=new Kr(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 Yr(c+1),p=mn(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 Kr(h),p]},mn=function(e,t,i){return-1==e.s?Math.max(mn(e.l,t,i+1),mn(e.r,t,i+1)):t[e.s]=i},yn=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Yr(++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]},bn=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},wn=function(e,t,i){var s=i.length,r=hn(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)},Sn=function(e,t,i,s,r,n,o,a,l,d,u){gn(t,u++,i),++r[256];for(var _=fn(r,15),c=_[0],h=_[1],p=fn(n,15),g=p[0],v=p[1],f=yn(c),m=f[0],y=f[1],b=yn(g),w=b[0],S=b[1],P=new Yr(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=fn(P,7),C=k[0],x=k[1],I=19;I>4&&!C[Xr[I-1]];--I);var T,F,R,O,A=d+5<<3,M=bn(r,dn)+bn(n,un)+o,D=bn(r,c)+bn(n,g)+o+14+3*I+bn(P,C)+(2*P[16]+3*P[17]+7*P[18]);if(M>=A&&D>=A)return wn(t,u,e.subarray(l,l+d));if(gn(t,u,1+(M>D)),u+=2,M>D){T=ln(c,h,0),F=c,R=ln(g,v,0),O=g;var L=ln(C,x,0);for(gn(t,u,y-257),gn(t,u+5,S-1),gn(t,u+10,I-4),u+=14,E=0;I>E;++E)gn(t,u+3*E,C[Xr[E]]);u+=3*I;for(var N=[m,w],B=0;2>B;++B){var U=N[B];for(E=0;U.length>E;++E)gn(t,u,L[q=31&U[E]]),u+=C[q],q>15&&(gn(t,u,U[E]>>>5&127),u+=U[E]>>>12)}}else T=_n,F=dn,R=cn,O=un;for(E=0;a>E;++E)if(s[E]>255){var q;vn(t,u,T[257+(q=s[E]>>>18&31)]),u+=F[q+257],q>7&&(gn(t,u,s[E]>>>23&31),u+=Qr[q]);var H=31&s[E];vn(t,u,R[H]),u+=O[H],H>3&&(vn(t,u,s[E]>>>5&8191),u+=Zr[H])}else vn(t,u,T[s[E]]),u+=F[s[E]];return vn(t,u,T[256]),u+F[256]},Pn=new Jr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),En=function(){for(var e=new Jr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),kn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Cn(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=En[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=(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 Kr(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=wn(l,d,e.subarray(u,_)):(l[u]=n,d=wn(l,d,e.subarray(u,o)))}else{for(var c=Pn[t-1],h=c>>>13,p=8191&c,g=(1<<i)-1,v=new Yr(32768),f=new Yr(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 Jr(25e3),S=new Yr(288),P=new Yr(32),E=0,k=0,C=(u=0,0),x=0,I=0;o>u;++u){var T=b(u),F=32767&u,R=f[T];if(v[F]=R,f[T]=F,u>=x){var O=o-u;if((E>7e3||C>24576)&&O>423){d=Sn(e,l,0,w,S,P,k,C,I,u-I,d),C=E=k=0,I=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&&T==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,z=V-v[V]+32768&32767;z>W&&(W=z,R=V)}}}N+=(F=R)-(R=v[F])+32768&32767}if(D){w[C++]=268435456|sn[M]<<18|rn[D];var j=31&sn[M],K=31&rn[D];k+=Qr[j]+Zr[K],++S[257+j],++P[K],x=u+M,++E}else w[C++]=e[u],++S[e[u]]}}d=Sn(e,l,n,w,S,P,k,C,I,u-I,d)}return pn(a,0,s+hn(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,!0)),u=d.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&&kn(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)}}(d,t),kn(d,u-8,i.d()),kn(d,u-4,s),d}var xn=!!Ye||!!Ke,In="text/plain",Tn=!1,Fn=(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:"")},$n=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 ss(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},Rn=e=>{if(e._encodedBody)return e._encodedBody;var t=e.data,i=e.compression;if(t){if(i===xr.GZipJS){var s=Cn(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new Kr(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 Kr(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 pn(i,0,s)}(Zs(t)),{mtime:0});return{contentType:In,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===xr.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):e}(Zs(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Zs(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Zs(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},On=e=>{var t,s,r=()=>"sendBeacon"===e.transport?{url:$n(e.url,{compression:xr.Base64}),encodedBody:Rn(i({},e,{compression:xr.Base64,_encodedBody:void 0}))}:{url:Fn(e.url,"compression"),encodedBody:Rn(i({},e,{compression:void 0,_encodedBody:void 0}))};try{t=Rn(e)}catch(t){if(Ki(e.compression,er(e.url,"compression")))return es.error("Failed to gzip request body, sending uncompressed payload",t),r();throw t}return t&&Ki(e.compression,er(e.url,"compression"))&&!((s=t.body)instanceof ArrayBuffer?ji(new Uint8Array(s)):ArrayBuffer.isView(s)&&ji(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Tn=!0,r()):{url:e.url,encodedBody:t}},An=e=>{try{return On(e)}catch(t){return es.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},Mn=function(){var e=t(function*(e){var t=Zs(e.data),r=yield function(e,t,i){return Zi.apply(this,arguments)}(t,s.DEBUG,{rethrow:!0});if(!r)return e;var n=yield r.arrayBuffer();return i({},e,{_encodedBody:{contentType:In,body:n,estimatedSize:n.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Dn=/Failed to fetch|NetworkError|Load failed/i,Ln=e=>"TypeError"===(null==e?void 0:e.name)&&Dn.test((null==e?void 0:e.message)||""),Nn=e=>{var t=An(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;ss(e.headers,function(e,t){d.append(t,e)}),o&&d.append("Content-Type",o);var u=null,_=!1;if(Je){var c=new Je;u={signal:c.signal,timeout:setTimeout(()=>{var t;_=!0,c.abort(Hi("AbortError","PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":"")))},e.timeout)}}var h=t=>{_&&"AbortError"===(null==t?void 0:t.name)||Ln(t)?es.warn(t):es.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{var p;Ke(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){es.error(e)}null==e.callback||e.callback(s)})).catch(h).finally(()=>u?clearTimeout(u.timeout):null)}catch(e){u&&clearTimeout(u.timeout),h(e)}}},Bn=e=>{try{var t,s=On(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(Ve.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 Bn(i({},e,{data:c(u.slice(0,_))})),void Bn(i({},e,{data:c(u.slice(_))}))}es.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Nn(i({},e,{_keepaliveDisabled:!0}))}catch(e){es.warn("Beacon send failed",e)}},Un=(e,t,s,r)=>{var n="query"===r?"POST"===t?"sent_at":"_":void 0;return $n(s===xr.GZipJS?Fn(e,"compression"):e,i({},n?{[n]:Date.now().toString()}:{},s===xr.GZipJS?{}:{compression:s}))},qn=[];Ke&&qn.push({transport:"fetch",method:Nn}),Ye&&qn.push({transport:"XHR",method(e){var t=An(e);if(t){var i=new Ye,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,o=r.body;ss(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)}}}),null!=Ve&&Ve.sendBeacon&&qn.push({transport:"sendBeacon",method:Bn});var Hn=3e3;class Gn{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=Tt((null==t?void 0:t.flush_interval_ms)||Hn,250,5e3,es.createLogger("flush interval"),Hn),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)&&ss(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){es.error(e)}}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return ss(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}}var Wn=["retriesPerformedSoFar"];class Vn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!gt(Ge)&&"onLine"in Ge.navigator&&(this._areWeOnline=Ge.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},us(Ge,"online",this._onlineListener),us(Ge,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var t=e.retriesPerformedSoFar,s=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,Wn);wt(t)&&(s.url=$n(s.url,{retry_count:t})),this._instance._send_request(i({},s,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this._enqueue(i({retriesPerformedSoFar:t},s));0===e.statusCode&&es.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==s.callback||s.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;return Math.ceil(s+r*(s-i))}(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)"),es.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(Ge)||(this._onlineListener&&(Ge.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(Ge.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){es.error(e)}}this._queue=[]}}class zn{constructor(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)},this._instance=e}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(){us(Ge,"scroll",this._updateScrollData,{capture:!0}),us(Ge,"scrollend",this._updateScrollData,{capture:!0}),us(Ge,"resize",this._updateScrollData)}scrollElement(){var e;if(!this._scrollRoot)return null==Ge||null==(e=Ge.document)?void 0:e.documentElement;var t=_t(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var i of t){var s,r=null==Ge||null==(s=Ge.document)?void 0:s.querySelector(i);if(r)return r}}_scrollPosition(e){var t,i,s="y"===e?"scrollTop":"scrollLeft";if(this._scrollRoot){var r=this.scrollElement();return r&&r[s]||0}return Ge?"y"===e?Ge.scrollY||Ge.pageYOffset||(null==(t=Ge.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:Ge.scrollX||Ge.pageXOffset||(null==(i=Ge.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this._scrollPosition("y")}scrollX(){return this._scrollPosition("x")}}var jn=e=>cr(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);class Kn{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({[he]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||jn,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[he]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?hr(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 ss(os(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+rt(i)]=t}),e}}class Yn{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={}}}var Jn=ts("[SessionId]"),Qn=864e5;class Zn{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 Yn,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(e.config.cookieless_mode===Oe)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||fs,this._windowIdGenerator=i||fs;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*Tt(this._config.session_idle_timeout_seconds||1800,60,36e3,Jn.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=Ns._parse(this._window_id_storage_key),o=Ns._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:Ns._remove(this._window_id_storage_key),Ns._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&&Ns._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ns._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ns._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({[F]:[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(F):(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({[F]:[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[F];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 Jn.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void Jn.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&&Ge&&(Ge.removeEventListener(Ne,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._flushPendingActivityTimestamp(),this._canUseSessionStorage()&&Ns._remove(this._primary_window_exists_storage_key)},us(Ge,Ne,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=null),void 0===i&&(i=!1),this._config.cookieless_mode===Oe)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>Qn),g=h?p:wt(d)&&Math.abs(s-d)>Qn,v=!1,f=u,m=!l||!!h,y=l,b=!m&&!e&&this._sessionHasBeenIdleTooLong(s,_);if(b){(b=this._isSessionIdleAfterCrossTabRefresh(s))||Jn.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(),Jn.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)&&(Jn.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 Xn(){return(Xn=t(function*(){var e=null==Ve?void 0:Ve.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return vt(i)&&i.length>0?i:void 0}catch(e){return void es.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function eo(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 to(e,t,i){return Zs({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var io="custom",so="i.posthog.com",ro=/^\/static\//,no=["/s/","/e/","/i/"];class oo{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("."+so,".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":io),this._regionCache[this.apiHost]}_staticAssetHostOverride(e){if(ro.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}_urlKey(e){var t=Xs(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=Xs(i))?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&"api"===e&&no.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||(u={apiHost:d,rewriteRequestPath:r,urls:new Set},this._ingestionEndpoints=u),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===io)return this._prepareEndpoint(e,t,this.apiHost+t);var s=so+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)}}}var ao=ts("[Surveys]"),lo={ignoreConditions:!1,ignoreDelay:!1,displayType:Nr.Popover},uo=ts("[PostHog ExternalIntegrations]"),_o={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class co{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=et.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return uo.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=et.__PosthogExtensions__)&&null!=(t=t.integrations)&&t[n]||e._loadScript(_o[n],()=>{var t;null==(t=et.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[n])||t.start(e._instance)}),!o&&null!=(s=et.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=et.__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()}}}class ho{constructor(e,t){this._logger=e,this._client=t,this._extensions=new Map,this._disposed=!1}add(e){var i=this;return t(function*(){if(i._disposed)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i._extensions.has(e.name))throw new Error('Browser extension "'+e.name+'" is already registered');i._extensions.set(e.name,e);try{var t=e.setup(i._client);t&&(yield t)}catch(t){var s=i._extensions.get(e.name)===e;s&&i._extensions.delete(e.name),i._logger.error('Failed to set up browser extension "'+e.name+'"',t),s&&i._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)}}}class po{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)}}var go="extensionsRemoteConfig";class vo{constructor(e){this._disposed=!1,this.instance=e,this._logger=es,this._latestRemoteConfigResult=e._lastRemoteConfig,this.kv=new po(e),this.onEvent=e=>Br(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 Br(()=>{});var t=t=>{try{e(t)}catch(e){this._logger.error("Browser extension remote config listener failed",e)}},i=this.instance._internalEventEmitter.on(go,t);return this._latestRemoteConfigResult&&t(this._latestRemoteConfigResult),Br(i)},this._runtime=new ho(es.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(o))&&void 0!==e?e:this.distinctId}get deviceId(){var e=this.instance.get_property(o);return"string"==typeof e?e:void 0}get library(){return{name:s.LIB_NAME,version:s.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,i,s){var r=this;return t(function*(){s?r.instance.capture(e,i,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):r.instance.capture(e,i)})()}registerDynamicEventProperties(e){return Br(this.instance._registerExtensionEventProperties(e))}handleRemoteConfig(e){this._disposed||(this._latestRemoteConfigResult=e,this.instance._internalEventEmitter.emit(go,e))}sendRequest(e,i){var s=this;return t(function*(){var t;void 0===i&&(i={});var r=s.instance.requestRouter.endpointFor(null!==(t=i.target)&&void 0!==t?t:"api",e),n={method:i.method,url:i.query?$n(r,i.query):r,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?nt.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(s.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,s.instance._send_request(n)})})()}dispose(){this._disposed||(this._disposed=!0,this._runtime.dispose())}}var fo,mo={},yo=0,bo=()=>{},wo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',So="Surveys module not available",Po="sanitize_properties is deprecated. Use before_send instead",Eo="Invalid value for property_denylist config: ",ko=/^[A-Za-z0-9_-]{1,400}$/,Co=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,xo=["token","distinct_id",be],Io="posthog",To=!xn&&-1===(null==Ze?void 0:Ze.indexOf("MSIE"))&&-1===(null==Ze?void 0:Ze.indexOf("Mozilla")),Fo=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},$o=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:ds(null==ze?void 0:ze.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:bo,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==Ge||null==(t=Ge.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){es.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:De,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Hn},error_tracking:{},_onCapture:bo},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:Us,ignore_text_selection:!0}:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:Fo(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))},Ro=[["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"]],Oo=e=>{var t={};for(var i of Ro){var s=i[0],r=i[1];gt(e[s])||(t[r]=e[s])}var n=rs({},t,e),o=e.__preview_external_dependency_versioned_paths;return gt(o)||(gt(e.strict_script_versioning)&&(n.strict_script_versioning=!!o),vt(o)&>(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]:es.error(Eo+e.property_denylist)),n};class Ao{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){es.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Mo{_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 this.config.cookieless_mode===Oe||this.config.cookieless_mode===Re&&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()&&this.get_distinct_id()===ye){var e=this.persistence;if(e){this._is_persistence_disabled()||e.load(!0);var t=this.get_distinct_id();if(!t||t===ye){var i=this.config.get_device_id(fs());this.register({distinct_id:i,$device_id:i}),e.set_property(ce,Ae)}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 e;this.webPerformance=new Ao,this._personProcessingSetOncePropertiesSent=!1,this.version=s.LIB_VERSION,this._sessionRegisteredPropKeys=new Set,this._sessionRegisteredPropertiesStorageKey="",this._internalEventEmitter=new Yn,this._extensions=[],this._extensionEventPropertyProducers=[],this._hasStableInitialDistinctId=!1,this._hasWarnedAboutVolatileIdentity=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=$o(),this.SentryIntegration=zs,this.sentryIntegration=e=>function(e,t){var i=Vs(e,t);return{name:Ws,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 zn(this),this.pageViewManager=new js(this),this.rateLimiter=new Wr(this),this.requestRouter=new oo(this),this.consent=new Bs(this),this.externalIntegrations=new co(this);var t=null!==(e=Mo.__defaultExtensionClasses)&&void 0!==e?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.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=>es.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==Io){var s,r=null!==(s=mo[i])&&void 0!==s?s:new Mo;return r._init(e,t,i),mo[i]=r,mo[Io][i]=r,r}return this._init(e,t,i)}_init(e,t,r){var n,o,l;void 0===t&&(t={});var d,u=vt(e)?e.trim():"";if(!u)return es.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return u!==(null==(d=this.config)?void 0:d.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=$o(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 _=$o(t.defaults),c=Oo(t),h=rs({},_,c,{name:r,token:u});ht(_.rageclick)&&ht(c.rageclick)&&(h.rageclick=rs({},_.rageclick,c.rageclick)),ht(_.session_recording)&&ht(c.session_recording)&&(h.session_recording=rs({},_.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&es.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:xr.GZipJS;var p=this._is_persistence_disabled();if(this.persistence=new Cr(this.config,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cr(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&&Ns._is_supported()){var g=Ns._parse(this._sessionRegisteredPropertiesStorageKey);_t(g)&&g.forEach(e=>{vt(e)&&this._sessionRegisteredPropKeys.add(e)})}else Ns._remove(this._sessionRegisteredPropertiesStorageKey);var v=i({},this.persistence.props),f=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Gn(e=>this._send_retriable_request(e),this.config.request_queue_config),this._retryQueue=new Vn(this),this.__request_queue=[];var m=this._inCookielessMode();m||(this.sessionManager=new Zn(this),this.sessionPropsManager=new Kn(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?(es.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._initExtensions(m)},0)):(es.info("Initializing extensions synchronously"),this._initExtensions(m)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&es.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:v,s:f}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var y=null==(o=t.bootstrap)?void 0:o.distinctID;if(this._hasStableInitialDistinctId=!!y&&!ft(y),void 0!==(null==(l=t.bootstrap)?void 0:l.distinctID)){var b=t.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(ce);if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&S===Ae)this.identify(b);else if(t.bootstrap.isIdentifiedID&&null!=w&&w!==b&&S===Me)es.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(fs()),E=t.bootstrap.isIdentifiedID?P:b;this.persistence.set_property(ce,t.bootstrap.isIdentifiedID?Me:Ae),this.register({distinct_id:b,$device_id:E})}}if(m)this.register_once({distinct_id:ye,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(fs());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(ce,Ae)}return us(Ge,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?Gs(this,()=>this._loaded()):this._loaded(),ct(this.config._onCapture)&&this.config._onCapture!==bo&&(es.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&es.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 Xn.apply(this,arguments)}().then(e=>{e&&this.register({[a]:e})}).catch(bo),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=>{es.error('Failed to dispose browser extension "'+e.name+'"',t)})}):this._extensions.push(e)}_enrollFeatureFlags(){var e,t,i,s,r,n,o=null!==(e=null==(t=this.config.__extensionClasses)?void 0:t.featureFlags)&&void 0!==e?e:null==(i=Mo.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(s=this._featureFlagsReloadingUnsubscribe)||s.call(this),this._featureFlagsReloadingUnsubscribe=void 0,this.featureFlags=new o(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(e){var t,s,r,n,o,a,l,d=performance.now(),u=i({},Mo.__defaultExtensionClasses,this.config.__extensionClasses),_=[];u.exceptions&&this._extensions.push(this.exceptions=null!==(t=this.exceptions)&&void 0!==t?t:new u.exceptions(this)),u.historyAutocapture&&this._extensions.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this._extensions.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this._extensions.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||_.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this._enrollExtension(this.autocapture=new u.autocapture(this),_),u.surveys&&this._enrollExtension(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new u.surveys(this),_),u.logs&&this._enrollExtension(this.logs=null!==(r=this.logs)&&void 0!==r?r:new u.logs(this),_),u.metrics&&this._extensions.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this._extensions.push(this.productTours=new u.productTours(this)),u.heatmaps&&this._extensions.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this._extensions.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,qs)),u.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this._extensions.forEach(e=>{e.initialize&&_.push(()=>{null==e.initialize||e.initialize()})}),_.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(_,d)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this._processInitTaskQueue(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){es.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[we]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Se]:s}),this.config.__preview_deferred_init_extensions&&es.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!ze||!ze.body)return es.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=st(s.supportedCompression,xr.GZipJS)?xr.GZipJS:st(s.supportedCompression,xr.Base64)?xr.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:De}),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){es.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 zr(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()&&is(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;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Ue),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this._requestQueue)||s.unload(),null==(r=this._retryQueue)||r.unload()):this._shouldCapturePageleave()&&this.capture(Ue,null,{transport:"sendBeacon"})}_send_request(e){var t;this.__loaded?To?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"===_&>(n.compression)&&n.data&&(n.compression=xr.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=Un(n.url,n.method,n.compression,n.timestampMode);var c=qn.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){Ln(e)?es.warn(e):es.error(e),null==n.callback||n.callback({statusCode:0,error:e})}};"sendBeacon"!==_&&n.data&&n.compression===xr.GZipJS&&Qe&&"undefined"!=typeof Promise&&!Tn?Mn(n).then(e=>{p(e)}).catch(t=>{if(Yi(t))return Tn=!0,void p(i({},n,{compression:void 0,url:Un(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 Yi(e)||t===zi})(t)&&(Tn=!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){yo++;try{var t,i=[],s=[],r=[];is(e,e=>{if(e)if(_t(t=e[0]))r.push(e);else if(ct(e))try{e.call(this)}catch(t){es.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){is(e,function(e){try{if(_t(e[0])){var i=t;ss(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){es.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{yo--}}push(e){if(yo>0&&_t(e)&&vt(e[0])){var t=Mo.prototype[e[0]];ct(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}_getPersistedFacebookClickId(){var e,t=null==(e=this.persistence)?void 0:e.get_property(_);return vt(t)&&Co.test(t)?{value:t,delivered:!1}:ht(t)&&vt(t.value)&&Co.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}_updateFacebookClickId(e,t,i,s){if(this.persistence){this.persistence.refreshKey(_);var r=this._getPersistedFacebookClickId();if(!s){if(i)return vt(t)&&Co.test(t)?(t!==(null==r?void 0:r.value)&&this.persistence.register({[_]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==r?void 0:r.value)||!r.delivered}):void this.persistence.unregister(_);if(vt(e)&&ko.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({[_]:{value:n,delivered:!1}}),{value:n,pending:!0}}return r?{value:r.value,pending:!r.delivered}:void 0}this.persistence.unregister(_)}}_markFacebookClickIdDelivered(e){if(this.persistence){this.persistence.refreshKey(_);var t=this._getPersistedFacebookClickId();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[_]:{value:e,delivered:!0}})}}capture(e,t,s){var r,n,o,a,l,d,_,c,h,p;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)&&(es.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||es.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=qi(null==s?void 0:s.uuid,fs),w={uuid:b,event:e,properties:this.calculateEventProperties(e,t||{},y,b)};e===Be&&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(W);(null==s?void 0: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)&&u in s.$set,k=E||!!P&&u in P,C=E?null==s||null==(r=s.$set)?void 0:r[u]:null==P?void 0:P[u],x=_t(null==t?void 0:t.$unset)?t.$unset:[],I=(null==s?void 0:s.$unset)||[],T=-1!==x.indexOf(u)||-1!==I.indexOf(u),F=this._updateFacebookClickId(null==(n=f)?void 0:n.fbclid,C,k,T);F&&!0===w.properties.$process_person_profile&&F.pending&&!k&&!S&&(w.$set=i({[u]: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!==He,e===qe);if(O&&(w.$set_once=O),null!=s&&s._noTruncate||(_=this.config.properties_string_max_length,c=w,h=e=>vt(e)?e.slice(0,_):e,p=new Set,w=function e(t,i){if(t!==Object(t))return h?h(t):t;if(!p.has(t)){var s;if(p.add(t),_t(t))s=[],is(t,t=>{s.push(e(t))});else{var r={};ss(kt(t)?as(t):t,(t,i)=>{p.has(t)||(r[i]=e(t,i))}),s=r}return s}}(c)),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 Vi.forEach(s),t.forEach(s),i}(w.properties,xo)),e===Dr.DISMISSED||e===Dr.SENT){var A=null==t?void 0:t[Lr.SURVEY_ID],M=null==t?void 0:t[Lr.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){ao.error("Failed to persist survey seen state",e)}})({id:A,current_iteration:M}),w.$set=i({},w.$set,{[eo({id:A,current_iteration:M},e===Dr.SENT?"responded":"dismissed")]:!0})}else e===Dr.SHOWN&&(w.$set=i({},w.$set,{[Lr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===qr.SHOWN){var D=null==t?void 0:t[Hr.TOUR_TYPE];D&&(w.$set=i({},w.$set,{[Hr.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=qi(w.uuid,fs)}var B=null!==(o=null==(a=w.$set)?void 0:a[u])&&void 0!==o?o:ht(null==(l=w.properties)?void 0:l.$set)?w.properties.$set[u]:void 0,U=null!=F&&F.pending&&B===F.value?F.value:void 0;this._internalEventEmitter.emit("eventCaptured",w);var q=null!==(d=null==s?void 0:s._url)&&void 0!==d?d:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H=i({method:"POST",url:q,data:w,compression:"best-available",timestampMode:"recordings"===(null==s?void 0:s._batchKey)||/\/s\/(?:\?|$)/.test(q)?"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?this._send_retriable_request(H):this._requestQueue.enqueue(H),w}es.critical("This capture call is ignored due to client rate limiting.")}}else es.error("No event name provided to posthog.capture")}else es.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 vo(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,this.persistence.get_property(ce)===Ae&&(null==(s=this.sessionPersistence)||s.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),null==(i=this.featureFlags)||i.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this._processCookieIdentityChange();var a=o?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[be]=!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))&&es.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,_=function(e,t,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ze)return{};var d,u=e?[...sr,...t||[]]:[],_=function(e){for(var t=0;Di.length>t;t++){var i=Di[t],s=i[1],r=i[0].exec(e),n=r&&(ct(s)?s(r,e):s);if(n)return n}return["",""]}(Ze),c=_[0],h=_[1],p=function(e){for(var t=0;Bi.length>t;t++){var i=Bi[t],s=i[1],r=i[2],n=e.match(i[0]);if(n){var o=r&&e.match(r)||n;return[s,(null==o?void 0:o[1])||""]}}return["",""]}(Ze),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==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,w=null==(o=navigator)?void 0:o.maxTouchPoints,S=null==Ge||null==(a=Ge.screen)?void 0:a.width,P=null==Ge||null==(l=Ge.screen)?void 0:l.height,E=null==Ge?void 0:Ge.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,I,T,F,R,O,A=rs(os({$os:c,$os_version:h,$browser:Oi(Ze,navigator.vendor,f,m),$webview_app:g,$webview_app_version:v,$device:Li(Ze),$device_type:(C=Ze,x=y,O=Li(C),O===Mt||O===At||"Kobo"===O||"Kindle Fire"===O||O===_i?Ot:O===ei||O===ii||O===ti||O===li?"Console":O===Lt?"Wearable":O?Ft:"Android"===(null==x?void 0:x.userAgentDataPlatform)&&(null!==(I=null==x?void 0:x.maxTouchPoints)&&void 0!==I?I:0)>0?600>Math.min(null!==(T=null==x?void 0:x.screenWidth)&&void 0!==T?T: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)?Ft:Ot:"Desktop"),$timezone:pr(),$timezone_offset:gr()}),{$current_url:tr(r?Gi(null==je?void 0:je.href):null==je?void 0:je.href,u,nr),$host:null==je?void 0:je.host,$pathname:null==je?void 0:je.pathname,$raw_user_agent:Ze.length>1e3?Ze.substring(0,997)+"...":Ze,$browser_version:Mi(Ze,navigator.vendor,f,m),$browser_language:dr(),$browser_language_prefix:(k=dr(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==Ge?void 0:Ge.screen.height,$screen_width:null==Ge?void 0:Ge.screen.width,$viewport_height:null==Ge?void 0:Ge.innerHeight,$viewport_width:null==Ge?void 0:Ge.innerWidth,$lib:s.LIB_NAME,$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return s.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=s.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(o,r.getTime(),!0),h=c.windowId;l.$session_id=c.sessionId,l.$window_id=h}this.sessionPropsManager&&rs(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&rs(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===io&&(l.$lib_custom_api_host=this.config.api_host),u=e!==Be||o?e!==Ue||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=rs(l,u),e===Be&&ze&&(l.title=ze.title),!gt(a)){var g=r.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}Ze&&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)),ss(["$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{rs(b,w())}catch(e){es.error("Failed to produce browser extension event properties",e)}(l=rs({},_,v,f,i({},b,l))).$is_identified=this._isIdentified(),_t(this.config.property_denylist)?ss(this.config.property_denylist,function(e){delete l[e]}):es.error(Eo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(es.error(Po),l=S(l,e));var P=this._hasPersonProcessing();return l.$process_person_profile=P,P&&!o&&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=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=rs({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(es.error(Po),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),pt(o)?void 0:o}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||!Ns._is_supported())Ns._remove(this._sessionRegisteredPropertiesStorageKey);else{var t=[];this._sessionRegisteredPropKeys.forEach(e=>t.push(e)),t.length>0?Ns._set(this._sessionRegisteredPropertiesStorageKey,t):Ns._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:So}),()=>{})}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:So})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:So})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=lo),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:So}}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:So})}_validateIdentifyId(e){return!e||ft(e)?(es.critical("Unique user id has not been set in posthog.identify"),!1):e===ye?(es.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())||(es.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 es.uninitializedWarning("posthog.identify");if(bt(e)&&(e=e.toString(),es.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),a=this.persistence._beginCookieSyncSuppression(),d=!1;try{var u=this.get_distinct_id();this.register({$user_id:e}),this.get_property(o)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),e!==u&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var _=(this.persistence.get_property(ce)||Ae)===Ae,c=e!==u,h=!c&&_;if(c&&_){var p,g=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:u};this.persistence.set_property(ce,Me),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture(qe,g,{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=to(e,t,i),null==(p=this.featureFlags)||p.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(h){this.persistence.set_property(ce,Me);var v=t||{},f=i||{};this.setPersonPropertiesForFlags({$set:v,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence._publishSuppressedCookieSnapshot(),this.capture("$set",{$set:v,$set_once:f}),this._cachedPersonProperties=to(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);c||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(le)):h&&(t||i)&&this.reloadFeatureFlags(),d=!0}finally{a&&this.persistence._endCookieSyncSuppression(d)}}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=to(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):es.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(He,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),o&&!s&&this.reloadFeatureFlags()}else es.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,l,d;if(void 0===t&&(t=!1),es.info("reset"),!this.__loaded)return es.uninitializedWarning("posthog.reset");var u=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 _=this.get_property(o),c=this.get_property(a),h=this.get_property(P);null==(l=this.sessionRecording)||l.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==(d=this.persistence)||null==d._beginCookieSyncSuppression?void 0:d._beginCookieSyncSuppression(),v=!1;try{var f,m,y,b,w,S,E,k,C,x,I,T,F;if(null==(f=this.persistence)||f.clear(),null==(m=this.sessionPersistence)||m.clear(),this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys(),gt(h)||null==(x=this.persistence)||x.register({[P]:h}),null==(y=this.surveys)||y.reset(),null==(b=this.featureFlags)||b.reset(),null==(w=this.conversations)||w.reset(),null==(S=this.logs)||S.reset(),null==(E=this.metrics)||E.reset(),null==(k=this.persistence)||k.set_property(ce,Ae),null==(C=this.sessionManager)||C.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===Oe)this.register_once({distinct_id:ye,$device_id:null},"");else{var R=this.config.get_device_id(fs());this.register_once({distinct_id:R,$device_id:e?R:_},""),e||gt(c)||this.register({[a]: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(ce,s.isIdentifiedID?Me:Ae),this.register({distinct_id:s.distinctID})),null==(I=this.featureFlags)||I.initialize(),!(gt(u)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(u,!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 i=this;return t(function*(){var e,t,s,r,n,o,a;if(i.__loaded){i._getBrowserClientAdapter().dispose(),null==(e=i.sessionRecording)||e.dispose(),null==(t=i.logs)||t.flushLogs("sendBeacon"),null==(s=i.metrics)||s.flush("sendBeacon"),null==(r=i._requestQueue)||r.unload(),null==(n=i._retryQueue)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(e){es.error("Error while destroying feature flags",e)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else es.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(r)?(es.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(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(es.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 r,n,o,a,l,d,u,_,c,h,p,g;rs(this.config,Oo(e));var v=this._is_persistence_disabled();null==(r=this.persistence)||r.update_config(this.config,t,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Cr(i({},this.config,{persistence:"sessionStorage"}),v,!1);var f,m=this._checkLocalStorageForDebug(this.config.debug);St(m)&&(this.config.debug=m),St(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Es._is_supported()&&Es._set("ph_debug",!0),es.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(s.DEBUG=!1,Es._is_supported()&&Es._remove("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this._shouldDisableFlags()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.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==(f=this.historyAutocapture)||f.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(g=this.externalIntegrations)||g.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&Gs(this,bo,!1)}}_overrideSDKInfo(e,t){s.LIB_NAME=e,s.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=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,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 e,t;return null!==(e=null==(t=this.logs)?void 0:t.logger)&&void 0!==e?e:Mo._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:Io;return t!==Io&&(t=Io+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(ce))===Me||(null==(t=this.sessionPersistence)?void 0:t.get_property(ce))===Me}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===De&&!this._isIdentified()&&pt(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[me]))}_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?(es.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._warnIfVolatileIdentityWithoutStableId(),this._register_single(me,!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&&this.config.cookieless_mode!==Re)}_sync_opt_out_with_persistence(){var e,t,i,s,r,n=this._is_persistence_disabled();return this.is_capturing()||null==(i=this.logs)||i._onOptOut(),(null==(e=this.persistence)?void 0:e._disabled)!==n&&(null==(s=this.persistence)||s.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),n&&(this._sessionRegisteredPropKeys.clear(),this._persistSessionRegisteredPropKeys()),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==Oe){if(this._inCookielessMode()){var i,s,r,n,o,a;null==(i=this.sessionRecording)||i.dispose({discardBufferedEvents:!0}),this._reset(!0,!0),null==(s=this.sessionManager)||s.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Zn(this),this.pageViewManager=new js(this),this.persistence&&(this.sessionPropsManager=new Kn(this,this.sessionManager,this.persistence));var l,d=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Mo.__defaultExtensionClasses)?void 0:a.sessionRecording;d&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new d(this)),this._lastRemoteConfig&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this._lastRemoteConfig)))}var u,_;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==Re&&(null==(u=this.surveys)||u.loadIfEnabled()),(gt(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(_=null==e?void 0:e.captureEventName)&&void 0!==_?_:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else es.warn(wo)}opt_out_capturing(){if(this.config.cookieless_mode!==Oe){var e,t,i=this.config.cookieless_mode===Re?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===Re&&this.consent.isOptedIn()&&this._reset(!0,!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===Re&&(this.register({distinct_id:ye,$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 es.warn(wo)}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 this.config.cookieless_mode===Oe||(this.config.cookieless_mode===Re?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 Ve?function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&it(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>it(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}(Ve,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ze&&("visible"===ze.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(Be,{title:ze.title},{send_instantly:!0}),this._visibilityStateListener&&(ze.removeEventListener(Le,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),us(ze,Le,this._visibilityStateListener)))}debug(e){!1===e?(null==Ge||Ge.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Ge||Ge.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?(es.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,es)}_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)?es.warn(o+". This can cause unexpected behavior."):es.info(o),null}r.properties&&!pt(r.properties)||es.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}catch(t){return es.error("Error in beforeSend function for event '"+e.event+"':",t),null}for(var a of i)if(r.properties&&yt(r.properties[a]))return es.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=Es._is_supported()&&"true"===Es._get("ph_debug");return!t&&(!!i||e)}}Mo.__defaultExtensionClasses={},Mo._noopLogger={trace:fo=()=>{},debug:fo,info:fo,warn:fo,error:fo,fatal:fo},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=ns(e.prototype[t[i]])}(Mo,["identify"]);var Do=function(){s.SDK_DIST_CHANNEL="npm";var e=mo[Io]=new Mo;return function(){function e(){e.done||(e.done=!0,To=!1,ss(mo,function(e){e._dom_loaded()}))}null!=ze&&ze.addEventListener?"complete"===ze.readyState?e():us(ze,"DOMContentLoaded",e,{capture:!1}):Ge&&es.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{xr as Compression,Ur as DEFAULT_PRODUCT_TOUR_APPEARANCE,Nr as DisplaySurveyType,Mo as PostHog,qr as ProductTourEventName,Hr as ProductTourEventProperties,Dr as SurveyEventName,Lr as SurveyEventProperties,Ir as SurveyEventType,Fr as SurveyPosition,Ar as SurveyQuestionBranchingType,Or as SurveyQuestionType,Mr as SurveySchedule,$r as SurveyTabPosition,Rr as SurveyType,Tr as SurveyWidgetType,Do as default,Do as posthog,jr as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.slim.no-external.js.map
|