posthog-js 1.423.2 → 1.424.0
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/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/customizations.full.js +1 -1
- package/dist/customizations.js +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/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.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.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/logs-defaults.js +52 -1
- package/lib/src/logs-defaults.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";function t(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise((function(s,n){var o=i.apply(e,r);function a(i){t(o,s,n,a,l,"next",i)}function l(i){t(o,s,n,a,l,"throw",i)}a(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var s={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.423.2",s.LIB_NAME="web";var n="$people_distinct_id",o="distinct_id",a="$device_id",l="$device_model",h="__alias",u="__timers",d="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",c="$exception_capture_enabled_server_side",f="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",_="$dead_clicks_enabled_server_side",m="$product_tours_enabled_server_side",y="$logs_capture_enabled_server_side",b="$web_vitals_allowed_metrics",w="$session_recording_remote_config",x="$replay_sample_rate",S="$replay_override_sampling",k="$replay_override_linked_flag",E="$replay_override_url_trigger",P="$replay_override_event_trigger",T="$sesid",C="$session_is_sampled",F="$enabled_feature_flags",R="$active_feature_flags",I="$early_access_features",A="$feature_flag_details",M="$feature_flag_payloads",O="$feature_flag_request_id",D="$minimal_flag_called_events",j="$override_feature_flags",L="$override_feature_flag_payloads",N="$stored_person_properties",B="$stored_group_properties",z="$groups",U="$surveys",H="$surveys_loaded_at",q="$surveys_activated",V="$surveys_activated_session",W="$surveys_activated_timestamps",G="ph_product_tours",J="$flag_call_reported",K="$flag_call_reported_session_id",Y="$feature_flag_errors",Q="$feature_flag_evaluated_at",X="$user_state",Z="$client_session_props",tt="$capture_rate_limit",it="$initial_campaign_params",et="$initial_referrer_info",rt="$initial_person_info",st="$epp",nt="$posthog_cookieless",ot="$cookieless_mode",at="$sdk_debug_extensions_init_method",lt="$sdk_debug_extensions_init_time_ms",ht="$sdk_debug_recording_script_not_loaded",ut="PostHog loadExternalDependency extension not found.",dt="on_reject",vt="always",ct="anonymous",ft="identified",pt="identified_only",gt="visibilitychange",_t="beforeunload",mt="$pageview",yt="$pageleave",bt="$identify",wt="$groupidentify",xt="undefined"!=typeof window?window:void 0,St="undefined"!=typeof globalThis?globalThis:xt,kt=null==St?void 0:St.navigator,Et=null==St?void 0:St.document,$t=null==St?void 0:St.location,Pt=null==St?void 0:St.fetch,Tt=null!=St&&St.XMLHttpRequest&&"withCredentials"in new St.XMLHttpRequest?St.XMLHttpRequest:void 0,Ct=null==St?void 0:St.AbortController,Ft=null==St?void 0:St.CompressionStream,Rt=null==kt?void 0:kt.userAgent;function It(){return!(!xt||!1===xt.navigator.onLine)}var At="undefined"!=typeof globalThis?globalThis:xt;At&&"undefined"==typeof self&&(At.self=At),At&&"undefined"==typeof File&&(At.File=function(){});var Mt=null!=xt?xt:{},Ot=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Dt(t){return"string"==typeof t||t}function jt(t){return"string"==typeof t?t:void 0}var Lt=["$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"],Nt=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),Bt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),zt=["$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"],Ut=["token"],Ht=20,qt=1e3,Vt=1e4,Wt="[Circular]",Gt="[Truncated]",Jt="[Unserializable]",Kt="[Function]";function Yt(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}var Qt=["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"],Xt=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return Qt.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function Zt(t,i){return-1!==t.indexOf(i)}var ti=function(t){return t.trim()},ii=function(t){return t.replace(/^\$/,"")};function ei(t){var i,e=[];return null!==(i=JSON.stringify(t,(function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}})))&&void 0!==i?i:"null"}var ri=Object.prototype,si=ri.hasOwnProperty,ni=ri.toString,oi=Array.isArray||function(t){return"[object Array]"===ni.call(t)},ai=t=>"function"==typeof t,li=t=>t===Object(t)&&!oi(t),hi=t=>{if(li(t)){for(var i in t)if(si.call(t,i))return!1;return!0}return!1},ui=t=>void 0===t,di=t=>"[object String]"==ni.call(t),vi=t=>di(t)&&0===t.trim().length,ci=t=>null===t,fi=t=>ui(t)||ci(t),pi=t=>"[object Number]"==ni.call(t)&&t==t,gi=t=>pi(t)&&t>0,_i=t=>"[object Boolean]"===ni.call(t),mi=t=>t instanceof FormData,yi=t=>Zt(zt,t),bi=t=>Zt(Ut,t);function wi(t){return null===t||"object"!=typeof t}function xi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Si(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Ei(t,Error)}}function ki(t){return"undefined"!=typeof Event&&Ei(t,Event)}function Ei(t,i){try{return t instanceof i}catch(t){return!1}}var $i=[!0,"true",1,"1","yes"],Pi=t=>Zt($i,t),Ti=[!1,"false",0,"0","no"];function Ci(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),pi(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),Ci(s||e,i,e,r))}class Fi{constructor(t){this.C={},this.I=t.I,this.R=Ci(t.bucketSize,0,100,t.A),this.O=Ci(t.refillRate,0,this.R,t.A),this.N=Ci(t.refillInterval,0,864e5,t.A)}F(t,i){var e=Math.floor((i-t.lastAccess)/this.N);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.N)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.F(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}}var Ri="Mobile",Ii="iOS",Ai="Android",Mi="Tablet",Oi=Ai+" "+Mi,Di="iPad",ji="Apple",Li=ji+" Watch",Ni="Safari",Bi="BlackBerry",zi="Samsung",Ui=zi+"Browser",Hi=zi+" Internet",qi="Chrome",Vi=qi+" OS",Wi=qi+" "+Ii,Gi="Internet Explorer",Ji=Gi+" "+Ri,Ki="Opera",Yi=Ki+" Mini",Qi="Edge",Xi="Microsoft "+Qi,Zi="Firefox",te=Zi+" "+Ii,ie="Nintendo",ee="PlayStation",re="Xbox",se=Ai+" "+Ri,ne=Ri+" "+Ni,oe="Windows",ae=oe+" Phone",le="Nokia",he="Ouya",ue="Generic",de=ue+" "+Ri.toLowerCase(),ve=ue+" "+Mi.toLowerCase(),ce="Konqueror",fe="Oculus Browser",pe="Vivaldi",ge="Yandex",_e="Whale",me="DuckDuckGo",ye="Pale Moon",be="Waterfox",we="Brave",xe="Claude",Se="Codex",ke="ChatGPT",Ee="Google Search App",$e="(\\d+(\\.\\d+)?)",Pe=new RegExp("Version/"+$e),Te=new RegExp("("+xe+"|"+Se+"|"+ke+")\\/"+$e),Ce=new RegExp(re,"i"),Fe=new RegExp(ee+" \\w+","i"),Re=new RegExp(ie+" \\w+","i"),Ie=new RegExp(Bi+"|PlayBook|BB10","i"),Ae={"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"},Me=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?we:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&Zt(t,"GSA/")?Ee:Zt(t," OPR/")&&Zt(t,"Mini")?Yi:Zt(t," OPR/")?Ki:Ie.test(t)?Bi:Zt(t,"IE"+Ri)||Zt(t,"WPDesktop")?Ji:Zt(t,"OculusBrowser")?fe:Zt(t,Ui)?Hi:Zt(t,Qi)||Zt(t,"Edg/")?Xi:Zt(t,pe+"/")?pe:Zt(t,"YaBrowser/")?ge:Zt(t,_e+"/")?_e:Zt(t,me+"/")||Zt(t,"Ddg/")?me:Zt(t,xe+"/")?xe:Zt(t,Se+"/")?Se:Zt(t,ke+"/")?ke:Zt(t,"FBIOS")?"Facebook "+Ri:Zt(t,"UCWEB")||Zt(t,"UCBrowser")?"UC Browser":Zt(t,"CriOS")?Wi:Zt(t,"CrMo")||Zt(t,qi)?qi:Zt(t,Ai)&&Zt(t,Ni)?se:Zt(t,"FxiOS")?te:Zt(t.toLowerCase(),ce.toLowerCase())?ce:Zt(t,we+"/")?we:((t,i)=>i&&Zt(i,ji)||function(t){return Zt(t,Ni)&&!Zt(t,qi)&&!Zt(t,Ai)}(t))(t,i)?Zt(t,Ri)?ne:Ni:Zt(t,"PaleMoon/")?ye:Zt(t,be+"/")?be:Zt(t,Zi)?Zi:Zt(t,"MSIE")||Zt(t,"Trident/")?Gi:Zt(t,"Gecko")?Zi:"")},Oe={[Ji]:[new RegExp("rv:"+$e)],[Xi]:[new RegExp(Qi+"?\\/"+$e)],[qi]:[new RegExp("("+qi+"|CrMo)\\/"+$e)],[Wi]:[new RegExp("CriOS\\/"+$e)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$e)],[Ni]:[Pe],[ne]:[Pe],[Ki]:[new RegExp("(Opera|OPR)\\/"+$e)],[Zi]:[new RegExp(Zi+"\\/"+$e)],[te]:[new RegExp("FxiOS\\/"+$e)],[ce]:[new RegExp("Konqueror[:/]?"+$e,"i")],[Bi]:[new RegExp(Bi+" "+$e),Pe],[se]:[new RegExp("android\\s"+$e,"i")],[Hi]:[new RegExp(Ui+"\\/"+$e)],[fe]:[new RegExp("OculusBrowser\\/"+$e)],[pe]:[new RegExp(pe+"\\/"+$e)],[ge]:[new RegExp("YaBrowser\\/"+$e)],[_e]:[new RegExp(_e+"\\/"+$e)],[we]:[new RegExp(we+"\\/"+$e)],[xe]:[Te],[Se]:[Te],[ke]:[Te],[me]:[new RegExp("(DuckDuckGo|Ddg)\\/"+$e)],[ye]:[new RegExp("PaleMoon\\/"+$e)],[be]:[new RegExp(be+"\\/"+$e)],[Ee]:[new RegExp("GSA\\/"+$e)],[Gi]:[new RegExp("(rv:|MSIE )"+$e)],Mozilla:[new RegExp("rv:"+$e)]},De=function(t,i,e,r){var s=Me(t,i,e,r),n=Oe[s];if(ui(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},je=[[new RegExp(re+"; "+re+" (.*?)[);]","i"),t=>[re,t&&t[1]||""]],[new RegExp(ie,"i"),[ie,""]],[new RegExp(ee,"i"),[ee,""]],[Ie,[Bi,""]],[new RegExp(oe,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ae,""];if(new RegExp(Ri).test(i)&&!/IEMobile\b/.test(i))return[oe+" "+Ri,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Ae[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[oe,r]}return[oe,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ii,[t[3],t[4],t[5]||"0"].join(".")]:[Ii,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=ui(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Ai+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ai+")","i"),t=>t&&t[2]?[Ai,[t[2],t[3],t[4]||"0"].join(".")]:[Ai,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Vi,""]],[/Linux|debian/i,["Linux",""]]],Le=function(t){return Re.test(t)?ie:Fe.test(t)?ee:Ce.test(t)?re:new RegExp(he,"i").test(t)?he:new RegExp("("+ae+"|WPDesktop)","i").test(t)?ae:/iPad/.test(t)?Di:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Li:Ie.test(t)?Bi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(le,"i").test(t)?le:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Ri).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ai:Oi:new RegExp("(pda|"+Ri+")","i").test(t)?de:new RegExp(Mi,"i").test(t)&&!new RegExp(Mi+" pc","i").test(t)?ve:""},Ne=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Be(t,i){return"string"==typeof(e=t)&&Ne.test(e)?t:i();var e}function ze(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function Ue(t){return t?t.split("#")[0]:t}function He(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function qe(t,i,e){return Ve.apply(this,arguments)}function Ve(){return(Ve=i((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=He((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var We,Ge="NativeGzipValidationError",Je=t=>t.length>=2&&31===t[0]&&139===t[1],Ke=(t,i)=>t===Bt.GZipJS||i===Bt.GZipJS||"gzip"===i,Ye=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Qe=t=>{throw ze(Ge,"Native gzip produced invalid output: "+t)},Xe=function(){var t=i((function*(t,i){18>t.size&&Qe("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Je(e)&&8===e[2]||Qe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(We)return We;We=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;We[t]=i>>>0}return We})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Qe("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Qe("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function Ze(){return Ze=i((function*(t,e,r){void 0===e&&(e=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=i((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(i){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Xe(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),Ze.apply(this,arguments)}var tr=0x8000000000000000,ir="9223372036854775808",er={}.propertyIsEnumerable;function rr(t,i){try{return or(t,i,{ancestors:new WeakSet,remainingNodes:Vt},0)}catch(t){return[]}}function sr(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:Gt};if(e.remainingNodes--,_i(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt(ir);return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var s=BigInt(t).toString();return t>=tr||-tr>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Yt(t)};if("function"==typeof t)return{stringValue:Kt};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:Wt};if(r>=Ht)return{stringValue:Gt};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Yt(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return sr(a.call(t),i,e,r+1)}catch(t){}return oi(t)?{arrayValue:{values:nr(t,i,e,r+1)}}:{kvlistValue:{values:or(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Yt(String(t))}}function nr(t,i,e,r){for(var s=[],n=Math.min(t.length,qt),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(fi(a))continue;s.push(sr(a,i,e,r))}catch(t){s.push({stringValue:Jt})}return t.length>o&&s.push({stringValue:Gt}),s}function or(t,i,e,r){var s=[];for(var n in t)if(er.call(t,n)){if(s.length>=qt||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(ci(o)||ui(o))continue;s.push({key:Yt(n),value:sr(o,i,e,r)})}catch(t){s.push({key:Yt(n),value:{stringValue:Jt}})}}return s}var ar={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},lr=ar.info;function hr(t){try{return Yt(String(t))}catch(t){return Jt}}function ur(t,i,r,s){var n,o=ar[t.level||"info"]||lr,a=o.text,l=o.number,h=(void 0===(n=pi(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),fi(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),fi(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=e({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Jt}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var g={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:hr(t.body)},attributes:rr(d,r)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),ui(t.trace_flags)||(g.flags=t.trace_flags),g}function dr(t,i,r){return e({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":r})}function vr(t,i,e,r){return{resourceLogs:[{resource:{attributes:rr(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let cr=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.gn=i,this.A=e,this.Pn=r,this.Fn=s,this.Dn=n,this.$n=o,this.Nn=null,this.qn=0,this.jn=0,this.Bn=0,this.Hn=0,this.zn=0,this.Un=!1,this.Wn=i.maxBufferSize,this.Vn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.Gn=i.flushIntervalMs,this.Zn=i.maxBatchRecordsPerPost,this.Qn=i.rateCapWindowMs,this.Jn=i.maxLogsPerInterval}clearQueue(){this.jn++,this._instance.setPersistedProperty(Nt.LogsQueue,[])}reset(){this.Kn(),this.Hn=0,this.zn=0,this.Un=!1,this.Bn=0,this.Zn=this.gn.maxBatchRecordsPerPost}onReconnect(){this.Bn=0,this.Yn()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.Xn(t);if(null!==r)if(r.body){if(this.ts()){var s={record:ur(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.Pn(),this.A,null==i?void 0:i.occurredAtMs)};this.Fn((()=>this.es(s)))}}else this.A.info("Log was rejected in beforeSend function")}}Xn(t){var i=this.gn.beforeSend;if(!i)return t;var e=oi(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}ts(){if(void 0===this.Jn)return!0;var t=Date.now(),i=t-this.Hn;return this.Qn>i&&i>=0||(this.Hn=t,this.zn=0,this.Un=!1),this.Jn>this.zn?(this.zn++,!0):(this.Un||(this.A.warn("captureLog dropping logs: exceeded "+this.Jn+" logs per "+this.Qn+"ms"),this.Un=!0),!1)}flush(){var t=this;return i((function*(){if(!t._instance.isDisabled)return t.Nn||(t.Nn=t.rs().finally((()=>{t.Nn=null}))),t.Nn}))()}rs(){var t=this;return i((function*(){var i;t.Kn();var e=null!==(i=t._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.jn;t.qn=0;var l=Math.min(e.length,t.Zn),h=e.slice(0,l),u=vr(h.map((t=>t.record)),t.ns(),null!==(n=t.$n)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.ss(u);if(t.jn!==a)return;if("too-large"===d.kind&&h.length>1)t.Zn=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.Zn);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.gn.maxBatchRecordsPerPost>t.Zn&&(t.Zn=Math.min(t.gn.maxBatchRecordsPerPost,t.Zn+1)),yield t.os(h.length),e=null!==(o=t._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}os(t){var e=this;return i((function*(){var i,r=Math.max(0,t-e.qn),s=null!==(i=e._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(Nt.LogsQueue,s.slice(r)),yield e.Dn()}))()}ns(){return dr(this.gn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}es(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];this.Vn>e.length||(e.shift(),this.qn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(Nt.LogsQueue,e),this.Wn>e.length?this.ls():this.Yn()}}ls(t){void 0===t&&(t=this.Gn),this.us||(this.us=He((()=>{this.us=void 0,this.Yn()}),t))}hs(){var t=Math.min(Math.max(0,this.Bn-1),6);return this.Gn*Math.pow(2,t)}ds(){var t=this._instance.getPersistedProperty(Nt.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i((function*(){e.Kn();var i=e.flush().catch((()=>{}));void 0!==t?yield qe(i,t):yield i}))()}flushWithTimeout(t){var e=this;return i((function*(){var i=e.flush();yield qe(i,t,(()=>{i.catch((()=>{}))}))}))()}Yn(){this.flush().then((()=>{this.Bn=0}),(t=>{this.Bn++,this.A.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.ds()&&this.ls(this.hs())}))}Kn(){this.us&&(clearTimeout(this.us),this.us=void 0)}};var fr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function pr(t){return String(t)+"000000"}function gr(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let _r=class{constructor(t,i,e){this._instance=t,this.gn=i,this.A=e,this.vs=new Map,this.Nn=null,this.cs=!1,this.fs=new Map,this.ps=new Set,this.gs=0}count(t,i,e){void 0===i&&(i=1),this.ys({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.ys({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.ys({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,e=this.Nn,r=function(){var r=i((function*(){e&&(yield e.catch((()=>{}))),yield t.bs()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.Nn===s&&(this.Nn=null)}));return this.Nn=s,s}drainWindow(){if(0===this.vs.size)return null;var t=this.vs;return this.vs=new Map,this.cs=!1,this.fs=new Map,this.ps=new Set,this._s(t)}reset(){this.gs++,this.Kn(),this.vs=new Map,this.Nn=null,this.cs=!1,this.fs=new Map,this.ps=new Set}ys(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.Xn(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=i.attributes?e({},i.attributes):void 0,s=gr(i.type,i.name,i.unit,r)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.vs.get(s);if(!n){if(!this.ws())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.vs.set(s,n)}var o=this.fs.get(i.name);void 0===o?this.fs.set(i.name,i.type):o===i.type||this.ps.has(i.name)||(this.ps.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.ks(n,i.value),this.ls()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}ws(){return this.gn.maxSeriesPerFlush>this.vs.size||(this.cs||(this.cs=!0,this.A.warn("Metric series cap reached ("+this.gn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}ks(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(fr.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,fr)]+=1}}Xn(t){var i=this.gn.beforeSend;if(!i)return t;var e=oi(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}ls(){this.us||(this.us=He((()=>{this.us=void 0,this.flush().catch((t=>{this.A.error("Metrics flush failed:",t)}))}),this.gn.flushIntervalMs))}Kn(){this.us&&(clearTimeout(this.us),this.us=void 0)}bs(){var t=this;return i((function*(){if(0!==t.vs.size){var i=t.vs;t.vs=new Map,t.cs=!1,t.fs=new Map,t.ps=new Set;var e=t.gs,r=yield t._instance.Ss(t._s(i));if(e===t.gs)switch(r.kind){case"ok":return;case"retry-later":return t.xs(i),void t.ls();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}}))()}_s(t){return i=this.Cs(t),r=function(t,i,r){return e({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":r})}(this.gn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:rr(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,r,s,n}Cs(t){var i=pr(Date.now()),r=new Map;for(var s of t.values()){var n,o=gr(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=e({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=rr(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=pr(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:fr})}return Array.from(r.values())}xs(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.vs.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.ws()&&this.vs.set(s,n)}}};var mr,yr,br;function wr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return br&&e.length===yr||(yr=e.length,br=e.reduce(((e,r)=>{mr||(mr={});var s=mr[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,mr[r]=[l,h];break}}return e}),{})),br}}class xr{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&oi(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var e=this;return i((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,i){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:wr(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Sr="?";function kr(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Sr:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return ui(r)||(n.lineno=r),ui(s)||(n.colno=s),n}var Er=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Sr,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},$r=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Pr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Tr=/\((\S*)(?::(\d+))(?::(\d+))\)/,Cr=(t,i)=>{var e=$r.exec(t);if(e)return kr(i,e[1],Sr,+e[2],+e[3]);var r=Pr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=Tr.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Er(r[1]||Sr,r[2]);return kr(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Fr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Rr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ir=(t,i)=>{var e=Fr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Rr.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Sr,o=Er(n,s);return kr(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Ar=/\(error: (.*)\)/;class Mr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=di(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return xi(t,"DOMException")}isDOMError(t){return xi(t,"DOMError")}}class Or{match(t){return Si(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class Dr{constructor(){}match(t){return!!xi(t,"ErrorEvent")&&(null!=t.error||this.Wi(t))}coerce(t,i){var r;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return e({},s,{stack:null!==(r=this.Vi(t))&&void 0!==r?r:s.stack,synthetic:!0})}Wi(t){return di(t.message)&&t.message.length>0}Vi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(di(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var jr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Lr{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(jr);return r&&(i=r[1],e=r[2]),[i,e]}}var Nr=["fatal","error","warning","log","info","debug"];function Br(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class zr{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(ki(t))return t.constructor.name;var i="name"in t?t.name:void 0;return di(i)&&!vi(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+Br(t)}isSeverityLevel(t){return di(t)&&!vi(t)&&Nr.indexOf(t)>=0}getStack(t){try{return di(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:di(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Si(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Ur{match(t){return ki(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Br(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Hr{match(t){return wi(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class qr{match(t){return xi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!ki(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return wi(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Vr="$message",Wr="$timestamp",Gr=new Set([Vr,Wr]),Jr={enabled:!0,max_bytes:32768};function Kr(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Jr.enabled,max_bytes:Qr(t.max_bytes,Jr.max_bytes)}:e({},Jr)}class Yr{constructor(t){this.Ts=[],this.Ms=0,this.gn=Kr(t)}setConfig(t){this.gn=Kr(t),this.Es()}add(t){var i=function(t){var i;try{i=ei(t)}catch(t){return}try{var e=JSON.parse(i);if(!li(e))return;var r=e,s=r[Vr],n=r[Wr];if(!di(s)||0===s.trim().length)return;if(!di(n)&&!pi(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.gn.max_bytes||(this.Ts.push({step:i.step,bytes:e}),this.Ms+=e,this.Es())}}getAttachable(){return this.Ts.map((t=>t.step))}clear(){this.Ts=[],this.Ms=0}size(){return this.Ts.length}Es(){for(;this.Ms>this.gn.max_bytes&&this.Ts.length>0;){var t=this.Ts.shift();t&&(this.Ms-=t.bytes)}}}function Qr(t,i){if(!pi(t)||t===1/0||t===-1/0)return i;var e=Math.floor(t);return 0>e?i:e}var Xr=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){if(xt&&(s.DEBUG||xt.POSTHOG_DEBUG||e)&&!ui(xt.console)&&xt.console){for(var r=("__rrweb_original__"in xt.console[i]?xt.console[i].__rrweb_original__:xt.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>Xr(t+" "+i,e)};return r},Zr=Xr("[PostHog.js]"),ts=Zr.createLogger;function is(t,i){oi(t)&&t.forEach(i)}function es(t,i){if(!fi(t))if(oi(t))t.forEach(i);else if(mi(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)si.call(t,e)&&i(t[e],e)}var rs=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function ss(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var ns=function(t){try{return t()}catch(t){return}},os=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Zr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Zr.critical(t)}}},as=function(t){var i={};return es(t,(function(t,e){(di(t)&&t.length>0||pi(t))&&(i[e]=t)})),i};var ls=["herokuapp.com","vercel.app","netlify.app"];function hs(t){var i=null==t?void 0:t.hostname;if(!di(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of ls)if(e===r)return!1;return!0}function us(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function ds(t){return"ph_toolbar_internal"===t.name}var vs=t=>{if(Et){try{for(var i=t+"=",e=Et.cookie.split(";").filter((t=>t.length)),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return pi(t)&&isFinite(t)&&Math.floor(t)===t});class cs{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new cs(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new cs(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class fs{generate(){var t=this.generateOrAbort();if(!ui(t))return t;this.Yr=0;var i=this.generateOrAbort();if(ui(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Yr)this.Yr=t,this.Kr();else{if(this.Yr>=t+1e4)return;this.Xr++,this.Xr>4398046511103&&(this.Yr++,this.Kr())}return cs.fromFieldsV7(this.Yr,Math.trunc(this.Xr/Math.pow(2,30)),this.Xr&Math.pow(2,30)-1,this.ei.nextUint32())}Kr(){this.Xr=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Yr=0,this.Xr=0,this.ei=new _s}}var ps,gs=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};xt&&!ui(xt.crypto)&&crypto.getRandomValues&&(gs=t=>crypto.getRandomValues(t));class _s{nextUint32(){return this.Dt.length>this.ti||(gs(this.Dt),this.ti=0),this.Dt[this.ti++]}constructor(){this.Dt=new Uint32Array(8),this.ti=1/0}}var ms=()=>ys().toString(),ys=()=>(ps||(ps=new fs)).generate(),bs="",ws=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var xs=null,Ss={ri(){if(!ci(xs))return xs;if(xs=!1,Et)try{var t="__ph_cookie_support_"+ms();Ss.ii(t,"xyz"),xs='"xyz"'===vs(t),Ss.ai(t)}catch(t){xs=!1}return xs},oi(t){Zr.error("cookieStore error: "+t)},ni:vs,si(t){var i;try{i=JSON.parse(Ss.ni(t))||{}}catch(t){}return i},ii(t,i,e,r,s){if(!Et)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=Et),bs)return bs;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+ms();!bs&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",bs=n)}return bs}(t);if(!e){var r=(t=>{var i=t.match(ws);return i?i[0]:""})(t);r!==e&&Zr.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(Et.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&Zr.warn("cookieStore warning: large cookie, len="+h.length),Et.cookie=h,!0}catch(t){return!1}},ai(t,i){if(null!=Et&&Et.cookie)try{Ss.ii(t,"",-1,i)}catch(t){return}}},ks=null,Es={ri(){if(!ci(ks))return ks;var t=!0;if(ui(xt))t=!1;else try{var i="__mplssupport__";Es.ii(i,"xyz"),'"xyz"'!==Es.ni(i)&&(t=!1),Es.ai(i)}catch(i){t=!1}return t||Zr.error("localStorage unsupported; falling back to cookie store"),ks=t,t},oi(t){Zr.error("localStorage error: "+t)},ni(t){try{return null==xt?void 0:xt.localStorage.getItem(t)}catch(t){Es.oi(t)}return null},si(t){try{return JSON.parse(Es.ni(t))||{}}catch(t){}return null},ii(t,i){try{return null==xt||xt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Es.oi(t)}return!1},ai(t){try{null==xt||xt.localStorage.removeItem(t)}catch(t){Es.oi(t)}}},$s=[N,R,F,A,M,O,Q,Y,J],Ps=[a,o,T,C,st,rt,X],Ts=t=>t+"_cpm",Cs=["__proto__","constructor","prototype"],Fs=t=>{if(!li(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===Cs.indexOf(e)&&(i[e]=t[e])})),i},Rs=function(t,i){void 0===i&&(i=[]);var e={};return[...Ps,...i].forEach((i=>{var r=t[i];ui(r)||ci(r)||""===r||(e[i]=r)})),e},Is=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},As=(t,i)=>({p:i,f:Is(JSON.stringify(t))}),Ms=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ss.si(Ts(t)),r=(null==e?void 0:e.f)===Is(i)&&oi(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Os=(t,i)=>i+"|"+(Ss.ni(Ts(t))||""),Ds={},js={ri:()=>!0,oi(t){Zr.error("memoryStorage error: "+t)},ni:t=>t in Ds?Ds[t]:null,si:t=>t in Ds?Ds[t]:null,ii:(t,i)=>(Ds[t]=i,!0),ai(t){delete Ds[t]}},Ls=null,Ns={ri(){if(!ci(Ls))return Ls;if(Ls=!0,ui(xt))Ls=!1;else try{var t="__support__";Ns.ii(t,"xyz"),'"xyz"'!==Ns.ni(t)&&(Ls=!1),Ns.ai(t)}catch(t){Ls=!1}return Ls},oi(t){Zr.error("sessionStorage error: ",t)},ni(t){try{return null==xt?void 0:xt.sessionStorage.getItem(t)}catch(t){Ns.oi(t)}return null},si(t){try{return JSON.parse(Ns.ni(t))||null}catch(t){}return null},ii(t,i){try{return null==xt||xt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Ns.oi(t)}return!1},ai(t){try{null==xt||xt.sessionStorage.removeItem(t)}catch(t){Ns.oi(t)}}};class Bs{constructor(t){this._instance=t}get gn(){return this._instance.config}get consent(){return this.Ws()?0:this.Vs}isOptedOut(){return this.gn.cookieless_mode===vt||this.isRejected()||-1===this.consent&&this.gn.cookieless_mode===dt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.gn.opt_out_capturing_by_default}optInOut(t){this.Gs.ii(this.Zs,t?1:0,this.gn.cookie_expiration,this.gn.cross_subdomain_cookie,this.gn.secure_cookie)}reset(){this.Gs.ai(this.Zs,this.gn.cross_subdomain_cookie)}get Zs(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get Vs(){var t=this.Gs.ni(this.Zs);return Pi(t)?1:Zt(Ti,t)?0:-1}get Gs(){var t=this.gn.opt_out_capturing_persistence_type,i="localStorage"===t?Es:Ss,e=i.ri()?i:js;if(!this.Qs||this.Qs!==e){this.Qs=e;var r="localStorage"===t?Ss:Es;r.ni(this.Zs)&&(this.Qs.ni(this.Zs)||this.optInOut(Pi(r.ni(this.Zs))),r.ai(this.Zs,this.gn.cross_subdomain_cookie))}return this.Qs}Ws(){return!!this.gn.respect_dnt&&[null==kt?void 0:kt.doNotTrack,null==kt?void 0:kt.msDoNotTrack,Mt.doNotTrack,null==kt?void 0:kt.globalPrivacyControl].some((t=>Pi(t)))}}function zs(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!ai(r))return i;try{var s=r(i);return di(s)&&s?s:i}catch(t){return Zr.error("Error in get_current_url, falling back to window.location.href",t),i}}var Us="__POSTHOG_TOOLBAR__",Hs=1,qs=3,Vs=11;function Ws(t){return t instanceof Element&&(t.id===Us||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Gs(t){return!!t&&t.nodeType===Hs}function Js(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Ks(t){return!!t&&t.nodeType===qs}function Ys(t){return!!t&&t.nodeType===Vs&&Gs(t.host)}var Qs=1e3;function Xs(t){return t?ti(t).split(/\s+/):[]}function Zs(t,i){var e=function(t){var i,e=null==xt||null==(i=xt.location)?void 0:i.href;return ui(e)?void 0:zs(t,e)}(i);return!!(e&&t&&t.some((t=>e.match(t))))}function tn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Xs(i)}function en(t){return fi(t)?null:ti(t).split(/(\s+)/).filter((t=>$n(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rn(t){var i="";return _n(t)&&!mn(t)&&t.childNodes&&t.childNodes.length&&es(t.childNodes,(function(t){var e;Ks(t)&&t.textContent&&(i+=null!==(e=en(t.textContent))&&void 0!==e?e:"")})),ti(i)}function sn(t){var i;return ui(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var nn=["a","button","form","input","select","textarea","label"];function on(t,i){if(ui(i))return!0;var e,r=function(t){if(i.some((i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function an(t){var i=t.parentNode;return!(!i||!Gs(i))&&i}var ln=[".ph-no-autocapture","[data-ph-no-autocapture]"],hn=["next","previous","prev",">","<"],un=[...hn,"+","-","−","–"],dn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,vn=[".ph-no-rageclick",".ph-no-capture"],cn=["","text","search","email","password","url","tel","number"];function fn(t,i){if(!xt||pn(t))return!1;var e,r,s,n,o;if(_i(i)?(e=!!i&&vn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:vn,r=null==i?void 0:i.content_ignorelist,s=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(s&&function(t){return!(!t||!Gs(t))&&(!!Js(t,"textarea")||(Js(t,"input")?Zt(cn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var a=gn(t,!1).targetElementList;return!function(t,i){if(!1===t||ui(t))return!1;var e;if(!0===t)e=hn;else{if(!oi(t))return!1;if(t.length>10)return Zr.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var i=t.safeText,r=t.ariaLabel;return e.some((t=>dn(i,t)||dn(r,t)))}))}(r,a.map((t=>{var i;return{safeText:rn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!on(a,e)}var pn=t=>!t||Js(t,"html")||!Gs(t),gn=(t,i)=>{if(!xt||pn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!Js(s,"body");)if(Ys(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=an(s);if(!n)break;if(i||nn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=xt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function _n(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Js(r,"body");r=r.parentNode){if(e++>=Qs||i.has(r))return!1;i.add(r);var s=tn(r);if(Zt(s,"ph-sensitive")||Zt(s,"ph-no-capture"))return!1}if(Zt(tn(t),"ph-include"))return!0;var n=t.type||"";if(di(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!di(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function mn(t){return!!(Js(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Js(t,"select")||Js(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var yn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),bn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,wn=[16,15,14,13],xn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Sn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),kn=/[0-9A-Za-z_]/;function En(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function $n(t,i){if(void 0===i&&(i=!0),fi(t))return!1;if(di(t)){t=ti(t);var e=i?yn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(bn.lastIndex=0;i=bn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of wn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(yn.test(a)&&En(a))return!0}}}return!1}(t);if(e)return!1;var r=i?xn.test(t):function(t){var i;for(Sn.lastIndex=0;i=Sn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&kn.test(e)&&kn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function Pn(t){var i=rn(t);return $n(i=(i+" "+Tn(t)).trim())?i:""}function Tn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&es(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=rn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Tn(t)).trim())}catch(t){Zr.error("[AutoCapture]",t)}})),i}function Cn(t){return t.replace(/"|\\"/g,'\\"')}function Fn(t){var i=t.attr__class;if(i)return oi(i)?i:Xs(i)}var Rn=ts("[Dead Clicks]"),In=()=>!0,An=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(_)),r=t.instance.config.capture_dead_clicks;return _i(r)?r:!!li(r)||e};class Mn{get lazyLoadedDeadClicksAutocapture(){return this.Js}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[_]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ks((()=>{this.Ys()})):this.stop()}Ks(t){var i,e;null!=(i=Mt.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Rn.error("failed to load script",i):t()}))}Ys(){var t;if(Et){if(!this.Js&&null!=(t=Mt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=li(this.instance.config.capture_dead_clicks)?e({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Js=Mt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Js.start(Et),Rn.info("starting...")}}else Rn.error("`document` not found. Cannot start.")}stop(){this.Js&&(this.Js.stop(),this.Js=void 0,Rn.info("stopping..."))}}var On=ts("[SegmentIntegration]");var Dn="posthog-js";function jn(t,i){var r=void 0===i?{}:i,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var r,a,h,d,v;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=i.exception)?void 0:r.values)||[],g=p.map((t=>e({},t,{stacktrace:t.stacktrace?e({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>e({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return s&&n&&(_.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(f=t.exceptions)||f.sendExceptionEvent(_)),i}}class Ln{constructor(t,i,e,r,s,n){this.name=Dn,this.setupOnce=function(o){o(jn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Nn{constructor(t){this.Xs=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Zr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ta=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ea()}ea(){var t;this.ia=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Xs)}destroy(){var t;null==(t=this.ia)||t.call(this),this.ia=void 0}doPageView(t,i){var e,r=this.ra(t,i);return this.ta={pathname:null!==(e=null==xt?void 0:xt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.ra(t,null==(i=this.ta)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ta)?void 0:t.pageViewId}}ra(t,i){var e=this.ta;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(ui(n)||ui(o)||ui(a)||ui(l)||ui(h)||ui(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?Ci(o/n,0,1,Zr):1,v=n>1?Ci(a/n,0,1,Zr):1,c=l>1?Ci(h/l,0,1,Zr):1,f=l>1?Ci(u/l,0,1,Zr):1;r=rs(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Bn=["flags","surveys"],zn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[y]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[g]:{exposure:"event"},[_]:{exposure:"event"},[m]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[T]:{exposure:"hidden"},[C]:{exposure:"event"},[x]:{exposure:"event",shouldSkipFromEventProperties:t=>ci(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[F]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"hidden",storageGroup:"flags"},[I]:{exposure:"hidden"},[A]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags"},[O]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[D]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden",storageGroup:"surveys"},[H]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[q]:{exposure:"event"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[z]:{exposure:"event"},[Y]:{exposure:"hidden"},[Q]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[S]:{exposure:"event"},[k]:{exposure:"event"},[E]:{exposure:"event"},[P]:{exposure:"event"},[at]:{exposure:"event"},[lt]:{exposure:"event"},[ht]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Un=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Hn=t=>{var i=zn[t];if(i)return i;for(var e of Un){var r=e[1];if(0===t.indexOf(e[0]))return r}},qn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return ei(t)}},Vn=t=>{var i=null==Et?void 0:Et.createElement("a");return ui(i)?null:(i.href=t,i)},Wn=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!oi(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Zr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Gn=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");oi(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},Jn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Kn=(t,i)=>t>=i&&It(),Yn=(t,i,e,r)=>{if(0===t){if(It()){var s=i+1;return s===e&&r(),s}return i}return 0},Qn="https?://(.*)",Xn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Zn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Xn],to="<masked>",io=["li_fat_id"];function eo(t,i,e){if(!Et)return{};var r,s=i?[...Xn,...e||[]]:[],n=ro(Gn(Et.URL,s,to),t),o=(r={},es(io,(function(t){var i=vs(t);r[t]=i||null})),r);return rs(o,n)}function ro(t,i){var e=Zn.concat(i||[]),r={};return es(e,(function(i){var e=Wn(t,i);r[i]=e||null})),r}function so(t){var i=function(t){return t?0===t.search(Qn+"google.([^/?]*)")?"google":0===t.search(Qn+"bing.com")?"bing":0===t.search(Qn+"yahoo.com")?"yahoo":0===t.search(Qn+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!ci(i)){r.$search_engine=i;var s=Et?Wn(Et.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function no(){return navigator.language||navigator.userLanguage}var oo="$direct";function ao(){return(null==Et?void 0:Et.referrer)||oo}function lo(t,i,e){void 0===e&&(e=!1);var r=t?[...Xn,...i||[]]:[],s=e?Ue(null==$t?void 0:$t.href):null==$t?void 0:$t.href,n=null==s?void 0:s.substring(0,1e3);return{r:ao().substring(0,1e3),u:n?Gn(n,r,to):void 0}}function ho(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?Ue(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==oo?oo:null==(e=Vn(r))?void 0:e.host};if(n){o.$current_url=n;var a=Vn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=ro(n);rs(o,l)}if(r){var h=so(r);rs(o,h)}return o}function uo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function vo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var co={flags:Q,surveys:H},fo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],po=t=>t+"_cookie_identity_change_pending",go="main",_o=[F,R,A,M,O,Q,D,N],mo=t=>-1!==_o.indexOf(t),yo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},bo=t=>{if(!t)return{};var i=JSON.parse(t);return li(i)?i:{}},wo=(t,i)=>{es(t,((e,r)=>{var s=Hn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class xo{constructor(t,i,r){if(void 0===r&&(r=!0),this.na={},this.sa=!1,this.aa=!1,this.oa=!1,this.la=!1,this.ua=new Map,this.ha=!1,this.da=!1,this.va=!1,this.ca=new Set,this.gn=t,this.fa=r,this.props={},this.pa=void 0,this.ga=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.Gs=this.ma(t),this.aa=this.ya(t),this.load(),this.ba(),t.debug&&Zr.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save(),xt){var s=()=>this.flush();us(xt,"beforeunload",s,{capture:!1}),us(xt,"pagehide",s,{capture:!1}),this._a=t=>{if(this.sa&&(!t.storageArea||t.storageArea===(null==xt?void 0:xt.localStorage))&&t.key)if(t.key!==this.ga){if(this.aa){var i=Bn.find((i=>t.key===this.wa(i)));i&&this.ka(t.key,i)}}else this.ka(t.key,go)},us(xt,"storage",this._a)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var i=t[0],e=t[1],r=this.ua.get(i);if(mo(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach((t=>s.add(t))),s.size&&this.Sa(i,s)}else this.Sa(i,!0)}))}onCrossTabFeatureFlagChange(t){return this.ca.add(t),()=>this.ca.delete(t)}destroy(){this._a&&xt&&(xt.removeEventListener("storage",this._a),this._a=void 0),this.ca.clear()}ka(t,i,e){if(void 0===e&&(e=!0),this.xa)return!1;var r,s;try{if(s=Es.ni(t),ci(s)){var n=this.Ca(i);return n.storageValue=null,i!==go&&(n.persisted=!1),!1}r=bo(s)}catch(t){return!1}var o=i===go?r:Es.si(this.ga);if(o&&this.Ta(o))return!1;var a=this.Ma(r,i,e);return i===go&&this.aa&&!yo(this.Ea().main,r)||this.Ia(r,i,!0,s),a}Ta(t){var i=this.props[o],e=t[o];return!ui(i)&&!ui(e)&&i!==e}Ia(t,i,e,r){var s=this.Ca(i);s.storageValue=r,i!==go&&(s.persisted=e);try{s.fingerprint=this.Ra(t,i)}catch(t){s.fingerprint=void 0}}Ma(t,i,e){var r=!1;return _o.forEach((e=>{var s,n=null==(s=Hn(e))?void 0:s.storageGroup;if(!(i===go&&this.aa&&n||i!==go&&n!==i)){var o=e in t,a=this.Pa(e,o?t[e]:void 0),l=this.ua.has(e)?e in this.props:o;l===e in this.props&&yo(a,this.props[e])||(l?this.Aa(e,a,!1):this.Fa(e,!1),r=!0)}})),r&&e&&this.ca.forEach((t=>t())),r}Oa(){if(!this.sa)return!1;try{this.va=!1;var t,i=Es.ni(this.ga),e=this.Ca(go),r=!1,s=!1;if(i!==e.storageValue)if(ci(i))e.storageValue=null;else{if(t=bo(i),this.va=!this.da&&this.Ta(t),this.va)return!1;s=this.Ma(t,go,!1),!this.aa||yo(this.Ea().main,t)?this.Ia(t,go,!0,i):e.storageValue=i,r=!0}return this.aa&&Bn.forEach((i=>{var e=Es.ni(this.wa(i)),n=this.Ca(i),o=t||{},a=r&&_o.some((t=>{var e;return(null==(e=Hn(t))?void 0:e.storageGroup)===i&&t in o}));if(e!==n.storageValue||a){if(ci(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ma(o,i,!1)||s));var l=bo(e);s=this.Ma(l,i,!1)||s,this.Ia(l,i,!0,e)}})),s}catch(t){return!1}}Sa(t,i){this.ua.set(t,i);var e=Hn(t);null!=e&&e.volatile||(this.Ca((this.aa?null==e?void 0:e.storageGroup:void 0)||go).fingerprint=void 0,this.La(t))}Da(){_o.forEach((t=>this.ua.set(t,!0)))}ba(){if(this.sa)try{var t=Es.ni(this.ga),i=bo(t);this.Ca(go).storageValue=t,_o.forEach((t=>{var e,r=this.aa?null==(e=Hn(t))?void 0:e.storageGroup:void 0,s=r?Es.ni(this.wa(r)):null;if(r){var n=this.Ca(r);n.storageValue=s,n.persisted=!ci(s)}var o=r&&!ci(s)?bo(s):i;t in this.props?this.$a(t,o[t],this.props[t]):t in o&&this.Sa(t,!0)}))}catch(t){}}Pa(t,i){var r=this.ua.get(t);if(!r)return i;if(!0===r)return this.props[t];if(t===R){var s=new Set(oi(i)?i:[]),n=new Set(oi(this.props[t])?this.props[t]:[]);return r.forEach((t=>n.has(t)?s.add(t):s.delete(t))),Array.from(s)}var o=li(i)?e({},i):{},a=li(this.props[t])?this.props[t]:{};return r.forEach((t=>{t in a?o[t]=a[t]:delete o[t]})),o}$a(t,i,e){if(mo(t)){var r=this.ua.get(t);if(!0!==r){var s=i;if(this.sa)try{var n,o=this.aa?null==(n=Hn(t))?void 0:n.storageGroup:void 0,a=o?this.wa(o):this.ga;s=bo(Es.ni(a))[t]}catch(t){}var l=new Set(r||[]);if(t===R){if(!ui(i)&&!oi(i)||!ui(s)&&!oi(s)||!oi(e))return void this.Sa(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach((t=>{h.has(t)!==d.has(t)&&l.add(t)})),l.forEach((t=>{u.has(t)===d.has(t)&&l.delete(t)}))}else{if(!li(e))return void(yo(s,e)?this.ua.delete(t):this.Sa(t,!0));if(!ui(i)&&!li(i)||ui(i)&&hi(e)&&ui(s))return void this.Sa(t,!0);var v=li(i)?i:{},c=li(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach((t=>{t in v==t in e&&yo(v[t],e[t])||l.add(t)})),l.forEach((t=>{t in c==t in e&&yo(c[t],e[t])&&l.delete(t)}))}l.size?this.Sa(t,l):this.ua.delete(t)}}}Na(){var t,i=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return pi(i)&&i>0?i:0}qa(t){if(this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase())if(t)try{var i=Rs(t,this.gn.cookie_persisted_properties||[]),e=As(i,this.gn.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ss.ni(this.ga)||void 0;s&&Os(this.ga,s)===r&&(this.ja=r,this.Ba=s)}catch(t){}else try{var n=Ss.ni(this.ga)||void 0;this.ja=n?Os(this.ga,n):void 0,this.Ba=n}catch(t){}}syncCookieProperties(){return this.Ha(this.gn)}Ha(t,i){if(void 0===i&&(i=!1),this.xa&&!i||this.la||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=Ss.ni(this.ga)||void 0}catch(t){}if(!e||e===this.Ba)return!1;var r,s=Os(this.ga,e);try{r=Fs(JSON.parse(e))}catch(t){return!1}if((Ss.ni(this.ga)||void 0)!==e)return!1;this.ja=s,this.Ba=e;var n=Ms(this.ga,e),a=[...Ps,...n.properties],l={};if(Object.keys(r).forEach((t=>{var i=r[t];(ui(i)||ci(i)||""===i||t===X&&i!==ct&&i!==ft)&&(l[t]=!0,delete r[t])})),hi(r))return!1;var u=o in r||r[X]===ct||r[X]===ft,d=this.props,v=d[o],c=d[X],f=rs({},d);[...Ps,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==X)){var i=f[t];!n.isValid&&-1!==Ps.indexOf(t)&&(!1===i||0===i)||delete f[t]}})),this.props=rs(f,r),_o.forEach((t=>{var i=t in this.props;t in d===i&&yo(d[t],this.props[t])||(i?this.$a(t,d[t],this.props[t]):this.Sa(t,!0))})),!u||X in r||X in this.props||this.Aa(X,ct);var p=this.props[o],g=this.props[X];return!u||p===v&&g===c||(this.da=!0,this.oa=!0,Ns.ii(po(this.ga),!0),this.Fa(N),this.Fa(R),this.Fa(F),this.Fa(A),this.Fa(M),this.Fa(O),this.Fa(Q),this.Fa(Y),this.Fa(J),g===ct&&(c===ft||r[X]===ct||!ui(v)&&p!==v)&&(wo(this.props,r),this.Fa(B)),g===ft?this.props.$user_id=p:delete this.props.$user_id,this.Fa(h)),!0}consumeCookieIdentityChange(){var t=po(this.ga),i=this.oa||!!Ns.ni(t);return this.oa=!1,i&&Ns.ai(t),i}za(t){return void 0===t&&(t=!1),!(this.la||this.xa&&!t||!this.gn.cookieWinsOnConflict||"localstorage+cookie"!==this.gn.persistence.toLowerCase()||(this.la=!0,0))}Ua(){this.la&&(ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),delete this.na[go],this.Va(!0))}Ga(t){if(void 0===t&&(t=!0),this.la)try{t?this.Ua():ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0)}finally{this.la=!1}}isDisabled(){return!!this.xa}ma(t){-1===fo.indexOf(t.persistence.toLowerCase())&&(Zr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,r=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var r=[...Ps,...t];return e({},Es,{si(t){try{var e,s={};try{e=Ss.ni(t)||void 0,s=e?Fs(JSON.parse(e)):{}}catch(t){}var n,a=JSON.parse(Es.ni(t)||"{}");if(i){var l=Ms(t,e),h=[...Ps,...l.properties],u={};Object.keys(s).forEach((t=>{var i=s[t];ci(i)||""===i||t===X&&i!==ct&&i!==ft||(u[t]=i)}));var d=o in u||u[X]===ct||u[X]===ft;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[X])&&void 0!==v?v:ct;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==X)){var i=a[t];!l.isValid&&-1!==Ps.indexOf(t)&&(!1===i||0===i)||delete a[t]}})),!d||X in s||X in a||(a[X]=ct),!d||(o in u?u[o]:a[o])===c&&(X in u?u[X]:a[X])===f||($s.forEach((t=>delete a[t])),u[X]===ft&&o in u?a.$user_id=u[o]:delete a.$user_id,u[X]!==ft&&(delete a[z],delete a[B]),delete a.__alias)}n=rs(a,u)}else n=rs(s,a);return Es.ii(t,n),n}catch(t){}return null},ii(e,r,s,n,o,a){var l=Es.ii(e,r,void 0,void 0,a);try{var h=Rs(r,t);if(Object.keys(h).length){if(i){var u=Ts(e),d=As(h,t);if(Ss.ii(u,d,s,n,o,a),Ss.ni(u)!==JSON.stringify(d)){Ss.ai(u,n);var v=Rs(r);return Ss.ii(e,v,s,n,o,a),l}}Ss.ii(e,h,s,n,o,a)}}catch(t){Es.oi(t)}return l},ai(t,i){try{null==xt||xt.localStorage.removeItem(t),Ss.ai(t,i),Ss.ai(Ts(t),i)}catch(t){Es.oi(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&Es.ri()?(i=Es,s=!0):"localstorage+cookie"===n&&r.ri()?(i=r,s=!0):"sessionstorage"===n&&Ns.ri()?i=Ns:"memory"===n?i=js:"cookie"===n&&Ss.ri()?i=Ss:r.ri()?(i=r,s=!0):i=Ss.ri()?Ss:js,this.sa=s,i}wa(t){return this.ga+"__"+t}ya(t){return this.sa&&!!t.split_storage}properties(){var t={};return es(this.props,((i,e)=>{var r=Hn(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}})),t}load(t){if(void 0===t&&(t=!1),!this.xa||t){var i=this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase(),e=i?Es.si(this.ga):null,r={};if(i)try{es(r=Fs(Ss.si(this.ga)),((t,i)=>{(ui(t)||ci(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.Gs.si(this.ga);if(s&&(this.props=rs({},s)),this.aa&&this.Za(),i&&s){var n,a,l=null==e?void 0:e[o],h=null!==(n=null==e?void 0:e[X])&&void 0!==n?n:ct,u=s[o],d=null!==(a=s[X])&&void 0!==a?a:ct;if(u!==l||d!==h){this.oa=!0,Ns.ii(po(this.ga),!0);var v=rs({},this.props);$s.forEach((t=>delete v[t])),d===ct&&(h===ft||r[X]===ct||!ui(l)&&u!==l)&&(wo(v,r),delete v[B]),this.props=v;var c=new Set;$s.forEach((t=>{var i,e=null==(i=Hn(t))?void 0:i.storageGroup;e&&c.add(e)})),c.forEach((t=>{var i={};es(this.props,((e,r)=>{var s;(null==(s=Hn(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),hi(i)?(Es.ai(this.wa(t)),this.na[t]={}):Es.ii(this.wa(t),i)&&(this.na[t]={persisted:!0,fingerprint:this.Ra(i,t)})}))}}Ns.ni(po(this.ga))&&(this.oa=!0)}}Za(){for(var t of Bn){var i=Es.si(this.wa(t));if(i&&!hi(i)){var e=this.Ca(t);e.persisted=!0,this.Qa(t)||(e.fingerprint=this.Ra(i,t)),this.Ja(t,i)||rs(this.props,i)}}}Qa(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=Hn(i))?void 0:e.storageGroup)===t}))}Ja(t,i){var e=co[t];if(!e)return!1;var r=i[e],s=this.props[e];return pi(r)&&pi(s)&&s>r}refreshKey(t){var i;if(!this.xa){var e=this.aa?null==(i=Hn(t))?void 0:i.storageGroup:void 0,r=e?Es.si(this.wa(e)):this.Gs.si(this.ga);if(r&&t in r)this.Aa(t,r[t]);else{if(e){var s=this.Gs.si(this.ga);if(s&&t in s)return void this.Aa(t,s[t])}this.Fa(t)}}}save(){if(!this.xa){var t=this.Na();t>0?ui(this.Wa)&&(this.Wa=setTimeout((()=>{this.Wa=void 0,this.Va()}),t)):this.Va()}}flush(){ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0,this.Va())}Va(t){if(void 0===t&&(t=!1),!(this.xa||this.la&&!t)){t||this.syncCookieProperties();var i=!t&&!this.ha;i||(this.va=!1);var e=!!i&&this.Oa();if(this.va)this.gn.debug&&Zr.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.aa)return this.Ka(),void(e&&this.ca.forEach((t=>t())));var r=this.Ya(this.Gs,this.ga,this.props,go);"written"===r&&this.qa(this.props),"failed"!==r&&(this.ua.clear(),this.da=!1),e&&this.ca.forEach((t=>t()))}}}Ka(){var t=this,i=this.Ea(),e=i.main,r=i.groups,s=this.Ya(this.Gs,this.ga,e,go);"written"===s&&this.qa(e),"failed"!==s&&(this.da=!1,_o.forEach((t=>{var i;null!=(i=Hn(t))&&i.storageGroup||this.ua.delete(t)})));var n=function(i){var e,s=r[i];if(hi(s)&&(null==(e=t.na[i])||!e.persisted))return _o.forEach((e=>{var r;(null==(r=Hn(e))?void 0:r.storageGroup)===i&&t.ua.delete(e)})),1;var n=t.Ya(Es,t.wa(i),s,i);"failed"!==n&&_o.forEach((e=>{var r=Hn(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.ua.delete(e)}))};for(var o of Bn)n(o)}Ea(){var t={},i={flags:{},surveys:{}};return es(this.props,((e,r)=>{var s,n=null==(s=Hn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Ra(t,i){if(i===go)return JSON.stringify(t)+"|"+this.Xa+"|"+this.eo+"|"+this.io;var e={};return es(t,((t,i)=>{var r;e[i]=null!=(r=Hn(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}Ya(t,i,e,r){var s,n=this.Ca(r);if(r!==go&&!n.dirty&&!ui(n.fingerprint))return"skipped";try{if((s=this.Ra(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ii(i,e,this.Xa,this.eo,this.io,this.gn.debug)?(n.dirty=!1,r!==go&&(n.persisted=!0),ui(s)||(n.fingerprint=s),this.sa&&(n.storageValue=Es.ni(i)),"written"):(this.gn.debug&&Zr.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.Da(),ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),this.Gs.ai(this.ga,!1),this.Gs.ai(this.ga,!0),!e&&this.fa)for(var r of Bn)Es.ai(this.wa(r));e?delete this.na[go]:this.na={},this.ja=void 0,this.Ba=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(li(t)){this.syncCookieProperties(),ui(i)&&(i="None"),this.Xa=ui(e)?this.ro:e;var r=!1;if(es(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Aa(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(li(t)){this.syncCookieProperties(),this.Xa=ui(i)?this.ro:i;var e=!1;if(es(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||li(i)||oi(i))&&(this.Aa(r,i),e=!0)})),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.Fa(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==Et?void 0:Et.URL;if(t!==this.pa){var i=eo(this.gn.custom_campaign_params,this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties);hi(as(i))||this.register(i),this.pa=t}}update_search_keyword(){var t;this.register((t=null==Et?void 0:Et.referrer)?so(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ao(),$referring_domain:null!=Et&&Et.referrer&&(null==(t=Vn(Et.referrer))?void 0:t.host)||oo},void 0)}set_initial_person_info(){this.props[it]||this.props[et]||this.register_once({[rt]:lo(this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties,this.gn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};es([et,it],(i=>{var e=this.props[i];e&&es(e,(function(i,e){t["$initial_"+ii(e)]=i}))}));var i=this.props[rt];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=ho(t,i),r={};return es(e,(function(t,i){r["$initial_"+ii(i)]=t})),r}(i,this.gn.disable_capture_url_hashes);rs(t,e)}return t}safe_merge(t){return es(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,r){var s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.xa&&!l;l||this.Ha(i,h),this.gn=t,!l&&(s||n||a)&&(this.ja=void 0,this.Ba=void 0,this.Ha(e({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.ma(t):this.Gs,d=this.ya(t),v=o||d!==this.aa,c=!l&&(v||t.cross_subdomain_cookie!==this.eo||t.secure_cookie!==this.io)&&this.za(h);this.ha=v;try{if(this.ro=this.Xa=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.Gs=u,this.aa=d,this.props=f,this.save()}else a&&(this.Gs=u,l||(delete this.na[go],this.Va()))}finally{this.ha=!1,c&&this.Ga()}}set_disabled(t){this.xa=t,this.xa?this.remove():this.save()}set_cross_subdomain(t){t!==this.eo&&(this.eo=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.io&&(this.io=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[u]||{};e[t]=i,this.Aa(u,e),this.save()}remove_event_timer(t){var i=this.props[u]||{},e=i[t];return ui(e)||(delete i[t],this.Aa(u,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Aa(t,i),this.save()}Aa(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&(t!==o&&t!==X||s===i||(this.da=!0),this.$a(t,s,i),null!=(r=Hn(t))&&r.volatile||this.La(t))}Fa(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(mo(t)&&this.Sa(t,!0),this.La(t))}La(t){var i,e=null==(i=Hn(t))?void 0:i.storageGroup;e&&(this.Ca(e).dirty=!0)}Ca(t){return this.na[t]||(this.na[t]={})}}function So(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&ai(e.then)&&e.then(void 0,(()=>{}))}}}}var ko="gzip-js",Eo="base64",$o="events",Po="cancelEvents",To="survey shown",Co="survey dismissed",Fo="survey sent",Ro="popover",Io=ts("[RateLimiter]");class Ao{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Io.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Io.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(tt))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(pi(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.no(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(tt,a),{isRateLimited:l,remainingTokens:a.tokens}}so(t){var i=this.instance.config.property_denylist;return!oi(i)||!i.includes(t)}ao(){var t;if(this.so("$current_url")&&this.so("$pathname")&&null!=$t&&$t.pathname)return""+(null!==(t=$t.origin)&&void 0!==t?t:"")+$t.pathname}no(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ao(),o=this.so("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Mo=ts("[RemoteConfig]");class Oo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=Mt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}oo(t){var i,e;null!=(i=Mt.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}lo(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Mo.info("Using preloaded remote config",this.remoteConfig),void this.uo(this.remoteConfig);if(this._instance.ho())return void Mo.warn("Remote config is disabled. Falling back to local config.");this.oo((t=>{if(!t)return Mo.info("No config found after loading remote JS config. Falling back to JSON."),void this.lo((t=>{this.uo(t.json,t)}));this.uo(t)}))}catch(t){Mo.error("Error loading remote config",t),this.uo()}}uo(t,i){!t&&i&&(0===i.statusCode?i.error||Mo.warn("Failed to fetch remote config from PostHog."):Mo.error("Failed to fetch remote config from PostHog."));try{this._instance.uo(t?{ok:!0,config:t}:{ok:!1})}catch(t){Mo.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){Mo.error("Error loading feature flags",t)}}}var Do=Uint8Array,jo=Uint16Array,Lo=Uint32Array,No=new Do([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]),Bo=new Do([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),zo=new Do([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Uo=function(t,i){for(var e=new jo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Lo(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Ho=Uo(No,2),qo=Ho[1];Ho[0][28]=258,qo[258]=28;for(var Vo=Uo(Bo,0)[1],Wo=new jo(32768),Go=0;32768>Go;++Go){var Jo=(43690&Go)>>>1|(21845&Go)<<1;Wo[Go]=((65280&(Jo=(61680&(Jo=(52428&Jo)>>>2|(13107&Jo)<<2))>>>4|(3855&Jo)<<4))>>>8|(255&Jo)<<8)>>>1}var Ko=function(t,i,e){for(var r=t.length,s=0,n=new jo(i);r>s;++s)++n[t[s]-1];var o,a=new jo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new jo(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Wo[d]>>>l]=h}else for(o=new jo(r),s=0;r>s;++s)o[s]=Wo[a[t[s]-1]++]>>>15-t[s];return o},Yo=new Do(288);for(Go=0;144>Go;++Go)Yo[Go]=8;for(Go=144;256>Go;++Go)Yo[Go]=9;for(Go=256;280>Go;++Go)Yo[Go]=7;for(Go=280;288>Go;++Go)Yo[Go]=8;var Qo=new Do(32);for(Go=0;32>Go;++Go)Qo[Go]=5;var Xo=Ko(Yo,9,0),Zo=Ko(Qo,5,0),ta=function(t){return(t/8>>0)+(7&t&&1)},ia=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof jo?jo:t instanceof Lo?Lo:Do)(e-i);return r.set(t.subarray(i,e)),r},ea=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},ra=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},sa=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Do(0),0];if(1==s){var o=new Do(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new jo(v+1),f=na(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;i>c[y]?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Do(c),f]},na=function(t,i,e){return-1==t.s?Math.max(na(t.l,i,e+1),na(t.r,i,e+1)):i[t.s]=e},oa=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new jo(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},aa=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},la=function(t,i,e){var r=e.length,s=ta(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},ha=function(t,i,e,r,s,n,o,a,l,h,u){ea(i,u++,e),++s[256];for(var d=sa(s,15),v=d[0],c=d[1],f=sa(n,15),p=f[0],g=f[1],_=oa(v),m=_[0],y=_[1],b=oa(p),w=b[0],x=b[1],S=new jo(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=sa(S,7),P=E[0],T=E[1],C=19;C>4&&!P[zo[C-1]];--C);var F,R,I,A,M=h+5<<3,O=aa(s,Yo)+aa(n,Qo)+o,D=aa(s,v)+aa(n,p)+o+14+3*C+aa(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=M&&D>=M)return la(i,u,t.subarray(l,l+h));if(ea(i,u,1+(O>D)),u+=2,O>D){F=Ko(v,c,0),R=v,I=Ko(p,g,0),A=p;var j=Ko(P,T,0);for(ea(i,u,y-257),ea(i,u+5,x-1),ea(i,u+10,C-4),u+=14,k=0;C>k;++k)ea(i,u+3*k,P[zo[k]]);u+=3*C;for(var L=[m,w],N=0;2>N;++N){var B=L[N];for(k=0;B.length>k;++k)ea(i,u,j[z=31&B[k]]),u+=P[z],z>15&&(ea(i,u,B[k]>>>5&127),u+=B[k]>>>12)}}else F=Xo,R=Yo,I=Zo,A=Qo;for(k=0;a>k;++k)if(r[k]>255){var z;ra(i,u,F[257+(z=r[k]>>>18&31)]),u+=R[z+257],z>7&&(ea(i,u,r[k]>>>23&31),u+=No[z]);var U=31&r[k];ra(i,u,I[U]),u+=A[U],U>3&&(ra(i,u,r[k]>>>5&8191),u+=Bo[U])}else ra(i,u,F[r[k]]),u+=R[r[k]];return ra(i,u,F[256]),u+R[256]},ua=new Lo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),da=function(){for(var t=new Lo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),va=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ca(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=da[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Do(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=la(l,h,t.subarray(u,d)):(l[u]=!0,h=la(l,h,t.subarray(u,o)))}else{for(var v=ua[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new jo(32768),_=new jo(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Lo(25e3),x=new jo(288),S=new jo(32),k=0,E=0,P=(u=0,0),T=0,C=0;o>u;++u){var F=b(u),R=32767&u,I=_[F];if(g[R]=I,_[F]=R,u>=T){var A=o-u;if((k>7e3||P>24576)&&A>423){h=ha(t,l,0,w,x,S,E,P,C,u-C,h),P=k=E=0,C=u;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var O=2,D=0,j=f,L=R-I&32767;if(A>2&&F==b(u-L))for(var N=Math.min(c,A)-1,B=Math.min(32767,u),z=Math.min(258,A);B>=L&&--j&&R!=I;){if(t[u+O]==t[u+O-L]){for(var U=0;z>U&&t[u+U]==t[u+U-L];++U);if(U>O){if(O=U,D=L,U>N)break;var H=Math.min(L,U-2),q=0;for(M=0;H>M;++M){var V=u-L+M+32768&32767,W=V-g[V]+32768&32767;W>q&&(q=W,I=V)}}}L+=(R=I)-(I=g[R])+32768&32767}if(D){w[P++]=268435456|qo[O]<<18|Vo[D];var G=31&qo[O],J=31&Vo[D];E+=No[G]+Bo[J],++x[257+G],++S[J],T=u+O,++k}else w[P++]=t[u],++x[t[u]]}}h=ha(t,l,!0,w,x,S,E,P,C,u-C,h)}return ia(a,0,r+ta(h)+s)}(n=t,null==(o=i).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)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&va(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),va(h,u-8,e.d()),va(h,u-4,r),h}var fa=!!Tt||!!Pt,pa="text/plain",ga=!1,_a=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==i)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},ma=function(t,i,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=e({},i),h=null!==(s=null==a?void 0:a.split("&").map((t=>{var i,e=t.split("="),s=e[0],n=r&&null!==(i=l[s])&&void 0!==i?i:e[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return es(t,(function(t,i){ui(t)||ui(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},ya=t=>{if(t.do)return t.do;var i=t.data,e=t.compression;if(i){if(e===ko){var r=ca(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Do(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Do(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return ia(r,0,s)}(qn(i)),{mtime:0});return{contentType:pa,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Eo){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(qn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:qn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=qn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ba=t=>{var i,r,s=()=>"sendBeacon"===t.transport?{url:ma(t.url,{compression:Eo}),encodedBody:ya(e({},t,{compression:Eo,do:void 0}))}:{url:_a(t.url,"compression"),encodedBody:ya(e({},t,{compression:void 0,do:void 0}))};try{i=ya(t)}catch(i){if(Ke(t.compression,Wn(t.url,"compression")))return Zr.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&Ke(t.compression,Wn(t.url,"compression"))&&!((r=i.body)instanceof ArrayBuffer?Je(new Uint8Array(r)):ArrayBuffer.isView(r)&&Je(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(ga=!0,s()):{url:t.url,encodedBody:i}},wa=t=>{try{return ba(t)}catch(i){return Zr.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},xa=function(){var t=i((function*(t){var i=qn(t.data),r=yield function(t,i,e){return Ze.apply(this,arguments)}(i,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return e({},t,{do:{contentType:pa,body:n,estimatedSize:n.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),Sa=/Failed to fetch|NetworkError|Load failed/i,ka=t=>"TypeError"===(null==t?void 0:t.name)&&Sa.test((null==t?void 0:t.message)||""),Ea=t=>{var i=wa(t);if(i){var r=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;es(t.headers,(function(t,i){h.append(i,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Ct){var v=new Ct;u={signal:v.signal,timeout:setTimeout((()=>{var i;d=!0,v.abort(ze("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))}),t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||ka(i)?Zr.warn(i):Zr.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Pt(r,e({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.vo&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Zr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},$a=t=>{try{var i,r=ba(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(kt.sendBeacon(s,h))return;var u=oi(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(oi(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>oi(t.data)?i:e({},t.data,{batch:i});return $a(e({},t,{data:v(u.slice(0,d))})),void $a(e({},t,{data:v(u.slice(d))}))}Zr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ea(e({},t,{vo:!0}))}catch(t){Zr.warn("Beacon send failed",t)}},Pa=(t,i,r,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return ma(r===ko?_a(t,"compression"):t,e({},n?{[n]:Date.now().toString()}:{},r===ko?{}:{compression:r}))},Ta=[];Pt&&Ta.push({transport:"fetch",method:Ea}),Tt&&Ta.push({transport:"XHR",method(t){var i=wa(t);if(i){var e=new Tt,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;es(t.headers,(function(t,i){e.setRequestHeader(i,t)})),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=kt&&kt.sendBeacon&&Ta.push({transport:"sendBeacon",method:$a});var Ca=3e3;class Fa{constructor(t,i){this.co=!0,this.fo=[],this.po=Ci((null==i?void 0:i.flush_interval_ms)||Ca,250,5e3,Zr.createLogger("flush interval"),Ca),this.mo=t}enqueue(t){this.fo.push(t),this.yo||this.bo()}unload(){this._o();var t=this.fo.length>0?this.wo():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ko(e({},t,{transport:"sendBeacon"}))}))}enable(){this.co=!1,this.bo()}bo(){var t=this;this.co||(this.yo=setTimeout((()=>{if(this._o(),this.fo.length>0){var i=this.wo(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&oi(e.data)&&es(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ko(e)};for(var r in i)e()}}),this.po))}ko(t){try{this.mo(t)}catch(t){Zr.error(t)}}_o(){clearTimeout(this.yo),this.yo=void 0}wo(){var t={};return es(this.fo,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;ui(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.fo=[],t}}var Ra=["retriesPerformedSoFar"];class Ia{constructor(t){this.So=!1,this.xo=3e3,this.fo=[],this._instance=t,this.fo=[],this.Co=!0,!ui(xt)&&"onLine"in xt.navigator&&(this.Co=xt.navigator.onLine,this.To=()=>{this.Co=!0,this.Mo()},this.Eo=()=>{this.Co=!1},us(xt,"online",this.To),us(xt,"offline",this.Eo))}get length(){return this.fo.length}retriableRequest(t){var i=t.retriesPerformedSoFar,s=r(t,Ra);gi(i)&&(s.url=ma(s.url,{retry_count:i})),this._instance._send_request(e({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.es(e({retriesPerformedSoFar:i},s));0===t.statusCode&&Zr.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=i?i:0)+" retries.")}null==s.callback||s.callback(t)}}))}es(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.fo.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Zr.warn(s),this.So||(this.So=!0,this.Io())}Io(){if(this.Ro&&clearTimeout(this.Ro),0===this.fo.length)return this.So=!1,void(this.Ro=void 0);this.Ro=setTimeout((()=>{this.Co&&this.fo.length>0&&this.Mo(),this.Io()}),this.xo)}Mo(){var t=Date.now(),i=[],e=this.fo.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.fo=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Ro&&(clearTimeout(this.Ro),this.Ro=void 0),this.So=!1,ui(xt)||(this.To&&(xt.removeEventListener("online",this.To),this.To=void 0),this.Eo&&(xt.removeEventListener("offline",this.Eo),this.Eo=void 0)),this.fo)){var i=t.requestOptions;try{this._instance._send_request(e({},i,{transport:"sendBeacon"}))}catch(t){Zr.error(t)}}this.fo=[]}}class Aa{constructor(t){this.Po=()=>{var t,i,e,r;this.Ao||(this.Ao={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Ao.lastScrollY=Math.ceil(n),this.Ao.maxScrollY=Math.max(n,null!==(t=this.Ao.maxScrollY)&&void 0!==t?t:0),this.Ao.maxScrollHeight=Math.max(o,null!==(i=this.Ao.maxScrollHeight)&&void 0!==i?i:0),this.Ao.lastContentY=a,this.Ao.maxContentY=Math.max(a,null!==(e=this.Ao.maxContentY)&&void 0!==e?e:0),this.Ao.maxContentHeight=Math.max(l,null!==(r=this.Ao.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Fo(){return this._instance.config.scroll_root_selector}getContext(){return this.Ao}resetContext(){var t=this.Ao;return setTimeout(this.Po,0),t}startMeasuringScrollPosition(){us(xt,"scroll",this.Po,{capture:!0}),us(xt,"scrollend",this.Po,{capture:!0}),us(xt,"resize",this.Po)}scrollElement(){if(!this.Fo)return null==xt?void 0:xt.document.documentElement;var t=oi(this.Fo)?this.Fo:[this.Fo];for(var i of t){var e=null==xt?void 0:xt.document.querySelector(i);if(e)return e}}Oo(t){var i="y"===t?"scrollTop":"scrollLeft";if(this.Fo){var e=this.scrollElement();return e&&e[i]||0}return xt?"y"===t?xt.scrollY||xt.pageYOffset||xt.document.documentElement.scrollTop||0:xt.scrollX||xt.pageXOffset||xt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Oo("y")}scrollX(){return this.Oo("x")}}var Ma=t=>lo(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class Oa{constructor(t,i,e,r){this.Tt=t=>{var i=this.Lo();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Do(this._instance)};this.$o.register({[Z]:e})}},this._instance=t,this.No=i,this.$o=e,this.Do=r||Ma,this.No.onSessionId(this.Tt)}Lo(){return this.$o.props[Z]}getSetOnceProps(){var t,i=null==(t=this.Lo())?void 0:t.props;return i?"r"in i?ho(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return es(as(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+ii(e)]=i})),t}}class Da{on(t,i){return this.qo[t]||(this.qo[t]=[]),this.qo[t].push(i),()=>{this.qo[t]=this.qo[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.qo[t]||[])e(i);for(var r of this.qo["*"]||[])r(t,i)}constructor(){this.qo={}}}var ja=ts("[SessionId]"),La=864e5;class Na{on(t,i){return this.jo.on(t,i)}constructor(t,i,e){var r;if(this.Bo=null,this.Ho=null,this.zo=[],this.Uo=void 0,this.Wo=!1,this.jo=new Da,this.Vo=(t,i)=>!(!gi(t)||!gi(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===vt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.gn=t.config,this.$o=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Go=void 0,this._sessionActivityTimestamp=null,this.Zo=i||ms,this.Qo=e||ms;var s=this.gn.persistence_name||this.gn.token;if(this._sessionTimeoutMs=1e3*Ci(this.gn.session_idle_timeout_seconds||1800,60,36e3,ja.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Jo(),this.Ko="ph_"+s+"_window_id",this.Yo="ph_"+s+"_primary_window_exists",this.Xo()){var n=Ns.si(this.Ko),o=Ns.si(this.Yo);n&&!o?this.It=n:Ns.ai(this.Ko),Ns.ii(this.Yo,!0)}null!=(r=this.gn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.gn.bootstrap.sessionID),this.tl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ui(this.zo)&&(this.zo=[]),this.zo.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.zo=this.zo.filter((i=>i!==t))}}Xo(){return"memory"!==this.gn.persistence&&!this.$o.xa&&Ns.ri()}el(t){t!==this.It&&(this.It=t,this.Xo()&&Ns.ii(this.Ko,t))}il(){return this.It?this.It:this.Xo()?Ns.si(this.Ko):null}rl(t){var i=this.Bo;return!ci(i)&&!ci(t)&&5e3>Math.abs(t-i)}nl(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Pe||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Pe=t,s&&!r||s&&this.rl(i)||(this.Bo=i,this.$o.register({[T]:[i,t,e]}))}sl(){var t,i=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return gi(i)&&i>0}al(){this.sl()?this.$o.refreshKey(T):(this.$o.flush(),this.$o.load())}ol(){var t;if(!ci(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Bo){this.al();var i=this.ll();i[1]===this.Pe&&i[2]===this._sessionStartTimestamp&&(this.Bo=this._sessionActivityTimestamp,this.$o.register({[T]:[this._sessionActivityTimestamp,null!==(t=this.Pe)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.$o.flush())}}ul(){var t=this.ll()[0],i=gi(t)?t:0,e=gi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}hl(t){return this.al(),this.Vo(t,this.ul())}ll(){var t=this.$o.props[T];return oi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Bo=null,this.Go=void 0,clearTimeout(this.dl),this.dl=void 0,this.nl(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void ja.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void ja.error("Invalid sessionID in bootstrap",t)}}(t);return!ui(e)&&(i?this.Go={sessionId:t,sessionStartTimestamp:e}:this.nl(t,(new Date).getTime(),e),!0)}destroy(){this.Wo=!0,this.ol(),clearTimeout(this.dl),this.dl=void 0,this.Uo&&xt&&(xt.removeEventListener(_t,this.Uo,{capture:!1}),this.Uo=void 0),this.zo=[]}tl(){this.Uo=()=>{this.ol(),this.Xo()&&Ns.ai(this.Yo)},us(xt,_t,this.Uo,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.gn.cookieless_mode===vt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Pe;if(e)this.Ho=r;else if(ci(this.Ho)||this.Ho>r||r-this.Ho>=1e3){var n,o;null==(n=(o=this.$o).syncCookieProperties)||n.call(o),this.Ho=r}var a=this.ll(),l=a[1],h=a[2],u=!ui(s)&&l!==s,d=this.ul(),v=this.il(),c=this.Go,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>La),p=c?f:gi(h)&&Math.abs(r-h)>La,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.Vo(r,d);if(b){(b=this.hl(r))||ja.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.ll();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.Zo(),v=this.Qo(),ja.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Go=void 0,g=!0}else v||(v=this.Qo(),g=!0),(_=_||l!==y)&&(ja.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=gi(d)&&t&&!p?d:r,k=gi(h)?h:(new Date).getTime();this.el(v),this.nl(l,S,k),t||this.Jo();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.zo.forEach((t=>t(l,v,E))),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}Jo(){this.Wo||(clearTimeout(this.dl),this.dl=setTimeout((()=>{if(!this.Wo)if(this.hl((new Date).getTime())){var t=this.Pe;this.resetSessionId(),this.jo.emit("forcedIdleReset",{idleSessionId:t})}else this.Jo()}),1.1*this.sessionTimeoutMs))}}var Ba=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&Xt(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Xt(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function za(){return(za=i((function*(){var t=null==kt?void 0:kt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return di(e)&&e.length>0?e:void 0}catch(t){return void Zr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ua(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Ha=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},qa=t=>t.toLowerCase(),Va={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Ha(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Ha(i,t))))),icontains:(t,i)=>i.map(qa).some((i=>t.map(qa).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(qa).every((i=>t.map(qa).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))};function Wa(t,i){return!t||Object.entries(t).every((t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=Va[e.operator];return!!s&&s(e.values,[String(r)])}))}function Ga(t,i,e){return qn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Ja="custom",Ka="i.posthog.com",Ya=/^\/static\//,Qa=["/s/","/e/","/i/"];class Xa{constructor(t){this.vl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ka,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.vl[this.apiHost]||(this.vl[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":Ja),this.vl[this.apiHost]}cl(t){if(Ya.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}fl(t){var i=Vn(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}pl(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Vn(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&Qa.some((t=>0===i.indexOf(t)))){var a=this.fl(r);if(a){var l,h=this.apiHost,u=this.gl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.gl=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.gl,e=this.fl(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.pl(t,i,this.uiHost+i);if("flags"===t)return this.pl(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.cl(i);if(e)return this.pl(t,i,""+e+i)}if(this.region===Ja)return this.pl(t,i,this.apiHost+i);var r=Ka+i;switch(t){case"assets":return this.pl(t,i,"https://"+this.region+"-assets."+r);case"api":return this.pl(t,i,"https://"+this.region+"."+r)}}}var Za=ts("[Surveys]"),tl="seenSurvey_",il=t=>{try{var i=(t=>((t,i)=>""+t+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(tl,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Za.error("Failed to persist survey seen state",t)}},el=["popover","widget","api"],rl={ignoreConditions:!1,ignoreDelay:!1,displayType:Ro},sl=ts("[PostHog ExternalIntegrations]"),nl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class ol{constructor(t){this._instance=t}Ks(t,i){var e;null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return sl.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=Mt.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.Ks(nl[n],(()=>{var i;null==(i=Mt.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)})),!o&&null!=(r=Mt.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=Mt.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}}class al{constructor(t,i){this.A=t,this.$s=i,this.ml=new Map,this.Fs=!1}add(t){var e=this;return i((function*(){if(e.Fs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.ml.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.ml.set(t.name,t);try{var i=t.setup(e.$s);i&&(yield i)}catch(i){var r=e.ml.get(t.name)===t;r&&e.ml.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.yl(t)}}))()}getExtension(t){return this.ml.get(t)}dispose(){if(!this.Fs){this.Fs=!0;var t=Array.from(this.ml.values()).reverse();for(var i of(this.ml.clear(),t))this.yl(i)}}yl(t){try{var i=null==t.dispose?void 0:t.dispose();i&&ai(i.then)&&i.then(void 0,(i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class ll{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);ui(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}}var hl="extensionsRemoteConfig";class ul{constructor(t){this.Fs=!1,this.instance=t,this.A=Zr,this.bl=t._l,this.kv=new ll(t),this.onEvent=t=>So(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Fs)return So((()=>{}));var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.wl.on(hl,i);return this.bl&&i(this.bl),So(e)},this.kl=new al(Zr.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(a))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(a);return"string"==typeof t?t:void 0}get library(){return{name:s.LIB_NAME,version:s.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.kl.add(t)}getExtension(t){return this.kl.getExtension(t)}capture(t,e,r){var s=this;return i((function*(){r?s.instance.capture(t,e,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return So(this.instance.Sl(t))}handleRemoteConfig(t){this.Fs||(this.bl=t,this.instance.wl.emit(hl,t))}sendRequest(t,e){var r=this;return i((function*(){var i;void 0===e&&(e={});var s=r.instance.requestRouter.endpointFor(null!==(i=e.target)&&void 0!==i?i:"api",t),n={method:e.method,url:e.query?ma(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?Bt.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(r.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,r.instance._send_request(n)}))}))()}dispose(){this.Fs||(this.Fs=!0,this.kl.dispose())}}var dl={},vl=0,cl=()=>{},fl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',pl="Surveys module not available",gl="sanitize_properties is deprecated. Use before_send instead",_l="Invalid value for property_denylist config: ",ml=["token","distinct_id",ot],yl="posthog",bl=!fa&&-1===(null==Rt?void 0:Rt.indexOf("MSIE"))&&-1===(null==Rt?void 0:Rt.indexOf("Mozilla")),wl=t=>{var i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},xl=t=>{var i;return e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:hs(null==Et?void 0:Et.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:cl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:$t&&di(null==$t?void 0:$t.search)&&-1!==$t.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,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==xt||null==(i=xt.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Zr.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:pt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Ca},error_tracking:{},_onCapture:cl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:un,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:wl(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},Sl=[["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"]],kl=t=>{var i={};for(var e of Sl){var r=e[0],s=e[1];ui(t[r])||(i[s]=t[r])}var n=rs({},i,t),o=t.__preview_external_dependency_versioned_paths;return ui(o)||(ui(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),di(o)&&ui(t.asset_host)&&(n.asset_host=o)),oi(t.property_blacklist)&&(ui(t.property_denylist)?n.property_denylist=t.property_blacklist:oi(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Zr.error(_l+t.property_denylist)),n};class El{constructor(){this.__forceAllowLocalhost=!1}get xl(){return this.__forceAllowLocalhost}set xl(t){Zr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class $l{Cl(t){if(t){var i=this.ml.indexOf(t);-1!==i&&this.ml.splice(i,1)}}Tl(t,i){return this.Cl(t),this.ml.push(i),null==i.initialize||i.initialize(),i}Ml(){return this.config.cookieless_mode===vt||this.config.cookieless_mode===dt&&this.consent.isRejected()}El(){if(!this.Il&&!this.config.segment&&!this.Ml()){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Rl||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Il=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+e)))}}Pl(){if(!this.Ml()&&this.get_distinct_id()===nt){var t=this.persistence;if(t){this.Al()||t.load(!0);var i=this.get_distinct_id();if(!i||i===nt){var e=this.config.get_device_id(ms());this.register({distinct_id:e,$device_id:e}),t.set_property(X,ct)}this.Fl()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new El,this.Ol=!1,this.version=s.LIB_VERSION,this.Ll=new Set,this.Dl="",this.wl=new Da,this.ml=[],this.$l=[],this.Rl=!1,this.Il=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=xl(),this.SentryIntegration=Ln,this.sentryIntegration=t=>function(t,i){var e=jn(t,i);return{name:Dn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nl=!1,this.ql=null,this.jl=null,this.Bl=null,this.scrollManager=new Aa(this),this.pageViewManager=new Nn(this),this.rateLimiter=new Ao(this),this.requestRouter=new Xa(this),this.consent=new Bs(this),this.externalIntegrations=new ol(this);var i=null!==(t=$l.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=di(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=di(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Zr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==yl){var r,s=null!==(r=dl[e])&&void 0!==r?r:new $l;return s._init(t,i,e),dl[e]=s,dl[yl][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var n,o,a;void 0===i&&(i={});var h,u=di(t)?t.trim():"";if(!u)return Zr.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==(h=this.config)?void 0:h.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=xl(i.defaults),i.debug=this.Hl(i.debug),this.zl=i,this.Ul=[],i.person_profiles?this.jl=i.person_profiles:i.process_person&&(this.jl=i.process_person);var d=xl(i.defaults),v=kl(i),c=rs({},d,v,{name:r,token:u});li(d.rageclick)&&li(v.rageclick)&&(c.rageclick=rs({},d.rageclick,v.rageclick)),li(d.session_recording)&&li(v.session_recording)&&(c.session_recording=rs({},d.session_recording,v.session_recording)),this.set_config(c),this.config.on_xhr_error&&Zr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ko;var f=this.Al();if(this.persistence=new xo(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xo(e({},this.config,{persistence:"sessionStorage"}),f,!1),this.Dl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&Ns.ri()){var p=Ns.si(this.Dl);oi(p)&&p.forEach((t=>{di(t)&&this.Ll.add(t)}))}else Ns.ai(this.Dl);var g=e({},this.persistence.props),_=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Wl=new Fa((t=>this.Vl(t)),this.config.request_queue_config),this.Gl=new Ia(this),this.__request_queue=[];var m=this.Ml();m||(this.sessionManager=new Na(this),this.sessionPropsManager=new Oa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Zl()}))),this.Ql(),this.config.__preview_deferred_init_extensions?(Zr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Jl(m)}),0)):(Zr.info("Initializing extensions synchronously"),this.Jl(m)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Zr.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:g,s:_}),!this.config.identity_distinct_id||null!=(n=i.bootstrap)&&n.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var y=null==(o=i.bootstrap)?void 0:o.distinctID;if(this.Rl=!!y&&!vi(y),void 0!==(null==(a=i.bootstrap)?void 0:a.distinctID)){var b=i.bootstrap.distinctID,w=this.get_distinct_id(),x=this.persistence.get_property(X);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==b&&x===ct)this.identify(b);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==b&&x===ft)Zr.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 S=this.config.get_device_id(ms()),k=i.bootstrap.isIdentifiedID?S:b;this.persistence.set_property(X,i.bootstrap.isIdentifiedID?ft:ct),this.register({distinct_id:b,$device_id:k})}}if(m)this.register_once({distinct_id:nt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(ms());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(X,ct)}return us(xt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||ms();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(X,ft)),i()},s=e.user();"then"in s&&ai(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||On.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(On.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(On.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,mt),identify:t=>i(t,bt),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.Kl())):this.Kl(),ai(this.config._onCapture)&&this.config._onCapture!==cl&&(Zr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Zr.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 za.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(cl),this}Yl(t){var i=t;return di(i.name)&&ai(i.setup)}Xl(t,i){this.Yl(t)?i.push((()=>{this.tu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((i=>{Zr.error('Failed to dispose browser extension "'+t.name+'"',i)}))})):this.ml.push(t)}Ql(){var t,i,e,r,s,n,o=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(e=$l.__defaultExtensionClasses)?void 0:e.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.eu)||r.call(this),this.eu=void 0,this.featureFlags=new o(this)),ai(this.featureFlags.onReloading)&&ai(this.featureFlags.setup)?this.eu||(this.eu=this.featureFlags.onReloading((()=>{this.wl.emit("featureFlagsReloading",!0)})),this.tu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Jl(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},$l.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.ml.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.ml.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ml.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.ml.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.ml.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Xl(this.autocapture=new u.autocapture(this),d),u.surveys&&this.Xl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.Xl(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.ml.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.ml.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.ml.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ml.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ml.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ml.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ml.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,An)),u.toolbar&&this.ml.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.ml.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.ml.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.iu){var t=this.iu;this.iu=void 0,this.ml.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.ru(d,h)}ru(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ru(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Zr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[at]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[lt]:r}),this.config.__preview_deferred_init_extensions&&Zr.info("PostHog extensions initialized ("+r+"ms)")}uo(t){var i;if(!Et||!Et.body)return Zr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.uo(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.iu=t),this._l=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=Zt(r.supportedCompression,ko)?ko:Zt(r.supportedCompression,Eo)?Eo:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.jl?this.jl:pt}),null==(i=this.nu)||i.handleRemoteConfig(t),this.ml.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Kl(){try{this.config.loaded(this)}catch(t){Zr.critical("`loaded` function failed",t)}if(this.su(),this.config.internal_or_test_user_hostname&&null!=$t&&$t.hostname){var t=$t.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ml())&&this.au()}),1),this.ou=new Oo(this),this.ou.load()}su(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Wl)||t.enable())}_dom_loaded(){this.is_capturing()&&is(this.__request_queue,(t=>this.Vl(t))),this.__request_queue=[],this.su()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.lu()&&this.capture(yt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Wl)||r.unload(),null==(s=this.Gl)||s.unload()):this.lu()&&this.capture(yt,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?bl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=e({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(ui(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,r,s,n=e({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&ui(n.compression)&&n.data&&(n.compression=Eo),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(oi(o=n.data)?o:[o]).map((t=>e({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),oi(t)?t.map((t=>e({},t,{sent_at:i}))):e({},t,{sent_at:i})}(n.data))),n.url=Pa(n.url,n.method,n.compression,n.timestampMode);var v=Ta.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===d)return t[e]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){ka(t)?Zr.warn(t):Zr.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===ko&&Ft&&"undefined"!=typeof Promise&&!ga?xa(n).then((t=>{f(t)})).catch((i=>{if(Ye(i))return ga=!0,void f(e({},n,{compression:void 0,url:Pa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return Ye(t)||i===Ge})(i)&&(ga=!0),f(n)})):c(n)})(e({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Vl(t){this.Gl?this.Gl.retriableRequest(t):this._send_request(t)}_execute_array(t){vl++;try{var i,e=[],r=[],s=[];is(t,(t=>{if(t)if(oi(i=t[0]))s.push(t);else if(ai(t))try{t.call(this)}catch(i){Zr.error("Error executing queued PostHog call",t,i)}else oi(t)&&"alias"===i?e.push(t):oi(t)&&-1!==i.indexOf("capture")&&ai(this[i])?s.push(t):r.push(t)}));var n=function(t,i){is(t,(function(t){try{if(oi(t[0])){var e=i;es(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){Zr.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{vl--}}push(t){if(vl>0&&oi(t)&&di(t[0])){var i=$l.prototype[t[0]];ai(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Wl){if(this.is_capturing())if(!ui(t)&&di(t)){this.Pl();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=i&&i.$current_url&&!di(null==i?void 0:i.$current_url)&&(Zr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=r&&r.uu||Zr.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&&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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=Be(null==r?void 0:r.uuid,ms),f={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},v,c)};t===mt&&this.config.__preview_capture_bot_pageviews&&h&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(D);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var g=null==r?void 0:r.$unset;g&&(f.$unset=g);var _,m,y,b=p?void 0:this.hu(null==r?void 0:r.$set_once,t!==wt,t===bt);if(b&&(f.$set_once=b),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>di(t)?t.slice(0,n):t,l=new Set,f=function t(i,e){if(i!==Object(i))return a?a(i):i;if(!l.has(i)){var r;if(l.add(i),oi(i))r=[],is(i,(i=>{r.push(t(i))}));else{var s={};es(i,((i,e)=>{l.has(i)||(s[e]=t(i,e))})),r=s}return r}}(o)),f.timestamp=v,ui(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),p&&(f.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Lt.forEach(r),i.forEach(r),e}(f.properties,ml)),t===Co||t===Fo){var w=null==i?void 0:i.$survey_id,x=null==i?void 0:i.$survey_iteration;il({id:w,current_iteration:x}),f.$set=e({},f.$set,{[(_={id:w,current_iteration:x},m=t===Fo?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else t===To&&(f.$set=e({},f.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var S=null==i?void 0:i.$product_tour_type;S&&(f.$set=e({},f.$set,{["$product_tour_last_seen_date/"+S]:(new Date).toISOString()}))}var k=e({},f.properties.$set,f.$set);if(hi(k)||this.setPersonPropertiesForFlags(k),!fi(this.config.before_send)){var E=this.Xn(f);if(!E)return;(f=E).uuid=Be(f.uuid,ms)}this.wl.emit("eventCaptured",f);var P=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T={method:"POST",url:P,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Vl(T):this.Wl.enqueue(T),f}Zr.critical("This capture call is ignored due to client rate limiting.")}}else Zr.error("No event name provided to posthog.capture")}else Zr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}getExtension(t){var i;return null==(i=this.nu)?void 0:i.getExtension(t)}tu(){var t;return null!==(t=this.nu)&&void 0!==t?t:this.nu=new ul(this)}Sl(t){this.$l.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.$l.indexOf(t);-1!==e&&this.$l.splice(e,1)}}}du(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Bl=null,this.persistence.get_property(X)===ct&&(null==(r=this.sessionPersistence)||r.clear(),this.Ll.clear(),this.vu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.du();var a=o?void 0:this.persistence.remove_event_timer(t),l=e({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ml()&&(l[ot]=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!di(l.distinct_id)&&!pi(l.distinct_id)||vi(l.distinct_id))&&Zr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i,e,r){var n,o,a,l;if(void 0===r&&(r=!1),!Rt)return{};var h,u=t?[...Xn,...i||[]]:[],d=function(t){for(var i=0;je.length>i;i++){var e=je[i],r=e[1],s=e[0].exec(t),n=s&&(ai(r)?r(s,t):r);if(n)return n}return["",""]}(Rt),v=d[0],c=d[1],f=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};ui(e)||(p.detectGoogleSearchApp=e);var g={},_=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,y=null==xt||null==(a=xt.screen)?void 0:a.width,b=null==xt||null==(l=xt.screen)?void 0:l.height,w=null==xt?void 0:xt.devicePixelRatio;ui(_)||(g.userAgentDataPlatform=_),ui(m)||(g.maxTouchPoints=m),ui(y)||(g.screenWidth=y),ui(b)||(g.screenHeight=b),ui(w)||(g.devicePixelRatio=w);var x,S,k,E,P,T,C,F,R=rs(as({$os:v,$os_version:c,$browser:Me(Rt,navigator.vendor,f,p),$device:Le(Rt),$device_type:(S=Rt,k=g,F=Le(S),F===Di||F===Oi||"Kobo"===F||"Kindle Fire"===F||F===ve?Mi:F===ie||F===re||F===ee||F===he?"Console":F===Li?"Wearable":F?Ri:"Android"===(null==k?void 0:k.userAgentDataPlatform)&&(null!==(E=null==k?void 0:k.maxTouchPoints)&&void 0!==E?E:0)>0?600>Math.min(null!==(P=null==k?void 0:k.screenWidth)&&void 0!==P?P:0,null!==(T=null==k?void 0:k.screenHeight)&&void 0!==T?T:0)/(null!==(C=null==k?void 0:k.devicePixelRatio)&&void 0!==C?C:1)?Ri:Mi:"Desktop"),$timezone:uo(),$timezone_offset:vo()}),{$current_url:Gn(r?Ue(null==$t?void 0:$t.href):null==$t?void 0:$t.href,u,to),$host:null==$t?void 0:$t.host,$pathname:null==$t?void 0:$t.pathname,$raw_user_agent:Rt.length>1e3?Rt.substring(0,997)+"...":Rt,$browser_version:De(Rt,navigator.vendor,f,p),$browser_language:no(),$browser_language_prefix:(x=no(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==xt?void 0:xt.screen.height,$screen_width:null==xt?void 0:xt.screen.width,$viewport_height:null==xt?void 0:xt.innerHeight,$viewport_width:null==xt?void 0:xt.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&&(R.$sdk_dist_channel=s.SDK_DIST_CHANNEL),R}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&rs(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&rs(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Gl)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Ja&&(l.$lib_custom_api_host=this.config.api_host),u=t!==mt||o?t!==yt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=rs(l,u),t===mt&&Et&&(l.title=Et.title),!ui(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Rt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties();es(["$referrer","$referring_domain"],(t=>{t in g&&delete _[t]}));var m={};if(this.$l.length>0)for(var y of this.$l.slice())try{rs(m,y())}catch(t){Zr.error("Failed to produce browser extension event properties",t)}(l=rs({},d,g,_,e({},m,l))).$is_identified=this._isIdentified(),oi(this.config.property_denylist)?es(this.config.property_denylist,(function(t){delete l[t]})):Zr.error(_l+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Zr.error(gl),l=b(l,t));var w=this.cu();return l.$process_person_profile=w,w&&!o&&this.fu("_calculate_event_properties"),l}hu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.cu())return t;if(this.Ol&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=rs({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Zr.error(gl),o=a(o,"$set_once")),i&&(this.Ol=!0),hi(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.du(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.Ll.add(t))),this.vu()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.Ll.delete(t),this.vu()}pu(t,i){this.register({[t]:i})}Zl(){this.Ll.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.Ll.clear(),this.vu()}vu(){var t;if(this.Dl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.xa||!Ns.ri())Ns.ai(this.Dl);else{var i=[];this.Ll.forEach((t=>i.push(t))),i.length>0?Ns.ii(this.Dl,i):Ns.ai(this.Dl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.wl.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:pl}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:pl})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:pl})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=rl),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:pl}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:pl})}gu(t){return!t||vi(t)?(Zr.critical("Unique user id has not been set in posthog.identify"),!1):t===nt?(Zr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Zr.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Zr.uninitializedWarning("posthog.identify");if(pi(t)&&(t=t.toString(),Zr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.gu(t)&&this.fu("posthog.identify")){this.Pl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.du(!1),o=this.persistence.za(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property(h)&&(this.unregister(h),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(X)||ct)===ct,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(X,ft),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture(bt,{distinct_id:t,$anon_distinct_id:u},{$set:i||{},$set_once:e||{}}),this.Bl=Ga(t,i,e),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(X,ft);var p=i||{},g=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture("$set",{$set:p,$set_once:g}),this.Bl=Ga(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(J)):f&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ga(l)}}}setPersonProperties(t,i){if((t||i)&&this.fu("posthog.setPersonProperties")){var e=Ga(this.get_distinct_id(),t,i);this.Bl!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Bl=e):Zr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(oi(t)?t:[t]).filter((t=>di(t)&&t.length>0));0!==e.length&&this.fu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Bl=null)}group(t,i,r){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.du();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:e({},n,{[t]:i})}),o||r){var a={$group_type:t,$group_key:i};r&&(a.$group_set=r),this.capture(wt,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else Zr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.fu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=_i(t)?t:null==t?void 0:t.resetDeviceID,e=_i(t)||null==t?void 0:t.bootstrap;this.mu(i,!1,e)}mu(t,i,r){var s,n,o;if(void 0===i&&(i=!1),Zr.info("reset"),!this.__loaded)return Zr.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.zl)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ho());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(w),c=this.is_capturing();this.consent.reset(),i||!c||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 f=null==(o=this.persistence)||null==o.za?void 0:o.za(),p=!1;try{var g,_,m,y,b,x,S,k,E,P,T,C,F;if(null==(g=this.persistence)||g.clear(),null==(_=this.sessionPersistence)||_.clear(),this.Ll.clear(),this.vu(),ui(v)||null==(P=this.persistence)||P.register({[w]:v}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(b=this.conversations)||b.reset(),null==(x=this.logs)||x.reset(),null==(S=this.metrics)||S.reset(),null==(k=this.persistence)||k.set_property(X,ct),null==(E=this.sessionManager)||E.resetSessionId(),this.Bl=null,this.config.cookieless_mode===vt)this.register_once({distinct_id:nt,$device_id:null},"");else{var R=this.config.get_device_id(ms());this.register_once({distinct_id:R,$device_id:t?R:u},""),t||ui(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Ml()||(null==(F=this.persistence)||F.set_property(X,r.isIdentifiedID?ft:ct),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(ui(h)||null!=(C=this.sessionManager)&&C.setBootstrapSessionId(h,!0))){var I=e({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var A;f&&(null==(A=this.persistence)||null==A.Ga||A.Ga(p))}this.reloadFeatureFlags()}shutdown(t){var e=this;return i((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.tu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Wl)||s.unload(),null==(n=e.Gl)||n.unload();try{var l;null==(l=e.featureFlags)||l.destroy()}catch(t){Zr.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else Zr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.yu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.bu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(n)?(Zr.critical("Attempting to create alias for existing People user - aborting."),-2):this.fu("posthog.alias")?(ui(i)&&(i=this.get_distinct_id()),t!==i?(this.pu(h,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Zr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(li(t)){var r,n,o,a,l,h,u,d,v,c,f,p;rs(this.config,kl(t));var g=this.Al();null==(r=this.persistence)||r.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xo(e({},this.config,{persistence:"sessionStorage"}),g,!1);var _,m=this.Hl(this.config.debug);_i(m)&&(this.config.debug=m),_i(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Es.ri()&&Es.ii("ph_debug",!0),Zr.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(s.DEBUG=!1,Es.ri()&&Es.ai("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ho()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(_=this.historyAutocapture)||_.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.Fl(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){s.LIB_NAME=t,s.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(e({},s,i))}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:$l._u}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:yl;return i!==yl&&(i=yl+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(X))===ft||(null==(i=this.sessionPersistence)?void 0:i.get_property(X))===ft}cu(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===pt&&!this._isIdentified()&&hi(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(i=this.persistence)||null==(i=i.props)||!i[st]))}lu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.cu()||this.fu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fu(t){return"never"===this.config.person_profiles?(Zr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.El(),this.pu(st,!0),!0)}Al(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==dt)}Fl(){var t,i,e,r,s,n=this.Al();return this.is_capturing()||null==(e=this.logs)||e.wu(),(null==(t=this.persistence)?void 0:t.xa)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(i=this.sessionPersistence)?void 0:i.xa)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Ll.clear(),this.vu()),n}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==vt){if(this.Ml()){var e,r,s,n,o,a;null==(e=this.sessionRecording)||e.dispose({discardBufferedEvents:!0}),this.mu(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Na(this),this.pageViewManager=new Nn(this),this.persistence&&(this.sessionPropsManager=new Oa(this,this.sessionManager,this.persistence));var l,h=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=$l.__defaultExtensionClasses)?void 0:a.sessionRecording;h&&(this.sessionRecording=this.Tl(this.sessionRecording,new h(this)),this._l&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this._l)))}var u,d;this.consent.optInOut(!0),this.Fl(),this.su(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==dt&&(null==(u=this.surveys)||u.loadIfEnabled()),(ui(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.au()}else Zr.warn(fl)}opt_out_capturing(){if(this.config.cookieless_mode!==vt){var t,i,e=this.config.cookieless_mode===dt?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===dt&&this.consent.isOptedIn()&&this.mu(!0,!0),this.consent.optInOut(!1),this.Fl(),this.config.cookieless_mode===dt&&(this.register({distinct_id:nt,$device_id:null}),this.Cl(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.au(),this.su())}else Zr.warn(fl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===vt||(this.config.cookieless_mode===dt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fl()}_is_bot(){return kt?Ba(kt,this.config.custom_blocked_useragents):void 0}au(){Et&&("visible"===Et.visibilityState?this.Nl||(this.Nl=!0,this.capture(mt,{title:Et.title},{send_instantly:!0}),this.ql&&(Et.removeEventListener(gt,this.ql),this.ql=null)):this.ql||(this.ql=this.au.bind(this),us(Et,gt,this.ql)))}debug(t){!1===t?(null==xt||xt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==xt||xt.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}))}ho(){var t=this.zl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Zr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,i,e,r,s){var n=i in t&&!fi(t[i]),o=e in t&&!fi(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Zr)}Xn(t){var i;if(fi(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(bi),r=oi(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),fi(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return yi(t.event)?Zr.warn(o+". This can cause unexpected behavior."):Zr.info(o),null}s.properties&&!hi(s.properties)||Zr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Zr.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&fi(s.properties[a]))return Zr.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.ta)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Hl(t){var i=_i(t)&&!t,e=Es.ri()&&"true"===Es.ni("ph_debug");return!i&&(!!e||t)}}$l.__defaultExtensionClasses={},$l._u=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=os(t.prototype[i[e]])}($l,["identify"]);class Pl{constructor(t){this.disabled=!1===t;var i=li(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Tl="$copy_autocapture",Cl=ts("[AutoCapture]");function Fl(t,i){return i.length>t?i.slice(0,t)+"...":i}function Rl(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Gs(i));return i}function Il(t,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!Gs(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!Js(c,"body")&&Qs>d.length;)if(Ys(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Gs(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,g,_=[],m={},y=!1,b=!1;if(es(d,(t=>{var i=_n(t);if(Js(t,"a")){var e=t.getAttribute("href");y=!!(i&&e&&$n(e))&&(u?Ue(e):e)}Zt(tn(t),"ph-no-capture")&&(b=!0),_.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};nn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Fl(1024,Pn(t)):Fl(1024,rn(t)));var a=tn(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),es(t.attributes,(function(e){var n;if((!mn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&$n(e.value)&&(!di(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=Xs(a).join(" ")),o["attr__"+e.name]=Fl(1024,"href"===e.name&&s?Ue(a):a)}}));for(var l=1,h=1,u=t;u=Rl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!_n(t))return{};var i={};return es(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&$n(r)&&(i[e]=r)}})),i}(t);es(r,((t,i)=>{({}).hasOwnProperty.call(m,i)||(m[i]=t)}))})),b)return{props:{},explicitNoCapture:b};if(a||(_[0].$el_text=Js(t,"a")||Js(t,"button")?Pn(t):rn(t)),y){var w,x;_[0].attr__href=y;var S=null==(w=Vn(y))?void 0:w.host,k=null==xt||null==(x=xt.location)?void 0:x.host;S&&k&&S!==k&&(p=y)}return{props:rs({$event_type:n.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(g=_,oi(g)?function(t){return t.map((t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return ss(o).sort(((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r})).forEach((t=>{var i=t[1];return a[Cn(t[0].toString())]=Cn(i.toString())})),(s+=":")+ss(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Fn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return ss(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(g)):"")},null!=(r=_[0])&&r.$el_text?{$el_text:null==(s=_[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}class Al{constructor(t){this.name="autocapture",this.Is=!1,this.Rs=null,this.Ps=!1,this.As=!1,this.gn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Fs=!1,this.Os=t,this.Os.refresh(this.gn),this.rageclicks=new Pl(this.gn.rageclick),this.Ls=null}setup(t){this.Ds(),this.$s=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Fs?i.dispose():(this.Ns=i,this.startIfEnabled())}dispose(){var t;this.Fs||(this.Fs=!0,this.$s=void 0,null==(t=this.Ns)||t.dispose(),this.Ns=void 0,this.qs())}js(){return this.Os.refresh(this.gn),this.gn}Ds(){var t,i;return this.js(),this.gn.url_allowlist=null==(t=this.gn.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.gn.url_ignorelist=null==(i=this.gn.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.gn}Bs(){if(this.isBrowserSupported()){if(xt&&Et){var t=this.Hs=t=>{t=t||(null==xt?void 0:xt.event);try{this.zs(t)}catch(t){Cl.error("Failed to capture event",t)}};if(us(Et,"submit",t,{capture:!0}),us(Et,"change",t,{capture:!0}),us(Et,"click",t,{capture:!0}),this.js().capture_copied_text){var i=this.Us=t=>{t=t||(null==xt?void 0:xt.event);try{this.zs(t,Tl)}catch(t){Cl.error("Failed to capture clipboard event",t)}};us(Et,"copy",i,{capture:!0}),us(Et,"cut",i,{capture:!0}),us(Et,"paste",i,{capture:!0})}}}else Cl.info("Disabling Automatic Event Collection because this browser is not supported")}qs(){this.Hs&&(null==Et||Et.removeEventListener("submit",this.Hs,!0),null==Et||Et.removeEventListener("change",this.Hs,!0),null==Et||Et.removeEventListener("click",this.Hs,!0),this.Hs=void 0),this.Us&&(null==Et||Et.removeEventListener("copy",this.Us,!0),null==Et||Et.removeEventListener("cut",this.Us,!0),null==Et||Et.removeEventListener("paste",this.Us,!0),this.Us=void 0),this.Is=!1}startIfEnabled(){!this.Fs&&this.$s&&this.isEnabled&&!this.Is&&(this.Bs(),this.Is=!0)}onRemoteConfig(t){if(!this.Fs)if(this.Ps=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.As=i.elementsChainAsString);var e,r=i.autocapture_opt_out;_i(r)&&(null==(e=this.$s)||e.kv.set(d,r),this.Rs=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ls=t}getElementSelectors(t){var i,e=[];return null==(i=this.Ls)||i.forEach((i=>{var r=null==Et?void 0:Et.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Fs)return!1;var e=null==(t=this.$s)?void 0:t.kv.get(d),r=this.Rs,s=this.js(),n=s.remoteRequestsDisabled&&!this.Ps;if(ci(r)&&!_i(e)&&!n)return!1;var o=null!==(i=this.Rs)&&void 0!==i?i:!!e;return!!s.enabled&&!o}zs(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=sn(t);Ks(r)&&(r=r.parentNode||null);var s,n=this.Ds();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&fn(r,n.rageclick)&&this.zs(t,"$rageclick");var o=i===Tl,a=o?e({},n,{dom_event_allowlist:void 0}):n;if(r&&function(t,i,e,r,s,n){var o;if(!xt||pn(t))return!1;if(null!=e&&e.url_allowlist&&!Zs(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&Zs(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var a=e.dom_event_allowlist;if(a&&!a.some((t=>i.type===t)))return!1}var l=gn(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(ui(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(u,e))return!1;if(!on(u,null==e?void 0:e.css_selector_allowlist))return!1;if(on(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:ln))return!1;try{var d=xt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return h?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(nn.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=Il(r,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.As,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=h.props;if(h.explicitNoCapture)return!1;var d=this.getElementSelectors(r);if(d&&d.length>0&&(u.$element_selectors=d),i===Tl){var v=t.type||"clipboard";if("paste"!==v){var c,f,p=null==xt||null==(c=xt.getSelection())?void 0:c.toString(),g=en(p);if(!g)return!1;u.$selected_content=g,u.$clipboard_text_length=null!==(f=null==p?void 0:p.length)&&void 0!==f?f:0}u.$copy_type=v}return null==(l=this.$s)||l.capture(i,u).catch((t=>Cl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return ai(null==Et?void 0:Et.querySelectorAll)}}class Ml{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=li(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.ho(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var Ol=ts("[ExceptionAutocapture]"),Dl=()=>{},jl=t=>{var i;if(ai(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Ll(t,i,e){try{if(!(i in t))return Dl;var r={next:t[i]},s=e((function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)}));return ai(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=jl(e);n;){if(n.next===s)return void(n.next=r.next);n=jl(e=n.next)}else t[i]=r.next}}catch(t){return Dl}}var Nl=ts("[TracingHeaders]"),Bl=ts("[Web Vitals]"),zl=9e5,Ul=["CLS","FCP","INP","LCP"],Hl=["INP","LCP"],ql=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Vl="disabled",Wl="lazy_loading",Gl="awaiting_config",Jl="missing_config";ts("[SessionRecording]"),ts("[SessionRecording]");var Kl="[SessionRecording]",Yl=ts(Kl),Ql=ts("[Heatmaps]");function Xl(t){return li(t)&&"clientX"in t&&"clientY"in t&&pi(t.clientX)&&pi(t.clientY)}var Zl=ts("[Product Tours]"),th=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(m))},ih=["$set_once","$set"],eh=ts("[SiteApps]"),rh="Error while initializing PostHog app with config id ",sh=(t,i)=>null!=t&&t.then?t.then(i):i(t),nh="SDK is not enabled or survey functionality is not yet loaded",oh="Disabled. Not loading surveys.";class ah{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.ku=!1,this.Su=[],this.xu=null,this.Cu=null,this.Fs=!1,this.Tu=new Set,this.onRemoteConfig=t=>{if(!this.Fs&&!this.gn.disableSurveys){if(!t.ok)return Za.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(fi(i))return Za.warn("Flags not loaded yet. Not loading surveys.");this.Mu=_i(i)?i:i.length>0,Za.info("flags response received, isSurveysEnabled: "+this.Mu),this.loadIfEnabled()}},this.Os=t,this.Eu=i}setup(t){if(!this.Fs)return this.Iu=t,sh(t.kv.initialize(),(()=>{if(this.Iu===t&&!this.Fs){this.Iu=void 0,this.$s=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Fs?i.dispose():(this.Ns=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Fs||(this.Fs=!0,this.Iu=void 0,this.$s=void 0,null==(t=this.Ns)||t.dispose(),this.Ns=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Su=[],this.xu=null,this.Tu.forEach((t=>clearTimeout(t))),this.Tu.clear())}get gn(){return this.Os.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(tl)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Fs&&this.$s){var t=this.gn;if(!this._surveyManager)if(this.ku)Za.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Za.info(oh);else if(t.cookielessMode&&this.Os.isOptedOut())Za.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Os.getExtensions();if(i){if(!ui(this.Mu)||t.advancedEnableSurveys){var e=this.Mu||t.advancedEnableSurveys;this.ku=!0;try{var r=i.generateSurveys;if(r)return this.Ru(r,e),void(this.ku=!1);var s=i.loadExternalDependency;if(!s)return this.Pu(ut),void(this.ku=!1);s((t=>{try{if(this.Fs)return;var i=this.Os.getExtensions();t||null==i||!i.generateSurveys?this.Pu("Could not load surveys script",t):this.Ru(i.generateSurveys,e)}finally{this.ku=!1}}))}catch(t){throw this.ku=!1,this.Pu("Error initializing surveys",t),t}}}else Za.error("PostHog Extensions not found.")}}}Ru(t,i){this.Fs||(this._surveyManager=t(i),this._surveyEventReceiver=this.Os.createEventReceiver(),Za.info("Surveys loaded successfully"),this.Au({isLoaded:!0}))}Pu(t,i){Za.error(t,i),this.Au({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Su.push(t),this._surveyManager&&this.Au({isLoaded:!0}),()=>{this.Su=this.Su.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.$s)&&void 0!==e?e:this.Eu;if(r&&!this.Fs){if(this.gn.disableSurveys)return Za.info(oh),t([]);var s=r.kv.get(U);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Fu()&&this.getSurveys((()=>{}),!0));if(this.xu)this.xu.then((i=>{this.Fs||t(i.surveys,i.context)})).catch((t=>Za.error("Error in survey callback",t)));else{var n=this.Ou("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.gn.requestTimeoutMs}).then((t=>{try{return this.Lu(r,t)}catch(t){return Za.error("Error processing surveys response",t),this.Lu(r,{statusCode:0,error:t})}}),(t=>this.Lu(r,{statusCode:0,error:t})));this.xu=n;var o=()=>{this.xu===n&&(this.xu=null)};n.then((i=>{o(),this.Fs||t(i.surveys,i.context)}),o).catch((t=>Za.error("Error in survey callback",t)))}}}Ou(t,i){var e=this.$s;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(nh)})))}Lu(t,i){if(this.Fs)return{surveys:[],context:{isLoaded:!1,error:nh}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?Za.error(r):i.error||Za.warn(r),this.Cu=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Cu=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ua(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[U]:n,[H]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Fu(){return this.Du()&&!this.xu&&!this.$u()}Du(){var t,i,e=null==(t=null!==(i=this.$s)&&void 0!==i?i:this.Eu)?void 0:t.kv.get(H);return pi(e)&&Date.now()-e>3e5}$u(){return pi(this.Cu)&&3e5>Date.now()-this.Cu}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};il(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Au(t){for(var i of this.Su)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Za.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!fi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Za.warn("init was not called")}Nu(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}qu(t){if(fi(this._surveyManager))return{eligible:!1,reason:nh};var i="string"==typeof t?this.Nu(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}ju(t){if(fi(this._surveyManager))return{eligible:!1,reason:nh};var i="string"==typeof t?this.Nu(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(fi(this._surveyManager))return Za.warn("init was not called"),{visible:!1,disabledReason:nh};var i=this.ju(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return fi(this._surveyManager)?(Za.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:nh})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.ju(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(fi(this._surveyManager))Za.warn("init was not called");else{var s="string"==typeof t?this.Nu(t):t;if(null!=s&&s.id)if(el.includes(s.type)){var n=null==Et?void 0:Et.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){Za.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,i;this.Tu.delete(o),this.Fs||(Za.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Za.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Tu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else Za.warn("Survey element not found")}else Za.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Za.warn("Survey not found")}}displaySurvey(t,i){var r;if(fi(this._surveyManager))Za.warn("init was not called");else{var s=this.Nu(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Ro&&i.initialResponses&&Za.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.qu(s);if(!o.eligible)return void Za.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else Za.warn("Survey not found")}}cancelPendingSurvey(t){fi(this._surveyManager)?Za.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function lh(t,i,e){if(fi(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class hh{constructor(t){this.Bu=new Set,this.Hu=new Set,this.zu=new Da,this.Uu=(t,i)=>this.Wu(t,i)&&this.Vu(t,i)&&this.Gu(t,i)&&this.Zu(t,i),this.Wu=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;ui(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Qu=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.Qu)||t.call(this),this.Qu=void 0,this.zu=new Da}register(t){var i,e;if(!ui(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Bu.add(t),null==(i=t.steps)||i.forEach((t=>{this.Hu.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Bu.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Bu.clear(),this.Hu.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Hu.has(t)||this.Hu.has(i.event))&&this.Bu.forEach((t=>{this.Ju(i,t)&&this.zu.emit("actionCaptured",t.name)}))}Ku(t){this.onAction("actionCaptured",(i=>t(i)))}Ju(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Uu(t,e))return!0;return!1}onAction(t,i){return this.zu.on(t,i)}Vu(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!lh(r,i.url,i.url_matching||"contains"))return!1}return!0}Gu(t,i){return!!this.Yu(t,i)&&!!this.Xu(t,i)&&!!this.th(t,i)}Yu(t,i){var e;if(null==i||!i.href)return!0;var r=this.eh(t);if(r.length>0)return r.some((t=>lh(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&lh((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Xu(t,i){var e;if(null==i||!i.text)return!0;var r=this.eh(t);if(r.length>0)return r.some((t=>lh(t.text,i.text,i.text_matching||"exact")||lh(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!fi(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>lh(t,n,o))))}th(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}eh(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Zu(t,i){return null==i||!i.properties||0===i.properties.length||Wa(i.properties.reduce(((t,i)=>{var e=oi(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class uh{constructor(t){var i;this.ih=[],this._instance=t,this.rh=new Map,this.nh=new Map,this.sh=new Map,this.ah=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.oh(t)))}lh(t){return!1}uh(){return null}hh(t){}dh(){}fh(t,i){return!!t&&Wa(t.propertyFilters,null==i?void 0:i.properties)}ph(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}gh(t,i,e){var r=(e===$o?this.rh:this.nh).get(t),s=[];return this.mh((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.fh(n,i)}))}register(t){this.yh(t,!1)}replace(t){this.yh(t,!0)}yh(t,i){var e;ui(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.bh(t,i),this._h(t,i))}_h(t,i){var e=t.filter((t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}));if(i&&this.sh.clear(),0!==e.length){this.wh||(this.wh=new hh(this._instance),this.wh.init(),this.wh.Ku((t=>this.onAction(t))));var r=[];e.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach((i=>{if(r.push(i),i.name){var e,s=null!==(e=this.sh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.sh.set(i.name,s)}}))})),i?this.wh.replace(r):this.wh.register(r)}else{var s;i&&(null==(s=this.wh)||s.replace([]))}}kh(t,i){i.forEach(((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach((t=>{s.includes(t)||s.push(t)})),t.set(e,s)}))}bh(t,i){var e,r,s=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),n=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0})),o=this.ph(t,$o),a=this.ph(t,Po);i?(this.rh=o,this.nh=a):(this.kh(this.rh,o),this.kh(this.nh,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Qu)&&void 0!==e||(this.Qu=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Sh(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.xh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Ch([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Th(n),void this.Mh([n])}if(this.nh.has(t)){var a=this.gh(t,i,Po);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Ch(a.map((t=>t.id))),a.forEach((t=>this.Eh(t.id))))}if(this.rh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.rh.get(t)});var l=this.gh(t,i,$o);this.Ih(l.map((t=>t.id)))}}onAction(t){this.sh.has(t)&&this.Ih(this.sh.get(t)||[])}Ih(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.lh(s)?this.Th(s)&&this.Rh(s):r.push(s);r.length>0&&(this.ih=[...new Set([...this.ih,...r])]),this.Sh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Th(t){this.ih=this.ih.filter((i=>i!==t));var i=this.Ph();return!i.includes(t)&&(this.Ah([...i,t]),this.Fh(),!0)}Ch(t){var i=new Set(t);this.ih=this.ih.filter((t=>!i.has(t)));var e=this.Oh(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.Ah(r),0===r.length&&this.Lh()),this.Mh(t)}Dh(){var t,i=this.uh();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Rh(t){if(this.uh()){var i=this.Dh();this.hh(e({},i,{[t]:Date.now()}))}}Mh(t){if(this.uh()){var i=this.Dh(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(hi(e)?this.dh():this.hh(e))}}$h(){this.uh()&&this.dh()}getActivationTimestamp(t){if(this.Ph().includes(t)){var i=this.Dh()[t];return pi(i)?i:void 0}}Oh(){var t,i=this.Nh();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Ph(){var t,i,e=this.Oh();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.qh()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Fh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.jh(i)}Lh(){this.Bh()}oh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.qh()];if(e&&e!==t){var r=this.Oh(),s=this.Dh();r.length>0&&(this.Ah([]),r.filter((t=>pi(s[t]))).forEach((t=>this.Eh(t)))),this.Lh(),this.$h()}}getActivatedIds(){return[...new Set([...this.Ph(),...this.ih])].filter((t=>!this.Hh(t)))}dispose(){var t,i,e;null==(t=this.ah)||t.call(this),this.ah=void 0,null==(i=this.Qu)||i.call(this),this.Qu=void 0,null==(e=this.wh)||e.dispose(),this.wh=void 0}reset(){this.ih=[],this.Oh().length>0&&this.Ah([]),this.Lh(),this.$h()}getEventToItemsMap(){return this.rh}zh(){return this.wh}}class dh extends uh{constructor(t){super(t)}Nh(){return q}qh(){return V}uh(){return W}hh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[W]:t})}dh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(W)}lh(t){var i,e;this.mh((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return pi(r)&&r>0}Uh(){return To}mh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Eh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Sh(){return Za}Ah(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[q]:t})}jh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[V]:t})}Bh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}Hh(){return!1}xh(t,i){var e;this.mh((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Ua(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===To?"consume":"ignore":t===To?"persist":t===Co||t===Fo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class vh{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);ui(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class ch{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==Mt?void 0:Mt.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new dh(this._instance)}}var fh=null!=xt&&xt.location?Jn(xt.location.hash,"__posthog")||Jn(location.hash,"state"):null,ph="_postHogToolbarParams",gh=ts("[Toolbar]"),_h=ts("[FeatureFlags]");class mh{constructor(t,i){void 0===i&&(i=!1),this.Wh=!1,this.update(t,i)}update(t,i){this.Vh=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:oi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Wh||(_h.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Wh=!0),ui(t.flag_keys)||oi(t.flag_keys)||_h.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Vh}}var yh=ts("[FeatureFlags]"),bh=ts("[FeatureFlags]",{debugEnabled:!0}),wh="\" failed. Feature flags didn't load in time.",xh="connection_error",Sh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},kh=t=>{var i={};for(var e of ss(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Eh=ts("[Error tracking]"),$h="webkit-masked-url:",Ph=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",$h],Th=["__firefox__","__gCrWeb"],Ch="Refusing to render web experiment since the viewer is a likely bot",Fh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Ha(i,t),not_regex:(t,i)=>!Ha(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class Rh{get gn(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Rh.Gh("retrieved web experiments from the server"),i.Zh=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Zh&&(Rh.Gh("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Zh)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);di(r)&&t.variants[r]&&i.Qh(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Rh.Jh(n,i._instance)&&i.Qh(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Rh.Gh(Ch);else if(!this.gn.disable_web_experiments){if(fi(this.Zh))return this.Zh=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Rh.Gh("applying feature flags",t),t.forEach((t=>{var i;if(this.Zh&&null!=(i=this.Zh)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Zh)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Qh(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Rh.getWindowLocation();if(null!=t&&t.search){var i=Wn(null==t?void 0:t.search,"__experiment_id"),e=Wn(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Rh.Gh("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Kh(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.gn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.gn.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.gn.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Kh(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Rh.Gh("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Qh(r[0].name,i,r[0].variants[i].transforms))}static Jh(t,i){return!fi(t.conditions)&&Rh.Yh(t,i)&&Rh.Xh(t)}static Yh(t,i){var e;if(fi(t.conditions)||fi(null==(e=t.conditions)?void 0:e.url))return!0;var r=Rh.getWindowLocation();if(r){var s,n,o,a=zs(i,r.href);return null==(s=t.conditions)||!s.url||Fh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==xt?void 0:xt.location}static Xh(t){var i;if(fi(t.conditions)||fi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=eo();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Gh(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Zr.info("[WebExperiments] "+t,e)}Qh(t,i,e){this._is_bot()?Rh.Gh(Ch):"control"!==i?e.forEach((e=>{if(e.selector){var r;Rh.Gh("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Rh.Gh("Control variants leave the page unmodified.")}_is_bot(){return kt&&this._instance?Ba(kt,this.gn.custom_blocked_useragents):void 0}}var Ih=ts("[Conversations]"),Ah="Conversations not available yet.";function Mh(t,i){var e,r,s,n,o,a,l,h=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=i&&i.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=ui(d)?Math.max(u,2048):Math.max(u,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:u,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Oh=["debug","log","warn","error","info"],Dh="console",jh="__posthogHandledLogsRequestError",Lh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[jh]=!0,e},Nh=t=>!!t&&"object"==typeof t&&!0===t[jh],Bh={featureFlags:class{constructor(t){this.name="featureFlags",this.td=!1,this.featureFlagEventHandlers=[],this.A=yh,this.ed={},this.rd={},this.nd=[],this.sd=!1,this.ad=!1,this.od=0,this.ld=!1,this.ud=!1,this.hd=!1,this.dd=!1,this.vd=0,this.zt=()=>{var t=this.fd();this.vd=0,t&&this.reloadFeatureFlags()},this.pd=()=>{var t,i=this.gd;ui(i)||this.gn.remoteRequestsDisabled||!Et||"hidden"===Et.visibilityState||Date.now()-(null!==(t=this.md)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.yd())},this.Wt=()=>{"visible"===(null==Et?void 0:Et.visibilityState)&&this.pd()},"get"in t?this.Os=t:(this._instance=t,this.bd=new mh(t.config,t.ho()),this.Os=this.bd)}updateConfig(t,i){var e;null==(e=this.bd)||e.update(t,i),this.$s&&this._d()}setup(t){return this.Iu=t,this.A=t.logger.createLogger("[FeatureFlags]"),sh(t.kv.initialize(),(()=>{this.Iu===t&&(this.Iu=void 0,this.$s=t,this.wd(t))}))}wd(t){var i;if(this.$s===t)return xt&&us(xt,"online",this.zt),this._d(),this.kd=t.registerDynamicEventProperties((()=>this.Sd()?this.ed:this.rd)),this.xd=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange((()=>{this.Cd(),this.Td()})),this.Cd(),this.initialize()}_d(){var t=this.gn.refreshIntervalMs,i=!this.gn.remoteRequestsDisabled&&Et&&!ui(t)&&t>0?t:void 0;i!==this.gd&&(this.Md(),ui(i)||(this.gd=i,this.yd(),null!=Et&&Et.addEventListener&&us(Et,gt,this.Wt)))}yd(){ui(this.gd)||(ui(this.Ed)||clearInterval(this.Ed),this.md=Date.now(),this.Ed=setInterval(this.pd,this.gd))}Md(){ui(this.Ed)||(clearInterval(this.Ed),this.Ed=void 0,null==Et||null==Et.removeEventListener||Et.removeEventListener(gt,this.Wt)),this.gd=void 0,this.md=void 0}destroy(){this.Id()}dispose(){this.Id()}Id(){var t,i;this.Md(),this.od++,this.ud=!1,this.Iu=void 0,this.$s&&(this.Rd(),null==(t=this.kd)||t.dispose(),this.kd=void 0,null==(i=this.xd)||i.call(this),this.xd=void 0,this.nd=[],null==xt||xt.removeEventListener("online",this.zt),this.$s=void 0)}get gn(){return this.Os.get()}Pd(t){var i;return null==(i=this.$s)?void 0:i.kv.get(t)}ii(t){this.Ad((()=>{var i;return null==(i=this.$s)?void 0:i.kv.set(t)}))}Fd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t[F]){var s=this.Pd(F)||{},n=t[F]||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter((t=>{var i=t[1];return!(null!=i&&i.failed)})).map((t=>t[0])):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!oi(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Pd(M)||{},d=t[M]||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p={[R]:f,[F]:f,[M]:!!c||v};for(var g of(t[A]&&(p[A]=f),[O,Q,D]))ui(t[g])||(p[g]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(p)}}ai(t){this.Ad((()=>{var i;return null==(i=this.$s)?void 0:i.kv.remove(t)}))}Ad(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Cd(){var t={};for(var i of[R,M,O,j]){var r=this.Pd(i);ui(r)||(t[i]=r)}this.ed=t;var s=e({},t),n=this.Pd(F);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.rd=s}Sd(){var t=this.gn.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Pd(Q);return"number"!=typeof i||Date.now()-i>t}Od(){return!!this.Sd()&&(this.dd||this.ad||(this.dd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ld(){var t=this.gn.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Dd(){var t=this.gn.flagKeys;if(!ui(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.gn,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(t[i]=o[i],t)),{});return this.$d({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Pd(F))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Pd(M))&&void 0!==n?n:{},l=e({},o,t),h=e({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Dt(c),variant:jt(c),reason:void 0,metadata:ui(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.$d({flags:u})}get hasLoadedFlags(){return this.sd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Pd(A),i=this.Pd(j),r=this.Pd(L);if(!r&&!i)return t||{};var s=rs({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var o of n){var a,l,h=s[o],u=null==i?void 0:i[o],d=ui(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=ui(u)?null==h?void 0:h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=e({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=e({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.td||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.td=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:Dt(r),variant:jt(r),payload:Ot(i[e])}}))}getFlagVariants(){var t=this.Pd(F),i=this.Pd(j);if(!i)return t||{};for(var e=rs({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.td||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.td=!0),e}getFlagPayloads(){var t=this.Pd(M),i=this.Pd(L);if(!i)return t||{};for(var e=rs({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.td||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.td=!0),e}reloadFeatureFlags(){this.ld||this.gn.featureFlagsDisabled||this.fd()||this.Nd||(this.nd.slice().forEach((t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.Nd=setTimeout((()=>{this.qd()}),5))}Rd(){clearTimeout(this.Nd),this.Nd=void 0}onReloading(t){return this.nd.push(t),()=>{this.nd=this.nd.filter((i=>i!==t))}}ensureFlagsLoaded(){this.sd||this.ad||this.Nd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ld=t}resetFlagCallReported(){this.ai(J)}qd(t){this.Rd();var i=this.$s;if(i&&!this.gn.remoteRequestsDisabled&&!this.fd())if(this.ad)this.ud=!0;else{var r={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},i.initialPersonProperties,this.Pd(N)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Pd(B),timezone:uo()};ui(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.gn.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.Ld();s.length&&(r.evaluation_contexts=s);var n=this.Dd();ui(n)||(r.flag_keys=n);var o=this.gn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.od;this.ad=!0;var h=()=>{this.ud&&(this.ud=!1,this.qd())},u=t=>{this.ad=!1,l===this.od?(this.ii({[Y]:[xh]}),this.A.error("Feature flag request failed",t),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.gn.compression,sentAt:"body",timeoutMs:this.gn.requestTimeoutMs}).then((t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.ad=!1,l===this.od){if(this.jd(t.statusCode),n||this.ud||(this.$anon_distinct_id=void 0),!r.disable_flags||this.ud){this.hd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?xh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(e=s.quotaLimited)||!e.includes("feature_flags"));u&&a.push("quota_limited"),this.ii({[Y]:a}),u?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.$d(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}fd(){return Kn(this.vd,3)}jd(t){this.vd=Yn(t,this.vd,3,(()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.hd)if(this.sd||this.getFlags()&&this.getFlags().length>0){if(!this.Od()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+wh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.hd)if(this.sd||this.getFlags()&&this.getFlags().length>0){if(!this.Od()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Pd(O)||void 0,u=this.Pd(Q)||void 0,d=this.Pd(J)||{};if(this.gn.deduplicateCallsPerSession){var v,c=null==(v=this.$s)?void 0:v.session.sessionId,f=this.Pd(K);c&&c!==f&&(d={},r=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))r&&this.ii({[J]:d,[K]:r});else{var p,g,_,m,y,b,w,x,S,k,E,P;oi(d[t])?d[t].push(l):d[t]=[l],this.ii(e({[J]:d},r?{[K]:r}:{}));var T=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Pd(Y))&&void 0!==p?p:[]];ui(o)&&C.push("flag_missing");var F={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(g=null==(_=this.gn.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.gn.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.hd};ui(null==T||null==(b=T.metadata)?void 0:b.has_experiment)||(F.$feature_flag_has_experiment=T.metadata.has_experiment),ui(null==T||null==(w=T.metadata)?void 0:w.version)||(F.$feature_flag_version=T.metadata.version);var R,I=null!==(x=null==T||null==(S=T.reason)?void 0:S.description)&&void 0!==x?x:null==T||null==(k=T.reason)?void 0:k.code;I&&(F.$feature_flag_reason=I),null!=T&&null!=(E=T.metadata)&&E.id&&(F.$feature_flag_id=T.metadata.id),ui(null==T?void 0:T.original_variant)&&ui(null==T?void 0:T.original_enabled)||(F.$feature_flag_original_response=ui(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(P=T.metadata)&&P.original_payload&&(F.$feature_flag_original_payload=null==T||null==(R=T.metadata)?void 0:R.original_payload),C.length&&(F.$feature_flag_error=C.join(",")),this.Bd(F)}else r&&this.ii({[J]:d,[K]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Ot(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+wh)}Bd(t){try{var i;null==(i=this.$s)||i.capture("$feature_flag_called",t).catch((t=>{this.A.error("Failed to capture feature flag call",t)}))}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Hd(t,i)}Hd(t,e){var r=this;return i((function*(){var i=r.$s;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.Ld();n.length&&(s.evaluation_contexts=n);var o,a=r.Dd();ui(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.gn.compression,sentAt:"body",timeoutMs:r.gn.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.A.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){r.A.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.hd)return i.defaultValue;if(!(this.sd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+wh),i.defaultValue;var e=this.getFeatureFlag(t,i);return ui(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i,e){this.$d(t,i,e)}$d(t,i,r){if(this.$s){this.sd=!0;var s=function(t,i,r,s,n,o){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=yh);var a=((t,i)=>{var r=t.flags;return r?e({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var i;return[t,null!==(i=r[t].variant)&&void 0!==i?i:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var i;return!ui(null==(i=r[t].metadata)?void 0:i.payload)})).map((t=>{var i;return[t,null==(i=r[t].metadata)?void 0:i.payload]})))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(oi(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[R]:h,[F]:c,[D]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),y=g||{};p=e({},i,p),g=e({},r,y),m.forEach((t=>{var i;t in y||null==(i=g)||delete i[t]})),_=e({},s,_)}else if(t.errorsWhileComputingFlags)if(l){var b=new Set(Object.keys(l).filter((t=>{var i;return!(null!=(i=l[t])&&i.failed)})));p=e({},i,Object.fromEntries(Object.entries(p).filter((t=>b.has(t[0])))));var w=Object.fromEntries(Object.entries(g||{}).filter((t=>b.has(t[0]))));g=e({},r,w),b.forEach((t=>{var i;t in w||null==(i=g)||delete i[t]})),_=e({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>b.has(t[0])))))}else p=e({},i,p),g=e({},r,g),_=e({},s,_);return e({[R]:Object.keys(kh(p)),[F]:p||{},[M]:g||{},[A]:_||{},[D]:!0===t.minimalFlagCalledEvents},d?{[O]:d}:{},v?{[Q]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.A);s&&(this.Fd(s,t,!(null==r||!r.partialResponse)),this.ii(s)),i||(this.dd=!1),this.Td(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.zd(t)}zd(t){if(this.$s){if(!1===t)return this.ai([j,L]),this.Td(),void bh.info("All overrides cleared");if(oi(t))return this.ii({[j]:Sh(t)}),this.Td(),void bh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.td=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[j]=oi(s)?Sh(s):s),n&&(r[L]=n),Object.keys(r).length&&this.ii(r),!1===s&&!1===n?this.ai([j,L]):!1===s?this.ai(j):!1===n&&this.ai(L),this.Td(),!1===s?bh.info("Flag overrides cleared"):s&&bh.info("Flag overrides set",{flags:s}),void(!1===n?bh.info("Payload overrides cleared"):n&&bh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ii({[j]:t}),this.Td(),void bh.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.sd){var i=this.Ud(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.Pd(I)||[]).find((i=>i.flagKey===t)),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[R]:[t],[F]:[t],[N]:Object.keys(o)}),this.ii({[R]:Object.keys(kh(l)),[F]:l,[N]:e({},this.Pd(N)||{},o)}),this.Td();try{var h;null==(h=this.$s)||h.capture("$feature_enrollment_update",a).catch((t=>{this.A.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Pd(I);!r||i?this.Wd(t,e):t(r)}Wd(t,e){var r=this;return i((function*(){var i=r.$s;if(i){var s,n=e?"&"+e.map((t=>"stage="+t)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.ii({[I]:s=o.json.earlyAccessFeatures})}catch(t){return void r.A.error("Early access feature request failed",t)}try{t(s)}catch(t){r.A.error("Early access feature callback failed",t)}}}))()}Ud(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Td(t){this.Cd();var i=this.Ud(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Vd(t,i)}Vd(t,i){void 0===i&&(i=!0);var r=this.Pd(N)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this.ii({[N]:e({},r,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.Pd(N)||{});t.forEach((t=>{delete r[t]})),this.ii({[N]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.ai(N),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Pd(B)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.ii({[B]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Pd(B)||{};this.ii({[B]:e({},i,{[t]:{}})})}else this.ai(B)}reset(){this.od++,this.ud=!1,this.ed={},this.rd={},this.sd=!1,this.ld=!1,this.hd=!1,this.$anon_distinct_id=void 0,this.Rd(),this.td=!1,this.vd=0}}},zh={sessionRecording:class{get gn(){return this._instance.config}get $o(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Gd)||!t.isStarted)}get status(){var t,i;return this.Zd===Gl||this.Zd===Jl?this.Zd:null!==(t=null==(i=this.Gd)?void 0:i.status)&&void 0!==t?t:this.Zd}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Zd=Vl,this.Qd=void 0,this.Jd=!1,this.qt=(()=>{var t;if(null==Et||!Et.visibilityState||"visible"===Et.visibilityState)return!0;var i=null==xt||null==(t=xt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.Wt=()=>{var t;"visible"===(null==Et?void 0:Et.visibilityState)&&(this.qt=!0,null==(t=this.Gd)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Yl.error("started without valid sessionManager"),new Error(Kl+" started without valid sessionManager. This is a bug.");if(this.gn.cookieless_mode===vt)throw new Error(Kl+' cannot be used with cookieless_mode="always"');null!=Et&&Et.addEventListener&&us(Et,"visibilitychange",this.Wt)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.Jd=!0,null==Et||null==Et.removeEventListener||Et.removeEventListener("visibilitychange",this.Wt),e?this.Kd(!0):this.stopRecording()}get Yd(){var t,i=!(null==(t=this._instance.get_property(w))||!t.enabled),e=!this.gn.disable_session_recording,r=this.gn.disable_session_recording||this._instance.consent.isOptedOut();return xt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.Jd||this.Yd&&null!=(i=this.Gd)&&i.isStarted)){var e=!ui(Object.assign)&&!ui(Array.from);this.Yd&&e?(this.Xd(t),Yl.info("starting")):(this.Zd=Vl,this.stopRecording())}}Xd(t){var i,e;if(this.Yd)if(this.Zd!==Gl&&this.Zd!==Jl&&(this.Zd=Wl),null!=Mt&&null!=(i=Mt.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=Mt.__PosthogExtensions__)&&e.initSessionRecording)this.tv(t);else{var r,s=this._instance.sessionManager;null==(r=Mt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ev,(i=>{if(!this.Jd&&this.Yd&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[ht]:!0}),Yl.error("could not load recorder",i)):void this.tv(t);this.Zd=Vl}))}}stopRecording(){var t,i;null==(t=this.Qd)||t.call(this),this.Qd=void 0,null==(i=this.Gd)||i.stop()}Kd(t){var i,e;void 0===t&&(t=!1),null==(i=this.Qd)||i.call(this),this.Qd=void 0,null==(e=this.Gd)||e.discard({discardProducerEvents:t})}iv(){var t,i;null==(t=this.$o)||t.unregister(C),null==(i=this.$o)||i.unregister(x)}rv(t,i){if(fi(t))return null;var e,r=pi(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Yl.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}nv(t){if(this.$o){var i,r,s=this.$o,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.rv(null==(i=this.gn.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.rv(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;fi(a)&&this.iv();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[w]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ui(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(i=this.Qd)||i.call(this),this.Qd=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.nv(i),void this.Kd()):(this.nv(i),void this.startIfEnabledOrStop()):(this.Zd===Gl&&(this.Zd=Jl,Yl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.Gd)&&e.log?this.Gd.log(t,i):Yl.warn("log called before recorder was ready")}get ev(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(w);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}sv(){var t,i=this._instance.get_property(w);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Yl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!fi(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}tv(t){var i,e,r;if(!this.Jd&&this.Yd&&this._instance.sessionManager){if(null==(i=Mt.__PosthogExtensions__)||!i.initSessionRecording)return Yl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ht]:!0});var s;if(this.Gd||(this.Gd=null==(s=Mt.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.qt),this.Gd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.sv()){if(this.Zd===Jl||this.Zd===Gl)return;return this.Zd=Gl,Yl.info("persisted remote config is stale, requesting fresh config before starting"),void new Oo(this._instance).load()}this.Zd=Wl,null==(e=(r=this.Gd).setDocumentWasEverVisible)||e.call(r,this.qt),this.Gd.start(t)}else this.Zd=Vl}onRRwebEmit(t){var i;null==(i=this.Gd)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.Gd||null==(i=this.$o)||i.register({[k]:!0}),null==(t=this.Gd)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Gd||null==(i=this.$o)||i.register({[S]:!0}),null==(t=this.Gd)||t.overrideSampling()}overrideTrigger(t){var i,e;this.Gd||null==(e=this.$o)||e.register({["url"===t?E:P]:!0}),null==(i=this.Gd)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Gd)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.Gd)||!e.tryAddCustomEvent(t,i))}}},Uh={autocapture:class extends Al{constructor(t){super(new Ml(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.av=this.ov()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.lv();return!!(t.path||t.search||this.uv(t))}startIfEnabled(){this.isEnabled&&(Zr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.av=this.ov(),this.startIfEnabled()}stop(){this.hv&&this.hv(),this.hv=void 0,this.dv&&this.dv(),this.dv=void 0,Zr.info("History API monitoring stopped")}monitorHistoryChanges(){xt&&xt.history&&(this.vv("pushState"),this.vv("replaceState"),this.fv(),this.uv()&&this.pv())}vv(t){var i;if(xt&&(null==(i=xt.history[t])||!i.__posthog_wrapped__)){var e=this;Ll(xt.history,t,(i=>function(r,s,n){i.call(this,r,s,n),e.gv(t)}))}}ov(){var t=null==xt?void 0:xt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}lv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:li(t)?t:{}}uv(t){return void 0===t&&(t=this.lv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}mv(t){var i=this.lv(),e=this.av;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.uv(i)&&t.hash!==e.hash))}gv(t){try{var i=this.ov();if(!i)return;this.mv(i)&&this._instance.capture(mt,{navigation_type:t}),this.av=i}catch(i){Zr.error("Error capturing "+t+" pageview",i)}}fv(){if(!this.hv){var t=()=>{this.gv("popstate")};us(xt,"popstate",t),this.hv=()=>{xt&&xt.removeEventListener("popstate",t)}}}pv(){if(!this.dv){var t=()=>{this.gv("hashchange")};us(xt,"hashchange",t),this.dv=()=>{xt&&xt.removeEventListener("hashchange",t)}}}},heatmaps:class{get gn(){return this.instance.config}constructor(t){var i;this.yv=!1,this.Is=!1,this.bv=null,this.instance=t,this.yv=!(null==(i=this.instance.persistence)||!i.props[v]),this.rageclicks=new Pl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return li(this.gn.capture_heatmaps)&&this.gn.capture_heatmaps.flush_interval_milliseconds&&(t=this.gn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return fi(this.gn.capture_heatmaps)?fi(this.gn.enable_heatmaps)?this.yv:this.gn.enable_heatmaps:!1!==this.gn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Is)return;Ql.info("starting..."),this._v(),this.Wt()}else{var t;clearInterval(null!==(t=this.bv)&&void 0!==t?t:void 0),this.wv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:e}),this.yv=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Dt;return this.Dt=void 0,t}Sv(t){Xl(t.originalEvent)&&this.Ki(t.originalEvent,"deadclick")}Wt(){this.bv&&clearInterval(this.bv),this.bv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(Et)?setInterval(this.Mo.bind(this),this.flushIntervalMilliseconds):null}_v(){xt&&Et&&(this.xv=this.Mo.bind(this),us(xt,_t,this.xv),this.Cv=t=>this.Ki(t||(null==xt?void 0:xt.event)),us(Et,"click",this.Cv,{capture:!0}),this.Tv=t=>this.Mv(t||(null==xt?void 0:xt.event)),us(Et,"mousemove",this.Tv,{capture:!0}),this.Ev=new Mn(this.instance,In,this.Sv.bind(this)),this.Ev.startIfEnabledOrStop(),this.Iv=this.Wt.bind(this),us(Et,gt,this.Iv),this.Is=!0)}wv(){var t;xt&&Et&&(this.xv&&xt.removeEventListener(_t,this.xv),this.Cv&&Et.removeEventListener("click",this.Cv,{capture:!0}),this.Tv&&Et.removeEventListener("mousemove",this.Tv,{capture:!0}),this.Iv&&Et.removeEventListener(gt,this.Iv),clearTimeout(this.Rv),null==(t=this.Ev)||t.stop(),this.Is=!1)}Pv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&Gs(r)&&!Js(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:xt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Zt(i,s))return!0;r=an(r)}return!1}(sn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}Ki(t,i){var r;if(void 0===i&&(i="click"),!Ws(t.target)&&Xl(t)){var s=this.Pv(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&fn(sn(t),this.instance.config.rageclick)&&this.ys(e({},s,{type:"rageclick"})),this.ys(s)}}Mv(t){!Ws(t.target)&&Xl(t)&&(clearTimeout(this.Rv),this.Rv=setTimeout((()=>{this.ys(this.Pv(t,"mousemove"))}),500))}ys(t){if(xt){var i=this.gn.disable_capture_url_hashes?Ue(xt.location.href):xt.location.href,e=this.gn.custom_personal_data_properties,r=this.gn.mask_personal_data_properties?[...Xn,...e||[]]:[],s=Gn(i,r,to);this.Dt=this.Dt||{},this.Dt[s]||(this.Dt[s]=[]),this.Dt[s].push(t)}}Mo(){this.Dt&&!hi(this.Dt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Mn,webVitalsAutocapture:class{constructor(t){var i;this.yv=!1,this.Is=!1,this.Dt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Av=()=>{clearTimeout(this.Fv),this.Fv=void 0,0!==this.Dt.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.Dt.url},this.Dt.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.Dt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ov=t=>{var i;if(this.Dt=this.Dt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},fi(null==t?void 0:t.name)||fi(null==t?void 0:t.value))Bl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Lv(r);if(!ui(s)){var n=pi(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Dv||this.Dv>t.value){this.Dt.navigationKey!==n&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),ui(this.Dt.navigationKey)&&(this.Dt.navigationKey=n,this.Dt.url=s),this.Dt.firstMetricTimestamp=ui(this.Dt.firstMetricTimestamp)?Date.now():this.Dt.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=e({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,li(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of ql){var u="url"===h&&"string"==typeof t.attribution[h]?this.Lv(t.attribution[h]):t.attribution[h];ui(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;ui(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Dt.metrics.push(a),this.Dt.metrics.length===this.allowedMetrics.length&&this.Av()}else Bl.error("Ignoring metric with value >= "+this.Dv,t)}}},this.$v=()=>{if(!this.Is){var t,i,r,s,n=!1,o=Mt.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Nv])||("web-vitals"===this.Nv&&ui(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ui(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!ui(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,r=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?e({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Ov.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Ov.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Ov.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Ov.bind(this),v),this.Is=!0}else Bl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.yv=!(null==(i=this._instance.persistence)||!i.props[g]),this.startIfEnabled()}get qv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=li(this.qv)?null==(t=this.qv)?void 0:t.web_vitals_allowed_metrics:void 0;return fi(e)?(null==(i=this._instance.persistence)?void 0:i.props[b])||Ul:e}get flushToCaptureTimeoutMs(){return(li(this.qv)?this.qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=li(this.qv)?this.qv.web_vitals_attribution:void 0;return _i(t)?t?Ul:[]:oi(t)?t:Hl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=li(this.qv)?this.qv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Dv(){var t=li(this.qv)&&pi(this.qv.__web_vitals_max_value)?this.qv.__web_vitals_max_value:zl;return t>0&&6e4>=t?zl:t}get isEnabled(){var t=null==$t?void 0:$t.protocol;if("http:"!==t&&"https:"!==t)return Bl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=li(this.qv)?this.qv.web_vitals:_i(this.qv)?this.qv:void 0;return _i(i)?i:this.yv}startIfEnabled(){this.isEnabled&&!this.Is&&(Bl.info("enabled, starting..."),this.Ks(this.$v))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=li(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=li(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:e}),this._instance.persistence.register({[b]:r})),this.yv=e,this.startIfEnabled()}}}get Nv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ks(t){var i=Mt.__PosthogExtensions__,e=this.Nv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&ui(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?Bl.error("failed to load script",i):t()}))}Lv(t){var i=t||(null==xt?void 0:xt.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?Ue(i):i,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Xn,...r||[]]:[];return Gn(e,s,to)}Bl.error("Could not determine current URL")}}},Hh={exceptionObserver:class{constructor(t){var i;this.$v=()=>{var t;if(xt&&this.isEnabled&&null!=(t=Mt.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=Mt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=Mt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Mt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jv&&this.gn.capture_unhandled_errors&&(this.jv=i(this.captureException.bind(this))),!this.Bv&&this.gn.capture_unhandled_rejections&&(this.Bv=e(this.captureException.bind(this))),!this.Hv&&this.gn.capture_console_errors&&(this.Hv=r(this.captureException.bind(this)))}catch(t){Ol.error("failed to start",t),this.zv()}}},this._instance=t,this.Uv=!(null==(i=this._instance.persistence)||!i.props[c]),this.pe=new Fi(e({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:Ol})),this.gn=this.Wv(),this.startIfEnabledOrStop()}Wv(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return li(t)?i=e({},i,t):(ui(t)?this.Uv:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.gn.capture_console_errors||this.gn.capture_unhandled_errors||this.gn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ol.info("enabled"),this.zv(),this.Ks(this.$v)):this.zv()}Ks(t){var i,e;null!=(i=Mt.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Ol.error("failed to load script",i);t()}))}zv(){var t,i,e;null==(t=this.jv)||t.call(this),this.jv=void 0,null==(i=this.Bv)||i.call(this),this.Bv=void 0,null==(e=this.Hv)||e.call(this),this.Hv=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Uv=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.Uv}),this.gn=this.Wv(),this.startIfEnabledOrStop())}}onConfigChange(){this.gn=this.Wv()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.pe.consumeRateLimit(s)?Ol.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,r;this.Vv=[],this.Gv=new xr([new Mr,new qr,new Dr,new Or,new Ur,new zr,new Lr,new Hr],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Ar.test(l)?l.replace(Ar,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||Sr});var r}))}(n)}}("web:javascript",Cr,Ir)),this._instance=t,this.Vv=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==i?i:[],this.Zv=Kr(this.Qv()),this.Jv=new Yr(this.Zv)}onConfigChange(){this.Zv=Kr(this.Qv()),this.Jv.setConfig(this.Zv)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Vv=n,this._instance.persistence&&this._instance.persistence.register({[f]:this.Vv,[p]:o})}}}get Kv(){var t,i=!!this._instance.get_property(p),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Gv.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Zv.enabled)try{if(!di(t)||0===t.trim().length)return void Eh.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce(((e,r)=>Gr.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.Yv(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Eh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Jv.add(e({[Vr]:t,[Wr]:(new Date).toISOString()},s))}catch(t){Eh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Xv(i)){if(this.tc(i))return this.ec("Exception dropped: matched a suppression rule"),void Eh.info("Skipping exception capture because a suppression rule matched");if(!this.Kv&&this.ic(i))return this.ec("Exception dropped: thrown by a browser extension"),void Eh.info("Skipping exception capture because it was thrown by an extension");if(!this.Kv&&this.rc(i))return this.ec("Exception dropped: thrown by an injected browser script"),void Eh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.nc(i))return this.ec("Exception dropped: thrown by the PostHog SDK"),void Eh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.Zv.enabled&&fi(t.$exception_steps)?this.sc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",uu:!0});return s&&this.Jv.clear(),s}catch(t){return Eh.error("Failed to capture exception event. Dropping this exception.",t),void this.Jv.clear()}}catch(t){return void Eh.error("Failed to process exception event. Ignoring this exception.",t)}var n}sc(t){try{var i=this.Jv.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return Eh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}ec(t){this.Zv.enabled&&this.Jv.add({[Vr]:t,[Wr]:(new Date).toISOString()})}Yv(t){return li(t)?e({},t):{}}Qv(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}tc(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return di(e)&&e.length>0&&t.$exception_types.push(e),di(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Vv.some((t=>{var e=t.values.map((t=>{var e=Va[t.operator],r=i[t.key];if(!e||!r)return!1;var s=oi(t.value)?t.value:[t.value];return s.length>0&&e(s,r)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}catch(t){return Eh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}ic(t){var i=t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})),e=i.filter((t=>{var i=t.filename;return!!i&&Ph.some((t=>i.startsWith(t)))}));return 0!==e.length&&(!e.every((t=>{var i=t.filename;return!!i&&i.startsWith($h)}))||t.some((t=>{var i=t.value;return di(i)&&i.includes("isolatedAPI.contexts.topHostname")}))&&!i.some((t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith($h))})))}rc(t){return t.some((t=>{var i=t.value;return di(i)&&Th.some((t=>i.includes(t)))}))}nc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Xv(t){return!fi(t)&&oi(t)}}},qh=e({productTours:class{get $o(){return this._instance.persistence}constructor(t){this.ac=null,this.oc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.$o&&this.$o.register({[m]:!!i.productTours}),!th(this._instance))return!this.ac&&fi(null==(e=this.$o)?void 0:e.props[G])||Zl.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.ac)||r.stop(),this.ac=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ac&&th(this._instance)&&this.Ks((()=>this.lc()))}Ks(t){var i,e;null!=(i=Mt.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?Zl.error("Could not load product tours script",i):t()}))}lc(){var t;!this.ac&&null!=(t=Mt.__PosthogExtensions__)&&t.generateProductTours&&(this.ac=Mt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!oi(this.oc)||i){var e=this.$o;if(e){var r=e.props[G];if(oi(r)&&!i)return this.oc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(th(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||Zl.warn(s):Zl.error(s),void t([],{isLoaded:!1,error:s})}var n=oi(i.json.product_tours)?i.json.product_tours:[];this.oc=n,e&&e.register({[G]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.oc,{isLoaded:!0})}getActiveProductTours(t){fi(this.ac)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ac.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.ac)||i.showTourById(t)}previewTour(t){this.ac?this.ac.previewTour(t):this.Ks((()=>{var i;this.lc(),null==(i=this.ac)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.ac)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ac)||t.nextStep()}previousStep(){var t;null==(t=this.ac)||t.previousStep()}clearCache(){var t;this.oc=null,null==(t=this.$o)||t.unregister(G)}resetTour(t){var i;null==(i=this.ac)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ac)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.ac)||i.cancelPendingTour(t)}}},Bh),Vh={siteApps:class{constructor(t){this.uc=0,this._instance=t,this.hc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}dc(t,i){if(i){var e=this.globalsForEvent(i);this.hc.push(e),this.hc.length>1e3&&(this.hc=this.hc.slice(10))}}get siteAppLoaders(){var t;return null==(t=Mt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.dc.bind(this));this.vc=()=>{t(),this.hc=[],this.vc=void 0}}}globalsForEvent(t){var i,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(v)){var f=c[0];u[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,g=t.$set;return{event:e({},r(t,ih),{properties:e({},t.properties,g?{$set:e({},null!==(i=null==(s=t.properties)?void 0:s.$set)&&void 0!==i?i:{},g)}:{},p?{$set_once:e({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}cc(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(eh.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(eh.error("prepare_external_dependency_script returned null"),null):t}fc(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==Et?void 0:Et.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.uc++,this.gc)return this.mc();var u=[],d=this,v=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),u.push((()=>{t[i]=r}))}},f=t=>{if(v.has(t))return t;var i=d.cc(t);return i&&v.add(i),i},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ci(t)));return c(h,"appendChild",(t=>function(i){var e=f(i);return e?t.call(this,e):i})),c(h,"insertBefore",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i})),c(h,"replaceChild",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):e})),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"prepend",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"after",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"replaceWith",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null})),this.gc=()=>{u.forEach((t=>t())),this.gc=void 0},this.mc()}mc(){var t=!1;return()=>{var i;t||(t=!0,this.uc--,0===this.uc&&(null==(i=this.gc)||i.call(this)))}}yc(t,i){void 0===i&&(i=!0);var e=this.fc();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.hc.length&&(eh.info("Processing "+this.hc.length+" events for site app with id "+t.id),this.hc.forEach((t=>this.yc((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.vc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,eh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.yc((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){eh.error(rh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){eh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}bc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}_c(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.yc((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){eh.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.bc(),void this._instance.on("eventCaptured",(t=>this._c(t)))):void eh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.vc)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;Mt["__$$ph_site_app_"+i]=s._instance,null==(t=Mt.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,(t=>{if(t)return eh.error(rh+i,t)}))};for(var a of n.siteApps)o()}else eh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Wh={tracingHeaders:class{constructor(t){this.wc=void 0,this.kc=void 0,this.Sc=void 0,this.$v=()=>{var t,i,e=this.xc();e?(ui(this.wc)&&(this.wc=null==(t=Mt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ui(this.kc)&&(this.kc=null==(i=Mt.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.zv()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Ks(t){var i,e;null!=(i=Mt.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Nl.error("failed to load script",i);t()}))}Cc(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}xc(){var t=this.Cc();return oi(t)?(oi(this.Sc)?this.Sc.splice(0,this.Sc.length,...t):this.Sc=[...t],t.length>0?this.Sc:void 0):(oi(this.Sc)&&this.Sc.splice(0),this.Sc=t||void 0,this.Sc)}zv(){var t,i;null==(t=this.wc)||t.call(this),null==(i=this.kc)||i.call(this),this.wc=void 0,this.kc=void 0}startIfEnabledOrStop(){this.xc()?this.Ks(this.$v):this.zv()}}},Gh=e({surveys:class extends ah{constructor(t){var i;super(new ch(t),{get projectToken(){return i.config.token},kv:new vh(i=t)}),this._instance=t}Ou(t,i){var e=i.query?ma(t,i.query):t;return new Promise((t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})}))}}},Bh),Jh={toolbar:class{constructor(t){this.instance=t}Tc(t){Mt.ph_toolbar_state=t}Mc(){var t;return null!==(t=Mt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),ds(this.instance.config))return!1;if(!xt||!Et)return!1;t=null!=t?t:xt.location,e=null!=e?e:xt.history;try{if(!i){try{xt.localStorage.setItem("test","test"),xt.localStorage.removeItem("test")}catch(t){return!1}i=null==xt?void 0:xt.localStorage}var r,s=fh||Jn(t.hash,"__posthog")||Jn(t.hash,"state"),n=s?ns((()=>JSON.parse(atob(decodeURIComponent(s)))))||ns((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(ph)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Ec(t){var i=Mt.ph_load_toolbar||Mt.ph_load_editor;!fi(i)&&ai(i)?i(t,this.instance):gh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==Et||!Et.getElementById(Us));if(!xt||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(xt.localStorage.setItem(ph,JSON.stringify(e({},s,{source:void 0}))),2===this.Mc())this.Ec(s);else if(0===this.Mc()){var n;this.Tc(1),null==(n=Mt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return gh.error("[Toolbar] Failed to load",t),void this.Tc(0);this.Tc(2),this.Ec(s)})),us(xt,"turbolinks:load",(()=>{this.Tc(0),this.loadToolbar(s)}))}return!0}Ic(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Kh=e({experiments:Rh},Bh),Yh={conversations:class{constructor(t){this.Rc=void 0,this._conversationsManager=null,this.Pc=!1,this.je=null,this.Ac=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Fc=t.ok,t.ok)){var i=t.config.conversations;fi(i)||(_i(i)?this.Rc=i:(this.Rc=i.enabled,this.je=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Rc=void 0,this.je=null,this.Fc=void 0,this.Ac=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Pc||this._instance.config.disable_conversations||ds(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Mt?void 0:Mt.__PosthogExtensions__;if(t&&!ui(this.Rc)&&this.Rc)if(this.je&&this.je.token){this.Pc=!0;try{var i=t.initConversations;if(i)return this.Oc(i),void(this.Pc=!1);var e=t.loadExternalDependency;if(!e)return void this.Lc(ut);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Lc("Could not load conversations script",i):this.Oc(t.initConversations),this.Pc=!1}))}catch(t){this.Lc("Error initializing conversations",t),this.Pc=!1}}else Ih.error("Conversations enabled but missing token in remote config.")}}Oc(t){if(this.je)try{this._conversationsManager=t(this.je,this._instance),this.Ac=!1,Ih.info("Conversations loaded successfully")}catch(t){this.Lc("Error completing conversations initialization",t)}else Ih.error("Cannot complete initialization: remote config is null")}Lc(t,i){Ih.error(t,i),this._conversationsManager=null,this.Pc=!1,this.Ac=!0}show(){this._conversationsManager?this._conversationsManager.show():Ih.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rc&&!ci(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ds(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Fc?"remote_config_failed":ui(this.Rc)?this.Fc?"disabled_in_project":"remote_config_pending":this.Rc?fi(this.je)||!this.je.token?"missing_token":null!=Mt&&Mt.__PosthogExtensions__?this.Pc?"initializing":this.Ac?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(Ih.warn(Ah),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Ih.warn(Ah),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ih.warn(Ah),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ih.warn(Ah),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ih.warn(Ah),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ih.warn(Ah),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ih.warn(Ah),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}yu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}bu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Qh={logs:class{constructor(t){var i,r=this;this.name="logs",this.Dc=!1,this.$c=!1,this.Nc=!1,this.A=ts("[logs]"),this.qc=e({},this.A,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some(Nh)||r.A.error(...i)}}),this.fo=[],this.jc=[],this.vd=0,this.Fs=!1,this.Bc=[],this.Hc=[],this.zc=!1,this.Uc=!1,this.Wc=()=>{var t,i;this.Fs||(this.vd=0,null==(t=this.Vc)||t.onReconnect(),null==(i=this.Gc)||i.onReconnect())},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Dc=!0),xt&&us(xt,"online",this.Wc)}Zc(t,i,e,r){var s,n=Mh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new cr(this.Qc(t,i),n,this.qc,(()=>this.Jc()),(t=>t()),void 0,r),n]}Kc(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Vc||this.Yc!==i){var e;null==(e=this.Vc)||e.reset(),this.Yc=i;var r=this.Zc((()=>this.fo),(t=>{this.fo=t}));this.Vc=r[0],this.Xc=r[1]}return this.Vc}tf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Gc||this.ef!==i){var e;null==(e=this.Gc)||e.reset(),this.ef=i;var r=this.Zc((()=>this.jc),(t=>{this.jc=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Dh);this.Gc=r[0],this.if=r[1]}return this.Gc}setup(t){var i;if(!this.Fs){this.$s=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.Dc=!0),(this.Dc||this.rf()&&this.nf())&&this.sf();var e=!1,r=t.onRemoteConfig((t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)}));this.Fs?r.dispose():(this.Ns=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Fs||(this.Fs=!0,this.af(),null==(t=this.Ns)||t.dispose(),this.Ns=void 0,this.$s=void 0,this.Nc=!1,null==xt||xt.removeEventListener("online",this.Wc),null==(i=this.lf)||i.call(this),this.lf=void 0,null==(e=this.Vc)||e.reset(),null==(r=this.Gc)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Fs){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;fi(r)?this.uf():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[y]:!!r}),r?(this.Dc=!0,this.$c||this.sf(),this.loadIfEnabled()):this.uf())}}reset(){var t,i,e,r;this.af(),null==(t=this.Vc)||t.clearQueue(),this.fo=[],null==(i=this.Vc)||i.reset(),null==(e=this.Gc)||e.clearQueue(),this.jc=[],null==(r=this.Gc)||r.reset(),this.vd=0}captureLog(t){this.Fs||this.Kc().captureLog(t)}captureConsoleLog(t){this.Fs||this.tf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Fs||this.tf().captureLog(t,{context:i,occurredAtMs:e})}nf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[y])}rf(){var t,i;return null==(t=this._instance)||null==t.ho||!t.ho()||!(null==(i=Mt._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}wu(){var t;this.af(),null==(t=this.Gc)||t.clearQueue(),this.jc=[]}uf(){this.Dc||this.af()}sf(){var t,i=this;if(!this.zc&&null!=Mt&&Mt.console){var e=Mh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(Mt.console[t])}catch(t){return 0}if(!r)return 0;i.Hc.push(Ll(Mt.console,t,(s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.hf(t,n,e)}catch(t){}return s.apply(Mt.console,n)};return n.__rrweb_original__=r,n})))};for(var s of Oh)r(s);this.zc=!0,this.df=setTimeout((()=>{this.af()}),3e4)}}hf(t,i,e){var r;if(this.zc&&!this.Uc&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.Bc.length){this.Uc=!0;try{this.Bc.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Jc()})}finally{this.Uc=!1}}}else this.af()}af(){if(this.Bc=[],this.zc){for(var t of(this.zc=!1,this.df&&(clearTimeout(this.df),this.df=void 0),this.Hc))t();this.Hc=[]}}vf(){var t=this.Bc;return this.af(),t}get logger(){return this.cf||(this.cf={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.cf}flushLogs(t){t?this.ff(t):(this.Vc&&this.Vc.flush().catch((t=>this.pf(t))),this.Gc&&this.Gc.flush().catch((t=>this.pf(t))))}pf(t){Nh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Fs&&this.Dc&&!this.$c&&!this.Nc){var t=null==Mt?void 0:Mt.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.af();var i=t.loadExternalDependency;if(!i)return this.A.error(ut),void this.af();this.Nc=!0;try{i(this._instance,"logs",(i=>{if(this.Nc=!1,!this.Fs&&this.Dc){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.af();else{var r,s,n=this.vf();this.lf=e.initializeLogs(null!==(r=this.$s)&&void 0!==r?r:this._instance),this.$c=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.$s)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.Nc=!1,t}}}Qc(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===Nt.LogsQueue?t():void 0,setPersistedProperty(t,e){var r;t===Nt.LogsQueue&&i(null!==(r=e)&&void 0!==r?r:[])},ss:t=>this.ss(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}ss(t){return new Promise((i=>{if(Kn(this.vd,3))i({kind:"fatal",error:Lh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Lh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.gf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.mf(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Lh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}}))}mf(t){(0!==t||this._instance.__loaded)&&(this.vd=Yn(t,this.vd,3,(()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}ff(t){this.fo.length>0&&this.yf(t,this.fo,this.Xc,s.LIB_NAME,(t=>{this.fo=t})),this.jc.length>0&&this.yf(t,this.jc,this.if,Dh,(t=>{this.jc=t}))}yf(t,i,e,r,n){if(0!==i.length){var o=i.map((t=>t.record));n([]);var a=vr(o,dr(e,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.gf(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}gf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Jc(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,fi(s)||(i.sessionStartTimestamp=s),fi(n)||(i.lastActivityTimestamp=n)}if(null!=Mt&&null!=(t=Mt.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?Ue(Mt.location.href):Mt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},Xh={metrics:class{constructor(t){this.A=ts("[metrics]"),this._instance=t}initialize(){}Kc(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Vc&&this.Yc===e||(null==(i=this.Vc)||i.reset(),this.Yc=e,this.Vc=new _r(this.Qc(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.Vc}count(t,i,e){void 0===i&&(i=1),this.Kc().count(t,i,e)}gauge(t,i,e){this.Kc().gauge(t,i,e)}histogram(t,i,e){this.Kc().histogram(t,i,e)}flush(t){if(!this.Vc)return Promise.resolve();if(t){var i=this.Vc.drainWindow();return i&&this.Ss(i,t),Promise.resolve()}return this.Vc.flush().catch((t=>this.A.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Vc)||t.reset()}Qc(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ss:t=>i.Ss(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Ss(t,i){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(e({method:"POST",url:this.bf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))}))}bf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Zh=e({},Bh,zh,Uh,Hh,qh,Vh,Gh,Wh,Jh,Kh,Yh,Qh,Xh);$l.__defaultExtensionClasses=e({},Zh)}();
|
|
1
|
+
!function(){"use strict";function t(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise((function(s,n){var o=i.apply(e,r);function a(i){t(o,s,n,a,l,"next",i)}function l(i){t(o,s,n,a,l,"throw",i)}a(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var s={DEBUG:!1,LIB_VERSION:"0.7.1",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.424.0",s.LIB_NAME="web";var n="$people_distinct_id",o="distinct_id",a="$device_id",l="$device_model",h="__alias",u="__timers",d="$autocapture_disabled_server_side",v="$heatmaps_enabled_server_side",c="$exception_capture_enabled_server_side",f="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",_="$dead_clicks_enabled_server_side",m="$product_tours_enabled_server_side",y="$logs_capture_enabled_server_side",b="$web_vitals_allowed_metrics",w="$session_recording_remote_config",x="$replay_sample_rate",S="$replay_override_sampling",k="$replay_override_linked_flag",E="$replay_override_url_trigger",P="$replay_override_event_trigger",T="$sesid",C="$session_is_sampled",F="$enabled_feature_flags",R="$active_feature_flags",I="$early_access_features",O="$feature_flag_details",A="$feature_flag_payloads",M="$feature_flag_request_id",D="$minimal_flag_called_events",j="$override_feature_flags",L="$override_feature_flag_payloads",N="$stored_person_properties",B="$stored_group_properties",z="$groups",U="$surveys",H="$surveys_loaded_at",q="$surveys_activated",V="$surveys_activated_session",W="$surveys_activated_timestamps",G="ph_product_tours",J="$flag_call_reported",K="$flag_call_reported_session_id",Y="$feature_flag_errors",X="$feature_flag_evaluated_at",Q="$user_state",Z="$client_session_props",tt="$capture_rate_limit",it="$initial_campaign_params",et="$initial_referrer_info",rt="$initial_person_info",st="$epp",nt="$posthog_cookieless",ot="$cookieless_mode",at="$sdk_debug_extensions_init_method",lt="$sdk_debug_extensions_init_time_ms",ht="$sdk_debug_recording_script_not_loaded",ut="PostHog loadExternalDependency extension not found.",dt="on_reject",vt="always",ct="anonymous",ft="identified",pt="identified_only",gt="visibilitychange",_t="beforeunload",mt="$pageview",yt="$pageleave",bt="$identify",wt="$groupidentify",xt="undefined"!=typeof window?window:void 0,St="undefined"!=typeof globalThis?globalThis:xt,kt=null==St?void 0:St.navigator,Et=null==St?void 0:St.document,$t=null==St?void 0:St.location,Pt=null==St?void 0:St.fetch,Tt=null!=St&&St.XMLHttpRequest&&"withCredentials"in new St.XMLHttpRequest?St.XMLHttpRequest:void 0,Ct=null==St?void 0:St.AbortController,Ft=null==St?void 0:St.CompressionStream,Rt=null==kt?void 0:kt.userAgent;function It(){return!(!xt||!1===xt.navigator.onLine)}var Ot="undefined"!=typeof globalThis?globalThis:xt;Ot&&"undefined"==typeof self&&(Ot.self=Ot),Ot&&"undefined"==typeof File&&(Ot.File=function(){});var At=null!=xt?xt:{},Mt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Dt(t){return"string"==typeof t||t}function jt(t){return"string"==typeof t?t:void 0}var Lt=["$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"],Nt=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),Bt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),zt=["$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"],Ut=["token"],Ht=20,qt=1e3,Vt=1e4,Wt="[Circular]",Gt="[Truncated]",Jt="[Unserializable]",Kt="[Function]";function Yt(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}var Xt=["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"],Qt=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return Xt.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function Zt(t,i){return-1!==t.indexOf(i)}var ti=function(t){return t.trim()},ii=function(t){return t.replace(/^\$/,"")};function ei(t){var i,e=[];return null!==(i=JSON.stringify(t,(function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}})))&&void 0!==i?i:"null"}var ri=Object.prototype,si=ri.hasOwnProperty,ni=ri.toString,oi=Array.isArray||function(t){return"[object Array]"===ni.call(t)},ai=t=>"function"==typeof t,li=t=>t===Object(t)&&!oi(t),hi=t=>{if(li(t)){for(var i in t)if(si.call(t,i))return!1;return!0}return!1},ui=t=>void 0===t,di=t=>"[object String]"==ni.call(t),vi=t=>di(t)&&0===t.trim().length,ci=t=>null===t,fi=t=>ui(t)||ci(t),pi=t=>"[object Number]"==ni.call(t)&&t==t,gi=t=>pi(t)&&t>0,_i=t=>"[object Boolean]"===ni.call(t),mi=t=>t instanceof FormData,yi=t=>Zt(zt,t),bi=t=>Zt(Ut,t);function wi(t){return null===t||"object"!=typeof t}function xi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Si(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Ei(t,Error)}}function ki(t){return"undefined"!=typeof Event&&Ei(t,Event)}function Ei(t,i){try{return t instanceof i}catch(t){return!1}}var $i=[!0,"true",1,"1","yes"],Pi=t=>Zt($i,t),Ti=[!1,"false",0,"0","no"];function Ci(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),pi(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),Ci(s||e,i,e,r))}class Fi{constructor(t){this.C={},this.I=t.I,this.R=Ci(t.bucketSize,0,100,t.A),this.O=Ci(t.refillRate,0,this.R,t.A),this.N=Ci(t.refillInterval,0,864e5,t.A)}F(t,i){var e=Math.floor((i-t.lastAccess)/this.N);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.N)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.F(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}}var Ri="Mobile",Ii="iOS",Oi="Android",Ai="Tablet",Mi=Oi+" "+Ai,Di="iPad",ji="Apple",Li=ji+" Watch",Ni="Safari",Bi="BlackBerry",zi="Samsung",Ui=zi+"Browser",Hi=zi+" Internet",qi="Chrome",Vi=qi+" OS",Wi=qi+" "+Ii,Gi="Internet Explorer",Ji=Gi+" "+Ri,Ki="Opera",Yi=Ki+" Mini",Xi="Edge",Qi="Microsoft "+Xi,Zi="Firefox",te=Zi+" "+Ii,ie="Nintendo",ee="PlayStation",re="Xbox",se=Oi+" "+Ri,ne=Ri+" "+Ni,oe="Windows",ae=oe+" Phone",le="Nokia",he="Ouya",ue="Generic",de=ue+" "+Ri.toLowerCase(),ve=ue+" "+Ai.toLowerCase(),ce="Konqueror",fe="Oculus Browser",pe="Vivaldi",ge="Yandex",_e="Whale",me="DuckDuckGo",ye="Pale Moon",be="Waterfox",we="Brave",xe="Claude",Se="Codex",ke="ChatGPT",Ee="Google Search App",$e="(\\d+(\\.\\d+)?)",Pe=new RegExp("Version/"+$e),Te=new RegExp("("+xe+"|"+Se+"|"+ke+")\\/"+$e),Ce=new RegExp(re,"i"),Fe=new RegExp(ee+" \\w+","i"),Re=new RegExp(ie+" \\w+","i"),Ie=new RegExp(Bi+"|PlayBook|BB10","i"),Oe={"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"},Ae=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?we:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&Zt(t,"GSA/")?Ee:Zt(t," OPR/")&&Zt(t,"Mini")?Yi:Zt(t," OPR/")?Ki:Ie.test(t)?Bi:Zt(t,"IE"+Ri)||Zt(t,"WPDesktop")?Ji:Zt(t,"OculusBrowser")?fe:Zt(t,Ui)?Hi:Zt(t,Xi)||Zt(t,"Edg/")?Qi:Zt(t,pe+"/")?pe:Zt(t,"YaBrowser/")?ge:Zt(t,_e+"/")?_e:Zt(t,me+"/")||Zt(t,"Ddg/")?me:Zt(t,xe+"/")?xe:Zt(t,Se+"/")?Se:Zt(t,ke+"/")?ke:Zt(t,"FBIOS")?"Facebook "+Ri:Zt(t,"UCWEB")||Zt(t,"UCBrowser")?"UC Browser":Zt(t,"CriOS")?Wi:Zt(t,"CrMo")||Zt(t,qi)?qi:Zt(t,Oi)&&Zt(t,Ni)?se:Zt(t,"FxiOS")?te:Zt(t.toLowerCase(),ce.toLowerCase())?ce:Zt(t,we+"/")?we:((t,i)=>i&&Zt(i,ji)||function(t){return Zt(t,Ni)&&!Zt(t,qi)&&!Zt(t,Oi)}(t))(t,i)?Zt(t,Ri)?ne:Ni:Zt(t,"PaleMoon/")?ye:Zt(t,be+"/")?be:Zt(t,Zi)?Zi:Zt(t,"MSIE")||Zt(t,"Trident/")?Gi:Zt(t,"Gecko")?Zi:"")},Me={[Ji]:[new RegExp("rv:"+$e)],[Qi]:[new RegExp(Xi+"?\\/"+$e)],[qi]:[new RegExp("("+qi+"|CrMo)\\/"+$e)],[Wi]:[new RegExp("CriOS\\/"+$e)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$e)],[Ni]:[Pe],[ne]:[Pe],[Ki]:[new RegExp("(Opera|OPR)\\/"+$e)],[Zi]:[new RegExp(Zi+"\\/"+$e)],[te]:[new RegExp("FxiOS\\/"+$e)],[ce]:[new RegExp("Konqueror[:/]?"+$e,"i")],[Bi]:[new RegExp(Bi+" "+$e),Pe],[se]:[new RegExp("android\\s"+$e,"i")],[Hi]:[new RegExp(Ui+"\\/"+$e)],[fe]:[new RegExp("OculusBrowser\\/"+$e)],[pe]:[new RegExp(pe+"\\/"+$e)],[ge]:[new RegExp("YaBrowser\\/"+$e)],[_e]:[new RegExp(_e+"\\/"+$e)],[we]:[new RegExp(we+"\\/"+$e)],[xe]:[Te],[Se]:[Te],[ke]:[Te],[me]:[new RegExp("(DuckDuckGo|Ddg)\\/"+$e)],[ye]:[new RegExp("PaleMoon\\/"+$e)],[be]:[new RegExp(be+"\\/"+$e)],[Ee]:[new RegExp("GSA\\/"+$e)],[Gi]:[new RegExp("(rv:|MSIE )"+$e)],Mozilla:[new RegExp("rv:"+$e)]},De=function(t,i,e,r){var s=Ae(t,i,e,r),n=Me[s];if(ui(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},je=[[new RegExp(re+"; "+re+" (.*?)[);]","i"),t=>[re,t&&t[1]||""]],[new RegExp(ie,"i"),[ie,""]],[new RegExp(ee,"i"),[ee,""]],[Ie,[Bi,""]],[new RegExp(oe,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ae,""];if(new RegExp(Ri).test(i)&&!/IEMobile\b/.test(i))return[oe+" "+Ri,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Oe[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[oe,r]}return[oe,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ii,[t[3],t[4],t[5]||"0"].join(".")]:[Ii,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=ui(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Oi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Oi+")","i"),t=>t&&t[2]?[Oi,[t[2],t[3],t[4]||"0"].join(".")]:[Oi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Vi,""]],[/Linux|debian/i,["Linux",""]]],Le=function(t){for(var i=0;je.length>i;i++){var e=je[i],r=e[1],s=e[0].exec(t),n=s&&(ai(r)?r(s,t):r);if(n)return n}return["",""]},Ne=function(t){return Re.test(t)?ie:Fe.test(t)?ee:Ce.test(t)?re:new RegExp(he,"i").test(t)?he:new RegExp("("+ae+"|WPDesktop)","i").test(t)?ae:/iPad/.test(t)?Di:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Li:Ie.test(t)?Bi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(le,"i").test(t)?le:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Ri).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Oi:Mi:new RegExp("(pda|"+Ri+")","i").test(t)?de:new RegExp(Ai,"i").test(t)&&!new RegExp(Ai+" pc","i").test(t)?ve:""},Be=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ze(t,i){return"string"==typeof(e=t)&&Be.test(e)?t:i();var e}function Ue(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function He(t){return t?t.split("#")[0]:t}function qe(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function Ve(t,i,e){return We.apply(this,arguments)}function We(){return(We=i((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=qe((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ge,Je="NativeGzipValidationError",Ke=t=>t.length>=2&&31===t[0]&&139===t[1],Ye=(t,i)=>t===Bt.GZipJS||i===Bt.GZipJS||"gzip"===i,Xe=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Qe=t=>{throw Ue(Je,"Native gzip produced invalid output: "+t)},Ze=function(){var t=i((function*(t,i){18>t.size&&Qe("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ke(e)&&8===e[2]||Qe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(Ge)return Ge;Ge=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;Ge[t]=i>>>0}return Ge})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Qe("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Qe("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function tr(){return tr=i((function*(t,e,r){void 0===e&&(e=!0);try{var s=(new TextEncoder).encode(t),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=i((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(i){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Ze(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),tr.apply(this,arguments)}var ir=0x8000000000000000,er="9223372036854775808",rr={}.propertyIsEnumerable;function sr(t,i){try{return ar(t,i,{ancestors:new WeakSet,remainingNodes:Vt},0)}catch(t){return[]}}function nr(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:Gt};if(e.remainingNodes--,_i(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt(er);return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var s=BigInt(t).toString();return t>=ir||-ir>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Yt(t)};if("function"==typeof t)return{stringValue:Kt};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:Wt};if(r>=Ht)return{stringValue:Gt};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Yt(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return nr(a.call(t),i,e,r+1)}catch(t){}return oi(t)?{arrayValue:{values:or(t,i,e,r+1)}}:{kvlistValue:{values:ar(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Yt(String(t))}}function or(t,i,e,r){for(var s=[],n=Math.min(t.length,qt),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(fi(a))continue;s.push(nr(a,i,e,r))}catch(t){s.push({stringValue:Jt})}return t.length>o&&s.push({stringValue:Gt}),s}function ar(t,i,e,r){var s=[];for(var n in t)if(rr.call(t,n)){if(s.length>=qt||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(ci(o)||ui(o))continue;s.push({key:Yt(n),value:nr(o,i,e,r)})}catch(t){s.push({key:Yt(n),value:{stringValue:Jt}})}}return s}function lr(t,i,r){return e({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":r})}var hr={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var ur={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},dr=ur.info;function vr(t){try{return Yt(String(t))}catch(t){return Jt}}function cr(t,i,r,s){var n,o=ur[t.level||"info"]||dr,a=o.text,l=o.number,h=(void 0===(n=pi(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),fi(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),fi(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=e({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Jt}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var g={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:vr(t.body)},attributes:sr(d,r)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),ui(t.trace_flags)||(g.flags=t.trace_flags),g}function fr(t,i,e){return lr(t,i,e)}function pr(t,i,e,r){return{resourceLogs:[{resource:{attributes:sr(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let gr=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.gn=i,this.A=e,this.Pn=r,this.Fn=s,this.Dn=n,this.$n=o,this.Nn=null,this.qn=0,this.jn=0,this.Bn=0,this.Hn=0,this.zn=0,this.Un=!1,this.Wn=i.maxBufferSize,this.Vn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.Gn=i.flushIntervalMs,this.Zn=i.maxBatchRecordsPerPost,this.Qn=i.rateCapWindowMs,this.Jn=i.maxLogsPerInterval}clearQueue(){this.jn++,this._instance.setPersistedProperty(Nt.LogsQueue,[])}reset(){this.Kn(),this.Hn=0,this.zn=0,this.Un=!1,this.Bn=0,this.Zn=this.gn.maxBatchRecordsPerPost}onReconnect(){this.Bn=0,this.Yn()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.Xn(t);if(null!==r)if(r.body){if(this.ts()){var s={record:cr(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.Pn(),this.A,null==i?void 0:i.occurredAtMs)};this.Fn((()=>this.es(s)))}}else this.A.info("Log was rejected in beforeSend function")}}Xn(t){var i=this.gn.beforeSend;if(!i)return t;var e=oi(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}ts(){if(void 0===this.Jn)return!0;var t=Date.now(),i=t-this.Hn;return this.Qn>i&&i>=0||(this.Hn=t,this.zn=0,this.Un=!1),this.Jn>this.zn?(this.zn++,!0):(this.Un||(this.A.warn("captureLog dropping logs: exceeded "+this.Jn+" logs per "+this.Qn+"ms"),this.Un=!0),!1)}flush(){var t=this;return i((function*(){if(!t._instance.isDisabled)return t.Nn||(t.Nn=t.rs().finally((()=>{t.Nn=null}))),t.Nn}))()}rs(){var t=this;return i((function*(){var i;t.Kn();var e=null!==(i=t._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.jn;t.qn=0;var l=Math.min(e.length,t.Zn),h=e.slice(0,l),u=pr(h.map((t=>t.record)),t.ns(),null!==(n=t.$n)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.ss(u);if(t.jn!==a)return;if("too-large"===d.kind&&h.length>1)t.Zn=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.Zn);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t.gn.maxBatchRecordsPerPost>t.Zn&&(t.Zn=Math.min(t.gn.maxBatchRecordsPerPost,t.Zn+1)),yield t.os(h.length),e=null!==(o=t._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}}))()}os(t){var e=this;return i((function*(){var i,r=Math.max(0,t-e.qn),s=null!==(i=e._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(Nt.LogsQueue,s.slice(r)),yield e.Dn()}))()}ns(){return fr(this.gn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}es(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];this.Vn>e.length||(e.shift(),this.qn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(Nt.LogsQueue,e),this.Wn>e.length?this.ls():this.Yn()}}ls(t){void 0===t&&(t=this.Gn),this.us||(this.us=qe((()=>{this.us=void 0,this.Yn()}),t))}hs(){var t=Math.min(Math.max(0,this.Bn-1),6);return this.Gn*Math.pow(2,t)}ds(){var t=this._instance.getPersistedProperty(Nt.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i((function*(){e.Kn();var i=e.flush().catch((()=>{}));void 0!==t?yield Ve(i,t):yield i}))()}flushWithTimeout(t){var e=this;return i((function*(){var i=e.flush();yield Ve(i,t,(()=>{i.catch((()=>{}))}))}))()}Yn(){this.flush().then((()=>{this.Bn=0}),(t=>{this.Bn++,this.A.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.ds()&&this.ls(this.hs())}))}Kn(){this.us&&(clearTimeout(this.us),this.us=void 0)}};var _r=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function mr(t){return String(t)+"000000"}function yr(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let br=class{constructor(t,i,e){this._instance=t,this.gn=i,this.A=e,this.vs=new Map,this.Nn=null,this.cs=!1,this.fs=new Map,this.ps=new Set,this.gs=0}count(t,i,e){void 0===i&&(i=1),this.ys({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.ys({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.ys({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,e=this.Nn,r=function(){var r=i((function*(){e&&(yield e.catch((()=>{}))),yield t.bs()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.Nn===s&&(this.Nn=null)}));return this.Nn=s,s}drainWindow(){if(0===this.vs.size)return null;var t=this.vs;return this.vs=new Map,this.cs=!1,this.fs=new Map,this.ps=new Set,this._s(t)}reset(){this.gs++,this.Kn(),this.vs=new Map,this.Nn=null,this.cs=!1,this.fs=new Map,this.ps=new Set}ys(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.Xn(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=i.attributes?e({},i.attributes):void 0,s=yr(i.type,i.name,i.unit,r)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.vs.get(s);if(!n){if(!this.ws())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.vs.set(s,n)}var o=this.fs.get(i.name);void 0===o?this.fs.set(i.name,i.type):o===i.type||this.ps.has(i.name)||(this.ps.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.ks(n,i.value),this.ls()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}ws(){return this.gn.maxSeriesPerFlush>this.vs.size||(this.cs||(this.cs=!0,this.A.warn("Metric series cap reached ("+this.gn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}ks(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(_r.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,_r)]+=1}}Xn(t){var i=this.gn.beforeSend;if(!i)return t;var e=oi(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}ls(){this.us||(this.us=qe((()=>{this.us=void 0,this.flush().catch((t=>{this.A.error("Metrics flush failed:",t)}))}),this.gn.flushIntervalMs))}Kn(){this.us&&(clearTimeout(this.us),this.us=void 0)}bs(){var t=this;return i((function*(){if(0!==t.vs.size){var i=t.vs;t.vs=new Map,t.cs=!1,t.fs=new Map,t.ps=new Set;var e=t.gs,r=yield t._instance.Ss(t._s(i));if(e===t.gs)switch(r.kind){case"ok":return;case"retry-later":return t.xs(i),void t.ls();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}}))()}_s(t){return i=this.Cs(t),e=function(t,i,e){return lr(t,i,e)}(this.gn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:sr(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}Cs(t){var i=mr(Date.now()),r=new Map;for(var s of t.values()){var n,o=yr(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=e({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},r.set(o,a));var l=sr(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=mr(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:_r})}return Array.from(r.values())}xs(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.vs.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.ws()&&this.vs.set(s,n)}}};var wr,xr,Sr;function kr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Sr&&e.length===xr||(xr=e.length,Sr=e.reduce(((e,r)=>{wr||(wr={});var s=wr[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,wr[r]=[l,h];break}}return e}),{})),Sr}}class Er{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&oi(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var e=this;return i((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,i){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:kr(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var $r="?";function Pr(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?$r:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return ui(r)||(n.lineno=r),ui(s)||(n.colno=s),n}var Tr=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:$r,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},Cr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Fr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Rr=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ir=(t,i)=>{var e=Cr.exec(t);if(e)return Pr(i,e[1],$r,+e[2],+e[3]);var r=Fr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=Rr.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Tr(r[1]||$r,r[2]);return Pr(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Or=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ar=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Mr=(t,i)=>{var e=Or.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Ar.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||$r,o=Tr(n,s);return Pr(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Dr=/\(error: (.*)\)/;class jr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=di(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return xi(t,"DOMException")}isDOMError(t){return xi(t,"DOMError")}}class Lr{match(t){return Si(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class Nr{constructor(){}match(t){return!!xi(t,"ErrorEvent")&&(null!=t.error||this.Wi(t))}coerce(t,i){var r;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return e({},s,{stack:null!==(r=this.Vi(t))&&void 0!==r?r:s.stack,synthetic:!0})}Wi(t){return di(t.message)&&t.message.length>0}Vi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(di(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Br=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class zr{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(Br);return r&&(i=r[1],e=r[2]),[i,e]}}var Ur=["fatal","error","warning","log","info","debug"];function Hr(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class qr{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(ki(t))return t.constructor.name;var i="name"in t?t.name:void 0;return di(i)&&!vi(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+Hr(t)}isSeverityLevel(t){return di(t)&&!vi(t)&&Ur.indexOf(t)>=0}getStack(t){try{return di(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:di(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Si(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Vr{match(t){return ki(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Hr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Wr{match(t){return wi(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Gr{match(t){return xi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!ki(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return wi(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Jr="$message",Kr="$timestamp",Yr=new Set([Jr,Kr]),Xr={enabled:!0,max_bytes:32768};function Qr(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Xr.enabled,max_bytes:ts(t.max_bytes,Xr.max_bytes)}:e({},Xr)}class Zr{constructor(t){this.Ts=[],this.Ms=0,this.gn=Qr(t)}setConfig(t){this.gn=Qr(t),this.Es()}add(t){var i=function(t){var i;try{i=ei(t)}catch(t){return}try{var e=JSON.parse(i);if(!li(e))return;var r=e,s=r[Jr],n=r[Kr];if(!di(s)||0===s.trim().length)return;if(!di(n)&&!pi(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.gn.max_bytes||(this.Ts.push({step:i.step,bytes:e}),this.Ms+=e,this.Es())}}getAttachable(){return this.Ts.map((t=>t.step))}clear(){this.Ts=[],this.Ms=0}size(){return this.Ts.length}Es(){for(;this.Ms>this.gn.max_bytes&&this.Ts.length>0;){var t=this.Ts.shift();t&&(this.Ms-=t.bytes)}}}function ts(t,i){if(!pi(t)||t===1/0||t===-1/0)return i;var e=Math.floor(t);return 0>e?i:e}var is=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){if(xt&&(s.DEBUG||xt.POSTHOG_DEBUG||e)&&!ui(xt.console)&&xt.console){for(var r=("__rrweb_original__"in xt.console[i]?xt.console[i].__rrweb_original__:xt.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];r(t,...o)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>is(t+" "+i,e)};return r},es=is("[PostHog.js]"),rs=es.createLogger;function ss(t,i){oi(t)&&t.forEach(i)}function ns(t,i){if(!fi(t))if(oi(t))t.forEach(i);else if(mi(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)si.call(t,e)&&i(t[e],e)}var os=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function as(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var ls=function(t){try{return t()}catch(t){return}},hs=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){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(t)}}},us=function(t){var i={};return ns(t,(function(t,e){(di(t)&&t.length>0||pi(t))&&(i[e]=t)})),i};var ds=["herokuapp.com","vercel.app","netlify.app"];function vs(t){var i=null==t?void 0:t.hostname;if(!di(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of ds)if(e===r)return!1;return!0}function cs(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function fs(t){return"ph_toolbar_internal"===t.name}var ps=t=>{if(Et){try{for(var i=t+"=",e=Et.cookie.split(";").filter((t=>t.length)),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return pi(t)&&isFinite(t)&&Math.floor(t)===t});class gs{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new gs(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new gs(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class _s{generate(){var t=this.generateOrAbort();if(!ui(t))return t;this.Yr=0;var i=this.generateOrAbort();if(ui(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Yr)this.Yr=t,this.Kr();else{if(this.Yr>=t+1e4)return;this.Xr++,this.Xr>4398046511103&&(this.Yr++,this.Kr())}return gs.fromFieldsV7(this.Yr,Math.trunc(this.Xr/Math.pow(2,30)),this.Xr&Math.pow(2,30)-1,this.ei.nextUint32())}Kr(){this.Xr=1024*this.ei.nextUint32()+(1023&this.ei.nextUint32())}constructor(){this.Yr=0,this.Xr=0,this.ei=new bs}}var ms,ys=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};xt&&!ui(xt.crypto)&&crypto.getRandomValues&&(ys=t=>crypto.getRandomValues(t));class bs{nextUint32(){return this.Dt.length>this.ti||(ys(this.Dt),this.ti=0),this.Dt[this.ti++]}constructor(){this.Dt=new Uint32Array(8),this.ti=1/0}}var ws=()=>xs().toString(),xs=()=>(ms||(ms=new _s)).generate(),Ss="",ks=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Es=null,$s={ri(){if(!ci(Es))return Es;if(Es=!1,Et)try{var t="__ph_cookie_support_"+ws();$s.ii(t,"xyz"),Es='"xyz"'===ps(t),$s.ai(t)}catch(t){Es=!1}return Es},oi(t){es.error("cookieStore error: "+t)},ni:ps,si(t){var i;try{i=JSON.parse($s.ni(t))||{}}catch(t){}return i},ii(t,i,e,r,s){if(!Et)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=Et),Ss)return Ss;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+ws();!Ss&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",Ss=n)}return Ss}(t);if(!e){var r=(t=>{var i=t.match(ks);return i?i[0]:""})(t);r!==e&&es.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(Et.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&es.warn("cookieStore warning: large cookie, len="+h.length),Et.cookie=h,!0}catch(t){return!1}},ai(t,i){if(null!=Et&&Et.cookie)try{$s.ii(t,"",-1,i)}catch(t){return}}},Ps=null,Ts={ri(){if(!ci(Ps))return Ps;var t=!0;if(ui(xt))t=!1;else try{var i="__mplssupport__";Ts.ii(i,"xyz"),'"xyz"'!==Ts.ni(i)&&(t=!1),Ts.ai(i)}catch(i){t=!1}return t||es.error("localStorage unsupported; falling back to cookie store"),Ps=t,t},oi(t){es.error("localStorage error: "+t)},ni(t){try{return null==xt?void 0:xt.localStorage.getItem(t)}catch(t){Ts.oi(t)}return null},si(t){try{return JSON.parse(Ts.ni(t))||{}}catch(t){}return null},ii(t,i){try{return null==xt||xt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Ts.oi(t)}return!1},ai(t){try{null==xt||xt.localStorage.removeItem(t)}catch(t){Ts.oi(t)}}},Cs=[N,R,F,O,A,M,X,Y,J],Fs=[a,o,T,C,st,rt,Q],Rs=t=>t+"_cpm",Is=["__proto__","constructor","prototype"],Os=t=>{if(!li(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===Is.indexOf(e)&&(i[e]=t[e])})),i},As=function(t,i){void 0===i&&(i=[]);var e={};return[...Fs,...i].forEach((i=>{var r=t[i];ui(r)||ci(r)||""===r||(e[i]=r)})),e},Ms=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Ds=(t,i)=>({p:i,f:Ms(JSON.stringify(t))}),js=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=$s.si(Rs(t)),r=(null==e?void 0:e.f)===Ms(i)&&oi(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ls=(t,i)=>i+"|"+($s.ni(Rs(t))||""),Ns={},Bs={ri:()=>!0,oi(t){es.error("memoryStorage error: "+t)},ni:t=>t in Ns?Ns[t]:null,si:t=>t in Ns?Ns[t]:null,ii:(t,i)=>(Ns[t]=i,!0),ai(t){delete Ns[t]}},zs=null,Us={ri(){if(!ci(zs))return zs;if(zs=!0,ui(xt))zs=!1;else try{var t="__support__";Us.ii(t,"xyz"),'"xyz"'!==Us.ni(t)&&(zs=!1),Us.ai(t)}catch(t){zs=!1}return zs},oi(t){es.error("sessionStorage error: ",t)},ni(t){try{return null==xt?void 0:xt.sessionStorage.getItem(t)}catch(t){Us.oi(t)}return null},si(t){try{return JSON.parse(Us.ni(t))||null}catch(t){}return null},ii(t,i){try{return null==xt||xt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Us.oi(t)}return!1},ai(t){try{null==xt||xt.sessionStorage.removeItem(t)}catch(t){Us.oi(t)}}};class Hs{constructor(t){this._instance=t}get gn(){return this._instance.config}get consent(){return this.Ws()?0:this.Vs}isOptedOut(){return this.gn.cookieless_mode===vt||this.isRejected()||-1===this.consent&&this.gn.cookieless_mode===dt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.gn.opt_out_capturing_by_default}optInOut(t){this.Gs.ii(this.Zs,t?1:0,this.gn.cookie_expiration,this.gn.cross_subdomain_cookie,this.gn.secure_cookie)}reset(){this.Gs.ai(this.Zs,this.gn.cross_subdomain_cookie)}get Zs(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get Vs(){var t=this.Gs.ni(this.Zs);return Pi(t)?1:Zt(Ti,t)?0:-1}get Gs(){var t=this.gn.opt_out_capturing_persistence_type,i="localStorage"===t?Ts:$s,e=i.ri()?i:Bs;if(!this.Qs||this.Qs!==e){this.Qs=e;var r="localStorage"===t?$s:Ts;r.ni(this.Zs)&&(this.Qs.ni(this.Zs)||this.optInOut(Pi(r.ni(this.Zs))),r.ai(this.Zs,this.gn.cross_subdomain_cookie))}return this.Qs}Ws(){return!!this.gn.respect_dnt&&[null==kt?void 0:kt.doNotTrack,null==kt?void 0:kt.msDoNotTrack,At.doNotTrack,null==kt?void 0:kt.globalPrivacyControl].some((t=>Pi(t)))}}function qs(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!ai(r))return i;try{var s=r(i);return di(s)&&s?s:i}catch(t){return es.error("Error in get_current_url, falling back to window.location.href",t),i}}var Vs="__POSTHOG_TOOLBAR__",Ws=1,Gs=3,Js=11;function Ks(t){return t instanceof Element&&(t.id===Vs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Ys(t){return!!t&&t.nodeType===Ws}function Xs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Qs(t){return!!t&&t.nodeType===Gs}function Zs(t){return!!t&&t.nodeType===Js&&Ys(t.host)}var tn=1e3;function en(t){return t?ti(t).split(/\s+/):[]}function rn(t,i){var e=function(t){var i,e=null==xt||null==(i=xt.location)?void 0:i.href;return ui(e)?void 0:qs(t,e)}(i);return!!(e&&t&&t.some((t=>e.match(t))))}function sn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return en(i)}function nn(t){return fi(t)?null:ti(t).split(/(\s+)/).filter((t=>Cn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function on(t){var i="";return bn(t)&&!wn(t)&&t.childNodes&&t.childNodes.length&&ns(t.childNodes,(function(t){var e;Qs(t)&&t.textContent&&(i+=null!==(e=nn(t.textContent))&&void 0!==e?e:"")})),ti(i)}function an(t){var i;return ui(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var ln=["a","button","form","input","select","textarea","label"];function hn(t,i){if(ui(i))return!0;var e,r=function(t){if(i.some((i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function un(t){var i=t.parentNode;return!(!i||!Ys(i))&&i}var dn=[".ph-no-autocapture","[data-ph-no-autocapture]"],vn=["next","previous","prev",">","<"],cn=[...vn,"+","-","−","–"],fn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,pn=[".ph-no-rageclick",".ph-no-capture"],gn=["","text","search","email","password","url","tel","number"];function _n(t,i){if(!xt||mn(t))return!1;var e,r,s,n,o;if(_i(i)?(e=!!i&&pn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:pn,r=null==i?void 0:i.content_ignorelist,s=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(s&&function(t){return!(!t||!Ys(t))&&(!!Xs(t,"textarea")||(Xs(t,"input")?Zt(gn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var a=yn(t,!1).targetElementList;return!function(t,i){if(!1===t||ui(t))return!1;var e;if(!0===t)e=vn;else{if(!oi(t))return!1;if(t.length>10)return es.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var i=t.safeText,r=t.ariaLabel;return e.some((t=>fn(i,t)||fn(r,t)))}))}(r,a.map((t=>{var i;return{safeText:on(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!hn(a,e)}var mn=t=>!t||Xs(t,"html")||!Ys(t),yn=(t,i)=>{if(!xt||mn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!Xs(s,"body");)if(Zs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=un(s);if(!n)break;if(i||ln.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=xt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function bn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Xs(r,"body");r=r.parentNode){if(e++>=tn||i.has(r))return!1;i.add(r);var s=sn(r);if(Zt(s,"ph-sensitive")||Zt(s,"ph-no-capture"))return!1}if(Zt(sn(t),"ph-include"))return!0;var n=t.type||"";if(di(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!di(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function wn(t){return!!(Xs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Xs(t,"select")||Xs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var xn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Sn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,kn=[16,15,14,13],En=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),$n=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Pn=/[0-9A-Za-z_]/;function Tn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Cn(t,i){if(void 0===i&&(i=!0),fi(t))return!1;if(di(t)){t=ti(t);var e=i?xn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Sn.lastIndex=0;i=Sn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of kn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(xn.test(a)&&Tn(a))return!0}}}return!1}(t);if(e)return!1;var r=i?En.test(t):function(t){var i;for($n.lastIndex=0;i=$n.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Pn.test(e)&&Pn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function Fn(t){var i=on(t);return Cn(i=(i+" "+Rn(t)).trim())?i:""}function Rn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ns(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=on(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Rn(t)).trim())}catch(t){es.error("[AutoCapture]",t)}})),i}function In(t){return t.replace(/"|\\"/g,'\\"')}function On(t){var i=t.attr__class;if(i)return oi(i)?i:en(i)}var An=rs("[Dead Clicks]"),Mn=()=>!0,Dn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(_)),r=t.instance.config.capture_dead_clicks;return _i(r)?r:!!li(r)||e};class jn{get lazyLoadedDeadClicksAutocapture(){return this.Js}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[_]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.Ks((()=>{this.Ys()})):this.stop()}Ks(t){var i,e;null!=(i=At.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=At.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?An.error("failed to load script",i):t()}))}Ys(){var t;if(Et){if(!this.Js&&null!=(t=At.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=li(this.instance.config.capture_dead_clicks)?e({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.Js=At.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.Js.start(Et),An.info("starting...")}}else An.error("`document` not found. Cannot start.")}stop(){this.Js&&(this.Js.stop(),this.Js=void 0,An.info("stopping..."))}}var Ln=rs("[SegmentIntegration]");var Nn="posthog-js";function Bn(t,i){var r=void 0===i?{}:i,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,h=r.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var r,a,h,d,v;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=i.exception)?void 0:r.values)||[],g=p.map((t=>e({},t,{stacktrace:t.stacktrace?e({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>e({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return s&&n&&(_.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(f=t.exceptions)||f.sendExceptionEvent(_)),i}}class zn{constructor(t,i,e,r,s,n){this.name=Nn,this.setupOnce=function(o){o(Bn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Un{constructor(t){this.Xs=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(es.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ta=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ea()}ea(){var t;this.ia=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Xs)}destroy(){var t;null==(t=this.ia)||t.call(this),this.ia=void 0}doPageView(t,i){var e,r=this.ra(t,i);return this.ta={pathname:null!==(e=null==xt?void 0:xt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.ra(t,null==(i=this.ta)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ta)?void 0:t.pageViewId}}ra(t,i){var e=this.ta;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(ui(n)||ui(o)||ui(a)||ui(l)||ui(h)||ui(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?Ci(o/n,0,1,es):1,v=n>1?Ci(a/n,0,1,es):1,c=l>1?Ci(h/l,0,1,es):1,f=l>1?Ci(u/l,0,1,es):1;r=os(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Hn=["flags","surveys"],qn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[y]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[g]:{exposure:"event"},[_]:{exposure:"event"},[m]:{exposure:"hidden"},[b]:{exposure:"event"},[w]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[T]:{exposure:"hidden"},[C]:{exposure:"event"},[x]:{exposure:"event",shouldSkipFromEventProperties:t=>ci(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[F]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"hidden",storageGroup:"flags"},[I]:{exposure:"hidden"},[O]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[D]:{exposure:"hidden",storageGroup:"flags"},[j]:{exposure:"hidden"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden"},[B]:{exposure:"hidden"},[U]:{exposure:"hidden",storageGroup:"surveys"},[H]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[q]:{exposure:"event"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[z]:{exposure:"event"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Q]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[st]:{exposure:"hidden"},[S]:{exposure:"event"},[k]:{exposure:"event"},[E]:{exposure:"event"},[P]:{exposure:"event"},[at]:{exposure:"event"},[lt]:{exposure:"event"},[ht]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Vn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Wn=t=>{var i=qn[t];if(i)return i;for(var e of Vn){var r=e[1];if(0===t.indexOf(e[0]))return r}},Gn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return ei(t)}},Jn=t=>{var i=null==Et?void 0:Et.createElement("a");return ui(i)?null:(i.href=t,i)},Kn=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!oi(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){es.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Yn=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");oi(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},Xn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Qn=(t,i)=>t>=i&&It(),Zn=(t,i,e,r)=>{if(0===t){if(It()){var s=i+1;return s===e&&r(),s}return i}return 0},to="https?://(.*)",io=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],eo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...io],ro="<masked>",so=["li_fat_id"];function no(t,i,e){if(!Et)return{};var r,s=i?[...io,...e||[]]:[],n=oo(Yn(Et.URL,s,ro),t),o=(r={},ns(so,(function(t){var i=ps(t);r[t]=i||null})),r);return os(o,n)}function oo(t,i){var e=eo.concat(i||[]),r={};return ns(e,(function(i){var e=Kn(t,i);r[i]=e||null})),r}function ao(t){var i=function(t){return t?0===t.search(to+"google.([^/?]*)")?"google":0===t.search(to+"bing.com")?"bing":0===t.search(to+"yahoo.com")?"yahoo":0===t.search(to+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!ci(i)){r.$search_engine=i;var s=Et?Kn(Et.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function lo(){return navigator.language||navigator.userLanguage}var ho="$direct";function uo(){return(null==Et?void 0:Et.referrer)||ho}function vo(t,i,e){void 0===e&&(e=!1);var r=t?[...io,...i||[]]:[],s=e?He(null==$t?void 0:$t.href):null==$t?void 0:$t.href,n=null==s?void 0:s.substring(0,1e3);return{r:uo().substring(0,1e3),u:n?Yn(n,r,ro):void 0}}function co(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?He(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==ho?ho:null==(e=Jn(r))?void 0:e.host};if(n){o.$current_url=n;var a=Jn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=oo(n);os(o,l)}if(r){var h=ao(r);os(o,h)}return o}function fo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function po(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var go={flags:X,surveys:H},_o=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],mo=t=>t+"_cookie_identity_change_pending",yo="main",bo=[F,R,O,A,M,X,D,N],wo=t=>-1!==bo.indexOf(t),xo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},So=t=>{if(!t)return{};var i=JSON.parse(t);return li(i)?i:{}},ko=(t,i)=>{ns(t,((e,r)=>{var s=Wn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class Eo{constructor(t,i,r){if(void 0===r&&(r=!0),this.na={},this.sa=!1,this.aa=!1,this.oa=!1,this.la=!1,this.ua=new Map,this.ha=!1,this.da=!1,this.va=!1,this.ca=new Set,this.gn=t,this.fa=r,this.props={},this.pa=void 0,this.ga=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.Gs=this.ma(t),this.aa=this.ya(t),this.load(),this.ba(),t.debug&&es.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save(),xt){var s=()=>this.flush();cs(xt,"beforeunload",s,{capture:!1}),cs(xt,"pagehide",s,{capture:!1}),this._a=t=>{if(this.sa&&(!t.storageArea||t.storageArea===(null==xt?void 0:xt.localStorage))&&t.key)if(t.key!==this.ga){if(this.aa){var i=Hn.find((i=>t.key===this.wa(i)));i&&this.ka(t.key,i)}}else this.ka(t.key,yo)},cs(xt,"storage",this._a)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach((t=>{var i=t[0],e=t[1],r=this.ua.get(i);if(wo(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach((t=>s.add(t))),s.size&&this.Sa(i,s)}else this.Sa(i,!0)}))}onCrossTabFeatureFlagChange(t){return this.ca.add(t),()=>this.ca.delete(t)}destroy(){this._a&&xt&&(xt.removeEventListener("storage",this._a),this._a=void 0),this.ca.clear()}ka(t,i,e){if(void 0===e&&(e=!0),this.xa)return!1;var r,s;try{if(s=Ts.ni(t),ci(s)){var n=this.Ca(i);return n.storageValue=null,i!==yo&&(n.persisted=!1),!1}r=So(s)}catch(t){return!1}var o=i===yo?r:Ts.si(this.ga);if(o&&this.Ta(o))return!1;var a=this.Ma(r,i,e);return i===yo&&this.aa&&!xo(this.Ea().main,r)||this.Ia(r,i,!0,s),a}Ta(t){var i=this.props[o],e=t[o];return!ui(i)&&!ui(e)&&i!==e}Ia(t,i,e,r){var s=this.Ca(i);s.storageValue=r,i!==yo&&(s.persisted=e);try{s.fingerprint=this.Ra(t,i)}catch(t){s.fingerprint=void 0}}Ma(t,i,e){var r=!1;return bo.forEach((e=>{var s,n=null==(s=Wn(e))?void 0:s.storageGroup;if(!(i===yo&&this.aa&&n||i!==yo&&n!==i)){var o=e in t,a=this.Pa(e,o?t[e]:void 0),l=this.ua.has(e)?e in this.props:o;l===e in this.props&&xo(a,this.props[e])||(l?this.Aa(e,a,!1):this.Fa(e,!1),r=!0)}})),r&&e&&this.ca.forEach((t=>t())),r}Oa(){if(!this.sa)return!1;try{this.va=!1;var t,i=Ts.ni(this.ga),e=this.Ca(yo),r=!1,s=!1;if(i!==e.storageValue)if(ci(i))e.storageValue=null;else{if(t=So(i),this.va=!this.da&&this.Ta(t),this.va)return!1;s=this.Ma(t,yo,!1),!this.aa||xo(this.Ea().main,t)?this.Ia(t,yo,!0,i):e.storageValue=i,r=!0}return this.aa&&Hn.forEach((i=>{var e=Ts.ni(this.wa(i)),n=this.Ca(i),o=t||{},a=r&&bo.some((t=>{var e;return(null==(e=Wn(t))?void 0:e.storageGroup)===i&&t in o}));if(e!==n.storageValue||a){if(ci(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Ma(o,i,!1)||s));var l=So(e);s=this.Ma(l,i,!1)||s,this.Ia(l,i,!0,e)}})),s}catch(t){return!1}}Sa(t,i){this.ua.set(t,i);var e=Wn(t);null!=e&&e.volatile||(this.Ca((this.aa?null==e?void 0:e.storageGroup:void 0)||yo).fingerprint=void 0,this.La(t))}Da(){bo.forEach((t=>this.ua.set(t,!0)))}ba(){if(this.sa)try{var t=Ts.ni(this.ga),i=So(t);this.Ca(yo).storageValue=t,bo.forEach((t=>{var e,r=this.aa?null==(e=Wn(t))?void 0:e.storageGroup:void 0,s=r?Ts.ni(this.wa(r)):null;if(r){var n=this.Ca(r);n.storageValue=s,n.persisted=!ci(s)}var o=r&&!ci(s)?So(s):i;t in this.props?this.$a(t,o[t],this.props[t]):t in o&&this.Sa(t,!0)}))}catch(t){}}Pa(t,i){var r=this.ua.get(t);if(!r)return i;if(!0===r)return this.props[t];if(t===R){var s=new Set(oi(i)?i:[]),n=new Set(oi(this.props[t])?this.props[t]:[]);return r.forEach((t=>n.has(t)?s.add(t):s.delete(t))),Array.from(s)}var o=li(i)?e({},i):{},a=li(this.props[t])?this.props[t]:{};return r.forEach((t=>{t in a?o[t]=a[t]:delete o[t]})),o}$a(t,i,e){if(wo(t)){var r=this.ua.get(t);if(!0!==r){var s=i;if(this.sa)try{var n,o=this.aa?null==(n=Wn(t))?void 0:n.storageGroup:void 0,a=o?this.wa(o):this.ga;s=So(Ts.ni(a))[t]}catch(t){}var l=new Set(r||[]);if(t===R){if(!ui(i)&&!oi(i)||!ui(s)&&!oi(s)||!oi(e))return void this.Sa(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach((t=>{h.has(t)!==d.has(t)&&l.add(t)})),l.forEach((t=>{u.has(t)===d.has(t)&&l.delete(t)}))}else{if(!li(e))return void(xo(s,e)?this.ua.delete(t):this.Sa(t,!0));if(!ui(i)&&!li(i)||ui(i)&&hi(e)&&ui(s))return void this.Sa(t,!0);var v=li(i)?i:{},c=li(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach((t=>{t in v==t in e&&xo(v[t],e[t])||l.add(t)})),l.forEach((t=>{t in c==t in e&&xo(c[t],e[t])&&l.delete(t)}))}l.size?this.Sa(t,l):this.ua.delete(t)}}}Na(){var t,i=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return pi(i)&&i>0?i:0}qa(t){if(this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase())if(t)try{var i=As(t,this.gn.cookie_persisted_properties||[]),e=Ds(i,this.gn.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=$s.ni(this.ga)||void 0;s&&Ls(this.ga,s)===r&&(this.ja=r,this.Ba=s)}catch(t){}else try{var n=$s.ni(this.ga)||void 0;this.ja=n?Ls(this.ga,n):void 0,this.Ba=n}catch(t){}}syncCookieProperties(){return this.Ha(this.gn)}Ha(t,i){if(void 0===i&&(i=!1),this.xa&&!i||this.la||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=$s.ni(this.ga)||void 0}catch(t){}if(!e||e===this.Ba)return!1;var r,s=Ls(this.ga,e);try{r=Os(JSON.parse(e))}catch(t){return!1}if(($s.ni(this.ga)||void 0)!==e)return!1;this.ja=s,this.Ba=e;var n=js(this.ga,e),a=[...Fs,...n.properties],l={};if(Object.keys(r).forEach((t=>{var i=r[t];(ui(i)||ci(i)||""===i||t===Q&&i!==ct&&i!==ft)&&(l[t]=!0,delete r[t])})),hi(r))return!1;var u=o in r||r[Q]===ct||r[Q]===ft,d=this.props,v=d[o],c=d[Q],f=os({},d);[...Fs,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==Q)){var i=f[t];!n.isValid&&-1!==Fs.indexOf(t)&&(!1===i||0===i)||delete f[t]}})),this.props=os(f,r),bo.forEach((t=>{var i=t in this.props;t in d===i&&xo(d[t],this.props[t])||(i?this.$a(t,d[t],this.props[t]):this.Sa(t,!0))})),!u||Q in r||Q in this.props||this.Aa(Q,ct);var p=this.props[o],g=this.props[Q];return!u||p===v&&g===c||(this.da=!0,this.oa=!0,Us.ii(mo(this.ga),!0),this.Fa(N),this.Fa(R),this.Fa(F),this.Fa(O),this.Fa(A),this.Fa(M),this.Fa(X),this.Fa(Y),this.Fa(J),g===ct&&(c===ft||r[Q]===ct||!ui(v)&&p!==v)&&(ko(this.props,r),this.Fa(B)),g===ft?this.props.$user_id=p:delete this.props.$user_id,this.Fa(h)),!0}consumeCookieIdentityChange(){var t=mo(this.ga),i=this.oa||!!Us.ni(t);return this.oa=!1,i&&Us.ai(t),i}za(t){return void 0===t&&(t=!1),!(this.la||this.xa&&!t||!this.gn.cookieWinsOnConflict||"localstorage+cookie"!==this.gn.persistence.toLowerCase()||(this.la=!0,0))}Ua(){this.la&&(ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),delete this.na[yo],this.Va(!0))}Ga(t){if(void 0===t&&(t=!0),this.la)try{t?this.Ua():ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0)}finally{this.la=!1}}isDisabled(){return!!this.xa}ma(t){-1===_o.indexOf(t.persistence.toLowerCase())&&(es.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,r=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var r=[...Fs,...t];return e({},Ts,{si(t){try{var e,s={};try{e=$s.ni(t)||void 0,s=e?Os(JSON.parse(e)):{}}catch(t){}var n,a=JSON.parse(Ts.ni(t)||"{}");if(i){var l=js(t,e),h=[...Fs,...l.properties],u={};Object.keys(s).forEach((t=>{var i=s[t];ci(i)||""===i||t===Q&&i!==ct&&i!==ft||(u[t]=i)}));var d=o in u||u[Q]===ct||u[Q]===ft;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[Q])&&void 0!==v?v:ct;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==Q)){var i=a[t];!l.isValid&&-1!==Fs.indexOf(t)&&(!1===i||0===i)||delete a[t]}})),!d||Q in s||Q in a||(a[Q]=ct),!d||(o in u?u[o]:a[o])===c&&(Q in u?u[Q]:a[Q])===f||(Cs.forEach((t=>delete a[t])),u[Q]===ft&&o in u?a.$user_id=u[o]:delete a.$user_id,u[Q]!==ft&&(delete a[z],delete a[B]),delete a.__alias)}n=os(a,u)}else n=os(s,a);return Ts.ii(t,n),n}catch(t){}return null},ii(e,r,s,n,o,a){var l=Ts.ii(e,r,void 0,void 0,a);try{var h=As(r,t);if(Object.keys(h).length){if(i){var u=Rs(e),d=Ds(h,t);if($s.ii(u,d,s,n,o,a),$s.ni(u)!==JSON.stringify(d)){$s.ai(u,n);var v=As(r);return $s.ii(e,v,s,n,o,a),l}}$s.ii(e,h,s,n,o,a)}}catch(t){Ts.oi(t)}return l},ai(t,i){try{null==xt||xt.localStorage.removeItem(t),$s.ai(t,i),$s.ai(Rs(t),i)}catch(t){Ts.oi(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&Ts.ri()?(i=Ts,s=!0):"localstorage+cookie"===n&&r.ri()?(i=r,s=!0):"sessionstorage"===n&&Us.ri()?i=Us:"memory"===n?i=Bs:"cookie"===n&&$s.ri()?i=$s:r.ri()?(i=r,s=!0):i=$s.ri()?$s:Bs,this.sa=s,i}wa(t){return this.ga+"__"+t}ya(t){return this.sa&&!!t.split_storage}properties(){var t={};return ns(this.props,((i,e)=>{var r=Wn(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}})),t}load(t){if(void 0===t&&(t=!1),!this.xa||t){var i=this.gn.cookieWinsOnConflict&&"localstorage+cookie"===this.gn.persistence.toLowerCase(),e=i?Ts.si(this.ga):null,r={};if(i)try{ns(r=Os($s.si(this.ga)),((t,i)=>{(ui(t)||ci(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.Gs.si(this.ga);if(s&&(this.props=os({},s)),this.aa&&this.Za(),i&&s){var n,a,l=null==e?void 0:e[o],h=null!==(n=null==e?void 0:e[Q])&&void 0!==n?n:ct,u=s[o],d=null!==(a=s[Q])&&void 0!==a?a:ct;if(u!==l||d!==h){this.oa=!0,Us.ii(mo(this.ga),!0);var v=os({},this.props);Cs.forEach((t=>delete v[t])),d===ct&&(h===ft||r[Q]===ct||!ui(l)&&u!==l)&&(ko(v,r),delete v[B]),this.props=v;var c=new Set;Cs.forEach((t=>{var i,e=null==(i=Wn(t))?void 0:i.storageGroup;e&&c.add(e)})),c.forEach((t=>{var i={};ns(this.props,((e,r)=>{var s;(null==(s=Wn(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),hi(i)?(Ts.ai(this.wa(t)),this.na[t]={}):Ts.ii(this.wa(t),i)&&(this.na[t]={persisted:!0,fingerprint:this.Ra(i,t)})}))}}Us.ni(mo(this.ga))&&(this.oa=!0)}}Za(){for(var t of Hn){var i=Ts.si(this.wa(t));if(i&&!hi(i)){var e=this.Ca(t);e.persisted=!0,this.Qa(t)||(e.fingerprint=this.Ra(i,t)),this.Ja(t,i)||os(this.props,i)}}}Qa(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=Wn(i))?void 0:e.storageGroup)===t}))}Ja(t,i){var e=go[t];if(!e)return!1;var r=i[e],s=this.props[e];return pi(r)&&pi(s)&&s>r}refreshKey(t){var i;if(!this.xa){var e=this.aa?null==(i=Wn(t))?void 0:i.storageGroup:void 0,r=e?Ts.si(this.wa(e)):this.Gs.si(this.ga);if(r&&t in r)this.Aa(t,r[t]);else{if(e){var s=this.Gs.si(this.ga);if(s&&t in s)return void this.Aa(t,s[t])}this.Fa(t)}}}save(){if(!this.xa){var t=this.Na();t>0?ui(this.Wa)&&(this.Wa=setTimeout((()=>{this.Wa=void 0,this.Va()}),t)):this.Va()}}flush(){ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0,this.Va())}Va(t){if(void 0===t&&(t=!1),!(this.xa||this.la&&!t)){t||this.syncCookieProperties();var i=!t&&!this.ha;i||(this.va=!1);var e=!!i&&this.Oa();if(this.va)this.gn.debug&&es.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.aa)return this.Ka(),void(e&&this.ca.forEach((t=>t())));var r=this.Ya(this.Gs,this.ga,this.props,yo);"written"===r&&this.qa(this.props),"failed"!==r&&(this.ua.clear(),this.da=!1),e&&this.ca.forEach((t=>t()))}}}Ka(){var t=this,i=this.Ea(),e=i.main,r=i.groups,s=this.Ya(this.Gs,this.ga,e,yo);"written"===s&&this.qa(e),"failed"!==s&&(this.da=!1,bo.forEach((t=>{var i;null!=(i=Wn(t))&&i.storageGroup||this.ua.delete(t)})));var n=function(i){var e,s=r[i];if(hi(s)&&(null==(e=t.na[i])||!e.persisted))return bo.forEach((e=>{var r;(null==(r=Wn(e))?void 0:r.storageGroup)===i&&t.ua.delete(e)})),1;var n=t.Ya(Ts,t.wa(i),s,i);"failed"!==n&&bo.forEach((e=>{var r=Wn(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.ua.delete(e)}))};for(var o of Hn)n(o)}Ea(){var t={},i={flags:{},surveys:{}};return ns(this.props,((e,r)=>{var s,n=null==(s=Wn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Ra(t,i){if(i===yo)return JSON.stringify(t)+"|"+this.Xa+"|"+this.eo+"|"+this.io;var e={};return ns(t,((t,i)=>{var r;e[i]=null!=(r=Wn(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}Ya(t,i,e,r){var s,n=this.Ca(r);if(r!==yo&&!n.dirty&&!ui(n.fingerprint))return"skipped";try{if((s=this.Ra(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ii(i,e,this.Xa,this.eo,this.io,this.gn.debug)?(n.dirty=!1,r!==yo&&(n.persisted=!0),ui(s)||(n.fingerprint=s),this.sa&&(n.storageValue=Ts.ni(i)),"written"):(this.gn.debug&&es.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.Da(),ui(this.Wa)||(clearTimeout(this.Wa),this.Wa=void 0),this.Gs.ai(this.ga,!1),this.Gs.ai(this.ga,!0),!e&&this.fa)for(var r of Hn)Ts.ai(this.wa(r));e?delete this.na[yo]:this.na={},this.ja=void 0,this.Ba=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(li(t)){this.syncCookieProperties(),ui(i)&&(i="None"),this.Xa=ui(e)?this.ro:e;var r=!1;if(ns(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Aa(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(li(t)){this.syncCookieProperties(),this.Xa=ui(i)?this.ro:i;var e=!1;if(ns(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||li(i)||oi(i))&&(this.Aa(r,i),e=!0)})),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.Fa(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==Et?void 0:Et.URL;if(t!==this.pa){var i=no(this.gn.custom_campaign_params,this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties);hi(us(i))||this.register(i),this.pa=t}}update_search_keyword(){var t;this.register((t=null==Et?void 0:Et.referrer)?ao(t):{})}update_referrer_info(){var t;this.register_once({$referrer:uo(),$referring_domain:null!=Et&&Et.referrer&&(null==(t=Jn(Et.referrer))?void 0:t.host)||ho},void 0)}set_initial_person_info(){this.props[it]||this.props[et]||this.register_once({[rt]:vo(this.gn.mask_personal_data_properties,this.gn.custom_personal_data_properties,this.gn.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};ns([et,it],(i=>{var e=this.props[i];e&&ns(e,(function(i,e){t["$initial_"+ii(e)]=i}))}));var i=this.props[rt];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=co(t,i),r={};return ns(e,(function(t,i){r["$initial_"+ii(i)]=t})),r}(i,this.gn.disable_capture_url_hashes);os(t,e)}return t}safe_merge(t){return ns(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,r){var s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!r,h=!!this.xa&&!l;l||this.Ha(i,h),this.gn=t,!l&&(s||n||a)&&(this.ja=void 0,this.Ba=void 0,this.Ha(e({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.ma(t):this.Gs,d=this.ya(t),v=o||d!==this.aa,c=!l&&(v||t.cross_subdomain_cookie!==this.eo||t.secure_cookie!==this.io)&&this.za(h);this.ha=v;try{if(this.ro=this.Xa=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.Gs=u,this.aa=d,this.props=f,this.save()}else a&&(this.Gs=u,l||(delete this.na[yo],this.Va()))}finally{this.ha=!1,c&&this.Ga()}}set_disabled(t){this.xa=t,this.xa?this.remove():this.save()}set_cross_subdomain(t){t!==this.eo&&(this.eo=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.io&&(this.io=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[u]||{};e[t]=i,this.Aa(u,e),this.save()}remove_event_timer(t){var i=this.props[u]||{},e=i[t];return ui(e)||(delete i[t],this.Aa(u,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Aa(t,i),this.save()}Aa(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&(t!==o&&t!==Q||s===i||(this.da=!0),this.$a(t,s,i),null!=(r=Wn(t))&&r.volatile||this.La(t))}Fa(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(wo(t)&&this.Sa(t,!0),this.La(t))}La(t){var i,e=null==(i=Wn(t))?void 0:i.storageGroup;e&&(this.Ca(e).dirty=!0)}Ca(t){return this.na[t]||(this.na[t]={})}}function $o(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&ai(e.then)&&e.then(void 0,(()=>{}))}}}}var Po="gzip-js",To="base64",Co="events",Fo="cancelEvents",Ro="survey shown",Io="survey dismissed",Oo="survey sent",Ao="popover",Mo=rs("[RateLimiter]");class Do{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Mo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Mo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(tt))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(pi(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.no(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(tt,a),{isRateLimited:l,remainingTokens:a.tokens}}so(t){var i=this.instance.config.property_denylist;return!oi(i)||!i.includes(t)}ao(){var t;if(this.so("$current_url")&&this.so("$pathname")&&null!=$t&&$t.pathname)return""+(null!==(t=$t.origin)&&void 0!==t?t:"")+$t.pathname}no(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ao(),o=this.so("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var jo=rs("[RemoteConfig]");class Lo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}oo(t){var i,e;null!=(i=At.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=At.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}lo(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return jo.info("Using preloaded remote config",this.remoteConfig),void this.uo(this.remoteConfig);if(this._instance.ho())return void jo.warn("Remote config is disabled. Falling back to local config.");this.oo((t=>{if(!t)return jo.info("No config found after loading remote JS config. Falling back to JSON."),void this.lo((t=>{this.uo(t.json,t)}));this.uo(t)}))}catch(t){jo.error("Error loading remote config",t),this.uo()}}uo(t,i){!t&&i&&(0===i.statusCode?i.error||jo.warn("Failed to fetch remote config from PostHog."):jo.error("Failed to fetch remote config from PostHog."));try{this._instance.uo(t?{ok:!0,config:t}:{ok:!1})}catch(t){jo.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){jo.error("Error loading feature flags",t)}}}var No=Uint8Array,Bo=Uint16Array,zo=Uint32Array,Uo=new No([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]),Ho=new No([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]),qo=new No([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vo=function(t,i){for(var e=new Bo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new zo(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Wo=Vo(Uo,2),Go=Wo[1];Wo[0][28]=258,Go[258]=28;for(var Jo=Vo(Ho,0)[1],Ko=new Bo(32768),Yo=0;32768>Yo;++Yo){var Xo=(43690&Yo)>>>1|(21845&Yo)<<1;Ko[Yo]=((65280&(Xo=(61680&(Xo=(52428&Xo)>>>2|(13107&Xo)<<2))>>>4|(3855&Xo)<<4))>>>8|(255&Xo)<<8)>>>1}var Qo=function(t,i,e){for(var r=t.length,s=0,n=new Bo(i);r>s;++s)++n[t[s]-1];var o,a=new Bo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Bo(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Ko[d]>>>l]=h}else for(o=new Bo(r),s=0;r>s;++s)o[s]=Ko[a[t[s]-1]++]>>>15-t[s];return o},Zo=new No(288);for(Yo=0;144>Yo;++Yo)Zo[Yo]=8;for(Yo=144;256>Yo;++Yo)Zo[Yo]=9;for(Yo=256;280>Yo;++Yo)Zo[Yo]=7;for(Yo=280;288>Yo;++Yo)Zo[Yo]=8;var ta=new No(32);for(Yo=0;32>Yo;++Yo)ta[Yo]=5;var ia=Qo(Zo,9,0),ea=Qo(ta,5,0),ra=function(t){return(t/8>>0)+(7&t&&1)},sa=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Bo?Bo:t instanceof zo?zo:No)(e-i);return r.set(t.subarray(i,e)),r},na=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},oa=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},aa=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new No(0),0];if(1==s){var o=new No(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Bo(v+1),f=la(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;i>c[y]?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new No(c),f]},la=function(t,i,e){return-1==t.s?Math.max(la(t.l,i,e+1),la(t.r,i,e+1)):i[t.s]=e},ha=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Bo(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},ua=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},da=function(t,i,e){var r=e.length,s=ra(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},va=function(t,i,e,r,s,n,o,a,l,h,u){na(i,u++,e),++s[256];for(var d=aa(s,15),v=d[0],c=d[1],f=aa(n,15),p=f[0],g=f[1],_=ha(v),m=_[0],y=_[1],b=ha(p),w=b[0],x=b[1],S=new Bo(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=aa(S,7),P=E[0],T=E[1],C=19;C>4&&!P[qo[C-1]];--C);var F,R,I,O,A=h+5<<3,M=ua(s,Zo)+ua(n,ta)+o,D=ua(s,v)+ua(n,p)+o+14+3*C+ua(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(M>=A&&D>=A)return da(i,u,t.subarray(l,l+h));if(na(i,u,1+(M>D)),u+=2,M>D){F=Qo(v,c,0),R=v,I=Qo(p,g,0),O=p;var j=Qo(P,T,0);for(na(i,u,y-257),na(i,u+5,x-1),na(i,u+10,C-4),u+=14,k=0;C>k;++k)na(i,u+3*k,P[qo[k]]);u+=3*C;for(var L=[m,w],N=0;2>N;++N){var B=L[N];for(k=0;B.length>k;++k)na(i,u,j[z=31&B[k]]),u+=P[z],z>15&&(na(i,u,B[k]>>>5&127),u+=B[k]>>>12)}}else F=ia,R=Zo,I=ea,O=ta;for(k=0;a>k;++k)if(r[k]>255){var z;oa(i,u,F[257+(z=r[k]>>>18&31)]),u+=R[z+257],z>7&&(na(i,u,r[k]>>>23&31),u+=Uo[z]);var U=31&r[k];oa(i,u,I[U]),u+=O[U],U>3&&(oa(i,u,r[k]>>>5&8191),u+=Ho[U])}else oa(i,u,F[r[k]]),u+=R[r[k]];return oa(i,u,F[256]),u+R[256]},ca=new zo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fa=function(){for(var t=new zo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),pa=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ga(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=fa[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new No(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=da(l,h,t.subarray(u,d)):(l[u]=!0,h=da(l,h,t.subarray(u,o)))}else{for(var v=ca[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Bo(32768),_=new Bo(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new zo(25e3),x=new Bo(288),S=new Bo(32),k=0,E=0,P=(u=0,0),T=0,C=0;o>u;++u){var F=b(u),R=32767&u,I=_[F];if(g[R]=I,_[F]=R,u>=T){var O=o-u;if((k>7e3||P>24576)&&O>423){h=va(t,l,0,w,x,S,E,P,C,u-C,h),P=k=E=0,C=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)S[A]=0}var M=2,D=0,j=f,L=R-I&32767;if(O>2&&F==b(u-L))for(var N=Math.min(c,O)-1,B=Math.min(32767,u),z=Math.min(258,O);B>=L&&--j&&R!=I;){if(t[u+M]==t[u+M-L]){for(var U=0;z>U&&t[u+U]==t[u+U-L];++U);if(U>M){if(M=U,D=L,U>N)break;var H=Math.min(L,U-2),q=0;for(A=0;H>A;++A){var V=u-L+A+32768&32767,W=V-g[V]+32768&32767;W>q&&(q=W,I=V)}}}L+=(R=I)-(I=g[R])+32768&32767}if(D){w[P++]=268435456|Go[M]<<18|Jo[D];var G=31&Go[M],J=31&Jo[D];E+=Uo[G]+Ho[J],++x[257+G],++S[J],T=u+M,++k}else w[P++]=t[u],++x[t[u]]}}h=va(t,l,!0,w,x,S,E,P,C,u-C,h)}return sa(a,0,r+ra(h)+s)}(n=t,null==(o=i).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)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&pa(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),pa(h,u-8,e.d()),pa(h,u-4,r),h}var _a=!!Tt||!!Pt,ma="text/plain",ya=!1,ba=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==i)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},wa=function(t,i,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=e({},i),h=null!==(s=null==a?void 0:a.split("&").map((t=>{var i,e=t.split("="),s=e[0],n=r&&null!==(i=l[s])&&void 0!==i?i:e[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ns(t,(function(t,i){ui(t)||ui(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},xa=t=>{if(t.do)return t.do;var i=t.data,e=t.compression;if(i){if(e===Po){var r=ga(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new No(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new No(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return sa(r,0,s)}(Gn(i)),{mtime:0});return{contentType:ma,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===To){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(Gn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Gn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Gn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Sa=t=>{var i,r,s=()=>"sendBeacon"===t.transport?{url:wa(t.url,{compression:To}),encodedBody:xa(e({},t,{compression:To,do:void 0}))}:{url:ba(t.url,"compression"),encodedBody:xa(e({},t,{compression:void 0,do:void 0}))};try{i=xa(t)}catch(i){if(Ye(t.compression,Kn(t.url,"compression")))return es.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&Ye(t.compression,Kn(t.url,"compression"))&&!((r=i.body)instanceof ArrayBuffer?Ke(new Uint8Array(r)):ArrayBuffer.isView(r)&&Ke(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(ya=!0,s()):{url:t.url,encodedBody:i}},ka=t=>{try{return Sa(t)}catch(i){return es.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Ea=function(){var t=i((function*(t){var i=Gn(t.data),r=yield function(t,i,e){return tr.apply(this,arguments)}(i,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return e({},t,{do:{contentType:ma,body:n,estimatedSize:n.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),$a=/Failed to fetch|NetworkError|Load failed/i,Pa=t=>"TypeError"===(null==t?void 0:t.name)&&$a.test((null==t?void 0:t.message)||""),Ta=t=>{var i=ka(t);if(i){var r=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;ns(t.headers,(function(t,i){h.append(i,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Ct){var v=new Ct;u={signal:v.signal,timeout:setTimeout((()=>{var i;d=!0,v.abort(Ue("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))}),t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Pa(i)?es.warn(i):es.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Pt(r,e({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.vo&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){es.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},Ca=t=>{try{var i,r=Sa(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(kt.sendBeacon(s,h))return;var u=oi(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(oi(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>oi(t.data)?i:e({},t.data,{batch:i});return Ca(e({},t,{data:v(u.slice(0,d))})),void Ca(e({},t,{data:v(u.slice(d))}))}es.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ta(e({},t,{vo:!0}))}catch(t){es.warn("Beacon send failed",t)}},Fa=(t,i,r,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return wa(r===Po?ba(t,"compression"):t,e({},n?{[n]:Date.now().toString()}:{},r===Po?{}:{compression:r}))},Ra=[];Pt&&Ra.push({transport:"fetch",method:Ta}),Tt&&Ra.push({transport:"XHR",method(t){var i=ka(t);if(i){var e=new Tt,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;ns(t.headers,(function(t,i){e.setRequestHeader(i,t)})),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=kt&&kt.sendBeacon&&Ra.push({transport:"sendBeacon",method:Ca});var Ia=3e3;class Oa{constructor(t,i){this.co=!0,this.fo=[],this.po=Ci((null==i?void 0:i.flush_interval_ms)||Ia,250,5e3,es.createLogger("flush interval"),Ia),this.mo=t}enqueue(t){this.fo.push(t),this.yo||this.bo()}unload(){this._o();var t=this.fo.length>0?this.wo():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ko(e({},t,{transport:"sendBeacon"}))}))}enable(){this.co=!1,this.bo()}bo(){var t=this;this.co||(this.yo=setTimeout((()=>{if(this._o(),this.fo.length>0){var i=this.wo(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&oi(e.data)&&ns(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.ko(e)};for(var r in i)e()}}),this.po))}ko(t){try{this.mo(t)}catch(t){es.error(t)}}_o(){clearTimeout(this.yo),this.yo=void 0}wo(){var t={};return ns(this.fo,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;ui(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.fo=[],t}}var Aa=["retriesPerformedSoFar"];class Ma{constructor(t){this.So=!1,this.xo=3e3,this.fo=[],this._instance=t,this.fo=[],this.Co=!0,!ui(xt)&&"onLine"in xt.navigator&&(this.Co=xt.navigator.onLine,this.To=()=>{this.Co=!0,this.Mo()},this.Eo=()=>{this.Co=!1},cs(xt,"online",this.To),cs(xt,"offline",this.Eo))}get length(){return this.fo.length}retriableRequest(t){var i=t.retriesPerformedSoFar,s=r(t,Aa);gi(i)&&(s.url=wa(s.url,{retry_count:i})),this._instance._send_request(e({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.es(e({retriesPerformedSoFar:i},s));0===t.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!=i?i:0)+" retries.")}null==s.callback||s.callback(t)}}))}es(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.fo.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),es.warn(s),this.So||(this.So=!0,this.Io())}Io(){if(this.Ro&&clearTimeout(this.Ro),0===this.fo.length)return this.So=!1,void(this.Ro=void 0);this.Ro=setTimeout((()=>{this.Co&&this.fo.length>0&&this.Mo(),this.Io()}),this.xo)}Mo(){var t=Date.now(),i=[],e=this.fo.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.fo=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Ro&&(clearTimeout(this.Ro),this.Ro=void 0),this.So=!1,ui(xt)||(this.To&&(xt.removeEventListener("online",this.To),this.To=void 0),this.Eo&&(xt.removeEventListener("offline",this.Eo),this.Eo=void 0)),this.fo)){var i=t.requestOptions;try{this._instance._send_request(e({},i,{transport:"sendBeacon"}))}catch(t){es.error(t)}}this.fo=[]}}class Da{constructor(t){this.Po=()=>{var t,i,e,r;this.Ao||(this.Ao={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Ao.lastScrollY=Math.ceil(n),this.Ao.maxScrollY=Math.max(n,null!==(t=this.Ao.maxScrollY)&&void 0!==t?t:0),this.Ao.maxScrollHeight=Math.max(o,null!==(i=this.Ao.maxScrollHeight)&&void 0!==i?i:0),this.Ao.lastContentY=a,this.Ao.maxContentY=Math.max(a,null!==(e=this.Ao.maxContentY)&&void 0!==e?e:0),this.Ao.maxContentHeight=Math.max(l,null!==(r=this.Ao.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Fo(){return this._instance.config.scroll_root_selector}getContext(){return this.Ao}resetContext(){var t=this.Ao;return setTimeout(this.Po,0),t}startMeasuringScrollPosition(){cs(xt,"scroll",this.Po,{capture:!0}),cs(xt,"scrollend",this.Po,{capture:!0}),cs(xt,"resize",this.Po)}scrollElement(){if(!this.Fo)return null==xt?void 0:xt.document.documentElement;var t=oi(this.Fo)?this.Fo:[this.Fo];for(var i of t){var e=null==xt?void 0:xt.document.querySelector(i);if(e)return e}}Oo(t){var i="y"===t?"scrollTop":"scrollLeft";if(this.Fo){var e=this.scrollElement();return e&&e[i]||0}return xt?"y"===t?xt.scrollY||xt.pageYOffset||xt.document.documentElement.scrollTop||0:xt.scrollX||xt.pageXOffset||xt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Oo("y")}scrollX(){return this.Oo("x")}}var ja=t=>vo(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class La{constructor(t,i,e,r){this.Tt=t=>{var i=this.Lo();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Do(this._instance)};this.$o.register({[Z]:e})}},this._instance=t,this.No=i,this.$o=e,this.Do=r||ja,this.No.onSessionId(this.Tt)}Lo(){return this.$o.props[Z]}getSetOnceProps(){var t,i=null==(t=this.Lo())?void 0:t.props;return i?"r"in i?co(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return ns(us(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+ii(e)]=i})),t}}class Na{on(t,i){return this.qo[t]||(this.qo[t]=[]),this.qo[t].push(i),()=>{this.qo[t]=this.qo[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.qo[t]||[])e(i);for(var r of this.qo["*"]||[])r(t,i)}constructor(){this.qo={}}}var Ba=rs("[SessionId]"),za=864e5;class Ua{on(t,i){return this.jo.on(t,i)}constructor(t,i,e){var r;if(this.Bo=null,this.Ho=null,this.zo=[],this.Uo=void 0,this.Wo=!1,this.jo=new Na,this.Vo=(t,i)=>!(!gi(t)||!gi(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===vt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.gn=t.config,this.$o=t.persistence,this.It=void 0,this.Pe=void 0,this._sessionStartTimestamp=null,this.Go=void 0,this._sessionActivityTimestamp=null,this.Zo=i||ws,this.Qo=e||ws;var s=this.gn.persistence_name||this.gn.token;if(this._sessionTimeoutMs=1e3*Ci(this.gn.session_idle_timeout_seconds||1800,60,36e3,Ba.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Jo(),this.Ko="ph_"+s+"_window_id",this.Yo="ph_"+s+"_primary_window_exists",this.Xo()){var n=Us.si(this.Ko),o=Us.si(this.Yo);n&&!o?this.It=n:Us.ai(this.Ko),Us.ii(this.Yo,!0)}null!=(r=this.gn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.gn.bootstrap.sessionID),this.tl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ui(this.zo)&&(this.zo=[]),this.zo.push(t),this.Pe&&t(this.Pe,this.It),()=>{this.zo=this.zo.filter((i=>i!==t))}}Xo(){return"memory"!==this.gn.persistence&&!this.$o.xa&&Us.ri()}el(t){t!==this.It&&(this.It=t,this.Xo()&&Us.ii(this.Ko,t))}il(){return this.It?this.It:this.Xo()?Us.si(this.Ko):null}rl(t){var i=this.Bo;return!ci(i)&&!ci(t)&&5e3>Math.abs(t-i)}nl(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Pe||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Pe=t,s&&!r||s&&this.rl(i)||(this.Bo=i,this.$o.register({[T]:[i,t,e]}))}sl(){var t,i=null==(t=this.gn)?void 0:t.persistence_save_debounce_ms;return gi(i)&&i>0}al(){this.sl()?this.$o.refreshKey(T):(this.$o.flush(),this.$o.load())}ol(){var t;if(!ci(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Bo){this.al();var i=this.ll();i[1]===this.Pe&&i[2]===this._sessionStartTimestamp&&(this.Bo=this._sessionActivityTimestamp,this.$o.register({[T]:[this._sessionActivityTimestamp,null!==(t=this.Pe)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.$o.flush())}}ul(){var t=this.ll()[0],i=gi(t)?t:0,e=gi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}hl(t){return this.al(),this.Vo(t,this.ul())}ll(){var t=this.$o.props[T];return oi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Bo=null,this.Go=void 0,clearTimeout(this.dl),this.dl=void 0,this.nl(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Ba.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ba.error("Invalid sessionID in bootstrap",t)}}(t);return!ui(e)&&(i?this.Go={sessionId:t,sessionStartTimestamp:e}:this.nl(t,(new Date).getTime(),e),!0)}destroy(){this.Wo=!0,this.ol(),clearTimeout(this.dl),this.dl=void 0,this.Uo&&xt&&(xt.removeEventListener(_t,this.Uo,{capture:!1}),this.Uo=void 0),this.zo=[]}tl(){this.Uo=()=>{this.ol(),this.Xo()&&Us.ai(this.Yo)},cs(xt,_t,this.Uo,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.gn.cookieless_mode===vt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Pe;if(e)this.Ho=r;else if(ci(this.Ho)||this.Ho>r||r-this.Ho>=1e3){var n,o;null==(n=(o=this.$o).syncCookieProperties)||n.call(o),this.Ho=r}var a=this.ll(),l=a[1],h=a[2],u=!ui(s)&&l!==s,d=this.ul(),v=this.il(),c=this.Go,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>za),p=c?f:gi(h)&&Math.abs(r-h)>za,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.Vo(r,d);if(b){(b=this.hl(r))||Ba.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.ll();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.Zo(),v=this.Qo(),Ba.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.Go=void 0,g=!0}else v||(v=this.Qo(),g=!0),(_=_||l!==y)&&(Ba.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=gi(d)&&t&&!p?d:r,k=gi(h)?h:(new Date).getTime();this.el(v),this.nl(l,S,k),t||this.Jo();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.zo.forEach((t=>t(l,v,E))),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}Jo(){this.Wo||(clearTimeout(this.dl),this.dl=setTimeout((()=>{if(!this.Wo)if(this.hl((new Date).getTime())){var t=this.Pe;this.resetSessionId(),this.jo.emit("forcedIdleReset",{idleSessionId:t})}else this.Jo()}),1.1*this.sessionTimeoutMs))}}var Ha=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&Qt(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Qt(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function qa(){return(qa=i((function*(){var t=null==kt?void 0:kt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return di(e)&&e.length>0?e:void 0}catch(t){return void es.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Va(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Wa=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},Ga=t=>t.toLowerCase(),Ja={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Wa(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Wa(i,t))))),icontains:(t,i)=>i.map(Ga).some((i=>t.map(Ga).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Ga).every((i=>t.map(Ga).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))};function Ka(t,i){return!t||Object.entries(t).every((t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=Ja[e.operator];return!!s&&s(e.values,[String(r)])}))}function Ya(t,i,e){return Gn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Xa="custom",Qa="i.posthog.com",Za=/^\/static\//,tl=["/s/","/e/","/i/"];class il{constructor(t){this.vl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Qa,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.vl[this.apiHost]||(this.vl[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":Xa),this.vl[this.apiHost]}cl(t){if(Za.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}fl(t){var i=Jn(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}pl(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Jn(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&tl.some((t=>0===i.indexOf(t)))){var a=this.fl(r);if(a){var l,h=this.apiHost,u=this.gl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.gl=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.gl,e=this.fl(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.pl(t,i,this.uiHost+i);if("flags"===t)return this.pl(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.cl(i);if(e)return this.pl(t,i,""+e+i)}if(this.region===Xa)return this.pl(t,i,this.apiHost+i);var r=Qa+i;switch(t){case"assets":return this.pl(t,i,"https://"+this.region+"-assets."+r);case"api":return this.pl(t,i,"https://"+this.region+"."+r)}}}var el=rs("[Surveys]"),rl="seenSurvey_",sl=t=>{try{var i=(t=>((t,i)=>""+t+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(rl,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){el.error("Failed to persist survey seen state",t)}},nl=["popover","widget","api"],ol={ignoreConditions:!1,ignoreDelay:!1,displayType:Ao},al=rs("[PostHog ExternalIntegrations]"),ll={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class hl{constructor(t){this._instance=t}Ks(t,i){var e;null==(e=At.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return al.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=At.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.Ks(ll[n],(()=>{var i;null==(i=At.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)})),!o&&null!=(r=At.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=At.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}}class ul{constructor(t,i){this.A=t,this.$s=i,this.ml=new Map,this.Fs=!1}add(t){var e=this;return i((function*(){if(e.Fs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.ml.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.ml.set(t.name,t);try{var i=t.setup(e.$s);i&&(yield i)}catch(i){var r=e.ml.get(t.name)===t;r&&e.ml.delete(t.name),e.A.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.yl(t)}}))()}getExtension(t){return this.ml.get(t)}dispose(){if(!this.Fs){this.Fs=!0;var t=Array.from(this.ml.values()).reverse();for(var i of(this.ml.clear(),t))this.yl(i)}}yl(t){try{var i=null==t.dispose?void 0:t.dispose();i&&ai(i.then)&&i.then(void 0,(i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class dl{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);ui(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}}var vl="extensionsRemoteConfig";class cl{constructor(t){this.Fs=!1,this.instance=t,this.A=es,this.bl=t._l,this.kv=new dl(t),this.onEvent=t=>$o(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Fs)return $o((()=>{}));var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.wl.on(vl,i);return this.bl&&i(this.bl),$o(e)},this.kl=new ul(es.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(a))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(a);return"string"==typeof t?t:void 0}get library(){return{name:s.LIB_NAME,version:s.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.kl.add(t)}getExtension(t){return this.kl.getExtension(t)}capture(t,e,r){var s=this;return i((function*(){r?s.instance.capture(t,e,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return $o(this.instance.Sl(t))}handleRemoteConfig(t){this.Fs||(this.bl=t,this.instance.wl.emit(vl,t))}sendRequest(t,e){var r=this;return i((function*(){var i;void 0===e&&(e={});var s=r.instance.requestRouter.endpointFor(null!==(i=e.target)&&void 0!==i?i:"api",t),n={method:e.method,url:e.query?wa(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?Bt.Base64:void 0,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(r.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,r.instance._send_request(n)}))}))()}dispose(){this.Fs||(this.Fs=!0,this.kl.dispose())}}var fl={},pl=0,gl=()=>{},_l='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ml="Surveys module not available",yl="sanitize_properties is deprecated. Use before_send instead",bl="Invalid value for property_denylist config: ",wl=["token","distinct_id",ot],xl="posthog",Sl=!_a&&-1===(null==Rt?void 0:Rt.indexOf("MSIE"))&&-1===(null==Rt?void 0:Rt.indexOf("Mozilla")),kl=t=>{var i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},El=t=>{var i;return e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:vs(null==Et?void 0:Et.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:gl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:$t&&di(null==$t?void 0:$t.search)&&-1!==$t.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,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==xt||null==(i=xt.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){es.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:pt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Ia},error_tracking:{},_onCapture:gl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:cn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:kl(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},$l=[["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"]],Pl=t=>{var i={};for(var e of $l){var r=e[0],s=e[1];ui(t[r])||(i[s]=t[r])}var n=os({},i,t),o=t.__preview_external_dependency_versioned_paths;return ui(o)||(ui(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),di(o)&&ui(t.asset_host)&&(n.asset_host=o)),oi(t.property_blacklist)&&(ui(t.property_denylist)?n.property_denylist=t.property_blacklist:oi(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:es.error(bl+t.property_denylist)),n};class Tl{constructor(){this.__forceAllowLocalhost=!1}get xl(){return this.__forceAllowLocalhost}set xl(t){es.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Cl{Cl(t){if(t){var i=this.ml.indexOf(t);-1!==i&&this.ml.splice(i,1)}}Tl(t,i){return this.Cl(t),this.ml.push(i),null==i.initialize||i.initialize(),i}Ml(){return this.config.cookieless_mode===vt||this.config.cookieless_mode===dt&&this.consent.isRejected()}El(){if(!this.Il&&!this.config.segment&&!this.Ml()){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Rl||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', or keep this persistence and pass a stable ID through bootstrap.distinctID."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, or keep persistence disabled and pass a stable ID through bootstrap.distinctID."),this.Il=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. "+e)))}}Pl(){if(!this.Ml()&&this.get_distinct_id()===nt){var t=this.persistence;if(t){this.Al()||t.load(!0);var i=this.get_distinct_id();if(!i||i===nt){var e=this.config.get_device_id(ws());this.register({distinct_id:e,$device_id:e}),t.set_property(Q,ct)}this.Fl()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Tl,this.Ol=!1,this.version=s.LIB_VERSION,this.Ll=new Set,this.Dl="",this.wl=new Na,this.ml=[],this.$l=[],this.Rl=!1,this.Il=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=El(),this.SentryIntegration=zn,this.sentryIntegration=t=>function(t,i){var e=Bn(t,i);return{name:Nn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nl=!1,this.ql=null,this.jl=null,this.Bl=null,this.scrollManager=new Da(this),this.pageViewManager=new Un(this),this.rateLimiter=new Do(this),this.requestRouter=new il(this),this.consent=new Hs(this),this.externalIntegrations=new hl(this);var i=null!==(t=Cl.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=di(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=di(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>es.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==xl){var r,s=null!==(r=fl[e])&&void 0!==r?r:new Cl;return s._init(t,i,e),fl[e]=s,fl[xl][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var n,o,a;void 0===i&&(i={});var h,u=di(t)?t.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==(h=this.config)?void 0:h.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=El(i.defaults),i.debug=this.Hl(i.debug),this.zl=i,this.Ul=[],i.person_profiles?this.jl=i.person_profiles:i.process_person&&(this.jl=i.process_person);var d=El(i.defaults),v=Pl(i),c=os({},d,v,{name:r,token:u});li(d.rageclick)&&li(v.rageclick)&&(c.rageclick=os({},d.rageclick,v.rageclick)),li(d.session_recording)&&li(v.session_recording)&&(c.session_recording=os({},d.session_recording,v.session_recording)),this.set_config(c),this.config.on_xhr_error&&es.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Po;var f=this.Al();if(this.persistence=new Eo(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Eo(e({},this.config,{persistence:"sessionStorage"}),f,!1),this.Dl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&Us.ri()){var p=Us.si(this.Dl);oi(p)&&p.forEach((t=>{di(t)&&this.Ll.add(t)}))}else Us.ai(this.Dl);var g=e({},this.persistence.props),_=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Wl=new Oa((t=>this.Vl(t)),this.config.request_queue_config),this.Gl=new Ma(this),this.__request_queue=[];var m=this.Ml();m||(this.sessionManager=new Ua(this),this.sessionPropsManager=new La(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Zl()}))),this.Ql(),this.config.__preview_deferred_init_extensions?(es.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Jl(m)}),0)):(es.info("Initializing extensions synchronously"),this.Jl(m)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&es.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:g,s:_}),!this.config.identity_distinct_id||null!=(n=i.bootstrap)&&n.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var y=null==(o=i.bootstrap)?void 0:o.distinctID;if(this.Rl=!!y&&!vi(y),void 0!==(null==(a=i.bootstrap)?void 0:a.distinctID)){var b=i.bootstrap.distinctID,w=this.get_distinct_id(),x=this.persistence.get_property(Q);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==b&&x===ct)this.identify(b);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==b&&x===ft)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 S=this.config.get_device_id(ws()),k=i.bootstrap.isIdentifiedID?S:b;this.persistence.set_property(Q,i.bootstrap.isIdentifiedID?ft:ct),this.register({distinct_id:b,$device_id:k})}}if(m)this.register_once({distinct_id:nt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(ws());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Q,ct)}return cs(xt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||ws();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Q,ft)),i()},s=e.user();"then"in s&&ai(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Ln.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Ln.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Ln.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,mt),identify:t=>i(t,bt),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.Kl())):this.Kl(),ai(this.config._onCapture)&&this.config._onCapture!==gl&&(es.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),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 qa.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(gl),this}Yl(t){var i=t;return di(i.name)&&ai(i.setup)}Xl(t,i){this.Yl(t)?i.push((()=>{this.tu().add(t).catch((()=>null==t.dispose?void 0:t.dispose())).catch((i=>{es.error('Failed to dispose browser extension "'+t.name+'"',i)}))})):this.ml.push(t)}Ql(){var t,i,e,r,s,n,o=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(e=Cl.__defaultExtensionClasses)?void 0:e.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.eu)||r.call(this),this.eu=void 0,this.featureFlags=new o(this)),ai(this.featureFlags.onReloading)&&ai(this.featureFlags.setup)?this.eu||(this.eu=this.featureFlags.onReloading((()=>{this.wl.emit("featureFlagsReloading",!0)})),this.tu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}Jl(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},Cl.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.ml.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.ml.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ml.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.ml.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.ml.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Xl(this.autocapture=new u.autocapture(this),d),u.surveys&&this.Xl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.Xl(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this),d),u.metrics&&this.ml.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.ml.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.ml.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ml.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ml.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ml.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ml.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Dn)),u.toolbar&&this.ml.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.ml.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.ml.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.iu){var t=this.iu;this.iu=void 0,this.ml.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.ru(d,h)}ru(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ru(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){es.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[at]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[lt]:r}),this.config.__preview_deferred_init_extensions&&es.info("PostHog extensions initialized ("+r+"ms)")}uo(t){var i;if(!Et||!Et.body)return es.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.uo(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.iu=t),this._l=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=Zt(r.supportedCompression,Po)?Po:Zt(r.supportedCompression,To)?To:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.jl?this.jl:pt}),null==(i=this.nu)||i.handleRemoteConfig(t),this.ml.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Kl(){try{this.config.loaded(this)}catch(t){es.critical("`loaded` function failed",t)}if(this.su(),this.config.internal_or_test_user_hostname&&null!=$t&&$t.hostname){var t=$t.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ml())&&this.au()}),1),this.ou=new Lo(this),this.ou.load()}su(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Wl)||t.enable())}_dom_loaded(){this.is_capturing()&&ss(this.__request_queue,(t=>this.Vl(t))),this.__request_queue=[],this.su()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.lu()&&this.capture(yt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Wl)||r.unload(),null==(s=this.Gl)||s.unload()):this.lu()&&this.capture(yt,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Sl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=e({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(ui(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,r,s,n=e({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&ui(n.compression)&&n.data&&(n.compression=To),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(oi(o=n.data)?o:[o]).map((t=>e({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),oi(t)?t.map((t=>e({},t,{sent_at:i}))):e({},t,{sent_at:i})}(n.data))),n.url=Fa(n.url,n.method,n.compression,n.timestampMode);var v=Ra.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===d)return t[e]}(v))?void 0:s.method)&&void 0!==r?r:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){Pa(t)?es.warn(t):es.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Po&&Ft&&"undefined"!=typeof Promise&&!ya?Ea(n).then((t=>{f(t)})).catch((i=>{if(Xe(i))return ya=!0,void f(e({},n,{compression:void 0,url:Fa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return Xe(t)||i===Je})(i)&&(ya=!0),f(n)})):c(n)})(e({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Vl(t){this.Gl?this.Gl.retriableRequest(t):this._send_request(t)}_execute_array(t){pl++;try{var i,e=[],r=[],s=[];ss(t,(t=>{if(t)if(oi(i=t[0]))s.push(t);else if(ai(t))try{t.call(this)}catch(i){es.error("Error executing queued PostHog call",t,i)}else oi(t)&&"alias"===i?e.push(t):oi(t)&&-1!==i.indexOf("capture")&&ai(this[i])?s.push(t):r.push(t)}));var n=function(t,i){ss(t,(function(t){try{if(oi(t[0])){var e=i;ns(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){es.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{pl--}}push(t){if(pl>0&&oi(t)&&di(t[0])){var i=Cl.prototype[t[0]];ai(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Wl){if(this.is_capturing())if(!ui(t)&&di(t)){this.Pl();var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=i&&i.$current_url&&!di(null==i?void 0:i.$current_url)&&(es.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=r&&r.uu||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&&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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=ze(null==r?void 0:r.uuid,ws),f={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},v,c)};t===mt&&this.config.__preview_capture_bot_pageviews&&h&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(D);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var g=null==r?void 0:r.$unset;g&&(f.$unset=g);var _,m,y,b=p?void 0:this.hu(null==r?void 0:r.$set_once,t!==wt,t===bt);if(b&&(f.$set_once=b),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>di(t)?t.slice(0,n):t,l=new Set,f=function t(i,e){if(i!==Object(i))return a?a(i):i;if(!l.has(i)){var r;if(l.add(i),oi(i))r=[],ss(i,(i=>{r.push(t(i))}));else{var s={};ns(i,((i,e)=>{l.has(i)||(s[e]=t(i,e))})),r=s}return r}}(o)),f.timestamp=v,ui(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),p&&(f.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Lt.forEach(r),i.forEach(r),e}(f.properties,wl)),t===Io||t===Oo){var w=null==i?void 0:i.$survey_id,x=null==i?void 0:i.$survey_iteration;sl({id:w,current_iteration:x}),f.$set=e({},f.$set,{[(_={id:w,current_iteration:x},m=t===Oo?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else t===Ro&&(f.$set=e({},f.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var S=null==i?void 0:i.$product_tour_type;S&&(f.$set=e({},f.$set,{["$product_tour_last_seen_date/"+S]:(new Date).toISOString()}))}var k=e({},f.properties.$set,f.$set);if(hi(k)||this.setPersonPropertiesForFlags(k),!fi(this.config.before_send)){var E=this.Xn(f);if(!E)return;(f=E).uuid=ze(f.uuid,ws)}this.wl.emit("eventCaptured",f);var P=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T={method:"POST",url:P,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Vl(T):this.Wl.enqueue(T),f}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(t){return this.on("eventCaptured",(i=>t(i.event,i)))}getExtension(t){var i;return null==(i=this.nu)?void 0:i.getExtension(t)}tu(){var t;return null!==(t=this.nu)&&void 0!==t?t:this.nu=new cl(this)}Sl(t){this.$l.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.$l.indexOf(t);-1!==e&&this.$l.splice(e,1)}}}du(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Bl=null,this.persistence.get_property(Q)===ct&&(null==(r=this.sessionPersistence)||r.clear(),this.Ll.clear(),this.vu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.du();var a=o?void 0:this.persistence.remove_event_timer(t),l=e({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ml()&&(l[ot]=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!di(l.distinct_id)&&!pi(l.distinct_id)||vi(l.distinct_id))&&es.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i,e,r){var n,o,a,l;if(void 0===r&&(r=!1),!Rt)return{};var h,u=t?[...io,...i||[]]:[],d=Le(Rt),v=d[0],c=d[1],f=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};ui(e)||(p.detectGoogleSearchApp=e);var g={},_=null==(n=navigator)||null==(n=n.userAgentData)?void 0:n.platform,m=null==(o=navigator)?void 0:o.maxTouchPoints,y=null==xt||null==(a=xt.screen)?void 0:a.width,b=null==xt||null==(l=xt.screen)?void 0:l.height,w=null==xt?void 0:xt.devicePixelRatio;ui(_)||(g.userAgentDataPlatform=_),ui(m)||(g.maxTouchPoints=m),ui(y)||(g.screenWidth=y),ui(b)||(g.screenHeight=b),ui(w)||(g.devicePixelRatio=w);var x,S,k,E,P,T,C,F,R=os(us({$os:v,$os_version:c,$browser:Ae(Rt,navigator.vendor,f,p),$device:Ne(Rt),$device_type:(S=Rt,k=g,F=Ne(S),F===Di||F===Mi||"Kobo"===F||"Kindle Fire"===F||F===ve?Ai:F===ie||F===re||F===ee||F===he?"Console":F===Li?"Wearable":F?Ri:"Android"===(null==k?void 0:k.userAgentDataPlatform)&&(null!==(E=null==k?void 0:k.maxTouchPoints)&&void 0!==E?E:0)>0?600>Math.min(null!==(P=null==k?void 0:k.screenWidth)&&void 0!==P?P:0,null!==(T=null==k?void 0:k.screenHeight)&&void 0!==T?T:0)/(null!==(C=null==k?void 0:k.devicePixelRatio)&&void 0!==C?C:1)?Ri:Ai:"Desktop"),$timezone:fo(),$timezone_offset:po()}),{$current_url:Yn(r?He(null==$t?void 0:$t.href):null==$t?void 0:$t.href,u,ro),$host:null==$t?void 0:$t.host,$pathname:null==$t?void 0:$t.pathname,$raw_user_agent:Rt.length>1e3?Rt.substring(0,997)+"...":Rt,$browser_version:De(Rt,navigator.vendor,f,p),$browser_language:lo(),$browser_language_prefix:(x=lo(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==xt?void 0:xt.screen.height,$screen_width:null==xt?void 0:xt.screen.width,$viewport_height:null==xt?void 0:xt.innerHeight,$viewport_width:null==xt?void 0:xt.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&&(R.$sdk_dist_channel=s.SDK_DIST_CHANNEL),R}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&os(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&os(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Gl)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Xa&&(l.$lib_custom_api_host=this.config.api_host),u=t!==mt||o?t!==yt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=os(l,u),t===mt&&Et&&(l.title=Et.title),!ui(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Rt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties();ns(["$referrer","$referring_domain"],(t=>{t in g&&delete _[t]}));var m={};if(this.$l.length>0)for(var y of this.$l.slice())try{os(m,y())}catch(t){es.error("Failed to produce browser extension event properties",t)}(l=os({},d,g,_,e({},m,l))).$is_identified=this._isIdentified(),oi(this.config.property_denylist)?ns(this.config.property_denylist,(function(t){delete l[t]})):es.error(bl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(es.error(yl),l=b(l,t));var w=this.cu();return l.$process_person_profile=w,w&&!o&&this.fu("_calculate_event_properties"),l}hu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.cu())return t;if(this.Ol&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=os({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(es.error(yl),o=a(o,"$set_once")),i&&(this.Ol=!0),hi(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.du(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.Ll.add(t))),this.vu()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.Ll.delete(t),this.vu()}pu(t,i){this.register({[t]:i})}Zl(){this.Ll.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.Ll.clear(),this.vu()}vu(){var t;if(this.Dl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.xa||!Us.ri())Us.ai(this.Dl);else{var i=[];this.Ll.forEach((t=>i.push(t))),i.length>0?Us.ii(this.Dl,i):Us.ai(this.Dl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.wl.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ml}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:ml})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:ml})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=ol),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:ml}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:ml})}gu(t){return!t||vi(t)?(es.critical("Unique user id has not been set in posthog.identify"),!1):t===nt?(es.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(es.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return es.uninitializedWarning("posthog.identify");if(pi(t)&&(t=t.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.gu(t)&&this.fu("posthog.identify")){this.Pl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.du(!1),o=this.persistence.za(),l=!1;try{var u=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property(h)&&(this.unregister(h),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(Q)||ct)===ct,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(Q,ft),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture(bt,{distinct_id:t,$anon_distinct_id:u},{$set:i||{},$set_once:e||{}}),this.Bl=Ya(t,i,e),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(Q,ft);var p=i||{},g=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence.Ua(),this.capture("$set",{$set:p,$set_once:g}),this.Bl=Ya(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(J)):f&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ga(l)}}}setPersonProperties(t,i){if((t||i)&&this.fu("posthog.setPersonProperties")){var e=Ya(this.get_distinct_id(),t,i);this.Bl!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Bl=e):es.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(oi(t)?t:[t]).filter((t=>di(t)&&t.length>0));0!==e.length&&this.fu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Bl=null)}group(t,i,r){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.du();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:e({},n,{[t]:i})}),o||r){var a={$group_type:t,$group_key:i};r&&(a.$group_set=r),this.capture(wt,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else es.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.fu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=_i(t)?t:null==t?void 0:t.resetDeviceID,e=_i(t)||null==t?void 0:t.bootstrap;this.mu(i,!1,e)}mu(t,i,r){var s,n,o;if(void 0===i&&(i=!1),es.info("reset"),!this.__loaded)return es.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.zl)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ho());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(w),c=this.is_capturing();this.consent.reset(),i||!c||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 f=null==(o=this.persistence)||null==o.za?void 0:o.za(),p=!1;try{var g,_,m,y,b,x,S,k,E,P,T,C,F;if(null==(g=this.persistence)||g.clear(),null==(_=this.sessionPersistence)||_.clear(),this.Ll.clear(),this.vu(),ui(v)||null==(P=this.persistence)||P.register({[w]:v}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(b=this.conversations)||b.reset(),null==(x=this.logs)||x.reset(),null==(S=this.metrics)||S.reset(),null==(k=this.persistence)||k.set_property(Q,ct),null==(E=this.sessionManager)||E.resetSessionId(),this.Bl=null,this.config.cookieless_mode===vt)this.register_once({distinct_id:nt,$device_id:null},"");else{var R=this.config.get_device_id(ws());this.register_once({distinct_id:R,$device_id:t?R:u},""),t||ui(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Ml()||(null==(F=this.persistence)||F.set_property(Q,r.isIdentifiedID?ft:ct),this.register({distinct_id:r.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(ui(h)||null!=(C=this.sessionManager)&&C.setBootstrapSessionId(h,!0))){var I=e({},r);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var O;f&&(null==(O=this.persistence)||null==O.Ga||O.Ga(p))}this.reloadFeatureFlags()}shutdown(t){var e=this;return i((function*(){var t,i,r,s,n,o,a;if(e.__loaded){e.tu().dispose(),null==(t=e.sessionRecording)||t.dispose(),null==(i=e.logs)||i.flushLogs("sendBeacon"),null==(r=e.metrics)||r.flush("sendBeacon"),null==(s=e.Wl)||s.unload(),null==(n=e.Gl)||n.unload();try{var l;null==(l=e.featureFlags)||l.destroy()}catch(t){es.error("Error while destroying feature flags",t)}null==(o=e.persistence)||o.destroy(),null==(a=e.sessionPersistence)||a.destroy()}else es.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.yu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.bu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(n)?(es.critical("Attempting to create alias for existing People user - aborting."),-2):this.fu("posthog.alias")?(ui(i)&&(i=this.get_distinct_id()),t!==i?(this.pu(h,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(es.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(li(t)){var r,n,o,a,l,h,u,d,v,c,f,p;os(this.config,Pl(t));var g=this.Al();null==(r=this.persistence)||r.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Eo(e({},this.config,{persistence:"sessionStorage"}),g,!1);var _,m=this.Hl(this.config.debug);_i(m)&&(this.config.debug=m),_i(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,Ts.ri()&&Ts.ii("ph_debug",!0),es.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(s.DEBUG=!1,Ts.ri()&&Ts.ai("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ho()),null==(o=this.exceptionObserver)||o.onConfigChange(),null==(a=this.exceptions)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(_=this.historyAutocapture)||_.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.Fl(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){s.LIB_NAME=t,s.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(e({},s,i))}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:Cl._u}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:xl;return i!==xl&&(i=xl+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Q))===ft||(null==(i=this.sessionPersistence)?void 0:i.get_property(Q))===ft}cu(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===pt&&!this._isIdentified()&&hi(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(i=this.persistence)||null==(i=i.props)||!i[st]))}lu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.cu()||this.fu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.fu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}fu(t){return"never"===this.config.person_profiles?(es.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.El(),this.pu(st,!0),!0)}Al(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==dt)}Fl(){var t,i,e,r,s,n=this.Al();return this.is_capturing()||null==(e=this.logs)||e.wu(),(null==(t=this.persistence)?void 0:t.xa)!==n&&(null==(r=this.persistence)||r.set_disabled(n)),(null==(i=this.sessionPersistence)?void 0:i.xa)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Ll.clear(),this.vu()),n}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==vt){if(this.Ml()){var e,r,s,n,o,a;null==(e=this.sessionRecording)||e.dispose({discardBufferedEvents:!0}),this.mu(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Ua(this),this.pageViewManager=new Un(this),this.persistence&&(this.sessionPropsManager=new La(this,this.sessionManager,this.persistence));var l,h=null!==(n=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)&&void 0!==n?n:null==(a=Cl.__defaultExtensionClasses)?void 0:a.sessionRecording;h&&(this.sessionRecording=this.Tl(this.sessionRecording,new h(this)),this._l&&(null==(l=this.sessionRecording)||null==l.onRemoteConfig||l.onRemoteConfig(this._l)))}var u,d;this.consent.optInOut(!0),this.Fl(),this.su(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==dt&&(null==(u=this.surveys)||u.loadIfEnabled()),(ui(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.au()}else es.warn(_l)}opt_out_capturing(){if(this.config.cookieless_mode!==vt){var t,i,e=this.config.cookieless_mode===dt?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode===dt&&this.consent.isOptedIn()&&this.mu(!0,!0),this.consent.optInOut(!1),this.Fl(),this.config.cookieless_mode===dt&&(this.register({distinct_id:nt,$device_id:null}),this.Cl(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.au(),this.su())}else es.warn(_l)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===vt||(this.config.cookieless_mode===dt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fl()}_is_bot(){return kt?Ha(kt,this.config.custom_blocked_useragents):void 0}au(){Et&&("visible"===Et.visibilityState?this.Nl||(this.Nl=!0,this.capture(mt,{title:Et.title},{send_instantly:!0}),this.ql&&(Et.removeEventListener(gt,this.ql),this.ql=null)):this.ql||(this.ql=this.au.bind(this),cs(Et,gt,this.ql)))}debug(t){!1===t?(null==xt||xt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==xt||xt.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}))}ho(){var t=this.zl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(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(t,i,e,r,s){var n=i in t&&!fi(t[i]),o=e in t&&!fi(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,es)}Xn(t){var i;if(fi(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(bi),r=oi(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),fi(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return yi(t.event)?es.warn(o+". This can cause unexpected behavior."):es.info(o),null}s.properties&&!hi(s.properties)||es.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return es.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&fi(s.properties[a]))return es.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.ta)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Hl(t){var i=_i(t)&&!t,e=Ts.ri()&&"true"===Ts.ni("ph_debug");return!i&&(!!e||t)}}Cl.__defaultExtensionClasses={},Cl._u=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=hs(t.prototype[i[e]])}(Cl,["identify"]);class Fl{constructor(t){this.disabled=!1===t;var i=li(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Rl="$copy_autocapture",Il=rs("[AutoCapture]");function Ol(t,i){return i.length>t?i.slice(0,t)+"...":i}function Al(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Ys(i));return i}function Ml(t,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!Ys(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!Xs(c,"body")&&tn>d.length;)if(Zs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Ys(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,g,_=[],m={},y=!1,b=!1;if(ns(d,(t=>{var i=bn(t);if(Xs(t,"a")){var e=t.getAttribute("href");y=!!(i&&e&&Cn(e))&&(u?He(e):e)}Zt(sn(t),"ph-no-capture")&&(b=!0),_.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};ln.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ol(1024,Fn(t)):Ol(1024,on(t)));var a=sn(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),ns(t.attributes,(function(e){var n;if((!wn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Cn(e.value)&&(!di(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=en(a).join(" ")),o["attr__"+e.name]=Ol(1024,"href"===e.name&&s?He(a):a)}}));for(var l=1,h=1,u=t;u=Al(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!bn(t))return{};var i={};return ns(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Cn(r)&&(i[e]=r)}})),i}(t);ns(r,((t,i)=>{({}).hasOwnProperty.call(m,i)||(m[i]=t)}))})),b)return{props:{},explicitNoCapture:b};if(a||(_[0].$el_text=Xs(t,"a")||Xs(t,"button")?Fn(t):on(t)),y){var w,x;_[0].attr__href=y;var S=null==(w=Jn(y))?void 0:w.host,k=null==xt||null==(x=xt.location)?void 0:x.host;S&&k&&S!==k&&(p=y)}return{props:os({$event_type:n.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(g=_,oi(g)?function(t){return t.map((t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return as(o).sort(((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r})).forEach((t=>{var i=t[1];return a[In(t[0].toString())]=In(i.toString())})),(s+=":")+as(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:On(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return as(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(g)):"")},null!=(r=_[0])&&r.$el_text?{$el_text:null==(s=_[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},m)}}class Dl{constructor(t){this.name="autocapture",this.Is=!1,this.Rs=null,this.Ps=!1,this.As=!1,this.gn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Fs=!1,this.Os=t,this.Os.refresh(this.gn),this.rageclicks=new Fl(this.gn.rageclick),this.Ls=null}setup(t){this.Ds(),this.$s=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Fs?i.dispose():(this.Ns=i,this.startIfEnabled())}dispose(){var t;this.Fs||(this.Fs=!0,this.$s=void 0,null==(t=this.Ns)||t.dispose(),this.Ns=void 0,this.qs())}js(){return this.Os.refresh(this.gn),this.gn}Ds(){var t,i;return this.js(),this.gn.url_allowlist=null==(t=this.gn.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.gn.url_ignorelist=null==(i=this.gn.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.gn}Bs(){if(this.isBrowserSupported()){if(xt&&Et){var t=this.Hs=t=>{t=t||(null==xt?void 0:xt.event);try{this.zs(t)}catch(t){Il.error("Failed to capture event",t)}};if(cs(Et,"submit",t,{capture:!0}),cs(Et,"change",t,{capture:!0}),cs(Et,"click",t,{capture:!0}),this.js().capture_copied_text){var i=this.Us=t=>{t=t||(null==xt?void 0:xt.event);try{this.zs(t,Rl)}catch(t){Il.error("Failed to capture clipboard event",t)}};cs(Et,"copy",i,{capture:!0}),cs(Et,"cut",i,{capture:!0}),cs(Et,"paste",i,{capture:!0})}}}else Il.info("Disabling Automatic Event Collection because this browser is not supported")}qs(){this.Hs&&(null==Et||Et.removeEventListener("submit",this.Hs,!0),null==Et||Et.removeEventListener("change",this.Hs,!0),null==Et||Et.removeEventListener("click",this.Hs,!0),this.Hs=void 0),this.Us&&(null==Et||Et.removeEventListener("copy",this.Us,!0),null==Et||Et.removeEventListener("cut",this.Us,!0),null==Et||Et.removeEventListener("paste",this.Us,!0),this.Us=void 0),this.Is=!1}startIfEnabled(){!this.Fs&&this.$s&&this.isEnabled&&!this.Is&&(this.Bs(),this.Is=!0)}onRemoteConfig(t){if(!this.Fs)if(this.Ps=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.As=i.elementsChainAsString);var e,r=i.autocapture_opt_out;_i(r)&&(null==(e=this.$s)||e.kv.set(d,r),this.Rs=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Ls=t}getElementSelectors(t){var i,e=[];return null==(i=this.Ls)||i.forEach((i=>{var r=null==Et?void 0:Et.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Fs)return!1;var e=null==(t=this.$s)?void 0:t.kv.get(d),r=this.Rs,s=this.js(),n=s.remoteRequestsDisabled&&!this.Ps;if(ci(r)&&!_i(e)&&!n)return!1;var o=null!==(i=this.Rs)&&void 0!==i?i:!!e;return!!s.enabled&&!o}zs(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=an(t);Qs(r)&&(r=r.parentNode||null);var s,n=this.Ds();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&_n(r,n.rageclick)&&this.zs(t,"$rageclick");var o=i===Rl,a=o?e({},n,{dom_event_allowlist:void 0}):n;if(r&&function(t,i,e,r,s,n){var o;if(!xt||mn(t))return!1;if(null!=e&&e.url_allowlist&&!rn(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&rn(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var a=e.dom_event_allowlist;if(a&&!a.some((t=>i.type===t)))return!1}var l=yn(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(ui(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(u,e))return!1;if(!hn(u,null==e?void 0:e.css_selector_allowlist))return!1;if(hn(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:dn))return!1;try{var d=xt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return h?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(ln.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l,h=Ml(r,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.As,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=h.props;if(h.explicitNoCapture)return!1;var d=this.getElementSelectors(r);if(d&&d.length>0&&(u.$element_selectors=d),i===Rl){var v=t.type||"clipboard";if("paste"!==v){var c,f,p=null==xt||null==(c=xt.getSelection())?void 0:c.toString(),g=nn(p);if(!g)return!1;u.$selected_content=g,u.$clipboard_text_length=null!==(f=null==p?void 0:p.length)&&void 0!==f?f:0}u.$copy_type=v}return null==(l=this.$s)||l.capture(i,u).catch((t=>Il.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return ai(null==Et?void 0:Et.querySelectorAll)}}class jl{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=li(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.ho(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var Ll=rs("[ExceptionAutocapture]"),Nl=()=>{},Bl=t=>{var i;if(ai(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function zl(t,i,e){try{if(!(i in t))return Nl;var r={next:t[i]},s=e((function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)}));return ai(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=Bl(e);n;){if(n.next===s)return void(n.next=r.next);n=Bl(e=n.next)}else t[i]=r.next}}catch(t){return Nl}}var Ul=rs("[TracingHeaders]"),Hl=rs("[Web Vitals]"),ql=9e5,Vl=["CLS","FCP","INP","LCP"],Wl=["INP","LCP"],Gl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Jl="disabled",Kl="lazy_loading",Yl="awaiting_config",Xl="missing_config";rs("[SessionRecording]"),rs("[SessionRecording]");var Ql="[SessionRecording]",Zl=rs(Ql),th=rs("[Heatmaps]");function ih(t){return li(t)&&"clientX"in t&&"clientY"in t&&pi(t.clientX)&&pi(t.clientY)}var eh=rs("[Product Tours]"),rh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(m))},sh=["$set_once","$set"],nh=rs("[SiteApps]"),oh="Error while initializing PostHog app with config id ",ah=(t,i)=>null!=t&&t.then?t.then(i):i(t),lh="SDK is not enabled or survey functionality is not yet loaded",hh="Disabled. Not loading surveys.";class uh{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.ku=!1,this.Su=[],this.xu=null,this.Cu=null,this.Fs=!1,this.Tu=new Set,this.onRemoteConfig=t=>{if(!this.Fs&&!this.gn.disableSurveys){if(!t.ok)return el.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(fi(i))return el.warn("Flags not loaded yet. Not loading surveys.");this.Mu=_i(i)?i:i.length>0,el.info("flags response received, isSurveysEnabled: "+this.Mu),this.loadIfEnabled()}},this.Os=t,this.Eu=i}setup(t){if(!this.Fs)return this.Iu=t,ah(t.kv.initialize(),(()=>{if(this.Iu===t&&!this.Fs){this.Iu=void 0,this.$s=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Fs?i.dispose():(this.Ns=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Fs||(this.Fs=!0,this.Iu=void 0,this.$s=void 0,null==(t=this.Ns)||t.dispose(),this.Ns=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Su=[],this.xu=null,this.Tu.forEach((t=>clearTimeout(t))),this.Tu.clear())}get gn(){return this.Os.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(rl)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Fs&&this.$s){var t=this.gn;if(!this._surveyManager)if(this.ku)el.info("Already initializing surveys, skipping...");else if(t.disableSurveys)el.info(hh);else if(t.cookielessMode&&this.Os.isOptedOut())el.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Os.getExtensions();if(i){if(!ui(this.Mu)||t.advancedEnableSurveys){var e=this.Mu||t.advancedEnableSurveys;this.ku=!0;try{var r=i.generateSurveys;if(r)return this.Ru(r,e),void(this.ku=!1);var s=i.loadExternalDependency;if(!s)return this.Pu(ut),void(this.ku=!1);s((t=>{try{if(this.Fs)return;var i=this.Os.getExtensions();t||null==i||!i.generateSurveys?this.Pu("Could not load surveys script",t):this.Ru(i.generateSurveys,e)}finally{this.ku=!1}}))}catch(t){throw this.ku=!1,this.Pu("Error initializing surveys",t),t}}}else el.error("PostHog Extensions not found.")}}}Ru(t,i){this.Fs||(this._surveyManager=t(i),this._surveyEventReceiver=this.Os.createEventReceiver(),el.info("Surveys loaded successfully"),this.Au({isLoaded:!0}))}Pu(t,i){el.error(t,i),this.Au({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Su.push(t),this._surveyManager&&this.Au({isLoaded:!0}),()=>{this.Su=this.Su.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.$s)&&void 0!==e?e:this.Eu;if(r&&!this.Fs){if(this.gn.disableSurveys)return el.info(hh),t([]);var s=r.kv.get(U);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Fu()&&this.getSurveys((()=>{}),!0));if(this.xu)this.xu.then((i=>{this.Fs||t(i.surveys,i.context)})).catch((t=>el.error("Error in survey callback",t)));else{var n=this.Ou("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.gn.requestTimeoutMs}).then((t=>{try{return this.Lu(r,t)}catch(t){return el.error("Error processing surveys response",t),this.Lu(r,{statusCode:0,error:t})}}),(t=>this.Lu(r,{statusCode:0,error:t})));this.xu=n;var o=()=>{this.xu===n&&(this.xu=null)};n.then((i=>{o(),this.Fs||t(i.surveys,i.context)}),o).catch((t=>el.error("Error in survey callback",t)))}}}Ou(t,i){var e=this.$s;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(lh)})))}Lu(t,i){if(this.Fs)return{surveys:[],context:{isLoaded:!1,error:lh}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?el.error(r):i.error||el.warn(r),this.Cu=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Cu=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Va(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[U]:n,[H]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Fu(){return this.Du()&&!this.xu&&!this.$u()}Du(){var t,i,e=null==(t=null!==(i=this.$s)&&void 0!==i?i:this.Eu)?void 0:t.kv.get(H);return pi(e)&&Date.now()-e>3e5}$u(){return pi(this.Cu)&&3e5>Date.now()-this.Cu}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};sl(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Au(t){for(var i of this.Su)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){el.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!fi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);el.warn("init was not called")}Nu(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}qu(t){if(fi(this._surveyManager))return{eligible:!1,reason:lh};var i="string"==typeof t?this.Nu(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}ju(t){if(fi(this._surveyManager))return{eligible:!1,reason:lh};var i="string"==typeof t?this.Nu(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(fi(this._surveyManager))return el.warn("init was not called"),{visible:!1,disabledReason:lh};var i=this.ju(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return fi(this._surveyManager)?(el.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:lh})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.ju(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(fi(this._surveyManager))el.warn("init was not called");else{var s="string"==typeof t?this.Nu(t):t;if(null!=s&&s.id)if(nl.includes(s.type)){var n=null==Et?void 0:Et.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){el.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,i;this.Tu.delete(o),this.Fs||(el.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),el.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Tu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else el.warn("Survey element not found")}else el.warn("Surveys of type "+s.type+" cannot be rendered in the app");else el.warn("Survey not found")}}displaySurvey(t,i){var r;if(fi(this._surveyManager))el.warn("init was not called");else{var s=this.Nu(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Ao&&i.initialResponses&&el.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.qu(s);if(!o.eligible)return void el.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else el.warn("Survey not found")}}cancelPendingSurvey(t){fi(this._surveyManager)?el.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function dh(t,i,e){if(fi(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class vh{constructor(t){this.Bu=new Set,this.Hu=new Set,this.zu=new Na,this.Uu=(t,i)=>this.Wu(t,i)&&this.Vu(t,i)&&this.Gu(t,i)&&this.Zu(t,i),this.Wu=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;ui(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Qu=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.Qu)||t.call(this),this.Qu=void 0,this.zu=new Na}register(t){var i,e;if(!ui(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Bu.add(t),null==(i=t.steps)||i.forEach((t=>{this.Hu.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Bu.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Bu.clear(),this.Hu.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Hu.has(t)||this.Hu.has(i.event))&&this.Bu.forEach((t=>{this.Ju(i,t)&&this.zu.emit("actionCaptured",t.name)}))}Ku(t){this.onAction("actionCaptured",(i=>t(i)))}Ju(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Uu(t,e))return!0;return!1}onAction(t,i){return this.zu.on(t,i)}Vu(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!dh(r,i.url,i.url_matching||"contains"))return!1}return!0}Gu(t,i){return!!this.Yu(t,i)&&!!this.Xu(t,i)&&!!this.th(t,i)}Yu(t,i){var e;if(null==i||!i.href)return!0;var r=this.eh(t);if(r.length>0)return r.some((t=>dh(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&dh((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Xu(t,i){var e;if(null==i||!i.text)return!0;var r=this.eh(t);if(r.length>0)return r.some((t=>dh(t.text,i.text,i.text_matching||"exact")||dh(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!fi(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>dh(t,n,o))))}th(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}eh(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Zu(t,i){return null==i||!i.properties||0===i.properties.length||Ka(i.properties.reduce(((t,i)=>{var e=oi(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class ch{constructor(t){var i;this.ih=[],this._instance=t,this.rh=new Map,this.nh=new Map,this.sh=new Map,this.ah=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.oh(t)))}lh(t){return!1}uh(){return null}hh(t){}dh(){}fh(t,i){return!!t&&Ka(t.propertyFilters,null==i?void 0:i.properties)}ph(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}gh(t,i,e){var r=(e===Co?this.rh:this.nh).get(t),s=[];return this.mh((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.fh(n,i)}))}register(t){this.yh(t,!1)}replace(t){this.yh(t,!0)}yh(t,i){var e;ui(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.bh(t,i),this._h(t,i))}_h(t,i){var e=t.filter((t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}));if(i&&this.sh.clear(),0!==e.length){this.wh||(this.wh=new vh(this._instance),this.wh.init(),this.wh.Ku((t=>this.onAction(t))));var r=[];e.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach((i=>{if(r.push(i),i.name){var e,s=null!==(e=this.sh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.sh.set(i.name,s)}}))})),i?this.wh.replace(r):this.wh.register(r)}else{var s;i&&(null==(s=this.wh)||s.replace([]))}}kh(t,i){i.forEach(((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach((t=>{s.includes(t)||s.push(t)})),t.set(e,s)}))}bh(t,i){var e,r,s=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),n=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0})),o=this.ph(t,Co),a=this.ph(t,Fo);i?(this.rh=o,this.nh=a):(this.kh(this.rh,o),this.kh(this.nh,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Qu)&&void 0!==e||(this.Qu=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Sh(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.xh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Ch([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Th(n),void this.Mh([n])}if(this.nh.has(t)){var a=this.gh(t,i,Fo);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Ch(a.map((t=>t.id))),a.forEach((t=>this.Eh(t.id))))}if(this.rh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.rh.get(t)});var l=this.gh(t,i,Co);this.Ih(l.map((t=>t.id)))}}onAction(t){this.sh.has(t)&&this.Ih(this.sh.get(t)||[])}Ih(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.lh(s)?this.Th(s)&&this.Rh(s):r.push(s);r.length>0&&(this.ih=[...new Set([...this.ih,...r])]),this.Sh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Th(t){this.ih=this.ih.filter((i=>i!==t));var i=this.Ph();return!i.includes(t)&&(this.Ah([...i,t]),this.Fh(),!0)}Ch(t){var i=new Set(t);this.ih=this.ih.filter((t=>!i.has(t)));var e=this.Oh(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.Ah(r),0===r.length&&this.Lh()),this.Mh(t)}Dh(){var t,i=this.uh();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Rh(t){if(this.uh()){var i=this.Dh();this.hh(e({},i,{[t]:Date.now()}))}}Mh(t){if(this.uh()){var i=this.Dh(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(hi(e)?this.dh():this.hh(e))}}$h(){this.uh()&&this.dh()}getActivationTimestamp(t){if(this.Ph().includes(t)){var i=this.Dh()[t];return pi(i)?i:void 0}}Oh(){var t,i=this.Nh();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Ph(){var t,i,e=this.Oh();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.qh()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Fh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.jh(i)}Lh(){this.Bh()}oh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.qh()];if(e&&e!==t){var r=this.Oh(),s=this.Dh();r.length>0&&(this.Ah([]),r.filter((t=>pi(s[t]))).forEach((t=>this.Eh(t)))),this.Lh(),this.$h()}}getActivatedIds(){return[...new Set([...this.Ph(),...this.ih])].filter((t=>!this.Hh(t)))}dispose(){var t,i,e;null==(t=this.ah)||t.call(this),this.ah=void 0,null==(i=this.Qu)||i.call(this),this.Qu=void 0,null==(e=this.wh)||e.dispose(),this.wh=void 0}reset(){this.ih=[],this.Oh().length>0&&this.Ah([]),this.Lh(),this.$h()}getEventToItemsMap(){return this.rh}zh(){return this.wh}}class fh extends ch{constructor(t){super(t)}Nh(){return q}qh(){return V}uh(){return W}hh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[W]:t})}dh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(W)}lh(t){var i,e;this.mh((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return pi(r)&&r>0}Uh(){return Ro}mh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Eh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Sh(){return el}Ah(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[q]:t})}jh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[V]:t})}Bh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}Hh(){return!1}xh(t,i){var e;this.mh((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Va(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===Ro?"consume":"ignore":t===Ro?"persist":t===Io||t===Oo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class ph{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);ui(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class gh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==At?void 0:At.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new fh(this._instance)}}var _h=null!=xt&&xt.location?Xn(xt.location.hash,"__posthog")||Xn(location.hash,"state"):null,mh="_postHogToolbarParams",yh=rs("[Toolbar]"),bh=rs("[FeatureFlags]");class wh{constructor(t,i){void 0===i&&(i=!1),this.Wh=!1,this.update(t,i)}update(t,i){this.Vh=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:oi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Wh||(bh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Wh=!0),ui(t.flag_keys)||oi(t.flag_keys)||bh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Vh}}var xh=rs("[FeatureFlags]"),Sh=rs("[FeatureFlags]",{debugEnabled:!0}),kh="\" failed. Feature flags didn't load in time.",Eh="connection_error",$h=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Ph=t=>{var i={};for(var e of as(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Th=rs("[Error tracking]"),Ch="webkit-masked-url:",Fh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Ch],Rh=["__firefox__","__gCrWeb"],Ih="Refusing to render web experiment since the viewer is a likely bot",Oh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Wa(i,t),not_regex:(t,i)=>!Wa(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class Ah{get gn(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Ah.Gh("retrieved web experiments from the server"),i.Zh=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Zh&&(Ah.Gh("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Zh)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);di(r)&&t.variants[r]&&i.Qh(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Ah.Jh(n,i._instance)&&i.Qh(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Ah.Gh(Ih);else if(!this.gn.disable_web_experiments){if(fi(this.Zh))return this.Zh=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ah.Gh("applying feature flags",t),t.forEach((t=>{var i;if(this.Zh&&null!=(i=this.Zh)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Zh)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Qh(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Ah.getWindowLocation();if(null!=t&&t.search){var i=Kn(null==t?void 0:t.search,"__experiment_id"),e=Kn(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Ah.Gh("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Kh(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.gn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.gn.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.gn.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Kh(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Ah.Gh("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Qh(r[0].name,i,r[0].variants[i].transforms))}static Jh(t,i){return!fi(t.conditions)&&Ah.Yh(t,i)&&Ah.Xh(t)}static Yh(t,i){var e;if(fi(t.conditions)||fi(null==(e=t.conditions)?void 0:e.url))return!0;var r=Ah.getWindowLocation();if(r){var s,n,o,a=qs(i,r.href);return null==(s=t.conditions)||!s.url||Oh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==xt?void 0:xt.location}static Xh(t){var i;if(fi(t.conditions)||fi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=no();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Gh(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];es.info("[WebExperiments] "+t,e)}Qh(t,i,e){this._is_bot()?Ah.Gh(Ih):"control"!==i?e.forEach((e=>{if(e.selector){var r;Ah.Gh("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Ah.Gh("Control variants leave the page unmodified.")}_is_bot(){return kt&&this._instance?Ha(kt,this.gn.custom_blocked_useragents):void 0}}var Mh=rs("[Conversations]"),Dh="Conversations not available yet.";function jh(t,i){var r,s,n,o,a,l,h,u=null!==(r=null==t?void 0:t.flushIntervalMs)&&void 0!==r?r:3e3,d=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,v=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=ui(v)?Math.max(d,2048):Math.max(d,v),f=e({},function(){var t="",i="";try{var r=null==kt?void 0:kt.userAgent;if(r){var s=Le(r);t=s[0],i=s[1]}}catch(t){}return function(t,i){var r=function(t){if(t)return{}.hasOwnProperty.call(hr,t)?hr[t]:t}(t);return e({},r?{"os.name":r}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==f?void 0:f["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==f?void 0:f["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(h=null==f?void 0:f["deployment.environment"])&&void 0!==h?h:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:c,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Lh=["debug","log","warn","error","info"],Nh="console",Bh="__posthogHandledLogsRequestError",zh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Bh]=!0,e},Uh=t=>!!t&&"object"==typeof t&&!0===t[Bh],Hh={featureFlags:class{constructor(t){this.name="featureFlags",this.td=!1,this.featureFlagEventHandlers=[],this.A=xh,this.ed={},this.rd={},this.nd=[],this.sd=!1,this.ad=!1,this.od=0,this.ld=!1,this.ud=!1,this.hd=!1,this.dd=!1,this.vd=0,this.zt=()=>{var t=this.fd();this.vd=0,t&&this.reloadFeatureFlags()},this.pd=()=>{var t,i=this.gd;ui(i)||this.gn.remoteRequestsDisabled||!Et||"hidden"===Et.visibilityState||Date.now()-(null!==(t=this.md)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.yd())},this.Wt=()=>{"visible"===(null==Et?void 0:Et.visibilityState)&&this.pd()},"get"in t?this.Os=t:(this._instance=t,this.bd=new wh(t.config,t.ho()),this.Os=this.bd)}updateConfig(t,i){var e;null==(e=this.bd)||e.update(t,i),this.$s&&this._d()}setup(t){return this.Iu=t,this.A=t.logger.createLogger("[FeatureFlags]"),ah(t.kv.initialize(),(()=>{this.Iu===t&&(this.Iu=void 0,this.$s=t,this.wd(t))}))}wd(t){var i;if(this.$s===t)return xt&&cs(xt,"online",this.zt),this._d(),this.kd=t.registerDynamicEventProperties((()=>this.Sd()?this.ed:this.rd)),this.xd=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange((()=>{this.Cd(),this.Td()})),this.Cd(),this.initialize()}_d(){var t=this.gn.refreshIntervalMs,i=!this.gn.remoteRequestsDisabled&&Et&&!ui(t)&&t>0?t:void 0;i!==this.gd&&(this.Md(),ui(i)||(this.gd=i,this.yd(),null!=Et&&Et.addEventListener&&cs(Et,gt,this.Wt)))}yd(){ui(this.gd)||(ui(this.Ed)||clearInterval(this.Ed),this.md=Date.now(),this.Ed=setInterval(this.pd,this.gd))}Md(){ui(this.Ed)||(clearInterval(this.Ed),this.Ed=void 0,null==Et||null==Et.removeEventListener||Et.removeEventListener(gt,this.Wt)),this.gd=void 0,this.md=void 0}destroy(){this.Id()}dispose(){this.Id()}Id(){var t,i;this.Md(),this.od++,this.ud=!1,this.Iu=void 0,this.$s&&(this.Rd(),null==(t=this.kd)||t.dispose(),this.kd=void 0,null==(i=this.xd)||i.call(this),this.xd=void 0,this.nd=[],null==xt||xt.removeEventListener("online",this.zt),this.$s=void 0)}get gn(){return this.Os.get()}Pd(t){var i;return null==(i=this.$s)?void 0:i.kv.get(t)}ii(t){this.Ad((()=>{var i;return null==(i=this.$s)?void 0:i.kv.set(t)}))}Fd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t[F]){var s=this.Pd(F)||{},n=t[F]||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter((t=>{var i=t[1];return!(null!=i&&i.failed)})).map((t=>t[0])):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!oi(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Pd(A)||{},d=t[A]||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p={[R]:f,[F]:f,[A]:!!c||v};for(var g of(t[O]&&(p[O]=f),[M,X,D]))ui(t[g])||(p[g]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(p)}}ai(t){this.Ad((()=>{var i;return null==(i=this.$s)?void 0:i.kv.remove(t)}))}Ad(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Cd(){var t={};for(var i of[R,A,M,j]){var r=this.Pd(i);ui(r)||(t[i]=r)}this.ed=t;var s=e({},t),n=this.Pd(F);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.rd=s}Sd(){var t=this.gn.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Pd(X);return"number"!=typeof i||Date.now()-i>t}Od(){return!!this.Sd()&&(this.dd||this.ad||(this.dd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ld(){var t=this.gn.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Dd(){var t=this.gn.flagKeys;if(!ui(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.gn,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(t[i]=o[i],t)),{});return this.$d({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Pd(F))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Pd(A))&&void 0!==n?n:{},l=e({},o,t),h=e({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Dt(c),variant:jt(c),reason:void 0,metadata:ui(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.$d({flags:u})}get hasLoadedFlags(){return this.sd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Pd(O),i=this.Pd(j),r=this.Pd(L);if(!r&&!i)return t||{};var s=os({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var o of n){var a,l,h=s[o],u=null==i?void 0:i[o],d=ui(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=ui(u)?null==h?void 0:h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=e({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=e({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.td||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.td=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:Dt(r),variant:jt(r),payload:Mt(i[e])}}))}getFlagVariants(){var t=this.Pd(F),i=this.Pd(j);if(!i)return t||{};for(var e=os({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.td||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.td=!0),e}getFlagPayloads(){var t=this.Pd(A),i=this.Pd(L);if(!i)return t||{};for(var e=os({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.td||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.td=!0),e}reloadFeatureFlags(){this.ld||this.gn.featureFlagsDisabled||this.fd()||this.Nd||(this.nd.slice().forEach((t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}})),this.Nd=setTimeout((()=>{this.qd()}),5))}Rd(){clearTimeout(this.Nd),this.Nd=void 0}onReloading(t){return this.nd.push(t),()=>{this.nd=this.nd.filter((i=>i!==t))}}ensureFlagsLoaded(){this.sd||this.ad||this.Nd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ld=t}resetFlagCallReported(){this.ai(J)}qd(t){this.Rd();var i=this.$s;if(i&&!this.gn.remoteRequestsDisabled&&!this.fd())if(this.ad)this.ud=!0;else{var r={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},i.initialPersonProperties,this.Pd(N)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Pd(B),timezone:fo()};ui(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.gn.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.Ld();s.length&&(r.evaluation_contexts=s);var n=this.Dd();ui(n)||(r.flag_keys=n);var o=this.gn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.od;this.ad=!0;var h=()=>{this.ud&&(this.ud=!1,this.qd())},u=t=>{this.ad=!1,l===this.od?(this.ii({[Y]:[Eh]}),this.A.error("Feature flag request failed",t),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:r,compression:this.gn.compression,sentAt:"body",timeoutMs:this.gn.requestTimeoutMs}).then((t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.ad=!1,l===this.od){if(this.jd(t.statusCode),n||this.ud||(this.$anon_distinct_id=void 0),!r.disable_flags||this.ud){this.hd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Eh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(e=s.quotaLimited)||!e.includes("feature_flags"));u&&a.push("quota_limited"),this.ii({[Y]:a}),u?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.$d(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}fd(){return Qn(this.vd,3)}jd(t){this.vd=Zn(t,this.vd,3,(()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.hd)if(this.sd||this.getFlags()&&this.getFlags().length>0){if(!this.Od()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+kh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.hd)if(this.sd||this.getFlags()&&this.getFlags().length>0){if(!this.Od()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Pd(M)||void 0,u=this.Pd(X)||void 0,d=this.Pd(J)||{};if(this.gn.deduplicateCallsPerSession){var v,c=null==(v=this.$s)?void 0:v.session.sessionId,f=this.Pd(K);c&&c!==f&&(d={},r=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))r&&this.ii({[J]:d,[K]:r});else{var p,g,_,m,y,b,w,x,S,k,E,P;oi(d[t])?d[t].push(l):d[t]=[l],this.ii(e({[J]:d},r?{[K]:r}:{}));var T=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Pd(Y))&&void 0!==p?p:[]];ui(o)&&C.push("flag_missing");var F={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(g=null==(_=this.gn.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.gn.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.hd};ui(null==T||null==(b=T.metadata)?void 0:b.has_experiment)||(F.$feature_flag_has_experiment=T.metadata.has_experiment),ui(null==T||null==(w=T.metadata)?void 0:w.version)||(F.$feature_flag_version=T.metadata.version);var R,I=null!==(x=null==T||null==(S=T.reason)?void 0:S.description)&&void 0!==x?x:null==T||null==(k=T.reason)?void 0:k.code;I&&(F.$feature_flag_reason=I),null!=T&&null!=(E=T.metadata)&&E.id&&(F.$feature_flag_id=T.metadata.id),ui(null==T?void 0:T.original_variant)&&ui(null==T?void 0:T.original_enabled)||(F.$feature_flag_original_response=ui(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(P=T.metadata)&&P.original_payload&&(F.$feature_flag_original_payload=null==T||null==(R=T.metadata)?void 0:R.original_payload),C.length&&(F.$feature_flag_error=C.join(",")),this.Bd(F)}else r&&this.ii({[J]:d,[K]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Mt(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+kh)}Bd(t){try{var i;null==(i=this.$s)||i.capture("$feature_flag_called",t).catch((t=>{this.A.error("Failed to capture feature flag call",t)}))}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Hd(t,i)}Hd(t,e){var r=this;return i((function*(){var i=r.$s;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.Ld();n.length&&(s.evaluation_contexts=n);var o,a=r.Dd();ui(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:r.gn.compression,sentAt:"body",timeoutMs:r.gn.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.A.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){r.A.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.hd)return i.defaultValue;if(!(this.sd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+kh),i.defaultValue;var e=this.getFeatureFlag(t,i);return ui(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i,e){this.$d(t,i,e)}$d(t,i,r){if(this.$s){this.sd=!0;var s=function(t,i,r,s,n,o){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=xh);var a=((t,i)=>{var r=t.flags;return r?e({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var i;return[t,null!==(i=r[t].variant)&&void 0!==i?i:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var i;return!ui(null==(i=r[t].metadata)?void 0:i.payload)})).map((t=>{var i;return[t,null==(i=r[t].metadata)?void 0:i.payload]})))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(oi(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[R]:h,[F]:c,[D]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),y=g||{};p=e({},i,p),g=e({},r,y),m.forEach((t=>{var i;t in y||null==(i=g)||delete i[t]})),_=e({},s,_)}else if(t.errorsWhileComputingFlags)if(l){var b=new Set(Object.keys(l).filter((t=>{var i;return!(null!=(i=l[t])&&i.failed)})));p=e({},i,Object.fromEntries(Object.entries(p).filter((t=>b.has(t[0])))));var w=Object.fromEntries(Object.entries(g||{}).filter((t=>b.has(t[0]))));g=e({},r,w),b.forEach((t=>{var i;t in w||null==(i=g)||delete i[t]})),_=e({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>b.has(t[0])))))}else p=e({},i,p),g=e({},r,g),_=e({},s,_);return e({[R]:Object.keys(Ph(p)),[F]:p||{},[A]:g||{},[O]:_||{},[D]:!0===t.minimalFlagCalledEvents},d?{[M]:d}:{},v?{[X]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.A);s&&(this.Fd(s,t,!(null==r||!r.partialResponse)),this.ii(s)),i||(this.dd=!1),this.Td(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.zd(t)}zd(t){if(this.$s){if(!1===t)return this.ai([j,L]),this.Td(),void Sh.info("All overrides cleared");if(oi(t))return this.ii({[j]:$h(t)}),this.Td(),void Sh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.td=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[j]=oi(s)?$h(s):s),n&&(r[L]=n),Object.keys(r).length&&this.ii(r),!1===s&&!1===n?this.ai([j,L]):!1===s?this.ai(j):!1===n&&this.ai(L),this.Td(),!1===s?Sh.info("Flag overrides cleared"):s&&Sh.info("Flag overrides set",{flags:s}),void(!1===n?Sh.info("Payload overrides cleared"):n&&Sh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ii({[j]:t}),this.Td(),void Sh.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.sd){var i=this.Ud(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.Pd(I)||[]).find((i=>i.flagKey===t)),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[R]:[t],[F]:[t],[N]:Object.keys(o)}),this.ii({[R]:Object.keys(Ph(l)),[F]:l,[N]:e({},this.Pd(N)||{},o)}),this.Td();try{var h;null==(h=this.$s)||h.capture("$feature_enrollment_update",a).catch((t=>{this.A.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Pd(I);!r||i?this.Wd(t,e):t(r)}Wd(t,e){var r=this;return i((function*(){var i=r.$s;if(i){var s,n=e?"&"+e.map((t=>"stage="+t)).join("&"):"";try{var o=yield i.sendRequest("/api/early_access_features/?token="+i.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.ii({[I]:s=o.json.earlyAccessFeatures})}catch(t){return void r.A.error("Early access feature request failed",t)}try{t(s)}catch(t){r.A.error("Early access feature callback failed",t)}}}))()}Ud(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Td(t){this.Cd();var i=this.Ud(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Vd(t,i)}Vd(t,i){void 0===i&&(i=!0);var r=this.Pd(N)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this.ii({[N]:e({},r,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.Pd(N)||{});t.forEach((t=>{delete r[t]})),this.ii({[N]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.ai(N),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Pd(B)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.ii({[B]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Pd(B)||{};this.ii({[B]:e({},i,{[t]:{}})})}else this.ai(B)}reset(){this.od++,this.ud=!1,this.ed={},this.rd={},this.sd=!1,this.ld=!1,this.hd=!1,this.$anon_distinct_id=void 0,this.Rd(),this.td=!1,this.vd=0}}},qh={sessionRecording:class{get gn(){return this._instance.config}get $o(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Gd)||!t.isStarted)}get status(){var t,i;return this.Zd===Yl||this.Zd===Xl?this.Zd:null!==(t=null==(i=this.Gd)?void 0:i.status)&&void 0!==t?t:this.Zd}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Zd=Jl,this.Qd=void 0,this.Jd=!1,this.qt=(()=>{var t;if(null==Et||!Et.visibilityState||"visible"===Et.visibilityState)return!0;var i=null==xt||null==(t=xt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.Wt=()=>{var t;"visible"===(null==Et?void 0:Et.visibilityState)&&(this.qt=!0,null==(t=this.Gd)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Zl.error("started without valid sessionManager"),new Error(Ql+" started without valid sessionManager. This is a bug.");if(this.gn.cookieless_mode===vt)throw new Error(Ql+' cannot be used with cookieless_mode="always"');null!=Et&&Et.addEventListener&&cs(Et,"visibilitychange",this.Wt)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.Jd=!0,null==Et||null==Et.removeEventListener||Et.removeEventListener("visibilitychange",this.Wt),e?this.Kd(!0):this.stopRecording()}get Yd(){var t,i=!(null==(t=this._instance.get_property(w))||!t.enabled),e=!this.gn.disable_session_recording,r=this.gn.disable_session_recording||this._instance.consent.isOptedOut();return xt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.Jd||this.Yd&&null!=(i=this.Gd)&&i.isStarted)){var e=!ui(Object.assign)&&!ui(Array.from);this.Yd&&e?(this.Xd(t),Zl.info("starting")):(this.Zd=Jl,this.stopRecording())}}Xd(t){var i,e;if(this.Yd)if(this.Zd!==Yl&&this.Zd!==Xl&&(this.Zd=Kl),null!=At&&null!=(i=At.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=At.__PosthogExtensions__)&&e.initSessionRecording)this.tv(t);else{var r,s=this._instance.sessionManager;null==(r=At.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ev,(i=>{if(!this.Jd&&this.Yd&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[ht]:!0}),Zl.error("could not load recorder",i)):void this.tv(t);this.Zd=Jl}))}}stopRecording(){var t,i;null==(t=this.Qd)||t.call(this),this.Qd=void 0,null==(i=this.Gd)||i.stop()}Kd(t){var i,e;void 0===t&&(t=!1),null==(i=this.Qd)||i.call(this),this.Qd=void 0,null==(e=this.Gd)||e.discard({discardProducerEvents:t})}iv(){var t,i;null==(t=this.$o)||t.unregister(C),null==(i=this.$o)||i.unregister(x)}rv(t,i){if(fi(t))return null;var e,r=pi(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Zl.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}nv(t){if(this.$o){var i,r,s=this.$o,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.rv(null==(i=this.gn.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.rv(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;fi(a)&&this.iv();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[w]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ui(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(i=this.Qd)||i.call(this),this.Qd=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.nv(i),void this.Kd()):(this.nv(i),void this.startIfEnabledOrStop()):(this.Zd===Yl&&(this.Zd=Xl,Zl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.Gd)&&e.log?this.Gd.log(t,i):Zl.warn("log called before recorder was ready")}get ev(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(w);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}sv(){var t,i=this._instance.get_property(w);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Zl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!fi(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}tv(t){var i,e,r;if(!this.Jd&&this.Yd&&this._instance.sessionManager){if(null==(i=At.__PosthogExtensions__)||!i.initSessionRecording)return Zl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ht]:!0});var s;if(this.Gd||(this.Gd=null==(s=At.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.qt),this.Gd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.sv()){if(this.Zd===Xl||this.Zd===Yl)return;return this.Zd=Yl,Zl.info("persisted remote config is stale, requesting fresh config before starting"),void new Lo(this._instance).load()}this.Zd=Kl,null==(e=(r=this.Gd).setDocumentWasEverVisible)||e.call(r,this.qt),this.Gd.start(t)}else this.Zd=Jl}onRRwebEmit(t){var i;null==(i=this.Gd)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.Gd||null==(i=this.$o)||i.register({[k]:!0}),null==(t=this.Gd)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Gd||null==(i=this.$o)||i.register({[S]:!0}),null==(t=this.Gd)||t.overrideSampling()}overrideTrigger(t){var i,e;this.Gd||null==(e=this.$o)||e.register({["url"===t?E:P]:!0}),null==(i=this.Gd)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Gd)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.Gd)||!e.tryAddCustomEvent(t,i))}}},Vh={autocapture:class extends Dl{constructor(t){super(new jl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.av=this.ov()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.lv();return!!(t.path||t.search||this.uv(t))}startIfEnabled(){this.isEnabled&&(es.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.av=this.ov(),this.startIfEnabled()}stop(){this.hv&&this.hv(),this.hv=void 0,this.dv&&this.dv(),this.dv=void 0,es.info("History API monitoring stopped")}monitorHistoryChanges(){xt&&xt.history&&(this.vv("pushState"),this.vv("replaceState"),this.fv(),this.uv()&&this.pv())}vv(t){var i;if(xt&&(null==(i=xt.history[t])||!i.__posthog_wrapped__)){var e=this;zl(xt.history,t,(i=>function(r,s,n){i.call(this,r,s,n),e.gv(t)}))}}ov(){var t=null==xt?void 0:xt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}lv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:li(t)?t:{}}uv(t){return void 0===t&&(t=this.lv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}mv(t){var i=this.lv(),e=this.av;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.uv(i)&&t.hash!==e.hash))}gv(t){try{var i=this.ov();if(!i)return;this.mv(i)&&this._instance.capture(mt,{navigation_type:t}),this.av=i}catch(i){es.error("Error capturing "+t+" pageview",i)}}fv(){if(!this.hv){var t=()=>{this.gv("popstate")};cs(xt,"popstate",t),this.hv=()=>{xt&&xt.removeEventListener("popstate",t)}}}pv(){if(!this.dv){var t=()=>{this.gv("hashchange")};cs(xt,"hashchange",t),this.dv=()=>{xt&&xt.removeEventListener("hashchange",t)}}}},heatmaps:class{get gn(){return this.instance.config}constructor(t){var i;this.yv=!1,this.Is=!1,this.bv=null,this.instance=t,this.yv=!(null==(i=this.instance.persistence)||!i.props[v]),this.rageclicks=new Fl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return li(this.gn.capture_heatmaps)&&this.gn.capture_heatmaps.flush_interval_milliseconds&&(t=this.gn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return fi(this.gn.capture_heatmaps)?fi(this.gn.enable_heatmaps)?this.yv:this.gn.enable_heatmaps:!1!==this.gn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Is)return;th.info("starting..."),this._v(),this.Wt()}else{var t;clearInterval(null!==(t=this.bv)&&void 0!==t?t:void 0),this.wv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:e}),this.yv=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Dt;return this.Dt=void 0,t}Sv(t){ih(t.originalEvent)&&this.Ki(t.originalEvent,"deadclick")}Wt(){this.bv&&clearInterval(this.bv),this.bv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(Et)?setInterval(this.Mo.bind(this),this.flushIntervalMilliseconds):null}_v(){xt&&Et&&(this.xv=this.Mo.bind(this),cs(xt,_t,this.xv),this.Cv=t=>this.Ki(t||(null==xt?void 0:xt.event)),cs(Et,"click",this.Cv,{capture:!0}),this.Tv=t=>this.Mv(t||(null==xt?void 0:xt.event)),cs(Et,"mousemove",this.Tv,{capture:!0}),this.Ev=new jn(this.instance,Mn,this.Sv.bind(this)),this.Ev.startIfEnabledOrStop(),this.Iv=this.Wt.bind(this),cs(Et,gt,this.Iv),this.Is=!0)}wv(){var t;xt&&Et&&(this.xv&&xt.removeEventListener(_t,this.xv),this.Cv&&Et.removeEventListener("click",this.Cv,{capture:!0}),this.Tv&&Et.removeEventListener("mousemove",this.Tv,{capture:!0}),this.Iv&&Et.removeEventListener(gt,this.Iv),clearTimeout(this.Rv),null==(t=this.Ev)||t.stop(),this.Is=!1)}Pv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&Ys(r)&&!Xs(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:xt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(Zt(i,s))return!0;r=un(r)}return!1}(an(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}Ki(t,i){var r;if(void 0===i&&(i="click"),!Ks(t.target)&&ih(t)){var s=this.Pv(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&_n(an(t),this.instance.config.rageclick)&&this.ys(e({},s,{type:"rageclick"})),this.ys(s)}}Mv(t){!Ks(t.target)&&ih(t)&&(clearTimeout(this.Rv),this.Rv=setTimeout((()=>{this.ys(this.Pv(t,"mousemove"))}),500))}ys(t){if(xt){var i=this.gn.disable_capture_url_hashes?He(xt.location.href):xt.location.href,e=this.gn.custom_personal_data_properties,r=this.gn.mask_personal_data_properties?[...io,...e||[]]:[],s=Yn(i,r,ro);this.Dt=this.Dt||{},this.Dt[s]||(this.Dt[s]=[]),this.Dt[s].push(t)}}Mo(){this.Dt&&!hi(this.Dt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:jn,webVitalsAutocapture:class{constructor(t){var i;this.yv=!1,this.Is=!1,this.Dt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Av=()=>{clearTimeout(this.Fv),this.Fv=void 0,0!==this.Dt.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.Dt.url},this.Dt.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.Dt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ov=t=>{var i;if(this.Dt=this.Dt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},fi(null==t?void 0:t.name)||fi(null==t?void 0:t.value))Hl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Lv(r);if(!ui(s)){var n=pi(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Dv||this.Dv>t.value){this.Dt.navigationKey!==n&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),ui(this.Dt.navigationKey)&&(this.Dt.navigationKey=n,this.Dt.url=s),this.Dt.firstMetricTimestamp=ui(this.Dt.firstMetricTimestamp)?Date.now():this.Dt.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=e({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,li(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Gl){var u="url"===h&&"string"==typeof t.attribution[h]?this.Lv(t.attribution[h]):t.attribution[h];ui(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;ui(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Dt.metrics.push(a),this.Dt.metrics.length===this.allowedMetrics.length&&this.Av()}else Hl.error("Ignoring metric with value >= "+this.Dv,t)}}},this.$v=()=>{if(!this.Is){var t,i,r,s,n=!1,o=At.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Nv])||("web-vitals"===this.Nv&&ui(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ui(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!ui(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,r=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?e({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Ov.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Ov.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Ov.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Ov.bind(this),v),this.Is=!0}else Hl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.yv=!(null==(i=this._instance.persistence)||!i.props[g]),this.startIfEnabled()}get qv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=li(this.qv)?null==(t=this.qv)?void 0:t.web_vitals_allowed_metrics:void 0;return fi(e)?(null==(i=this._instance.persistence)?void 0:i.props[b])||Vl:e}get flushToCaptureTimeoutMs(){return(li(this.qv)?this.qv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=li(this.qv)?this.qv.web_vitals_attribution:void 0;return _i(t)?t?Vl:[]:oi(t)?t:Wl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=li(this.qv)?this.qv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Dv(){var t=li(this.qv)&&pi(this.qv.__web_vitals_max_value)?this.qv.__web_vitals_max_value:ql;return t>0&&6e4>=t?ql:t}get isEnabled(){var t=null==$t?void 0:$t.protocol;if("http:"!==t&&"https:"!==t)return Hl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=li(this.qv)?this.qv.web_vitals:_i(this.qv)?this.qv:void 0;return _i(i)?i:this.yv}startIfEnabled(){this.isEnabled&&!this.Is&&(Hl.info("enabled, starting..."),this.Ks(this.$v))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=li(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=li(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:e}),this._instance.persistence.register({[b]:r})),this.yv=e,this.startIfEnabled()}}}get Nv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ks(t){var i=At.__PosthogExtensions__,e=this.Nv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&ui(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?Hl.error("failed to load script",i):t()}))}Lv(t){var i=t||(null==xt?void 0:xt.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?He(i):i,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...io,...r||[]]:[];return Yn(e,s,ro)}Hl.error("Could not determine current URL")}}},Wh={exceptionObserver:class{constructor(t){var i;this.$v=()=>{var t;if(xt&&this.isEnabled&&null!=(t=At.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=At.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=At.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=At.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.jv&&this.gn.capture_unhandled_errors&&(this.jv=i(this.captureException.bind(this))),!this.Bv&&this.gn.capture_unhandled_rejections&&(this.Bv=e(this.captureException.bind(this))),!this.Hv&&this.gn.capture_console_errors&&(this.Hv=r(this.captureException.bind(this)))}catch(t){Ll.error("failed to start",t),this.zv()}}},this._instance=t,this.Uv=!(null==(i=this._instance.persistence)||!i.props[c]),this.pe=new Fi(e({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:Ll})),this.gn=this.Wv(),this.startIfEnabledOrStop()}Wv(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return li(t)?i=e({},i,t):(ui(t)?this.Uv:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.gn.capture_console_errors||this.gn.capture_unhandled_errors||this.gn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ll.info("enabled"),this.zv(),this.Ks(this.$v)):this.zv()}Ks(t){var i,e;null!=(i=At.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=At.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Ll.error("failed to load script",i);t()}))}zv(){var t,i,e;null==(t=this.jv)||t.call(this),this.jv=void 0,null==(i=this.Bv)||i.call(this),this.Bv=void 0,null==(e=this.Hv)||e.call(this),this.Hv=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Uv=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.Uv}),this.gn=this.Wv(),this.startIfEnabledOrStop())}}onConfigChange(){this.gn=this.Wv()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.pe.consumeRateLimit(s)?Ll.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,r;this.Vv=[],this.Gv=new Er([new jr,new Gr,new Nr,new Lr,new Vr,new qr,new zr,new Wr],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Dr.test(l)?l.replace(Dr,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||$r});var r}))}(n)}}("web:javascript",Ir,Mr)),this._instance=t,this.Vv=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==i?i:[],this.Zv=Qr(this.Qv()),this.Jv=new Zr(this.Zv)}onConfigChange(){this.Zv=Qr(this.Qv()),this.Jv.setConfig(this.Zv)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Vv=n,this._instance.persistence&&this._instance.persistence.register({[f]:this.Vv,[p]:o})}}}get Kv(){var t,i=!!this._instance.get_property(p),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Gv.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Zv.enabled)try{if(!di(t)||0===t.trim().length)return void Th.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce(((e,r)=>Yr.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.Yv(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&Th.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Jv.add(e({[Jr]:t,[Kr]:(new Date).toISOString()},s))}catch(t){Th.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Xv(i)){if(this.tc(i))return this.ec("Exception dropped: matched a suppression rule"),void Th.info("Skipping exception capture because a suppression rule matched");if(!this.Kv&&this.ic(i))return this.ec("Exception dropped: thrown by a browser extension"),void Th.info("Skipping exception capture because it was thrown by an extension");if(!this.Kv&&this.rc(i))return this.ec("Exception dropped: thrown by an injected browser script"),void Th.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.nc(i))return this.ec("Exception dropped: thrown by the PostHog SDK"),void Th.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.Zv.enabled&&fi(t.$exception_steps)?this.sc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",uu:!0});return s&&this.Jv.clear(),s}catch(t){return Th.error("Failed to capture exception event. Dropping this exception.",t),void this.Jv.clear()}}catch(t){return void Th.error("Failed to process exception event. Ignoring this exception.",t)}var n}sc(t){try{var i=this.Jv.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return Th.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}ec(t){this.Zv.enabled&&this.Jv.add({[Jr]:t,[Kr]:(new Date).toISOString()})}Yv(t){return li(t)?e({},t):{}}Qv(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}tc(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return di(e)&&e.length>0&&t.$exception_types.push(e),di(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Vv.some((t=>{var e=t.values.map((t=>{var e=Ja[t.operator],r=i[t.key];if(!e||!r)return!1;var s=oi(t.value)?t.value:[t.value];return s.length>0&&e(s,r)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}catch(t){return Th.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}ic(t){var i=t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})),e=i.filter((t=>{var i=t.filename;return!!i&&Fh.some((t=>i.startsWith(t)))}));return 0!==e.length&&(!e.every((t=>{var i=t.filename;return!!i&&i.startsWith(Ch)}))||t.some((t=>{var i=t.value;return di(i)&&i.includes("isolatedAPI.contexts.topHostname")}))&&!i.some((t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Ch))})))}rc(t){return t.some((t=>{var i=t.value;return di(i)&&Rh.some((t=>i.includes(t)))}))}nc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Xv(t){return!fi(t)&&oi(t)}}},Gh=e({productTours:class{get $o(){return this._instance.persistence}constructor(t){this.ac=null,this.oc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.$o&&this.$o.register({[m]:!!i.productTours}),!rh(this._instance))return!this.ac&&fi(null==(e=this.$o)?void 0:e.props[G])||eh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.ac)||r.stop(),this.ac=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.ac&&rh(this._instance)&&this.Ks((()=>this.lc()))}Ks(t){var i,e;null!=(i=At.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=At.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?eh.error("Could not load product tours script",i):t()}))}lc(){var t;!this.ac&&null!=(t=At.__PosthogExtensions__)&&t.generateProductTours&&(this.ac=At.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!oi(this.oc)||i){var e=this.$o;if(e){var r=e.props[G];if(oi(r)&&!i)return this.oc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(rh(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||eh.warn(s):eh.error(s),void t([],{isLoaded:!1,error:s})}var n=oi(i.json.product_tours)?i.json.product_tours:[];this.oc=n,e&&e.register({[G]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.oc,{isLoaded:!0})}getActiveProductTours(t){fi(this.ac)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ac.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.ac)||i.showTourById(t)}previewTour(t){this.ac?this.ac.previewTour(t):this.Ks((()=>{var i;this.lc(),null==(i=this.ac)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.ac)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ac)||t.nextStep()}previousStep(){var t;null==(t=this.ac)||t.previousStep()}clearCache(){var t;this.oc=null,null==(t=this.$o)||t.unregister(G)}resetTour(t){var i;null==(i=this.ac)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ac)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.ac)||i.cancelPendingTour(t)}}},Hh),Jh={siteApps:class{constructor(t){this.uc=0,this._instance=t,this.hc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}dc(t,i){if(i){var e=this.globalsForEvent(i);this.hc.push(e),this.hc.length>1e3&&(this.hc=this.hc.slice(10))}}get siteAppLoaders(){var t;return null==(t=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.dc.bind(this));this.vc=()=>{t(),this.hc=[],this.vc=void 0}}}globalsForEvent(t){var i,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var c of Object.entries(v)){var f=c[0];u[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,g=t.$set;return{event:e({},r(t,sh),{properties:e({},t.properties,g?{$set:e({},null!==(i=null==(s=t.properties)?void 0:s.$set)&&void 0!==i?i:{},g)}:{},p?{$set_once:e({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}cc(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(nh.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(nh.error("prepare_external_dependency_script returned null"),null):t}fc(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==Et?void 0:Et.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.uc++,this.gc)return this.mc();var u=[],d=this,v=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),u.push((()=>{t[i]=r}))}},f=t=>{if(v.has(t))return t;var i=d.cc(t);return i&&v.add(i),i},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ci(t)));return c(h,"appendChild",(t=>function(i){var e=f(i);return e?t.call(this,e):i})),c(h,"insertBefore",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i})),c(h,"replaceChild",(t=>function(i,e){var r=f(i);return r?t.call(this,r,e):e})),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"prepend",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"after",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,p(e))})),c(t,"replaceWith",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null})),this.gc=()=>{u.forEach((t=>t())),this.gc=void 0},this.mc()}mc(){var t=!1;return()=>{var i;t||(t=!0,this.uc--,0===this.uc&&(null==(i=this.gc)||i.call(this)))}}yc(t,i){void 0===i&&(i=!0);var e=this.fc();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.hc.length&&(nh.info("Processing "+this.hc.length+" events for site app with id "+t.id),this.hc.forEach((t=>this.yc((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.vc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,nh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.yc((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){nh.error(oh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){nh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}bc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}_c(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.yc((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){nh.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.bc(),void this._instance.on("eventCaptured",(t=>this._c(t)))):void nh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.vc)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;At["__$$ph_site_app_"+i]=s._instance,null==(t=At.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,(t=>{if(t)return nh.error(oh+i,t)}))};for(var a of n.siteApps)o()}else nh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Kh={tracingHeaders:class{constructor(t){this.wc=void 0,this.kc=void 0,this.Sc=void 0,this.$v=()=>{var t,i,e=this.xc();e?(ui(this.wc)&&(this.wc=null==(t=At.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ui(this.kc)&&(this.kc=null==(i=At.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.zv()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Ks(t){var i,e;null!=(i=At.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=At.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Ul.error("failed to load script",i);t()}))}Cc(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}xc(){var t=this.Cc();return oi(t)?(oi(this.Sc)?this.Sc.splice(0,this.Sc.length,...t):this.Sc=[...t],t.length>0?this.Sc:void 0):(oi(this.Sc)&&this.Sc.splice(0),this.Sc=t||void 0,this.Sc)}zv(){var t,i;null==(t=this.wc)||t.call(this),null==(i=this.kc)||i.call(this),this.wc=void 0,this.kc=void 0}startIfEnabledOrStop(){this.xc()?this.Ks(this.$v):this.zv()}}},Yh=e({surveys:class extends uh{constructor(t){var i;super(new gh(t),{get projectToken(){return i.config.token},kv:new ph(i=t)}),this._instance=t}Ou(t,i){var e=i.query?wa(t,i.query):t;return new Promise((t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})}))}}},Hh),Xh={toolbar:class{constructor(t){this.instance=t}Tc(t){At.ph_toolbar_state=t}Mc(){var t;return null!==(t=At.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),fs(this.instance.config))return!1;if(!xt||!Et)return!1;t=null!=t?t:xt.location,e=null!=e?e:xt.history;try{if(!i){try{xt.localStorage.setItem("test","test"),xt.localStorage.removeItem("test")}catch(t){return!1}i=null==xt?void 0:xt.localStorage}var r,s=_h||Xn(t.hash,"__posthog")||Xn(t.hash,"state"),n=s?ls((()=>JSON.parse(atob(decodeURIComponent(s)))))||ls((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(mh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Ec(t){var i=At.ph_load_toolbar||At.ph_load_editor;!fi(i)&&ai(i)?i(t,this.instance):yh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==Et||!Et.getElementById(Vs));if(!xt||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(xt.localStorage.setItem(mh,JSON.stringify(e({},s,{source:void 0}))),2===this.Mc())this.Ec(s);else if(0===this.Mc()){var n;this.Tc(1),null==(n=At.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return yh.error("[Toolbar] Failed to load",t),void this.Tc(0);this.Tc(2),this.Ec(s)})),cs(xt,"turbolinks:load",(()=>{this.Tc(0),this.loadToolbar(s)}))}return!0}Ic(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Qh=e({experiments:Ah},Hh),Zh={conversations:class{constructor(t){this.Rc=void 0,this._conversationsManager=null,this.Pc=!1,this.je=null,this.Ac=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Fc=t.ok,t.ok)){var i=t.config.conversations;fi(i)||(_i(i)?this.Rc=i:(this.Rc=i.enabled,this.je=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Rc=void 0,this.je=null,this.Fc=void 0,this.Ac=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Pc||this._instance.config.disable_conversations||fs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==At?void 0:At.__PosthogExtensions__;if(t&&!ui(this.Rc)&&this.Rc)if(this.je&&this.je.token){this.Pc=!0;try{var i=t.initConversations;if(i)return this.Oc(i),void(this.Pc=!1);var e=t.loadExternalDependency;if(!e)return void this.Lc(ut);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Lc("Could not load conversations script",i):this.Oc(t.initConversations),this.Pc=!1}))}catch(t){this.Lc("Error initializing conversations",t),this.Pc=!1}}else Mh.error("Conversations enabled but missing token in remote config.")}}Oc(t){if(this.je)try{this._conversationsManager=t(this.je,this._instance),this.Ac=!1,Mh.info("Conversations loaded successfully")}catch(t){this.Lc("Error completing conversations initialization",t)}else Mh.error("Cannot complete initialization: remote config is null")}Lc(t,i){Mh.error(t,i),this._conversationsManager=null,this.Pc=!1,this.Ac=!0}show(){this._conversationsManager?this._conversationsManager.show():Mh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rc&&!ci(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":fs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Fc?"remote_config_failed":ui(this.Rc)?this.Fc?"disabled_in_project":"remote_config_pending":this.Rc?fi(this.je)||!this.je.token?"missing_token":null!=At&&At.__PosthogExtensions__?this.Pc?"initializing":this.Ac?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(Mh.warn(Dh),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Mh.warn(Dh),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Mh.warn(Dh),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Mh.warn(Dh),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Mh.warn(Dh),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Mh.warn(Dh),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Mh.warn(Dh),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}yu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}bu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},tu={logs:class{constructor(t){var i,r=this;this.name="logs",this.Dc=!1,this.$c=!1,this.Nc=!1,this.A=rs("[logs]"),this.qc=e({},this.A,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some(Uh)||r.A.error(...i)}}),this.fo=[],this.jc=[],this.vd=0,this.Fs=!1,this.Bc=[],this.Hc=[],this.zc=!1,this.Uc=!1,this.Wc=()=>{var t,i;this.Fs||(this.vd=0,null==(t=this.Vc)||t.onReconnect(),null==(i=this.Gc)||i.onReconnect())},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Dc=!0),xt&&cs(xt,"online",this.Wc)}Zc(t,i,e,r){var s,n=jh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new gr(this.Qc(t,i),n,this.qc,(()=>this.Jc()),(t=>t()),void 0,r),n]}Kc(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Vc||this.Yc!==i){var e;null==(e=this.Vc)||e.reset(),this.Yc=i;var r=this.Zc((()=>this.fo),(t=>{this.fo=t}));this.Vc=r[0],this.Xc=r[1]}return this.Vc}tf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Gc||this.ef!==i){var e;null==(e=this.Gc)||e.reset(),this.ef=i;var r=this.Zc((()=>this.jc),(t=>{this.jc=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Nh);this.Gc=r[0],this.if=r[1]}return this.Gc}setup(t){var i;if(!this.Fs){this.$s=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.Dc=!0),(this.Dc||this.rf()&&this.nf())&&this.sf();var e=!1,r=t.onRemoteConfig((t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)}));this.Fs?r.dispose():(this.Ns=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Fs||(this.Fs=!0,this.af(),null==(t=this.Ns)||t.dispose(),this.Ns=void 0,this.$s=void 0,this.Nc=!1,null==xt||xt.removeEventListener("online",this.Wc),null==(i=this.lf)||i.call(this),this.lf=void 0,null==(e=this.Vc)||e.reset(),null==(r=this.Gc)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Fs){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;fi(r)?this.uf():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[y]:!!r}),r?(this.Dc=!0,this.$c||this.sf(),this.loadIfEnabled()):this.uf())}}reset(){var t,i,e,r;this.af(),null==(t=this.Vc)||t.clearQueue(),this.fo=[],null==(i=this.Vc)||i.reset(),null==(e=this.Gc)||e.clearQueue(),this.jc=[],null==(r=this.Gc)||r.reset(),this.vd=0}captureLog(t){this.Fs||this.Kc().captureLog(t)}captureConsoleLog(t){this.Fs||this.tf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Fs||this.tf().captureLog(t,{context:i,occurredAtMs:e})}nf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[y])}rf(){var t,i;return null==(t=this._instance)||null==t.ho||!t.ho()||!(null==(i=At._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}wu(){var t;this.af(),null==(t=this.Gc)||t.clearQueue(),this.jc=[]}uf(){this.Dc||this.af()}sf(){var t,i=this;if(!this.zc&&null!=At&&At.console){var e=jh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(At.console[t])}catch(t){return 0}if(!r)return 0;i.Hc.push(zl(At.console,t,(s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.hf(t,n,e)}catch(t){}return s.apply(At.console,n)};return n.__rrweb_original__=r,n})))};for(var s of Lh)r(s);this.zc=!0,this.df=setTimeout((()=>{this.af()}),3e4)}}hf(t,i,e){var r;if(this.zc&&!this.Uc&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.Bc.length){this.Uc=!0;try{this.Bc.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Jc()})}finally{this.Uc=!1}}}else this.af()}af(){if(this.Bc=[],this.zc){for(var t of(this.zc=!1,this.df&&(clearTimeout(this.df),this.df=void 0),this.Hc))t();this.Hc=[]}}vf(){var t=this.Bc;return this.af(),t}get logger(){return this.cf||(this.cf={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.cf}flushLogs(t){t?this.ff(t):(this.Vc&&this.Vc.flush().catch((t=>this.pf(t))),this.Gc&&this.Gc.flush().catch((t=>this.pf(t))))}pf(t){Uh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Fs&&this.Dc&&!this.$c&&!this.Nc){var t=null==At?void 0:At.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.af();var i=t.loadExternalDependency;if(!i)return this.A.error(ut),void this.af();this.Nc=!0;try{i(this._instance,"logs",(i=>{if(this.Nc=!1,!this.Fs&&this.Dc){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.af();else{var r,s,n=this.vf();this.lf=e.initializeLogs(null!==(r=this.$s)&&void 0!==r?r:this._instance),this.$c=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.$s)&&void 0!==s?s:this._instance,n))}}}))}catch(t){throw this.Nc=!1,t}}}Qc(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===Nt.LogsQueue?t():void 0,setPersistedProperty(t,e){var r;t===Nt.LogsQueue&&i(null!==(r=e)&&void 0!==r?r:[])},ss:t=>this.ss(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}ss(t){return new Promise((i=>{if(Qn(this.vd,3))i({kind:"fatal",error:zh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:zh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.gf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.mf(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:zh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}}))}mf(t){(0!==t||this._instance.__loaded)&&(this.vd=Zn(t,this.vd,3,(()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}ff(t){this.fo.length>0&&this.yf(t,this.fo,this.Xc,s.LIB_NAME,(t=>{this.fo=t})),this.jc.length>0&&this.yf(t,this.jc,this.if,Nh,(t=>{this.jc=t}))}yf(t,i,e,r,n){if(0!==i.length){var o=i.map((t=>t.record));n([]);var a=pr(o,fr(e,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.gf(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}gf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Jc(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,fi(s)||(i.sessionStartTimestamp=s),fi(n)||(i.lastActivityTimestamp=n)}if(null!=At&&null!=(t=At.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?He(At.location.href):At.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},iu={metrics:class{constructor(t){this.A=rs("[metrics]"),this._instance=t}initialize(){}Kc(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Vc&&this.Yc===e||(null==(i=this.Vc)||i.reset(),this.Yc=e,this.Vc=new br(this.Qc(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.Vc}count(t,i,e){void 0===i&&(i=1),this.Kc().count(t,i,e)}gauge(t,i,e){this.Kc().gauge(t,i,e)}histogram(t,i,e){this.Kc().histogram(t,i,e)}flush(t){if(!this.Vc)return Promise.resolve();if(t){var i=this.Vc.drainWindow();return i&&this.Ss(i,t),Promise.resolve()}return this.Vc.flush().catch((t=>this.A.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Vc)||t.reset()}Qc(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ss:t=>i.Ss(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Ss(t,i){return new Promise((r=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),r(t))},o=setTimeout((()=>n({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(e({method:"POST",url:this.bf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))}))}bf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},eu=e({},Hh,qh,Vh,Wh,Gh,Jh,Yh,Kh,Xh,Qh,Zh,tu,iu);Cl.__defaultExtensionClasses=e({},eu)}();
|
|
2
2
|
//# sourceMappingURL=default-extensions.js.map
|