posthog-js 1.419.1 → 1.419.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +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/package.json +6 -6
- package/react/dist/esm/index.js.map +1 -1
- package/react/dist/esm/slim/index.js.map +1 -1
- package/react/dist/types/index.d.ts +4 -4
- package/react/dist/types/slim/index.d.ts +5 -5
- package/react/dist/umd/index.js.map +1 -1
- package/react/dist/umd/slim/index.js.map +1 -1
|
@@ -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.5.2",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.419.1",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="$web_vitals_allowed_metrics",b="$session_recording_remote_config",w="$replay_sample_rate",x="$replay_override_sampling",S="$replay_override_linked_flag",k="$replay_override_url_trigger",E="$replay_override_event_trigger",P="$sesid",T="$session_is_sampled",C="$enabled_feature_flags",F="$active_feature_flags",R="$early_access_features",I="$feature_flag_details",M="$feature_flag_payloads",A="$feature_flag_request_id",O="$minimal_flag_called_events",D="$override_feature_flags",j="$override_feature_flag_payloads",L="$stored_person_properties",N="$stored_group_properties",B="$groups",z="$surveys",U="$surveys_loaded_at",q="$surveys_activated",H="$surveys_activated_session",V="$surveys_activated_timestamps",W="ph_product_tours",G="$flag_call_reported",K="$flag_call_reported_session_id",J="$feature_flag_errors",Y="$feature_flag_evaluated_at",Q="$user_state",X="$client_session_props",Z="$capture_rate_limit",tt="$initial_campaign_params",it="$initial_referrer_info",et="$initial_person_info",rt="$epp",st="$posthog_cookieless",nt="$cookieless_mode",ot="$sdk_debug_extensions_init_method",at="$sdk_debug_extensions_init_time_ms",lt="$sdk_debug_recording_script_not_loaded",ht="PostHog loadExternalDependency extension not found.",ut="on_reject",dt="always",vt="anonymous",ct="identified",ft="identified_only",pt="visibilitychange",gt="beforeunload",_t="$pageview",mt="$pageleave",yt="$identify",bt="$groupidentify",wt="undefined"!=typeof window?window:void 0,xt="undefined"!=typeof globalThis?globalThis:wt,St=null==xt?void 0:xt.navigator,kt=null==xt?void 0:xt.document,Et=null==xt?void 0:xt.location,$t=null==xt?void 0:xt.fetch,Pt=null!=xt&&xt.XMLHttpRequest&&"withCredentials"in new xt.XMLHttpRequest?xt.XMLHttpRequest:void 0,Tt=null==xt?void 0:xt.AbortController,Ct=null==xt?void 0:xt.CompressionStream,Ft=null==St?void 0:St.userAgent;function Rt(){return!(!wt||!1===wt.navigator.onLine)}var It="undefined"!=typeof globalThis?globalThis:wt;It&&"undefined"==typeof self&&(It.self=It),It&&"undefined"==typeof File&&(It.File=function(){});var Mt=null!=wt?wt:{},At=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Ot(t){return"string"==typeof t||t}function Dt(t){return"string"==typeof t?t:void 0}var jt,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"],qt="NativeGzipValidationError",Ht=t=>t.length>=2&&31===t[0]&&139===t[1],Vt=(t,i)=>t===Bt.GZipJS||i===Bt.GZipJS||"gzip"===i,Wt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Gt=t=>{var i=new Error("Native gzip produced invalid output: "+t);throw i.name=qt,i},Kt=function(){var t=i((function*(t,i){18>t.size&&Gt("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ht(e)&&8===e[2]||Gt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(jt)return jt;jt=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;jt[t]=i>>>0}return jt})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Gt("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Gt("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function Jt(){return Jt=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 Kt(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),Jt.apply(this,arguments)}var Yt=20,Qt=1e3,Xt=1e4,Zt="[Circular]",ti="[Truncated]",ii="[Unserializable]",ei="[Function]";function ri(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 si=["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","pinterest","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"],ni=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return si.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function oi(t,i){return-1!==t.indexOf(i)}var ai=function(t){return t.trim()},li=function(t){return t.replace(/^\$/,"")};function hi(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 ui=Object.prototype,di=ui.hasOwnProperty,vi=ui.toString,ci=Array.isArray||function(t){return"[object Array]"===vi.call(t)},fi=t=>"function"==typeof t,pi=t=>t===Object(t)&&!ci(t),gi=t=>{if(pi(t)){for(var i in t)if(di.call(t,i))return!1;return!0}return!1},_i=t=>void 0===t,mi=t=>"[object String]"==vi.call(t),yi=t=>mi(t)&&0===t.trim().length,bi=t=>null===t,wi=t=>_i(t)||bi(t),xi=t=>"[object Number]"==vi.call(t)&&t==t,Si=t=>xi(t)&&t>0,ki=t=>"[object Boolean]"===vi.call(t),Ei=t=>t instanceof FormData,$i=t=>oi(zt,t),Pi=t=>oi(Ut,t);function Ti(t){return null===t||"object"!=typeof t}function Ci(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Fi(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 Ii(t,Error)}}function Ri(t){return"undefined"!=typeof Event&&Ii(t,Event)}function Ii(t,i){try{return t instanceof i}catch(t){return!1}}var Mi=[!0,"true",1,"1","yes"],Ai=t=>oi(Mi,t),Oi=[!1,"false",0,"0","no"];function Di(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),xi(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),Di(s||e,i,e,r))}class ji{constructor(t){this.k={},this.S=t.S,this.C=Di(t.bucketSize,0,100,t.I),this.R=Di(t.refillRate,0,this.C,t.I),this.A=Di(t.refillInterval,0,864e5,t.I)}O(t,i){var e=Math.floor((i-t.lastAccess)/this.A);e>0&&(t.tokens=Math.min(t.tokens+e*this.R,this.C),t.lastAccess=t.lastAccess+e*this.A)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,e):this.k[r]=s={tokens:this.C,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.S)||i.call(this,t)),0===s.tokens)}stop(){this.k={}}}var Li="Mobile",Ni="iOS",Bi="Android",zi="Tablet",Ui=Bi+" "+zi,qi="iPad",Hi="Apple",Vi=Hi+" Watch",Wi="Safari",Gi="BlackBerry",Ki="Samsung",Ji=Ki+"Browser",Yi=Ki+" Internet",Qi="Chrome",Xi=Qi+" OS",Zi=Qi+" "+Ni,te="Internet Explorer",ie=te+" "+Li,ee="Opera",re=ee+" Mini",se="Edge",ne="Microsoft "+se,oe="Firefox",ae=oe+" "+Ni,le="Nintendo",he="PlayStation",ue="Xbox",de=Bi+" "+Li,ve=Li+" "+Wi,ce="Windows",fe=ce+" Phone",pe="Nokia",ge="Ouya",_e="Generic",me=_e+" "+Li.toLowerCase(),ye=_e+" "+zi.toLowerCase(),be="Konqueror",we="Oculus Browser",xe="Vivaldi",Se="Yandex",ke="Whale",Ee="DuckDuckGo",$e="Pale Moon",Pe="Waterfox",Te="Brave",Ce="Google Search App",Fe="(\\d+(\\.\\d+)?)",Re=new RegExp("Version/"+Fe),Ie=new RegExp(ue,"i"),Me=new RegExp(he+" \\w+","i"),Ae=new RegExp(le+" \\w+","i"),Oe=new RegExp(Gi+"|PlayBook|BB10","i"),De={"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"},je=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?Te:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&oi(t,"GSA/")?Ce:oi(t," OPR/")&&oi(t,"Mini")?re:oi(t," OPR/")?ee:Oe.test(t)?Gi:oi(t,"IE"+Li)||oi(t,"WPDesktop")?ie:oi(t,"OculusBrowser")?we:oi(t,Ji)?Yi:oi(t,se)||oi(t,"Edg/")?ne:oi(t,xe+"/")?xe:oi(t,"YaBrowser/")?Se:oi(t,ke+"/")?ke:oi(t,Ee+"/")||oi(t,"Ddg/")?Ee:oi(t,"FBIOS")?"Facebook "+Li:oi(t,"UCWEB")||oi(t,"UCBrowser")?"UC Browser":oi(t,"CriOS")?Zi:oi(t,"CrMo")||oi(t,Qi)?Qi:oi(t,Bi)&&oi(t,Wi)?de:oi(t,"FxiOS")?ae:oi(t.toLowerCase(),be.toLowerCase())?be:oi(t,Te+"/")?Te:((t,i)=>i&&oi(i,Hi)||function(t){return oi(t,Wi)&&!oi(t,Qi)&&!oi(t,Bi)}(t))(t,i)?oi(t,Li)?ve:Wi:oi(t,"PaleMoon/")?$e:oi(t,Pe+"/")?Pe:oi(t,oe)?oe:oi(t,"MSIE")||oi(t,"Trident/")?te:oi(t,"Gecko")?oe:"")},Le={[ie]:[new RegExp("rv:"+Fe)],[ne]:[new RegExp(se+"?\\/"+Fe)],[Qi]:[new RegExp("("+Qi+"|CrMo)\\/"+Fe)],[Zi]:[new RegExp("CriOS\\/"+Fe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Fe)],[Wi]:[Re],[ve]:[Re],[ee]:[new RegExp("(Opera|OPR)\\/"+Fe)],[oe]:[new RegExp(oe+"\\/"+Fe)],[ae]:[new RegExp("FxiOS\\/"+Fe)],[be]:[new RegExp("Konqueror[:/]?"+Fe,"i")],[Gi]:[new RegExp(Gi+" "+Fe),Re],[de]:[new RegExp("android\\s"+Fe,"i")],[Yi]:[new RegExp(Ji+"\\/"+Fe)],[we]:[new RegExp("OculusBrowser\\/"+Fe)],[xe]:[new RegExp(xe+"\\/"+Fe)],[Se]:[new RegExp("YaBrowser\\/"+Fe)],[ke]:[new RegExp(ke+"\\/"+Fe)],[Te]:[new RegExp(Te+"\\/"+Fe)],[Ee]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Fe)],[$e]:[new RegExp("PaleMoon\\/"+Fe)],[Pe]:[new RegExp(Pe+"\\/"+Fe)],[Ce]:[new RegExp("GSA\\/"+Fe)],[te]:[new RegExp("(rv:|MSIE )"+Fe)],Mozilla:[new RegExp("rv:"+Fe)]},Ne=function(t,i,e,r){var s=je(t,i,e,r),n=Le[s];if(_i(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},Be=[[new RegExp(ue+"; "+ue+" (.*?)[);]","i"),t=>[ue,t&&t[1]||""]],[new RegExp(le,"i"),[le,""]],[new RegExp(he,"i"),[he,""]],[Oe,[Gi,""]],[new RegExp(ce,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[fe,""];if(new RegExp(Li).test(i)&&!/IEMobile\b/.test(i))return[ce+" "+Li,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=De[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[ce,r]}return[ce,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ni,[t[3],t[4],t[5]||"0"].join(".")]:[Ni,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=_i(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Bi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Bi+")","i"),t=>t&&t[2]?[Bi,[t[2],t[3],t[4]||"0"].join(".")]:[Bi,""]],[/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/,[Xi,""]],[/Linux|debian/i,["Linux",""]]],ze=function(t){return Ae.test(t)?le:Me.test(t)?he:Ie.test(t)?ue:new RegExp(ge,"i").test(t)?ge:new RegExp("("+fe+"|WPDesktop)","i").test(t)?fe:/iPad/.test(t)?qi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Vi:Oe.test(t)?Gi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(pe,"i").test(t)?pe:/(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(Li).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)?Bi:Ui:new RegExp("(pda|"+Li+")","i").test(t)?me:new RegExp(zi,"i").test(t)&&!new RegExp(zi+" pc","i").test(t)?ye:""},Ue=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function qe(t,i){return"string"==typeof(e=t)&&Ue.test(e)?t:i();var e}function He(t){return t?t.split("#")[0]:t}function Ve(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function We(t,i,e){return Ge.apply(this,arguments)}function Ge(){return(Ge=i((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ve((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ke={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}},Je=Ke.info,Ye=0x8000000000000000,Qe={}.propertyIsEnumerable;function Xe(t,i){try{return ir(t,i,{ancestors:new WeakSet,remainingNodes:Xt},0)}catch(t){return[]}}function Ze(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:ti};if(e.remainingNodes--,ki(t))return{boolValue:t};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>=Ye||-Ye>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:ri(t)};if("function"==typeof t)return{stringValue:ei};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:Zt};if(r>=Yt)return{stringValue:ti};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?ri(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Ze(a.call(t),i,e,r+1)}catch(t){}return ci(t)?{arrayValue:{values:tr(t,i,e,r+1)}}:{kvlistValue:{values:ir(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:ri(String(t))}}function tr(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(wi(a))continue;s.push(Ze(a,i,e,r))}catch(t){s.push({stringValue:ii})}return t.length>o&&s.push({stringValue:ti}),s}function ir(t,i,e,r){var s=[];for(var n in t)if(Qe.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(bi(o)||_i(o))continue;s.push({key:ri(n),value:Ze(o,i,e,r)})}catch(t){s.push({key:ri(n),value:{stringValue:ii}})}}return s}function er(t){try{return ri(String(t))}catch(t){return ii}}function rr(t,i,r){var s=Ke[t.level||"info"]||Je,n=s.text,o=s.number,a=String(Date.now())+"000000",l={};i.distinctId&&(l.posthogDistinctId=i.distinctId),i.sessionId&&(l.sessionId=i.sessionId),i.windowId&&(l["window.id"]=i.windowId),wi(i.sessionStartTimestamp)||(l.sessionStartTimestamp=String(i.sessionStartTimestamp)),wi(i.lastActivityTimestamp)||(l.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(l["url.full"]=i.currentUrl),i.screenName&&(l["screen.name"]=i.screenName),i.appState&&(l["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(l.feature_flags=i.activeFeatureFlags);var h=e({},l),u=t.attributes;if(u){var d=[];try{d=Object.keys(u)}catch(t){d=[]}for(var v of d){var c=void 0;try{c=u[v]}catch(t){c=ii}Object.defineProperty(h,v,{value:c,enumerable:!0,writable:!0,configurable:!0})}}var f={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:er(t.body)},attributes:Xe(h,r)};return t.trace_id&&(f.traceId=t.trace_id),t.span_id&&(f.spanId=t.span_id),_i(t.trace_flags)||(f.flags=t.trace_flags),f}function sr(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 nr(t,i,e,r){return{resourceLogs:[{resource:{attributes:Xe(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let or=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.qi=i,this.I=e,this.rn=r,this.nn=s,this.sn=n,this.an=o,this.ln=null,this.un=0,this.hn=0,this.dn=0,this.vn=0,this.cn=!1,this.fn=i.maxBufferSize,this.pn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.gn=i.flushIntervalMs,this.mn=i.maxBatchRecordsPerPost,this.yn=i.rateCapWindowMs,this.bn=i.maxLogsPerInterval}reset(){this._n(),this.ln=null,this.dn=0,this.vn=0,this.cn=!1,this.un=0,this.hn=0,this.mn=this.qi.maxBatchRecordsPerPost}onReconnect(){this.hn=0,this.wn()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var i=this.kn(t);if(null!==i)if(i.body){if(this.Sn()){var e={record:rr(i,this.rn(),this.I)};this.nn((()=>this.xn(e)))}}else this.I.info("Log was rejected in beforeSend function")}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=ci(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for log:",t),null}return r}Sn(){if(void 0===this.bn)return!0;var t=Date.now(),i=t-this.dn;return this.yn>i&&i>=0||(this.dn=t,this.vn=0,this.cn=!1),this.bn>this.vn?(this.vn++,!0):(this.cn||(this.I.warn("captureLog dropping logs: exceeded "+this.bn+" logs per "+this.yn+"ms"),this.cn=!0),!1)}flush(){var t=this;return i((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return i((function*(){var i;t._n();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;t.un=0;var a=Math.min(e.length,t.mn),l=e.slice(0,a),h=nr(l.map((t=>t.record)),t.Tn(),null!==(n=t.an)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Mn(h);if("too-large"===u.kind&&l.length>1)t.mn=Math.max(1,Math.floor(l.length/2)),t.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.mn);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.I.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"===u.kind&&t.qi.maxBatchRecordsPerPost>t.mn&&(t.mn=Math.min(t.qi.maxBatchRecordsPerPost,t.mn+1)),yield t.En(l.length),e=null!==(o=t._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}}))()}En(t){var e=this;return i((function*(){var i,r=Math.max(0,t-e.un),s=null!==(i=e._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(Nt.LogsQueue,s.slice(r)),yield e.sn()}))()}Tn(){return sr(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];this.pn>e.length||(e.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(Nt.LogsQueue,e),this.fn>e.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Ve((()=>{this.Rn=void 0,this.wn()}),t))}Pn(){var t=Math.min(Math.max(0,this.hn-1),6);return this.gn*Math.pow(2,t)}An(){var t=this._instance.getPersistedProperty(Nt.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i((function*(){e._n();var i=e.flush().catch((()=>{}));void 0!==t?yield We(i,t):yield i}))()}flushWithTimeout(t){var e=this;return i((function*(){var i=e.flush();yield We(i,t,(()=>{i.catch((()=>{}))}))}))()}wn(){this.flush().then((()=>{this.hn=0}),(t=>{this.hn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())}))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var ar=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function lr(t){return String(t)+"000000"}function hr(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 ur=class{constructor(t,i,e){this._instance=t,this.qi=i,this.I=e,this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.$n=0}count(t,i,e){void 0===i&&(i=1),this.Nn({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.Nn({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.Nn({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.ln,r=function(){var r=i((function*(){e&&(yield e.catch((()=>{}))),yield t.qn()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.ln===s&&(this.ln=null)}));return this.ln=s,s}drainWindow(){if(0===this.Fn.size)return null;var t=this.Fn;return this.Fn=new Map,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.jn(t)}reset(){this.$n++,this._n(),this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set}Nn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.kn(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.I.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=hr(i.type,i.name,i.unit,r)}catch(t){return void this.I.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.Fn.get(s);if(!n){if(!this.Bn())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.Fn.set(s,n)}var o=this.On.get(i.name);void 0===o?this.On.set(i.name,i.type):o===i.type||this.Dn.has(i.name)||(this.Dn.add(i.name),this.I.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.Hn(n,i.value),this.In()}else this.I.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Bn(){return this.qi.maxSeriesPerFlush>this.Fn.size||(this.Ln||(this.Ln=!0,this.I.warn("Metric series cap reached ("+this.qi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Hn(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(ar.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,ar)]+=1}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=ci(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for metric:",t),null}return r}In(){this.Rn||(this.Rn=Ve((()=>{this.Rn=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.qi.flushIntervalMs))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}qn(){var t=this;return i((function*(){if(0!==t.Fn.size){var i=t.Fn;t.Fn=new Map,t.Ln=!1,t.On=new Map,t.Dn=new Set;var e=t.$n,r=yield t._instance.Un(t.jn(i));if(e===t.$n)switch(r.kind){case"ok":return;case"retry-later":return t.zn(i),void t.In();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}}))()}jn(t){return i=this.Wn(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.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Xe(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,r,s,n}Wn(t){var i=lr(Date.now()),r=new Map;for(var s of t.values()){var n,o=hr(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=Xe(null!==(n=s.attributes)&&void 0!==n?n:{},this.I),h=lr(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:ar})}return Array.from(r.values())}zn(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Fn.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.Bn()&&this.Fn.set(s,n)}}};var dr,vr,cr;function fr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return cr&&e.length===vr||(vr=e.length,cr=e.reduce(((e,r)=>{dr||(dr={});var s=dr[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,dr[r]=[l,h];break}}return e}),{})),cr}}class pr{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&&ci(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:fr(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 gr="?";function _r(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?gr:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return _i(r)||(n.lineno=r),_i(s)||(n.colno=s),n}var mr=(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]:gr,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},yr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,br=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wr=/\((\S*)(?::(\d+))(?::(\d+))\)/,xr=(t,i)=>{var e=yr.exec(t);if(e)return _r(i,e[1],gr,+e[2],+e[3]);var r=br.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=wr.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=mr(r[1]||gr,r[2]);return _r(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Sr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Er=(t,i)=>{var e=Sr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=kr.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]||gr,o=mr(n,s);return _r(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},$r=/\(error: (.*)\)/;class Pr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=mi(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 Ci(t,"DOMException")}isDOMError(t){return Ci(t,"DOMError")}}class Tr{match(t){return Fi(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 Cr{constructor(){}match(t){return!!Ci(t,"ErrorEvent")&&(null!=t.error||this.fi(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.pi(t))&&void 0!==r?r:s.stack,synthetic:!0})}fi(t){return mi(t.message)&&t.message.length>0}pi(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(mi(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Fr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Rr{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(Fr);return r&&(i=r[1],e=r[2]),[i,e]}}var Ir=["fatal","error","warning","log","info","debug"];function Mr(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 Ar{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(Ri(t))return t.constructor.name;var i="name"in t?t.name:void 0;return mi(i)&&!yi(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: "+Mr(t)}isSeverityLevel(t){return mi(t)&&!yi(t)&&Ir.indexOf(t)>=0}getStack(t){try{return mi(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:mi(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(Fi(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Or{match(t){return Ri(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Mr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Dr{match(t){return Ti(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 jr{match(t){return Ci(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ri(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 Ti(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 Lr="$message",Nr="$timestamp",Br=new Set([Lr,Nr]),zr={enabled:!0,max_bytes:32768};function Ur(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:zr.enabled,max_bytes:Hr(t.max_bytes,zr.max_bytes)}:e({},zr)}class qr{constructor(t){this.Vn=[],this.Gn=0,this.qi=Ur(t)}setConfig(t){this.qi=Ur(t),this.Zn()}add(t){var i=function(t){var i;try{i=hi(t)}catch(t){return}try{var e=JSON.parse(i);if(!pi(e))return;var r=e,s=r[Lr],n=r[Nr];if(!mi(s)||0===s.trim().length)return;if(!mi(n)&&!xi(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.qi.max_bytes||(this.Vn.push({step:i.step,bytes:e}),this.Gn+=e,this.Zn())}}getAttachable(){return this.Vn.map((t=>t.step))}clear(){this.Vn=[],this.Gn=0}size(){return this.Vn.length}Zn(){for(;this.Gn>this.qi.max_bytes&&this.Vn.length>0;){var t=this.Vn.shift();t&&(this.Gn-=t.bytes)}}}function Hr(t,i){if(!xi(t)||t===1/0||t===-1/0)return i;var e=Math.floor(t);return 0>e?i:e}var Vr=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={F(i){if(wt&&(s.DEBUG||wt.POSTHOG_DEBUG||e)&&!_i(wt.console)&&wt.console){for(var r=("__rrweb_original__"in wt.console[i]?wt.console[i].__rrweb_original__:wt.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.F("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.F("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.F("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.F("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)=>Vr(t+" "+i,e)};return r},Wr=Vr("[PostHog.js]"),Gr=Wr.createLogger;function Kr(t,i){ci(t)&&t.forEach(i)}function Jr(t,i){if(!wi(t))if(ci(t))t.forEach(i);else if(Ei(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)di.call(t,e)&&i(t[e],e)}var Yr=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 Qr(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 Xr=function(t){try{return t()}catch(t){return}},Zr=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){Wr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wr.critical(t)}}},ts=function(t){var i={};return Jr(t,(function(t,e){(mi(t)&&t.length>0||xi(t))&&(i[e]=t)})),i};var is=["herokuapp.com","vercel.app","netlify.app"];function es(t){var i=null==t?void 0:t.hostname;if(!mi(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of is)if(e===r)return!1;return!0}function rs(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 ss(t){return"ph_toolbar_internal"===t.name}var ns=t=>{if(kt){try{for(var i=t+"=",e=kt.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 xi(t)&&isFinite(t)&&Math.floor(t)===t});class os{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 os(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 os(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 as{generate(){var t=this.generateOrAbort();if(!_i(t))return t;this.Rr=0;var i=this.generateOrAbort();if(_i(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Rr)this.Rr=t,this.Ar();else{if(this.Rr>=t+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return os.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new us}}var ls,hs=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};wt&&!_i(wt.crypto)&&crypto.getRandomValues&&(hs=t=>crypto.getRandomValues(t));class us{nextUint32(){return this.ft.length>this.Fr||(hs(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var ds=()=>vs().toString(),vs=()=>(ls||(ls=new as)).generate(),cs="",fs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ps={Nr:()=>!!kt,jr(t){Wr.error("cookieStore error: "+t)},Pr:ns,Br(t){var i;try{i=JSON.parse(ps.Pr(t))||{}}catch(t){}return i},Dr(t,i,e,r,s){if(!kt)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=kt),cs)return cs;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_"+ds();!cs&&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",cs=n)}return cs}(t);if(!e){var r=(t=>{var i=t.match(fs);return i?i[0]:""})(t);r!==e&&Wr.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(kt.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&&Wr.warn("cookieStore warning: large cookie, len="+h.length),kt.cookie=h,!0}catch(t){return!1}},qr(t,i){if(null!=kt&&kt.cookie)try{ps.Dr(t,"",-1,i)}catch(t){return}}},gs=null,_s={Nr(){if(!bi(gs))return gs;var t=!0;if(_i(wt))t=!1;else try{var i="__mplssupport__";_s.Dr(i,"xyz"),'"xyz"'!==_s.Pr(i)&&(t=!1),_s.qr(i)}catch(i){t=!1}return t||Wr.error("localStorage unsupported; falling back to cookie store"),gs=t,t},jr(t){Wr.error("localStorage error: "+t)},Pr(t){try{return null==wt?void 0:wt.localStorage.getItem(t)}catch(t){_s.jr(t)}return null},Br(t){try{return JSON.parse(_s.Pr(t))||{}}catch(t){}return null},Dr(t,i){try{return null==wt||wt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){_s.jr(t)}return!1},qr(t){try{null==wt||wt.localStorage.removeItem(t)}catch(t){_s.jr(t)}}},ms=[L,F,C,I,M,A,Y,J,G],ys=[a,o,P,T,rt,et,Q],bs=t=>t+"_cpm",ws=["__proto__","constructor","prototype"],xs=t=>{if(!pi(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===ws.indexOf(e)&&(i[e]=t[e])})),i},Ss=function(t,i){void 0===i&&(i=[]);var e={};return[...ys,...i].forEach((i=>{var r=t[i];_i(r)||bi(r)||""===r||(e[i]=r)})),e},ks=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)},Es=(t,i)=>({p:i,f:ks(JSON.stringify(t))}),$s=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=ps.Br(bs(t)),r=(null==e?void 0:e.f)===ks(i)&&ci(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ps=(t,i)=>i+"|"+(ps.Pr(bs(t))||""),Ts={},Cs={Nr:()=>!0,jr(t){Wr.error("memoryStorage error: "+t)},Pr:t=>Ts[t]||null,Br:t=>Ts[t]||null,Dr:(t,i)=>(Ts[t]=i,!0),qr(t){delete Ts[t]}},Fs=null,Rs={Nr(){if(!bi(Fs))return Fs;if(Fs=!0,_i(wt))Fs=!1;else try{var t="__support__";Rs.Dr(t,"xyz"),'"xyz"'!==Rs.Pr(t)&&(Fs=!1),Rs.qr(t)}catch(t){Fs=!1}return Fs},jr(t){Wr.error("sessionStorage error: ",t)},Pr(t){try{return null==wt?void 0:wt.sessionStorage.getItem(t)}catch(t){Rs.jr(t)}return null},Br(t){try{return JSON.parse(Rs.Pr(t))||null}catch(t){}return null},Dr(t,i){try{return null==wt||wt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Rs.jr(t)}return!1},qr(t){try{null==wt||wt.sessionStorage.removeItem(t)}catch(t){Rs.jr(t)}}};class Is{constructor(t){this._instance=t}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===dt||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===ut}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qi.opt_out_capturing_by_default}optInOut(t){this.ps.Dr(this.gs,t?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){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 fs(){var t=this.ps.Pr(this.gs);return Ai(t)?1:oi(Oi,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,i="localStorage"===t?_s:ps;if(!this.ys||this.ys!==i){this.ys=i;var e="localStorage"===t?ps:_s;e.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(Ai(e.Pr(this.gs))),e.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==St?void 0:St.doNotTrack,null==St?void 0:St.msDoNotTrack,Mt.doNotTrack].some((t=>Ai(t)))}}function Ms(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!fi(r))return i;try{var s=r(i);return mi(s)&&s?s:i}catch(t){return Wr.error("Error in get_current_url, falling back to window.location.href",t),i}}var As="__POSTHOG_TOOLBAR__",Os=1,Ds=3,js=11;function Ls(t){return t instanceof Element&&(t.id===As||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Ns(t){return!!t&&t.nodeType===Os}function Bs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function zs(t){return!!t&&t.nodeType===Ds}function Us(t){return!!t&&t.nodeType===js&&Ns(t.host)}var qs=1e3;function Hs(t){return t?ai(t).split(/\s+/):[]}function Vs(t,i){var e=function(t){var i,e=null==wt||null==(i=wt.location)?void 0:i.href;return _i(e)?void 0:Ms(t,e)}(i);return!!(e&&t&&t.some((t=>e.match(t))))}function Ws(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 Hs(i)}function Gs(t){return wi(t)?null:ai(t).split(/(\s+)/).filter((t=>mn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ks(t){var i="";return hn(t)&&!un(t)&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var e;zs(t)&&t.textContent&&(i+=null!==(e=Gs(t.textContent))&&void 0!==e?e:"")})),ai(i)}function Js(t){var i;return _i(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var Ys=["a","button","form","input","select","textarea","label"];function Qs(t,i){if(_i(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 Xs(t){var i=t.parentNode;return!(!i||!Ns(i))&&i}var Zs=[".ph-no-autocapture","[data-ph-no-autocapture]"],tn=["next","previous","prev",">","<"],en=[...tn,"+","-","−","–"],rn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,sn=[".ph-no-rageclick",".ph-no-capture"],nn=["","text","search","email","password","url","tel","number"];function on(t,i){if(!wt||an(t))return!1;var e,r,s,n,o;if(ki(i)?(e=!!i&&sn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:sn,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||!Ns(t))&&(!!Bs(t,"textarea")||(Bs(t,"input")?oi(nn,(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=ln(t,!1).targetElementList;return!function(t,i){if(!1===t||_i(t))return!1;var e;if(!0===t)e=tn;else{if(!ci(t))return!1;if(t.length>10)return Wr.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=>rn(i,t)||rn(r,t)))}))}(r,a.map((t=>{var i;return{safeText:Ks(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!Qs(a,e)}var an=t=>!t||Bs(t,"html")||!Ns(t),ln=(t,i)=>{if(!wt||an(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!Bs(s,"body");)if(Us(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Xs(s);if(!n)break;if(i||Ys.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=wt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function hn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Bs(r,"body");r=r.parentNode){if(e++>=qs||i.has(r))return!1;i.add(r);var s=Ws(r);if(oi(s,"ph-sensitive")||oi(s,"ph-no-capture"))return!1}if(oi(Ws(t),"ph-include"))return!0;var n=t.type||"";if(mi(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!mi(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 un(t){return!!(Bs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Bs(t,"select")||Bs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var dn=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}))$"),vn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,cn=[16,15,14,13],fn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),pn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),gn=/[0-9A-Za-z_]/;function _n(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 mn(t,i){if(void 0===i&&(i=!0),wi(t))return!1;if(mi(t)){t=ai(t);var e=i?dn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(vn.lastIndex=0;i=vn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of cn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(dn.test(a)&&_n(a))return!0}}}return!1}(t);if(e)return!1;var r=i?fn.test(t):function(t){var i;for(pn.lastIndex=0;i=pn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&gn.test(e)&&gn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function yn(t){var i=Ks(t);return mn(i=(i+" "+bn(t)).trim())?i:""}function bn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ks(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+bn(t)).trim())}catch(t){Wr.error("[AutoCapture]",t)}})),i}function wn(t){return t.replace(/"|\\"/g,'\\"')}function xn(t){var i=t.attr__class;if(i)return ci(i)?i:Hs(i)}var Sn=Gr("[Dead Clicks]"),kn=()=>!0,En=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(_)),r=t.instance.config.capture_dead_clicks;return ki(r)?r:!!pi(r)||e};class $n{get lazyLoadedDeadClicksAutocapture(){return this.bs}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._s((()=>{this.ws()})):this.stop()}_s(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?Sn.error("failed to load script",i):t()}))}ws(){var t;if(kt){if(!this.bs&&null!=(t=Mt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=pi(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.bs=Mt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.bs.start(kt),Sn.info("starting...")}}else Sn.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Sn.info("stopping..."))}}var Pn=Gr("[SegmentIntegration]");var Tn="posthog-js";function Cn(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 Fn{constructor(t,i,e,r,s,n){this.name=Tn,this.setupOnce=function(o){o(Cn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Rn{constructor(t){this.ks=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Wr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.xs()}xs(){var t;this.Cs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ks)}destroy(){var t;null==(t=this.Cs)||t.call(this),this.Cs=void 0}doPageView(t,i){var e,r=this.Ts(t,i);return this.Ss={pathname:null!==(e=null==wt?void 0:wt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.Ts(t,null==(i=this.Ss)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,i){var e=this.Ss;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(!(_i(n)||_i(o)||_i(a)||_i(l)||_i(h)||_i(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?Di(o/n,0,1,Wr):1,v=n>1?Di(a/n,0,1,Wr):1,c=l>1?Di(h/l,0,1,Wr):1,f=l>1?Di(u/l,0,1,Wr):1;r=Yr(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 In=["flags","surveys"],Mn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[g]:{exposure:"event"},[_]:{exposure:"event"},[m]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[P]:{exposure:"hidden"},[T]:{exposure:"event"},[w]:{exposure:"event",shouldSkipFromEventProperties:t=>bi(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"},[C]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[O]:{exposure:"hidden",storageGroup:"flags"},[D]:{exposure:"hidden"},[j]:{exposure:"hidden"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden"},[z]:{exposure:"hidden",storageGroup:"surveys"},[U]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[q]:{exposure:"event"},[H]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{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"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[B]:{exposure:"event"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"event"},[k]:{exposure:"event"},[E]:{exposure:"event"},[ot]:{exposure:"event"},[at]:{exposure:"event"},[lt]:{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"}},An=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],On=t=>{var i=Mn[t];if(i)return i;for(var e of An){var r=e[1];if(0===t.indexOf(e[0]))return r}},Dn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return hi(t)}},jn=t=>{var i=null==kt?void 0:kt.createElement("a");return _i(i)?null:(i.href=t,i)},Ln=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(!ci(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Wr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Nn=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("=");ci(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},Bn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},zn=(t,i)=>t>=i&&Rt(),Un=(t,i,e,r)=>{if(0===t){if(Rt()){var s=i+1;return s===e&&r(),s}return i}return 0},qn="https?://(.*)",Hn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Vn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Hn],Wn="<masked>",Gn=["li_fat_id"];function Kn(t,i,e){if(!kt)return{};var r,s=i?[...Hn,...e||[]]:[],n=Jn(Nn(kt.URL,s,Wn),t),o=(r={},Jr(Gn,(function(t){var i=ns(t);r[t]=i||null})),r);return Yr(o,n)}function Jn(t,i){var e=Vn.concat(i||[]),r={};return Jr(e,(function(i){var e=Ln(t,i);r[i]=e||null})),r}function Yn(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(!bi(i)){r.$search_engine=i;var s=kt?Ln(kt.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function Qn(){return navigator.language||navigator.userLanguage}var Xn="$direct";function Zn(){return(null==kt?void 0:kt.referrer)||Xn}function to(t,i,e){void 0===e&&(e=!1);var r=t?[...Hn,...i||[]]:[],s=e?He(null==Et?void 0:Et.href):null==Et?void 0:Et.href,n=null==s?void 0:s.substring(0,1e3);return{r:Zn().substring(0,1e3),u:n?Nn(n,r,Wn):void 0}}function io(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==Xn?Xn: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=Jn(n);Yr(o,l)}if(r){var h=Yn(r);Yr(o,h)}return o}function eo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ro(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var so={flags:Y,surveys:U},no=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],oo=t=>t+"_cookie_identity_change_pending",ao="main",lo=(t,i)=>{Jr(t,((e,r)=>{var s=On(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class ho{constructor(t,i,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=t,this.As=r,this.props={},this.Fs=void 0,this.Ls=(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.ps=this.Os(t),this.Is=this.Ds(t),this.load(),t.debug&&Wr.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save(),wt){var s=()=>this.flush();rs(wt,"beforeunload",s,{capture:!1}),rs(wt,"pagehide",s,{capture:!1})}}$s(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return xi(i)&&i>0?i:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var i=Ss(t,this.qi.cookie_persisted_properties||[]),e=Es(i,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=ps.Pr(this.Ls)||void 0;s&&Ps(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=ps.Pr(this.Ls)||void 0;this.qs=n?Ps(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,i){if(void 0===i&&(i=!1),this.Hs&&!i||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=ps.Pr(this.Ls)||void 0}catch(t){}if(!e||e===this.js)return!1;var r,s=Ps(this.Ls,e);try{r=xs(JSON.parse(e))}catch(t){return!1}if((ps.Pr(this.Ls)||void 0)!==e)return!1;this.qs=s,this.js=e;var n=$s(this.Ls,e),a=[...ys,...n.properties],l={};if(Object.keys(r).forEach((t=>{var i=r[t];(_i(i)||bi(i)||""===i||t===Q&&i!==vt&&i!==ct)&&(l[t]=!0,delete r[t])})),gi(r))return!1;var u=o in r||r[Q]===vt||r[Q]===ct,d=this.props[o],v=this.props[Q],c=Yr({},this.props);[...ys,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==Q)){var i=c[t];!n.isValid&&-1!==ys.indexOf(t)&&(!1===i||0===i)||delete c[t]}})),this.props=Yr(c,r),!u||Q in r||Q in this.props||this.Us(Q,vt);var f=this.props[o],p=this.props[Q];return!u||f===d&&p===v||(this.Rs=!0,Rs.Dr(oo(this.Ls),!0),this.zs(L),this.zs(F),this.zs(C),this.zs(I),this.zs(M),this.zs(A),this.zs(Y),this.zs(J),this.zs(G),p===vt&&(v===ct||r[Q]===vt||!_i(d)&&f!==d)&&(lo(this.props,r),this.zs(N)),p===ct?this.props.$user_id=f:delete this.props.$user_id,this.zs(h)),!0}consumeCookieIdentityChange(){var t=oo(this.Ls),i=this.Rs||!!Rs.Pr(t);return this.Rs=!1,i&&Rs.qr(t),i}Ws(t){return void 0===t&&(t=!1),!(this.Ps||this.Hs&&!t||!this.qi.cookieWinsOnConflict||"localstorage+cookie"!==this.qi.persistence.toLowerCase()||(this.Ps=!0,0))}Vs(){this.Ps&&(_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[ao],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(t){-1===no.indexOf(t.persistence.toLowerCase())&&(Wr.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=[...ys,...t];return e({},_s,{Br(t){try{var e,s={};try{e=ps.Pr(t)||void 0,s=e?xs(JSON.parse(e)):{}}catch(t){}var n,a=JSON.parse(_s.Pr(t)||"{}");if(i){var l=$s(t,e),h=[...ys,...l.properties],u={};Object.keys(s).forEach((t=>{var i=s[t];bi(i)||""===i||t===Q&&i!==vt&&i!==ct||(u[t]=i)}));var d=o in u||u[Q]===vt||u[Q]===ct;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[Q])&&void 0!==v?v:vt;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==Q)){var i=a[t];!l.isValid&&-1!==ys.indexOf(t)&&(!1===i||0===i)||delete a[t]}})),!d||Q in s||Q in a||(a[Q]=vt),!d||(o in u?u[o]:a[o])===c&&(Q in u?u[Q]:a[Q])===f||(ms.forEach((t=>delete a[t])),u[Q]===ct&&o in u?a.$user_id=u[o]:delete a.$user_id,u[Q]!==ct&&(delete a[B],delete a[N]),delete a.__alias)}n=Yr(a,u)}else n=Yr(s,a);return _s.Dr(t,n),n}catch(t){}return null},Dr(e,r,s,n,o,a){var l=_s.Dr(e,r,void 0,void 0,a);try{var h=Ss(r,t);if(Object.keys(h).length){if(i){var u=bs(e),d=Es(h,t);if(ps.Dr(u,d,s,n,o,a),ps.Pr(u)!==JSON.stringify(d)){ps.qr(u,n);var v=Ss(r);return ps.Dr(e,v,s,n,o,a),l}}ps.Dr(e,h,s,n,o,a)}}catch(t){_s.jr(t)}return l},qr(t,i){try{null==wt||wt.localStorage.removeItem(t),ps.qr(t,i),ps.qr(bs(t),i)}catch(t){_s.jr(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&_s.Nr()?(i=_s,s=!0):"localstorage+cookie"===n&&r.Nr()?(i=r,s=!0):"sessionstorage"===n&&Rs.Nr()?i=Rs:"memory"===n?i=Cs:"cookie"===n?i=ps:r.Nr()?(i=r,s=!0):i=ps,this.Es=s,i}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return Jr(this.props,((i,e)=>{var r=On(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.Hs||t){var i=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),e=i?_s.Br(this.Ls):null,r={};if(i)try{Jr(r=xs(ps.Br(this.Ls)),((t,i)=>{(_i(t)||bi(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=Yr({},s)),this.Is&&this.Ks(),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:vt,u=s[o],d=null!==(a=s[Q])&&void 0!==a?a:vt;if(u!==l||d!==h){this.Rs=!0,Rs.Dr(oo(this.Ls),!0);var v=Yr({},this.props);ms.forEach((t=>delete v[t])),d===vt&&(h===ct||r[Q]===vt||!_i(l)&&u!==l)&&(lo(v,r),delete v[N]),this.props=v;var c=new Set;ms.forEach((t=>{var i,e=null==(i=On(t))?void 0:i.storageGroup;e&&c.add(e)})),c.forEach((t=>{var i={};Jr(this.props,((e,r)=>{var s;(null==(s=On(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),gi(i)?(_s.qr(this.Js(t)),this.Ms[t]={}):_s.Dr(this.Js(t),i)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(i,t)})}))}}Rs.Pr(oo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of In){var i=_s.Br(this.Js(t));if(i&&!gi(i)){var e=this.Xs(t);e.persisted=!0,this.ta(t)||(e.fingerprint=this.Ys(i,t)),this.ea(t,i)||Yr(this.props,i)}}}ta(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=On(i))?void 0:e.storageGroup)===t}))}ea(t,i){var e=so[t];if(!e)return!1;var r=i[e],s=this.props[e];return xi(r)&&xi(s)&&s>r}refreshKey(t){var i;if(!this.Hs){var e=this.Is?null==(i=On(t))?void 0:i.storageGroup:void 0,r=e?_s.Br(this.Js(e)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(e){var s=this.ps.Br(this.Ls);if(s&&t in s)return void this.Us(t,s[t])}this.zs(t)}}}save(){if(!this.Hs){var t=this.$s();t>0?_i(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(t){void 0===t&&(t=!1),this.Hs||this.Ps&&!t||(t||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Ls,this.props,ao)&&this.Ns(this.props))}ia(){var t=this.na(),i=t.main,e=t.groups;for(var r of(this.ra(this.ps,this.Ls,i,ao)&&this.Ns(i),In)){var s,n=e[r];(!gi(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(_s,this.Js(r),n,r)}}na(){var t={},i={flags:{},surveys:{}};return Jr(this.props,((e,r)=>{var s,n=null==(s=On(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Ys(t,i){if(i===ao)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var e={};return Jr(t,((t,i)=>{var r;e[i]=null!=(r=On(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}ra(t,i,e,r){var s,n=this.Xs(r);if(r!==ao&&!n.dirty&&!_i(n.fingerprint))return!1;try{if((s=this.Ys(e,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(i,e,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==ao&&(n.persisted=!0),_i(s)||(n.fingerprint=s),!0):(this.qi.debug&&Wr.warn('failed to persist storage entry "'+i+'"; will retry on next save'),!1)}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!e&&this.As)for(var r of In)_s.qr(this.Js(r));e?delete this.Ms[ao]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(pi(t)){this.syncCookieProperties(),_i(i)&&(i="None"),this.sa=_i(e)?this.la:e;var r=!1;if(Jr(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Us(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(pi(t)){this.syncCookieProperties(),this.sa=_i(i)?this.la:i;var e=!1;if(Jr(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||pi(i)||ci(i))&&(this.Us(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.zs(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==kt?void 0:kt.URL;if(t!==this.Fs){var i=Kn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);gi(ts(i))||this.register(i),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==kt?void 0:kt.referrer)?Yn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Zn(),$referring_domain:null!=kt&&kt.referrer&&(null==(t=jn(kt.referrer))?void 0:t.host)||Xn},void 0)}set_initial_person_info(){this.props[tt]||this.props[it]||this.register_once({[et]:to(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Jr([it,tt],(i=>{var e=this.props[i];e&&Jr(e,(function(i,e){t["$initial_"+li(e)]=i}))}));var i=this.props[et];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=io(t,i),r={};return Jr(e,(function(t,i){r["$initial_"+li(i)]=t})),r}(i,this.qi.disable_capture_url_hashes);Yr(t,e)}return t}safe_merge(t){return Jr(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.Hs&&!l;l||this.Bs(i,h),this.qi=t,!l&&(s||n||a)&&(this.qs=void 0,this.js=void 0,this.Bs(e({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Os(t):this.ps,d=this.Ds(t),v=o||d!==this.Is,c=!l&&(v||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(h);try{if(this.la=this.sa=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.ps=u,this.Is=d,this.props=f,this.save()}else a&&(this.ps=u,l||(delete this.Ms[ao],this.Zs()))}finally{c&&this.Qs()}}set_disabled(t){this.Hs=t,this.Hs?this.remove():this.save()}set_cross_subdomain(t){t!==this.aa&&(this.aa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[u]||{};e[t]=i,this.Us(u,e),this.save()}remove_event_timer(t){var i=this.props[u]||{},e=i[t];return _i(e)||(delete i[t],this.Us(u,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Us(t,i),this.save()}Us(t,i){var e;this.props[t]=i,null!=(e=On(t))&&e.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var i,e=null==(i=On(t))?void 0:i.storageGroup;e&&(this.Xs(e).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function uo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&fi(e.then)&&e.then(void 0,(()=>{}))}}}}var vo="gzip-js",co="base64",fo="events",po="cancelEvents",go="survey shown",_o="survey dismissed",mo="survey sent",yo="popover",bo=Gr("[RateLimiter]");class wo{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=>{bo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void bo.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(Z))&&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=(xi(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ha(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Z,a),{isRateLimited:l,remainingTokens:a.tokens}}da(t){var i=this.instance.config.property_denylist;return!ci(i)||!i.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=Et&&Et.pathname)return""+(null!==(t=Et.origin)&&void 0!==t?t:"")+Et.pathname}ha(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$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 xo=Gr("[RemoteConfig]");class So{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}ca(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()}fa(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 xo.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void xo.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return xo.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa((t=>{this.pa(t.json,t),this.ga()}));this.pa(t),this.ga()}))}catch(t){xo.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&kt&&"hidden"!==kt.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.ya=setInterval((()=>{this.refresh()}),i))}}pa(t,i){!t&&i&&(0===i.statusCode?i.error||xo.warn("Failed to fetch remote config from PostHog."):xo.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){xo.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){xo.error("Error loading feature flags",t)}}}var ko=Uint8Array,Eo=Uint16Array,$o=Uint32Array,Po=new ko([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]),To=new ko([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]),Co=new ko([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fo=function(t,i){for(var e=new Eo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new $o(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]},Ro=Fo(Po,2),Io=Ro[1];Ro[0][28]=258,Io[258]=28;for(var Mo=Fo(To,0)[1],Ao=new Eo(32768),Oo=0;32768>Oo;++Oo){var Do=(43690&Oo)>>>1|(21845&Oo)<<1;Ao[Oo]=((65280&(Do=(61680&(Do=(52428&Do)>>>2|(13107&Do)<<2))>>>4|(3855&Do)<<4))>>>8|(255&Do)<<8)>>>1}var jo=function(t,i,e){for(var r=t.length,s=0,n=new Eo(i);r>s;++s)++n[t[s]-1];var o,a=new Eo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Eo(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[Ao[d]>>>l]=h}else for(o=new Eo(r),s=0;r>s;++s)o[s]=Ao[a[t[s]-1]++]>>>15-t[s];return o},Lo=new ko(288);for(Oo=0;144>Oo;++Oo)Lo[Oo]=8;for(Oo=144;256>Oo;++Oo)Lo[Oo]=9;for(Oo=256;280>Oo;++Oo)Lo[Oo]=7;for(Oo=280;288>Oo;++Oo)Lo[Oo]=8;var No=new ko(32);for(Oo=0;32>Oo;++Oo)No[Oo]=5;var Bo=jo(Lo,9,0),zo=jo(No,5,0),Uo=function(t){return(t/8>>0)+(7&t&&1)},qo=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Eo?Eo:t instanceof $o?$o:ko)(e-i);return r.set(t.subarray(i,e)),r},Ho=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Vo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Wo=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 ko(0),0];if(1==s){var o=new ko(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 Eo(v+1),f=Go(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 ko(c),f]},Go=function(t,i,e){return-1==t.s?Math.max(Go(t.l,i,e+1),Go(t.r,i,e+1)):i[t.s]=e},Ko=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Eo(++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]},Jo=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},Yo=function(t,i,e){var r=e.length,s=Uo(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)},Qo=function(t,i,e,r,s,n,o,a,l,h,u){Ho(i,u++,e),++s[256];for(var d=Wo(s,15),v=d[0],c=d[1],f=Wo(n,15),p=f[0],g=f[1],_=Ko(v),m=_[0],y=_[1],b=Ko(p),w=b[0],x=b[1],S=new Eo(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=Wo(S,7),P=E[0],T=E[1],C=19;C>4&&!P[Co[C-1]];--C);var F,R,I,M,A=h+5<<3,O=Jo(s,Lo)+Jo(n,No)+o,D=Jo(s,v)+Jo(n,p)+o+14+3*C+Jo(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=A&&D>=A)return Yo(i,u,t.subarray(l,l+h));if(Ho(i,u,1+(O>D)),u+=2,O>D){F=jo(v,c,0),R=v,I=jo(p,g,0),M=p;var j=jo(P,T,0);for(Ho(i,u,y-257),Ho(i,u+5,x-1),Ho(i,u+10,C-4),u+=14,k=0;C>k;++k)Ho(i,u+3*k,P[Co[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)Ho(i,u,j[z=31&B[k]]),u+=P[z],z>15&&(Ho(i,u,B[k]>>>5&127),u+=B[k]>>>12)}}else F=Bo,R=Lo,I=zo,M=No;for(k=0;a>k;++k)if(r[k]>255){var z;Vo(i,u,F[257+(z=r[k]>>>18&31)]),u+=R[z+257],z>7&&(Ho(i,u,r[k]>>>23&31),u+=Po[z]);var U=31&r[k];Vo(i,u,I[U]),u+=M[U],U>3&&(Vo(i,u,r[k]>>>5&8191),u+=To[U])}else Vo(i,u,F[r[k]]),u+=R[r[k]];return Vo(i,u,F[256]),u+R[256]},Xo=new $o([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zo=function(){for(var t=new $o(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ta=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ia(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=Zo[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 ko(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=Yo(l,h,t.subarray(u,d)):(l[u]=!0,h=Yo(l,h,t.subarray(u,o)))}else{for(var v=Xo[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Eo(32768),_=new Eo(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 $o(25e3),x=new Eo(288),S=new Eo(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 M=o-u;if((k>7e3||P>24576)&&M>423){h=Qo(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 O=2,D=0,j=f,L=R-I&32767;if(M>2&&F==b(u-L))for(var N=Math.min(c,M)-1,B=Math.min(32767,u),z=Math.min(258,M);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 q=Math.min(L,U-2),H=0;for(A=0;q>A;++A){var V=u-L+A+32768&32767,W=V-g[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(R=I)-(I=g[R])+32768&32767}if(D){w[P++]=268435456|Io[O]<<18|Mo[D];var G=31&Io[O],K=31&Mo[D];E+=Po[G]+To[K],++x[257+G],++S[K],T=u+O,++k}else w[P++]=t[u],++x[t[u]]}}h=Qo(t,l,!0,w,x,S,E,P,C,u-C,h)}return qo(a,0,r+Uo(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&&ta(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),ta(h,u-8,e.d()),ta(h,u-4,r),h}var ea=!!Pt||!!$t,ra="text/plain",sa=!1,na=(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:"")},oa=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 Jr(t,(function(t,i){_i(t)||_i(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},aa=t=>{if(t.ba)return t.ba;var i=t.data,e=t.compression;if(i){if(e===vo){var r=ia(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new ko(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 ko(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 qo(r,0,s)}(Dn(i)),{mtime:0});return{contentType:ra,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===co){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(Dn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Dn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Dn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},la=t=>{var i,r,s=()=>"sendBeacon"===t.transport?{url:oa(t.url,{compression:co}),encodedBody:aa(e({},t,{compression:co,ba:void 0}))}:{url:na(t.url,"compression"),encodedBody:aa(e({},t,{compression:void 0,ba:void 0}))};try{i=aa(t)}catch(i){if(Vt(t.compression,Ln(t.url,"compression")))return Wr.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&Vt(t.compression,Ln(t.url,"compression"))&&!((r=i.body)instanceof ArrayBuffer?Ht(new Uint8Array(r)):ArrayBuffer.isView(r)&&Ht(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(sa=!0,s()):{url:t.url,encodedBody:i}},ha=t=>{try{return la(t)}catch(i){return Wr.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},ua=function(){var t=i((function*(t){var i=Dn(t.data),r=yield function(t,i,e){return Jt.apply(this,arguments)}(i,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return e({},t,{ba:{contentType:ra,body:n,estimatedSize:n.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),da=/Failed to fetch|NetworkError|Load failed/i,va=t=>"TypeError"===(null==t?void 0:t.name)&&da.test((null==t?void 0:t.message)||""),ca=t=>{var i=ha(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;Jr(t.headers,(function(t,i){h.append(i,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Tt){var v=new Tt;u={signal:v.signal,timeout:setTimeout((()=>{var i,e;d=!0,v.abort((i=t.timeout,(e=new Error("PostHog request timed out"+(i?" after "+i+"ms":""))).name="AbortError",e))}),t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||va(i)?Wr.warn(i):Wr.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;$t(r,e({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t._a&&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){Wr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},fa=t=>{try{var i,r=la(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(St.sendBeacon(s,h))return;var u=ci(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(ci(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>ci(t.data)?i:e({},t.data,{batch:i});return fa(e({},t,{data:v(u.slice(0,d))})),void fa(e({},t,{data:v(u.slice(d))}))}Wr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ca(e({},t,{_a:!0}))}catch(t){Wr.warn("Beacon send failed",t)}},pa=(t,i,r,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return oa(r===vo?na(t,"compression"):t,e({},n?{[n]:Date.now().toString()}:{},r===vo?{}:{compression:r}))},ga=[];$t&&ga.push({transport:"fetch",method:ca}),Pt&&ga.push({transport:"XHR",method(t){var i=ha(t);if(i){var e=new Pt,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Jr(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!=St&&St.sendBeacon&&ga.push({transport:"sendBeacon",method:fa});var _a=3e3;class ma{constructor(t,i){this.wa=!0,this.ka=[],this.Sa=Di((null==i?void 0:i.flush_interval_ms)||_a,250,5e3,Wr.createLogger("flush interval"),_a),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(e({},t,{transport:"sendBeacon"}))}))}enable(){this.wa=!1,this.Ta()}Ta(){var t=this;this.wa||(this.Ca=setTimeout((()=>{if(this.Ma(),this.ka.length>0){var i=this.Ea(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&ci(e.data)&&Jr(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(e)};for(var r in i)e()}}),this.Sa))}Ia(t){try{this.xa(t)}catch(t){Wr.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return Jr(this.ka,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;_i(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.ka=[],t}}var ya=["retriesPerformedSoFar"];class ba{constructor(t){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=t,this.ka=[],this.Aa=!0,!_i(wt)&&"onLine"in wt.navigator&&(this.Aa=wt.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},rs(wt,"online",this.Fa),rs(wt,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var i=t.retriesPerformedSoFar,s=r(t,ya);Si(i)&&(s.url=oa(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.xn(e({retriesPerformedSoFar:i},s));0===t.statusCode&&Wr.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)}}))}xn(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.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Wr.warn(s),this.Ra||(this.Ra=!0,this.Da())}Da(){if(this.$a&&clearTimeout(this.$a),0===this.ka.length)return this.Ra=!1,void(this.$a=void 0);this.$a=setTimeout((()=>{this.Aa&&this.ka.length>0&&this.La(),this.Da()}),this.Pa)}La(){var t=Date.now(),i=[],e=this.ka.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.ka=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,_i(wt)||(this.Fa&&(wt.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(wt.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var i=t.requestOptions;try{this._instance._send_request(e({},i,{transport:"sendBeacon"}))}catch(t){Wr.error(t)}}this.ka=[]}}class wa{constructor(t){this.Na=()=>{var t,i,e,r;this.qa||(this.qa={});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.qa.lastScrollY=Math.ceil(n),this.qa.maxScrollY=Math.max(n,null!==(t=this.qa.maxScrollY)&&void 0!==t?t:0),this.qa.maxScrollHeight=Math.max(o,null!==(i=this.qa.maxScrollHeight)&&void 0!==i?i:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(e=this.qa.maxContentY)&&void 0!==e?e:0),this.qa.maxContentHeight=Math.max(l,null!==(r=this.qa.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var t=this.qa;return setTimeout(this.Na,0),t}startMeasuringScrollPosition(){rs(wt,"scroll",this.Na,{capture:!0}),rs(wt,"scrollend",this.Na,{capture:!0}),rs(wt,"resize",this.Na)}scrollElement(){if(!this.ja)return null==wt?void 0:wt.document.documentElement;var t=ci(this.ja)?this.ja:[this.ja];for(var i of t){var e=null==wt?void 0:wt.document.querySelector(i);if(e)return e}}Ba(t){var i="y"===t?"scrollTop":"scrollLeft";if(this.ja){var e=this.scrollElement();return e&&e[i]||0}return wt?"y"===t?wt.scrollY||wt.pageYOffset||wt.document.documentElement.scrollTop||0:wt.scrollX||wt.pageXOffset||wt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var xa=t=>to(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 Sa{constructor(t,i,e,r){this.ot=t=>{var i=this.Ha();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ua(this._instance)};this.za.register({[X]:e})}},this._instance=t,this.Wa=i,this.za=e,this.Ua=r||xa,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[X]}getSetOnceProps(){var t,i=null==(t=this.Ha())?void 0:t.props;return i?"r"in i?io(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 Jr(ts(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+li(e)]=i})),t}}class ka{on(t,i){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(i),()=>{this.Va[t]=this.Va[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Va[t]||[])e(i);for(var r of this.Va["*"]||[])r(t,i)}constructor(){this.Va={}}}var Ea=Gr("[SessionId]"),$a=864e5;class Pa{on(t,i){return this.Ga.on(t,i)}constructor(t,i,e){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new ka,this.Xa=(t,i)=>!(!Si(t)||!Si(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===dt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=t.config,this.za=t.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=i||ds,this.ro=e||ds;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*Di(this.qi.session_idle_timeout_seconds||1800,60,36e3,Ea.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var n=Rs.Br(this.so),o=Rs.Br(this.ao);n&&!o?this.st=n:Rs.qr(this.so),Rs.Dr(this.ao,!0)}null!=(r=this.qi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return _i(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((i=>i!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&Rs.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Rs.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Rs.Br(this.so):null}do(t){var i=this.Za;return!bi(i)&&!bi(t)&&5e3>Math.abs(t-i)}vo(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this._e||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this._e=t,s&&!r||s&&this.do(i)||(this.Za=i,this.za.register({[P]:[i,t,e]}))}co(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return Si(i)&&i>0}fo(){this.co()?this.za.refreshKey(P):(this.za.flush(),this.za.load())}po(){var t;if(!bi(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var i=this.mo();i[1]===this._e&&i[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[P]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],i=Si(t)?t:0,e=Si(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[P];return ci(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(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 Ea.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ea.error("Invalid sessionID in bootstrap",t)}}(t);return!_i(e)&&(i?this.eo={sessionId:t,sessionStartTimestamp:e}:this.vo(t,(new Date).getTime(),e),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&wt&&(wt.removeEventListener(gt,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Rs.qr(this.ao)},rs(wt,gt,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.qi.cookieless_mode===dt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this._e;if(e)this.Qa=r;else if(bi(this.Qa)||this.Qa>r||r-this.Qa>=1e3){var n,o;null==(n=(o=this.za).syncCookieProperties)||n.call(o),this.Qa=r}var a=this.mo(),l=a[1],h=a[2],u=!_i(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>$a),p=c?f:Si(h)&&Math.abs(r-h)>$a,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||Ea.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.mo();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.io(),v=this.ro(),Ea.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.eo=void 0,g=!0}else v||(v=this.ro(),g=!0),(_=_||l!==y)&&(Ea.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=Si(d)&&t&&!p?d:r,k=Si(h)?h:(new Date).getTime();this.uo(v),this.vo(l,S,k),t||this.no();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.Ja.forEach((t=>t(l,v,E))),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout((()=>{if(!this.Ya)if(this.bo((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:t})}else this.no()}),1.1*this.sessionTimeoutMs))}}var Ta=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&ni(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>ni(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function Ca(){return(Ca=i((function*(){var t=null==St?void 0:St.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return mi(e)&&e.length>0?e:void 0}catch(t){return void Wr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Fa(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Ra=(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}},Ia=t=>t.toLowerCase(),Ma={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=>Ra(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Ra(i,t))))),icontains:(t,i)=>i.map(Ia).some((i=>t.map(Ia).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Ia).every((i=>t.map(Ia).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 Aa(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=Ma[e.operator];return!!s&&s(e.values,[String(r)])}))}function Oa(t,i,e){return Dn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Da="custom",ja="i.posthog.com",La=/^\/static\//,Na=["/s/","/e/","/i/"];class Ba{constructor(t){this.wo={},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("."+ja,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.wo[this.apiHost]||(this.wo[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":Da),this.wo[this.apiHost]}ko(t){if(La.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}So(t){var i=jn(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}xo(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&&Na.some((t=>0===i.indexOf(t)))){var a=this.So(r);if(a){var l,h=this.apiHost,u=this.Co;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Co=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Co,e=this.So(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.xo(t,i,this.uiHost+i);if("flags"===t)return this.xo(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.ko(i);if(e)return this.xo(t,i,""+e+i)}if(this.region===Da)return this.xo(t,i,this.apiHost+i);var r=ja+i;switch(t){case"assets":return this.xo(t,i,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,i,"https://"+this.region+"."+r)}}}var za=Gr("[Surveys]"),Ua="seenSurvey_",qa=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))(Ua,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){za.error("Failed to persist survey seen state",t)}},Ha=["popover","widget","api"],Va={ignoreConditions:!1,ignoreDelay:!1,displayType:yo},Wa=Gr("[PostHog ExternalIntegrations]"),Ga={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ka{constructor(t){this._instance=t}_s(t,i){var e;null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Wa.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._s(Ga[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 Ja{constructor(t,i){this.I=t,this.ns=i,this.To=new Map,this.Xn=!1}add(t){var e=this;return i((function*(){if(e.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.To.set(t.name,t);try{var i=t.setup(e.ns);i&&(yield i)}catch(i){var r=e.To.get(t.name)===t;r&&e.To.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var i of(this.To.clear(),t))this.Mo(i)}}Mo(t){try{var i=null==t.dispose?void 0:t.dispose();i&&fi(i.then)&&i.then(void 0,(i=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class Ya{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);_i(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 Qa="extensionsRemoteConfig";class Xa{constructor(t){this.Xn=!1,this.instance=t,this.I=Wr,this.Eo=t.Io,this.kv=new Ya(t),this.onEvent=t=>uo(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return uo((()=>{}));var i=i=>{try{t(i)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},e=this.instance.Ro.on(Qa,i);return this.Eo&&i(this.Eo),uo(e)},this.Po=new Ja(Wr.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}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 projectToken(){return this.instance.config.token}add(t){return this.Po.add(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 uo(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(Qa,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?oa(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,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.Xn||(this.Xn=!0,this.Po.dispose())}}var Za={},tl=0,il=()=>{},el='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',rl="Surveys module not available",sl="sanitize_properties is deprecated. Use before_send instead",nl="Invalid value for property_denylist config: ",ol=["token","distinct_id",nt],al="posthog",ll=!ea&&-1===(null==Ft?void 0:Ft.indexOf("MSIE"))&&-1===(null==Ft?void 0:Ft.indexOf("Mozilla")),hl=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:es(null==kt?void 0:kt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:il,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:Et&&mi(null==Et?void 0:Et.search)&&-1!==Et.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==wt||null==(i=wt.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){Wr.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:ft,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:_a},error_tracking:{},_onCapture:il},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:en,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},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))},ul=[["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"]],dl=t=>{var i={};for(var e of ul){var r=e[0],s=e[1];_i(t[r])||(i[s]=t[r])}var n=Yr({},i,t),o=t.__preview_external_dependency_versioned_paths;return _i(o)||(_i(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),mi(o)&&_i(t.asset_host)&&(n.asset_host=o)),ci(t.property_blacklist)&&(_i(t.property_denylist)?n.property_denylist=t.property_blacklist:ci(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Wr.error(nl+t.property_denylist)),n};class vl{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){Wr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class cl{Lo(t,i){if(t){var e=this.To.indexOf(t);-1!==e&&this.To.splice(e,1)}return this.To.push(i),null==i.initialize||i.initialize(),i}Oo(){return this.config.cookieless_mode===dt||this.config.cookieless_mode===ut&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===st){var t=this.persistence;if(t){this.$o()||t.load(!0);var i=this.get_distinct_id();if(!i||i===st){var e=this.config.get_device_id(ds());this.register({distinct_id:e,$device_id:e}),t.set_property(Q,vt)}this.No()}}}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 vl,this.qo=!1,this.version=s.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new ka,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=hl(),this.SentryIntegration=Fn,this.sentryIntegration=t=>function(t,i){var e=Cn(t,i);return{name:Tn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new wa(this),this.pageViewManager=new Rn(this),this.rateLimiter=new wo(this),this.requestRouter=new Ba(this),this.consent=new Is(this),this.externalIntegrations=new Ka(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=mi(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=mi(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Wr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==al){var r,s=null!==(r=Za[e])&&void 0!==r?r:new cl;return s._init(t,i,e),Za[e]=s,Za[al][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var n,o;void 0===i&&(i={});var a,h=mi(t)?t.trim():"";if(!h)return Wr.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 h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=hl(i.defaults),i.debug=this.Go(i.debug),this.Zo=i,this.Qo=[],i.person_profiles?this.Wo=i.person_profiles:i.process_person&&(this.Wo=i.process_person);var u=hl(i.defaults),d=dl(i),v=Yr({},u,d,{name:r,token:h});pi(u.rageclick)&&pi(d.rageclick)&&(v.rageclick=Yr({},u.rageclick,d.rageclick)),pi(u.session_recording)&&pi(d.session_recording)&&(v.session_recording=Yr({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Wr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:vo;var c=this.$o();if(this.persistence=new ho(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ho(e({},this.config,{persistence:"sessionStorage"}),c,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Rs.Nr()){var f=Rs.Br(this.Bo);ci(f)&&f.forEach((t=>{mi(t)&&this.jo.add(t)}))}else Rs.qr(this.Bo);var p=e({},this.persistence.props),g=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new ma((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new ba(this),this.__request_queue=[];var _=this.Oo();if(_||(this.sessionManager=new Pa(this),this.sessionPropsManager=new Sa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(Wr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(_)}),0)):(Wr.info("Initializing extensions synchronously"),this.el(_)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Wr.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:p,s:g}),!this.config.identity_distinct_id||null!=(n=i.bootstrap)&&n.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var m=i.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Q);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===vt)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===ct)Wr.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var w=this.config.get_device_id(ds()),x=i.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Q,i.bootstrap.isIdentifiedID?ct:vt),this.register({distinct_id:m,$device_id:x})}}if(_)this.register_once({distinct_id:st,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(ds());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(Q,vt)}return rs(wt,"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()||ds();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Q,ct)),i()},s=e.user();"then"in s&&fi(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Pn.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()||(Pn.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Pn.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,_t),identify:t=>i(t,yt),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.il())):this.il(),fi(this.config._onCapture)&&this.config._onCapture!==il&&(Wr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Wr.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 Ca.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(il),this}rl(t){var i=t;return mi(i.name)&&fi(i.setup)}nl(t,i){this.rl(t)?i.push((()=>{this.sl().add(t).catch(il)})):this.To.push(t)}tl(){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.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),fi(this.featureFlags.onReloading)&&fi(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading((()=>{this.Ro.emit("featureFlagsReloading",!0)})),this.sl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}el(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},cl.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.To.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.To.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.To.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.To.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.To.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.nl(this.autocapture=new u.autocapture(this),d),u.surveys&&this.nl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.To.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.metrics&&this.To.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.To.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.To.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.To.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.To.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,En)),u.toolbar&&this.To.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.To.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.To.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.ol){var t=this.ol;this.ol=void 0,this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.ll(d,h)}ll(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Wr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[ot]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[at]:r}),this.config.__preview_deferred_init_extensions&&Wr.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var i;if(!kt||!kt.body)return Wr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ol=t),this.Io=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=oi(r.supportedCompression,vo)?vo:oi(r.supportedCompression,co)?co:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:ft}),null==(i=this.ul)||i.handleRemoteConfig(t),this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}il(){try{this.config.loaded(this)}catch(t){Wr.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=Et&&Et.hostname){var t=Et.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.Oo())&&this.dl()}),1),this.vl=new So(this),this.vl.load()}hl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Jo)||t.enable())}_dom_loaded(){this.is_capturing()&&Kr(this.__request_queue,(t=>this.Ko(t))),this.__request_queue=[],this.hl()}_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.cl()&&this.capture(mt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(mt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?ll?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?this.compression:t.compression,(_i(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&&_i(n.compression)&&n.data&&(n.compression=co),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(ci(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()),ci(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=ga.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){va(t)?Wr.warn(t):Wr.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===vo&&Ct&&"undefined"!=typeof Promise&&!sa?ua(n).then((t=>{f(t)})).catch((i=>{if(Wt(i))return sa=!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 Wt(t)||i===qt})(i)&&(sa=!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}))}Ko(t){this.Yo?this.Yo.retriableRequest(t):this._send_request(t)}_execute_array(t){tl++;try{var i,e=[],r=[],s=[];Kr(t,(t=>{if(t)if(ci(i=t[0]))s.push(t);else if(fi(t))try{t.call(this)}catch(i){Wr.error("Error executing queued PostHog call",t,i)}else ci(t)&&"alias"===i?e.push(t):ci(t)&&-1!==i.indexOf("capture")&&fi(this[i])?s.push(t):r.push(t)}));var n=function(t,i){Kr(t,(function(t){try{if(ci(t[0])){var e=i;Jr(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){Wr.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{tl--}}push(t){if(tl>0&&ci(t)&&mi(t[0])){var i=cl.prototype[t[0]];fi(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.Jo){if(this.is_capturing())if(!_i(t)&&mi(t)){this.Do();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&&!mi(null==i?void 0:i.$current_url)&&(Wr.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.fl||Wr.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=qe(null==r?void 0:r.uuid,ds),f={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},v,c)};t===_t&&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(O);(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.pl(null==r?void 0:r.$set_once,t!==bt,t===yt);if(b&&(f.$set_once=b),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>mi(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),ci(i))r=[],Kr(i,(i=>{r.push(t(i))}));else{var s={};Jr(i,((i,e)=>{l.has(i)||(s[e]=t(i,e))})),r=s}return r}}(o)),f.timestamp=v,_i(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,ol)),t===_o||t===mo){var w=null==i?void 0:i.$survey_id,x=null==i?void 0:i.$survey_iteration;qa({id:w,current_iteration:x}),f.$set=e({},f.$set,{[(_={id:w,current_iteration:x},m=t===mo?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else t===go&&(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(gi(k)||this.setPersonPropertiesForFlags(k),!wi(this.config.before_send)){var E=this.kn(f);if(!E)return;(f=E).uuid=qe(f.uuid,ds)}this.Ro.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.Ko(T):this.Jo.enqueue(T),f}Wr.critical("This capture call is ignored due to client rate limiting.")}}else Wr.error("No event name provided to posthog.capture")}else Wr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new Xa(this)}Ao(t){this.Ho.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Ho.indexOf(t);-1!==e&&this.Ho.splice(e,1)}}}gl(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Q)===vt&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),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.gl();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.Oo()&&(l[nt]=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!mi(l.distinct_id)&&!xi(l.distinct_id)||yi(l.distinct_id))&&Wr.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),!Ft)return{};var h,u=t?[...Hn,...i||[]]:[],d=function(t){for(var i=0;Be.length>i;i++){var e=Be[i],r=e[1],s=e[0].exec(t),n=s&&(fi(r)?r(s,t):r);if(n)return n}return["",""]}(Ft),v=d[0],c=d[1],f=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};_i(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==wt||null==(a=wt.screen)?void 0:a.width,b=null==wt||null==(l=wt.screen)?void 0:l.height,w=null==wt?void 0:wt.devicePixelRatio;_i(_)||(g.userAgentDataPlatform=_),_i(m)||(g.maxTouchPoints=m),_i(y)||(g.screenWidth=y),_i(b)||(g.screenHeight=b),_i(w)||(g.devicePixelRatio=w);var x,S,k,E,P,T,C,F,R=Yr(ts({$os:v,$os_version:c,$browser:je(Ft,navigator.vendor,f,p),$device:ze(Ft),$device_type:(S=Ft,k=g,F=ze(S),F===qi||F===Ui||"Kobo"===F||"Kindle Fire"===F||F===ye?zi:F===le||F===ue||F===he||F===ge?"Console":F===Vi?"Wearable":F?Li:"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)?Li:zi:"Desktop"),$timezone:eo(),$timezone_offset:ro()}),{$current_url:Nn(r?He(null==Et?void 0:Et.href):null==Et?void 0:Et.href,u,Wn),$host:null==Et?void 0:Et.host,$pathname:null==Et?void 0:Et.pathname,$raw_user_agent:Ft.length>1e3?Ft.substring(0,997)+"...":Ft,$browser_version:Ne(Ft,navigator.vendor,f,p),$browser_language:Qn(),$browser_language_prefix:(x=Qn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==wt?void 0:wt.screen.height,$screen_width:null==wt?void 0:wt.screen.width,$viewport_height:null==wt?void 0:wt.innerHeight,$viewport_width:null==wt?void 0:wt.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&&Yr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Yr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Yo)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Da&&(l.$lib_custom_api_host=this.config.api_host),u=t!==_t||o?t!==mt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Yr(l,u),t===_t&&kt&&(l.title=kt.title),!_i(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ft&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties();Jr(["$referrer","$referring_domain"],(t=>{t in g&&delete _[t]}));var m={};if(this.Ho.length>0)for(var y of this.Ho.slice())try{Yr(m,y())}catch(t){Wr.error("Failed to produce browser extension event properties",t)}(l=Yr({},d,g,_,e({},m,l))).$is_identified=this._isIdentified(),ci(this.config.property_denylist)?Jr(this.config.property_denylist,(function(t){delete l[t]})):Wr.error(nl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Wr.error(sl),l=b(l,t));var w=this.yl();return l.$process_person_profile=w,w&&!o&&this.bl("_calculate_event_properties"),l}pl(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.yl())return t;if(this.qo&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Yr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Wr.error(sl),o=a(o,"$set_once")),i&&(this.qo=!0),gi(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.gl(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}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.jo.delete(t),this.ml()}_l(t,i){this.register({[t]:i})}Xo(){this.jo.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!Rs.Nr())Rs.qr(this.Bo);else{var i=[];this.jo.forEach((t=>i.push(t))),i.length>0?Rs.Dr(this.Bo,i):Rs.qr(this.Bo)}}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.Ro.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:rl}),()=>{})}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:rl})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:rl})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Va),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:rl}}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:rl})}wl(t){return!t||yi(t)?(Wr.critical("Unique user id has not been set in posthog.identify"),!1):t===st?(Wr.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())||(Wr.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 Wr.uninitializedWarning("posthog.identify");if(xi(t)&&(t=t.toString(),Wr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(t)&&this.bl("posthog.identify")){this.Do();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.gl(!1),o=this.persistence.Ws(),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)||vt)===vt,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(Q,ct),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(yt,{distinct_id:t,$anon_distinct_id:u},{$set:i||{},$set_once:e||{}}),this.Vo=Oa(t,i,e),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(Q,ct);var p=i||{},g=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:p,$set_once:g}),this.Vo=Oa(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(G)):f&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Qs(l)}}}setPersonProperties(t,i){if((t||i)&&this.bl("posthog.setPersonProperties")){var e=Oa(this.get_distinct_id(),t,i);this.Vo!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Vo=e):Wr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(ci(t)?t:[t]).filter((t=>mi(t)&&t.length>0));0!==e.length&&this.bl("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Vo=null)}group(t,i,r){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.gl();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(bt,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else Wr.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.bl("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=ki(t)?t:null==t?void 0:t.resetDeviceID,e=ki(t)||null==t?void 0:t.bootstrap;this.kl(i,!1,e)}kl(t,i,r){var s,n,o;if(void 0===i&&(i=!1),Wr.info("reset"),!this.__loaded)return Wr.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Zo)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ma());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(b),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.Ws?void 0:o.Ws(),p=!1;try{var g,_,m,y,w,x,S,k,E,P,T,C,F,R;if(null==(g=this.persistence)||g.clear(),null==(_=this.sessionPersistence)||_.clear(),this.jo.clear(),this.ml(),_i(v)||null==(T=this.persistence)||T.register({[b]:v}),null==(m=this.surveys)||m.reset(),null==(y=this.vl)||y.stop(),null==(w=this.featureFlags)||w.reset(),null==(x=this.conversations)||x.reset(),null==(S=this.logs)||S.reset(),null==(k=this.metrics)||k.reset(),null==(E=this.persistence)||E.set_property(Q,vt),null==(P=this.sessionManager)||P.resetSessionId(),this.Vo=null,this.config.cookieless_mode===dt)this.register_once({distinct_id:st,$device_id:null},"");else{var I=this.config.get_device_id(ds());this.register_once({distinct_id:I,$device_id:t?I:u},""),t||_i(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Oo()||(null==(R=this.persistence)||R.set_property(Q,r.isIdentifiedID?ct:vt),this.register({distinct_id:r.distinctID})),null==(C=this.featureFlags)||C.initialize(),!(_i(h)||null!=(F=this.sessionManager)&&F.setBootstrapSessionId(h,!0))){var M=e({},r);delete M.sessionID,this.config.bootstrap=M}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var A;f&&(null==(A=this.persistence)||null==A.Qs||A.Qs(p))}this.reloadFeatureFlags()}shutdown(t){var e=this;return i((function*(){var t,i,r,s,n,o;if(e.__loaded){null==(t=e.vl)||t.stop(),e.sl().dispose(),null==(i=e.sessionRecording)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.Jo)||n.unload(),null==(o=e.Yo)||o.unload();try{var a;null==(a=e.featureFlags)||a.destroy()}catch(t){Wr.error("Error while destroying feature flags",t)}}else Wr.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.Sl()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.xl()}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)?(Wr.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(_i(i)&&(i=this.get_distinct_id()),t!==i?(this._l(h,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Wr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(pi(t)){var r,n,o,a,l,h,u,d,v,c,f,p;Yr(this.config,dl(t));var g=this.$o();null==(r=this.persistence)||r.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ho(e({},this.config,{persistence:"sessionStorage"}),g,!1);var _,m=this.Go(this.config.debug);ki(m)&&(this.config.debug=m),ki(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,_s.Nr()&&_s.Dr("ph_debug",!0),Wr.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(s.DEBUG=!1,_s.Nr()&&_s.qr("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ma()),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.No(),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.Cl}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:al;return i!==al&&(i=al+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Q))===ct||(null==(i=this.sessionPersistence)?void 0:i.get_property(Q))===ct}yl(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===ft&&!this._isIdentified()&&gi(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(i=this.persistence)||null==(i=i.props)||!i[rt]))}cl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(t){return"never"===this.config.person_profiles?(Wr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(rt,!0),!0)}$o(){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!==ut)}No(){var t,i,e,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==dt){if(this.Oo()){var e,r,s,n,o;this.kl(!0,!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Pa(this),this.pageViewManager=new Rn(this),this.persistence&&(this.sessionPropsManager=new Sa(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=cl.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Lo(this.sessionRecording,new l(this)),this.Io&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Io)))}var h,u;this.consent.optInOut(!0),this.No(),this.hl(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==ut&&(null==(h=this.surveys)||h.loadIfEnabled()),(_i(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else Wr.warn(el)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==dt?(this.config.cookieless_mode===ut&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===ut&&(this.register({distinct_id:st,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(i=this.sessionManager)||i.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):Wr.warn(el)}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===dt||(this.config.cookieless_mode===ut?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return St?Ta(St,this.config.custom_blocked_useragents):void 0}dl(){kt&&("visible"===kt.visibilityState?this.Uo||(this.Uo=!0,this.capture(_t,{title:kt.title},{send_instantly:!0}),this.zo&&(kt.removeEventListener(pt,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),rs(kt,pt,this.zo)))}debug(t){!1===t?(null==wt||wt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==wt||wt.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}))}ma(){var t=this.Zo||{};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?(Wr.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&&!wi(t[i]),o=e in t&&!wi(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,Wr)}kn(t){var i;if(wi(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(Pi),r=ci(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),wi(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return $i(t.event)?Wr.warn(o+". This can cause unexpected behavior."):Wr.info(o),null}s.properties&&!gi(s.properties)||Wr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Wr.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&wi(s.properties[a]))return Wr.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.Ss)?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)})}Go(t){var i=ki(t)&&!t,e=_s.Nr()&&"true"===_s.Pr("ph_debug");return!i&&(!!e||t)}}cl.__defaultExtensionClasses={},cl.Cl=(()=>{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]]=Zr(t.prototype[i[e]])}(cl,["identify"]);class fl{constructor(t){this.disabled=!1===t;var i=pi(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 pl="$copy_autocapture",gl=Gr("[AutoCapture]");function _l(t,i){return i.length>t?i.slice(0,t)+"...":i}function ml(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Ns(i));return i}function yl(t,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!Ns(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!Bs(c,"body")&&qs>d.length;)if(Us(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Ns(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(Jr(d,(t=>{var i=hn(t);if(Bs(t,"a")){var e=t.getAttribute("href");y=!!(i&&e&&mn(e))&&(u?He(e):e)}oi(Ws(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};Ys.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?_l(1024,yn(t)):_l(1024,Ks(t)));var a=Ws(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Jr(t.attributes,(function(e){var n;if((!un(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&mn(e.value)&&(!mi(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=Hs(a).join(" ")),o["attr__"+e.name]=_l(1024,"href"===e.name&&s?He(a):a)}}));for(var l=1,h=1,u=t;u=ml(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(!hn(t))return{};var i={};return Jr(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&&mn(r)&&(i[e]=r)}})),i}(t);Yr(m,r)})),b)return{props:{},explicitNoCapture:b};if(a||(_[0].$el_text=Bs(t,"a")||Bs(t,"button")?yn(t):Ks(t)),y){var w,x;_[0].attr__href=y;var S=null==(w=jn(y))?void 0:w.host,k=null==wt||null==(x=wt.location)?void 0:x.host;S&&k&&S!==k&&(p=y)}return{props:Yr({$event_type:n.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(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 Qr(o).sort(((t,i)=>t[0].localeCompare(i[0]))).forEach((t=>{var i=t[1];return a[wn(t[0].toString())]=wn(i.toString())})),(s+=":")+Qr(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:xn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Qr(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 bl{constructor(t){this.name="autocapture",this.Qn=!1,this.Jn=null,this.Kn=!1,this.Yn=!1,this.qi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Xn=!1,this.ts=t,this.ts.refresh(this.qi),this.rageclicks=new fl(this.qi.rageclick),this.es=null}setup(t){this.rs(),this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?i.dispose():(this.ss=i,this.startIfEnabled())}dispose(){var t;this.Xn||(this.Xn=!0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,this.os())}ls(){return this.ts.refresh(this.qi),this.qi}rs(){var t,i;return this.ls(),this.qi.url_allowlist=null==(t=this.qi.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.qi.url_ignorelist=null==(i=this.qi.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.qi}us(){if(this.isBrowserSupported()){if(wt&&kt){var t=this.hs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t)}catch(t){gl.error("Failed to capture event",t)}};if(rs(kt,"submit",t,{capture:!0}),rs(kt,"change",t,{capture:!0}),rs(kt,"click",t,{capture:!0}),this.ls().capture_copied_text){var i=this.vs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t,pl)}catch(t){gl.error("Failed to capture copy/cut event",t)}};rs(kt,"copy",i,{capture:!0}),rs(kt,"cut",i,{capture:!0})}}}else gl.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==kt||kt.removeEventListener("submit",this.hs,!0),null==kt||kt.removeEventListener("change",this.hs,!0),null==kt||kt.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==kt||kt.removeEventListener("copy",this.vs,!0),null==kt||kt.removeEventListener("cut",this.vs,!0),this.vs=void 0),this.Qn=!1}startIfEnabled(){!this.Xn&&this.ns&&this.isEnabled&&!this.Qn&&(this.us(),this.Qn=!0)}onRemoteConfig(t){if(!this.Xn)if(this.Kn=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Yn=i.elementsChainAsString);var e,r=i.autocapture_opt_out;ki(r)&&(null==(e=this.ns)||e.kv.set(d,r),this.Jn=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.es=t}getElementSelectors(t){var i,e=[];return null==(i=this.es)||i.forEach((i=>{var r=null==kt?void 0:kt.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Xn)return!1;var e=null==(t=this.ns)?void 0:t.kv.get(d),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(bi(r)&&!ki(e)&&!n)return!1;var o=null!==(i=this.Jn)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ds(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var e=Js(t);zs(e)&&(e=e.parentNode||null);var r,s=this.rs();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&on(e,s.rageclick)&&this.ds(t,"$rageclick");var n=i===pl;if(e&&function(t,i,e,r,s,n){var o;if(!wt||an(t))return!1;if(null!=e&&e.url_allowlist&&!Vs(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&Vs(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=ln(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(_i(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(!Qs(u,null==e?void 0:e.css_selector_allowlist))return!1;if(Qs(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Zs))return!1;try{var d=wt.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&&(Ys.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(e,t,s,n,n?["copy","cut"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var o,a=yl(e,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:s.disableCaptureUrlHashes}),l=a.props;if(a.explicitNoCapture)return!1;var h=this.getElementSelectors(e);if(h&&h.length>0&&(l.$element_selectors=h),i===pl){var u,d=Gs(null==wt||null==(u=wt.getSelection())?void 0:u.toString()),v=t.type||"clipboard";if(!d)return!1;l.$selected_content=d,l.$copy_type=v}return null==(o=this.ns)||o.capture(i,l).catch((t=>gl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return fi(null==kt?void 0:kt.querySelectorAll)}}class wl{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=pi(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.ma(),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 xl=Gr("[ExceptionAutocapture]"),Sl=()=>{},kl=Gr("[TracingHeaders]"),El=Gr("[Web Vitals]"),$l=9e5,Pl=["CLS","FCP","INP","LCP"],Tl=["INP","LCP"],Cl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Fl="disabled",Rl="lazy_loading",Il="awaiting_config",Ml="missing_config";Gr("[SessionRecording]"),Gr("[SessionRecording]");var Al="[SessionRecording]",Ol=Gr(Al),Dl=Gr("[Heatmaps]");function jl(t){return pi(t)&&"clientX"in t&&"clientY"in t&&xi(t.clientX)&&xi(t.clientY)}var Ll=Gr("[Product Tours]"),Nl=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(m))},Bl=["$set_once","$set"],zl=Gr("[SiteApps]"),Ul="Error while initializing PostHog app with config id ",ql=(t,i)=>null!=t&&t.then?t.then(i):i(t),Hl="SDK is not enabled or survey functionality is not yet loaded",Vl="Disabled. Not loading surveys.";class Wl{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Tl=!1,this.Ml=[],this.El=null,this.Il=null,this.Xn=!1,this.Rl=new Set,this.onRemoteConfig=t=>{if(!this.Xn&&!this.qi.disableSurveys){if(!t.ok)return za.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(wi(i))return za.warn("Flags not loaded yet. Not loading surveys.");this.Pl=ki(i)?i:i.length>0,za.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=i}setup(t){if(!this.Xn)return this.Fl=t,ql(t.kv.initialize(),(()=>{if(this.Fl===t&&!this.Xn){this.Fl=void 0,this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Xn?i.dispose():(this.ss=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ml=[],this.El=null,this.Rl.forEach((t=>clearTimeout(t))),this.Rl.clear())}get qi(){return this.ts.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(Ua)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Xn&&this.ns){var t=this.qi;if(!this._surveyManager)if(this.Tl)za.info("Already initializing surveys, skipping...");else if(t.disableSurveys)za.info(Vl);else if(t.cookielessMode&&this.ts.isOptedOut())za.info("Not loading surveys in cookieless mode without consent.");else{var i=this.ts.getExtensions();if(i){if(!_i(this.Pl)||t.advancedEnableSurveys){var e=this.Pl||t.advancedEnableSurveys;this.Tl=!0;try{var r=i.generateSurveys;if(r)return this.Ll(r,e),void(this.Tl=!1);var s=i.loadExternalDependency;if(!s)return this.Ol(ht),void(this.Tl=!1);s((t=>{try{if(this.Xn)return;var i=this.ts.getExtensions();t||null==i||!i.generateSurveys?this.Ol("Could not load surveys script",t):this.Ll(i.generateSurveys,e)}finally{this.Tl=!1}}))}catch(t){throw this.Tl=!1,this.Ol("Error initializing surveys",t),t}}}else za.error("PostHog Extensions not found.")}}}Ll(t,i){this.Xn||(this._surveyManager=t(i),this._surveyEventReceiver=this.ts.createEventReceiver(),za.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,i){za.error(t,i),this.Dl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ml.push(t),this._surveyManager&&this.Dl({isLoaded:!0}),()=>{this.Ml=this.Ml.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.ns)&&void 0!==e?e:this.Al;if(r&&!this.Xn){if(this.qi.disableSurveys)return za.info(Vl),t([]);var s=r.kv.get(z);if(s&&!i)return t(s,{isLoaded:!0}),void(this.$l()&&this.getSurveys((()=>{}),!0));if(this.El)this.El.then((i=>{this.Xn||t(i.surveys,i.context)})).catch((t=>za.error("Error in survey callback",t)));else{var n=this.Nl("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{try{return this.ql(r,t)}catch(t){return za.error("Error processing surveys response",t),this.ql(r,{statusCode:0,error:t})}}),(t=>this.ql(r,{statusCode:0,error:t})));this.El=n;var o=()=>{this.El===n&&(this.El=null)};n.then((i=>{o(),this.Xn||t(i.surveys,i.context)}),o).catch((t=>za.error("Error in survey callback",t)))}}}Nl(t,i){var e=this.ns;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(Hl)})))}ql(t,i){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:Hl}};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.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Il=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Fa(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({[z]:n,[U]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}$l(){return this.jl()&&!this.El&&!this.Bl()}jl(){var t,i,e=null==(t=null!==(i=this.ns)&&void 0!==i?i:this.Al)?void 0:t.kv.get(U);return xi(e)&&Date.now()-e>3e5}Bl(){return xi(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};qa(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Dl(t){for(var i of this.Ml)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),!wi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);za.warn("init was not called")}Hl(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}Ul(t){if(wi(this._surveyManager))return{eligible:!1,reason:Hl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}zl(t){if(wi(this._surveyManager))return{eligible:!1,reason:Hl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(wi(this._surveyManager))return za.warn("init was not called"),{visible:!1,disabledReason:Hl};var i=this.zl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return wi(this._surveyManager)?(za.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Hl})):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.zl(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(wi(this._surveyManager))za.warn("init was not called");else{var s="string"==typeof t?this.Hl(t):t;if(null!=s&&s.id)if(Ha.includes(s.type)){var n=null==kt?void 0:kt.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.Rl.delete(o),this.Xn||(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.Rl.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(wi(this._surveyManager))za.warn("init was not called");else{var s=this.Hl(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!==yo&&i.initialResponses&&za.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.Ul(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){wi(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 Gl(t,i,e){if(wi(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 Kl{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new ka,this.Zl=(t,i)=>this.Ql(t,i)&&this.Jl(t,i)&&this.Kl(t,i)&&this.Yl(t,i),this.Ql=(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;_i(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Xl=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.Xl)||t.call(this),this.Xl=void 0,this.Gl=new ka}register(t){var i,e;if(!_i(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Wl.add(t),null==(i=t.steps)||i.forEach((t=>{this.Vl.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Wl.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.Wl.clear(),this.Vl.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Vl.has(t)||this.Vl.has(i.event))&&this.Wl.forEach((t=>{this.tu(i,t)&&this.Gl.emit("actionCaptured",t.name)}))}eu(t){this.onAction("actionCaptured",(i=>t(i)))}tu(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Zl(t,e))return!0;return!1}onAction(t,i){return this.Gl.on(t,i)}Jl(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(!Gl(r,i.url,i.url_matching||"contains"))return!1}return!0}Kl(t,i){return!!this.iu(t,i)&&!!this.ru(t,i)&&!!this.nu(t,i)}iu(t,i){var e;if(null==i||!i.href)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Gl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}ru(t,i){var e;if(null==i||!i.text)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.text,i.text,i.text_matching||"exact")||Gl(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;!wi(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=>Gl(t,n,o))))}nu(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}su(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Yl(t,i){return null==i||!i.properties||0===i.properties.length||Aa(i.properties.reduce(((t,i)=>{var e=ci(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 Jl{constructor(t){var i;this.au=[],this._instance=t,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.du(t)))}vu(t){return!1}cu(){return null}fu(t){}pu(){}gu(t,i){return!!t&&Aa(t.propertyFilters,null==i?void 0:i.properties)}mu(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}yu(t,i,e){var r=(e===fo?this.ou:this.lu).get(t),s=[];return this.bu((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.gu(n,i)}))}register(t){this._u(t,!1)}replace(t){this._u(t,!0)}_u(t,i){var e;_i(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.wu(t,i),this.ku(t,i))}ku(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.uu.clear(),0!==e.length){this.Su||(this.Su=new Kl(this._instance),this.Su.init(),this.Su.eu((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.uu.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.uu.set(i.name,s)}}))})),i?this.Su.replace(r):this.Su.register(r)}else{var s;i&&(null==(s=this.Su)||s.replace([]))}}xu(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)}))}wu(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.mu(t,fo),a=this.mu(t,po);i?(this.ou=o,this.lu=a):(this.xu(this.ou,o),this.xu(this.lu,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Xl)&&void 0!==e||(this.Xl=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Cu(),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.Tu(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Mu([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Eu(n),void this.Iu([n])}if(this.lu.has(t)){var a=this.yu(t,i,po);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Mu(a.map((t=>t.id))),a.forEach((t=>this.Ru(t.id))))}if(this.ou.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.ou.get(t)});var l=this.yu(t,i,fo);this.Pu(l.map((t=>t.id)))}}onAction(t){this.uu.has(t)&&this.Pu(this.uu.get(t)||[])}Pu(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.vu(s)?this.Eu(s)&&this.Au(s):r.push(s);r.length>0&&(this.au=[...new Set([...this.au,...r])]),this.Cu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Eu(t){this.au=this.au.filter((i=>i!==t));var i=this.Fu();return!i.includes(t)&&(this.Lu([...i,t]),this.Ou(),!0)}Mu(t){var i=new Set(t);this.au=this.au.filter((t=>!i.has(t)));var e=this.Du(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.Lu(r),0===r.length&&this.$u()),this.Iu(t)}Nu(){var t,i=this.cu();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Au(t){if(this.cu()){var i=this.Nu();this.fu(e({},i,{[t]:Date.now()}))}}Iu(t){if(this.cu()){var i=this.Nu(),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&&(gi(e)?this.pu():this.fu(e))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var i=this.Nu()[t];return xi(i)?i:void 0}}Du(){var t,i=this.ju();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Fu(){var t,i,e=this.Du();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Bu()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Ou(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.Hu(i)}$u(){this.Uu()}du(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Bu()];if(e&&e!==t){var r=this.Du(),s=this.Nu();r.length>0&&(this.Lu([]),r.filter((t=>xi(s[t]))).forEach((t=>this.Ru(t)))),this.$u(),this.qu()}}getActivatedIds(){return[...new Set([...this.Fu(),...this.au])].filter((t=>!this.zu(t)))}dispose(){var t,i,e;null==(t=this.hu)||t.call(this),this.hu=void 0,null==(i=this.Xl)||i.call(this),this.Xl=void 0,null==(e=this.Su)||e.dispose(),this.Su=void 0}reset(){this.au=[],this.Du().length>0&&this.Lu([]),this.$u(),this.qu()}getEventToItemsMap(){return this.ou}Wu(){return this.Su}}class Yl extends Jl{constructor(t){super(t)}ju(){return q}Bu(){return H}cu(){return V}fu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[V]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}vu(t){var i,e;this.bu((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return xi(r)&&r>0}Vu(){return go}bu(t){var i;null==(i=this._instance)||i.getSurveys(t)}Ru(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Cu(){return za}Lu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[q]:t})}Hu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[H]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(H)}zu(){return!1}Tu(t,i){var e;this.bu((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Fa(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===go?"consume":"ignore":t===go?"persist":t===_o||t===mo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Ql{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);_i(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 Xl{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 Yl(this._instance)}}var Zl=null!=wt&&wt.location?Bn(wt.location.hash,"__posthog")||Bn(location.hash,"state"):null,th="_postHogToolbarParams",ih=Gr("[Toolbar]"),eh=Gr("[FeatureFlags]");class rh{constructor(t,i){void 0===i&&(i=!1),this.Gu=!1,this.update(t,i)}update(t,i){this.Zu=((t,i)=>{var e,r,s,n;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,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?"none":"base64",evaluationContexts:null!==(s=null!==(n=t.evaluation_contexts)&&void 0!==n?n:t.evaluation_environments)&&void 0!==s?s:[],flagKeys:ci(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(eh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),_i(t.flag_keys)||ci(t.flag_keys)||eh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var sh=Gr("[FeatureFlags]"),nh=Gr("[FeatureFlags]",{debugEnabled:!0}),oh="\" failed. Feature flags didn't load in time.",ah="connection_error",lh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},hh=t=>{var i={};for(var e of Qr(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},uh=Gr("[Error tracking]"),dh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],vh=["__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)=>Ra(i,t),not_regex:(t,i)=>!Ra(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class ph{get qi(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{ph.Qu("retrieved web experiments from the server"),i.Ju=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Ju&&(ph.Qu("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Ju)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);mi(r)&&t.variants[r]&&i.Ku(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];ph.Yu(n,i._instance)&&i.Ku(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())ph.Qu(ch);else if(!this.qi.disable_web_experiments){if(wi(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ph.Qu("applying feature flags",t),t.forEach((t=>{var i;if(this.Ju&&null!=(i=this.Ju)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Ju)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Ku(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=ph.getWindowLocation();if(null!=t&&t.search){var i=Ln(null==t?void 0:t.search,"__experiment_id"),e=Ln(null==t?void 0:t.search,"__experiment_variant");i&&e&&(ph.Qu("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Xu(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.qi.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.qi.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Xu(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(ph.Qu("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Ku(r[0].name,i,r[0].variants[i].transforms))}static Yu(t,i){return!wi(t.conditions)&&ph.th(t,i)&&ph.eh(t)}static th(t,i){var e;if(wi(t.conditions)||wi(null==(e=t.conditions)?void 0:e.url))return!0;var r=ph.getWindowLocation();if(r){var s,n,o,a=Ms(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==wt?void 0:wt.location}static eh(t){var i;if(wi(t.conditions)||wi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=Kn();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 Qu(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Wr.info("[WebExperiments] "+t,e)}Ku(t,i,e){this._is_bot()?ph.Qu(ch):"control"!==i?e.forEach((e=>{if(e.selector){var r;ph.Qu("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)}))}})):ph.Qu("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?Ta(St,this.qi.custom_blocked_useragents):void 0}}var gh=Gr("[Conversations]"),_h="Conversations not available yet.",mh="console",yh="__posthogHandledLogsRequestError",bh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[yh]=!0,e},wh=t=>!!t&&"object"==typeof t&&!0===t[yh],xh={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=sh,this.rh={},this.nh={},this.sh=[],this.ah=!1,this.oh=!1,this.lh=0,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=!1,this.ph=0,this.Tt=()=>{var t=this.gh();this.ph=0,t&&this.reloadFeatureFlags()},"get"in t?this.ts=t:(this.mh=new rh(t.config,t.ma()),this.ts=this.mh)}updateConfig(t,i){var e;null==(e=this.mh)||e.update(t,i)}setup(t){return this.Fl=t,this.I=t.logger.createLogger("[FeatureFlags]"),ql(t.kv.initialize(),(()=>{this.Fl===t&&(this.Fl=void 0,this.ns=t,this.yh(t))}))}yh(t){if(this.ns===t)return wt&&rs(wt,"online",this.Tt),this.bh=t.registerDynamicEventProperties((()=>this._h()?this.rh:this.nh)),this.wh(),this.initialize()}destroy(){null==wt||wt.removeEventListener("online",this.Tt)}dispose(){var t;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),null==(t=this.bh)||t.dispose(),this.bh=void 0,this.sh=[],null==wt||wt.removeEventListener("online",this.Tt),this.ns=void 0)}get qi(){return this.ts.get()}Sh(t){var i;return null==(i=this.ns)?void 0:i.kv.get(t)}Dr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.set(t)}))}qr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.remove(t)}))}xh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}wh(){var t={};for(var i of[F,M,A,D]){var r=this.Sh(i);_i(r)||(t[i]=r)}this.rh=t;var s=e({},t),n=this.Sh(C);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.nh=s}_h(){var t=this.qi.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Sh(Y);return"number"!=typeof i||Date.now()-i>t}Ch(){return!!this._h()&&(this.fh||this.oh||(this.fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Th(){var t=this.qi.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Mh(){var t=this.qi.flagKeys;if(!_i(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.qi,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.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Sh(C))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Sh(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:Ot(c),variant:Dt(c),reason:void 0,metadata:_i(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Eh({flags:u})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(I),i=this.Sh(D),r=this.Sh(j);if(!r&&!i)return t||{};var s=Yr({},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=_i(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=_i(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.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.ih=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:Ot(r),variant:Dt(r),payload:At(i[e])}}))}getFlagVariants(){var t=this.Sh(C),i=this.Sh(D);if(!i)return t||{};for(var e=Yr({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ih=!0),e}getFlagPayloads(){var t=this.Sh(M),i=this.Sh(j);if(!i)return t||{};for(var e=Yr({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ih=!0),e}reloadFeatureFlags(){this.uh||this.qi.featureFlagsDisabled||this.gh()||this.Ih||(this.sh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.Ih=setTimeout((()=>{this.Rh()}),5))}kh(){clearTimeout(this.Ih),this.Ih=void 0}onReloading(t){return this.sh.push(t),()=>{this.sh=this.sh.filter((i=>i!==t))}}ensureFlagsLoaded(){this.ah||this.oh||this.Ih||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.uh=t}resetFlagCallReported(){this.qr(G)}Rh(t){this.kh();var i=this.ns;if(i&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!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.Sh(L)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Sh(N),timezone:eo()};_i(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.qi.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.Th();s.length&&(r.evaluation_contexts=s);var n=this.Mh();_i(n)||(r.flag_keys=n);var o=this.qi.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.lh;this.oh=!0;var h=()=>{this.hh&&(this.hh=!1,this.Rh())},u=t=>{this.oh=!1,l===this.lh?(this.Dr({[J]:[ah]}),this.I.error("Feature flag request failed",t),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:r,compression:"base64"===this.qi.compression?co:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.oh=!1,l===this.lh){if(this.Ph(t.statusCode),n||this.hh||(this.$anon_distinct_id=void 0),!r.disable_flags||this.hh){this.dh=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?ah:"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.Dr({[J]:a}),u?this.I.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.Eh(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}gh(){return zn(this.ph,3)}Ph(t){this.ph=Un(t,this.ph,3,(()=>this.I.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.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){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.I.warn('getFeatureFlag for key "'+t+oh)}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.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Sh(A)||void 0,u=this.Sh(Y)||void 0,d=this.Sh(G)||{};if(this.qi.deduplicateCallsPerSession){var v,c=null==(v=this.ns)?void 0:v.session.sessionId,f=this.Sh(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.Dr({[G]:d,[K]:r});else{var p,g,_,m,y,b,w,x,S,k,E,P;ci(d[t])?d[t].push(l):d[t]=[l],this.Dr(e({[G]:d},r?{[K]:r}:{}));var T=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Sh(J))&&void 0!==p?p:[]];_i(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.qi.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.qi.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.dh};_i(null==T||null==(b=T.metadata)?void 0:b.has_experiment)||(F.$feature_flag_has_experiment=T.metadata.has_experiment),_i(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),_i(null==T?void 0:T.original_variant)&&_i(null==T?void 0:T.original_enabled)||(F.$feature_flag_original_response=_i(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.Ah(F)}else r&&this.Dr({[G]:d,[K]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:At(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+oh)}Ah(t){try{var i;null==(i=this.ns)||i.capture("$feature_flag_called",t).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Fh(t,i)}Fh(t,e){var r=this;return i((function*(){var i=r.ns;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.Th();n.length&&(s.evaluation_contexts=n);var o,a=r.Mh();_i(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===r.qi.compression?co:void 0,sentAt:"body",timeoutMs:r.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.I.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){r.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.dh)return i.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+oh),i.defaultValue;var e=this.getFeatureFlag(t,i);return _i(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.Eh(t,i,e)}Eh(t,i,r){if(this.ns){this.ah=!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=sh);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 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(ci(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{[F]:h,[C]:c,[O]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse)p=e({},i,p),g=e({},r,g),_=e({},s,_);else if(t.errorsWhileComputingFlags)if(l){var m=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=>m.has(t[0]))))),g=e({},r,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0]))))),_=e({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0])))))}else p=e({},i,p),g=e({},r,g),_=e({},s,_);return e({[F]:Object.keys(hh(p)),[C]:p||{},[M]:g||{},[I]:_||{},[O]:!0===t.minimalFlagCalledEvents},d?{[A]:d}:{},v?{[Y]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.I);s&&this.Dr(s),i||(this.fh=!1),this.Lh(i)}}override(t,i){void 0===i&&(i=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Oh(t)}Oh(t){if(this.ns){if(!1===t)return this.qr([D,j]),this.Lh(),void nh.info("All overrides cleared");if(ci(t))return this.Dr({[D]:lh(t)}),this.Lh(),void nh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ih=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[D]=ci(s)?lh(s):s),n&&(r[j]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([D,j]):!1===s?this.qr(D):!1===n&&this.qr(j),this.Lh(),!1===s?nh.info("Flag overrides cleared"):s&&nh.info("Flag overrides set",{flags:s}),void(!1===n?nh.info("Payload overrides cleared"):n&&nh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[D]:t}),this.Lh(),void nh.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ah){var i=this.Dh(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s=(this.Sh(R)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=e({},this.getFlagVariants(),{[t]:i});this.Dr({[F]:Object.keys(hh(a)),[C]:a,[L]:e({},this.Sh(L)||{},n)}),this.Lh();try{var l;null==(l=this.ns)||l.capture("$feature_enrollment_update",o).catch((t=>{this.I.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.I.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Sh(R);!r||i?this.$h(t,e):t(r)}$h(t,e){var r=this;return i((function*(){var i=r.ns;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.Dr({[R]:s=o.json.earlyAccessFeatures})}catch(t){return void r.I.error("Early access feature request failed",t)}try{t(s)}catch(t){r.I.error("Early access feature callback failed",t)}}}))()}Dh(){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)),{})}}Lh(t){this.wh();var i=this.Dh(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Nh(t,i)}Nh(t,i){void 0===i&&(i=!0);var r=this.Sh(L)||{},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.Dr({[L]:e({},r,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.Sh(L)||{});t.forEach((t=>{delete r[t]})),this.Dr({[L]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(L),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Sh(N)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.Dr({[N]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Sh(N)||{};this.Dr({[N]:e({},i,{[t]:{}})})}else this.qr(N)}reset(){this.lh++,this.hh=!1,this.rh={},this.nh={},this.ah=!1,this.uh=!1,this.dh=!1,this.$anon_distinct_id=void 0,this.kh(),this.ih=!1,this.ph=0}}},Sh={sessionRecording:class{get qi(){return this._instance.config}get za(){return this._instance.persistence}get started(){var t;return!(null==(t=this.qh)||!t.isStarted)}get status(){var t,i;return this.jh===Il||this.jh===Ml?this.jh:null!==(t=null==(i=this.qh)?void 0:i.status)&&void 0!==t?t:this.jh}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=Fl,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var t;if(null==kt||!kt.visibilityState||"visible"===kt.visibilityState)return!0;var i=null==wt||null==(t=wt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==kt?void 0:kt.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Ol.error("started without valid sessionManager"),new Error(Al+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===dt)throw new Error(Al+' cannot be used with cookieless_mode="always"');null!=kt&&kt.addEventListener&&rs(kt,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==kt||null==kt.removeEventListener||kt.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var t,i=!(null==(t=this._instance.get_property(b))||!t.enabled),e=!this.qi.disable_session_recording,r=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return wt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.Hh||this.Uh&&null!=(i=this.qh)&&i.isStarted)){var e=!_i(Object.assign)&&!_i(Array.from);this.Uh&&e?(this.zh(t),Ol.info("starting")):(this.jh=Fl,this.stopRecording())}}zh(t){var i,e,r;this.Uh&&(this.jh!==Il&&this.jh!==Ml&&(this.jh=Rl),null!=Mt&&null!=(i=Mt.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=Mt.__PosthogExtensions__)&&e.initSessionRecording?this.Wh(t):null==(r=Mt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(i=>{if(i)return this._instance.register_for_session({[lt]:!0}),Ol.error("could not load recorder",i);this.Wh(t)})))}stopRecording(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.stop()}Gh(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.discard()}Zh(){var t,i;null==(t=this.za)||t.unregister(T),null==(i=this.za)||i.unregister(w)}Qh(t,i){if(wi(t))return null;var e,r=xi(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Ol.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var i,r,s=this.za,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Qh(null==(i=this.qi.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.Qh(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;wi(a)&&this.Zh();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]: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:_i(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.Bh)||i.call(this),this.Bh=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.Jh(i),void this.Gh()):(this.Jh(i),void this.startIfEnabledOrStop()):(this.jh===Il&&(this.jh=Ml,Ol.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.qh)&&e.log?this.qh.log(t,i):Ol.warn("log called before recorder was ready")}get Vh(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Kh(){var t,i=this._instance.get_property(b);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Ol.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!wi(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var i,e,r;if(!this.Hh){if(null==(i=Mt.__PosthogExtensions__)||!i.initSessionRecording)return Ol.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[lt]:!0});var s;if(this.qh||(this.qh=null==(s=Mt.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Ml||this.jh===Il)return;return this.jh=Il,Ol.info("persisted remote config is stale, requesting fresh config before starting"),void new So(this._instance).load()}this.jh=Rl,null==(e=(r=this.qh).setDocumentWasEverVisible)||e.call(r,this.kt),this.qh.start(t)}}onRRwebEmit(t){var i;null==(i=this.qh)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.qh||null==(i=this.za)||i.register({[S]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.qh||null==(i=this.za)||i.register({[x]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var i,e;this.qh||null==(e=this.za)||e.register({["url"===t?k:E]:!0}),null==(i=this.qh)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.qh)||!e.tryAddCustomEvent(t,i))}}},kh={autocapture:class extends bl{constructor(t){super(new wl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Yh=this.Xh()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.td();return!!(t.path||t.search||this.ed(t))}startIfEnabled(){this.isEnabled&&(Wr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Yh=this.Xh(),this.startIfEnabled()}stop(){this.rd&&this.rd(),this.rd=void 0,this.nd&&this.nd(),this.nd=void 0,Wr.info("History API monitoring stopped")}monitorHistoryChanges(){wt&&wt.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(t){var i;if(wt&&(null==(i=wt.history[t])||!i.__posthog_wrapped__)){var e=this;!function(t,i,e){try{if(!(i in t))return Sl;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 fi(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];fi(e)&&e.__posthog_layer__;){var n=e.__posthog_layer__;if(n.next===s)return void(n.next=r.next);e=n.next}else t[i]=r.next}}catch(t){return Sl}}(wt.history,t,(i=>function(r,s,n){i.call(this,r,s,n),e.ld(t)}))}}Xh(){var t=null==wt?void 0:wt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}td(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:pi(t)?t:{}}ed(t){return void 0===t&&(t=this.td()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ud(t){var i=this.td(),e=this.Yh;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.ed(i)&&t.hash!==e.hash))}ld(t){try{var i=this.Xh();if(!i)return;this.ud(i)&&this._instance.capture(_t,{navigation_type:t}),this.Yh=i}catch(i){Wr.error("Error capturing "+t+" pageview",i)}}ad(){if(!this.rd){var t=()=>{this.ld("popstate")};rs(wt,"popstate",t),this.rd=()=>{wt&&wt.removeEventListener("popstate",t)}}}od(){if(!this.nd){var t=()=>{this.ld("hashchange")};rs(wt,"hashchange",t),this.nd=()=>{wt&&wt.removeEventListener("hashchange",t)}}}},heatmaps:class{get qi(){return this.instance.config}constructor(t){var i;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=t,this.hd=!(null==(i=this.instance.persistence)||!i.props[v]),this.rageclicks=new fl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return pi(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return wi(this.qi.capture_heatmaps)?wi(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:!1!==this.qi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;Dl.info("starting..."),this.vd(),this.It()}else{var t;clearInterval(null!==(t=this.dd)&&void 0!==t?t:void 0),this.fd(),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.hd=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){jl(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(kt)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){wt&&kt&&(this.gd=this.La.bind(this),rs(wt,gt,this.gd),this.md=t=>this.ki(t||(null==wt?void 0:wt.event)),rs(kt,"click",this.md,{capture:!0}),this.yd=t=>this.bd(t||(null==wt?void 0:wt.event)),rs(kt,"mousemove",this.yd,{capture:!0}),this._d=new $n(this.instance,kn,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),rs(kt,pt,this.wd),this.Qn=!0)}fd(){var t;wt&&kt&&(this.gd&&wt.removeEventListener(gt,this.gd),this.md&&kt.removeEventListener("click",this.md,{capture:!0}),this.yd&&kt.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&kt.removeEventListener(pt,this.wd),clearTimeout(this.kd),null==(t=this._d)||t.stop(),this.Qn=!1)}Sd(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&&Ns(r)&&!Bs(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:wt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(oi(i,s))return!0;r=Xs(r)}return!1}(Js(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"),!Ls(t.target)&&jl(t)){var s=this.Sd(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&on(Js(t),this.instance.config.rageclick)&&this.Nn(e({},s,{type:"rageclick"})),this.Nn(s)}}bd(t){!Ls(t.target)&&jl(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(t){if(wt){var i=this.qi.disable_capture_url_hashes?He(wt.location.href):wt.location.href,e=this.qi.custom_personal_data_properties,r=this.qi.mask_personal_data_properties?[...Hn,...e||[]]:[],s=Nn(i,r,Wn);this.ft=this.ft||{},this.ft[s]||(this.ft[s]=[]),this.ft[s].push(t)}}La(){this.ft&&!gi(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:$n,webVitalsAutocapture:class{constructor(t){var i;this.hd=!1,this.Qn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.xd=()=>{clearTimeout(this.Cd),this.Cd=void 0,0!==this.ft.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.ft.url},this.ft.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=t=>{var i;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},wi(null==t?void 0:t.name)||wi(null==t?void 0:t.value))El.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Md(r);if(!_i(s)){var n=xi(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Ed||this.Ed>t.value){this.ft.navigationKey!==n&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),_i(this.ft.navigationKey)&&(this.ft.navigationKey=n,this.ft.url=s),this.ft.firstMetricTimestamp=_i(this.ft.firstMetricTimestamp)?Date.now():this.ft.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,pi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Cl){var u="url"===h&&"string"==typeof t.attribution[h]?this.Md(t.attribution[h]):t.attribution[h];_i(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;_i(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.ft.metrics.push(a),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else El.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,i,r,s,n=!1,o=Mt.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Rd])||("web-vitals"===this.Rd&&_i(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!_i(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!_i(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.Td.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Td.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Td.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Td.bind(this),v),this.Qn=!0}else El.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(i=this._instance.persistence)||!i.props[g]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=pi(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return wi(e)?(null==(i=this._instance.persistence)?void 0:i.props[y])||Pl:e}get flushToCaptureTimeoutMs(){return(pi(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=pi(this.Pd)?this.Pd.web_vitals_attribution:void 0;return ki(t)?t?Pl:[]:ci(t)?t:Tl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=pi(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=pi(this.Pd)&&xi(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:$l;return t>0&&6e4>=t?$l:t}get isEnabled(){var t=null==Et?void 0:Et.protocol;if("http:"!==t&&"https:"!==t)return El.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=pi(this.Pd)?this.Pd.web_vitals:ki(this.Pd)?this.Pd:void 0;return ki(i)?i:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(El.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=pi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=pi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:e}),this._instance.persistence.register({[y]:r})),this.hd=e,this.startIfEnabled()}}}get Rd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_s(t){var i=Mt.__PosthogExtensions__,e=this.Rd,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&_i(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?El.error("failed to load script",i):t()}))}Md(t){var i=t||(null==wt?void 0:wt.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?[...Hn,...r||[]]:[];return Nn(e,s,Wn)}El.error("Could not determine current URL")}}},Eh={exceptionObserver:class{constructor(t){var i;this.Id=()=>{var t;if(wt&&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.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=i(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=e(this.captureException.bind(this))),!this.Ld&&this.qi.capture_console_errors&&(this.Ld=r(this.captureException.bind(this)))}catch(t){xl.error("failed to start",t),this.Od()}}},this._instance=t,this.Dd=!(null==(i=this._instance.persistence)||!i.props[c]),this.oe=new ji(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,I:xl})),this.qi=this.$d(),this.startIfEnabledOrStop()}$d(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pi(t)?i=e({},i,t):(_i(t)?this.Dd:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.qi.capture_console_errors||this.qi.capture_unhandled_errors||this.qi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(xl.info("enabled"),this.Od(),this._s(this.Id)):this.Od()}_s(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 xl.error("failed to load script",i);t()}))}Od(){var t,i,e;null==(t=this.Ad)||t.call(this),this.Ad=void 0,null==(i=this.Fd)||i.call(this),this.Fd=void 0,null==(e=this.Ld)||e.call(this),this.Ld=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Dd=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.Dd}),this.qi=this.$d(),this.startIfEnabledOrStop())}}onConfigChange(){this.qi=this.$d()}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.oe.consumeRateLimit(s)?xl.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.Nd=[],this.qd=new pr([new Pr,new jr,new Cr,new Tr,new Or,new Ar,new Rr,new Dr],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=$r.test(l)?l.replace($r,"$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||gr});var r}))}(n)}}("web:javascript",xr,Er)),this._instance=t,this.Nd=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==i?i:[],this.jd=Ur(this.Bd()),this.Hd=new qr(this.jd)}onConfigChange(){this.jd=Ur(this.Bd()),this.Hd.setConfig(this.jd)}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.Nd=n,this._instance.persistence&&this._instance.persistence.register({[f]:this.Nd,[p]:o})}}}get Ud(){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.qd.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.jd.enabled)try{if(!mi(t)||0===t.trim().length)return void uh.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)=>Br.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.zd(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&uh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Hd.add(e({[Lr]:t,[Nr]:(new Date).toISOString()},s))}catch(t){uh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Wd(i)){if(this.Vd(i))return this.Gd("Exception dropped: matched a suppression rule"),void uh.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(i))return this.Gd("Exception dropped: thrown by a browser extension"),void uh.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(i))return this.Gd("Exception dropped: thrown by an injected browser script"),void uh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(i))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void uh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.jd.enabled&&wi(t.$exception_steps)?this.Kd(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",fl:!0});return s&&this.Hd.clear(),s}catch(t){return uh.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void uh.error("Failed to process exception event. Ignoring this exception.",t)}var n}Kd(t){try{var i=this.Hd.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return uh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Gd(t){this.jd.enabled&&this.Hd.add({[Lr]:t,[Nr]:(new Date).toISOString()})}zd(t){return pi(t)?e({},t):{}}Bd(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Vd(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return mi(e)&&e.length>0&&t.$exception_types.push(e),mi(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Nd.some((t=>{var e=t.values.map((t=>{var e=Ma[t.operator],r=i[t.key];if(!e||!r)return!1;var s=ci(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 uh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zd(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>{var i=t.filename;return!!i&&dh.some((t=>i.startsWith(t)))}))}Qd(t){return t.some((t=>{var i=t.value;return mi(i)&&vh.some((t=>i.includes(t)))}))}Jd(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}Wd(t){return!wi(t)&&ci(t)}}},$h=e({productTours:class{get za(){return this._instance.persistence}constructor(t){this.Yd=null,this.Xd=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.za&&this.za.register({[m]:!!i.productTours}),!Nl(this._instance))return!this.Yd&&wi(null==(e=this.za)?void 0:e.props[W])||Ll.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Yd)||r.stop(),this.Yd=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Yd&&Nl(this._instance)&&this._s((()=>this.tv()))}_s(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?Ll.error("Could not load product tours script",i):t()}))}tv(){var t;!this.Yd&&null!=(t=Mt.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=Mt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!ci(this.Xd)||i){var e=this.za;if(e){var r=e.props[W];if(ci(r)&&!i)return this.Xd=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(Nl(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||Ll.warn(s):Ll.error(s),void t([],{isLoaded:!1,error:s})}var n=ci(i.json.product_tours)?i.json.product_tours:[];this.Xd=n,e&&e.register({[W]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){wi(this.Yd)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Yd)||i.showTourById(t)}previewTour(t){this.Yd?this.Yd.previewTour(t):this._s((()=>{var i;this.tv(),null==(i=this.Yd)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Yd)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Yd)||t.nextStep()}previousStep(){var t;null==(t=this.Yd)||t.previousStep()}clearCache(){var t;this.Xd=null,null==(t=this.za)||t.unregister(W)}resetTour(t){var i;null==(i=this.Yd)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Yd)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Yd)||i.cancelPendingTour(t)}}},xh),Ph={siteApps:class{constructor(t){this.ev=0,this._instance=t,this.iv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rv(t,i){if(i){var e=this.globalsForEvent(i);this.iv.push(e),this.iv.length>1e3&&(this.iv=this.iv.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.rv.bind(this));this.nv=()=>{t(),this.iv=[],this.nv=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,Bl),{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}}sv(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)||(zl.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)||(zl.error("prepare_external_dependency_script returned null"),null):t}av(){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==kt?void 0:kt.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.ev++,this.ov)return this.lv();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.sv(t);return i&&v.add(i),i},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!bi(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.ov=()=>{u.forEach((t=>t())),this.ov=void 0},this.lv()}lv(){var t=!1;return()=>{var i;t||(t=!0,this.ev--,0===this.ev&&(null==(i=this.ov)||i.call(this)))}}uv(t,i){void 0===i&&(i=!0);var e=this.av();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.iv.length&&(zl.info("Processing "+this.iv.length+" events for site app with id "+t.id),this.iv.forEach((t=>this.uv((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.nv)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,zl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.uv((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){zl.error(Ul+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){zl.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}hv(){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)}dv(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.uv((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){zl.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.hv(),void this._instance.on("eventCaptured",(t=>this.dv(t)))):void zl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.nv)||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 zl.error(Ul+i,t)}))};for(var a of n.siteApps)o()}else zl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Th={tracingHeaders:class{constructor(t){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var t,i,e=this.gv();e?(_i(this.vv)&&(this.vv=null==(t=Mt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),_i(this.fv)&&(this.fv=null==(i=Mt.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Od()},this._instance=t}initialize(){this.startIfEnabledOrStop()}_s(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 kl.error("failed to load script",i);t()}))}mv(){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}gv(){var t=this.mv();return ci(t)?(ci(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(ci(this.pv)&&this.pv.splice(0),this.pv=t||void 0,this.pv)}Od(){var t,i;null==(t=this.vv)||t.call(this),null==(i=this.fv)||i.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Od()}}},Ch=e({surveys:class extends Wl{constructor(t){var i;super(new Xl(t),{get projectToken(){return i.config.token},kv:new Ql(i=t)}),this._instance=t}Nl(t,i){var e=i.query?oa(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})}))}}},xh),Fh={toolbar:class{constructor(t){this.instance=t}yv(t){Mt.ph_toolbar_state=t}bv(){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),ss(this.instance.config))return!1;if(!wt||!kt)return!1;t=null!=t?t:wt.location,e=null!=e?e:wt.history;try{if(!i){try{wt.localStorage.setItem("test","test"),wt.localStorage.removeItem("test")}catch(t){return!1}i=null==wt?void 0:wt.localStorage}var r,s=Zl||Bn(t.hash,"__posthog")||Bn(t.hash,"state"),n=s?Xr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Xr((()=>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(th)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}_v(t){var i=Mt.ph_load_toolbar||Mt.ph_load_editor;!wi(i)&&fi(i)?i(t,this.instance):ih.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==kt||!kt.getElementById(As));if(!wt||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(wt.localStorage.setItem(th,JSON.stringify(e({},s,{source:void 0}))),2===this.bv())this._v(s);else if(0===this.bv()){var n;this.yv(1),null==(n=Mt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ih.error("[Toolbar] Failed to load",t),void this.yv(0);this.yv(2),this._v(s)})),rs(wt,"turbolinks:load",(()=>{this.yv(0),this.loadToolbar(s)}))}return!0}wv(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)}}},Rh=e({experiments:ph},xh),Ih={conversations:class{constructor(t){this.Sv=void 0,this._conversationsManager=null,this.xv=!1,this.Me=null,this.Cv=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Tv=t.ok,t.ok)){var i=t.config.conversations;wi(i)||(ki(i)?this.Sv=i:(this.Sv=i.enabled,this.Me=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Sv=void 0,this.Me=null,this.Tv=void 0,this.Cv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.xv||this._instance.config.disable_conversations||ss(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Mt?void 0:Mt.__PosthogExtensions__;if(t&&!_i(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var i=t.initConversations;if(i)return this.Mv(i),void(this.xv=!1);var e=t.loadExternalDependency;if(!e)return void this.Ev(ht);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Ev("Could not load conversations script",i):this.Mv(t.initConversations),this.xv=!1}))}catch(t){this.Ev("Error initializing conversations",t),this.xv=!1}}else gh.error("Conversations enabled but missing token in remote config.")}}Mv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.Cv=!1,gh.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else gh.error("Cannot complete initialization: remote config is null")}Ev(t,i){gh.error(t,i),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():gh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!bi(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ss(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Tv?"remote_config_failed":_i(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?wi(this.Me)||!this.Me.token?"missing_token":null!=Mt&&Mt.__PosthogExtensions__?this.xv?"initializing":this.Cv?"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):(gh.warn(_h),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(gh.warn(_h),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(gh.warn(_h),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(gh.warn(_h),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(gh.warn(_h),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(gh.warn(_h),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(gh.warn(_h),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}Sl(){var t;null==(t=this._conversationsManager)||t.setIdentity()}xl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Mh={logs:class{constructor(t){var i,r=this;this.Iv=!1,this.Rv=!1,this.I=Gr("[logs]"),this.Pv=e({},this.I,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some(wh)||r.I.error(...i)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var t,i;this.ph=0,null==(t=this.Lv)||t.onReconnect(),null==(i=this.Ov)||i.onReconnect()},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Iv=!0),wt&&rs(wt,"online",this.Fv)}Dv(t,i,e,r){var s,n=function(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=_i(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}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new or(this.$v(t,i),n,this.Pv,(()=>this.Nv()),(t=>t()),void 0,r),n]}qv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Lv||this.jv!==i){var e;null==(e=this.Lv)||e.reset(),this.jv=i;var r=this.Dv((()=>this.ka),(t=>{this.ka=t}));this.Lv=r[0],this.Bv=r[1]}return this.Lv}Hv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Ov||this.Uv!==i){var e;null==(e=this.Ov)||e.reset(),this.Uv=i;var r=this.Dv((()=>this.Av),(t=>{this.Av=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},mh);this.Ov=r[0],this.zv=r[1]}return this.Ov}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i;if(t.ok){var e=null==(i=t.config.logs)?void 0:i.captureConsoleLogs;!wi(e)&&e&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var t,i;this.ka=[],null==(t=this.Lv)||t.reset(),this.Av=[],null==(i=this.Ov)||i.reset(),this.ph=0}captureLog(t){this.qv().captureLog(t)}vi(t){this.Hv().captureLog(t)}get logger(){return this.Wv||(this.Wv={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.Wv}flushLogs(t){t?this.Vv(t):(this.Lv&&this.Lv.flush().catch((t=>this.Gv(t))),this.Ov&&this.Ov.flush().catch((t=>this.Gv(t))))}Gv(t){wh(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==Mt?void 0:Mt.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",(i=>{var e;i||null==(e=t.logs)||!e.initializeLogs?this.I.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Rv=!0)})):this.I.error(ht)}else this.I.error("PostHog Extensions not found.")}}$v(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:[])},Mn:t=>this.Mn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Mn(t){return new Promise((i=>{if(zn(this.ph,3))i({kind:"fatal",error:bh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:bh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Zv(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Qv(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.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:bh(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)})}}})}}))}Qv(t){(0!==t||this._instance.__loaded)&&(this.ph=Un(t,this.ph,3,(()=>this.I.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."))))}Vv(t){this.ka.length>0&&this.Jv(t,this.ka,this.Bv,s.LIB_NAME,(t=>{this.ka=t})),this.Av.length>0&&this.Jv(t,this.Av,this.zv,mh,(t=>{this.Av=t}))}Jv(t,i,e,r,n){if(0!==i.length){var o=i.map((t=>t.record));n([]);var a=nr(o,sr(e,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Zv(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Nv(){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,wi(s)||(i.sessionStartTimestamp=s),wi(n)||(i.lastActivityTimestamp=n)}if(null!=Mt&&null!=(t=Mt.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?He(Mt.location.href):Mt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},Ah={metrics:class{constructor(t){this.I=Gr("[metrics]"),this._instance=t}initialize(){}qv(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Lv&&this.jv===e||(null==(i=this.Lv)||i.reset(),this.jv=e,this.Lv=new ur(this.$v(),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.I)),this.Lv}count(t,i,e){void 0===i&&(i=1),this.qv().count(t,i,e)}gauge(t,i,e){this.qv().gauge(t,i,e)}histogram(t,i,e){this.qv().histogram(t,i,e)}flush(t){if(!this.Lv)return Promise.resolve();if(t){var i=this.Lv.drainWindow();return i&&this.Un(i,t),Promise.resolve()}return this.Lv.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Lv)||t.reset()}$v(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Un:t=>i.Un(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Un(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.Kv(),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)})}}}))}))}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Oh=e({},xh,Sh,kh,Eh,$h,Ph,Ch,Th,Fh,Rh,Ih,Mh,Ah);cl.__defaultExtensionClasses=e({},Oh)}();
|
|
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.5.2",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.419.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="$web_vitals_allowed_metrics",b="$session_recording_remote_config",w="$replay_sample_rate",x="$replay_override_sampling",S="$replay_override_linked_flag",k="$replay_override_url_trigger",E="$replay_override_event_trigger",P="$sesid",T="$session_is_sampled",C="$enabled_feature_flags",F="$active_feature_flags",R="$early_access_features",I="$feature_flag_details",M="$feature_flag_payloads",A="$feature_flag_request_id",O="$minimal_flag_called_events",D="$override_feature_flags",j="$override_feature_flag_payloads",L="$stored_person_properties",N="$stored_group_properties",B="$groups",z="$surveys",U="$surveys_loaded_at",q="$surveys_activated",H="$surveys_activated_session",V="$surveys_activated_timestamps",W="ph_product_tours",G="$flag_call_reported",K="$flag_call_reported_session_id",J="$feature_flag_errors",Y="$feature_flag_evaluated_at",Q="$user_state",X="$client_session_props",Z="$capture_rate_limit",tt="$initial_campaign_params",it="$initial_referrer_info",et="$initial_person_info",rt="$epp",st="$posthog_cookieless",nt="$cookieless_mode",ot="$sdk_debug_extensions_init_method",at="$sdk_debug_extensions_init_time_ms",lt="$sdk_debug_recording_script_not_loaded",ht="PostHog loadExternalDependency extension not found.",ut="on_reject",dt="always",vt="anonymous",ct="identified",ft="identified_only",pt="visibilitychange",gt="beforeunload",_t="$pageview",mt="$pageleave",yt="$identify",bt="$groupidentify",wt="undefined"!=typeof window?window:void 0,xt="undefined"!=typeof globalThis?globalThis:wt,St=null==xt?void 0:xt.navigator,kt=null==xt?void 0:xt.document,Et=null==xt?void 0:xt.location,$t=null==xt?void 0:xt.fetch,Pt=null!=xt&&xt.XMLHttpRequest&&"withCredentials"in new xt.XMLHttpRequest?xt.XMLHttpRequest:void 0,Tt=null==xt?void 0:xt.AbortController,Ct=null==xt?void 0:xt.CompressionStream,Ft=null==St?void 0:St.userAgent;function Rt(){return!(!wt||!1===wt.navigator.onLine)}var It="undefined"!=typeof globalThis?globalThis:wt;It&&"undefined"==typeof self&&(It.self=It),It&&"undefined"==typeof File&&(It.File=function(){});var Mt=null!=wt?wt:{},At=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Ot(t){return"string"==typeof t||t}function Dt(t){return"string"==typeof t?t:void 0}var jt,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"],qt="NativeGzipValidationError",Ht=t=>t.length>=2&&31===t[0]&&139===t[1],Vt=(t,i)=>t===Bt.GZipJS||i===Bt.GZipJS||"gzip"===i,Wt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Gt=t=>{var i=new Error("Native gzip produced invalid output: "+t);throw i.name=qt,i},Kt=function(){var t=i((function*(t,i){18>t.size&&Gt("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ht(e)&&8===e[2]||Gt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(jt)return jt;jt=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;jt[t]=i>>>0}return jt})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Gt("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Gt("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function Jt(){return Jt=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 Kt(h,s),h}catch(t){if(null!=r&&r.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),Jt.apply(this,arguments)}var Yt=20,Qt=1e3,Xt=1e4,Zt="[Circular]",ti="[Truncated]",ii="[Unserializable]",ei="[Function]";function ri(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 si=["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","pinterest","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"],ni=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return si.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function oi(t,i){return-1!==t.indexOf(i)}var ai=function(t){return t.trim()},li=function(t){return t.replace(/^\$/,"")};function hi(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 ui=Object.prototype,di=ui.hasOwnProperty,vi=ui.toString,ci=Array.isArray||function(t){return"[object Array]"===vi.call(t)},fi=t=>"function"==typeof t,pi=t=>t===Object(t)&&!ci(t),gi=t=>{if(pi(t)){for(var i in t)if(di.call(t,i))return!1;return!0}return!1},_i=t=>void 0===t,mi=t=>"[object String]"==vi.call(t),yi=t=>mi(t)&&0===t.trim().length,bi=t=>null===t,wi=t=>_i(t)||bi(t),xi=t=>"[object Number]"==vi.call(t)&&t==t,Si=t=>xi(t)&&t>0,ki=t=>"[object Boolean]"===vi.call(t),Ei=t=>t instanceof FormData,$i=t=>oi(zt,t),Pi=t=>oi(Ut,t);function Ti(t){return null===t||"object"!=typeof t}function Ci(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Fi(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 Ii(t,Error)}}function Ri(t){return"undefined"!=typeof Event&&Ii(t,Event)}function Ii(t,i){try{return t instanceof i}catch(t){return!1}}var Mi=[!0,"true",1,"1","yes"],Ai=t=>oi(Mi,t),Oi=[!1,"false",0,"0","no"];function Di(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),xi(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),Di(s||e,i,e,r))}class ji{constructor(t){this.k={},this.S=t.S,this.C=Di(t.bucketSize,0,100,t.I),this.R=Di(t.refillRate,0,this.C,t.I),this.A=Di(t.refillInterval,0,864e5,t.I)}O(t,i){var e=Math.floor((i-t.lastAccess)/this.A);e>0&&(t.tokens=Math.min(t.tokens+e*this.R,this.C),t.lastAccess=t.lastAccess+e*this.A)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,e):this.k[r]=s={tokens:this.C,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.S)||i.call(this,t)),0===s.tokens)}stop(){this.k={}}}var Li="Mobile",Ni="iOS",Bi="Android",zi="Tablet",Ui=Bi+" "+zi,qi="iPad",Hi="Apple",Vi=Hi+" Watch",Wi="Safari",Gi="BlackBerry",Ki="Samsung",Ji=Ki+"Browser",Yi=Ki+" Internet",Qi="Chrome",Xi=Qi+" OS",Zi=Qi+" "+Ni,te="Internet Explorer",ie=te+" "+Li,ee="Opera",re=ee+" Mini",se="Edge",ne="Microsoft "+se,oe="Firefox",ae=oe+" "+Ni,le="Nintendo",he="PlayStation",ue="Xbox",de=Bi+" "+Li,ve=Li+" "+Wi,ce="Windows",fe=ce+" Phone",pe="Nokia",ge="Ouya",_e="Generic",me=_e+" "+Li.toLowerCase(),ye=_e+" "+zi.toLowerCase(),be="Konqueror",we="Oculus Browser",xe="Vivaldi",Se="Yandex",ke="Whale",Ee="DuckDuckGo",$e="Pale Moon",Pe="Waterfox",Te="Brave",Ce="Google Search App",Fe="(\\d+(\\.\\d+)?)",Re=new RegExp("Version/"+Fe),Ie=new RegExp(ue,"i"),Me=new RegExp(he+" \\w+","i"),Ae=new RegExp(le+" \\w+","i"),Oe=new RegExp(Gi+"|PlayBook|BB10","i"),De={"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"},je=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?Te:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&oi(t,"GSA/")?Ce:oi(t," OPR/")&&oi(t,"Mini")?re:oi(t," OPR/")?ee:Oe.test(t)?Gi:oi(t,"IE"+Li)||oi(t,"WPDesktop")?ie:oi(t,"OculusBrowser")?we:oi(t,Ji)?Yi:oi(t,se)||oi(t,"Edg/")?ne:oi(t,xe+"/")?xe:oi(t,"YaBrowser/")?Se:oi(t,ke+"/")?ke:oi(t,Ee+"/")||oi(t,"Ddg/")?Ee:oi(t,"FBIOS")?"Facebook "+Li:oi(t,"UCWEB")||oi(t,"UCBrowser")?"UC Browser":oi(t,"CriOS")?Zi:oi(t,"CrMo")||oi(t,Qi)?Qi:oi(t,Bi)&&oi(t,Wi)?de:oi(t,"FxiOS")?ae:oi(t.toLowerCase(),be.toLowerCase())?be:oi(t,Te+"/")?Te:((t,i)=>i&&oi(i,Hi)||function(t){return oi(t,Wi)&&!oi(t,Qi)&&!oi(t,Bi)}(t))(t,i)?oi(t,Li)?ve:Wi:oi(t,"PaleMoon/")?$e:oi(t,Pe+"/")?Pe:oi(t,oe)?oe:oi(t,"MSIE")||oi(t,"Trident/")?te:oi(t,"Gecko")?oe:"")},Le={[ie]:[new RegExp("rv:"+Fe)],[ne]:[new RegExp(se+"?\\/"+Fe)],[Qi]:[new RegExp("("+Qi+"|CrMo)\\/"+Fe)],[Zi]:[new RegExp("CriOS\\/"+Fe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Fe)],[Wi]:[Re],[ve]:[Re],[ee]:[new RegExp("(Opera|OPR)\\/"+Fe)],[oe]:[new RegExp(oe+"\\/"+Fe)],[ae]:[new RegExp("FxiOS\\/"+Fe)],[be]:[new RegExp("Konqueror[:/]?"+Fe,"i")],[Gi]:[new RegExp(Gi+" "+Fe),Re],[de]:[new RegExp("android\\s"+Fe,"i")],[Yi]:[new RegExp(Ji+"\\/"+Fe)],[we]:[new RegExp("OculusBrowser\\/"+Fe)],[xe]:[new RegExp(xe+"\\/"+Fe)],[Se]:[new RegExp("YaBrowser\\/"+Fe)],[ke]:[new RegExp(ke+"\\/"+Fe)],[Te]:[new RegExp(Te+"\\/"+Fe)],[Ee]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Fe)],[$e]:[new RegExp("PaleMoon\\/"+Fe)],[Pe]:[new RegExp(Pe+"\\/"+Fe)],[Ce]:[new RegExp("GSA\\/"+Fe)],[te]:[new RegExp("(rv:|MSIE )"+Fe)],Mozilla:[new RegExp("rv:"+Fe)]},Ne=function(t,i,e,r){var s=je(t,i,e,r),n=Le[s];if(_i(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},Be=[[new RegExp(ue+"; "+ue+" (.*?)[);]","i"),t=>[ue,t&&t[1]||""]],[new RegExp(le,"i"),[le,""]],[new RegExp(he,"i"),[he,""]],[Oe,[Gi,""]],[new RegExp(ce,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[fe,""];if(new RegExp(Li).test(i)&&!/IEMobile\b/.test(i))return[ce+" "+Li,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=De[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[ce,r]}return[ce,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ni,[t[3],t[4],t[5]||"0"].join(".")]:[Ni,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=_i(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Bi+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Bi+")","i"),t=>t&&t[2]?[Bi,[t[2],t[3],t[4]||"0"].join(".")]:[Bi,""]],[/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/,[Xi,""]],[/Linux|debian/i,["Linux",""]]],ze=function(t){return Ae.test(t)?le:Me.test(t)?he:Ie.test(t)?ue:new RegExp(ge,"i").test(t)?ge:new RegExp("("+fe+"|WPDesktop)","i").test(t)?fe:/iPad/.test(t)?qi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Vi:Oe.test(t)?Gi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(pe,"i").test(t)?pe:/(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(Li).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)?Bi:Ui:new RegExp("(pda|"+Li+")","i").test(t)?me:new RegExp(zi,"i").test(t)&&!new RegExp(zi+" pc","i").test(t)?ye:""},Ue=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function qe(t,i){return"string"==typeof(e=t)&&Ue.test(e)?t:i();var e}function He(t){return t?t.split("#")[0]:t}function Ve(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function We(t,i,e){return Ge.apply(this,arguments)}function Ge(){return(Ge=i((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ve((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ke={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}},Je=Ke.info,Ye=0x8000000000000000,Qe={}.propertyIsEnumerable;function Xe(t,i){try{return ir(t,i,{ancestors:new WeakSet,remainingNodes:Xt},0)}catch(t){return[]}}function Ze(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:ti};if(e.remainingNodes--,ki(t))return{boolValue:t};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>=Ye||-Ye>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:ri(t)};if("function"==typeof t)return{stringValue:ei};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:Zt};if(r>=Yt)return{stringValue:ti};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?ri(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Ze(a.call(t),i,e,r+1)}catch(t){}return ci(t)?{arrayValue:{values:tr(t,i,e,r+1)}}:{kvlistValue:{values:ir(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:ri(String(t))}}function tr(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(wi(a))continue;s.push(Ze(a,i,e,r))}catch(t){s.push({stringValue:ii})}return t.length>o&&s.push({stringValue:ti}),s}function ir(t,i,e,r){var s=[];for(var n in t)if(Qe.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(bi(o)||_i(o))continue;s.push({key:ri(n),value:Ze(o,i,e,r)})}catch(t){s.push({key:ri(n),value:{stringValue:ii}})}}return s}function er(t){try{return ri(String(t))}catch(t){return ii}}function rr(t,i,r){var s=Ke[t.level||"info"]||Je,n=s.text,o=s.number,a=String(Date.now())+"000000",l={};i.distinctId&&(l.posthogDistinctId=i.distinctId),i.sessionId&&(l.sessionId=i.sessionId),i.windowId&&(l["window.id"]=i.windowId),wi(i.sessionStartTimestamp)||(l.sessionStartTimestamp=String(i.sessionStartTimestamp)),wi(i.lastActivityTimestamp)||(l.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(l["url.full"]=i.currentUrl),i.screenName&&(l["screen.name"]=i.screenName),i.appState&&(l["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(l.feature_flags=i.activeFeatureFlags);var h=e({},l),u=t.attributes;if(u){var d=[];try{d=Object.keys(u)}catch(t){d=[]}for(var v of d){var c=void 0;try{c=u[v]}catch(t){c=ii}Object.defineProperty(h,v,{value:c,enumerable:!0,writable:!0,configurable:!0})}}var f={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:er(t.body)},attributes:Xe(h,r)};return t.trace_id&&(f.traceId=t.trace_id),t.span_id&&(f.spanId=t.span_id),_i(t.trace_flags)||(f.flags=t.trace_flags),f}function sr(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 nr(t,i,e,r){return{resourceLogs:[{resource:{attributes:Xe(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let or=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.qi=i,this.I=e,this.rn=r,this.nn=s,this.sn=n,this.an=o,this.ln=null,this.un=0,this.hn=0,this.dn=0,this.vn=0,this.cn=!1,this.fn=i.maxBufferSize,this.pn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.gn=i.flushIntervalMs,this.mn=i.maxBatchRecordsPerPost,this.yn=i.rateCapWindowMs,this.bn=i.maxLogsPerInterval}reset(){this._n(),this.ln=null,this.dn=0,this.vn=0,this.cn=!1,this.un=0,this.hn=0,this.mn=this.qi.maxBatchRecordsPerPost}onReconnect(){this.hn=0,this.wn()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var i=this.kn(t);if(null!==i)if(i.body){if(this.Sn()){var e={record:rr(i,this.rn(),this.I)};this.nn((()=>this.xn(e)))}}else this.I.info("Log was rejected in beforeSend function")}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=ci(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for log:",t),null}return r}Sn(){if(void 0===this.bn)return!0;var t=Date.now(),i=t-this.dn;return this.yn>i&&i>=0||(this.dn=t,this.vn=0,this.cn=!1),this.bn>this.vn?(this.vn++,!0):(this.cn||(this.I.warn("captureLog dropping logs: exceeded "+this.bn+" logs per "+this.yn+"ms"),this.cn=!0),!1)}flush(){var t=this;return i((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return i((function*(){var i;t._n();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;t.un=0;var a=Math.min(e.length,t.mn),l=e.slice(0,a),h=nr(l.map((t=>t.record)),t.Tn(),null!==(n=t.an)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Mn(h);if("too-large"===u.kind&&l.length>1)t.mn=Math.max(1,Math.floor(l.length/2)),t.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.mn);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.I.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"===u.kind&&t.qi.maxBatchRecordsPerPost>t.mn&&(t.mn=Math.min(t.qi.maxBatchRecordsPerPost,t.mn+1)),yield t.En(l.length),e=null!==(o=t._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}}))()}En(t){var e=this;return i((function*(){var i,r=Math.max(0,t-e.un),s=null!==(i=e._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(Nt.LogsQueue,s.slice(r)),yield e.sn()}))()}Tn(){return sr(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(Nt.LogsQueue))&&void 0!==i?i:[];this.pn>e.length||(e.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(Nt.LogsQueue,e),this.fn>e.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Ve((()=>{this.Rn=void 0,this.wn()}),t))}Pn(){var t=Math.min(Math.max(0,this.hn-1),6);return this.gn*Math.pow(2,t)}An(){var t=this._instance.getPersistedProperty(Nt.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return i((function*(){e._n();var i=e.flush().catch((()=>{}));void 0!==t?yield We(i,t):yield i}))()}flushWithTimeout(t){var e=this;return i((function*(){var i=e.flush();yield We(i,t,(()=>{i.catch((()=>{}))}))}))()}wn(){this.flush().then((()=>{this.hn=0}),(t=>{this.hn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())}))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var ar=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function lr(t){return String(t)+"000000"}function hr(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 ur=class{constructor(t,i,e){this._instance=t,this.qi=i,this.I=e,this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.$n=0}count(t,i,e){void 0===i&&(i=1),this.Nn({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.Nn({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.Nn({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.ln,r=function(){var r=i((function*(){e&&(yield e.catch((()=>{}))),yield t.qn()}));return function(){return r.apply(this,arguments)}}(),s=r().finally((()=>{this.ln===s&&(this.ln=null)}));return this.ln=s,s}drainWindow(){if(0===this.Fn.size)return null;var t=this.Fn;return this.Fn=new Map,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.jn(t)}reset(){this.$n++,this._n(),this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set}Nn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.kn(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.I.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=hr(i.type,i.name,i.unit,r)}catch(t){return void this.I.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.Fn.get(s);if(!n){if(!this.Bn())return;n={name:i.name,type:i.type,unit:i.unit,attributes:r,windowStartMs:Date.now()},this.Fn.set(s,n)}var o=this.On.get(i.name);void 0===o?this.On.set(i.name,i.type):o===i.type||this.Dn.has(i.name)||(this.Dn.add(i.name),this.I.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.Hn(n,i.value),this.In()}else this.I.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Bn(){return this.qi.maxSeriesPerFlush>this.Fn.size||(this.Ln||(this.Ln=!0,this.I.warn("Metric series cap reached ("+this.qi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Hn(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(ar.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,ar)]+=1}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=ci(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for metric:",t),null}return r}In(){this.Rn||(this.Rn=Ve((()=>{this.Rn=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.qi.flushIntervalMs))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}qn(){var t=this;return i((function*(){if(0!==t.Fn.size){var i=t.Fn;t.Fn=new Map,t.Ln=!1,t.On=new Map,t.Dn=new Set;var e=t.$n,r=yield t._instance.Un(t.jn(i));if(e===t.$n)switch(r.kind){case"ok":return;case"retry-later":return t.zn(i),void t.In();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}}))()}jn(t){return i=this.Wn(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.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Xe(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,r,s,n}Wn(t){var i=lr(Date.now()),r=new Map;for(var s of t.values()){var n,o=hr(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=Xe(null!==(n=s.attributes)&&void 0!==n?n:{},this.I),h=lr(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:ar})}return Array.from(r.values())}zn(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Fn.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.Bn()&&this.Fn.set(s,n)}}};var dr,vr,cr;function fr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return cr&&e.length===vr||(vr=e.length,cr=e.reduce(((e,r)=>{dr||(dr={});var s=dr[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,dr[r]=[l,h];break}}return e}),{})),cr}}class pr{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&&ci(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:fr(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 gr="?";function _r(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?gr:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return _i(r)||(n.lineno=r),_i(s)||(n.colno=s),n}var mr=(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]:gr,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},yr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,br=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wr=/\((\S*)(?::(\d+))(?::(\d+))\)/,xr=(t,i)=>{var e=yr.exec(t);if(e)return _r(i,e[1],gr,+e[2],+e[3]);var r=br.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=wr.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=mr(r[1]||gr,r[2]);return _r(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Sr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Er=(t,i)=>{var e=Sr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=kr.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]||gr,o=mr(n,s);return _r(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},$r=/\(error: (.*)\)/;class Pr{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=mi(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 Ci(t,"DOMException")}isDOMError(t){return Ci(t,"DOMError")}}class Tr{match(t){return Fi(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 Cr{constructor(){}match(t){return!!Ci(t,"ErrorEvent")&&(null!=t.error||this.fi(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.pi(t))&&void 0!==r?r:s.stack,synthetic:!0})}fi(t){return mi(t.message)&&t.message.length>0}pi(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(mi(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Fr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Rr{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(Fr);return r&&(i=r[1],e=r[2]),[i,e]}}var Ir=["fatal","error","warning","log","info","debug"];function Mr(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 Ar{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(Ri(t))return t.constructor.name;var i="name"in t?t.name:void 0;return mi(i)&&!yi(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: "+Mr(t)}isSeverityLevel(t){return mi(t)&&!yi(t)&&Ir.indexOf(t)>=0}getStack(t){try{return mi(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:mi(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(Fi(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Or{match(t){return Ri(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Mr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class Dr{match(t){return Ti(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 jr{match(t){return Ci(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ri(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 Ti(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 Lr="$message",Nr="$timestamp",Br=new Set([Lr,Nr]),zr={enabled:!0,max_bytes:32768};function Ur(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:zr.enabled,max_bytes:Hr(t.max_bytes,zr.max_bytes)}:e({},zr)}class qr{constructor(t){this.Vn=[],this.Gn=0,this.qi=Ur(t)}setConfig(t){this.qi=Ur(t),this.Zn()}add(t){var i=function(t){var i;try{i=hi(t)}catch(t){return}try{var e=JSON.parse(i);if(!pi(e))return;var r=e,s=r[Lr],n=r[Nr];if(!mi(s)||0===s.trim().length)return;if(!mi(n)&&!xi(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.qi.max_bytes||(this.Vn.push({step:i.step,bytes:e}),this.Gn+=e,this.Zn())}}getAttachable(){return this.Vn.map((t=>t.step))}clear(){this.Vn=[],this.Gn=0}size(){return this.Vn.length}Zn(){for(;this.Gn>this.qi.max_bytes&&this.Vn.length>0;){var t=this.Vn.shift();t&&(this.Gn-=t.bytes)}}}function Hr(t,i){if(!xi(t)||t===1/0||t===-1/0)return i;var e=Math.floor(t);return 0>e?i:e}var Vr=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={F(i){if(wt&&(s.DEBUG||wt.POSTHOG_DEBUG||e)&&!_i(wt.console)&&wt.console){for(var r=("__rrweb_original__"in wt.console[i]?wt.console[i].__rrweb_original__:wt.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.F("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.F("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.F("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.F("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)=>Vr(t+" "+i,e)};return r},Wr=Vr("[PostHog.js]"),Gr=Wr.createLogger;function Kr(t,i){ci(t)&&t.forEach(i)}function Jr(t,i){if(!wi(t))if(ci(t))t.forEach(i);else if(Ei(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)di.call(t,e)&&i(t[e],e)}var Yr=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 Qr(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 Xr=function(t){try{return t()}catch(t){return}},Zr=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){Wr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wr.critical(t)}}},ts=function(t){var i={};return Jr(t,(function(t,e){(mi(t)&&t.length>0||xi(t))&&(i[e]=t)})),i};var is=["herokuapp.com","vercel.app","netlify.app"];function es(t){var i=null==t?void 0:t.hostname;if(!mi(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of is)if(e===r)return!1;return!0}function rs(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 ss(t){return"ph_toolbar_internal"===t.name}var ns=t=>{if(kt){try{for(var i=t+"=",e=kt.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 xi(t)&&isFinite(t)&&Math.floor(t)===t});class os{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 os(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 os(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 as{generate(){var t=this.generateOrAbort();if(!_i(t))return t;this.Rr=0;var i=this.generateOrAbort();if(_i(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Rr)this.Rr=t,this.Ar();else{if(this.Rr>=t+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return os.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new us}}var ls,hs=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};wt&&!_i(wt.crypto)&&crypto.getRandomValues&&(hs=t=>crypto.getRandomValues(t));class us{nextUint32(){return this.ft.length>this.Fr||(hs(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var ds=()=>vs().toString(),vs=()=>(ls||(ls=new as)).generate(),cs="",fs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ps={Nr:()=>!!kt,jr(t){Wr.error("cookieStore error: "+t)},Pr:ns,Br(t){var i;try{i=JSON.parse(ps.Pr(t))||{}}catch(t){}return i},Dr(t,i,e,r,s){if(!kt)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=kt),cs)return cs;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_"+ds();!cs&&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",cs=n)}return cs}(t);if(!e){var r=(t=>{var i=t.match(fs);return i?i[0]:""})(t);r!==e&&Wr.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(kt.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&&Wr.warn("cookieStore warning: large cookie, len="+h.length),kt.cookie=h,!0}catch(t){return!1}},qr(t,i){if(null!=kt&&kt.cookie)try{ps.Dr(t,"",-1,i)}catch(t){return}}},gs=null,_s={Nr(){if(!bi(gs))return gs;var t=!0;if(_i(wt))t=!1;else try{var i="__mplssupport__";_s.Dr(i,"xyz"),'"xyz"'!==_s.Pr(i)&&(t=!1),_s.qr(i)}catch(i){t=!1}return t||Wr.error("localStorage unsupported; falling back to cookie store"),gs=t,t},jr(t){Wr.error("localStorage error: "+t)},Pr(t){try{return null==wt?void 0:wt.localStorage.getItem(t)}catch(t){_s.jr(t)}return null},Br(t){try{return JSON.parse(_s.Pr(t))||{}}catch(t){}return null},Dr(t,i){try{return null==wt||wt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){_s.jr(t)}return!1},qr(t){try{null==wt||wt.localStorage.removeItem(t)}catch(t){_s.jr(t)}}},ms=[L,F,C,I,M,A,Y,J,G],ys=[a,o,P,T,rt,et,Q],bs=t=>t+"_cpm",ws=["__proto__","constructor","prototype"],xs=t=>{if(!pi(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===ws.indexOf(e)&&(i[e]=t[e])})),i},Ss=function(t,i){void 0===i&&(i=[]);var e={};return[...ys,...i].forEach((i=>{var r=t[i];_i(r)||bi(r)||""===r||(e[i]=r)})),e},ks=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)},Es=(t,i)=>({p:i,f:ks(JSON.stringify(t))}),$s=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=ps.Br(bs(t)),r=(null==e?void 0:e.f)===ks(i)&&ci(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ps=(t,i)=>i+"|"+(ps.Pr(bs(t))||""),Ts={},Cs={Nr:()=>!0,jr(t){Wr.error("memoryStorage error: "+t)},Pr:t=>Ts[t]||null,Br:t=>Ts[t]||null,Dr:(t,i)=>(Ts[t]=i,!0),qr(t){delete Ts[t]}},Fs=null,Rs={Nr(){if(!bi(Fs))return Fs;if(Fs=!0,_i(wt))Fs=!1;else try{var t="__support__";Rs.Dr(t,"xyz"),'"xyz"'!==Rs.Pr(t)&&(Fs=!1),Rs.qr(t)}catch(t){Fs=!1}return Fs},jr(t){Wr.error("sessionStorage error: ",t)},Pr(t){try{return null==wt?void 0:wt.sessionStorage.getItem(t)}catch(t){Rs.jr(t)}return null},Br(t){try{return JSON.parse(Rs.Pr(t))||null}catch(t){}return null},Dr(t,i){try{return null==wt||wt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Rs.jr(t)}return!1},qr(t){try{null==wt||wt.sessionStorage.removeItem(t)}catch(t){Rs.jr(t)}}};class Is{constructor(t){this._instance=t}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===dt||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===ut}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qi.opt_out_capturing_by_default}optInOut(t){this.ps.Dr(this.gs,t?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){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 fs(){var t=this.ps.Pr(this.gs);return Ai(t)?1:oi(Oi,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,i="localStorage"===t?_s:ps;if(!this.ys||this.ys!==i){this.ys=i;var e="localStorage"===t?ps:_s;e.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(Ai(e.Pr(this.gs))),e.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==St?void 0:St.doNotTrack,null==St?void 0:St.msDoNotTrack,Mt.doNotTrack].some((t=>Ai(t)))}}function Ms(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!fi(r))return i;try{var s=r(i);return mi(s)&&s?s:i}catch(t){return Wr.error("Error in get_current_url, falling back to window.location.href",t),i}}var As="__POSTHOG_TOOLBAR__",Os=1,Ds=3,js=11;function Ls(t){return t instanceof Element&&(t.id===As||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Ns(t){return!!t&&t.nodeType===Os}function Bs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function zs(t){return!!t&&t.nodeType===Ds}function Us(t){return!!t&&t.nodeType===js&&Ns(t.host)}var qs=1e3;function Hs(t){return t?ai(t).split(/\s+/):[]}function Vs(t,i){var e=function(t){var i,e=null==wt||null==(i=wt.location)?void 0:i.href;return _i(e)?void 0:Ms(t,e)}(i);return!!(e&&t&&t.some((t=>e.match(t))))}function Ws(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 Hs(i)}function Gs(t){return wi(t)?null:ai(t).split(/(\s+)/).filter((t=>mn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ks(t){var i="";return hn(t)&&!un(t)&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var e;zs(t)&&t.textContent&&(i+=null!==(e=Gs(t.textContent))&&void 0!==e?e:"")})),ai(i)}function Js(t){var i;return _i(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var Ys=["a","button","form","input","select","textarea","label"];function Qs(t,i){if(_i(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 Xs(t){var i=t.parentNode;return!(!i||!Ns(i))&&i}var Zs=[".ph-no-autocapture","[data-ph-no-autocapture]"],tn=["next","previous","prev",">","<"],en=[...tn,"+","-","−","–"],rn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,sn=[".ph-no-rageclick",".ph-no-capture"],nn=["","text","search","email","password","url","tel","number"];function on(t,i){if(!wt||an(t))return!1;var e,r,s,n,o;if(ki(i)?(e=!!i&&sn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:sn,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||!Ns(t))&&(!!Bs(t,"textarea")||(Bs(t,"input")?oi(nn,(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=ln(t,!1).targetElementList;return!function(t,i){if(!1===t||_i(t))return!1;var e;if(!0===t)e=tn;else{if(!ci(t))return!1;if(t.length>10)return Wr.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=>rn(i,t)||rn(r,t)))}))}(r,a.map((t=>{var i;return{safeText:Ks(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!Qs(a,e)}var an=t=>!t||Bs(t,"html")||!Ns(t),ln=(t,i)=>{if(!wt||an(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!Bs(s,"body");)if(Us(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Xs(s);if(!n)break;if(i||Ys.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=wt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function hn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Bs(r,"body");r=r.parentNode){if(e++>=qs||i.has(r))return!1;i.add(r);var s=Ws(r);if(oi(s,"ph-sensitive")||oi(s,"ph-no-capture"))return!1}if(oi(Ws(t),"ph-include"))return!0;var n=t.type||"";if(mi(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!mi(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 un(t){return!!(Bs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Bs(t,"select")||Bs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var dn=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}))$"),vn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,cn=[16,15,14,13],fn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),pn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),gn=/[0-9A-Za-z_]/;function _n(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 mn(t,i){if(void 0===i&&(i=!0),wi(t))return!1;if(mi(t)){t=ai(t);var e=i?dn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(vn.lastIndex=0;i=vn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of cn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(dn.test(a)&&_n(a))return!0}}}return!1}(t);if(e)return!1;var r=i?fn.test(t):function(t){var i;for(pn.lastIndex=0;i=pn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&gn.test(e)&&gn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function yn(t){var i=Ks(t);return mn(i=(i+" "+bn(t)).trim())?i:""}function bn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Ks(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+bn(t)).trim())}catch(t){Wr.error("[AutoCapture]",t)}})),i}function wn(t){return t.replace(/"|\\"/g,'\\"')}function xn(t){var i=t.attr__class;if(i)return ci(i)?i:Hs(i)}var Sn=Gr("[Dead Clicks]"),kn=()=>!0,En=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(_)),r=t.instance.config.capture_dead_clicks;return ki(r)?r:!!pi(r)||e};class $n{get lazyLoadedDeadClicksAutocapture(){return this.bs}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._s((()=>{this.ws()})):this.stop()}_s(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?Sn.error("failed to load script",i):t()}))}ws(){var t;if(kt){if(!this.bs&&null!=(t=Mt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=pi(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.bs=Mt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.bs.start(kt),Sn.info("starting...")}}else Sn.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Sn.info("stopping..."))}}var Pn=Gr("[SegmentIntegration]");var Tn="posthog-js";function Cn(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 Fn{constructor(t,i,e,r,s,n){this.name=Tn,this.setupOnce=function(o){o(Cn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Rn{constructor(t){this.ks=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Wr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.xs()}xs(){var t;this.Cs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ks)}destroy(){var t;null==(t=this.Cs)||t.call(this),this.Cs=void 0}doPageView(t,i){var e,r=this.Ts(t,i);return this.Ss={pathname:null!==(e=null==wt?void 0:wt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.Ts(t,null==(i=this.Ss)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,i){var e=this.Ss;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(!(_i(n)||_i(o)||_i(a)||_i(l)||_i(h)||_i(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?Di(o/n,0,1,Wr):1,v=n>1?Di(a/n,0,1,Wr):1,c=l>1?Di(h/l,0,1,Wr):1,f=l>1?Di(u/l,0,1,Wr):1;r=Yr(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 In=["flags","surveys"],Mn={[n]:{exposure:"hidden"},[h]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[g]:{exposure:"event"},[_]:{exposure:"event"},[m]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[P]:{exposure:"hidden"},[T]:{exposure:"event"},[w]:{exposure:"event",shouldSkipFromEventProperties:t=>bi(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"},[C]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags"},[R]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"flags"},[M]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[O]:{exposure:"hidden",storageGroup:"flags"},[D]:{exposure:"hidden"},[j]:{exposure:"hidden"},[L]:{exposure:"hidden"},[N]:{exposure:"hidden"},[z]:{exposure:"hidden",storageGroup:"surveys"},[U]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[q]:{exposure:"event"},[H]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{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"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[B]:{exposure:"event"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"hidden"},[et]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"event"},[k]:{exposure:"event"},[E]:{exposure:"event"},[ot]:{exposure:"event"},[at]:{exposure:"event"},[lt]:{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"}},An=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],On=t=>{var i=Mn[t];if(i)return i;for(var e of An){var r=e[1];if(0===t.indexOf(e[0]))return r}},Dn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return hi(t)}},jn=t=>{var i=null==kt?void 0:kt.createElement("a");return _i(i)?null:(i.href=t,i)},Ln=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(!ci(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Wr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Nn=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("=");ci(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},Bn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},zn=(t,i)=>t>=i&&Rt(),Un=(t,i,e,r)=>{if(0===t){if(Rt()){var s=i+1;return s===e&&r(),s}return i}return 0},qn="https?://(.*)",Hn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Vn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Hn],Wn="<masked>",Gn=["li_fat_id"];function Kn(t,i,e){if(!kt)return{};var r,s=i?[...Hn,...e||[]]:[],n=Jn(Nn(kt.URL,s,Wn),t),o=(r={},Jr(Gn,(function(t){var i=ns(t);r[t]=i||null})),r);return Yr(o,n)}function Jn(t,i){var e=Vn.concat(i||[]),r={};return Jr(e,(function(i){var e=Ln(t,i);r[i]=e||null})),r}function Yn(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(!bi(i)){r.$search_engine=i;var s=kt?Ln(kt.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function Qn(){return navigator.language||navigator.userLanguage}var Xn="$direct";function Zn(){return(null==kt?void 0:kt.referrer)||Xn}function to(t,i,e){void 0===e&&(e=!1);var r=t?[...Hn,...i||[]]:[],s=e?He(null==Et?void 0:Et.href):null==Et?void 0:Et.href,n=null==s?void 0:s.substring(0,1e3);return{r:Zn().substring(0,1e3),u:n?Nn(n,r,Wn):void 0}}function io(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==Xn?Xn: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=Jn(n);Yr(o,l)}if(r){var h=Yn(r);Yr(o,h)}return o}function eo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ro(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var so={flags:Y,surveys:U},no=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],oo=t=>t+"_cookie_identity_change_pending",ao="main",lo=(t,i)=>{Jr(t,((e,r)=>{var s=On(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class ho{constructor(t,i,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=t,this.As=r,this.props={},this.Fs=void 0,this.Ls=(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.ps=this.Os(t),this.Is=this.Ds(t),this.load(),t.debug&&Wr.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save(),wt){var s=()=>this.flush();rs(wt,"beforeunload",s,{capture:!1}),rs(wt,"pagehide",s,{capture:!1})}}$s(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return xi(i)&&i>0?i:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var i=Ss(t,this.qi.cookie_persisted_properties||[]),e=Es(i,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=ps.Pr(this.Ls)||void 0;s&&Ps(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=ps.Pr(this.Ls)||void 0;this.qs=n?Ps(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,i){if(void 0===i&&(i=!1),this.Hs&&!i||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=ps.Pr(this.Ls)||void 0}catch(t){}if(!e||e===this.js)return!1;var r,s=Ps(this.Ls,e);try{r=xs(JSON.parse(e))}catch(t){return!1}if((ps.Pr(this.Ls)||void 0)!==e)return!1;this.qs=s,this.js=e;var n=$s(this.Ls,e),a=[...ys,...n.properties],l={};if(Object.keys(r).forEach((t=>{var i=r[t];(_i(i)||bi(i)||""===i||t===Q&&i!==vt&&i!==ct)&&(l[t]=!0,delete r[t])})),gi(r))return!1;var u=o in r||r[Q]===vt||r[Q]===ct,d=this.props[o],v=this.props[Q],c=Yr({},this.props);[...ys,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==a.indexOf(t)&&!(t in r)&&!l[t]&&(u||t!==o&&t!==Q)){var i=c[t];!n.isValid&&-1!==ys.indexOf(t)&&(!1===i||0===i)||delete c[t]}})),this.props=Yr(c,r),!u||Q in r||Q in this.props||this.Us(Q,vt);var f=this.props[o],p=this.props[Q];return!u||f===d&&p===v||(this.Rs=!0,Rs.Dr(oo(this.Ls),!0),this.zs(L),this.zs(F),this.zs(C),this.zs(I),this.zs(M),this.zs(A),this.zs(Y),this.zs(J),this.zs(G),p===vt&&(v===ct||r[Q]===vt||!_i(d)&&f!==d)&&(lo(this.props,r),this.zs(N)),p===ct?this.props.$user_id=f:delete this.props.$user_id,this.zs(h)),!0}consumeCookieIdentityChange(){var t=oo(this.Ls),i=this.Rs||!!Rs.Pr(t);return this.Rs=!1,i&&Rs.qr(t),i}Ws(t){return void 0===t&&(t=!1),!(this.Ps||this.Hs&&!t||!this.qi.cookieWinsOnConflict||"localstorage+cookie"!==this.qi.persistence.toLowerCase()||(this.Ps=!0,0))}Vs(){this.Ps&&(_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[ao],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(t){-1===no.indexOf(t.persistence.toLowerCase())&&(Wr.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=[...ys,...t];return e({},_s,{Br(t){try{var e,s={};try{e=ps.Pr(t)||void 0,s=e?xs(JSON.parse(e)):{}}catch(t){}var n,a=JSON.parse(_s.Pr(t)||"{}");if(i){var l=$s(t,e),h=[...ys,...l.properties],u={};Object.keys(s).forEach((t=>{var i=s[t];bi(i)||""===i||t===Q&&i!==vt&&i!==ct||(u[t]=i)}));var d=o in u||u[Q]===vt||u[Q]===ct;if(Object.keys(u).length>0){var v,c=a[o],f=null!==(v=a[Q])&&void 0!==v?v:vt;r.forEach((t=>{if(-1!==h.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==Q)){var i=a[t];!l.isValid&&-1!==ys.indexOf(t)&&(!1===i||0===i)||delete a[t]}})),!d||Q in s||Q in a||(a[Q]=vt),!d||(o in u?u[o]:a[o])===c&&(Q in u?u[Q]:a[Q])===f||(ms.forEach((t=>delete a[t])),u[Q]===ct&&o in u?a.$user_id=u[o]:delete a.$user_id,u[Q]!==ct&&(delete a[B],delete a[N]),delete a.__alias)}n=Yr(a,u)}else n=Yr(s,a);return _s.Dr(t,n),n}catch(t){}return null},Dr(e,r,s,n,o,a){var l=_s.Dr(e,r,void 0,void 0,a);try{var h=Ss(r,t);if(Object.keys(h).length){if(i){var u=bs(e),d=Es(h,t);if(ps.Dr(u,d,s,n,o,a),ps.Pr(u)!==JSON.stringify(d)){ps.qr(u,n);var v=Ss(r);return ps.Dr(e,v,s,n,o,a),l}}ps.Dr(e,h,s,n,o,a)}}catch(t){_s.jr(t)}return l},qr(t,i){try{null==wt||wt.localStorage.removeItem(t),ps.qr(t,i),ps.qr(bs(t),i)}catch(t){_s.jr(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&_s.Nr()?(i=_s,s=!0):"localstorage+cookie"===n&&r.Nr()?(i=r,s=!0):"sessionstorage"===n&&Rs.Nr()?i=Rs:"memory"===n?i=Cs:"cookie"===n?i=ps:r.Nr()?(i=r,s=!0):i=ps,this.Es=s,i}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return Jr(this.props,((i,e)=>{var r=On(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.Hs||t){var i=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),e=i?_s.Br(this.Ls):null,r={};if(i)try{Jr(r=xs(ps.Br(this.Ls)),((t,i)=>{(_i(t)||bi(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=Yr({},s)),this.Is&&this.Ks(),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:vt,u=s[o],d=null!==(a=s[Q])&&void 0!==a?a:vt;if(u!==l||d!==h){this.Rs=!0,Rs.Dr(oo(this.Ls),!0);var v=Yr({},this.props);ms.forEach((t=>delete v[t])),d===vt&&(h===ct||r[Q]===vt||!_i(l)&&u!==l)&&(lo(v,r),delete v[N]),this.props=v;var c=new Set;ms.forEach((t=>{var i,e=null==(i=On(t))?void 0:i.storageGroup;e&&c.add(e)})),c.forEach((t=>{var i={};Jr(this.props,((e,r)=>{var s;(null==(s=On(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),gi(i)?(_s.qr(this.Js(t)),this.Ms[t]={}):_s.Dr(this.Js(t),i)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(i,t)})}))}}Rs.Pr(oo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of In){var i=_s.Br(this.Js(t));if(i&&!gi(i)){var e=this.Xs(t);e.persisted=!0,this.ta(t)||(e.fingerprint=this.Ys(i,t)),this.ea(t,i)||Yr(this.props,i)}}}ta(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=On(i))?void 0:e.storageGroup)===t}))}ea(t,i){var e=so[t];if(!e)return!1;var r=i[e],s=this.props[e];return xi(r)&&xi(s)&&s>r}refreshKey(t){var i;if(!this.Hs){var e=this.Is?null==(i=On(t))?void 0:i.storageGroup:void 0,r=e?_s.Br(this.Js(e)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(e){var s=this.ps.Br(this.Ls);if(s&&t in s)return void this.Us(t,s[t])}this.zs(t)}}}save(){if(!this.Hs){var t=this.$s();t>0?_i(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(t){void 0===t&&(t=!1),this.Hs||this.Ps&&!t||(t||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Ls,this.props,ao)&&this.Ns(this.props))}ia(){var t=this.na(),i=t.main,e=t.groups;for(var r of(this.ra(this.ps,this.Ls,i,ao)&&this.Ns(i),In)){var s,n=e[r];(!gi(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(_s,this.Js(r),n,r)}}na(){var t={},i={flags:{},surveys:{}};return Jr(this.props,((e,r)=>{var s,n=null==(s=On(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Ys(t,i){if(i===ao)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var e={};return Jr(t,((t,i)=>{var r;e[i]=null!=(r=On(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}ra(t,i,e,r){var s,n=this.Xs(r);if(r!==ao&&!n.dirty&&!_i(n.fingerprint))return!1;try{if((s=this.Ys(e,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(i,e,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==ao&&(n.persisted=!0),_i(s)||(n.fingerprint=s),!0):(this.qi.debug&&Wr.warn('failed to persist storage entry "'+i+'"; will retry on next save'),!1)}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(_i(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!e&&this.As)for(var r of In)_s.qr(this.Js(r));e?delete this.Ms[ao]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(pi(t)){this.syncCookieProperties(),_i(i)&&(i="None"),this.sa=_i(e)?this.la:e;var r=!1;if(Jr(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Us(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(pi(t)){this.syncCookieProperties(),this.sa=_i(i)?this.la:i;var e=!1;if(Jr(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||pi(i)||ci(i))&&(this.Us(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.zs(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==kt?void 0:kt.URL;if(t!==this.Fs){var i=Kn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);gi(ts(i))||this.register(i),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==kt?void 0:kt.referrer)?Yn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Zn(),$referring_domain:null!=kt&&kt.referrer&&(null==(t=jn(kt.referrer))?void 0:t.host)||Xn},void 0)}set_initial_person_info(){this.props[tt]||this.props[it]||this.register_once({[et]:to(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Jr([it,tt],(i=>{var e=this.props[i];e&&Jr(e,(function(i,e){t["$initial_"+li(e)]=i}))}));var i=this.props[et];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=io(t,i),r={};return Jr(e,(function(t,i){r["$initial_"+li(i)]=t})),r}(i,this.qi.disable_capture_url_hashes);Yr(t,e)}return t}safe_merge(t){return Jr(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.Hs&&!l;l||this.Bs(i,h),this.qi=t,!l&&(s||n||a)&&(this.qs=void 0,this.js=void 0,this.Bs(e({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Os(t):this.ps,d=this.Ds(t),v=o||d!==this.Is,c=!l&&(v||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(h);try{if(this.la=this.sa=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.ps=u,this.Is=d,this.props=f,this.save()}else a&&(this.ps=u,l||(delete this.Ms[ao],this.Zs()))}finally{c&&this.Qs()}}set_disabled(t){this.Hs=t,this.Hs?this.remove():this.save()}set_cross_subdomain(t){t!==this.aa&&(this.aa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[u]||{};e[t]=i,this.Us(u,e),this.save()}remove_event_timer(t){var i=this.props[u]||{},e=i[t];return _i(e)||(delete i[t],this.Us(u,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Us(t,i),this.save()}Us(t,i){var e;this.props[t]=i,null!=(e=On(t))&&e.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var i,e=null==(i=On(t))?void 0:i.storageGroup;e&&(this.Xs(e).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function uo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&fi(e.then)&&e.then(void 0,(()=>{}))}}}}var vo="gzip-js",co="base64",fo="events",po="cancelEvents",go="survey shown",_o="survey dismissed",mo="survey sent",yo="popover",bo=Gr("[RateLimiter]");class wo{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=>{bo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void bo.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(Z))&&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=(xi(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ha(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Z,a),{isRateLimited:l,remainingTokens:a.tokens}}da(t){var i=this.instance.config.property_denylist;return!ci(i)||!i.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=Et&&Et.pathname)return""+(null!==(t=Et.origin)&&void 0!==t?t:"")+Et.pathname}ha(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$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 xo=Gr("[RemoteConfig]");class So{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}ca(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()}fa(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 xo.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void xo.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return xo.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa((t=>{this.pa(t.json,t),this.ga()}));this.pa(t),this.ga()}))}catch(t){xo.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&kt&&"hidden"!==kt.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.ya=setInterval((()=>{this.refresh()}),i))}}pa(t,i){!t&&i&&(0===i.statusCode?i.error||xo.warn("Failed to fetch remote config from PostHog."):xo.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){xo.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){xo.error("Error loading feature flags",t)}}}var ko=Uint8Array,Eo=Uint16Array,$o=Uint32Array,Po=new ko([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]),To=new ko([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]),Co=new ko([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fo=function(t,i){for(var e=new Eo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new $o(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]},Ro=Fo(Po,2),Io=Ro[1];Ro[0][28]=258,Io[258]=28;for(var Mo=Fo(To,0)[1],Ao=new Eo(32768),Oo=0;32768>Oo;++Oo){var Do=(43690&Oo)>>>1|(21845&Oo)<<1;Ao[Oo]=((65280&(Do=(61680&(Do=(52428&Do)>>>2|(13107&Do)<<2))>>>4|(3855&Do)<<4))>>>8|(255&Do)<<8)>>>1}var jo=function(t,i,e){for(var r=t.length,s=0,n=new Eo(i);r>s;++s)++n[t[s]-1];var o,a=new Eo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Eo(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[Ao[d]>>>l]=h}else for(o=new Eo(r),s=0;r>s;++s)o[s]=Ao[a[t[s]-1]++]>>>15-t[s];return o},Lo=new ko(288);for(Oo=0;144>Oo;++Oo)Lo[Oo]=8;for(Oo=144;256>Oo;++Oo)Lo[Oo]=9;for(Oo=256;280>Oo;++Oo)Lo[Oo]=7;for(Oo=280;288>Oo;++Oo)Lo[Oo]=8;var No=new ko(32);for(Oo=0;32>Oo;++Oo)No[Oo]=5;var Bo=jo(Lo,9,0),zo=jo(No,5,0),Uo=function(t){return(t/8>>0)+(7&t&&1)},qo=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Eo?Eo:t instanceof $o?$o:ko)(e-i);return r.set(t.subarray(i,e)),r},Ho=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Vo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Wo=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 ko(0),0];if(1==s){var o=new ko(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 Eo(v+1),f=Go(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 ko(c),f]},Go=function(t,i,e){return-1==t.s?Math.max(Go(t.l,i,e+1),Go(t.r,i,e+1)):i[t.s]=e},Ko=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Eo(++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]},Jo=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},Yo=function(t,i,e){var r=e.length,s=Uo(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)},Qo=function(t,i,e,r,s,n,o,a,l,h,u){Ho(i,u++,e),++s[256];for(var d=Wo(s,15),v=d[0],c=d[1],f=Wo(n,15),p=f[0],g=f[1],_=Ko(v),m=_[0],y=_[1],b=Ko(p),w=b[0],x=b[1],S=new Eo(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=Wo(S,7),P=E[0],T=E[1],C=19;C>4&&!P[Co[C-1]];--C);var F,R,I,M,A=h+5<<3,O=Jo(s,Lo)+Jo(n,No)+o,D=Jo(s,v)+Jo(n,p)+o+14+3*C+Jo(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=A&&D>=A)return Yo(i,u,t.subarray(l,l+h));if(Ho(i,u,1+(O>D)),u+=2,O>D){F=jo(v,c,0),R=v,I=jo(p,g,0),M=p;var j=jo(P,T,0);for(Ho(i,u,y-257),Ho(i,u+5,x-1),Ho(i,u+10,C-4),u+=14,k=0;C>k;++k)Ho(i,u+3*k,P[Co[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)Ho(i,u,j[z=31&B[k]]),u+=P[z],z>15&&(Ho(i,u,B[k]>>>5&127),u+=B[k]>>>12)}}else F=Bo,R=Lo,I=zo,M=No;for(k=0;a>k;++k)if(r[k]>255){var z;Vo(i,u,F[257+(z=r[k]>>>18&31)]),u+=R[z+257],z>7&&(Ho(i,u,r[k]>>>23&31),u+=Po[z]);var U=31&r[k];Vo(i,u,I[U]),u+=M[U],U>3&&(Vo(i,u,r[k]>>>5&8191),u+=To[U])}else Vo(i,u,F[r[k]]),u+=R[r[k]];return Vo(i,u,F[256]),u+R[256]},Xo=new $o([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zo=function(){for(var t=new $o(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ta=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ia(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=Zo[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 ko(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=Yo(l,h,t.subarray(u,d)):(l[u]=!0,h=Yo(l,h,t.subarray(u,o)))}else{for(var v=Xo[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Eo(32768),_=new Eo(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 $o(25e3),x=new Eo(288),S=new Eo(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 M=o-u;if((k>7e3||P>24576)&&M>423){h=Qo(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 O=2,D=0,j=f,L=R-I&32767;if(M>2&&F==b(u-L))for(var N=Math.min(c,M)-1,B=Math.min(32767,u),z=Math.min(258,M);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 q=Math.min(L,U-2),H=0;for(A=0;q>A;++A){var V=u-L+A+32768&32767,W=V-g[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(R=I)-(I=g[R])+32768&32767}if(D){w[P++]=268435456|Io[O]<<18|Mo[D];var G=31&Io[O],K=31&Mo[D];E+=Po[G]+To[K],++x[257+G],++S[K],T=u+O,++k}else w[P++]=t[u],++x[t[u]]}}h=Qo(t,l,!0,w,x,S,E,P,C,u-C,h)}return qo(a,0,r+Uo(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&&ta(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),ta(h,u-8,e.d()),ta(h,u-4,r),h}var ea=!!Pt||!!$t,ra="text/plain",sa=!1,na=(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:"")},oa=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 Jr(t,(function(t,i){_i(t)||_i(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},aa=t=>{if(t.ba)return t.ba;var i=t.data,e=t.compression;if(i){if(e===vo){var r=ia(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new ko(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 ko(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 qo(r,0,s)}(Dn(i)),{mtime:0});return{contentType:ra,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===co){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(Dn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Dn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Dn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},la=t=>{var i,r,s=()=>"sendBeacon"===t.transport?{url:oa(t.url,{compression:co}),encodedBody:aa(e({},t,{compression:co,ba:void 0}))}:{url:na(t.url,"compression"),encodedBody:aa(e({},t,{compression:void 0,ba:void 0}))};try{i=aa(t)}catch(i){if(Vt(t.compression,Ln(t.url,"compression")))return Wr.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&Vt(t.compression,Ln(t.url,"compression"))&&!((r=i.body)instanceof ArrayBuffer?Ht(new Uint8Array(r)):ArrayBuffer.isView(r)&&Ht(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)))?(sa=!0,s()):{url:t.url,encodedBody:i}},ha=t=>{try{return la(t)}catch(i){return Wr.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},ua=function(){var t=i((function*(t){var i=Dn(t.data),r=yield function(t,i,e){return Jt.apply(this,arguments)}(i,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return e({},t,{ba:{contentType:ra,body:n,estimatedSize:n.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),da=/Failed to fetch|NetworkError|Load failed/i,va=t=>"TypeError"===(null==t?void 0:t.name)&&da.test((null==t?void 0:t.message)||""),ca=t=>{var i=ha(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;Jr(t.headers,(function(t,i){h.append(i,t)})),o&&h.append("Content-Type",o);var u=null,d=!1;if(Tt){var v=new Tt;u={signal:v.signal,timeout:setTimeout((()=>{var i,e;d=!0,v.abort((i=t.timeout,(e=new Error("PostHog request timed out"+(i?" after "+i+"ms":""))).name="AbortError",e))}),t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||va(i)?Wr.warn(i):Wr.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;$t(r,e({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t._a&&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){Wr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>u?clearTimeout(u.timeout):null))}catch(t){u&&clearTimeout(u.timeout),c(t)}}},fa=t=>{try{var i,r=la(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(St.sendBeacon(s,h))return;var u=ci(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(ci(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>ci(t.data)?i:e({},t.data,{batch:i});return fa(e({},t,{data:v(u.slice(0,d))})),void fa(e({},t,{data:v(u.slice(d))}))}Wr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ca(e({},t,{_a:!0}))}catch(t){Wr.warn("Beacon send failed",t)}},pa=(t,i,r,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return oa(r===vo?na(t,"compression"):t,e({},n?{[n]:Date.now().toString()}:{},r===vo?{}:{compression:r}))},ga=[];$t&&ga.push({transport:"fetch",method:ca}),Pt&&ga.push({transport:"XHR",method(t){var i=ha(t);if(i){var e=new Pt,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Jr(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!=St&&St.sendBeacon&&ga.push({transport:"sendBeacon",method:fa});var _a=3e3;class ma{constructor(t,i){this.wa=!0,this.ka=[],this.Sa=Di((null==i?void 0:i.flush_interval_ms)||_a,250,5e3,Wr.createLogger("flush interval"),_a),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(e({},t,{transport:"sendBeacon"}))}))}enable(){this.wa=!1,this.Ta()}Ta(){var t=this;this.wa||(this.Ca=setTimeout((()=>{if(this.Ma(),this.ka.length>0){var i=this.Ea(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&ci(e.data)&&Jr(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(e)};for(var r in i)e()}}),this.Sa))}Ia(t){try{this.xa(t)}catch(t){Wr.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return Jr(this.ka,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;_i(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.ka=[],t}}var ya=["retriesPerformedSoFar"];class ba{constructor(t){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=t,this.ka=[],this.Aa=!0,!_i(wt)&&"onLine"in wt.navigator&&(this.Aa=wt.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},rs(wt,"online",this.Fa),rs(wt,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var i=t.retriesPerformedSoFar,s=r(t,ya);Si(i)&&(s.url=oa(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.xn(e({retriesPerformedSoFar:i},s));0===t.statusCode&&Wr.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)}}))}xn(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.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Wr.warn(s),this.Ra||(this.Ra=!0,this.Da())}Da(){if(this.$a&&clearTimeout(this.$a),0===this.ka.length)return this.Ra=!1,void(this.$a=void 0);this.$a=setTimeout((()=>{this.Aa&&this.ka.length>0&&this.La(),this.Da()}),this.Pa)}La(){var t=Date.now(),i=[],e=this.ka.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.ka=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,_i(wt)||(this.Fa&&(wt.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(wt.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var i=t.requestOptions;try{this._instance._send_request(e({},i,{transport:"sendBeacon"}))}catch(t){Wr.error(t)}}this.ka=[]}}class wa{constructor(t){this.Na=()=>{var t,i,e,r;this.qa||(this.qa={});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.qa.lastScrollY=Math.ceil(n),this.qa.maxScrollY=Math.max(n,null!==(t=this.qa.maxScrollY)&&void 0!==t?t:0),this.qa.maxScrollHeight=Math.max(o,null!==(i=this.qa.maxScrollHeight)&&void 0!==i?i:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(e=this.qa.maxContentY)&&void 0!==e?e:0),this.qa.maxContentHeight=Math.max(l,null!==(r=this.qa.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var t=this.qa;return setTimeout(this.Na,0),t}startMeasuringScrollPosition(){rs(wt,"scroll",this.Na,{capture:!0}),rs(wt,"scrollend",this.Na,{capture:!0}),rs(wt,"resize",this.Na)}scrollElement(){if(!this.ja)return null==wt?void 0:wt.document.documentElement;var t=ci(this.ja)?this.ja:[this.ja];for(var i of t){var e=null==wt?void 0:wt.document.querySelector(i);if(e)return e}}Ba(t){var i="y"===t?"scrollTop":"scrollLeft";if(this.ja){var e=this.scrollElement();return e&&e[i]||0}return wt?"y"===t?wt.scrollY||wt.pageYOffset||wt.document.documentElement.scrollTop||0:wt.scrollX||wt.pageXOffset||wt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var xa=t=>to(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 Sa{constructor(t,i,e,r){this.ot=t=>{var i=this.Ha();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ua(this._instance)};this.za.register({[X]:e})}},this._instance=t,this.Wa=i,this.za=e,this.Ua=r||xa,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[X]}getSetOnceProps(){var t,i=null==(t=this.Ha())?void 0:t.props;return i?"r"in i?io(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 Jr(ts(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+li(e)]=i})),t}}class ka{on(t,i){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(i),()=>{this.Va[t]=this.Va[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Va[t]||[])e(i);for(var r of this.Va["*"]||[])r(t,i)}constructor(){this.Va={}}}var Ea=Gr("[SessionId]"),$a=864e5;class Pa{on(t,i){return this.Ga.on(t,i)}constructor(t,i,e){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new ka,this.Xa=(t,i)=>!(!Si(t)||!Si(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===dt)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=t.config,this.za=t.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=i||ds,this.ro=e||ds;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*Di(this.qi.session_idle_timeout_seconds||1800,60,36e3,Ea.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var n=Rs.Br(this.so),o=Rs.Br(this.ao);n&&!o?this.st=n:Rs.qr(this.so),Rs.Dr(this.ao,!0)}null!=(r=this.qi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return _i(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((i=>i!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&Rs.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Rs.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Rs.Br(this.so):null}do(t){var i=this.Za;return!bi(i)&&!bi(t)&&5e3>Math.abs(t-i)}vo(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this._e||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this._e=t,s&&!r||s&&this.do(i)||(this.Za=i,this.za.register({[P]:[i,t,e]}))}co(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return Si(i)&&i>0}fo(){this.co()?this.za.refreshKey(P):(this.za.flush(),this.za.load())}po(){var t;if(!bi(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var i=this.mo();i[1]===this._e&&i[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[P]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],i=Si(t)?t:0,e=Si(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[P];return ci(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(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 Ea.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ea.error("Invalid sessionID in bootstrap",t)}}(t);return!_i(e)&&(i?this.eo={sessionId:t,sessionStartTimestamp:e}:this.vo(t,(new Date).getTime(),e),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&wt&&(wt.removeEventListener(gt,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Rs.qr(this.ao)},rs(wt,gt,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.qi.cookieless_mode===dt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this._e;if(e)this.Qa=r;else if(bi(this.Qa)||this.Qa>r||r-this.Qa>=1e3){var n,o;null==(n=(o=this.za).syncCookieProperties)||n.call(o),this.Qa=r}var a=this.mo(),l=a[1],h=a[2],u=!_i(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>$a),p=c?f:Si(h)&&Math.abs(r-h)>$a,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||Ea.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.mo();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.io(),v=this.ro(),Ea.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.eo=void 0,g=!0}else v||(v=this.ro(),g=!0),(_=_||l!==y)&&(Ea.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=Si(d)&&t&&!p?d:r,k=Si(h)?h:(new Date).getTime();this.uo(v),this.vo(l,S,k),t||this.no();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.Ja.forEach((t=>t(l,v,E))),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout((()=>{if(!this.Ya)if(this.bo((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:t})}else this.no()}),1.1*this.sessionTimeoutMs))}}var Ta=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&ni(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>ni(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function Ca(){return(Ca=i((function*(){var t=null==St?void 0:St.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return mi(e)&&e.length>0?e:void 0}catch(t){return void Wr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Fa(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Ra=(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}},Ia=t=>t.toLowerCase(),Ma={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=>Ra(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Ra(i,t))))),icontains:(t,i)=>i.map(Ia).some((i=>t.map(Ia).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Ia).every((i=>t.map(Ia).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 Aa(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=Ma[e.operator];return!!s&&s(e.values,[String(r)])}))}function Oa(t,i,e){return Dn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Da="custom",ja="i.posthog.com",La=/^\/static\//,Na=["/s/","/e/","/i/"];class Ba{constructor(t){this.wo={},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("."+ja,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.wo[this.apiHost]||(this.wo[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":Da),this.wo[this.apiHost]}ko(t){if(La.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}So(t){var i=jn(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}xo(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&&Na.some((t=>0===i.indexOf(t)))){var a=this.So(r);if(a){var l,h=this.apiHost,u=this.Co;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Co=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Co,e=this.So(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.xo(t,i,this.uiHost+i);if("flags"===t)return this.xo(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.ko(i);if(e)return this.xo(t,i,""+e+i)}if(this.region===Da)return this.xo(t,i,this.apiHost+i);var r=ja+i;switch(t){case"assets":return this.xo(t,i,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,i,"https://"+this.region+"."+r)}}}var za=Gr("[Surveys]"),Ua="seenSurvey_",qa=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))(Ua,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){za.error("Failed to persist survey seen state",t)}},Ha=["popover","widget","api"],Va={ignoreConditions:!1,ignoreDelay:!1,displayType:yo},Wa=Gr("[PostHog ExternalIntegrations]"),Ga={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ka{constructor(t){this._instance=t}_s(t,i){var e;null==(e=Mt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Wa.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._s(Ga[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 Ja{constructor(t,i){this.I=t,this.ns=i,this.To=new Map,this.Xn=!1}add(t){var e=this;return i((function*(){if(e.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.To.set(t.name,t);try{var i=t.setup(e.ns);i&&(yield i)}catch(i){var r=e.To.get(t.name)===t;r&&e.To.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var i of(this.To.clear(),t))this.Mo(i)}}Mo(t){try{var i=null==t.dispose?void 0:t.dispose();i&&fi(i.then)&&i.then(void 0,(i=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class Ya{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);_i(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 Qa="extensionsRemoteConfig";class Xa{constructor(t){this.Xn=!1,this.instance=t,this.I=Wr,this.Eo=t.Io,this.kv=new Ya(t),this.onEvent=t=>uo(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return uo((()=>{}));var i=i=>{try{t(i)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},e=this.instance.Ro.on(Qa,i);return this.Eo&&i(this.Eo),uo(e)},this.Po=new Ja(Wr.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}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 projectToken(){return this.instance.config.token}add(t){return this.Po.add(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 uo(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(Qa,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?oa(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,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.Xn||(this.Xn=!0,this.Po.dispose())}}var Za={},tl=0,il=()=>{},el='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',rl="Surveys module not available",sl="sanitize_properties is deprecated. Use before_send instead",nl="Invalid value for property_denylist config: ",ol=["token","distinct_id",nt],al="posthog",ll=!ea&&-1===(null==Ft?void 0:Ft.indexOf("MSIE"))&&-1===(null==Ft?void 0:Ft.indexOf("Mozilla")),hl=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:es(null==kt?void 0:kt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:il,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:Et&&mi(null==Et?void 0:Et.search)&&-1!==Et.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==wt||null==(i=wt.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){Wr.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:ft,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:_a},error_tracking:{},_onCapture:il},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:en,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},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))},ul=[["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"]],dl=t=>{var i={};for(var e of ul){var r=e[0],s=e[1];_i(t[r])||(i[s]=t[r])}var n=Yr({},i,t),o=t.__preview_external_dependency_versioned_paths;return _i(o)||(_i(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),mi(o)&&_i(t.asset_host)&&(n.asset_host=o)),ci(t.property_blacklist)&&(_i(t.property_denylist)?n.property_denylist=t.property_blacklist:ci(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Wr.error(nl+t.property_denylist)),n};class vl{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){Wr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class cl{Lo(t,i){if(t){var e=this.To.indexOf(t);-1!==e&&this.To.splice(e,1)}return this.To.push(i),null==i.initialize||i.initialize(),i}Oo(){return this.config.cookieless_mode===dt||this.config.cookieless_mode===ut&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===st){var t=this.persistence;if(t){this.$o()||t.load(!0);var i=this.get_distinct_id();if(!i||i===st){var e=this.config.get_device_id(ds());this.register({distinct_id:e,$device_id:e}),t.set_property(Q,vt)}this.No()}}}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 vl,this.qo=!1,this.version=s.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new ka,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=hl(),this.SentryIntegration=Fn,this.sentryIntegration=t=>function(t,i){var e=Cn(t,i);return{name:Tn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new wa(this),this.pageViewManager=new Rn(this),this.rateLimiter=new wo(this),this.requestRouter=new Ba(this),this.consent=new Is(this),this.externalIntegrations=new Ka(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=mi(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=mi(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Wr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==al){var r,s=null!==(r=Za[e])&&void 0!==r?r:new cl;return s._init(t,i,e),Za[e]=s,Za[al][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var n,o;void 0===i&&(i={});var a,h=mi(t)?t.trim():"";if(!h)return Wr.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 h!==(null==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=hl(i.defaults),i.debug=this.Go(i.debug),this.Zo=i,this.Qo=[],i.person_profiles?this.Wo=i.person_profiles:i.process_person&&(this.Wo=i.process_person);var u=hl(i.defaults),d=dl(i),v=Yr({},u,d,{name:r,token:h});pi(u.rageclick)&&pi(d.rageclick)&&(v.rageclick=Yr({},u.rageclick,d.rageclick)),pi(u.session_recording)&&pi(d.session_recording)&&(v.session_recording=Yr({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Wr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:vo;var c=this.$o();if(this.persistence=new ho(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ho(e({},this.config,{persistence:"sessionStorage"}),c,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Rs.Nr()){var f=Rs.Br(this.Bo);ci(f)&&f.forEach((t=>{mi(t)&&this.jo.add(t)}))}else Rs.qr(this.Bo);var p=e({},this.persistence.props),g=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new ma((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new ba(this),this.__request_queue=[];var _=this.Oo();if(_||(this.sessionManager=new Pa(this),this.sessionPropsManager=new Sa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(Wr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(_)}),0)):(Wr.info("Initializing extensions synchronously"),this.el(_)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Wr.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:p,s:g}),!this.config.identity_distinct_id||null!=(n=i.bootstrap)&&n.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var m=i.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Q);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===vt)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===ct)Wr.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var w=this.config.get_device_id(ds()),x=i.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Q,i.bootstrap.isIdentifiedID?ct:vt),this.register({distinct_id:m,$device_id:x})}}if(_)this.register_once({distinct_id:st,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(ds());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(Q,vt)}return rs(wt,"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()||ds();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Q,ct)),i()},s=e.user();"then"in s&&fi(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||Pn.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()||(Pn.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Pn.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,_t),identify:t=>i(t,yt),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.il())):this.il(),fi(this.config._onCapture)&&this.config._onCapture!==il&&(Wr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Wr.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 Ca.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(il),this}rl(t){var i=t;return mi(i.name)&&fi(i.setup)}nl(t,i){this.rl(t)?i.push((()=>{this.sl().add(t).catch(il)})):this.To.push(t)}tl(){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.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),fi(this.featureFlags.onReloading)&&fi(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading((()=>{this.Ro.emit("featureFlagsReloading",!0)})),this.sl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}el(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},cl.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.exceptions&&this.To.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.To.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.To.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.To.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.To.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.nl(this.autocapture=new u.autocapture(this),d),u.surveys&&this.nl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this),d),u.logs&&this.To.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.metrics&&this.To.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new u.metrics(this)),u.conversations&&this.To.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.To.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.To.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.To.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,En)),u.toolbar&&this.To.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.To.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.To.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.ol){var t=this.ol;this.ol=void 0,this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.ll(d,h)}ll(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Wr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[ot]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[at]:r}),this.config.__preview_deferred_init_extensions&&Wr.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var i;if(!kt||!kt.body)return Wr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ol=t),this.Io=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=oi(r.supportedCompression,vo)?vo:oi(r.supportedCompression,co)?co:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:ft}),null==(i=this.ul)||i.handleRemoteConfig(t),this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}il(){try{this.config.loaded(this)}catch(t){Wr.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=Et&&Et.hostname){var t=Et.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.Oo())&&this.dl()}),1),this.vl=new So(this),this.vl.load()}hl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Jo)||t.enable())}_dom_loaded(){this.is_capturing()&&Kr(this.__request_queue,(t=>this.Ko(t))),this.__request_queue=[],this.hl()}_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.cl()&&this.capture(mt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(mt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?ll?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?this.compression:t.compression,(_i(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&&_i(n.compression)&&n.data&&(n.compression=co),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(ci(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()),ci(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=ga.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){va(t)?Wr.warn(t):Wr.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===vo&&Ct&&"undefined"!=typeof Promise&&!sa?ua(n).then((t=>{f(t)})).catch((i=>{if(Wt(i))return sa=!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 Wt(t)||i===qt})(i)&&(sa=!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}))}Ko(t){this.Yo?this.Yo.retriableRequest(t):this._send_request(t)}_execute_array(t){tl++;try{var i,e=[],r=[],s=[];Kr(t,(t=>{if(t)if(ci(i=t[0]))s.push(t);else if(fi(t))try{t.call(this)}catch(i){Wr.error("Error executing queued PostHog call",t,i)}else ci(t)&&"alias"===i?e.push(t):ci(t)&&-1!==i.indexOf("capture")&&fi(this[i])?s.push(t):r.push(t)}));var n=function(t,i){Kr(t,(function(t){try{if(ci(t[0])){var e=i;Jr(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){Wr.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{tl--}}push(t){if(tl>0&&ci(t)&&mi(t[0])){var i=cl.prototype[t[0]];fi(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.Jo){if(this.is_capturing())if(!_i(t)&&mi(t)){this.Do();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&&!mi(null==i?void 0:i.$current_url)&&(Wr.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.fl||Wr.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=qe(null==r?void 0:r.uuid,ds),f={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},v,c)};t===_t&&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(O);(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.pl(null==r?void 0:r.$set_once,t!==bt,t===yt);if(b&&(f.$set_once=b),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>mi(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),ci(i))r=[],Kr(i,(i=>{r.push(t(i))}));else{var s={};Jr(i,((i,e)=>{l.has(i)||(s[e]=t(i,e))})),r=s}return r}}(o)),f.timestamp=v,_i(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,ol)),t===_o||t===mo){var w=null==i?void 0:i.$survey_id,x=null==i?void 0:i.$survey_iteration;qa({id:w,current_iteration:x}),f.$set=e({},f.$set,{[(_={id:w,current_iteration:x},m=t===mo?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else t===go&&(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(gi(k)||this.setPersonPropertiesForFlags(k),!wi(this.config.before_send)){var E=this.kn(f);if(!E)return;(f=E).uuid=qe(f.uuid,ds)}this.Ro.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.Ko(T):this.Jo.enqueue(T),f}Wr.critical("This capture call is ignored due to client rate limiting.")}}else Wr.error("No event name provided to posthog.capture")}else Wr.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new Xa(this)}Ao(t){this.Ho.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Ho.indexOf(t);-1!==e&&this.Ho.splice(e,1)}}}gl(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Q)===vt&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),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.gl();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.Oo()&&(l[nt]=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!mi(l.distinct_id)&&!xi(l.distinct_id)||yi(l.distinct_id))&&Wr.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),!Ft)return{};var h,u=t?[...Hn,...i||[]]:[],d=function(t){for(var i=0;Be.length>i;i++){var e=Be[i],r=e[1],s=e[0].exec(t),n=s&&(fi(r)?r(s,t):r);if(n)return n}return["",""]}(Ft),v=d[0],c=d[1],f=null!=(h="undefined"!=typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},p={};_i(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==wt||null==(a=wt.screen)?void 0:a.width,b=null==wt||null==(l=wt.screen)?void 0:l.height,w=null==wt?void 0:wt.devicePixelRatio;_i(_)||(g.userAgentDataPlatform=_),_i(m)||(g.maxTouchPoints=m),_i(y)||(g.screenWidth=y),_i(b)||(g.screenHeight=b),_i(w)||(g.devicePixelRatio=w);var x,S,k,E,P,T,C,F,R=Yr(ts({$os:v,$os_version:c,$browser:je(Ft,navigator.vendor,f,p),$device:ze(Ft),$device_type:(S=Ft,k=g,F=ze(S),F===qi||F===Ui||"Kobo"===F||"Kindle Fire"===F||F===ye?zi:F===le||F===ue||F===he||F===ge?"Console":F===Vi?"Wearable":F?Li:"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)?Li:zi:"Desktop"),$timezone:eo(),$timezone_offset:ro()}),{$current_url:Nn(r?He(null==Et?void 0:Et.href):null==Et?void 0:Et.href,u,Wn),$host:null==Et?void 0:Et.host,$pathname:null==Et?void 0:Et.pathname,$raw_user_agent:Ft.length>1e3?Ft.substring(0,997)+"...":Ft,$browser_version:Ne(Ft,navigator.vendor,f,p),$browser_language:Qn(),$browser_language_prefix:(x=Qn(),"string"==typeof x?x.split("-")[0]:void 0),$screen_height:null==wt?void 0:wt.screen.height,$screen_width:null==wt?void 0:wt.screen.width,$viewport_height:null==wt?void 0:wt.innerHeight,$viewport_width:null==wt?void 0:wt.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&&Yr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Yr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Yo)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Da&&(l.$lib_custom_api_host=this.config.api_host),u=t!==_t||o?t!==mt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Yr(l,u),t===_t&&kt&&(l.title=kt.title),!_i(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ft&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties();Jr(["$referrer","$referring_domain"],(t=>{t in g&&delete _[t]}));var m={};if(this.Ho.length>0)for(var y of this.Ho.slice())try{Yr(m,y())}catch(t){Wr.error("Failed to produce browser extension event properties",t)}(l=Yr({},d,g,_,e({},m,l))).$is_identified=this._isIdentified(),ci(this.config.property_denylist)?Jr(this.config.property_denylist,(function(t){delete l[t]})):Wr.error(nl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Wr.error(sl),l=b(l,t));var w=this.yl();return l.$process_person_profile=w,w&&!o&&this.bl("_calculate_event_properties"),l}pl(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.yl())return t;if(this.qo&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Yr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Wr.error(sl),o=a(o,"$set_once")),i&&(this.qo=!0),gi(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.gl(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}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.jo.delete(t),this.ml()}_l(t,i){this.register({[t]:i})}Xo(){this.jo.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!Rs.Nr())Rs.qr(this.Bo);else{var i=[];this.jo.forEach((t=>i.push(t))),i.length>0?Rs.Dr(this.Bo,i):Rs.qr(this.Bo)}}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.Ro.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:rl}),()=>{})}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:rl})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:rl})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Va),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:rl}}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:rl})}wl(t){return!t||yi(t)?(Wr.critical("Unique user id has not been set in posthog.identify"),!1):t===st?(Wr.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())||(Wr.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 Wr.uninitializedWarning("posthog.identify");if(xi(t)&&(t=t.toString(),Wr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(t)&&this.bl("posthog.identify")){this.Do();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.gl(!1),o=this.persistence.Ws(),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)||vt)===vt,c=t!==u,f=!c&&v;if(c&&v)this.persistence.set_property(Q,ct),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(yt,{distinct_id:t,$anon_distinct_id:u},{$set:i||{},$set_once:e||{}}),this.Vo=Oa(t,i,e),null==(d=this.featureFlags)||d.setAnonymousDistinctId(u);else if(f){this.persistence.set_property(Q,ct);var p=i||{},g=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:p,$set_once:g}),this.Vo=Oa(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(G)):f&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Qs(l)}}}setPersonProperties(t,i){if((t||i)&&this.bl("posthog.setPersonProperties")){var e=Oa(this.get_distinct_id(),t,i);this.Vo!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Vo=e):Wr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(ci(t)?t:[t]).filter((t=>mi(t)&&t.length>0));0!==e.length&&this.bl("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Vo=null)}group(t,i,r){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.gl();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(bt,a)}r&&this.setGroupPropertiesForFlags({[t]:r}),o&&!r&&this.reloadFeatureFlags()}else Wr.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.bl("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=ki(t)?t:null==t?void 0:t.resetDeviceID,e=ki(t)||null==t?void 0:t.bootstrap;this.kl(i,!1,e)}kl(t,i,r){var s,n,o;if(void 0===i&&(i=!1),Wr.info("reset"),!this.__loaded)return Wr.uninitializedWarning("posthog.reset");var h=null==r?void 0:r.sessionID;this.config.bootstrap=r||(null==(s=this.Zo)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ma());var u=this.get_property(a),d=this.get_property(l),v=this.get_property(b),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.Ws?void 0:o.Ws(),p=!1;try{var g,_,m,y,w,x,S,k,E,P,T,C,F,R;if(null==(g=this.persistence)||g.clear(),null==(_=this.sessionPersistence)||_.clear(),this.jo.clear(),this.ml(),_i(v)||null==(T=this.persistence)||T.register({[b]:v}),null==(m=this.surveys)||m.reset(),null==(y=this.vl)||y.stop(),null==(w=this.featureFlags)||w.reset(),null==(x=this.conversations)||x.reset(),null==(S=this.logs)||S.reset(),null==(k=this.metrics)||k.reset(),null==(E=this.persistence)||E.set_property(Q,vt),null==(P=this.sessionManager)||P.resetSessionId(),this.Vo=null,this.config.cookieless_mode===dt)this.register_once({distinct_id:st,$device_id:null},"");else{var I=this.config.get_device_id(ds());this.register_once({distinct_id:I,$device_id:t?I:u},""),t||_i(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Oo()||(null==(R=this.persistence)||R.set_property(Q,r.isIdentifiedID?ct:vt),this.register({distinct_id:r.distinctID})),null==(C=this.featureFlags)||C.initialize(),!(_i(h)||null!=(F=this.sessionManager)&&F.setBootstrapSessionId(h,!0))){var M=e({},r);delete M.sessionID,this.config.bootstrap=M}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var A;f&&(null==(A=this.persistence)||null==A.Qs||A.Qs(p))}this.reloadFeatureFlags()}shutdown(t){var e=this;return i((function*(){var t,i,r,s,n,o;if(e.__loaded){null==(t=e.vl)||t.stop(),e.sl().dispose(),null==(i=e.sessionRecording)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.Jo)||n.unload(),null==(o=e.Yo)||o.unload();try{var a;null==(a=e.featureFlags)||a.destroy()}catch(t){Wr.error("Error while destroying feature flags",t)}}else Wr.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.Sl()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.xl()}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)?(Wr.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(_i(i)&&(i=this.get_distinct_id()),t!==i?(this._l(h,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Wr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(pi(t)){var r,n,o,a,l,h,u,d,v,c,f,p;Yr(this.config,dl(t));var g=this.$o();null==(r=this.persistence)||r.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ho(e({},this.config,{persistence:"sessionStorage"}),g,!1);var _,m=this.Go(this.config.debug);ki(m)&&(this.config.debug=m),ki(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,_s.Nr()&&_s.Dr("ph_debug",!0),Wr.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(s.DEBUG=!1,_s.Nr()&&_s.qr("ph_debug"))),null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.ma()),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.No(),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.Cl}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:al;return i!==al&&(i=al+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Q))===ct||(null==(i=this.sessionPersistence)?void 0:i.get_property(Q))===ct}yl(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===ft&&!this._isIdentified()&&gi(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[h])&&(null==(i=this.persistence)||null==(i=i.props)||!i[rt]))}cl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(t){return"never"===this.config.person_profiles?(Wr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(rt,!0),!0)}$o(){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!==ut)}No(){var t,i,e,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==dt){if(this.Oo()){var e,r,s,n,o;this.kl(!0,!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Pa(this),this.pageViewManager=new Rn(this),this.persistence&&(this.sessionPropsManager=new Sa(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=cl.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Lo(this.sessionRecording,new l(this)),this.Io&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Io)))}var h,u;this.consent.optInOut(!0),this.No(),this.hl(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==ut&&(null==(h=this.surveys)||h.loadIfEnabled()),(_i(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else Wr.warn(el)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==dt?(this.config.cookieless_mode===ut&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===ut&&(this.register({distinct_id:st,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(i=this.sessionManager)||i.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):Wr.warn(el)}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===dt||(this.config.cookieless_mode===ut?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return St?Ta(St,this.config.custom_blocked_useragents):void 0}dl(){kt&&("visible"===kt.visibilityState?this.Uo||(this.Uo=!0,this.capture(_t,{title:kt.title},{send_instantly:!0}),this.zo&&(kt.removeEventListener(pt,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),rs(kt,pt,this.zo)))}debug(t){!1===t?(null==wt||wt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==wt||wt.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}))}ma(){var t=this.Zo||{};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?(Wr.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&&!wi(t[i]),o=e in t&&!wi(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,Wr)}kn(t){var i;if(wi(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(Pi),r=ci(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),wi(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return $i(t.event)?Wr.warn(o+". This can cause unexpected behavior."):Wr.info(o),null}s.properties&&!gi(s.properties)||Wr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Wr.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&wi(s.properties[a]))return Wr.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.Ss)?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)})}Go(t){var i=ki(t)&&!t,e=_s.Nr()&&"true"===_s.Pr("ph_debug");return!i&&(!!e||t)}}cl.__defaultExtensionClasses={},cl.Cl=(()=>{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]]=Zr(t.prototype[i[e]])}(cl,["identify"]);class fl{constructor(t){this.disabled=!1===t;var i=pi(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 pl="$copy_autocapture",gl=Gr("[AutoCapture]");function _l(t,i){return i.length>t?i.slice(0,t)+"...":i}function ml(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Ns(i));return i}function yl(t,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!Ns(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!Bs(c,"body")&&qs>d.length;)if(Us(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Ns(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(Jr(d,(t=>{var i=hn(t);if(Bs(t,"a")){var e=t.getAttribute("href");y=!!(i&&e&&mn(e))&&(u?He(e):e)}oi(Ws(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};Ys.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?_l(1024,yn(t)):_l(1024,Ks(t)));var a=Ws(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Jr(t.attributes,(function(e){var n;if((!un(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&mn(e.value)&&(!mi(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=Hs(a).join(" ")),o["attr__"+e.name]=_l(1024,"href"===e.name&&s?He(a):a)}}));for(var l=1,h=1,u=t;u=ml(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(!hn(t))return{};var i={};return Jr(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&&mn(r)&&(i[e]=r)}})),i}(t);Yr(m,r)})),b)return{props:{},explicitNoCapture:b};if(a||(_[0].$el_text=Bs(t,"a")||Bs(t,"button")?yn(t):Ks(t)),y){var w,x;_[0].attr__href=y;var S=null==(w=jn(y))?void 0:w.host,k=null==wt||null==(x=wt.location)?void 0:x.host;S&&k&&S!==k&&(p=y)}return{props:Yr({$event_type:n.type,$ce_version:1},h?{}:{$elements:_},{$elements_chain:(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 Qr(o).sort(((t,i)=>t[0].localeCompare(i[0]))).forEach((t=>{var i=t[1];return a[wn(t[0].toString())]=wn(i.toString())})),(s+=":")+Qr(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:xn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Qr(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 bl{constructor(t){this.name="autocapture",this.Qn=!1,this.Jn=null,this.Kn=!1,this.Yn=!1,this.qi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Xn=!1,this.ts=t,this.ts.refresh(this.qi),this.rageclicks=new fl(this.qi.rageclick),this.es=null}setup(t){this.rs(),this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?i.dispose():(this.ss=i,this.startIfEnabled())}dispose(){var t;this.Xn||(this.Xn=!0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,this.os())}ls(){return this.ts.refresh(this.qi),this.qi}rs(){var t,i;return this.ls(),this.qi.url_allowlist=null==(t=this.qi.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.qi.url_ignorelist=null==(i=this.qi.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.qi}us(){if(this.isBrowserSupported()){if(wt&&kt){var t=this.hs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t)}catch(t){gl.error("Failed to capture event",t)}};if(rs(kt,"submit",t,{capture:!0}),rs(kt,"change",t,{capture:!0}),rs(kt,"click",t,{capture:!0}),this.ls().capture_copied_text){var i=this.vs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t,pl)}catch(t){gl.error("Failed to capture copy/cut event",t)}};rs(kt,"copy",i,{capture:!0}),rs(kt,"cut",i,{capture:!0})}}}else gl.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==kt||kt.removeEventListener("submit",this.hs,!0),null==kt||kt.removeEventListener("change",this.hs,!0),null==kt||kt.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==kt||kt.removeEventListener("copy",this.vs,!0),null==kt||kt.removeEventListener("cut",this.vs,!0),this.vs=void 0),this.Qn=!1}startIfEnabled(){!this.Xn&&this.ns&&this.isEnabled&&!this.Qn&&(this.us(),this.Qn=!0)}onRemoteConfig(t){if(!this.Xn)if(this.Kn=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Yn=i.elementsChainAsString);var e,r=i.autocapture_opt_out;ki(r)&&(null==(e=this.ns)||e.kv.set(d,r),this.Jn=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.es=t}getElementSelectors(t){var i,e=[];return null==(i=this.es)||i.forEach((i=>{var r=null==kt?void 0:kt.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Xn)return!1;var e=null==(t=this.ns)?void 0:t.kv.get(d),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(bi(r)&&!ki(e)&&!n)return!1;var o=null!==(i=this.Jn)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ds(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var e=Js(t);zs(e)&&(e=e.parentNode||null);var r,s=this.rs();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&on(e,s.rageclick)&&this.ds(t,"$rageclick");var n=i===pl;if(e&&function(t,i,e,r,s,n){var o;if(!wt||an(t))return!1;if(null!=e&&e.url_allowlist&&!Vs(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&Vs(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=ln(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(_i(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(!Qs(u,null==e?void 0:e.css_selector_allowlist))return!1;if(Qs(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Zs))return!1;try{var d=wt.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&&(Ys.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(e,t,s,n,n?["copy","cut"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var o,a=yl(e,{e:t,maskAllElementAttributes:s.maskAllElementAttributes,maskAllText:s.maskAllText,elementAttributeIgnoreList:s.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:s.disableCaptureUrlHashes}),l=a.props;if(a.explicitNoCapture)return!1;var h=this.getElementSelectors(e);if(h&&h.length>0&&(l.$element_selectors=h),i===pl){var u,d=Gs(null==wt||null==(u=wt.getSelection())?void 0:u.toString()),v=t.type||"clipboard";if(!d)return!1;l.$selected_content=d,l.$copy_type=v}return null==(o=this.ns)||o.capture(i,l).catch((t=>gl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return fi(null==kt?void 0:kt.querySelectorAll)}}class wl{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=pi(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.ma(),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 xl=Gr("[ExceptionAutocapture]"),Sl=()=>{},kl=Gr("[TracingHeaders]"),El=Gr("[Web Vitals]"),$l=9e5,Pl=["CLS","FCP","INP","LCP"],Tl=["INP","LCP"],Cl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Fl="disabled",Rl="lazy_loading",Il="awaiting_config",Ml="missing_config";Gr("[SessionRecording]"),Gr("[SessionRecording]");var Al="[SessionRecording]",Ol=Gr(Al),Dl=Gr("[Heatmaps]");function jl(t){return pi(t)&&"clientX"in t&&"clientY"in t&&xi(t.clientX)&&xi(t.clientY)}var Ll=Gr("[Product Tours]"),Nl=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(m))},Bl=["$set_once","$set"],zl=Gr("[SiteApps]"),Ul="Error while initializing PostHog app with config id ",ql=(t,i)=>null!=t&&t.then?t.then(i):i(t),Hl="SDK is not enabled or survey functionality is not yet loaded",Vl="Disabled. Not loading surveys.";class Wl{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Tl=!1,this.Ml=[],this.El=null,this.Il=null,this.Xn=!1,this.Rl=new Set,this.onRemoteConfig=t=>{if(!this.Xn&&!this.qi.disableSurveys){if(!t.ok)return za.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(wi(i))return za.warn("Flags not loaded yet. Not loading surveys.");this.Pl=ki(i)?i:i.length>0,za.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=i}setup(t){if(!this.Xn)return this.Fl=t,ql(t.kv.initialize(),(()=>{if(this.Fl===t&&!this.Xn){this.Fl=void 0,this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Xn?i.dispose():(this.ss=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ml=[],this.El=null,this.Rl.forEach((t=>clearTimeout(t))),this.Rl.clear())}get qi(){return this.ts.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(Ua)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Xn&&this.ns){var t=this.qi;if(!this._surveyManager)if(this.Tl)za.info("Already initializing surveys, skipping...");else if(t.disableSurveys)za.info(Vl);else if(t.cookielessMode&&this.ts.isOptedOut())za.info("Not loading surveys in cookieless mode without consent.");else{var i=this.ts.getExtensions();if(i){if(!_i(this.Pl)||t.advancedEnableSurveys){var e=this.Pl||t.advancedEnableSurveys;this.Tl=!0;try{var r=i.generateSurveys;if(r)return this.Ll(r,e),void(this.Tl=!1);var s=i.loadExternalDependency;if(!s)return this.Ol(ht),void(this.Tl=!1);s((t=>{try{if(this.Xn)return;var i=this.ts.getExtensions();t||null==i||!i.generateSurveys?this.Ol("Could not load surveys script",t):this.Ll(i.generateSurveys,e)}finally{this.Tl=!1}}))}catch(t){throw this.Tl=!1,this.Ol("Error initializing surveys",t),t}}}else za.error("PostHog Extensions not found.")}}}Ll(t,i){this.Xn||(this._surveyManager=t(i),this._surveyEventReceiver=this.ts.createEventReceiver(),za.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,i){za.error(t,i),this.Dl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ml.push(t),this._surveyManager&&this.Dl({isLoaded:!0}),()=>{this.Ml=this.Ml.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.ns)&&void 0!==e?e:this.Al;if(r&&!this.Xn){if(this.qi.disableSurveys)return za.info(Vl),t([]);var s=r.kv.get(z);if(s&&!i)return t(s,{isLoaded:!0}),void(this.$l()&&this.getSurveys((()=>{}),!0));if(this.El)this.El.then((i=>{this.Xn||t(i.surveys,i.context)})).catch((t=>za.error("Error in survey callback",t)));else{var n=this.Nl("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{try{return this.ql(r,t)}catch(t){return za.error("Error processing surveys response",t),this.ql(r,{statusCode:0,error:t})}}),(t=>this.ql(r,{statusCode:0,error:t})));this.El=n;var o=()=>{this.El===n&&(this.El=null)};n.then((i=>{o(),this.Xn||t(i.surveys,i.context)}),o).catch((t=>za.error("Error in survey callback",t)))}}}Nl(t,i){var e=this.ns;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(Hl)})))}ql(t,i){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:Hl}};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.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Il=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Fa(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({[z]:n,[U]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}$l(){return this.jl()&&!this.El&&!this.Bl()}jl(){var t,i,e=null==(t=null!==(i=this.ns)&&void 0!==i?i:this.Al)?void 0:t.kv.get(U);return xi(e)&&Date.now()-e>3e5}Bl(){return xi(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};qa(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Dl(t){for(var i of this.Ml)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),!wi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);za.warn("init was not called")}Hl(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}Ul(t){if(wi(this._surveyManager))return{eligible:!1,reason:Hl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}zl(t){if(wi(this._surveyManager))return{eligible:!1,reason:Hl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(wi(this._surveyManager))return za.warn("init was not called"),{visible:!1,disabledReason:Hl};var i=this.zl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return wi(this._surveyManager)?(za.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Hl})):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.zl(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(wi(this._surveyManager))za.warn("init was not called");else{var s="string"==typeof t?this.Hl(t):t;if(null!=s&&s.id)if(Ha.includes(s.type)){var n=null==kt?void 0:kt.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.Rl.delete(o),this.Xn||(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.Rl.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(wi(this._surveyManager))za.warn("init was not called");else{var s=this.Hl(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!==yo&&i.initialResponses&&za.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.Ul(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){wi(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 Gl(t,i,e){if(wi(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 Kl{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new ka,this.Zl=(t,i)=>this.Ql(t,i)&&this.Jl(t,i)&&this.Kl(t,i)&&this.Yl(t,i),this.Ql=(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;_i(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Xl=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.Xl)||t.call(this),this.Xl=void 0,this.Gl=new ka}register(t){var i,e;if(!_i(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Wl.add(t),null==(i=t.steps)||i.forEach((t=>{this.Vl.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Wl.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.Wl.clear(),this.Vl.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Vl.has(t)||this.Vl.has(i.event))&&this.Wl.forEach((t=>{this.tu(i,t)&&this.Gl.emit("actionCaptured",t.name)}))}eu(t){this.onAction("actionCaptured",(i=>t(i)))}tu(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Zl(t,e))return!0;return!1}onAction(t,i){return this.Gl.on(t,i)}Jl(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(!Gl(r,i.url,i.url_matching||"contains"))return!1}return!0}Kl(t,i){return!!this.iu(t,i)&&!!this.ru(t,i)&&!!this.nu(t,i)}iu(t,i){var e;if(null==i||!i.href)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Gl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}ru(t,i){var e;if(null==i||!i.text)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.text,i.text,i.text_matching||"exact")||Gl(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;!wi(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=>Gl(t,n,o))))}nu(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}su(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Yl(t,i){return null==i||!i.properties||0===i.properties.length||Aa(i.properties.reduce(((t,i)=>{var e=ci(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 Jl{constructor(t){var i;this.au=[],this._instance=t,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.du(t)))}vu(t){return!1}cu(){return null}fu(t){}pu(){}gu(t,i){return!!t&&Aa(t.propertyFilters,null==i?void 0:i.properties)}mu(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}yu(t,i,e){var r=(e===fo?this.ou:this.lu).get(t),s=[];return this.bu((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.gu(n,i)}))}register(t){this._u(t,!1)}replace(t){this._u(t,!0)}_u(t,i){var e;_i(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.wu(t,i),this.ku(t,i))}ku(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.uu.clear(),0!==e.length){this.Su||(this.Su=new Kl(this._instance),this.Su.init(),this.Su.eu((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.uu.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.uu.set(i.name,s)}}))})),i?this.Su.replace(r):this.Su.register(r)}else{var s;i&&(null==(s=this.Su)||s.replace([]))}}xu(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)}))}wu(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.mu(t,fo),a=this.mu(t,po);i?(this.ou=o,this.lu=a):(this.xu(this.ou,o),this.xu(this.lu,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Xl)&&void 0!==e||(this.Xl=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Cu(),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.Tu(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Mu([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Eu(n),void this.Iu([n])}if(this.lu.has(t)){var a=this.yu(t,i,po);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Mu(a.map((t=>t.id))),a.forEach((t=>this.Ru(t.id))))}if(this.ou.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.ou.get(t)});var l=this.yu(t,i,fo);this.Pu(l.map((t=>t.id)))}}onAction(t){this.uu.has(t)&&this.Pu(this.uu.get(t)||[])}Pu(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.vu(s)?this.Eu(s)&&this.Au(s):r.push(s);r.length>0&&(this.au=[...new Set([...this.au,...r])]),this.Cu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Eu(t){this.au=this.au.filter((i=>i!==t));var i=this.Fu();return!i.includes(t)&&(this.Lu([...i,t]),this.Ou(),!0)}Mu(t){var i=new Set(t);this.au=this.au.filter((t=>!i.has(t)));var e=this.Du(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.Lu(r),0===r.length&&this.$u()),this.Iu(t)}Nu(){var t,i=this.cu();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Au(t){if(this.cu()){var i=this.Nu();this.fu(e({},i,{[t]:Date.now()}))}}Iu(t){if(this.cu()){var i=this.Nu(),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&&(gi(e)?this.pu():this.fu(e))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var i=this.Nu()[t];return xi(i)?i:void 0}}Du(){var t,i=this.ju();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Fu(){var t,i,e=this.Du();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Bu()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Ou(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.Hu(i)}$u(){this.Uu()}du(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Bu()];if(e&&e!==t){var r=this.Du(),s=this.Nu();r.length>0&&(this.Lu([]),r.filter((t=>xi(s[t]))).forEach((t=>this.Ru(t)))),this.$u(),this.qu()}}getActivatedIds(){return[...new Set([...this.Fu(),...this.au])].filter((t=>!this.zu(t)))}dispose(){var t,i,e;null==(t=this.hu)||t.call(this),this.hu=void 0,null==(i=this.Xl)||i.call(this),this.Xl=void 0,null==(e=this.Su)||e.dispose(),this.Su=void 0}reset(){this.au=[],this.Du().length>0&&this.Lu([]),this.$u(),this.qu()}getEventToItemsMap(){return this.ou}Wu(){return this.Su}}class Yl extends Jl{constructor(t){super(t)}ju(){return q}Bu(){return H}cu(){return V}fu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[V]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}vu(t){var i,e;this.bu((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return xi(r)&&r>0}Vu(){return go}bu(t){var i;null==(i=this._instance)||i.getSurveys(t)}Ru(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Cu(){return za}Lu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[q]:t})}Hu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[H]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(H)}zu(){return!1}Tu(t,i){var e;this.bu((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Fa(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===go?"consume":"ignore":t===go?"persist":t===_o||t===mo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class Ql{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);_i(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 Xl{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 Yl(this._instance)}}var Zl=null!=wt&&wt.location?Bn(wt.location.hash,"__posthog")||Bn(location.hash,"state"):null,th="_postHogToolbarParams",ih=Gr("[Toolbar]"),eh=Gr("[FeatureFlags]");class rh{constructor(t,i){void 0===i&&(i=!1),this.Gu=!1,this.update(t,i)}update(t,i){this.Zu=((t,i)=>{var e,r,s,n;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,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?"none":"base64",evaluationContexts:null!==(s=null!==(n=t.evaluation_contexts)&&void 0!==n?n:t.evaluation_environments)&&void 0!==s?s:[],flagKeys:ci(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(eh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),_i(t.flag_keys)||ci(t.flag_keys)||eh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var sh=Gr("[FeatureFlags]"),nh=Gr("[FeatureFlags]",{debugEnabled:!0}),oh="\" failed. Feature flags didn't load in time.",ah="connection_error",lh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},hh=t=>{var i={};for(var e of Qr(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},uh=Gr("[Error tracking]"),dh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],vh=["__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)=>Ra(i,t),not_regex:(t,i)=>!Ra(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class ph{get qi(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{ph.Qu("retrieved web experiments from the server"),i.Ju=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Ju&&(ph.Qu("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Ju)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);mi(r)&&t.variants[r]&&i.Ku(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];ph.Yu(n,i._instance)&&i.Ku(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())ph.Qu(ch);else if(!this.qi.disable_web_experiments){if(wi(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ph.Qu("applying feature flags",t),t.forEach((t=>{var i;if(this.Ju&&null!=(i=this.Ju)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Ju)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Ku(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=ph.getWindowLocation();if(null!=t&&t.search){var i=Ln(null==t?void 0:t.search,"__experiment_id"),e=Ln(null==t?void 0:t.search,"__experiment_variant");i&&e&&(ph.Qu("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Xu(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.qi.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.qi.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Xu(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(ph.Qu("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Ku(r[0].name,i,r[0].variants[i].transforms))}static Yu(t,i){return!wi(t.conditions)&&ph.th(t,i)&&ph.eh(t)}static th(t,i){var e;if(wi(t.conditions)||wi(null==(e=t.conditions)?void 0:e.url))return!0;var r=ph.getWindowLocation();if(r){var s,n,o,a=Ms(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==wt?void 0:wt.location}static eh(t){var i;if(wi(t.conditions)||wi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=Kn();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 Qu(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Wr.info("[WebExperiments] "+t,e)}Ku(t,i,e){this._is_bot()?ph.Qu(ch):"control"!==i?e.forEach((e=>{if(e.selector){var r;ph.Qu("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)}))}})):ph.Qu("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?Ta(St,this.qi.custom_blocked_useragents):void 0}}var gh=Gr("[Conversations]"),_h="Conversations not available yet.",mh="console",yh="__posthogHandledLogsRequestError",bh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[yh]=!0,e},wh=t=>!!t&&"object"==typeof t&&!0===t[yh],xh={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=sh,this.rh={},this.nh={},this.sh=[],this.ah=!1,this.oh=!1,this.lh=0,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=!1,this.ph=0,this.Tt=()=>{var t=this.gh();this.ph=0,t&&this.reloadFeatureFlags()},"get"in t?this.ts=t:(this.mh=new rh(t.config,t.ma()),this.ts=this.mh)}updateConfig(t,i){var e;null==(e=this.mh)||e.update(t,i)}setup(t){return this.Fl=t,this.I=t.logger.createLogger("[FeatureFlags]"),ql(t.kv.initialize(),(()=>{this.Fl===t&&(this.Fl=void 0,this.ns=t,this.yh(t))}))}yh(t){if(this.ns===t)return wt&&rs(wt,"online",this.Tt),this.bh=t.registerDynamicEventProperties((()=>this._h()?this.rh:this.nh)),this.wh(),this.initialize()}destroy(){null==wt||wt.removeEventListener("online",this.Tt)}dispose(){var t;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),null==(t=this.bh)||t.dispose(),this.bh=void 0,this.sh=[],null==wt||wt.removeEventListener("online",this.Tt),this.ns=void 0)}get qi(){return this.ts.get()}Sh(t){var i;return null==(i=this.ns)?void 0:i.kv.get(t)}Dr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.set(t)}))}qr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.remove(t)}))}xh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}wh(){var t={};for(var i of[F,M,A,D]){var r=this.Sh(i);_i(r)||(t[i]=r)}this.rh=t;var s=e({},t),n=this.Sh(C);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.nh=s}_h(){var t=this.qi.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Sh(Y);return"number"!=typeof i||Date.now()-i>t}Ch(){return!!this._h()&&(this.fh||this.oh||(this.fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Th(){var t=this.qi.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Mh(){var t=this.qi.flagKeys;if(!_i(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.qi,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.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Sh(C))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Sh(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:Ot(c),variant:Dt(c),reason:void 0,metadata:_i(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Eh({flags:u})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(I),i=this.Sh(D),r=this.Sh(j);if(!r&&!i)return t||{};var s=Yr({},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=_i(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=_i(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.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.ih=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:Ot(r),variant:Dt(r),payload:At(i[e])}}))}getFlagVariants(){var t=this.Sh(C),i=this.Sh(D);if(!i)return t||{};for(var e=Yr({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ih=!0),e}getFlagPayloads(){var t=this.Sh(M),i=this.Sh(j);if(!i)return t||{};for(var e=Yr({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ih=!0),e}reloadFeatureFlags(){this.uh||this.qi.featureFlagsDisabled||this.gh()||this.Ih||(this.sh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.Ih=setTimeout((()=>{this.Rh()}),5))}kh(){clearTimeout(this.Ih),this.Ih=void 0}onReloading(t){return this.sh.push(t),()=>{this.sh=this.sh.filter((i=>i!==t))}}ensureFlagsLoaded(){this.ah||this.oh||this.Ih||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.uh=t}resetFlagCallReported(){this.qr(G)}Rh(t){this.kh();var i=this.ns;if(i&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!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.Sh(L)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Sh(N),timezone:eo()};_i(i.deviceId)||(r.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.qi.featureFlagsDisabled)&&(r.disable_flags=!0);var s=this.Th();s.length&&(r.evaluation_contexts=s);var n=this.Mh();_i(n)||(r.flag_keys=n);var o=this.qi.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.lh;this.oh=!0;var h=()=>{this.hh&&(this.hh=!1,this.Rh())},u=t=>{this.oh=!1,l===this.lh?(this.Dr({[J]:[ah]}),this.I.error("Feature flag request failed",t),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:r,compression:"base64"===this.qi.compression?co:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var i,e,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.oh=!1,l===this.lh){if(this.Ph(t.statusCode),n||this.hh||(this.$anon_distinct_id=void 0),!r.disable_flags||this.hh){this.dh=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?ah:"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.Dr({[J]:a}),u?this.I.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.Eh(s,n,{partialResponse:o}),h()}}else h()})).catch(u)}catch(t){u(t)}}}gh(){return zn(this.ph,3)}Ph(t){this.ph=Un(t,this.ph,3,(()=>this.I.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.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){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.I.warn('getFeatureFlag for key "'+t+oh)}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.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Sh(A)||void 0,u=this.Sh(Y)||void 0,d=this.Sh(G)||{};if(this.qi.deduplicateCallsPerSession){var v,c=null==(v=this.ns)?void 0:v.session.sessionId,f=this.Sh(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.Dr({[G]:d,[K]:r});else{var p,g,_,m,y,b,w,x,S,k,E,P;ci(d[t])?d[t].push(l):d[t]=[l],this.Dr(e({[G]:d},r?{[K]:r}:{}));var T=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Sh(J))&&void 0!==p?p:[]];_i(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.qi.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this.qi.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.dh};_i(null==T||null==(b=T.metadata)?void 0:b.has_experiment)||(F.$feature_flag_has_experiment=T.metadata.has_experiment),_i(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),_i(null==T?void 0:T.original_variant)&&_i(null==T?void 0:T.original_enabled)||(F.$feature_flag_original_response=_i(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.Ah(F)}else r&&this.Dr({[G]:d,[K]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:At(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+oh)}Ah(t){try{var i;null==(i=this.ns)||i.capture("$feature_flag_called",t).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Fh(t,i)}Fh(t,e){var r=this;return i((function*(){var i=r.ns;if(i){var s={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=r.Th();n.length&&(s.evaluation_contexts=n);var o,a=r.Mh();_i(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===r.qi.compression?co:void 0,sentAt:"body",timeoutMs:r.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void r.I.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){r.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.dh)return i.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+oh),i.defaultValue;var e=this.getFeatureFlag(t,i);return _i(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.Eh(t,i,e)}Eh(t,i,r){if(this.ns){this.ah=!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=sh);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 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(ci(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{[F]:h,[C]:c,[O]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse)p=e({},i,p),g=e({},r,g),_=e({},s,_);else if(t.errorsWhileComputingFlags)if(l){var m=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=>m.has(t[0]))))),g=e({},r,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0]))))),_=e({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0])))))}else p=e({},i,p),g=e({},r,g),_=e({},s,_);return e({[F]:Object.keys(hh(p)),[C]:p||{},[M]:g||{},[I]:_||{},[O]:!0===t.minimalFlagCalledEvents},d?{[A]:d}:{},v?{[Y]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.I);s&&this.Dr(s),i||(this.fh=!1),this.Lh(i)}}override(t,i){void 0===i&&(i=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Oh(t)}Oh(t){if(this.ns){if(!1===t)return this.qr([D,j]),this.Lh(),void nh.info("All overrides cleared");if(ci(t))return this.Dr({[D]:lh(t)}),this.Lh(),void nh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ih=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[D]=ci(s)?lh(s):s),n&&(r[j]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([D,j]):!1===s?this.qr(D):!1===n&&this.qr(j),this.Lh(),!1===s?nh.info("Flag overrides cleared"):s&&nh.info("Flag overrides set",{flags:s}),void(!1===n?nh.info("Payload overrides cleared"):n&&nh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[D]:t}),this.Lh(),void nh.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ah){var i=this.Dh(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s=(this.Sh(R)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=e({},this.getFlagVariants(),{[t]:i});this.Dr({[F]:Object.keys(hh(a)),[C]:a,[L]:e({},this.Sh(L)||{},n)}),this.Lh();try{var l;null==(l=this.ns)||l.capture("$feature_enrollment_update",o).catch((t=>{this.I.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.I.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Sh(R);!r||i?this.$h(t,e):t(r)}$h(t,e){var r=this;return i((function*(){var i=r.ns;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.Dr({[R]:s=o.json.earlyAccessFeatures})}catch(t){return void r.I.error("Early access feature request failed",t)}try{t(s)}catch(t){r.I.error("Early access feature callback failed",t)}}}))()}Dh(){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)),{})}}Lh(t){this.wh();var i=this.Dh(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Nh(t,i)}Nh(t,i){void 0===i&&(i=!0);var r=this.Sh(L)||{},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.Dr({[L]:e({},r,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=e({},this.Sh(L)||{});t.forEach((t=>{delete r[t]})),this.Dr({[L]:r}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(L),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Sh(N)||{},s=e({},r);for(var n of Object.keys(t))s[n]=e({},r[n],t[n]);this.Dr({[N]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Sh(N)||{};this.Dr({[N]:e({},i,{[t]:{}})})}else this.qr(N)}reset(){this.lh++,this.hh=!1,this.rh={},this.nh={},this.ah=!1,this.uh=!1,this.dh=!1,this.$anon_distinct_id=void 0,this.kh(),this.ih=!1,this.ph=0}}},Sh={sessionRecording:class{get qi(){return this._instance.config}get za(){return this._instance.persistence}get started(){var t;return!(null==(t=this.qh)||!t.isStarted)}get status(){var t,i;return this.jh===Il||this.jh===Ml?this.jh:null!==(t=null==(i=this.qh)?void 0:i.status)&&void 0!==t?t:this.jh}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=Fl,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var t;if(null==kt||!kt.visibilityState||"visible"===kt.visibilityState)return!0;var i=null==wt||null==(t=wt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==kt?void 0:kt.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Ol.error("started without valid sessionManager"),new Error(Al+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===dt)throw new Error(Al+' cannot be used with cookieless_mode="always"');null!=kt&&kt.addEventListener&&rs(kt,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==kt||null==kt.removeEventListener||kt.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var t,i=!(null==(t=this._instance.get_property(b))||!t.enabled),e=!this.qi.disable_session_recording,r=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return wt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.Hh||this.Uh&&null!=(i=this.qh)&&i.isStarted)){var e=!_i(Object.assign)&&!_i(Array.from);this.Uh&&e?(this.zh(t),Ol.info("starting")):(this.jh=Fl,this.stopRecording())}}zh(t){var i,e,r;this.Uh&&(this.jh!==Il&&this.jh!==Ml&&(this.jh=Rl),null!=Mt&&null!=(i=Mt.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=Mt.__PosthogExtensions__)&&e.initSessionRecording?this.Wh(t):null==(r=Mt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(i=>{if(i)return this._instance.register_for_session({[lt]:!0}),Ol.error("could not load recorder",i);this.Wh(t)})))}stopRecording(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.stop()}Gh(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.discard()}Zh(){var t,i;null==(t=this.za)||t.unregister(T),null==(i=this.za)||i.unregister(w)}Qh(t,i){if(wi(t))return null;var e,r=xi(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Ol.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var i,r,s=this.za,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Qh(null==(i=this.qi.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.Qh(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;wi(a)&&this.Zh();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]: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:_i(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.Bh)||i.call(this),this.Bh=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.Jh(i),void this.Gh()):(this.Jh(i),void this.startIfEnabledOrStop()):(this.jh===Il&&(this.jh=Ml,Ol.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.qh)&&e.log?this.qh.log(t,i):Ol.warn("log called before recorder was ready")}get Vh(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Kh(){var t,i=this._instance.get_property(b);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Ol.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!wi(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var i,e,r;if(!this.Hh){if(null==(i=Mt.__PosthogExtensions__)||!i.initSessionRecording)return Ol.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[lt]:!0});var s;if(this.qh||(this.qh=null==(s=Mt.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Ml||this.jh===Il)return;return this.jh=Il,Ol.info("persisted remote config is stale, requesting fresh config before starting"),void new So(this._instance).load()}this.jh=Rl,null==(e=(r=this.qh).setDocumentWasEverVisible)||e.call(r,this.kt),this.qh.start(t)}}onRRwebEmit(t){var i;null==(i=this.qh)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.qh||null==(i=this.za)||i.register({[S]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.qh||null==(i=this.za)||i.register({[x]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var i,e;this.qh||null==(e=this.za)||e.register({["url"===t?k:E]:!0}),null==(i=this.qh)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.qh)||!e.tryAddCustomEvent(t,i))}}},kh={autocapture:class extends bl{constructor(t){super(new wl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Yh=this.Xh()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.td();return!!(t.path||t.search||this.ed(t))}startIfEnabled(){this.isEnabled&&(Wr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Yh=this.Xh(),this.startIfEnabled()}stop(){this.rd&&this.rd(),this.rd=void 0,this.nd&&this.nd(),this.nd=void 0,Wr.info("History API monitoring stopped")}monitorHistoryChanges(){wt&&wt.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(t){var i;if(wt&&(null==(i=wt.history[t])||!i.__posthog_wrapped__)){var e=this;!function(t,i,e){try{if(!(i in t))return Sl;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 fi(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];fi(e)&&e.__posthog_layer__;){var n=e.__posthog_layer__;if(n.next===s)return void(n.next=r.next);e=n.next}else t[i]=r.next}}catch(t){return Sl}}(wt.history,t,(i=>function(r,s,n){i.call(this,r,s,n),e.ld(t)}))}}Xh(){var t=null==wt?void 0:wt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}td(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:pi(t)?t:{}}ed(t){return void 0===t&&(t=this.td()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ud(t){var i=this.td(),e=this.Yh;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.ed(i)&&t.hash!==e.hash))}ld(t){try{var i=this.Xh();if(!i)return;this.ud(i)&&this._instance.capture(_t,{navigation_type:t}),this.Yh=i}catch(i){Wr.error("Error capturing "+t+" pageview",i)}}ad(){if(!this.rd){var t=()=>{this.ld("popstate")};rs(wt,"popstate",t),this.rd=()=>{wt&&wt.removeEventListener("popstate",t)}}}od(){if(!this.nd){var t=()=>{this.ld("hashchange")};rs(wt,"hashchange",t),this.nd=()=>{wt&&wt.removeEventListener("hashchange",t)}}}},heatmaps:class{get qi(){return this.instance.config}constructor(t){var i;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=t,this.hd=!(null==(i=this.instance.persistence)||!i.props[v]),this.rageclicks=new fl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return pi(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return wi(this.qi.capture_heatmaps)?wi(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:!1!==this.qi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;Dl.info("starting..."),this.vd(),this.It()}else{var t;clearInterval(null!==(t=this.dd)&&void 0!==t?t:void 0),this.fd(),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.hd=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){jl(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(kt)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){wt&&kt&&(this.gd=this.La.bind(this),rs(wt,gt,this.gd),this.md=t=>this.ki(t||(null==wt?void 0:wt.event)),rs(kt,"click",this.md,{capture:!0}),this.yd=t=>this.bd(t||(null==wt?void 0:wt.event)),rs(kt,"mousemove",this.yd,{capture:!0}),this._d=new $n(this.instance,kn,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),rs(kt,pt,this.wd),this.Qn=!0)}fd(){var t;wt&&kt&&(this.gd&&wt.removeEventListener(gt,this.gd),this.md&&kt.removeEventListener("click",this.md,{capture:!0}),this.yd&&kt.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&kt.removeEventListener(pt,this.wd),clearTimeout(this.kd),null==(t=this._d)||t.stop(),this.Qn=!1)}Sd(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&&Ns(r)&&!Bs(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:wt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(oi(i,s))return!0;r=Xs(r)}return!1}(Js(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"),!Ls(t.target)&&jl(t)){var s=this.Sd(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&on(Js(t),this.instance.config.rageclick)&&this.Nn(e({},s,{type:"rageclick"})),this.Nn(s)}}bd(t){!Ls(t.target)&&jl(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(t){if(wt){var i=this.qi.disable_capture_url_hashes?He(wt.location.href):wt.location.href,e=this.qi.custom_personal_data_properties,r=this.qi.mask_personal_data_properties?[...Hn,...e||[]]:[],s=Nn(i,r,Wn);this.ft=this.ft||{},this.ft[s]||(this.ft[s]=[]),this.ft[s].push(t)}}La(){this.ft&&!gi(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:$n,webVitalsAutocapture:class{constructor(t){var i;this.hd=!1,this.Qn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.xd=()=>{clearTimeout(this.Cd),this.Cd=void 0,0!==this.ft.metrics.length&&(this._instance.capture("$web_vitals",e({$current_url:this.ft.url},this.ft.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=t=>{var i;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},wi(null==t?void 0:t.name)||wi(null==t?void 0:t.value))El.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Md(r);if(!_i(s)){var n=xi(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Ed||this.Ed>t.value){this.ft.navigationKey!==n&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),_i(this.ft.navigationKey)&&(this.ft.navigationKey=n,this.ft.url=s),this.ft.firstMetricTimestamp=_i(this.ft.firstMetricTimestamp)?Date.now():this.ft.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,pi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of Cl){var u="url"===h&&"string"==typeof t.attribution[h]?this.Md(t.attribution[h]):t.attribution[h];_i(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;_i(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.ft.metrics.push(a),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else El.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,i,r,s,n=!1,o=Mt.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Rd])||("web-vitals"===this.Rd&&_i(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!_i(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!_i(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.Td.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Td.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Td.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Td.bind(this),v),this.Qn=!0}else El.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(i=this._instance.persistence)||!i.props[g]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=pi(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return wi(e)?(null==(i=this._instance.persistence)?void 0:i.props[y])||Pl:e}get flushToCaptureTimeoutMs(){return(pi(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=pi(this.Pd)?this.Pd.web_vitals_attribution:void 0;return ki(t)?t?Pl:[]:ci(t)?t:Tl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=pi(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=pi(this.Pd)&&xi(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:$l;return t>0&&6e4>=t?$l:t}get isEnabled(){var t=null==Et?void 0:Et.protocol;if("http:"!==t&&"https:"!==t)return El.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=pi(this.Pd)?this.Pd.web_vitals:ki(this.Pd)?this.Pd:void 0;return ki(i)?i:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(El.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=pi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=pi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:e}),this._instance.persistence.register({[y]:r})),this.hd=e,this.startIfEnabled()}}}get Rd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_s(t){var i=Mt.__PosthogExtensions__,e=this.Rd,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&_i(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?El.error("failed to load script",i):t()}))}Md(t){var i=t||(null==wt?void 0:wt.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?[...Hn,...r||[]]:[];return Nn(e,s,Wn)}El.error("Could not determine current URL")}}},Eh={exceptionObserver:class{constructor(t){var i;this.Id=()=>{var t;if(wt&&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.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=i(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=e(this.captureException.bind(this))),!this.Ld&&this.qi.capture_console_errors&&(this.Ld=r(this.captureException.bind(this)))}catch(t){xl.error("failed to start",t),this.Od()}}},this._instance=t,this.Dd=!(null==(i=this._instance.persistence)||!i.props[c]),this.oe=new ji(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,I:xl})),this.qi=this.$d(),this.startIfEnabledOrStop()}$d(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pi(t)?i=e({},i,t):(_i(t)?this.Dd:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.qi.capture_console_errors||this.qi.capture_unhandled_errors||this.qi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(xl.info("enabled"),this.Od(),this._s(this.Id)):this.Od()}_s(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 xl.error("failed to load script",i);t()}))}Od(){var t,i,e;null==(t=this.Ad)||t.call(this),this.Ad=void 0,null==(i=this.Fd)||i.call(this),this.Fd=void 0,null==(e=this.Ld)||e.call(this),this.Ld=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Dd=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[c]:this.Dd}),this.qi=this.$d(),this.startIfEnabledOrStop())}}onConfigChange(){this.qi=this.$d()}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.oe.consumeRateLimit(s)?xl.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.Nd=[],this.qd=new pr([new Pr,new jr,new Cr,new Tr,new Or,new Ar,new Rr,new Dr],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=$r.test(l)?l.replace($r,"$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||gr});var r}))}(n)}}("web:javascript",xr,Er)),this._instance=t,this.Nd=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==i?i:[],this.jd=Ur(this.Bd()),this.Hd=new qr(this.jd)}onConfigChange(){this.jd=Ur(this.Bd()),this.Hd.setConfig(this.jd)}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.Nd=n,this._instance.persistence&&this._instance.persistence.register({[f]:this.Nd,[p]:o})}}}get Ud(){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.qd.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.jd.enabled)try{if(!mi(t)||0===t.trim().length)return void uh.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)=>Br.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.zd(i)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&uh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Hd.add(e({[Lr]:t,[Nr]:(new Date).toISOString()},s))}catch(t){uh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Wd(i)){if(this.Vd(i))return this.Gd("Exception dropped: matched a suppression rule"),void uh.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(i))return this.Gd("Exception dropped: thrown by a browser extension"),void uh.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(i))return this.Gd("Exception dropped: thrown by an injected browser script"),void uh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(i))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void uh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.jd.enabled&&wi(t.$exception_steps)?this.Kd(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",fl:!0});return s&&this.Hd.clear(),s}catch(t){return uh.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void uh.error("Failed to process exception event. Ignoring this exception.",t)}var n}Kd(t){try{var i=this.Hd.getAttachable();return 0===i.length?t:e({},t,{$exception_steps:i})}catch(i){return uh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Gd(t){this.jd.enabled&&this.Hd.add({[Lr]:t,[Nr]:(new Date).toISOString()})}zd(t){return pi(t)?e({},t):{}}Bd(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Vd(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return mi(e)&&e.length>0&&t.$exception_types.push(e),mi(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Nd.some((t=>{var e=t.values.map((t=>{var e=Ma[t.operator],r=i[t.key];if(!e||!r)return!1;var s=ci(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 uh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zd(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>{var i=t.filename;return!!i&&dh.some((t=>i.startsWith(t)))}))}Qd(t){return t.some((t=>{var i=t.value;return mi(i)&&vh.some((t=>i.includes(t)))}))}Jd(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}Wd(t){return!wi(t)&&ci(t)}}},$h=e({productTours:class{get za(){return this._instance.persistence}constructor(t){this.Yd=null,this.Xd=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.za&&this.za.register({[m]:!!i.productTours}),!Nl(this._instance))return!this.Yd&&wi(null==(e=this.za)?void 0:e.props[W])||Ll.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Yd)||r.stop(),this.Yd=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Yd&&Nl(this._instance)&&this._s((()=>this.tv()))}_s(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?Ll.error("Could not load product tours script",i):t()}))}tv(){var t;!this.Yd&&null!=(t=Mt.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=Mt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!ci(this.Xd)||i){var e=this.za;if(e){var r=e.props[W];if(ci(r)&&!i)return this.Xd=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(Nl(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||Ll.warn(s):Ll.error(s),void t([],{isLoaded:!1,error:s})}var n=ci(i.json.product_tours)?i.json.product_tours:[];this.Xd=n,e&&e.register({[W]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){wi(this.Yd)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Yd)||i.showTourById(t)}previewTour(t){this.Yd?this.Yd.previewTour(t):this._s((()=>{var i;this.tv(),null==(i=this.Yd)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Yd)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Yd)||t.nextStep()}previousStep(){var t;null==(t=this.Yd)||t.previousStep()}clearCache(){var t;this.Xd=null,null==(t=this.za)||t.unregister(W)}resetTour(t){var i;null==(i=this.Yd)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Yd)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Yd)||i.cancelPendingTour(t)}}},xh),Ph={siteApps:class{constructor(t){this.ev=0,this._instance=t,this.iv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rv(t,i){if(i){var e=this.globalsForEvent(i);this.iv.push(e),this.iv.length>1e3&&(this.iv=this.iv.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.rv.bind(this));this.nv=()=>{t(),this.iv=[],this.nv=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,Bl),{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}}sv(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)||(zl.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)||(zl.error("prepare_external_dependency_script returned null"),null):t}av(){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==kt?void 0:kt.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.ev++,this.ov)return this.lv();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.sv(t);return i&&v.add(i),i},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!bi(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.ov=()=>{u.forEach((t=>t())),this.ov=void 0},this.lv()}lv(){var t=!1;return()=>{var i;t||(t=!0,this.ev--,0===this.ev&&(null==(i=this.ov)||i.call(this)))}}uv(t,i){void 0===i&&(i=!0);var e=this.av();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.iv.length&&(zl.info("Processing "+this.iv.length+" events for site app with id "+t.id),this.iv.forEach((t=>this.uv((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.nv)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,zl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.uv((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){zl.error(Ul+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){zl.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}hv(){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)}dv(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.uv((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){zl.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.hv(),void this._instance.on("eventCaptured",(t=>this.dv(t)))):void zl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.nv)||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 zl.error(Ul+i,t)}))};for(var a of n.siteApps)o()}else zl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Th={tracingHeaders:class{constructor(t){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var t,i,e=this.gv();e?(_i(this.vv)&&(this.vv=null==(t=Mt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),_i(this.fv)&&(this.fv=null==(i=Mt.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Od()},this._instance=t}initialize(){this.startIfEnabledOrStop()}_s(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 kl.error("failed to load script",i);t()}))}mv(){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}gv(){var t=this.mv();return ci(t)?(ci(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(ci(this.pv)&&this.pv.splice(0),this.pv=t||void 0,this.pv)}Od(){var t,i;null==(t=this.vv)||t.call(this),null==(i=this.fv)||i.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Od()}}},Ch=e({surveys:class extends Wl{constructor(t){var i;super(new Xl(t),{get projectToken(){return i.config.token},kv:new Ql(i=t)}),this._instance=t}Nl(t,i){var e=i.query?oa(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})}))}}},xh),Fh={toolbar:class{constructor(t){this.instance=t}yv(t){Mt.ph_toolbar_state=t}bv(){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),ss(this.instance.config))return!1;if(!wt||!kt)return!1;t=null!=t?t:wt.location,e=null!=e?e:wt.history;try{if(!i){try{wt.localStorage.setItem("test","test"),wt.localStorage.removeItem("test")}catch(t){return!1}i=null==wt?void 0:wt.localStorage}var r,s=Zl||Bn(t.hash,"__posthog")||Bn(t.hash,"state"),n=s?Xr((()=>JSON.parse(atob(decodeURIComponent(s)))))||Xr((()=>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(th)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}_v(t){var i=Mt.ph_load_toolbar||Mt.ph_load_editor;!wi(i)&&fi(i)?i(t,this.instance):ih.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==kt||!kt.getElementById(As));if(!wt||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(wt.localStorage.setItem(th,JSON.stringify(e({},s,{source:void 0}))),2===this.bv())this._v(s);else if(0===this.bv()){var n;this.yv(1),null==(n=Mt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ih.error("[Toolbar] Failed to load",t),void this.yv(0);this.yv(2),this._v(s)})),rs(wt,"turbolinks:load",(()=>{this.yv(0),this.loadToolbar(s)}))}return!0}wv(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)}}},Rh=e({experiments:ph},xh),Ih={conversations:class{constructor(t){this.Sv=void 0,this._conversationsManager=null,this.xv=!1,this.Me=null,this.Cv=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Tv=t.ok,t.ok)){var i=t.config.conversations;wi(i)||(ki(i)?this.Sv=i:(this.Sv=i.enabled,this.Me=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Sv=void 0,this.Me=null,this.Tv=void 0,this.Cv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.xv||this._instance.config.disable_conversations||ss(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==Mt?void 0:Mt.__PosthogExtensions__;if(t&&!_i(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var i=t.initConversations;if(i)return this.Mv(i),void(this.xv=!1);var e=t.loadExternalDependency;if(!e)return void this.Ev(ht);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Ev("Could not load conversations script",i):this.Mv(t.initConversations),this.xv=!1}))}catch(t){this.Ev("Error initializing conversations",t),this.xv=!1}}else gh.error("Conversations enabled but missing token in remote config.")}}Mv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.Cv=!1,gh.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else gh.error("Cannot complete initialization: remote config is null")}Ev(t,i){gh.error(t,i),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():gh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!bi(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ss(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Tv?"remote_config_failed":_i(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?wi(this.Me)||!this.Me.token?"missing_token":null!=Mt&&Mt.__PosthogExtensions__?this.xv?"initializing":this.Cv?"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):(gh.warn(_h),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(gh.warn(_h),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(gh.warn(_h),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(gh.warn(_h),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(gh.warn(_h),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(gh.warn(_h),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(gh.warn(_h),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}Sl(){var t;null==(t=this._conversationsManager)||t.setIdentity()}xl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Mh={logs:class{constructor(t){var i,r=this;this.Iv=!1,this.Rv=!1,this.I=Gr("[logs]"),this.Pv=e({},this.I,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some(wh)||r.I.error(...i)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var t,i;this.ph=0,null==(t=this.Lv)||t.onReconnect(),null==(i=this.Ov)||i.onReconnect()},this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Iv=!0),wt&&rs(wt,"online",this.Fv)}Dv(t,i,e,r){var s,n=function(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=_i(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}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new or(this.$v(t,i),n,this.Pv,(()=>this.Nv()),(t=>t()),void 0,r),n]}qv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Lv||this.jv!==i){var e;null==(e=this.Lv)||e.reset(),this.jv=i;var r=this.Dv((()=>this.ka),(t=>{this.ka=t}));this.Lv=r[0],this.Bv=r[1]}return this.Lv}Hv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Ov||this.Uv!==i){var e;null==(e=this.Ov)||e.reset(),this.Uv=i;var r=this.Dv((()=>this.Av),(t=>{this.Av=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},mh);this.Ov=r[0],this.zv=r[1]}return this.Ov}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i;if(t.ok){var e=null==(i=t.config.logs)?void 0:i.captureConsoleLogs;!wi(e)&&e&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var t,i;this.ka=[],null==(t=this.Lv)||t.reset(),this.Av=[],null==(i=this.Ov)||i.reset(),this.ph=0}captureLog(t){this.qv().captureLog(t)}vi(t){this.Hv().captureLog(t)}get logger(){return this.Wv||(this.Wv={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.Wv}flushLogs(t){t?this.Vv(t):(this.Lv&&this.Lv.flush().catch((t=>this.Gv(t))),this.Ov&&this.Ov.flush().catch((t=>this.Gv(t))))}Gv(t){wh(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==Mt?void 0:Mt.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",(i=>{var e;i||null==(e=t.logs)||!e.initializeLogs?this.I.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Rv=!0)})):this.I.error(ht)}else this.I.error("PostHog Extensions not found.")}}$v(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:[])},Mn:t=>this.Mn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Mn(t){return new Promise((i=>{if(zn(this.ph,3))i({kind:"fatal",error:bh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:bh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Zv(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Qv(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.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:bh(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)})}}})}}))}Qv(t){(0!==t||this._instance.__loaded)&&(this.ph=Un(t,this.ph,3,(()=>this.I.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."))))}Vv(t){this.ka.length>0&&this.Jv(t,this.ka,this.Bv,s.LIB_NAME,(t=>{this.ka=t})),this.Av.length>0&&this.Jv(t,this.Av,this.zv,mh,(t=>{this.Av=t}))}Jv(t,i,e,r,n){if(0!==i.length){var o=i.map((t=>t.record));n([]);var a=nr(o,sr(e,s.LIB_NAME,s.LIB_VERSION),r,s.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:a,compression:"best-available",batchKey:"logs",transport:t})}}Zv(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Nv(){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,wi(s)||(i.sessionStartTimestamp=s),wi(n)||(i.lastActivityTimestamp=n)}if(null!=Mt&&null!=(t=Mt.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?He(Mt.location.href):Mt.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},Ah={metrics:class{constructor(t){this.I=Gr("[metrics]"),this._instance=t}initialize(){}qv(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Lv&&this.jv===e||(null==(i=this.Lv)||i.reset(),this.jv=e,this.Lv=new ur(this.$v(),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.I)),this.Lv}count(t,i,e){void 0===i&&(i=1),this.qv().count(t,i,e)}gauge(t,i,e){this.qv().gauge(t,i,e)}histogram(t,i,e){this.qv().histogram(t,i,e)}flush(t){if(!this.Lv)return Promise.resolve();if(t){var i=this.Lv.drainWindow();return i&&this.Un(i,t),Promise.resolve()}return this.Lv.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Lv)||t.reset()}$v(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Un:t=>i.Un(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Un(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.Kv(),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)})}}}))}))}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Oh=e({},xh,Sh,kh,Eh,$h,Ph,Ch,Th,Fh,Rh,Ih,Mh,Ah);cl.__defaultExtensionClasses=e({},Oh)}();
|
|
2
2
|
//# sourceMappingURL=default-extensions.js.map
|