posthog-js 1.419.0 → 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 +13 -1
- package/package.json +18 -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
package/dist/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});var s={DEBUG:!1,LIB_VERSION:"0.5.2",LIB_NAME:"browser-common"};s.DEBUG=!1,s.LIB_VERSION="1.419.0",s.LIB_NAME="web";var n="$people_distinct_id",o="distinct_id",a="$device_id",l="$device_model",u="__alias",h="__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",_="$web_vitals_enabled_server_side",g="$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",E="$replay_override_url_trigger",k="$replay_override_event_trigger",T="$sesid",P="$session_is_sampled",R="$enabled_feature_flags",C="$active_feature_flags",O="$early_access_features",I="$feature_flag_details",A="$feature_flag_payloads",F="$feature_flag_request_id",M="$minimal_flag_called_events",D="$override_feature_flags",N="$override_feature_flag_payloads",L="$stored_person_properties",U="$stored_group_properties",j="$groups",B="$surveys",z="$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",et="$initial_referrer_info",it="$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",ut="PostHog loadExternalDependency extension not found.",ht="on_reject",dt="always",vt="anonymous",ct="identified",ft="identified_only",pt="visibilitychange",_t="beforeunload",gt="$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,Et=null==xt?void 0:xt.document,kt=null==xt?void 0:xt.location,Tt=null==xt?void 0:xt.fetch,$t=null!=xt&&xt.XMLHttpRequest&&"withCredentials"in new xt.XMLHttpRequest?xt.XMLHttpRequest:void 0,Pt=null==xt?void 0:xt.AbortController,Rt=null==xt?void 0:xt.CompressionStream,Ct=null==St?void 0:St.userAgent;function Ot(){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 At=null!=wt?wt:{},Ft=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Mt(t){return"string"==typeof t||t}function Dt(t){return"string"==typeof t?t:void 0}var Nt,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"],Ut=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}({}),jt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Bt=["$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"],zt=["token"],qt="NativeGzipValidationError",Ht=t=>t.length>=2&&31===t[0]&&139===t[1],Vt=(t,e)=>t===jt.GZipJS||e===jt.GZipJS||"gzip"===e,Wt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Gt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=qt,e},Kt=function(){var t=e((function*(t,e){18>t.size&&Gt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ht(i)&&8===i[2]||Gt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Nt)return Nt;Nt=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;Nt[t]=e>>>0}return Nt})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Gt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Gt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Jt(){return Jt=e((function*(t,i,r){void 0===i&&(i=!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=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),u=(yield Promise.all([l,a]))[0];return yield Kt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Jt.apply(this,arguments)}var Yt=20,Qt=1e3,Xt=1e4,Zt="[Circular]",te="[Truncated]",ee="[Unserializable]",ie="[Function]";function re(t){for(var e="",i=0;t.length>i;i++){var r=t.charCodeAt(i);if(55296>r||r>56319)e+=56320>r||r>57343?t[i]:"�";else{var s=t.charCodeAt(i+1);56320>s||s>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}var se=["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"],ne=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return se.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function oe(t,e){return-1!==t.indexOf(e)}var ae=function(t){return t.trim()},le=function(t){return t.replace(/^\$/,"")};function ue(t){var e,i=[];return null!==(e=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}})))&&void 0!==e?e:"null"}var he=Object.prototype,de=he.hasOwnProperty,ve=he.toString,ce=Array.isArray||function(t){return"[object Array]"===ve.call(t)},fe=t=>"function"==typeof t,pe=t=>t===Object(t)&&!ce(t),_e=t=>{if(pe(t)){for(var e in t)if(de.call(t,e))return!1;return!0}return!1},ge=t=>void 0===t,me=t=>"[object String]"==ve.call(t),ye=t=>me(t)&&0===t.trim().length,be=t=>null===t,we=t=>ge(t)||be(t),xe=t=>"[object Number]"==ve.call(t)&&t==t,Se=t=>xe(t)&&t>0,Ee=t=>"[object Boolean]"===ve.call(t),ke=t=>t instanceof FormData,Te=t=>oe(Bt,t),$e=t=>oe(zt,t);function Pe(t){return null===t||"object"!=typeof t}function Re(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Ce(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 Ie(t,Error)}}function Oe(t){return"undefined"!=typeof Event&&Ie(t,Event)}function Ie(t,e){try{return t instanceof e}catch(t){return!1}}var Ae=[!0,"true",1,"1","yes"],Fe=t=>oe(Ae,t),Me=[!1,"false",0,"0","no"];function De(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),xe(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),De(s||i,e,i,r))}class Ne{constructor(t){this.k={},this.S=t.S,this.C=De(t.bucketSize,0,100,t.I),this.R=De(t.refillRate,0,this.C,t.I),this.A=De(t.refillInterval,0,864e5,t.I)}O(t,e){var i=Math.floor((e-t.lastAccess)/this.A);i>0&&(t.tokens=Math.min(t.tokens+i*this.R,this.C),t.lastAccess=t.lastAccess+i*this.A)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,i):this.k[r]=s={tokens:this.C,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.S)||e.call(this,t)),0===s.tokens)}stop(){this.k={}}}var Le="Mobile",Ue="iOS",je="Android",Be="Tablet",ze=je+" "+Be,qe="iPad",He="Apple",Ve=He+" Watch",We="Safari",Ge="BlackBerry",Ke="Samsung",Je=Ke+"Browser",Ye=Ke+" Internet",Qe="Chrome",Xe=Qe+" OS",Ze=Qe+" "+Ue,ti="Internet Explorer",ei=ti+" "+Le,ii="Opera",ri=ii+" Mini",si="Edge",ni="Microsoft "+si,oi="Firefox",ai=oi+" "+Ue,li="Nintendo",ui="PlayStation",hi="Xbox",di=je+" "+Le,vi=Le+" "+We,ci="Windows",fi=ci+" Phone",pi="Nokia",_i="Ouya",gi="Generic",mi=gi+" "+Le.toLowerCase(),yi=gi+" "+Be.toLowerCase(),bi="Konqueror",wi="Oculus Browser",xi="Vivaldi",Si="Yandex",Ei="Whale",ki="DuckDuckGo",Ti="Pale Moon",$i="Waterfox",Pi="Brave",Ri="Google Search App",Ci="(\\d+(\\.\\d+)?)",Oi=new RegExp("Version/"+Ci),Ii=new RegExp(hi,"i"),Ai=new RegExp(ui+" \\w+","i"),Fi=new RegExp(li+" \\w+","i"),Mi=new RegExp(Ge+"|PlayBook|BB10","i"),Di={"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"},Ni=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Pi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&oe(t,"GSA/")?Ri:oe(t," OPR/")&&oe(t,"Mini")?ri:oe(t," OPR/")?ii:Mi.test(t)?Ge:oe(t,"IE"+Le)||oe(t,"WPDesktop")?ei:oe(t,"OculusBrowser")?wi:oe(t,Je)?Ye:oe(t,si)||oe(t,"Edg/")?ni:oe(t,xi+"/")?xi:oe(t,"YaBrowser/")?Si:oe(t,Ei+"/")?Ei:oe(t,ki+"/")||oe(t,"Ddg/")?ki:oe(t,"FBIOS")?"Facebook "+Le:oe(t,"UCWEB")||oe(t,"UCBrowser")?"UC Browser":oe(t,"CriOS")?Ze:oe(t,"CrMo")||oe(t,Qe)?Qe:oe(t,je)&&oe(t,We)?di:oe(t,"FxiOS")?ai:oe(t.toLowerCase(),bi.toLowerCase())?bi:oe(t,Pi+"/")?Pi:((t,e)=>e&&oe(e,He)||function(t){return oe(t,We)&&!oe(t,Qe)&&!oe(t,je)}(t))(t,e)?oe(t,Le)?vi:We:oe(t,"PaleMoon/")?Ti:oe(t,$i+"/")?$i:oe(t,oi)?oi:oe(t,"MSIE")||oe(t,"Trident/")?ti:oe(t,"Gecko")?oi:"")},Li={[ei]:[new RegExp("rv:"+Ci)],[ni]:[new RegExp(si+"?\\/"+Ci)],[Qe]:[new RegExp("("+Qe+"|CrMo)\\/"+Ci)],[Ze]:[new RegExp("CriOS\\/"+Ci)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ci)],[We]:[Oi],[vi]:[Oi],[ii]:[new RegExp("(Opera|OPR)\\/"+Ci)],[oi]:[new RegExp(oi+"\\/"+Ci)],[ai]:[new RegExp("FxiOS\\/"+Ci)],[bi]:[new RegExp("Konqueror[:/]?"+Ci,"i")],[Ge]:[new RegExp(Ge+" "+Ci),Oi],[di]:[new RegExp("android\\s"+Ci,"i")],[Ye]:[new RegExp(Je+"\\/"+Ci)],[wi]:[new RegExp("OculusBrowser\\/"+Ci)],[xi]:[new RegExp(xi+"\\/"+Ci)],[Si]:[new RegExp("YaBrowser\\/"+Ci)],[Ei]:[new RegExp(Ei+"\\/"+Ci)],[Pi]:[new RegExp(Pi+"\\/"+Ci)],[ki]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ci)],[Ti]:[new RegExp("PaleMoon\\/"+Ci)],[$i]:[new RegExp($i+"\\/"+Ci)],[Ri]:[new RegExp("GSA\\/"+Ci)],[ti]:[new RegExp("(rv:|MSIE )"+Ci)],Mozilla:[new RegExp("rv:"+Ci)]},Ui=function(t,e,i,r){var s=Ni(t,e,i,r),n=Li[s];if(ge(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},ji=[[new RegExp(hi+"; "+hi+" (.*?)[);]","i"),t=>[hi,t&&t[1]||""]],[new RegExp(li,"i"),[li,""]],[new RegExp(ui,"i"),[ui,""]],[Mi,[Ge,""]],[new RegExp(ci,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[fi,""];if(new RegExp(Le).test(e)&&!/IEMobile\b/.test(e))return[ci+" "+Le,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Di[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[ci,r]}return[ci,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ue,[t[3],t[4],t[5]||"0"].join(".")]:[Ue,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ge(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+je+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+je+")","i"),t=>t&&t[2]?[je,[t[2],t[3],t[4]||"0"].join(".")]:[je,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Xe,""]],[/Linux|debian/i,["Linux",""]]],Bi=function(t){return Fi.test(t)?li:Ai.test(t)?ui:Ii.test(t)?hi:new RegExp(_i,"i").test(t)?_i:new RegExp("("+fi+"|WPDesktop)","i").test(t)?fi:/iPad/.test(t)?qe:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ve:Mi.test(t)?Ge:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(pi,"i").test(t)?pi:/(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(Le).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)?je:ze:new RegExp("(pda|"+Le+")","i").test(t)?mi:new RegExp(Be,"i").test(t)&&!new RegExp(Be+" pc","i").test(t)?yi:""},zi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function qi(t,e){return"string"==typeof(i=t)&&zi.test(i)?t:e();var i}function Hi(t){return t?t.split("#")[0]:t}function Vi(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function Wi(t,e,i){return Gi.apply(this,arguments)}function Gi(){return(Gi=e((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Vi((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ki={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}},Ji=Ki.info,Yi=0x8000000000000000,Qi={}.propertyIsEnumerable;function Xi(t,e){try{return er(t,e,{ancestors:new WeakSet,remainingNodes:Xt},0)}catch(t){return[]}}function Zi(t,e,i,r){if(0>=i.remainingNodes)return{stringValue:te};if(i.remainingNodes--,Ee(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>=Yi||-Yi>t?(null==e||e.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:re(t)};if("function"==typeof t)return{stringValue:ie};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:Zt};if(r>=Yt)return{stringValue:te};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?re(o):String(o)}}i.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Zi(a.call(t),e,i,r+1)}catch(t){}return ce(t)?{arrayValue:{values:tr(t,e,i,r+1)}}:{kvlistValue:{values:er(t,e,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:re(String(t))}}function tr(t,e,i,r){for(var s=[],n=Math.min(t.length,Qt),o=0;n>o&&i.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(we(a))continue;s.push(Zi(a,e,i,r))}catch(t){s.push({stringValue:ee})}return t.length>o&&s.push({stringValue:te}),s}function er(t,e,i,r){var s=[];for(var n in t)if(Qi.call(t,n)){if(s.length>=Qt||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(be(o)||ge(o))continue;s.push({key:re(n),value:Zi(o,e,i,r)})}catch(t){s.push({key:re(n),value:{stringValue:ee}})}}return s}function ir(t){try{return re(String(t))}catch(t){return ee}}function rr(t,e,r){var s=Ki[t.level||"info"]||Ji,n=s.text,o=s.number,a=String(Date.now())+"000000",l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),we(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),we(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);var u=i({},l),h=t.attributes;if(h){var d=[];try{d=Object.keys(h)}catch(t){d=[]}for(var v of d){var c=void 0;try{c=h[v]}catch(t){c=ee}Object.defineProperty(u,v,{value:c,enumerable:!0,writable:!0,configurable:!0})}}var f={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:ir(t.body)},attributes:Xi(u,r)};return t.trace_id&&(f.traceId=t.trace_id),t.span_id&&(f.spanId=t.span_id),ge(t.trace_flags)||(f.flags=t.trace_flags),f}function sr(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function nr(t,e,i,r){return{resourceLogs:[{resource:{attributes:Xi(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let or=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.qi=e,this.I=i,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=e.maxBufferSize,this.pn=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.gn=e.flushIntervalMs,this.mn=e.maxBatchRecordsPerPost,this.yn=e.rateCapWindowMs,this.bn=e.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 e=this.kn(t);if(null!==e)if(e.body){if(this.Sn()){var i={record:rr(e,this.rn(),this.I)};this.nn((()=>this.xn(i)))}}else this.I.info("Log was rejected in beforeSend function")}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var i=ce(e)?e:[e],r=t;for(var s of i)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(),e=t-this.dn;return this.yn>e&&e>=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 e((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return e((function*(){var e;t._n();var i=null!==(e=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.un=0;var a=Math.min(i.length,t.mn),l=i.slice(0,a),u=nr(l.map((t=>t.record)),t.Tn(),null!==(n=t.an)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.Mn(u);if("too-large"===h.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"===h.kind)throw h.error;if("too-large"===h.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"===h.kind&&t.qi.maxBatchRecordsPerPost>t.mn&&(t.mn=Math.min(t.qi.maxBatchRecordsPerPost,t.mn+1)),yield t.En(l.length),i=null!==(o=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}En(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.un),s=null!==(e=i._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ut.LogsQueue,s.slice(r)),yield i.sn()}))()}Tn(){return sr(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];this.pn>i.length||(i.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ut.LogsQueue,i),this.fn>i.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Vi((()=>{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(Ut.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i._n();var e=i.flush().catch((()=>{}));void 0!==t?yield Wi(e,t):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=i.flush();yield Wi(e,t,(()=>{e.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 ur(t,e,i,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+e+"\0"+(null!=i?i:"")+"\0"+s}let hr=class{constructor(t,e,i){this._instance=t,this.qi=e,this.I=i,this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.$n=0}count(t,e,i){void 0===e&&(e=1),this.Nn({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Nn({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Nn({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this,i=this.ln,r=function(){var r=e((function*(){i&&(yield i.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 e=this.kn(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.I.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=e.attributes?i({},e.attributes):void 0,s=ur(e.type,e.name,e.unit,r)}catch(t){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.Fn.get(s);if(!n){if(!this.Bn())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Fn.set(s,n)}var o=this.On.get(e.name);void 0===o?this.On.set(e.name,e.type):o===e.type||this.Dn.has(e.name)||(this.Dn.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+o+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(n,e.value),this.In()}else this.I.warn("Dropping metric '"+e.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,e){var i;switch(t.type){case"count":t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(ar.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(t,e){for(var i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,ar)]+=1}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var i=ce(e)?e:[e],r=t;for(var s of i)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=Vi((()=>{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 e((function*(){if(0!==t.Fn.size){var e=t.Fn;t.Fn=new Map,t.Ln=!1,t.On=new Map,t.Dn=new Set;var i=t.$n,r=yield t._instance.Un(t.jn(e));if(i===t.$n)switch(r.kind){case"ok":return;case"retry-later":return t.zn(e),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 e=this.Wn(t),r=function(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Xi(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}Wn(t){var e=lr(Date.now()),r=new Map;for(var s of t.values()){var n,o=ur(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=i({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=Xi(null!==(n=s.attributes)&&void 0!==n?n:{},this.I),u=lr(s.windowStartMs);if("count"===s.type){var h,d={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(h=s.total)&&void 0!==h?h:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:e,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:u,timeUnixNano:e,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 e,i;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!==(e=o.total)&&void 0!==e?e:0)+(null!==(i=n.total)&&void 0!==i?i: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 e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return cr&&i.length===vr||(vr=i.length,cr=i.reduce(((i,r)=>{dr||(dr={});var s=dr[r];if(s)i[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,u=e[r];if(l&&u){i[l]=u,dr[r]=[l,u];break}}return i}),{})),cr}}class pr{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&ce(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.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,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:fr(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var _r="?";function gr(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?_r:i,in_app:!(null!=e&&e.startsWith("webkit-masked-url://"))&&"<anonymous>"!==e};return ge(r)||(n.lineno=r),ge(s)||(n.colno=s),n}var mr=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:_r,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},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,e)=>{var i=yr.exec(t);if(i)return gr(e,i[1],_r,+i[2],+i[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]||_r,r[2]);return gr(e,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,Er=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,kr=(t,e)=>{var i=Sr.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Er.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||_r,o=mr(n,s);return gr(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Tr=/\(error: (.*)\)/;class $r{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=me(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return Re(t,"DOMException")}isDOMError(t){return Re(t,"DOMError")}}class Pr{match(t){return Ce(t)}coerce(t,e){var i,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=r?r:null==(i=e.syntheticException)?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class Rr{constructor(){}match(t){return!!Re(t,"ErrorEvent")&&(null!=t.error||this.fi(t))}coerce(t,e){var r;if(null!=t.error)return e.apply(t.error);var s=e.apply(t.message);return i({},s,{stack:null!==(r=this.pi(t))&&void 0!==r?r:s.stack,synthetic:!0})}fi(t){return me(t.message)&&t.message.length>0}pi(t){var e,i,r=t,s=null!==(e=r.lineno)&&void 0!==e?e:0,n=null!==(i=r.colno)&&void 0!==i?i:0;if(me(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Cr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Or{match(t){return"string"==typeof t}coerce(t,e){var i,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(Cr);return r&&(e=r[1],i=r[2]),[e,i]}}var Ir=["fatal","error","warning","log","info","debug"];function Ar(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Fr{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r,s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null==(r=e.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Oe(t))return t.constructor.name;var e="name"in t?t.name:void 0;return me(e)&&!ye(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Ar(t)}isSeverityLevel(t){return me(t)&&!ye(t)&&Ir.indexOf(t)>=0}getStack(t){try{return me(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:me(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Ce(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Mr{match(t){return Oe(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Ar(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Dr{match(t){return Pe(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Nr{match(t){return Re(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Oe(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return Pe(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.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",Ur="$timestamp",jr=new Set([Lr,Ur]),Br={enabled:!0,max_bytes:32768};function zr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Br.enabled,max_bytes:Hr(t.max_bytes,Br.max_bytes)}:i({},Br)}class qr{constructor(t){this.Vn=[],this.Gn=0,this.qi=zr(t)}setConfig(t){this.qi=zr(t),this.Zn()}add(t){var e=function(t){var e;try{e=ue(t)}catch(t){return}try{var i=JSON.parse(e);if(!pe(i))return;var r=i,s=r[Lr],n=r[Ur];if(!me(s)||0===s.trim().length)return;if(!me(n)&&!xe(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.qi.max_bytes||(this.Vn.push({step:e.step,bytes:i}),this.Gn+=i,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,e){if(!xe(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Vr=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={F(e){if(wt&&(s.DEBUG||wt.POSTHOG_DEBUG||i)&&!ge(wt.console)&&wt.console){for(var r=("__rrweb_original__"in wt.console[e]?wt.console[e].__rrweb_original__:wt.console[e]),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,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>Vr(t+" "+e,i)};return r},Wr=Vr("[PostHog.js]"),Gr=Wr.createLogger;function Kr(t,e){ce(t)&&t.forEach(e)}function Jr(t,e){if(!we(t))if(ce(t))t.forEach(e);else if(ke(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)de.call(t,i)&&e(t[i],i)}var Yr=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Qr(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Xr=function(t){try{return t()}catch(t){return}},Zr=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}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 e={};return Jr(t,(function(t,i){(me(t)&&t.length>0||xe(t))&&(e[i]=t)})),e};var es=["herokuapp.com","vercel.app","netlify.app"];function is(t){var e=null==t?void 0:t.hostname;if(!me(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of es)if(i===r)return!1;return!0}function rs(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}function ss(t){return"ph_toolbar_internal"===t.name}var ns=t=>{if(Et){try{for(var e=t+"=",i=Et.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.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 xe(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,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>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|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new os(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(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 e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class as{generate(){var t=this.generateOrAbort();if(!ge(t))return t;this.Rr=0;var e=this.generateOrAbort();if(ge(e))throw new Error("Could not generate UUID after timestamp reset");return e}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 hs}}var ls,us=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};wt&&!ge(wt.crypto)&&crypto.getRandomValues&&(us=t=>crypto.getRandomValues(t));class hs{nextUint32(){return this.ft.length>this.Fr||(us(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:()=>!!Et,jr(t){Wr.error("cookieStore error: "+t)},Pr:ns,Br(t){var e;try{e=JSON.parse(ps.Pr(t))||{}}catch(t){}return e},Dr(t,e,i,r,s){if(!Et)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=Et),cs)return cs;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+ds();!cs&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",cs=n)}return cs}(t);if(!i){var r=(t=>{var e=t.match(fs);return e?e[0]:""})(t);r!==i&&Wr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(Et.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Wr.warn("cookieStore warning: large cookie, len="+u.length),Et.cookie=u,!0}catch(t){return!1}},qr(t,e){if(null!=Et&&Et.cookie)try{ps.Dr(t,"",-1,e)}catch(t){return}}},_s=null,gs={Nr(){if(!be(_s))return _s;var t=!0;if(ge(wt))t=!1;else try{var e="__mplssupport__";gs.Dr(e,"xyz"),'"xyz"'!==gs.Pr(e)&&(t=!1),gs.qr(e)}catch(e){t=!1}return t||Wr.error("localStorage unsupported; falling back to cookie store"),_s=t,t},jr(t){Wr.error("localStorage error: "+t)},Pr(t){try{return null==wt?void 0:wt.localStorage.getItem(t)}catch(t){gs.jr(t)}return null},Br(t){try{return JSON.parse(gs.Pr(t))||{}}catch(t){}return null},Dr(t,e){try{return null==wt||wt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){gs.jr(t)}return!1},qr(t){try{null==wt||wt.localStorage.removeItem(t)}catch(t){gs.jr(t)}}},ms=[L,C,R,I,A,F,Y,J,G],ys=[a,o,T,P,rt,it,Q],bs=t=>t+"_cpm",ws=["__proto__","constructor","prototype"],xs=t=>{if(!pe(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===ws.indexOf(i)&&(e[i]=t[i])})),e},Ss=function(t,e){void 0===e&&(e=[]);var i={};return[...ys,...e].forEach((e=>{var r=t[e];ge(r)||be(r)||""===r||(i[e]=r)})),i},Es=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},ks=(t,e)=>({p:e,f:Es(JSON.stringify(t))}),Ts=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=ps.Br(bs(t)),r=(null==i?void 0:i.f)===Es(e)&&ce(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},$s=(t,e)=>e+"|"+(ps.Pr(bs(t))||""),Ps={},Rs={Nr:()=>!0,jr(t){Wr.error("memoryStorage error: "+t)},Pr:t=>Ps[t]||null,Br:t=>Ps[t]||null,Dr:(t,e)=>(Ps[t]=e,!0),qr(t){delete Ps[t]}},Cs=null,Os={Nr(){if(!be(Cs))return Cs;if(Cs=!0,ge(wt))Cs=!1;else try{var t="__support__";Os.Dr(t,"xyz"),'"xyz"'!==Os.Pr(t)&&(Cs=!1),Os.qr(t)}catch(t){Cs=!1}return Cs},jr(t){Wr.error("sessionStorage error: ",t)},Pr(t){try{return null==wt?void 0:wt.sessionStorage.getItem(t)}catch(t){Os.jr(t)}return null},Br(t){try{return JSON.parse(Os.Pr(t))||null}catch(t){}return null},Dr(t,e){try{return null==wt||wt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Os.jr(t)}return!1},qr(t){try{null==wt||wt.sessionStorage.removeItem(t)}catch(t){Os.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===ht}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,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get fs(){var t=this.ps.Pr(this.gs);return Fe(t)?1:oe(Me,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,e="localStorage"===t?gs:ps;if(!this.ys||this.ys!==e){this.ys=e;var i="localStorage"===t?ps:gs;i.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(Fe(i.Pr(this.gs))),i.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,At.doNotTrack].some((t=>Fe(t)))}}function As(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!fe(r))return e;try{var s=r(e);return me(s)&&s?s:e}catch(t){return Wr.error("Error in get_current_url, falling back to window.location.href",t),e}}var Fs="__POSTHOG_TOOLBAR__",Ms=1,Ds=3,Ns=11;function Ls(t){return t instanceof Element&&(t.id===Fs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Us(t){return!!t&&t.nodeType===Ms}function js(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Bs(t){return!!t&&t.nodeType===Ds}function zs(t){return!!t&&t.nodeType===Ns&&Us(t.host)}var qs=1e3;function Hs(t){return t?ae(t).split(/\s+/):[]}function Vs(t,e){var i=function(t){var e,i=null==wt||null==(e=wt.location)?void 0:e.href;return ge(i)?void 0:As(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function Ws(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Hs(e)}function Gs(t){return we(t)?null:ae(t).split(/(\s+)/).filter((t=>mn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ks(t){var e="";return un(t)&&!hn(t)&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var i;Bs(t)&&t.textContent&&(e+=null!==(i=Gs(t.textContent))&&void 0!==i?i:"")})),ae(e)}function Js(t){var e;return ge(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Ys=["a","button","form","input","select","textarea","label"];function Qs(t,e){if(ge(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function Xs(t){var e=t.parentNode;return!(!e||!Us(e))&&e}var Zs=[".ph-no-autocapture","[data-ph-no-autocapture]"],tn=["next","previous","prev",">","<"],en=[...tn,"+","-","−","–"],rn=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,sn=[".ph-no-rageclick",".ph-no-capture"],nn=["","text","search","email","password","url","tel","number"];function on(t,e){if(!wt||an(t))return!1;var i,r,s,n,o;if(Ee(e)?(i=!!e&&sn,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:sn,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!Us(t))&&(!!js(t,"textarea")||(js(t,"input")?oe(nn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var a=ln(t,!1).targetElementList;return!function(t,e){if(!1===t||ge(t))return!1;var i;if(!0===t)i=tn;else{if(!ce(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;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var e=t.safeText,r=t.ariaLabel;return i.some((t=>rn(e,t)||rn(r,t)))}))}(r,a.map((t=>{var e;return{safeText:Ks(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Qs(a,i)}var an=t=>!t||js(t,"html")||!Us(t),ln=(t,e)=>{if(!wt||an(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!js(s,"body");)if(zs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Xs(s);if(!n)break;if(e||Ys.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=wt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function un(t){for(var e=new Set,i=0,r=t;r.parentNode&&!js(r,"body");r=r.parentNode){if(i++>=qs||e.has(r))return!1;e.add(r);var s=Ws(r);if(oe(s,"ph-sensitive")||oe(s,"ph-no-capture"))return!1}if(oe(Ws(t),"ph-include"))return!0;var n=t.type||"";if(me(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!me(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 hn(t){return!!(js(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||js(t,"select")||js(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"),_n=/[0-9A-Za-z_]/;function gn(t){for(var e=0,i=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;i&&(s*=2)>9&&(s-=9),e+=s,i=!i}return e%10==0}function mn(t,e){if(void 0===e&&(e=!0),we(t))return!1;if(me(t)){t=ae(t);var i=e?dn.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(vn.lastIndex=0;e=vn.exec(t);){var i=e[2];if(i)for(var r=i.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)&&gn(a))return!0}}}return!1}(t);if(i)return!1;var r=e?fn.test(t):function(t){var e;for(pn.lastIndex=0;e=pn.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&_n.test(i)&&_n.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function yn(t){var e=Ks(t);return mn(e=(e+" "+bn(t)).trim())?e:""}function bn(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Ks(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+bn(t)).trim())}catch(t){Wr.error("[AutoCapture]",t)}})),e}function wn(t){return t.replace(/"|\\"/g,'\\"')}function xn(t){var e=t.attr__class;if(e)return ce(e)?e:Hs(e)}var Sn=Gr("[Dead Clicks]"),En=()=>!0,kn=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return Ee(r)?r:!!pe(r)||i};class Tn{get lazyLoadedDeadClicksAutocapture(){return this.bs}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[g]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s((()=>{this.ws()})):this.stop()}_s(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Sn.error("failed to load script",e):t()}))}ws(){var t;if(Et){if(!this.bs&&null!=(t=At.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=pe(this.instance.config.capture_dead_clicks)?i({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.bs=At.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.bs.start(Et),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 $n=Gr("[SegmentIntegration]");var Pn="posthog-js";function Rn(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,u=r.sendExceptionsToPostHog,h=void 0===u||u;return e=>{var r,a,u,d,v;if("*"!==l&&!l.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=e.exception)?void 0:r.values)||[],_=p.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),h&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),e}}class Cn{constructor(t,e,i,r,s,n){this.name=Pn,this.setupOnce=function(o){o(Rn(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class On{constructor(t){this.ks=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Wr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),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,e){var i,r=this.Ts(t,e);return this.Ss={pathname:null!==(i=null==wt?void 0:wt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Ts(t,null==(e=this.Ss)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,e){var i=this.Ss;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.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,u=s.lastContentY,h=s.maxContentY;if(!(ge(n)||ge(o)||ge(a)||ge(l)||ge(u)||ge(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?De(o/n,0,1,Wr):1,v=n>1?De(a/n,0,1,Wr):1,c=l>1?De(u/l,0,1,Wr):1,f=l>1?De(h/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:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var In=["flags","surveys"],An={[n]:{exposure:"hidden"},[u]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[h]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[T]:{exposure:"hidden"},[P]:{exposure:"event"},[w]:{exposure:"event",shouldSkipFromEventProperties:t=>be(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"},[R]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden",storageGroup:"flags"},[O]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[M]:{exposure:"hidden",storageGroup:"flags"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden"},[L]:{exposure:"hidden"},[U]:{exposure:"hidden"},[B]:{exposure:"hidden",storageGroup:"surveys"},[z]:{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"},[j]:{exposure:"event"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden"},[it]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"event"},[E]:{exposure:"event"},[k]:{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"}},Fn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mn=t=>{var e=An[t];if(e)return e;for(var i of Fn){var r=i[1];if(0===t.indexOf(i[0]))return r}},Dn=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return ue(t)}},Nn=t=>{var e=null==Et?void 0:Et.createElement("a");return ge(e)?null:(e.href=t,e)},Ln=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!ce(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Wr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Un=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");ce(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},jn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Bn=(t,e)=>t>=e&&Ot(),zn=(t,e,i,r)=>{if(0===t){if(Ot()){var s=e+1;return s===i&&r(),s}return e}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,e,i){if(!Et)return{};var r,s=e?[...Hn,...i||[]]:[],n=Jn(Un(Et.URL,s,Wn),t),o=(r={},Jr(Gn,(function(t){var e=ns(t);r[t]=e||null})),r);return Yr(o,n)}function Jn(t,e){var i=Vn.concat(e||[]),r={};return Jr(i,(function(e){var i=Ln(t,e);r[e]=i||null})),r}function Yn(t){var e=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),i="yahoo"!=e?"q":"p",r={};if(!be(e)){r.$search_engine=e;var s=Et?Ln(Et.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Qn(){return navigator.language||navigator.userLanguage}var Xn="$direct";function Zn(){return(null==Et?void 0:Et.referrer)||Xn}function to(t,e,i){void 0===i&&(i=!1);var r=t?[...Hn,...e||[]]:[],s=i?Hi(null==kt?void 0:kt.href):null==kt?void 0:kt.href,n=null==s?void 0:s.substring(0,1e3);return{r:Zn().substring(0,1e3),u:n?Un(n,r,Wn):void 0}}function eo(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Hi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==Xn?Xn:null==(i=Nn(r))?void 0:i.host};if(n){o.$current_url=n;var a=Nn(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 u=Yn(r);Yr(o,u)}return o}function io(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ro(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var so={flags:Y,surveys:z},no=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],oo=t=>t+"_cookie_identity_change_pending",ao="main",lo=(t,e)=>{Jr(t,((i,r)=>{var s=Mn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class uo{constructor(t,e,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 e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.ps=this.Os(t),this.Is=this.Ds(t),this.load(),t.debug&&Wr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),wt){var s=()=>this.flush();rs(wt,"beforeunload",s,{capture:!1}),rs(wt,"pagehide",s,{capture:!1})}}$s(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return xe(e)&&e>0?e:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var e=Ss(t,this.qi.cookie_persisted_properties||[]),i=ks(e,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=ps.Pr(this.Ls)||void 0;s&&$s(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?$s(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,e){if(void 0===e&&(e=!1),this.Hs&&!e||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=ps.Pr(this.Ls)||void 0}catch(t){}if(!i||i===this.js)return!1;var r,s=$s(this.Ls,i);try{r=xs(JSON.parse(i))}catch(t){return!1}if((ps.Pr(this.Ls)||void 0)!==i)return!1;this.qs=s,this.js=i;var n=Ts(this.Ls,i),a=[...ys,...n.properties],l={};if(Object.keys(r).forEach((t=>{var e=r[t];(ge(e)||be(e)||""===e||t===Q&&e!==vt&&e!==ct)&&(l[t]=!0,delete r[t])})),_e(r))return!1;var h=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]&&(h||t!==o&&t!==Q)){var e=c[t];!n.isValid&&-1!==ys.indexOf(t)&&(!1===e||0===e)||delete c[t]}})),this.props=Yr(c,r),!h||Q in r||Q in this.props||this.Us(Q,vt);var f=this.props[o],p=this.props[Q];return!h||f===d&&p===v||(this.Rs=!0,Os.Dr(oo(this.Ls),!0),this.zs(L),this.zs(C),this.zs(R),this.zs(I),this.zs(A),this.zs(F),this.zs(Y),this.zs(J),this.zs(G),p===vt&&(v===ct||r[Q]===vt||!ge(d)&&f!==d)&&(lo(this.props,r),this.zs(U)),p===ct?this.props.$user_id=f:delete this.props.$user_id,this.zs(u)),!0}consumeCookieIdentityChange(){var t=oo(this.Ls),e=this.Rs||!!Os.Pr(t);return this.Rs=!1,e&&Os.qr(t),e}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&&(ge(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():ge(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 e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...ys,...t];return i({},gs,{Br(t){try{var i,s={};try{i=ps.Pr(t)||void 0,s=i?xs(JSON.parse(i)):{}}catch(t){}var n,a=JSON.parse(gs.Pr(t)||"{}");if(e){var l=Ts(t,i),u=[...ys,...l.properties],h={};Object.keys(s).forEach((t=>{var e=s[t];be(e)||""===e||t===Q&&e!==vt&&e!==ct||(h[t]=e)}));var d=o in h||h[Q]===vt||h[Q]===ct;if(Object.keys(h).length>0){var v,c=a[o],f=null!==(v=a[Q])&&void 0!==v?v:vt;r.forEach((t=>{if(-1!==u.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==Q)){var e=a[t];!l.isValid&&-1!==ys.indexOf(t)&&(!1===e||0===e)||delete a[t]}})),!d||Q in s||Q in a||(a[Q]=vt),!d||(o in h?h[o]:a[o])===c&&(Q in h?h[Q]:a[Q])===f||(ms.forEach((t=>delete a[t])),h[Q]===ct&&o in h?a.$user_id=h[o]:delete a.$user_id,h[Q]!==ct&&(delete a[j],delete a[U]),delete a.__alias)}n=Yr(a,h)}else n=Yr(s,a);return gs.Dr(t,n),n}catch(t){}return null},Dr(i,r,s,n,o,a){var l=gs.Dr(i,r,void 0,void 0,a);try{var u=Ss(r,t);if(Object.keys(u).length){if(e){var h=bs(i),d=ks(u,t);if(ps.Dr(h,d,s,n,o,a),ps.Pr(h)!==JSON.stringify(d)){ps.qr(h,n);var v=Ss(r);return ps.Dr(i,v,s,n,o,a),l}}ps.Dr(i,u,s,n,o,a)}}catch(t){gs.jr(t)}return l},qr(t,e){try{null==wt||wt.localStorage.removeItem(t),ps.qr(t,e),ps.qr(bs(t),e)}catch(t){gs.jr(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&gs.Nr()?(e=gs,s=!0):"localstorage+cookie"===n&&r.Nr()?(e=r,s=!0):"sessionstorage"===n&&Os.Nr()?e=Os:"memory"===n?e=Rs:"cookie"===n?e=ps:r.Nr()?(e=r,s=!0):e=ps,this.Es=s,e}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return Jr(this.props,((e,i)=>{var r=Mn(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Hs||t){var e=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),i=e?gs.Br(this.Ls):null,r={};if(e)try{Jr(r=xs(ps.Br(this.Ls)),((t,e)=>{(ge(t)||be(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=Yr({},s)),this.Is&&this.Ks(),e&&s){var n,a,l=null==i?void 0:i[o],u=null!==(n=null==i?void 0:i[Q])&&void 0!==n?n:vt,h=s[o],d=null!==(a=s[Q])&&void 0!==a?a:vt;if(h!==l||d!==u){this.Rs=!0,Os.Dr(oo(this.Ls),!0);var v=Yr({},this.props);ms.forEach((t=>delete v[t])),d===vt&&(u===ct||r[Q]===vt||!ge(l)&&h!==l)&&(lo(v,r),delete v[U]),this.props=v;var c=new Set;ms.forEach((t=>{var e,i=null==(e=Mn(t))?void 0:e.storageGroup;i&&c.add(i)})),c.forEach((t=>{var e={};Jr(this.props,((i,r)=>{var s;(null==(s=Mn(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),_e(e)?(gs.qr(this.Js(t)),this.Ms[t]={}):gs.Dr(this.Js(t),e)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(e,t)})}))}}Os.Pr(oo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of In){var e=gs.Br(this.Js(t));if(e&&!_e(e)){var i=this.Xs(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Ys(e,t)),this.ea(t,e)||Yr(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Mn(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=so[t];if(!i)return!1;var r=e[i],s=this.props[i];return xe(r)&&xe(s)&&s>r}refreshKey(t){var e;if(!this.Hs){var i=this.Is?null==(e=Mn(t))?void 0:e.storageGroup:void 0,r=i?gs.Br(this.Js(i)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(i){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?ge(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){ge(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(),e=t.main,i=t.groups;for(var r of(this.ra(this.ps,this.Ls,e,ao)&&this.Ns(e),In)){var s,n=i[r];(!_e(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(gs,this.Js(r),n,r)}}na(){var t={},e={flags:{},surveys:{}};return Jr(this.props,((i,r)=>{var s,n=null==(s=Mn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ys(t,e){if(e===ao)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var i={};return Jr(t,((t,e)=>{var r;i[e]=null!=(r=Mn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Xs(r);if(r!==ao&&!n.dirty&&!ge(n.fingerprint))return!1;try{if((s=this.Ys(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(e,i,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==ao&&(n.persisted=!0),ge(s)||(n.fingerprint=s),!0):(this.qi.debug&&Wr.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(ge(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!i&&this.As)for(var r of In)gs.qr(this.Js(r));i?delete this.Ms[ao]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(pe(t)){this.syncCookieProperties(),ge(e)&&(e="None"),this.sa=ge(i)?this.la:i;var r=!1;if(Jr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Us(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(pe(t)){this.syncCookieProperties(),this.sa=ge(e)?this.la:e;var i=!1;if(Jr(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||pe(e)||ce(e))&&(this.Us(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.zs(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==Et?void 0:Et.URL;if(t!==this.Fs){var e=Kn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);_e(ts(e))||this.register(e),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==Et?void 0:Et.referrer)?Yn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Zn(),$referring_domain:null!=Et&&Et.referrer&&(null==(t=Nn(Et.referrer))?void 0:t.host)||Xn},void 0)}set_initial_person_info(){this.props[tt]||this.props[et]||this.register_once({[it]: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([et,tt],(e=>{var i=this.props[e];i&&Jr(i,(function(e,i){t["$initial_"+le(i)]=e}))}));var e=this.props[it];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=eo(t,e),r={};return Jr(i,(function(t,e){r["$initial_"+le(e)]=t})),r}(e,this.qi.disable_capture_url_hashes);Yr(t,i)}return t}safe_merge(t){return Jr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,u=!!this.Hs&&!l;l||this.Bs(e,u),this.qi=t,!l&&(s||n||a)&&(this.qs=void 0,this.js=void 0,this.Bs(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),u));var h=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(u);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=h,this.Is=d,this.props=f,this.save()}else a&&(this.ps=h,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,e){var i=this.props[h]||{};i[t]=e,this.Us(h,i),this.save()}remove_event_timer(t){var e=this.props[h]||{},i=e[t];return ge(i)||(delete e[t],this.Us(h,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Us(t,e),this.save()}Us(t,e){var i;this.props[t]=e,null!=(i=Mn(t))&&i.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var e,i=null==(e=Mn(t))?void 0:e.storageGroup;i&&(this.Xs(i).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function ho(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&fe(i.then)&&i.then(void 0,(()=>{}))}}}}var vo={GZipJS:"gzip-js",Base64:"base64"},co={Activation:"events",Cancellation:"cancelEvents"},fo={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},po={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},_o={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},go={Popover:"popover",Inline:"inline"},mo={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},yo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},bo=Gr("[RateLimiter]");class wo{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).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:e})}},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 e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(Z))&&void 0!==e?e:{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 u=(xe(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.ha(u)&&(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 e=this.instance.config.property_denylist;return!ce(e)||!e.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=kt&&kt.pathname)return""+(null!==(t=kt.origin)&&void 0!==t?t:"")+kt.pathname}ha(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):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 e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var xo=Gr("[RemoteConfig]");class So{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.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()&&Et&&"hidden"!==Et.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.ya=setInterval((()=>{this.refresh()}),e))}}pa(t,e){!t&&e&&(0===e.statusCode?e.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 i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){xo.error("Error loading feature flags",t)}}}var Eo=Uint8Array,ko=Uint16Array,To=Uint32Array,$o=new Eo([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]),Po=new Eo([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]),Ro=new Eo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Co=function(t,e){for(var i=new ko(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new To(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Oo=Co($o,2),Io=Oo[1];Oo[0][28]=258,Io[258]=28;for(var Ao=Co(Po,0)[1],Fo=new ko(32768),Mo=0;32768>Mo;++Mo){var Do=(43690&Mo)>>>1|(21845&Mo)<<1;Fo[Mo]=((65280&(Do=(61680&(Do=(52428&Do)>>>2|(13107&Do)<<2))>>>4|(3855&Do)<<4))>>>8|(255&Do)<<8)>>>1}var No=function(t,e,i){for(var r=t.length,s=0,n=new ko(e);r>s;++s)++n[t[s]-1];var o,a=new ko(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new ko(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[Fo[d]>>>l]=u}else for(o=new ko(r),s=0;r>s;++s)o[s]=Fo[a[t[s]-1]++]>>>15-t[s];return o},Lo=new Eo(288);for(Mo=0;144>Mo;++Mo)Lo[Mo]=8;for(Mo=144;256>Mo;++Mo)Lo[Mo]=9;for(Mo=256;280>Mo;++Mo)Lo[Mo]=7;for(Mo=280;288>Mo;++Mo)Lo[Mo]=8;var Uo=new Eo(32);for(Mo=0;32>Mo;++Mo)Uo[Mo]=5;var jo=No(Lo,9,0),Bo=No(Uo,5,0),zo=function(t){return(t/8>>0)+(7&t&&1)},qo=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof ko?ko:t instanceof To?To:Eo)(i-e);return r.set(t.subarray(e,i)),r},Ho=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Vo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Wo=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Eo(0),0];if(1==s){var o=new Eo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={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 ko(v+1),f=Go(i[h-1],c,0);if(f>e){r=0;var p=0,_=f-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<f-c[m]),c[m]=e}for(p>>>=_;p>0;){var y=n[r].s;e>c[y]?p-=1<<e-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p)}f=e}return[new Eo(c),f]},Go=function(t,e,i){return-1==t.s?Math.max(Go(t.l,e,i+1),Go(t.r,e,i+1)):e[t.s]=i},Ko=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new ko(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++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[i.subarray(0,r),e]},Jo=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Yo=function(t,e,i){var r=i.length,s=zo(e+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]=i[n];return 8*(s+4+r)},Qo=function(t,e,i,r,s,n,o,a,l,u,h){Ho(e,h++,i),++s[256];for(var d=Wo(s,15),v=d[0],c=d[1],f=Wo(n,15),p=f[0],_=f[1],g=Ko(v),m=g[0],y=g[1],b=Ko(p),w=b[0],x=b[1],S=new ko(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=Wo(S,7),T=k[0],P=k[1],R=19;R>4&&!T[Ro[R-1]];--R);var C,O,I,A,F=u+5<<3,M=Jo(s,Lo)+Jo(n,Uo)+o,D=Jo(s,v)+Jo(n,p)+o+14+3*R+Jo(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(M>=F&&D>=F)return Yo(e,h,t.subarray(l,l+u));if(Ho(e,h,1+(M>D)),h+=2,M>D){C=No(v,c,0),O=v,I=No(p,_,0),A=p;var N=No(T,P,0);for(Ho(e,h,y-257),Ho(e,h+5,x-1),Ho(e,h+10,R-4),h+=14,E=0;R>E;++E)Ho(e,h+3*E,T[Ro[E]]);h+=3*R;for(var L=[m,w],U=0;2>U;++U){var j=L[U];for(E=0;j.length>E;++E)Ho(e,h,N[B=31&j[E]]),h+=T[B],B>15&&(Ho(e,h,j[E]>>>5&127),h+=j[E]>>>12)}}else C=jo,O=Lo,I=Bo,A=Uo;for(E=0;a>E;++E)if(r[E]>255){var B;Vo(e,h,C[257+(B=r[E]>>>18&31)]),h+=O[B+257],B>7&&(Ho(e,h,r[E]>>>23&31),h+=$o[B]);var z=31&r[E];Vo(e,h,I[z]),h+=A[z],z>3&&(Vo(e,h,r[E]>>>5&8191),h+=Po[z])}else Vo(e,h,C[r[E]]),h+=O[r[E]];return Vo(e,h,C[256]),h+O[256]},Xo=new To([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zo=function(){for(var t=new To(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ta=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ea(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Zo[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new Eo(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Yo(l,u,t.subarray(h,d)):(l[h]=!0,u=Yo(l,u,t.subarray(h,o)))}else{for(var v=Xo[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new ko(32768),g=new ko(p+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&p},w=new To(25e3),x=new ko(288),S=new ko(32),E=0,k=0,T=(h=0,0),P=0,R=0;o>h;++h){var C=b(h),O=32767&h,I=g[C];if(_[O]=I,g[C]=O,h>=P){var A=o-h;if((E>7e3||T>24576)&&A>423){u=Qo(t,l,0,w,x,S,k,T,R,h-R,u),T=E=k=0,R=h;for(var F=0;286>F;++F)x[F]=0;for(F=0;30>F;++F)S[F]=0}var M=2,D=0,N=f,L=O-I&32767;if(A>2&&C==b(h-L))for(var U=Math.min(c,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=L&&--N&&O!=I;){if(t[h+M]==t[h+M-L]){for(var z=0;B>z&&t[h+z]==t[h+z-L];++z);if(z>M){if(M=z,D=L,z>U)break;var q=Math.min(L,z-2),H=0;for(F=0;q>F;++F){var V=h-L+F+32768&32767,W=V-_[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(O=I)-(I=_[O])+32768&32767}if(D){w[T++]=268435456|Io[M]<<18|Ao[D];var G=31&Io[M],K=31&Ao[D];k+=$o[G]+Po[K],++x[257+G],++S[K],P=h+M,++E}else w[T++]=t[h],++x[t[h]]}}u=Qo(t,l,!0,w,x,S,k,T,R,h-R,u)}return qo(a,0,r+zo(u)+s)}(n=t,null==(o=e).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)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ta(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),ta(u,h-8,i.d()),ta(u,h-4,r),u}var ia=!!$t||!!Tt,ra="text/plain",sa=!1,na=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},oa=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),u=null!==(s=null==a?void 0:a.split("&").map((t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],h=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Jr(t,(function(t,e){ge(t)||ge(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(l);return h&&u.push(h),u.length>0?o+"?"+u.join("&"):o},aa=t=>{if(t.ba)return t.ba;var e=t.data,i=t.compression;if(e){if(i===vo.GZipJS){var r=ea(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Eo(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Eo(s+8+(i-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(e)),{mtime:0});return{contentType:ra,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===vo.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Dn(e)),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(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},la=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:oa(t.url,{compression:vo.Base64}),encodedBody:aa(i({},t,{compression:vo.Base64,ba:void 0}))}:{url:na(t.url,"compression"),encodedBody:aa(i({},t,{compression:void 0,ba:void 0}))};try{e=aa(t)}catch(e){if(Vt(t.compression,Ln(t.url,"compression")))return Wr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Vt(t.compression,Ln(t.url,"compression"))&&!((r=e.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:e}},ua=t=>{try{return la(t)}catch(e){return Wr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},ha=function(){var t=e((function*(t){var e=Dn(t.data),r=yield function(t,e,i){return Jt.apply(this,arguments)}(e,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return i({},t,{ba:{contentType:ra,body:n,estimatedSize:n.byteLength}})}));return function(e){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 e=ua(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,u=new Headers;Jr(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var h=null,d=!1;if(Pt){var v=new Pt;h={signal:v.signal,timeout:setTimeout((()=>{var e,i;d=!0,v.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var c=e=>{d&&"AbortError"===(null==e?void 0:e.name)||va(e)?Wr.warn(e):Wr.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;Tt(r,i({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t._a&&52428.8>(l||0),body:a,signal:null==(f=h)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Wr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>h?clearTimeout(h.timeout):null))}catch(t){h&&clearTimeout(h.timeout),c(t)}}},fa=t=>{try{var e,r=la(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(St.sendBeacon(s,u))return;var h=ce(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(ce(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>ce(t.data)?e:i({},t.data,{batch:e});return fa(i({},t,{data:v(h.slice(0,d))})),void fa(i({},t,{data:v(h.slice(d))}))}Wr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ca(i({},t,{_a:!0}))}catch(t){Wr.warn("Beacon send failed",t)}},pa=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return oa(r===vo.GZipJS?na(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===vo.GZipJS?{}:{compression:r}))},_a=[];Tt&&_a.push({transport:"fetch",method:ca}),$t&&_a.push({transport:"XHR",method(t){var e=ua(t);if(e){var i=new $t,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Jr(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}}}),null!=St&&St.sendBeacon&&_a.push({transport:"sendBeacon",method:fa});var ga=3e3;class ma{constructor(t,e){this.wa=!0,this.ka=[],this.Sa=De((null==e?void 0:e.flush_interval_ms)||ga,250,5e3,Wr.createLogger("flush interval"),ga),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(i({},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 e=this.Ea(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&ce(i.data)&&Jr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(i)};for(var r in e)i()}}),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,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ge(t[n])&&(t[n]=i({},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,!ge(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 e=t.retriesPerformedSoFar,s=r(t,ya);Se(e)&&(s.url=oa(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.xn(i({retriesPerformedSoFar:e},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!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}xn(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;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(),e=[],i=this.ka.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.ka=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,ge(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 e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Wr.error(t)}}this.ka=[]}}class wa{constructor(t){this.Na=()=>{var t,e,i,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!==(e=this.qa.maxScrollHeight)&&void 0!==e?e:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(i=this.qa.maxContentY)&&void 0!==i?i: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=ce(this.ja)?this.ja:[this.ja];for(var e of t){var i=null==wt?void 0:wt.document.querySelector(e);if(i)return i}}Ba(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.ja){var i=this.scrollElement();return i&&i[e]||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,e,i,r){this.ot=t=>{var e=this.Ha();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ua(this._instance)};this.za.register({[X]:i})}},this._instance=t,this.Wa=e,this.za=i,this.Ua=r||xa,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[X]}getSetOnceProps(){var t,e=null==(t=this.Ha())?void 0:t.props;return e?"r"in e?eo(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return Jr(ts(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+le(i)]=e})),t}}class Ea{on(t,e){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(e),()=>{this.Va[t]=this.Va[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Va[t]||[])i(e);for(var r of this.Va["*"]||[])r(t,e)}constructor(){this.Va={}}}var ka=Gr("[SessionId]"),Ta=864e5;class $a{on(t,e){return this.Ga.on(t,e)}constructor(t,e,i){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new Ea,this.Xa=(t,e)=>!(!Se(t)||!Se(e))&&Math.abs(t-e)>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=e||ds,this.ro=i||ds;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*De(this.qi.session_idle_timeout_seconds||1800,60,36e3,ka.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=Os.Br(this.so),o=Os.Br(this.ao);n&&!o?this.st=n:Os.qr(this.so),Os.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 ge(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((e=>e!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&Os.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Os.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Os.Br(this.so):null}do(t){var e=this.Za;return!be(e)&&!be(t)&&5e3>Math.abs(t-e)}vo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.do(e)||(this.Za=e,this.za.register({[T]:[e,t,i]}))}co(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return Se(e)&&e>0}fo(){this.co()?this.za.refreshKey(T):(this.za.flush(),this.za.load())}po(){var t;if(!be(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var e=this.mo();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[T]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],e=Se(t)?t:0,i=Se(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[T];return ce(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,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void ka.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void ka.error("Invalid sessionID in bootstrap",t)}}(t);return!ge(i)&&(e?this.eo={sessionId:t,sessionStartTimestamp:i}:this.vo(t,(new Date).getTime(),i),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&wt&&(wt.removeEventListener(_t,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Os.qr(this.ao)},rs(wt,_t,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.qi.cookieless_mode===dt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.Qa=r;else if(be(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],u=a[2],h=!ge(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ta),p=c?f:Se(u)&&Math.abs(r-u)>Ta,_=!1,g=h,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||ka.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.mo();l=w[1],u=w[2]}if(m||b||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.io(),v=this.ro(),ka.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),u=x?c.sessionStartTimestamp:r,this.eo=void 0,_=!0}else v||(v=this.ro(),_=!0),(g=g||l!==y)&&(ka.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var S=Se(d)&&t&&!p?d:r,E=Se(u)?u:(new Date).getTime();this.uo(v),this.vo(l,S,E),t||this.no();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.Ja.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k: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 Pa=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&ne(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>ne(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Ra(){return(Ra=e((function*(){var t=null==St?void 0:St.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return me(i)&&i.length>0?i:void 0}catch(t){return void Wr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ca(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var Oa=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},Ia=t=>t.toLowerCase(),Aa={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Oa(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Oa(e,t))))),icontains:(t,e)=>e.map(Ia).some((e=>t.map(Ia).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Ia).every((e=>t.map(Ia).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))};function Fa(t,e){return!t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(null==r)return!1;var s=Aa[i.operator];return!!s&&s(i.values,[String(r)])}))}function Ma(t,e,i){return Dn({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Da="custom",Na="i.posthog.com",La=/^\/static\//,Ua=["/s/","/e/","/i/"];class ja{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,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Na,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}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 e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}So(t){var e=Nn(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}xo(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Nn(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&Ua.some((t=>0===e.indexOf(t)))){var a=this.So(r);if(a){var l,u=this.apiHost,h=this.Co;(null==(l=h)?void 0:l.apiHost)===u&&h.rewriteRequestPath===s||(h={apiHost:u,rewriteRequestPath:s,urls:new Set},this.Co=h),h.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Co,i=this.So(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.xo(t,e,this.uiHost+e);if("flags"===t)return this.xo(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.ko(e);if(i)return this.xo(t,e,""+i+e)}if(this.region===Da)return this.xo(t,e,this.apiHost+e);var r=Na+e;switch(t){case"assets":return this.xo(t,e,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,e,"https://"+this.region+"."+r)}}}var Ba=Gr("[Surveys]"),za="seenSurvey_",qa=t=>{try{var e=(t=>((t,e)=>""+za+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Ba.error("Failed to persist survey seen state",t)}},Ha=[fo.Popover,fo.Widget,fo.API],Va={ignoreConditions:!1,ignoreDelay:!1,displayType:go.Popover},Wa=Gr("[PostHog ExternalIntegrations]"),Ga={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ka{constructor(t){this._instance=t}_s(t,e){var i;null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Wa.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=At.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t._s(Ga[n],(()=>{var e;null==(e=At.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=At.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=At.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class Ja{constructor(t,e){this.I=t,this.ns=e,this.To=new Map,this.Xn=!1}add(t){var i=this;return e((function*(){if(i.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.To.set(t.name,t);try{var e=t.setup(i.ns);e&&(yield e)}catch(e){var r=i.To.get(t.name)===t;r&&i.To.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var e of(this.To.clear(),t))this.Mo(e)}}Mo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&fe(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class Ya{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);ge(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.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=>ho(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return ho((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Ro.on(Qa,e);return this.Eo&&e(this.Eo),ho(i)},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,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",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,i,r){var s=this;return e((function*(){r?s.instance.capture(t,i,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return ho(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(Qa,t))}sendRequest(t,i){var r=this;return e((function*(){var e;void 0===i&&(i={});var s=r.instance.requestRouter.endpointFor(null!==(e=i.target)&&void 0!==e?e:"api",t),n={method:i.method,url:i.query?oa(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt};return"sendBeacon"===i.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,el=()=>{},il='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=!ia&&-1===(null==Ct?void 0:Ct.indexOf("MSIE"))&&-1===(null==Ct?void 0:Ct.indexOf("Mozilla")),ul=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:is(null==Et?void 0:Et.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:el,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:kt&&me(null==kt?void 0:kt.search)&&-1!==kt.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==(e=wt.location)?void 0:e.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:ga},error_tracking:{},_onCapture:el},(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))},hl=[["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 e={};for(var i of hl){var r=i[0],s=i[1];ge(t[r])||(e[s]=t[r])}var n=Yr({},e,t),o=t.__preview_external_dependency_versioned_paths;return ge(o)||(ge(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),me(o)&&ge(t.asset_host)&&(n.asset_host=o)),ce(t.property_blacklist)&&(ge(t.property_denylist)?n.property_denylist=t.property_blacklist:ce(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,e){if(t){var i=this.To.indexOf(t);-1!==i&&this.To.splice(i,1)}return this.To.push(e),null==e.initialize||e.initialize(),e}Oo(){return this.config.cookieless_mode===dt||this.config.cookieless_mode===ht&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===st){var t=this.persistence;if(t){this.$o()||t.load(!0);var e=this.get_distinct_id();if(!e||e===st){var i=this.config.get_device_id(ds());this.register({distinct_id:i,$device_id:i}),t.set_property(Q,vt)}this.No()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.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 Ea,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ul(),this.SentryIntegration=Cn,this.sentryIntegration=t=>function(t,e){var i=Rn(t,e);return{name:Pn,processEvent:t=>i(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 On(this),this.rateLimiter=new wo(this),this.requestRouter=new ja(this),this.consent=new Is(this),this.externalIntegrations=new Ka(this);var e=null!==(t=cl.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=me(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=me(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Wr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==al){var r,s=null!==(r=Za[i])&&void 0!==r?r:new cl;return s._init(t,e,i),Za[i]=s,Za[al][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var a,u=me(t)?t.trim():"";if(!u)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 u!==(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('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=ul(e.defaults),e.debug=this.Go(e.debug),this.Zo=e,this.Qo=[],e.person_profiles?this.Wo=e.person_profiles:e.process_person&&(this.Wo=e.process_person);var h=ul(e.defaults),d=dl(e),v=Yr({},h,d,{name:r,token:u});pe(h.rageclick)&&pe(d.rageclick)&&(v.rageclick=Yr({},h.rageclick,d.rageclick)),pe(h.session_recording)&&pe(d.session_recording)&&(v.session_recording=Yr({},h.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=e.disable_compression?void 0:vo.GZipJS;var c=this.$o();if(this.persistence=new uo(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new uo(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Os.Nr()){var f=Os.Br(this.Bo);ce(f)&&f.forEach((t=>{me(t)&&this.jo.add(t)}))}else Os.qr(this.Bo);var p=i({},this.persistence.props),_=i({},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 g=this.Oo();if(g||(this.sessionManager=new $a(this),this.sessionPropsManager=new Sa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(Wr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(g)}),0)):(Wr.info("Initializing extensions synchronously"),this.el(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Wr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:_}),!this.config.identity_distinct_id||null!=(n=e.bootstrap)&&n.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var m=e.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Q);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===vt)this.identify(m);else if(e.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=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Q,e.bootstrap.isIdentifiedID?ct:vt),this.register({distinct_id:m,$device_id:x})}}if(g)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}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||ds();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Q,ct)),e()},s=i.user();"then"in s&&fe(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||$n.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||($n.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&($n.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,gt),identify:t=>e(t,yt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.il())):this.il(),fe(this.config._onCapture)&&this.config._onCapture!==el&&(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 Ra.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(el),this}rl(t){var e=t;return me(e.name)&&fe(e.setup)}nl(t,e){this.rl(t)?e.push((()=>{this.sl().add(t).catch(el)})):this.To.push(t)}tl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=cl.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),fe(this.featureFlags.onReloading)&&fe(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 e,r,s,n,o,a,l,u=performance.now(),h=i({},cl.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.exceptions&&this.To.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new h.exceptions(this)),h.historyAutocapture&&this.To.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.To.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.To.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.To.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.nl(this.autocapture=new h.autocapture(this),d),h.surveys&&this.nl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new h.surveys(this),d),h.logs&&this.To.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new h.logs(this)),h.metrics&&this.To.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new h.metrics(this)),h.conversations&&this.To.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.To.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.To.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.To.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,kn)),h.toolbar&&this.To.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.To.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.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((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.ll(d,u)}ll(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Wr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);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 e;if(!Et||!Et.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 i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=oe(r.supportedCompression,vo.GZipJS)?vo.GZipJS:oe(r.supportedCompression,vo.Base64)?vo.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:ft}),null==(e=this.ul)||e.handleRemoteConfig(t),this.To.forEach((e=>null==e.onRemoteConfig?void 0:e.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!=kt&&kt.hostname){var t=kt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.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,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(mt),null==(i=this.logs)||i.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=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(ge(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 e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,l,u,h,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&ge(n.compression)&&n.data&&(n.compression=vo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(h=(u=(ce(o=n.data)?o:[o]).map((t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=h.properties)?void 0:l.token)&&void 0!==a?a:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),ce(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=pa(n.url,n.method,n.compression,n.timestampMode);var v=_a.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(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.GZipJS&&Rt&&"undefined"!=typeof Promise&&!sa?ha(n).then((t=>{f(t)})).catch((e=>{if(Wt(e))return sa=!0,void f(i({},n,{compression:void 0,url:pa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return Wt(t)||e===qt})(e)&&(sa=!0),f(n)})):c(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):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 e,i=[],r=[],s=[];Kr(t,(t=>{if(t)if(ce(e=t[0]))s.push(t);else if(fe(t))try{t.call(this)}catch(e){Wr.error("Error executing queued PostHog call",t,e)}else ce(t)&&"alias"===e?i.push(t):ce(t)&&-1!==e.indexOf("capture")&&fe(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Kr(t,(function(t){try{if(ce(t[0])){var i=e;Jr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Wr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{tl--}}push(t){if(tl>0&&ce(t)&&me(t[0])){var e=cl.prototype[t[0]];fe(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!ge(t)&&me(t)){this.Do();var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!me(null==e?void 0:e.$current_url)&&(Wr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$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=qi(null==r?void 0:r.uuid,ds),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===gt&&this.config.__preview_capture_bot_pageviews&&u&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),h&&(f.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(M);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var _=null==r?void 0:r.$unset;_&&(f.$unset=_);var g,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=>me(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){if(e!==Object(e))return a?a(e):e;if(!l.has(e)){var r;if(l.add(e),ce(e))r=[],Kr(e,(e=>{r.push(t(e))}));else{var s={};Jr(e,((e,i)=>{l.has(e)||(s[i]=t(e,i))})),r=s}return r}}(o)),f.timestamp=v,ge(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,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return Lt.forEach(r),e.forEach(r),i}(f.properties,ol)),t===po.DISMISSED||t===po.SENT){var w=null==e?void 0:e[_o.SURVEY_ID],x=null==e?void 0:e[_o.SURVEY_ITERATION];qa({id:w,current_iteration:x}),f.$set=i({},f.$set,{[(g={id:w,current_iteration:x},m=t===po.SENT?"responded":"dismissed",y="$survey_"+m+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(y="$survey_"+m+"/"+g.id+"/"+g.current_iteration),y)]:!0})}else t===po.SHOWN&&(f.$set=i({},f.$set,{[_o.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===mo.SHOWN){var S=null==e?void 0:e[yo.TOUR_TYPE];S&&(f.$set=i({},f.$set,{[yo.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var E=i({},f.properties.$set,f.$set);if(_e(E)||this.setPersonPropertiesForFlags(E),!we(this.config.before_send)){var k=this.kn(f);if(!k)return;(f=k).uuid=qi(f.uuid,ds)}this.Ro.emit("eventCaptured",f);var T=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P={method:"POST",url:T,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(T)?"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(P):this.Jo.enqueue(P),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",(e=>t(e.event,e)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new Xa(this)}Ao(t){this.Ho.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Ho.indexOf(t);-1!==i&&this.Ho.splice(i,1)}}}gl(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Q)===vt&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.gl();var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Oo()&&(l[nt]=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!me(l.distinct_id)&&!xe(l.distinct_id)||ye(l.distinct_id))&&Wr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ct)return{};var u,h=t?[...Hn,...e||[]]:[],d=function(t){for(var e=0;ji.length>e;e++){var i=ji[e],r=i[1],s=i[0].exec(t),n=s&&(fe(r)?r(s,t):r);if(n)return n}return["",""]}(Ct),v=d[0],c=d[1],f=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},p={};ge(i)||(p.detectGoogleSearchApp=i);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;ge(g)||(_.userAgentDataPlatform=g),ge(m)||(_.maxTouchPoints=m),ge(y)||(_.screenWidth=y),ge(b)||(_.screenHeight=b),ge(w)||(_.devicePixelRatio=w);var x,S,E,k,T,P,R,C,O=Yr(ts({$os:v,$os_version:c,$browser:Ni(Ct,navigator.vendor,f,p),$device:Bi(Ct),$device_type:(S=Ct,E=_,C=Bi(S),C===qe||C===ze||"Kobo"===C||"Kindle Fire"===C||C===yi?Be:C===li||C===hi||C===ui||C===_i?"Console":C===Ve?"Wearable":C?Le:"Android"===(null==E?void 0:E.userAgentDataPlatform)&&(null!==(k=null==E?void 0:E.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==E?void 0:E.screenWidth)&&void 0!==T?T:0,null!==(P=null==E?void 0:E.screenHeight)&&void 0!==P?P:0)/(null!==(R=null==E?void 0:E.devicePixelRatio)&&void 0!==R?R:1)?Le:Be:"Desktop"),$timezone:io(),$timezone_offset:ro()}),{$current_url:Un(r?Hi(null==kt?void 0:kt.href):null==kt?void 0:kt.href,h,Wn),$host:null==kt?void 0:kt.host,$pathname:null==kt?void 0:kt.pathname,$raw_user_agent:Ct.length>1e3?Ct.substring(0,997)+"...":Ct,$browser_version:Ui(Ct,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&&(O.$sdk_dist_channel=s.SDK_DIST_CHANNEL),O}(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),h=t!==gt||o?t!==mt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Yr(l,h),t===gt&&Et&&(l.title=Et.title),!ge(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ct&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Jr(["$referrer","$referring_domain"],(t=>{t in _&&delete g[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,i({},m,l))).$is_identified=this._isIdentified(),ce(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,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.yl())return t;if(this.qo&&!i)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")),e&&(this.qo=!0),_e(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.gl(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.jo.delete(t),this.ml()}_l(t,e){this.register({[t]:e})}Xo(){this.jo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!Os.Nr())Os.qr(this.Bo);else{var e=[];this.jo.forEach((t=>e.push(t))),e.length>0?Os.Dr(this.Bo,e):Os.qr(this.Bo)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Ro.on(t,e)}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 e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:rl})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:rl})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Va),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:rl}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:rl})}wl(t){return!t||ye(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,e,i){if(!this.__loaded||!this.persistence)return Wr.uninitializedWarning("posthog.identify");if(xe(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 h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(u)&&(this.unregister(u),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(Q)||vt)===vt,c=t!==h,f=!c&&v;if(c&&v)this.persistence.set_property(Q,ct),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(yt,{distinct_id:t,$anon_distinct_id:h},{$set:e||{},$set_once:i||{}}),this.Vo=Ma(t,e,i),null==(d=this.featureFlags)||d.setAnonymousDistinctId(h);else if(f){this.persistence.set_property(Q,ct);var p=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:p,$set_once:_}),this.Vo=Ma(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(G)):f&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Qs(l)}}}setPersonProperties(t,e){if((t||e)&&this.bl("posthog.setPersonProperties")){var i=Ma(this.get_distinct_id(),t,e);this.Vo!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Vo=i):Wr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(ce(t)?t:[t]).filter((t=>me(t)&&t.length>0));0!==i.length&&this.bl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Vo=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.gl();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),o||r){var a={$group_type:t,$group_key:e};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,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.bl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=Ee(t)?t:null==t?void 0:t.resetDeviceID,i=Ee(t)||null==t?void 0:t.bootstrap;this.kl(e,!1,i)}kl(t,e,r){var s,n,o;if(void 0===e&&(e=!1),Wr.info("reset"),!this.__loaded)return Wr.uninitializedWarning("posthog.reset");var u=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 h=this.get_property(a),d=this.get_property(l),v=this.get_property(b),c=this.is_capturing();this.consent.reset(),e||!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,E,k,T,P,R,C,O;if(null==(_=this.persistence)||_.clear(),null==(g=this.sessionPersistence)||g.clear(),this.jo.clear(),this.ml(),ge(v)||null==(P=this.persistence)||P.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==(E=this.metrics)||E.reset(),null==(k=this.persistence)||k.set_property(Q,vt),null==(T=this.sessionManager)||T.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:h},""),t||ge(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Oo()||(null==(O=this.persistence)||O.set_property(Q,r.isIdentifiedID?ct:vt),this.register({distinct_id:r.distinctID})),null==(R=this.featureFlags)||R.initialize(),!(ge(u)||null!=(C=this.sessionManager)&&C.setBootstrapSessionId(u,!0))){var A=i({},r);delete A.sessionID,this.config.bootstrap=A}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var F;f&&(null==(F=this.persistence)||null==F.Qs||F.Qs(p))}this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s,n,o;if(i.__loaded){null==(t=i.vl)||t.stop(),i.sl().dispose(),null==(e=i.sessionRecording)||e.dispose(),null==(r=i.logs)||r.flushLogs("sendBeacon"),null==(s=i.metrics)||s.flush("sendBeacon"),null==(n=i.Jo)||n.unload(),null==(o=i.Yo)||o.unload();try{var a;null==(a=i.featureFlags)||a.destroy()}catch(t){Wr.error("Error while destroying feature flags",t)}}else Wr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.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,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(n)?(Wr.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(ge(e)&&(e=this.get_distinct_id()),t!==e?(this._l(u,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Wr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(pe(t)){var r,n,o,a,l,u,h,d,v,c,f,p;Yr(this.config,dl(t));var _=this.$o();null==(r=this.persistence)||r.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new uo(i({},this.config,{persistence:"sessionStorage"}),_,!1);var g,m=this.Go(this.config.debug);Ee(m)&&(this.config.debug=m),Ee(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,gs.Nr()&&gs.Dr("ph_debug",!0),Wr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,gs.Nr()&&gs.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==(u=this.tracingHeaders)||u.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.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,e){s.LIB_NAME=t,s.LIB_VERSION=e}startSessionRecording(t){var e,i,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==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.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,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.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 e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:al;return e!==al&&(e=al+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Q))===ct||(null==(e=this.sessionPersistence)?void 0:e.get_property(Q))===ct}yl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ft&&!this._isIdentified()&&_e(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[u])&&(null==(e=this.persistence)||null==(e=e.props)||!e[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!==ht)}No(){var t,e,i,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==dt){if(this.Oo()){var i,r,s,n,o;this.kl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new $a(this),this.pageViewManager=new On(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 u,h;this.consent.optInOut(!0),this.No(),this.hl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ht&&(null==(u=this.surveys)||u.loadIfEnabled()),(ge(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else Wr.warn(il)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==dt?(this.config.cookieless_mode===ht&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===ht&&(this.register({distinct_id:st,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):Wr.warn(il)}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===ht?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?Pa(St,this.config.custom_blocked_useragents):void 0}dl(){Et&&("visible"===Et.visibilityState?this.Uo||(this.Uo=!0,this.capture(gt,{title:Et.title},{send_instantly:!0}),this.zo&&(Et.removeEventListener(pt,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),rs(Et,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,e,i,r,s){var n=e in t&&!we(t[e]),o=i in t&&!we(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Wr)}kn(t){var e;if(we(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter($e),r=ce(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),we(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Te(t.event)?Wr.warn(o+". This can cause unexpected behavior."):Wr.info(o),null}s.properties&&!_e(s.properties)||Wr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return Wr.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&we(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,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Go(t){var e=Ee(t)&&!t,i=gs.Nr()&&"true"===gs.Pr("ph_debug");return!e&&(!!i||t)}}cl.__defaultExtensionClasses={},cl.Cl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Zr(t.prototype[e[i]])}(cl,["identify"]);class fl{constructor(t){this.disabled=!1===t;var e=pe(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var pl="$copy_autocapture",_l=Gr("[AutoCapture]");function gl(t,e){return e.length>t?e.slice(0,t)+"...":e}function ml(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Us(e));return e}function yl(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,u=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!Us(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!js(c,"body")&&qs>d.length;)if(zs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Us(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 e=un(t);if(js(t,"a")){var i=t.getAttribute("href");y=!!(e&&i&&mn(i))&&(h?Hi(i):i)}oe(Ws(t),"ph-no-capture")&&(b=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};Ys.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?gl(1024,yn(t)):gl(1024,Ks(t)));var a=Ws(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Jr(t.attributes,(function(i){var n;if((!hn(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&mn(i.value)&&(!me(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=Hs(a).join(" ")),o["attr__"+i.name]=gl(1024,"href"===i.name&&s?Hi(a):a)}}));for(var l=1,u=1,h=t;h=ml(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,o,a,l,h));var r=function(t){if(!un(t))return{};var e={};return Jr(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&mn(r)&&(e[i]=r)}})),e}(t);Yr(m,r)})),b)return{props:{},explicitNoCapture:b};if(a||(g[0].$el_text=js(t,"a")||js(t,"button")?yn(t):Ks(t)),y){var w,x;g[0].attr__href=y;var S=null==(w=Nn(y))?void 0:w.host,E=null==wt||null==(x=wt.location)?void 0:x.host;S&&E&&S!==E&&(p=y)}return{props:Yr({$event_type:n.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(_=g,function(t){return t.map((t=>{var e,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=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e: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,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return a[wn(t[0].toString())]=wn(e.toString())})),(s+=":")+Qr(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.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}))}(_)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[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 e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?e.dispose():(this.ss=e,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,e;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==(e=this.qi.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),this.qi}us(){if(this.isBrowserSupported()){if(wt&&Et){var t=this.hs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t)}catch(t){_l.error("Failed to capture event",t)}};if(rs(Et,"submit",t,{capture:!0}),rs(Et,"change",t,{capture:!0}),rs(Et,"click",t,{capture:!0}),this.ls().capture_copied_text){var e=this.vs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t,pl)}catch(t){_l.error("Failed to capture copy/cut event",t)}};rs(Et,"copy",e,{capture:!0}),rs(Et,"cut",e,{capture:!0})}}}else _l.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==Et||Et.removeEventListener("submit",this.hs,!0),null==Et||Et.removeEventListener("change",this.hs,!0),null==Et||Et.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==Et||Et.removeEventListener("copy",this.vs,!0),null==Et||Et.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 e=t.config;e.elementsChainAsString&&(this.Yn=e.elementsChainAsString);var i,r=e.autocapture_opt_out;Ee(r)&&(null==(i=this.ns)||i.kv.set(d,r),this.Jn=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.es=t}getElementSelectors(t){var e,i=[];return null==(e=this.es)||e.forEach((e=>{var r=null==Et?void 0:Et.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e;if(this.Xn)return!1;var i=null==(t=this.ns)?void 0:t.kv.get(d),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(be(r)&&!Ee(i)&&!n)return!1;var o=null!==(e=this.Jn)&&void 0!==e?e:!!i;return!!s.enabled&&!o}ds(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i=Js(t);Bs(i)&&(i=i.parentNode||null);var r,s=this.rs();"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&on(i,s.rageclick)&&this.ds(t,"$rageclick");var n=e===pl;if(i&&function(t,e,i,r,s,n){var o;if(!wt||an(t))return!1;if(null!=i&&i.url_allowlist&&!Vs(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&Vs(i.url_ignorelist,n))return!1;if(null!=i&&i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some((t=>e.type===t)))return!1}var l=ln(t,r),u=l.parentIsUsefulElement,h=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ge(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(h,i))return!1;if(!Qs(h,null==i?void 0:i.css_selector_allowlist))return!1;if(Qs(h,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Zs))return!1;try{var d=wt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return u?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Ys.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(i,t,s,n,n?["copy","cut"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var o,a=yl(i,{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 u=this.getElementSelectors(i);if(u&&u.length>0&&(l.$element_selectors=u),e===pl){var h,d=Gs(null==wt||null==(h=wt.getSelection())?void 0:h.toString()),v=t.type||"clipboard";if(!d)return!1;l.$selected_content=d,l.$copy_type=v}return null==(o=this.ns)||o.capture(e,l).catch((t=>_l.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return fe(null==Et?void 0:Et.querySelectorAll)}}class wl{constructor(t){this._instance=t}refresh(t){var e=this._instance.config,i=pe(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.ma(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}}var xl=Gr("[ExceptionAutocapture]"),Sl=()=>{},El=Gr("[TracingHeaders]"),kl=Gr("[Web Vitals]"),Tl=9e5,$l=["CLS","FCP","INP","LCP"],Pl=["INP","LCP"],Rl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Cl="disabled",Ol="lazy_loading",Il="awaiting_config",Al="missing_config";Gr("[SessionRecording]"),Gr("[SessionRecording]");var Fl="[SessionRecording]",Ml=Gr(Fl),Dl=Gr("[Heatmaps]");function Nl(t){return pe(t)&&"clientX"in t&&"clientY"in t&&xe(t.clientX)&&xe(t.clientY)}var Ll=Gr("[Product Tours]"),Ul=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(m))},jl=["$set_once","$set"],Bl=Gr("[SiteApps]"),zl="Error while initializing PostHog app with config id ",ql=(t,e)=>null!=t&&t.then?t.then(e):e(t),Hl="SDK is not enabled or survey functionality is not yet loaded",Vl="Disabled. Not loading surveys.";class Wl{constructor(t,e){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 Ba.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(we(e))return Ba.warn("Flags not loaded yet. Not loading surveys.");this.Pl=Ee(e)?e:e.length>0,Ba.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=e}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 e=t.onRemoteConfig(this.onRemoteConfig);this.Xn?e.dispose():(this.ss=e,this.loadIfEnabled())}}))}dispose(){var t,e,i;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,null==(e=this._surveyEventReceiver)||e.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==i.dispose||i.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 e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(za)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Xn&&this.ns){var t=this.qi;if(!this._surveyManager)if(this.Tl)Ba.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Ba.info(Vl);else if(t.cookielessMode&&this.ts.isOptedOut())Ba.info("Not loading surveys in cookieless mode without consent.");else{var e=this.ts.getExtensions();if(e){if(!ge(this.Pl)||t.advancedEnableSurveys){var i=this.Pl||t.advancedEnableSurveys;this.Tl=!0;try{var r=e.generateSurveys;if(r)return this.Ll(r,i),void(this.Tl=!1);var s=e.loadExternalDependency;if(!s)return this.Ol(ut),void(this.Tl=!1);s((t=>{try{if(this.Xn)return;var e=this.ts.getExtensions();t||null==e||!e.generateSurveys?this.Ol("Could not load surveys script",t):this.Ll(e.generateSurveys,i)}finally{this.Tl=!1}}))}catch(t){throw this.Tl=!1,this.Ol("Error initializing surveys",t),t}}}else Ba.error("PostHog Extensions not found.")}}}Ll(t,e){this.Xn||(this._surveyManager=t(e),this._surveyEventReceiver=this.ts.createEventReceiver(),Ba.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,e){Ba.error(t,e),this.Dl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ml.push(t),this._surveyManager&&this.Dl({isLoaded:!0}),()=>{this.Ml=this.Ml.filter((e=>e!==t))}}getSurveys(t,e){var i;void 0===e&&(e=!1);var r=null!==(i=this.ns)&&void 0!==i?i:this.Al;if(r&&!this.Xn){if(this.qi.disableSurveys)return Ba.info(Vl),t([]);var s=r.kv.get(B);if(s&&!e)return t(s,{isLoaded:!0}),void(this.$l()&&this.getSurveys((()=>{}),!0));if(this.El)this.El.then((e=>{this.Xn||t(e.surveys,e.context)})).catch((t=>Ba.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 Ba.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((e=>{o(),this.Xn||t(e.surveys,e.context)}),o).catch((t=>Ba.error("Error in survey callback",t)))}}}Nl(t,e){var i=this.ns;return i?i.sendRequest(t,e):new Promise((t=>t({statusCode:0,error:new Error(Hl)})))}ql(t,e){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:Hl}};var i=e.statusCode;if(200!==i||!e.json){var r="Surveys API could not be loaded, status: "+i;return 0!==i?Ba.error(r):e.error||Ba.warn(r),this.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Il=null;var s,n=e.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ca(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[B]:n,[z]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}$l(){return this.jl()&&!this.El&&!this.Bl()}jl(){var t,e,i=null==(t=null!==(e=this.ns)&&void 0!==e?e:this.Al)?void 0:t.kv.get(z);return xe(i)&&Date.now()-i>3e5}Bl(){return xe(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};qa(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Dl(t){for(var e of this.Ml)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Ba.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!we(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Ba.warn("init was not called")}Hl(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Ul(t){if(we(this._surveyManager))return{eligible:!1,reason:Hl};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}zl(t){if(we(this._surveyManager))return{eligible:!1,reason:Hl};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(we(this._surveyManager))return Ba.warn("init was not called"),{visible:!1,disabledReason:Hl};var e=this.zl(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return we(this._surveyManager)?(Ba.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Hl})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.zl(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(we(this._surveyManager))Ba.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==Et?void 0:Et.querySelector(e);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){Ba.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,e;this.Rl.delete(o),this.Xn||(Ba.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),Ba.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Rl.add(o)}else this._surveyManager.renderSurvey(s,n,i);else Ba.warn("Survey element not found")}else Ba.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ba.warn("Survey not found")}}displaySurvey(t,e){var r;if(we(this._surveyManager))Ba.warn("init was not called");else{var s=this.Hl(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==go.Popover&&e.initialResponses&&Ba.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.Ul(s);if(!o.eligible)return void Ba.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==go.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else Ba.warn("Survey not found")}}cancelPendingSurvey(t){we(this._surveyManager)?Ba.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function Gl(t,e,i){if(we(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Kl{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new Ea,this.Zl=(t,e)=>this.Ql(t,e)&&this.Jl(t,e)&&this.Kl(t,e)&&this.Yl(t,e),this.Ql=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t}init(){var t,e;ge(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Xl=null==(e=this._instance)?void 0:e._addCaptureHook(((t,e)=>{this.on(t,e)})))}dispose(){var t;null==(t=this.Xl)||t.call(this),this.Xl=void 0,this.Gl=new Ea}register(t){var e,i;if(!ge(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e;this.Wl.add(t),null==(e=t.steps)||e.forEach((t=>{this.Vl.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r=new Set;this.Wl.forEach((t=>{var e;null==(e=t.steps)||e.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,e){null!=e&&0!=t.length&&(this.Vl.has(t)||this.Vl.has(e.event))&&this.Wl.forEach((t=>{this.tu(e,t)&&this.Gl.emit("actionCaptured",t.name)}))}eu(t){this.onAction("actionCaptured",(e=>t(e)))}tu(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.Zl(t,i))return!0;return!1}onAction(t,e){return this.Gl.on(t,e)}Jl(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Gl(r,e.url,e.url_matching||"contains"))return!1}return!0}Kl(t,e){return!!this.iu(t,e)&&!!this.ru(t,e)&&!!this.nu(t,e)}iu(t,e){var i;if(null==e||!e.href)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Gl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}ru(t,e){var i;if(null==e||!e.text)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.text,e.text,e.text_matching||"exact")||Gl(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!we(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Gl(t,n,o))))}nu(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}su(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Yl(t,e){return null==e||!e.properties||0===e.properties.length||Fa(e.properties.reduce(((t,e)=>{var i=ce(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Jl{constructor(t){var e;this.au=[],this._instance=t,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=null==(e=this._instance)||null==e.onSessionId?void 0:e.onSessionId((t=>this.du(t)))}vu(t){return!1}cu(){return null}fu(t){}pu(){}gu(t,e){return!!t&&Fa(t.propertyFilters,null==e?void 0:e.properties)}mu(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}yu(t,e,i){var r=(i===co.Activation?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[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.gu(n,e)}))}register(t){this._u(t,!1)}replace(t){this._u(t,!0)}_u(t,e){var i;ge(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.wu(t,e),this.ku(t,e))}ku(t,e){var i=t.filter((t=>{var e;return null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length}));if(e&&this.uu.clear(),0!==i.length){this.Su||(this.Su=new Kl(this._instance),this.Su.init(),this.Su.eu((t=>this.onAction(t))));var r=[];i.forEach((t=>{var e;null==(e=t.conditions)||null==(e=e.actions)||e.values.forEach((e=>{if(r.push(e),e.name){var i,s=null!==(i=this.uu.get(e.name))&&void 0!==i?i:[];s.includes(t.id)||s.push(t.id),this.uu.set(e.name,s)}}))})),e?this.Su.replace(r):this.Su.register(r)}else{var s;e&&(null==(s=this.Su)||s.replace([]))}}xu(t,e){e.forEach(((e,i)=>{var r,s=null!==(r=t.get(i))&&void 0!==r?r:[];e.forEach((t=>{s.includes(t)||s.push(t)})),t.set(i,s)}))}wu(t,e){var i,r,s=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),n=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0})),o=this.mu(t,co.Activation),a=this.mu(t,co.Cancellation);e?(this.ou=o,this.lu=a):(this.xu(this.ou,o),this.xu(this.lu,a)),(0!==s.length||0!==n.length)&&(null!==(i=this.Xl)&&void 0!==i||(this.Xl=null==(r=this._instance)?void 0:r._addCaptureHook(((t,e)=>{this.onEvent(t,e)}))))}onEvent(t,e){var i,r,s=this.Cu(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.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,e,co.Cancellation);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:e,items:this.ou.get(t)});var l=this.yu(t,e,co.Activation);this.Pu(l.map((t=>t.id)))}}onAction(t){this.uu.has(t)&&this.Pu(this.uu.get(t)||[])}Pu(t){var e;if(0!==t.length){var i=!(null==(e=this._instance)||null==e.get_session_id||!e.get_session_id()),r=[];for(var s of t)i&&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((e=>e!==t));var e=this.Fu();return!e.includes(t)&&(this.Lu([...e,t]),this.Ou(),!0)}Mu(t){var e=new Set(t);this.au=this.au.filter((t=>!e.has(t)));var i=this.Du(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.Lu(r),0===r.length&&this.$u()),this.Iu(t)}Nu(){var t,e=this.cu();if(!e)return{};var i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Au(t){if(this.cu()){var e=this.Nu();this.fu(i({},e,{[t]:Date.now()}))}}Iu(t){if(this.cu()){var e=this.Nu(),i={},r=!1;for(var s of Object.entries(e)){var n=s[0],o=s[1];t.includes(n)?r=!0:i[n]=o}r&&(_e(i)?this.pu():this.fu(i))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var e=this.Nu()[t];return xe(e)?e:void 0}}Du(){var t,e=this.ju();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}Fu(){var t,e,i=this.Du();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Bu()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}Ou(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.Hu(e)}$u(){this.Uu()}du(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Bu()];if(i&&i!==t){var r=this.Du(),s=this.Nu();r.length>0&&(this.Lu([]),r.filter((t=>xe(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,e,i;null==(t=this.hu)||t.call(this),this.hu=void 0,null==(e=this.Xl)||e.call(this),this.Xl=void 0,null==(i=this.Su)||i.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 e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[V]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}vu(t){var e,i;this.bu((e=>{i=e.find((e=>e.id===t))}));var r=null==(e=i)||null==(e=e.appearance)?void 0:e.surveyPopupDelaySeconds;return xe(r)&&r>0}Vu(){return po.SHOWN}bu(t){var e;null==(e=this._instance)||e.getSurveys(t)}Ru(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Cu(){return Ba}Lu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[q]:t})}Hu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[H]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(H)}zu(){return!1}Tu(t,e){var i;this.bu((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return Ca(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===po.SHOWN?"consume":"ignore":t===po.SHOWN?"persist":t===po.DISMISSED||t===po.SENT?"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 e={};for(var i of t){var r=this._instance.get_property(i);ge(r)||(e[i]=r)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}: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==At?void 0:At.__PosthogExtensions__;if(t){var e=t.generateSurveys,i=t.loadExternalDependency;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new Yl(this._instance)}}var Zl=null!=wt&&wt.location?jn(wt.location.hash,"__posthog")||jn(location.hash,"state"):null,tu="_postHogToolbarParams",eu=Gr("[Toolbar]"),iu=Gr("[FeatureFlags]");class ru{constructor(t,e){void 0===e&&(e=!1),this.Gu=!1,this.update(t,e)}update(t,e){this.Zu=((t,e)=>{var i,r,s,n;return{bootstrap:{featureFlags:null==(i=t.bootstrap)?void 0:i.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:e,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:ce(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(iu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),ge(t.flag_keys)||ce(t.flag_keys)||iu.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var su=Gr("[FeatureFlags]"),nu=Gr("[FeatureFlags]",{debugEnabled:!0}),ou="\" failed. Feature flags didn't load in time.",au="connection_error",lu=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},uu=t=>{var e={};for(var i of Qr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},hu=Gr("[Error tracking]"),du=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],vu=["__firefox__","__gCrWeb"],cu="Refusing to render web experiment since the viewer is a likely bot",fu={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Oa(e,t),not_regex:(t,e)=>!Oa(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class pu{get qi(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{pu.Qu("retrieved web experiments from the server"),e.Ju=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Ju&&(pu.Qu("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Ju)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);me(r)&&t.variants[r]&&e.Ku(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];pu.Yu(n,e._instance)&&e.Ku(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())pu.Qu(cu);else if(!this.qi.disable_web_experiments){if(we(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();pu.Qu("applying feature flags",t),t.forEach((t=>{var e;if(this.Ju&&null!=(e=this.Ju)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Ju)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Ku(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=pu.getWindowLocation();if(null!=t&&t.search){var e=Ln(null==t?void 0:t.search,"__experiment_id"),i=Ln(null==t?void 0:t.search,"__experiment_variant");e&&i&&(pu.Qu("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Xu(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.qi.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)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:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Xu(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(pu.Qu("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Ku(r[0].name,e,r[0].variants[e].transforms))}static Yu(t,e){return!we(t.conditions)&&pu.th(t,e)&&pu.eh(t)}static th(t,e){var i;if(we(t.conditions)||we(null==(i=t.conditions)?void 0:i.url))return!0;var r=pu.getWindowLocation();if(r){var s,n,o,a=As(e,r.href);return null==(s=t.conditions)||!s.url||fu[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 e;if(we(t.conditions)||we(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Kn();if(i.utm_source){var r,s,n,o,a,l,u,h,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)==i.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)==i.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)==i.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&f&&v}return!1}static Qu(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Wr.info("[WebExperiments] "+t,i)}Ku(t,e,i){this._is_bot()?pu.Qu(cu):"control"!==e?i.forEach((i=>{if(i.selector){var r;pu.Qu("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):pu.Qu("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?Pa(St,this.qi.custom_blocked_useragents):void 0}}var _u=Gr("[Conversations]"),gu="Conversations not available yet.",mu="console",yu="__posthogHandledLogsRequestError",bu=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[yu]=!0,i},wu=t=>!!t&&"object"==typeof t&&!0===t[yu],xu={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=su,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 ru(t.config,t.ma()),this.ts=this.mh)}updateConfig(t,e){var i;null==(i=this.mh)||i.update(t,e)}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 e;return null==(e=this.ns)?void 0:e.kv.get(t)}Dr(t){this.xh((()=>{var e;return null==(e=this.ns)?void 0:e.kv.set(t)}))}qr(t){this.xh((()=>{var e;return null==(e=this.ns)?void 0:e.kv.remove(t)}))}xh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}wh(){var t={};for(var e of[C,A,F,D]){var r=this.Sh(e);ge(r)||(t[e]=r)}this.rh=t;var s=i({},t),n=this.Sh(R);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 e=this.Sh(Y);return"number"!=typeof e||Date.now()-e>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 e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}Mh(){var t=this.qi.flagKeys;if(!ge(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),e}))}initialize(){var t,e,i=this.qi,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(t[e]=o[e],t)),{});return this.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Sh(R))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Sh(A))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var d of Object.entries(l)){var v=d[0],c=d[1];h[v]={key:v,enabled:Mt(c),variant:Dt(c),reason:void 0,metadata:ge(null==u?void 0:u[v])?void 0:{id:0,version:void 0,description:void 0,payload:u[v]}}}this.Eh({flags:h})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(I),e=this.Sh(D),r=this.Sh(N);if(!r&&!e)return t||{};var s=Yr({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,u=s[o],h=null==e?void 0:e[o],d=ge(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=ge(h)?null==u?void 0:u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],f=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.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(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Mt(r),variant:Dt(r),payload:Ft(e[i])}}))}getFlagVariants(){var t=this.Sh(R),e=this.Sh(D);if(!e)return t||{};for(var i=Yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.ih=!0),i}getFlagPayloads(){var t=this.Sh(A),e=this.Sh(N);if(!e)return t||{};for(var i=Yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.ih=!0),i}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((e=>e!==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 e=this.ns;if(e&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var r={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},e.initialPersonProperties,this.Sh(L)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Sh(U),timezone:io()};ge(e.deviceId)||(r.$device_id=e.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();ge(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 u=()=>{this.hh&&(this.hh=!1,this.Rh())},h=t=>{this.oh=!1,l===this.lh?(this.Dr({[J]:[au]}),this.I.error("Feature flag request failed",t),u()):u()};try{e.sendRequest(a,{target:"flags",method:"POST",body:r,compression:"base64"===this.qi.compression?vo.Base64:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var e,i,s=null!==(e=t.json)&&void 0!==e?e:{},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?au:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var h=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));h&&a.push("quota_limited"),this.Dr({[J]:a}),h?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}),u()}}else u()})).catch(h)}catch(t){h(t)}}}gh(){return Bn(this.ph,3)}Ph(t){this.ph=zn(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,e){var i;if(void 0===e&&(e={}),!e.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+ou)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.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),u=this.Sh(F)||void 0,h=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(e.send_event||!("send_event"in e))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,E,k,T;ce(d[t])?d[t].push(l):d[t]=[l],this.Dr(i({[G]:d},r?{[K]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.Sh(J))&&void 0!==p?p:[]];ge(o)&&R.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:u,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.qi.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_: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};ge(null==P||null==(b=P.metadata)?void 0:b.has_experiment)||(C.$feature_flag_has_experiment=P.metadata.has_experiment),ge(null==P||null==(w=P.metadata)?void 0:w.version)||(C.$feature_flag_version=P.metadata.version);var O,I=null!==(x=null==P||null==(S=P.reason)?void 0:S.description)&&void 0!==x?x:null==P||null==(E=P.reason)?void 0:E.code;I&&(C.$feature_flag_reason=I),null!=P&&null!=(k=P.metadata)&&k.id&&(C.$feature_flag_id=P.metadata.id),ge(null==P?void 0:P.original_variant)&&ge(null==P?void 0:P.original_enabled)||(C.$feature_flag_original_response=ge(P.original_variant)?P.original_enabled:P.original_variant),null!=P&&null!=(T=P.metadata)&&T.original_payload&&(C.$feature_flag_original_payload=null==P||null==(O=P.metadata)?void 0:O.original_payload),R.length&&(C.$feature_flag_error=R.join(",")),this.Ah(C)}else r&&this.Dr({[G]:d,[K]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Ft(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+ou)}Ah(t){try{var e;null==(e=this.ns)||e.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,e){this.Fh(t,e)}Fh(t,i){var r=this;return e((function*(){var e=r.ns;if(e){var s={distinct_id:e.distinctId,token:e.projectToken,person_properties:{$lib:e.library.name,$lib_version:e.library.version}},n=r.Th();n.length&&(s.evaluation_contexts=n);var o,a=r.Mh();ge(a)||(s.flag_keys=a);try{var l,u=null==(l=(yield e.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===r.qi.compression?vo.Base64:void 0,sentAt:"body",timeoutMs:r.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==u?void 0:u[t])||void 0}catch(t){return void r.I.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){r.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,e){if(void 0===e&&(e={}),e.fresh&&!this.dh)return e.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+ou),e.defaultValue;var i=this.getFeatureFlag(t,e);return ge(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){this.Eh(t,e,i)}Eh(t,e,r){if(this.ns){this.ah=!0;var s=function(t,e,r,s,n,o){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=su);var a=((t,e)=>{var r=t.flags;return r?i({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var e;return[t,null!==(e=r[t].variant)&&void 0!==e?e:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var e;return null==(e=r[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=r[t].metadata)?void 0:e.payload]})))}):(t.featureFlags&&e.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,u=a.featureFlags,h=a.featureFlagPayloads;if(u){var d=t.requestId,v=t.evaluatedAt;if(ce(u)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var f=0;u.length>f;f++)c[u[f]]=!0;return{[C]:u,[R]:c,[M]:!1}}var p=u,_=h,g=l;if(null!=n&&n.partialResponse)p=i({},e,p),_=i({},r,_),g=i({},s,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));p=i({},e,Object.fromEntries(Object.entries(p).filter((t=>m.has(t[0]))))),_=i({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0]))))),g=i({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else p=i({},e,p),_=i({},r,_),g=i({},s,g);return i({[C]:Object.keys(uu(p)),[R]:p||{},[A]:_||{},[I]:g||{},[M]:!0===t.minimalFlagCalledEvents},d?{[F]:d}:{},v?{[Y]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.I);s&&this.Dr(s),e||(this.fh=!1),this.Lh(e)}}override(t,e){void 0===e&&(e=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Oh(t)}Oh(t){if(this.ns){if(!1===t)return this.qr([D,N]),this.Lh(),void nu.info("All overrides cleared");if(ce(t))return this.Dr({[D]:lu(t)}),this.Lh(),void nu.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,i=t;this.ih=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);var r={},s=i.flags,n=i.payloads;return s&&(r[D]=ce(s)?lu(s):s),n&&(r[N]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([D,N]):!1===s?this.qr(D):!1===n&&this.qr(N),this.Lh(),!1===s?nu.info("Flag overrides cleared"):s&&nu.info("Flag overrides set",{flags:s}),void(!1===n?nu.info("Payload overrides cleared"):n&&nu.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[D]:t}),this.Lh(),void nu.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 e=this.Dh(),i=e.flags,r=e.flagVariants;try{t(i,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s=(this.Sh(O)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=i({},this.getFlagVariants(),{[t]:e});this.Dr({[C]:Object.keys(uu(a)),[R]:a,[L]:i({},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,e,i){void 0===e&&(e=!1);var r=this.Sh(O);!r||e?this.$h(t,i):t(r)}$h(t,i){var r=this;return e((function*(){var e=r.ns;if(e){var s,n=i?"&"+i.map((t=>"stage="+t)).join("&"):"";try{var o=yield e.sendRequest("/api/early_access_features/?token="+e.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.Dr({[O]: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(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}Lh(t){this.wh();var e=this.Dh(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0),this.Nh(t,e)}Nh(t,e){void 0===e&&(e=!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]:i({},r,o,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.Sh(L)||{});t.forEach((t=>{delete r[t]})),this.Dr({[L]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(L),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.Sh(U)||{},s=i({},r);for(var n of Object.keys(t))s[n]=i({},r[n],t[n]);this.Dr({[U]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Sh(U)||{};this.Dr({[U]:i({},e,{[t]:{}})})}else this.qr(U)}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}}},Su={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,e;return this.jh===Il||this.jh===Al?this.jh:null!==(t=null==(e=this.qh)?void 0:e.status)&&void 0!==t?t:this.jh}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=Cl,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var t;if(null==Et||!Et.visibilityState||"visible"===Et.visibilityState)return!0;var e=null==wt||null==(t=wt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==Et?void 0:Et.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Ml.error("started without valid sessionManager"),new Error(Fl+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===dt)throw new Error(Fl+' cannot be used with cookieless_mode="always"');null!=Et&&Et.addEventListener&&rs(Et,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==Et||null==Et.removeEventListener||Et.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.qi.disable_session_recording,r=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return wt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!(this.Hh||this.Uh&&null!=(e=this.qh)&&e.isStarted)){var i=!ge(Object.assign)&&!ge(Array.from);this.Uh&&i?(this.zh(t),Ml.info("starting")):(this.jh=Cl,this.stopRecording())}}zh(t){var e,i,r;this.Uh&&(this.jh!==Il&&this.jh!==Al&&(this.jh=Ol),null!=At&&null!=(e=At.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=At.__PosthogExtensions__)&&i.initSessionRecording?this.Wh(t):null==(r=At.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(e=>{if(e)return this._instance.register_for_session({[lt]:!0}),Ml.error("could not load recorder",e);this.Wh(t)})))}stopRecording(){var t,e;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(e=this.qh)||e.stop()}Gh(){var t,e;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(e=this.qh)||e.discard()}Zh(){var t,e;null==(t=this.za)||t.unregister(P),null==(e=this.za)||e.unregister(w)}Qh(t,e){if(we(t))return null;var i,r=xe(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Ml.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var e,r,s=this.za,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Qh(null==(e=this.qi.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.Qh(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;we(a)&&this.Zh();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({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:ge(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==(e=this.Bh)||e.call(this),this.Bh=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.Jh(e),void this.Gh()):(this.Jh(e),void this.startIfEnabledOrStop()):(this.jh===Il&&(this.jh=Al,Ml.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.qh)&&i.log?this.qh.log(t,e):Ml.warn("log called before recorder was ready")}get Vh(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Kh(){var t,e=this._instance.get_property(b);if(!e)return!1;try{t="object"==typeof e?e:JSON.parse(e)}catch(t){return Ml.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!we(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var e,i,r;if(!this.Hh){if(null==(e=At.__PosthogExtensions__)||!e.initSessionRecording)return Ml.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=At.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Al||this.jh===Il)return;return this.jh=Il,Ml.info("persisted remote config is stale, requesting fresh config before starting"),void new So(this._instance).load()}this.jh=Ol,null==(i=(r=this.qh).setDocumentWasEverVisible)||i.call(r,this.kt),this.qh.start(t)}}onRRwebEmit(t){var e;null==(e=this.qh)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.qh||null==(e=this.za)||e.register({[S]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.qh||null==(e=this.za)||e.register({[x]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var e,i;this.qh||null==(i=this.za)||i.register({["url"===t?E:k]:!0}),null==(e=this.qh)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.qh)||!i.tryAddCustomEvent(t,e))}}},Eu={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 e;if(wt&&(null==(e=wt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return Sl;var r={next:t[e]},s=i((function(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];return r.next.apply(this,e)}));return fe(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]!==s)for(var i=t[e];fe(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===s)return void(n.next=r.next);i=n.next}else t[e]=r.next}}catch(t){return Sl}}(wt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.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}:pe(t)?t:{}}ed(t){return void 0===t&&(t=this.td()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ud(t){var e=this.td(),i=this.Yh;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.ed(e)&&t.hash!==i.hash))}ld(t){try{var e=this.Xh();if(!e)return;this.ud(e)&&this._instance.capture(gt,{navigation_type:t}),this.Yh=e}catch(e){Wr.error("Error capturing "+t+" pageview",e)}}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 e;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=t,this.hd=!(null==(e=this.instance.persistence)||!e.props[v]),this.rageclicks=new fl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return pe(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return we(this.qi.capture_heatmaps)?we(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 e=t.config;if("heatmaps"in e){var i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:i}),this.hd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){Nl(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd="visible"===(null==Et?void 0:Et.visibilityState)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){wt&&Et&&(this.gd=this.La.bind(this),rs(wt,_t,this.gd),this.md=t=>this.ki(t||(null==wt?void 0:wt.event)),rs(Et,"click",this.md,{capture:!0}),this.yd=t=>this.bd(t||(null==wt?void 0:wt.event)),rs(Et,"mousemove",this.yd,{capture:!0}),this._d=new Tn(this.instance,En,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),rs(Et,pt,this.wd),this.Qn=!0)}fd(){var t;wt&&Et&&(this.gd&&wt.removeEventListener(_t,this.gd),this.md&&Et.removeEventListener("click",this.md,{capture:!0}),this.yd&&Et.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&Et.removeEventListener(pt,this.wd),clearTimeout(this.kd),null==(t=this._d)||t.stop(),this.Qn=!1)}Sd(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&Us(r)&&!js(r,"body");){if(r===i)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(oe(e,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:i),target_fixed:n,type:e}}ki(t,e){var r;if(void 0===e&&(e="click"),!Ls(t.target)&&Nl(t)){var s=this.Sd(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&on(Js(t),this.instance.config.rageclick)&&this.Nn(i({},s,{type:"rageclick"})),this.Nn(s)}}bd(t){!Ls(t.target)&&Nl(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(t){if(wt){var e=this.qi.disable_capture_url_hashes?Hi(wt.location.href):wt.location.href,i=this.qi.custom_personal_data_properties,r=this.qi.mask_personal_data_properties?[...Hn,...i||[]]:[],s=Un(e,r,Wn);this.ft=this.ft||{},this.ft[s]||(this.ft[s]=[]),this.ft[s].push(t)}}La(){this.ft&&!_e(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Tn,webVitalsAutocapture:class{constructor(t){var e;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",i({$current_url:this.ft.url},this.ft.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=t=>{var e;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},we(null==t?void 0:t.name)||we(null==t?void 0:t.value))kl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Md(r);if(!ge(s)){var n=xe(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)),ge(this.ft.navigationKey)&&(this.ft.navigationKey=n,this.ft.url=s),this.ft.firstMetricTimestamp=ge(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp;var o=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),a=i({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,pe(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var u of Rl){var h="url"===u&&"string"==typeof t.attribution[u]?this.Md(t.attribution[u]):t.attribution[u];ge(h)||(l[u]=h)}a.attribution=l}else delete a.attribution;ge(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 kl.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,e,r,s,n=!1,o=At.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Rd])||("web-vitals"===this.Rd&&ge(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ge(l)){var u=l.withoutAttribution,h=this.attributionMetrics;n=!ge(u),t=h.indexOf("LCP")>-1?l.onLCP:(null==u?void 0:u.onLCP)||l.onLCP,e=h.indexOf("CLS")>-1?l.onCLS:(null==u?void 0:u.onCLS)||l.onCLS,r=h.indexOf("FCP")>-1?l.onFCP:(null==u?void 0:u.onFCP)||l.onFCP,s=h.indexOf("INP")>-1?l.onINP:(null==u?void 0:u.onINP)||l.onINP}if(t&&e&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?i({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Td.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&e(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 kl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=pe(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return we(i)?(null==(e=this._instance.persistence)?void 0:e.props[y])||$l:i}get flushToCaptureTimeoutMs(){return(pe(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=pe(this.Pd)?this.Pd.web_vitals_attribution:void 0;return Ee(t)?t?$l:[]:ce(t)?t:Pl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=pe(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=pe(this.Pd)&&xe(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:Tl;return t>0&&6e4>=t?Tl:t}get isEnabled(){var t=null==kt?void 0:kt.protocol;if("http:"!==t&&"https:"!==t)return kl.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=pe(this.Pd)?this.Pd.web_vitals:Ee(this.Pd)?this.Pd:void 0;return Ee(e)?e:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(kl.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=pe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=pe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_]:i}),this._instance.persistence.register({[y]:r})),this.hd=i,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 e=At.__PosthogExtensions__,i=this.Rd,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&ge(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?kl.error("failed to load script",e):t()}))}Md(t){var e=t||(null==wt?void 0:wt.location.href);if(e){var i=this._instance.config.disable_capture_url_hashes?Hi(e):e,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Hn,...r||[]]:[];return Un(i,s,Wn)}kl.error("Could not determine current URL")}}},ku={exceptionObserver:class{constructor(t){var e;this.Id=()=>{var t;if(wt&&this.isEnabled&&null!=(t=At.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=At.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=At.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=At.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=e(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=i(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==(e=this._instance.persistence)||!e.props[c]),this.oe=new Ne(i({},function(t){var e,i,r,s;return void 0===t&&(t={}),{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e: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,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pe(t)?e=i({},e,t):(ge(t)?this.Dd:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}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 e,i;null!=(e=At.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return xl.error("failed to load script",e);t()}))}Od(){var t,e,i;null==(t=this.Ad)||t.call(this),this.Ad=void 0,null==(e=this.Fd)||e.call(this),this.Fd=void 0,null==(i=this.Ld)||i.call(this),this.Ld=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Dd=!!e.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 e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"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 e,r;this.Nd=[],this.qd=new pr([new $r,new Nr,new Rr,new Pr,new Mr,new Fr,new Or,new Dr],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Tr.test(l)?l.replace(Tr,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var d=h(u,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||_r});var r}))}(n)}}("web:javascript",xr,kr)),this._instance=t,this.Nd=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==e?e:[],this.jd=zr(this.Bd()),this.Hd=new qr(this.jd)}onConfigChange(){this.jd=zr(this.Bd()),this.Hd.setConfig(this.jd)}onRemoteConfig(t){var e,i,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(e=null==(i=s.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],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,e=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.qd.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.jd.enabled)try{if(!me(t)||0===t.trim().length)return void hu.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>jr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.zd(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&hu.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Hd.add(i({[Lr]:t,[Ur]:(new Date).toISOString()},s))}catch(t){hu.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Wd(e)){if(this.Vd(e))return this.Gd("Exception dropped: matched a suppression rule"),void hu.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(e))return this.Gd("Exception dropped: thrown by a browser extension"),void hu.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(e))return this.Gd("Exception dropped: thrown by an injected browser script"),void hu.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(e))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void hu.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.jd.enabled&&we(t.$exception_steps)?this.Kd(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(i.$release_id=r);try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fl:!0});return s&&this.Hd.clear(),s}catch(t){return hu.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void hu.error("Failed to process exception event. Ignoring this exception.",t)}var n}Kd(t){try{var e=this.Hd.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return hu.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Gd(t){this.jd.enabled&&this.Hd.add({[Lr]:t,[Ur]:(new Date).toISOString()})}zd(t){return pe(t)?i({},t):{}}Bd(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Vd(t){if(0===t.length)return!1;try{var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return me(i)&&i.length>0&&t.$exception_types.push(i),me(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Nd.some((t=>{var i=t.values.map((t=>{var i=Aa[t.operator],r=e[t.key];if(!i||!r)return!1;var s=ce(t.value)?t.value:[t.value];return s.length>0&&i(s,r)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}catch(t){return hu.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zd(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>{var e=t.filename;return!!e&&du.some((t=>e.startsWith(t)))}))}Qd(t){return t.some((t=>{var e=t.value;return me(e)&&vu.some((t=>e.includes(t)))}))}Jd(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],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!we(t)&&ce(t)}}},Tu=i({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 e=t.config;if("productTours"in e){var i,r;if(this.za&&this.za.register({[m]:!!e.productTours}),!Ul(this._instance))return!this.Yd&&we(null==(i=this.za)?void 0:i.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&&Ul(this._instance)&&this._s((()=>this.tv()))}_s(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ll.error("Could not load product tours script",e):t()}))}tv(){var t;!this.Yd&&null!=(t=At.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=At.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!ce(this.Xd)||e){var i=this.za;if(i){var r=i.props[W];if(ce(r)&&!e)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:e=>{if(Ul(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?e.error||Ll.warn(s):Ll.error(s),void t([],{isLoaded:!1,error:s})}var n=ce(e.json.product_tours)?e.json.product_tours:[];this.Xd=n,i&&i.register({[W]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){we(this.Yd)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Yd)||e.showTourById(t)}previewTour(t){this.Yd?this.Yd.previewTour(t):this._s((()=>{var e;this.tv(),null==(e=this.Yd)||e.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 e;null==(e=this.Yd)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Yd)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Yd)||e.cancelPendingTour(t)}}},xu),$u={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,e){if(e){var i=this.globalsForEvent(e);this.iv.push(i),this.iv.length>1e3&&(this.iv=this.iv.slice(10))}}get siteAppLoaders(){var t;return null==(t=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.rv.bind(this));this.nv=()=>{t(),this.iv=[],this.nv=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,u;if(!t)throw new Error("Event payload is required");var h={},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];h[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:i({},r(t,jl),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},p?{$set_once:i({},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==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}sv(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Bl.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Bl.error("prepare_external_dependency_script returned null"),null):t}av(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==Et?void 0:Et.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.ev++,this.ov)return this.lv();var h=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),h.push((()=>{t[e]=r}))}},f=t=>{if(v.has(t))return t;var e=d.sv(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!be(t)));return c(u,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))}))})),[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 e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=p(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=f(i);return r?t.call(this,e,r):null})),this.ov=()=>{h.forEach((t=>t())),this.ov=void 0},this.lv()}lv(){var t=!1;return()=>{var e;t||(t=!0,this.ev--,0===this.ev&&(null==(e=this.ov)||e.call(this)))}}uv(t,e){void 0===e&&(e=!0);var i=this.av();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.iv.length&&(Bl.info("Processing "+this.iv.length+" events for site app with id "+t.id),this.iv.forEach((t=>this.uv((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.nv)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Bl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.uv((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){Bl.error(zl+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Bl.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}hv(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}dv(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.uv((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Bl.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.hv(),void this._instance.on("eventCaptured",(t=>this.dv(t)))):void Bl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.nv)||i.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,e=a.id,i=a.url;At["__$$ph_site_app_"+e]=s._instance,null==(t=At.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return Bl.error(zl+e,t)}))};for(var a of n.siteApps)o()}else Bl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Pu={tracingHeaders:class{constructor(t){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var t,e,i=this.gv();i?(ge(this.vv)&&(this.vv=null==(t=At.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ge(this.fv)&&(this.fv=null==(e=At.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Od()},this._instance=t}initialize(){this.startIfEnabledOrStop()}_s(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return El.error("failed to load script",e);t()}))}mv(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}gv(){var t=this.mv();return ce(t)?(ce(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(ce(this.pv)&&this.pv.splice(0),this.pv=t||void 0,this.pv)}Od(){var t,e;null==(t=this.vv)||t.call(this),null==(e=this.fv)||e.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Od()}}},Ru=i({surveys:class extends Wl{constructor(t){var e;super(new Xl(t),{get projectToken(){return e.config.token},kv:new Ql(e=t)}),this._instance=t}Nl(t,e){var i=e.query?oa(t,e.query):t;return new Promise((t=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})}))}}},xu),Cu={toolbar:class{constructor(t){this.instance=t}yv(t){At.ph_toolbar_state=t}bv(){var t;return null!==(t=At.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),ss(this.instance.config))return!1;if(!wt||!Et)return!1;t=null!=t?t:wt.location,i=null!=i?i:wt.history;try{if(!e){try{wt.localStorage.setItem("test","test"),wt.localStorage.removeItem("test")}catch(t){return!1}e=null==wt?void 0:wt.localStorage}var r,s=Zl||jn(t.hash,"__posthog")||jn(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:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(tu)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}_v(t){var e=At.ph_load_toolbar||At.ph_load_editor;!we(e)&&fe(e)?e(t,this.instance):eu.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==Et||!Et.getElementById(Fs));if(!wt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(wt.localStorage.setItem(tu,JSON.stringify(i({},s,{source:void 0}))),2===this.bv())this._v(s);else if(0===this.bv()){var n;this.yv(1),null==(n=At.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return eu.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,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},Ou=i({experiments:pu},xu),Iu={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 e=t.config.conversations;we(e)||(Ee(e)?this.Sv=e:(this.Sv=e.enabled,this.Me=e),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==At?void 0:At.__PosthogExtensions__;if(t&&!ge(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var e=t.initConversations;if(e)return this.Mv(e),void(this.xv=!1);var i=t.loadExternalDependency;if(!i)return void this.Ev(ut);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.Ev("Could not load conversations script",e):this.Mv(t.initConversations),this.xv=!1}))}catch(t){this.Ev("Error initializing conversations",t),this.xv=!1}}else _u.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,_u.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else _u.error("Cannot complete initialization: remote config is null")}Ev(t,e){_u.error(t,e),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():_u.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!be(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":ge(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?we(this.Me)||!this.Me.token?"missing_token":null!=At&&At.__PosthogExtensions__?this.xv?"initializing":this.Cv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(_u.warn(gu),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(_u.warn(gu),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(_u.warn(gu),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(_u.warn(gu),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(_u.warn(gu),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(_u.warn(gu),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(_u.warn(gu),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}Sl(){var t;null==(t=this._conversationsManager)||t.setIdentity()}xl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Au={logs:class{constructor(t){var e,r=this;this.Iv=!1,this.Rv=!1,this.I=Gr("[logs]"),this.Pv=i({},this.I,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(wu)||r.I.error(...e)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var t,e;this.ph=0,null==(t=this.Lv)||t.onReconnect(),null==(e=this.Ov)||e.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.Iv=!0),wt&&rs(wt,"online",this.Fv)}Dv(t,e,i,r){var s,n=function(t,e){var i,r,s,n,o,a,l,u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=ge(d)?Math.max(h,2048):Math.max(h,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==e?void 0:e.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:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new or(this.$v(t,e),n,this.Pv,(()=>this.Nv()),(t=>t()),void 0,r),n]}qv(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Lv||this.jv!==e){var i;null==(i=this.Lv)||i.reset(),this.jv=e;var r=this.Dv((()=>this.ka),(t=>{this.ka=t}));this.Lv=r[0],this.Bv=r[1]}return this.Lv}Hv(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Ov||this.Uv!==e){var i;null==(i=this.Ov)||i.reset(),this.Uv=e;var r=this.Dv((()=>this.Av),(t=>{this.Av=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},mu);this.Ov=r[0],this.zv=r[1]}return this.Ov}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var i=null==(e=t.config.logs)?void 0:e.captureConsoleLogs;!we(i)&&i&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var t,e;this.ka=[],null==(t=this.Lv)||t.reset(),this.Av=[],null==(e=this.Ov)||e.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,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),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){wu(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==At?void 0:At.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.I.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.Rv=!0)})):this.I.error(ut)}else this.I.error("PostHog Extensions not found.")}}$v(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===Ut.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===Ut.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Mn:t=>this.Mn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Mn(t){return new Promise((e=>{if(Bn(this.ph,3))e({kind:"fatal",error:bu(void 0,"logs endpoint is unreachable, dropping batch")});else{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:bu(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 e=t.statusCode;if(this.Qv(e),e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;0===e?(t.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:bu(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}}))}Qv(t){(0!==t||this._instance.__loaded)&&(this.ph=zn(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,mu,(t=>{this.Av=t}))}Jv(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=nr(o,sr(i,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,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.windowId,s=i.sessionStartTimestamp,n=i.lastActivityTimestamp;e.sessionId=i.sessionId,e.windowId=r,we(s)||(e.sessionStartTimestamp=s),we(n)||(e.lastActivityTimestamp=n)}if(null!=At&&null!=(t=At.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Hi(At.location.href):At.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Fu={metrics:class{constructor(t){this.I=Gr("[metrics]"),this._instance=t}initialize(){}qv(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Lv&&this.jv===i||(null==(e=this.Lv)||e.reset(),this.jv=i,this.Lv=new hr(this.$v(),function(t){var e,i,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i: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}}(i),this.I)),this.Lv}count(t,e,i){void 0===e&&(e=1),this.qv().count(t,e,i)}gauge(t,e,i){this.qv().gauge(t,e,i)}histogram(t,e,i){this.qv().histogram(t,e,i)}flush(t){if(!this.Lv)return Promise.resolve();if(t){var e=this.Lv.drainWindow();return e&&this.Un(e,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,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Un:t=>e.Un(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Un(t,e){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(i({method:"POST",url:this.Kv(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}}))}))}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Mu=i({},xu,Su,Eu,ku,Tu,$u,Ru,Pu,Cu,Ou,Iu,Au,Fu);cl.__defaultExtensionClasses=i({},Mu);var Du=Gr("[ExternalScriptsLoader]"),Nu=t=>{var e=null==Et?void 0:Et.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},Lu=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Du.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=Nu(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",(t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)})),void r.addEventListener("error",(t=>{r.__posthog_loading_error=t,i(t)})))}var n=()=>{if(!Et)return i("document not found");if(Nu(e))return Lu(t,e,i);var r=Et.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)Et.head.appendChild(r);else{var s,n=Et.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):Et.body.appendChild(r)}};null!=Et&&Et.body?n():null==Et||Et.addEventListener("DOMContentLoaded",n)},Uu={},ju=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};At.__PosthogExtensions__=At.__PosthogExtensions__||{},At.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=Uu[s];if("fallback"===r&&n){if(Nu(n))return void Lu(t,n,i);delete Uu[s]}Lu(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=ju(t,e);Uu[s]=a;var l=Nu(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Lu(t,a,i)}else i(void 0,n)}:i)}else Lu(t,ju(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Lu(t,o,i)}},At.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Lu(t,r,i)};var Bu=function(){s.SDK_DIST_CHANNEL="npm";var t=Za[al]=new cl;return function(){function t(){t.done||(t.done=!0,ll=!1,Jr(Za,(function(t){t._dom_loaded()})))}null!=Et&&Et.addEventListener?"complete"===Et.readyState?t():rs(Et,"DOMContentLoaded",t,{capture:!1}):wt&&Wr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=vo,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=go,exports.PostHog=cl,exports.ProductTourEventName=mo,exports.ProductTourEventProperties=yo,exports.SurveyEventName=po,exports.SurveyEventProperties=_o,exports.SurveyEventType=co,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=fo,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Bu,exports.posthog=Bu,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
1
|
+
"use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});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",u="__alias",h="__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",_="$web_vitals_enabled_server_side",g="$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",E="$replay_override_url_trigger",k="$replay_override_event_trigger",T="$sesid",P="$session_is_sampled",R="$enabled_feature_flags",C="$active_feature_flags",O="$early_access_features",I="$feature_flag_details",A="$feature_flag_payloads",F="$feature_flag_request_id",M="$minimal_flag_called_events",D="$override_feature_flags",N="$override_feature_flag_payloads",L="$stored_person_properties",U="$stored_group_properties",j="$groups",B="$surveys",z="$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",et="$initial_referrer_info",it="$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",ut="PostHog loadExternalDependency extension not found.",ht="on_reject",dt="always",vt="anonymous",ct="identified",ft="identified_only",pt="visibilitychange",_t="beforeunload",gt="$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,Et=null==xt?void 0:xt.document,kt=null==xt?void 0:xt.location,Tt=null==xt?void 0:xt.fetch,$t=null!=xt&&xt.XMLHttpRequest&&"withCredentials"in new xt.XMLHttpRequest?xt.XMLHttpRequest:void 0,Pt=null==xt?void 0:xt.AbortController,Rt=null==xt?void 0:xt.CompressionStream,Ct=null==St?void 0:St.userAgent;function Ot(){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 At=null!=wt?wt:{},Ft=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Mt(t){return"string"==typeof t||t}function Dt(t){return"string"==typeof t?t:void 0}var Nt,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"],Ut=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}({}),jt=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Bt=["$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"],zt=["token"],qt="NativeGzipValidationError",Ht=t=>t.length>=2&&31===t[0]&&139===t[1],Vt=(t,e)=>t===jt.GZipJS||e===jt.GZipJS||"gzip"===e,Wt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Gt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=qt,e},Kt=function(){var t=e((function*(t,e){18>t.size&&Gt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ht(i)&&8===i[2]||Gt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(Nt)return Nt;Nt=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;Nt[t]=e>>>0}return Nt})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Gt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Gt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Jt(){return Jt=e((function*(t,i,r){void 0===i&&(i=!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=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),u=(yield Promise.all([l,a]))[0];return yield Kt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Jt.apply(this,arguments)}var Yt=20,Qt=1e3,Xt=1e4,Zt="[Circular]",te="[Truncated]",ee="[Unserializable]",ie="[Function]";function re(t){for(var e="",i=0;t.length>i;i++){var r=t.charCodeAt(i);if(55296>r||r>56319)e+=56320>r||r>57343?t[i]:"�";else{var s=t.charCodeAt(i+1);56320>s||s>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}var se=["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"],ne=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return se.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function oe(t,e){return-1!==t.indexOf(e)}var ae=function(t){return t.trim()},le=function(t){return t.replace(/^\$/,"")};function ue(t){var e,i=[];return null!==(e=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}})))&&void 0!==e?e:"null"}var he=Object.prototype,de=he.hasOwnProperty,ve=he.toString,ce=Array.isArray||function(t){return"[object Array]"===ve.call(t)},fe=t=>"function"==typeof t,pe=t=>t===Object(t)&&!ce(t),_e=t=>{if(pe(t)){for(var e in t)if(de.call(t,e))return!1;return!0}return!1},ge=t=>void 0===t,me=t=>"[object String]"==ve.call(t),ye=t=>me(t)&&0===t.trim().length,be=t=>null===t,we=t=>ge(t)||be(t),xe=t=>"[object Number]"==ve.call(t)&&t==t,Se=t=>xe(t)&&t>0,Ee=t=>"[object Boolean]"===ve.call(t),ke=t=>t instanceof FormData,Te=t=>oe(Bt,t),$e=t=>oe(zt,t);function Pe(t){return null===t||"object"!=typeof t}function Re(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Ce(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 Ie(t,Error)}}function Oe(t){return"undefined"!=typeof Event&&Ie(t,Event)}function Ie(t,e){try{return t instanceof e}catch(t){return!1}}var Ae=[!0,"true",1,"1","yes"],Fe=t=>oe(Ae,t),Me=[!1,"false",0,"0","no"];function De(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),xe(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),De(s||i,e,i,r))}class Ne{constructor(t){this.k={},this.S=t.S,this.C=De(t.bucketSize,0,100,t.I),this.R=De(t.refillRate,0,this.C,t.I),this.A=De(t.refillInterval,0,864e5,t.I)}O(t,e){var i=Math.floor((e-t.lastAccess)/this.A);i>0&&(t.tokens=Math.min(t.tokens+i*this.R,this.C),t.lastAccess=t.lastAccess+i*this.A)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,i):this.k[r]=s={tokens:this.C,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.S)||e.call(this,t)),0===s.tokens)}stop(){this.k={}}}var Le="Mobile",Ue="iOS",je="Android",Be="Tablet",ze=je+" "+Be,qe="iPad",He="Apple",Ve=He+" Watch",We="Safari",Ge="BlackBerry",Ke="Samsung",Je=Ke+"Browser",Ye=Ke+" Internet",Qe="Chrome",Xe=Qe+" OS",Ze=Qe+" "+Ue,ti="Internet Explorer",ei=ti+" "+Le,ii="Opera",ri=ii+" Mini",si="Edge",ni="Microsoft "+si,oi="Firefox",ai=oi+" "+Ue,li="Nintendo",ui="PlayStation",hi="Xbox",di=je+" "+Le,vi=Le+" "+We,ci="Windows",fi=ci+" Phone",pi="Nokia",_i="Ouya",gi="Generic",mi=gi+" "+Le.toLowerCase(),yi=gi+" "+Be.toLowerCase(),bi="Konqueror",wi="Oculus Browser",xi="Vivaldi",Si="Yandex",Ei="Whale",ki="DuckDuckGo",Ti="Pale Moon",$i="Waterfox",Pi="Brave",Ri="Google Search App",Ci="(\\d+(\\.\\d+)?)",Oi=new RegExp("Version/"+Ci),Ii=new RegExp(hi,"i"),Ai=new RegExp(ui+" \\w+","i"),Fi=new RegExp(li+" \\w+","i"),Mi=new RegExp(Ge+"|PlayBook|BB10","i"),Di={"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"},Ni=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Pi:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&oe(t,"GSA/")?Ri:oe(t," OPR/")&&oe(t,"Mini")?ri:oe(t," OPR/")?ii:Mi.test(t)?Ge:oe(t,"IE"+Le)||oe(t,"WPDesktop")?ei:oe(t,"OculusBrowser")?wi:oe(t,Je)?Ye:oe(t,si)||oe(t,"Edg/")?ni:oe(t,xi+"/")?xi:oe(t,"YaBrowser/")?Si:oe(t,Ei+"/")?Ei:oe(t,ki+"/")||oe(t,"Ddg/")?ki:oe(t,"FBIOS")?"Facebook "+Le:oe(t,"UCWEB")||oe(t,"UCBrowser")?"UC Browser":oe(t,"CriOS")?Ze:oe(t,"CrMo")||oe(t,Qe)?Qe:oe(t,je)&&oe(t,We)?di:oe(t,"FxiOS")?ai:oe(t.toLowerCase(),bi.toLowerCase())?bi:oe(t,Pi+"/")?Pi:((t,e)=>e&&oe(e,He)||function(t){return oe(t,We)&&!oe(t,Qe)&&!oe(t,je)}(t))(t,e)?oe(t,Le)?vi:We:oe(t,"PaleMoon/")?Ti:oe(t,$i+"/")?$i:oe(t,oi)?oi:oe(t,"MSIE")||oe(t,"Trident/")?ti:oe(t,"Gecko")?oi:"")},Li={[ei]:[new RegExp("rv:"+Ci)],[ni]:[new RegExp(si+"?\\/"+Ci)],[Qe]:[new RegExp("("+Qe+"|CrMo)\\/"+Ci)],[Ze]:[new RegExp("CriOS\\/"+Ci)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ci)],[We]:[Oi],[vi]:[Oi],[ii]:[new RegExp("(Opera|OPR)\\/"+Ci)],[oi]:[new RegExp(oi+"\\/"+Ci)],[ai]:[new RegExp("FxiOS\\/"+Ci)],[bi]:[new RegExp("Konqueror[:/]?"+Ci,"i")],[Ge]:[new RegExp(Ge+" "+Ci),Oi],[di]:[new RegExp("android\\s"+Ci,"i")],[Ye]:[new RegExp(Je+"\\/"+Ci)],[wi]:[new RegExp("OculusBrowser\\/"+Ci)],[xi]:[new RegExp(xi+"\\/"+Ci)],[Si]:[new RegExp("YaBrowser\\/"+Ci)],[Ei]:[new RegExp(Ei+"\\/"+Ci)],[Pi]:[new RegExp(Pi+"\\/"+Ci)],[ki]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Ci)],[Ti]:[new RegExp("PaleMoon\\/"+Ci)],[$i]:[new RegExp($i+"\\/"+Ci)],[Ri]:[new RegExp("GSA\\/"+Ci)],[ti]:[new RegExp("(rv:|MSIE )"+Ci)],Mozilla:[new RegExp("rv:"+Ci)]},Ui=function(t,e,i,r){var s=Ni(t,e,i,r),n=Li[s];if(ge(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},ji=[[new RegExp(hi+"; "+hi+" (.*?)[);]","i"),t=>[hi,t&&t[1]||""]],[new RegExp(li,"i"),[li,""]],[new RegExp(ui,"i"),[ui,""]],[Mi,[Ge,""]],[new RegExp(ci,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[fi,""];if(new RegExp(Le).test(e)&&!/IEMobile\b/.test(e))return[ci+" "+Le,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Di[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[ci,r]}return[ci,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Ue,[t[3],t[4],t[5]||"0"].join(".")]:[Ue,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=ge(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+je+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+je+")","i"),t=>t&&t[2]?[je,[t[2],t[3],t[4]||"0"].join(".")]:[je,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Xe,""]],[/Linux|debian/i,["Linux",""]]],Bi=function(t){return Fi.test(t)?li:Ai.test(t)?ui:Ii.test(t)?hi:new RegExp(_i,"i").test(t)?_i:new RegExp("("+fi+"|WPDesktop)","i").test(t)?fi:/iPad/.test(t)?qe:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ve:Mi.test(t)?Ge:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(pi,"i").test(t)?pi:/(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(Le).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)?je:ze:new RegExp("(pda|"+Le+")","i").test(t)?mi:new RegExp(Be,"i").test(t)&&!new RegExp(Be+" pc","i").test(t)?yi:""},zi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function qi(t,e){return"string"==typeof(i=t)&&zi.test(i)?t:e();var i}function Hi(t){return t?t.split("#")[0]:t}function Vi(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function Wi(t,e,i){return Gi.apply(this,arguments)}function Gi(){return(Gi=e((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Vi((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ki={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}},Ji=Ki.info,Yi=0x8000000000000000,Qi={}.propertyIsEnumerable;function Xi(t,e){try{return er(t,e,{ancestors:new WeakSet,remainingNodes:Xt},0)}catch(t){return[]}}function Zi(t,e,i,r){if(0>=i.remainingNodes)return{stringValue:te};if(i.remainingNodes--,Ee(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>=Yi||-Yi>t?(null==e||e.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:re(t)};if("function"==typeof t)return{stringValue:ie};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:Zt};if(r>=Yt)return{stringValue:te};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?re(o):String(o)}}i.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Zi(a.call(t),e,i,r+1)}catch(t){}return ce(t)?{arrayValue:{values:tr(t,e,i,r+1)}}:{kvlistValue:{values:er(t,e,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:re(String(t))}}function tr(t,e,i,r){for(var s=[],n=Math.min(t.length,Qt),o=0;n>o&&i.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(we(a))continue;s.push(Zi(a,e,i,r))}catch(t){s.push({stringValue:ee})}return t.length>o&&s.push({stringValue:te}),s}function er(t,e,i,r){var s=[];for(var n in t)if(Qi.call(t,n)){if(s.length>=Qt||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(be(o)||ge(o))continue;s.push({key:re(n),value:Zi(o,e,i,r)})}catch(t){s.push({key:re(n),value:{stringValue:ee}})}}return s}function ir(t){try{return re(String(t))}catch(t){return ee}}function rr(t,e,r){var s=Ki[t.level||"info"]||Ji,n=s.text,o=s.number,a=String(Date.now())+"000000",l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),we(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),we(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);var u=i({},l),h=t.attributes;if(h){var d=[];try{d=Object.keys(h)}catch(t){d=[]}for(var v of d){var c=void 0;try{c=h[v]}catch(t){c=ee}Object.defineProperty(u,v,{value:c,enumerable:!0,writable:!0,configurable:!0})}}var f={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:ir(t.body)},attributes:Xi(u,r)};return t.trace_id&&(f.traceId=t.trace_id),t.span_id&&(f.spanId=t.span_id),ge(t.trace_flags)||(f.flags=t.trace_flags),f}function sr(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function nr(t,e,i,r){return{resourceLogs:[{resource:{attributes:Xi(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let or=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.qi=e,this.I=i,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=e.maxBufferSize,this.pn=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.gn=e.flushIntervalMs,this.mn=e.maxBatchRecordsPerPost,this.yn=e.rateCapWindowMs,this.bn=e.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 e=this.kn(t);if(null!==e)if(e.body){if(this.Sn()){var i={record:rr(e,this.rn(),this.I)};this.nn((()=>this.xn(i)))}}else this.I.info("Log was rejected in beforeSend function")}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var i=ce(e)?e:[e],r=t;for(var s of i)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(),e=t-this.dn;return this.yn>e&&e>=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 e((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return e((function*(){var e;t._n();var i=null!==(e=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.un=0;var a=Math.min(i.length,t.mn),l=i.slice(0,a),u=nr(l.map((t=>t.record)),t.Tn(),null!==(n=t.an)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.Mn(u);if("too-large"===h.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"===h.kind)throw h.error;if("too-large"===h.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"===h.kind&&t.qi.maxBatchRecordsPerPost>t.mn&&(t.mn=Math.min(t.qi.maxBatchRecordsPerPost,t.mn+1)),yield t.En(l.length),i=null!==(o=t._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}En(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.un),s=null!==(e=i._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ut.LogsQueue,s.slice(r)),yield i.sn()}))()}Tn(){return sr(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ut.LogsQueue))&&void 0!==e?e:[];this.pn>i.length||(i.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ut.LogsQueue,i),this.fn>i.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Vi((()=>{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(Ut.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i._n();var e=i.flush().catch((()=>{}));void 0!==t?yield Wi(e,t):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=i.flush();yield Wi(e,t,(()=>{e.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 ur(t,e,i,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+e+"\0"+(null!=i?i:"")+"\0"+s}let hr=class{constructor(t,e,i){this._instance=t,this.qi=e,this.I=i,this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.$n=0}count(t,e,i){void 0===e&&(e=1),this.Nn({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Nn({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Nn({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this,i=this.ln,r=function(){var r=e((function*(){i&&(yield i.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 e=this.kn(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.I.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else{var r,s;try{r=e.attributes?i({},e.attributes):void 0,s=ur(e.type,e.name,e.unit,r)}catch(t){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var n=this.Fn.get(s);if(!n){if(!this.Bn())return;n={name:e.name,type:e.type,unit:e.unit,attributes:r,windowStartMs:Date.now()},this.Fn.set(s,n)}var o=this.On.get(e.name);void 0===o?this.On.set(e.name,e.type):o===e.type||this.Dn.has(e.name)||(this.Dn.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+o+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(n,e.value),this.In()}else this.I.warn("Dropping metric '"+e.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,e){var i;switch(t.type){case"count":t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(ar.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(t,e){for(var i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,ar)]+=1}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var i=ce(e)?e:[e],r=t;for(var s of i)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=Vi((()=>{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 e((function*(){if(0!==t.Fn.size){var e=t.Fn;t.Fn=new Map,t.Ln=!1,t.On=new Map,t.Dn=new Set;var i=t.$n,r=yield t._instance.Un(t.jn(e));if(i===t.$n)switch(r.kind){case"ok":return;case"retry-later":return t.zn(e),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 e=this.Wn(t),r=function(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Xi(r)},scopeMetrics:[{scope:{name:s,version:n},metrics:e}]}]};var e,r,s,n}Wn(t){var e=lr(Date.now()),r=new Map;for(var s of t.values()){var n,o=ur(s.type,s.name,s.unit,void 0),a=r.get(o);a||(a=i({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=Xi(null!==(n=s.attributes)&&void 0!==n?n:{},this.I),u=lr(s.windowStartMs);if("count"===s.type){var h,d={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(h=s.total)&&void 0!==h?h:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:e,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:u,timeUnixNano:e,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 e,i;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!==(e=o.total)&&void 0!==e?e:0)+(null!==(i=n.total)&&void 0!==i?i: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 e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return cr&&i.length===vr||(vr=i.length,cr=i.reduce(((i,r)=>{dr||(dr={});var s=dr[r];if(s)i[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,u=e[r];if(l&&u){i[l]=u,dr[r]=[l,u];break}}return i}),{})),cr}}class pr{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&ce(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.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,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:fr(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var _r="?";function gr(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?_r:i,in_app:!(null!=e&&e.startsWith("webkit-masked-url://"))&&"<anonymous>"!==e};return ge(r)||(n.lineno=r),ge(s)||(n.colno=s),n}var mr=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:_r,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},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,e)=>{var i=yr.exec(t);if(i)return gr(e,i[1],_r,+i[2],+i[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]||_r,r[2]);return gr(e,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,Er=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,kr=(t,e)=>{var i=Sr.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Er.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||_r,o=mr(n,s);return gr(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Tr=/\(error: (.*)\)/;class $r{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=me(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return Re(t,"DOMException")}isDOMError(t){return Re(t,"DOMError")}}class Pr{match(t){return Ce(t)}coerce(t,e){var i,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=r?r:null==(i=e.syntheticException)?void 0:i.stack,cause:t.cause?e.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class Rr{constructor(){}match(t){return!!Re(t,"ErrorEvent")&&(null!=t.error||this.fi(t))}coerce(t,e){var r;if(null!=t.error)return e.apply(t.error);var s=e.apply(t.message);return i({},s,{stack:null!==(r=this.pi(t))&&void 0!==r?r:s.stack,synthetic:!0})}fi(t){return me(t.message)&&t.message.length>0}pi(t){var e,i,r=t,s=null!==(e=r.lineno)&&void 0!==e?e:0,n=null!==(i=r.colno)&&void 0!==i?i:0;if(me(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var Cr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Or{match(t){return"string"==typeof t}coerce(t,e){var i,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(Cr);return r&&(e=r[1],i=r[2]),[e,i]}}var Ir=["fatal","error","warning","log","info","debug"];function Ar(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Fr{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r,s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null==(r=e.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Oe(t))return t.constructor.name;var e="name"in t?t.name:void 0;return me(e)&&!ye(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Ar(t)}isSeverityLevel(t){return me(t)&&!ye(t)&&Ir.indexOf(t)>=0}getStack(t){try{return me(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:me(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Ce(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Mr{match(t){return Oe(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Ar(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Dr{match(t){return Pe(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Nr{match(t){return Re(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Oe(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return Pe(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.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",Ur="$timestamp",jr=new Set([Lr,Ur]),Br={enabled:!0,max_bytes:32768};function zr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Br.enabled,max_bytes:Hr(t.max_bytes,Br.max_bytes)}:i({},Br)}class qr{constructor(t){this.Vn=[],this.Gn=0,this.qi=zr(t)}setConfig(t){this.qi=zr(t),this.Zn()}add(t){var e=function(t){var e;try{e=ue(t)}catch(t){return}try{var i=JSON.parse(e);if(!pe(i))return;var r=i,s=r[Lr],n=r[Ur];if(!me(s)||0===s.trim().length)return;if(!me(n)&&!xe(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.qi.max_bytes||(this.Vn.push({step:e.step,bytes:i}),this.Gn+=i,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,e){if(!xe(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Vr=function(t,e){var i=(void 0===e?{}:e).debugEnabled,r={F(e){if(wt&&(s.DEBUG||wt.POSTHOG_DEBUG||i)&&!ge(wt.console)&&wt.console){for(var r=("__rrweb_original__"in wt.console[e]?wt.console[e].__rrweb_original__:wt.console[e]),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,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.F("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>Vr(t+" "+e,i)};return r},Wr=Vr("[PostHog.js]"),Gr=Wr.createLogger;function Kr(t,e){ce(t)&&t.forEach(e)}function Jr(t,e){if(!we(t))if(ce(t))t.forEach(e);else if(ke(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)de.call(t,i)&&e(t[i],i)}var Yr=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Qr(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Xr=function(t){try{return t()}catch(t){return}},Zr=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}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 e={};return Jr(t,(function(t,i){(me(t)&&t.length>0||xe(t))&&(e[i]=t)})),e};var es=["herokuapp.com","vercel.app","netlify.app"];function is(t){var e=null==t?void 0:t.hostname;if(!me(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of es)if(i===r)return!1;return!0}function rs(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o})}function ss(t){return"ph_toolbar_internal"===t.name}var ns=t=>{if(Et){try{for(var e=t+"=",i=Et.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.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 xe(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,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>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|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new os(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(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 e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class as{generate(){var t=this.generateOrAbort();if(!ge(t))return t;this.Rr=0;var e=this.generateOrAbort();if(ge(e))throw new Error("Could not generate UUID after timestamp reset");return e}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 hs}}var ls,us=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};wt&&!ge(wt.crypto)&&crypto.getRandomValues&&(us=t=>crypto.getRandomValues(t));class hs{nextUint32(){return this.ft.length>this.Fr||(us(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:()=>!!Et,jr(t){Wr.error("cookieStore error: "+t)},Pr:ns,Br(t){var e;try{e=JSON.parse(ps.Pr(t))||{}}catch(t){}return e},Dr(t,e,i,r,s){if(!Et)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=Et),cs)return cs;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+ds();!cs&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",cs=n)}return cs}(t);if(!i){var r=(t=>{var e=t.match(fs);return e?e[0]:""})(t);r!==i&&Wr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(Et.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Wr.warn("cookieStore warning: large cookie, len="+u.length),Et.cookie=u,!0}catch(t){return!1}},qr(t,e){if(null!=Et&&Et.cookie)try{ps.Dr(t,"",-1,e)}catch(t){return}}},_s=null,gs={Nr(){if(!be(_s))return _s;var t=!0;if(ge(wt))t=!1;else try{var e="__mplssupport__";gs.Dr(e,"xyz"),'"xyz"'!==gs.Pr(e)&&(t=!1),gs.qr(e)}catch(e){t=!1}return t||Wr.error("localStorage unsupported; falling back to cookie store"),_s=t,t},jr(t){Wr.error("localStorage error: "+t)},Pr(t){try{return null==wt?void 0:wt.localStorage.getItem(t)}catch(t){gs.jr(t)}return null},Br(t){try{return JSON.parse(gs.Pr(t))||{}}catch(t){}return null},Dr(t,e){try{return null==wt||wt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){gs.jr(t)}return!1},qr(t){try{null==wt||wt.localStorage.removeItem(t)}catch(t){gs.jr(t)}}},ms=[L,C,R,I,A,F,Y,J,G],ys=[a,o,T,P,rt,it,Q],bs=t=>t+"_cpm",ws=["__proto__","constructor","prototype"],xs=t=>{if(!pe(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===ws.indexOf(i)&&(e[i]=t[i])})),e},Ss=function(t,e){void 0===e&&(e=[]);var i={};return[...ys,...e].forEach((e=>{var r=t[e];ge(r)||be(r)||""===r||(i[e]=r)})),i},Es=t=>{for(var e=5381,i=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},ks=(t,e)=>({p:e,f:Es(JSON.stringify(t))}),Ts=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=ps.Br(bs(t)),r=(null==i?void 0:i.f)===Es(e)&&ce(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},$s=(t,e)=>e+"|"+(ps.Pr(bs(t))||""),Ps={},Rs={Nr:()=>!0,jr(t){Wr.error("memoryStorage error: "+t)},Pr:t=>Ps[t]||null,Br:t=>Ps[t]||null,Dr:(t,e)=>(Ps[t]=e,!0),qr(t){delete Ps[t]}},Cs=null,Os={Nr(){if(!be(Cs))return Cs;if(Cs=!0,ge(wt))Cs=!1;else try{var t="__support__";Os.Dr(t,"xyz"),'"xyz"'!==Os.Pr(t)&&(Cs=!1),Os.qr(t)}catch(t){Cs=!1}return Cs},jr(t){Wr.error("sessionStorage error: ",t)},Pr(t){try{return null==wt?void 0:wt.sessionStorage.getItem(t)}catch(t){Os.jr(t)}return null},Br(t){try{return JSON.parse(Os.Pr(t))||null}catch(t){}return null},Dr(t,e){try{return null==wt||wt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){Os.jr(t)}return!1},qr(t){try{null==wt||wt.sessionStorage.removeItem(t)}catch(t){Os.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===ht}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,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get fs(){var t=this.ps.Pr(this.gs);return Fe(t)?1:oe(Me,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,e="localStorage"===t?gs:ps;if(!this.ys||this.ys!==e){this.ys=e;var i="localStorage"===t?ps:gs;i.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(Fe(i.Pr(this.gs))),i.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,At.doNotTrack].some((t=>Fe(t)))}}function As(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!fe(r))return e;try{var s=r(e);return me(s)&&s?s:e}catch(t){return Wr.error("Error in get_current_url, falling back to window.location.href",t),e}}var Fs="__POSTHOG_TOOLBAR__",Ms=1,Ds=3,Ns=11;function Ls(t){return t instanceof Element&&(t.id===Fs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Us(t){return!!t&&t.nodeType===Ms}function js(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Bs(t){return!!t&&t.nodeType===Ds}function zs(t){return!!t&&t.nodeType===Ns&&Us(t.host)}var qs=1e3;function Hs(t){return t?ae(t).split(/\s+/):[]}function Vs(t,e){var i=function(t){var e,i=null==wt||null==(e=wt.location)?void 0:e.href;return ge(i)?void 0:As(t,i)}(e);return!!(i&&t&&t.some((t=>i.match(t))))}function Ws(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Hs(e)}function Gs(t){return we(t)?null:ae(t).split(/(\s+)/).filter((t=>mn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ks(t){var e="";return un(t)&&!hn(t)&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var i;Bs(t)&&t.textContent&&(e+=null!==(i=Gs(t.textContent))&&void 0!==i?i:"")})),ae(e)}function Js(t){var e;return ge(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var Ys=["a","button","form","input","select","textarea","label"];function Qs(t,e){if(ge(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function Xs(t){var e=t.parentNode;return!(!e||!Us(e))&&e}var Zs=[".ph-no-autocapture","[data-ph-no-autocapture]"],tn=["next","previous","prev",">","<"],en=[...tn,"+","-","−","–"],rn=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,sn=[".ph-no-rageclick",".ph-no-capture"],nn=["","text","search","email","password","url","tel","number"];function on(t,e){if(!wt||an(t))return!1;var i,r,s,n,o;if(Ee(e)?(i=!!e&&sn,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:sn,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!Us(t))&&(!!js(t,"textarea")||(js(t,"input")?oe(nn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var a=ln(t,!1).targetElementList;return!function(t,e){if(!1===t||ge(t))return!1;var i;if(!0===t)i=tn;else{if(!ce(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;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var e=t.safeText,r=t.ariaLabel;return i.some((t=>rn(e,t)||rn(r,t)))}))}(r,a.map((t=>{var e;return{safeText:Ks(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Qs(a,i)}var an=t=>!t||js(t,"html")||!Us(t),ln=(t,e)=>{if(!wt||an(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!js(s,"body");)if(zs(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Xs(s);if(!n)break;if(e||Ys.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=wt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function un(t){for(var e=new Set,i=0,r=t;r.parentNode&&!js(r,"body");r=r.parentNode){if(i++>=qs||e.has(r))return!1;e.add(r);var s=Ws(r);if(oe(s,"ph-sensitive")||oe(s,"ph-no-capture"))return!1}if(oe(Ws(t),"ph-include"))return!0;var n=t.type||"";if(me(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!me(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 hn(t){return!!(js(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||js(t,"select")||js(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"),_n=/[0-9A-Za-z_]/;function gn(t){for(var e=0,i=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;i&&(s*=2)>9&&(s-=9),e+=s,i=!i}return e%10==0}function mn(t,e){if(void 0===e&&(e=!0),we(t))return!1;if(me(t)){t=ae(t);var i=e?dn.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(vn.lastIndex=0;e=vn.exec(t);){var i=e[2];if(i)for(var r=i.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)&&gn(a))return!0}}}return!1}(t);if(i)return!1;var r=e?fn.test(t):function(t){var e;for(pn.lastIndex=0;e=pn.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&_n.test(i)&&_n.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function yn(t){var e=Ks(t);return mn(e=(e+" "+bn(t)).trim())?e:""}function bn(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Jr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Ks(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+bn(t)).trim())}catch(t){Wr.error("[AutoCapture]",t)}})),e}function wn(t){return t.replace(/"|\\"/g,'\\"')}function xn(t){var e=t.attr__class;if(e)return ce(e)?e:Hs(e)}var Sn=Gr("[Dead Clicks]"),En=()=>!0,kn=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return Ee(r)?r:!!pe(r)||i};class Tn{get lazyLoadedDeadClicksAutocapture(){return this.bs}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[g]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s((()=>{this.ws()})):this.stop()}_s(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Sn.error("failed to load script",e):t()}))}ws(){var t;if(Et){if(!this.bs&&null!=(t=At.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=pe(this.instance.config.capture_dead_clicks)?i({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.bs=At.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.bs.start(Et),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 $n=Gr("[SegmentIntegration]");var Pn="posthog-js";function Rn(t,e){var r=void 0===e?{}:e,s=r.organization,n=r.projectId,o=r.prefix,a=r.severityAllowList,l=void 0===a?["error"]:a,u=r.sendExceptionsToPostHog,h=void 0===u||u;return e=>{var r,a,u,d,v;if("*"!==l&&!l.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(r=e.exception)?void 0:r.values)||[],_=p.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(a=p[0])?void 0:a.value)||e.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return s&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+e.event_id),h&&(null==(f=t.exceptions)||f.sendExceptionEvent(g)),e}}class Cn{constructor(t,e,i,r,s,n){this.name=Pn,this.setupOnce=function(o){o(Rn(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class On{constructor(t){this.ks=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Wr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),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,e){var i,r=this.Ts(t,e);return this.Ss={pathname:null!==(i=null==wt?void 0:wt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Ts(t,null==(e=this.Ss)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,e){var i=this.Ss;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.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,u=s.lastContentY,h=s.maxContentY;if(!(ge(n)||ge(o)||ge(a)||ge(l)||ge(u)||ge(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?De(o/n,0,1,Wr):1,v=n>1?De(a/n,0,1,Wr):1,c=l>1?De(u/l,0,1,Wr):1,f=l>1?De(h/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:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var In=["flags","surveys"],An={[n]:{exposure:"hidden"},[u]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[h]:{exposure:"hidden"},[d]:{exposure:"event"},[v]:{exposure:"hidden"},[c]:{exposure:"event"},[f]:{exposure:"hidden"},[p]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"event"},[m]:{exposure:"hidden"},[y]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[T]:{exposure:"hidden"},[P]:{exposure:"event"},[w]:{exposure:"event",shouldSkipFromEventProperties:t=>be(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"},[R]:{exposure:"hidden",storageGroup:"flags"},[C]:{exposure:"hidden",storageGroup:"flags"},[O]:{exposure:"hidden"},[I]:{exposure:"hidden",storageGroup:"flags"},[A]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[M]:{exposure:"hidden",storageGroup:"flags"},[D]:{exposure:"hidden"},[N]:{exposure:"hidden"},[L]:{exposure:"hidden"},[U]:{exposure:"hidden"},[B]:{exposure:"hidden",storageGroup:"surveys"},[z]:{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"},[j]:{exposure:"event"},[J]:{exposure:"hidden"},[Y]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Q]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden"},[it]:{exposure:"hidden"},[rt]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"event"},[E]:{exposure:"event"},[k]:{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"}},Fn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Mn=t=>{var e=An[t];if(e)return e;for(var i of Fn){var r=i[1];if(0===t.indexOf(i[0]))return r}},Dn=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return ue(t)}},Nn=t=>{var e=null==Et?void 0:Et.createElement("a");return ge(e)?null:(e.href=t,e)},Ln=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!ce(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Wr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Un=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");ce(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},jn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Bn=(t,e)=>t>=e&&Ot(),zn=(t,e,i,r)=>{if(0===t){if(Ot()){var s=e+1;return s===i&&r(),s}return e}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,e,i){if(!Et)return{};var r,s=e?[...Hn,...i||[]]:[],n=Jn(Un(Et.URL,s,Wn),t),o=(r={},Jr(Gn,(function(t){var e=ns(t);r[t]=e||null})),r);return Yr(o,n)}function Jn(t,e){var i=Vn.concat(e||[]),r={};return Jr(i,(function(e){var i=Ln(t,e);r[e]=i||null})),r}function Yn(t){var e=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),i="yahoo"!=e?"q":"p",r={};if(!be(e)){r.$search_engine=e;var s=Et?Ln(Et.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Qn(){return navigator.language||navigator.userLanguage}var Xn="$direct";function Zn(){return(null==Et?void 0:Et.referrer)||Xn}function to(t,e,i){void 0===i&&(i=!1);var r=t?[...Hn,...e||[]]:[],s=i?Hi(null==kt?void 0:kt.href):null==kt?void 0:kt.href,n=null==s?void 0:s.substring(0,1e3);return{r:Zn().substring(0,1e3),u:n?Un(n,r,Wn):void 0}}function eo(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Hi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==Xn?Xn:null==(i=Nn(r))?void 0:i.host};if(n){o.$current_url=n;var a=Nn(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 u=Yn(r);Yr(o,u)}return o}function io(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ro(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var so={flags:Y,surveys:z},no=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],oo=t=>t+"_cookie_identity_change_pending",ao="main",lo=(t,e)=>{Jr(t,((i,r)=>{var s=Mn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class uo{constructor(t,e,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 e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.ps=this.Os(t),this.Is=this.Ds(t),this.load(),t.debug&&Wr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),wt){var s=()=>this.flush();rs(wt,"beforeunload",s,{capture:!1}),rs(wt,"pagehide",s,{capture:!1})}}$s(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return xe(e)&&e>0?e:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var e=Ss(t,this.qi.cookie_persisted_properties||[]),i=ks(e,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=ps.Pr(this.Ls)||void 0;s&&$s(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?$s(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,e){if(void 0===e&&(e=!1),this.Hs&&!e||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var i;try{i=ps.Pr(this.Ls)||void 0}catch(t){}if(!i||i===this.js)return!1;var r,s=$s(this.Ls,i);try{r=xs(JSON.parse(i))}catch(t){return!1}if((ps.Pr(this.Ls)||void 0)!==i)return!1;this.qs=s,this.js=i;var n=Ts(this.Ls,i),a=[...ys,...n.properties],l={};if(Object.keys(r).forEach((t=>{var e=r[t];(ge(e)||be(e)||""===e||t===Q&&e!==vt&&e!==ct)&&(l[t]=!0,delete r[t])})),_e(r))return!1;var h=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]&&(h||t!==o&&t!==Q)){var e=c[t];!n.isValid&&-1!==ys.indexOf(t)&&(!1===e||0===e)||delete c[t]}})),this.props=Yr(c,r),!h||Q in r||Q in this.props||this.Us(Q,vt);var f=this.props[o],p=this.props[Q];return!h||f===d&&p===v||(this.Rs=!0,Os.Dr(oo(this.Ls),!0),this.zs(L),this.zs(C),this.zs(R),this.zs(I),this.zs(A),this.zs(F),this.zs(Y),this.zs(J),this.zs(G),p===vt&&(v===ct||r[Q]===vt||!ge(d)&&f!==d)&&(lo(this.props,r),this.zs(U)),p===ct?this.props.$user_id=f:delete this.props.$user_id,this.zs(u)),!0}consumeCookieIdentityChange(){var t=oo(this.Ls),e=this.Rs||!!Os.Pr(t);return this.Rs=!1,e&&Os.qr(t),e}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&&(ge(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():ge(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 e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...ys,...t];return i({},gs,{Br(t){try{var i,s={};try{i=ps.Pr(t)||void 0,s=i?xs(JSON.parse(i)):{}}catch(t){}var n,a=JSON.parse(gs.Pr(t)||"{}");if(e){var l=Ts(t,i),u=[...ys,...l.properties],h={};Object.keys(s).forEach((t=>{var e=s[t];be(e)||""===e||t===Q&&e!==vt&&e!==ct||(h[t]=e)}));var d=o in h||h[Q]===vt||h[Q]===ct;if(Object.keys(h).length>0){var v,c=a[o],f=null!==(v=a[Q])&&void 0!==v?v:vt;r.forEach((t=>{if(-1!==u.indexOf(t)&&!(t in s)&&(d||t!==o&&t!==Q)){var e=a[t];!l.isValid&&-1!==ys.indexOf(t)&&(!1===e||0===e)||delete a[t]}})),!d||Q in s||Q in a||(a[Q]=vt),!d||(o in h?h[o]:a[o])===c&&(Q in h?h[Q]:a[Q])===f||(ms.forEach((t=>delete a[t])),h[Q]===ct&&o in h?a.$user_id=h[o]:delete a.$user_id,h[Q]!==ct&&(delete a[j],delete a[U]),delete a.__alias)}n=Yr(a,h)}else n=Yr(s,a);return gs.Dr(t,n),n}catch(t){}return null},Dr(i,r,s,n,o,a){var l=gs.Dr(i,r,void 0,void 0,a);try{var u=Ss(r,t);if(Object.keys(u).length){if(e){var h=bs(i),d=ks(u,t);if(ps.Dr(h,d,s,n,o,a),ps.Pr(h)!==JSON.stringify(d)){ps.qr(h,n);var v=Ss(r);return ps.Dr(i,v,s,n,o,a),l}}ps.Dr(i,u,s,n,o,a)}}catch(t){gs.jr(t)}return l},qr(t,e){try{null==wt||wt.localStorage.removeItem(t),ps.qr(t,e),ps.qr(bs(t),e)}catch(t){gs.jr(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&gs.Nr()?(e=gs,s=!0):"localstorage+cookie"===n&&r.Nr()?(e=r,s=!0):"sessionstorage"===n&&Os.Nr()?e=Os:"memory"===n?e=Rs:"cookie"===n?e=ps:r.Nr()?(e=r,s=!0):e=ps,this.Es=s,e}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return Jr(this.props,((e,i)=>{var r=Mn(i);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e))return;t[i]=e}})),t}load(t){if(void 0===t&&(t=!1),!this.Hs||t){var e=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),i=e?gs.Br(this.Ls):null,r={};if(e)try{Jr(r=xs(ps.Br(this.Ls)),((t,e)=>{(ge(t)||be(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=Yr({},s)),this.Is&&this.Ks(),e&&s){var n,a,l=null==i?void 0:i[o],u=null!==(n=null==i?void 0:i[Q])&&void 0!==n?n:vt,h=s[o],d=null!==(a=s[Q])&&void 0!==a?a:vt;if(h!==l||d!==u){this.Rs=!0,Os.Dr(oo(this.Ls),!0);var v=Yr({},this.props);ms.forEach((t=>delete v[t])),d===vt&&(u===ct||r[Q]===vt||!ge(l)&&h!==l)&&(lo(v,r),delete v[U]),this.props=v;var c=new Set;ms.forEach((t=>{var e,i=null==(e=Mn(t))?void 0:e.storageGroup;i&&c.add(i)})),c.forEach((t=>{var e={};Jr(this.props,((i,r)=>{var s;(null==(s=Mn(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),_e(e)?(gs.qr(this.Js(t)),this.Ms[t]={}):gs.Dr(this.Js(t),e)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(e,t)})}))}}Os.Pr(oo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of In){var e=gs.Br(this.Js(t));if(e&&!_e(e)){var i=this.Xs(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Ys(e,t)),this.ea(t,e)||Yr(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Mn(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=so[t];if(!i)return!1;var r=e[i],s=this.props[i];return xe(r)&&xe(s)&&s>r}refreshKey(t){var e;if(!this.Hs){var i=this.Is?null==(e=Mn(t))?void 0:e.storageGroup:void 0,r=i?gs.Br(this.Js(i)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(i){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?ge(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){ge(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(),e=t.main,i=t.groups;for(var r of(this.ra(this.ps,this.Ls,e,ao)&&this.Ns(e),In)){var s,n=i[r];(!_e(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(gs,this.Js(r),n,r)}}na(){var t={},e={flags:{},surveys:{}};return Jr(this.props,((i,r)=>{var s,n=null==(s=Mn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ys(t,e){if(e===ao)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var i={};return Jr(t,((t,e)=>{var r;i[e]=null!=(r=Mn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Xs(r);if(r!==ao&&!n.dirty&&!ge(n.fingerprint))return!1;try{if((s=this.Ys(i,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(e,i,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==ao&&(n.persisted=!0),ge(s)||(n.fingerprint=s),!0):(this.qi.debug&&Wr.warn('failed to persist storage entry "'+e+'"; will retry on next save'),!1)}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(ge(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!i&&this.As)for(var r of In)gs.qr(this.Js(r));i?delete this.Ms[ao]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(pe(t)){this.syncCookieProperties(),ge(e)&&(e="None"),this.sa=ge(i)?this.la:i;var r=!1;if(Jr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Us(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(pe(t)){this.syncCookieProperties(),this.sa=ge(e)?this.la:e;var i=!1;if(Jr(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||pe(e)||ce(e))&&(this.Us(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var e="string"==typeof t?[t]:t,i=!1;for(var r of e)r in this.props&&(this.zs(r),i=!0);i&&this.save()}update_campaign_params(){var t=null==Et?void 0:Et.URL;if(t!==this.Fs){var e=Kn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);_e(ts(e))||this.register(e),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==Et?void 0:Et.referrer)?Yn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Zn(),$referring_domain:null!=Et&&Et.referrer&&(null==(t=Nn(Et.referrer))?void 0:t.host)||Xn},void 0)}set_initial_person_info(){this.props[tt]||this.props[et]||this.register_once({[it]: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([et,tt],(e=>{var i=this.props[e];i&&Jr(i,(function(e,i){t["$initial_"+le(i)]=e}))}));var e=this.props[it];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=eo(t,e),r={};return Jr(i,(function(t,e){r["$initial_"+le(e)]=t})),r}(e,this.qi.disable_capture_url_hashes);Yr(t,i)}return t}safe_merge(t){return Jr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,r){var s=t.persistence!==e.persistence,n=!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,l=t.disable_persistence||!!r,u=!!this.Hs&&!l;l||this.Bs(e,u),this.qi=t,!l&&(s||n||a)&&(this.qs=void 0,this.js=void 0,this.Bs(i({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),u));var h=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(u);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=h,this.Is=d,this.props=f,this.save()}else a&&(this.ps=h,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,e){var i=this.props[h]||{};i[t]=e,this.Us(h,i),this.save()}remove_event_timer(t){var e=this.props[h]||{},i=e[t];return ge(i)||(delete e[t],this.Us(h,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Us(t,e),this.save()}Us(t,e){var i;this.props[t]=e,null!=(i=Mn(t))&&i.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var e,i=null==(e=Mn(t))?void 0:e.storageGroup;i&&(this.Xs(i).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function ho(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&fe(i.then)&&i.then(void 0,(()=>{}))}}}}var vo={GZipJS:"gzip-js",Base64:"base64"},co={Activation:"events",Cancellation:"cancelEvents"},fo={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},po={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},_o={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},go={Popover:"popover",Inline:"inline"},mo={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},yo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},bo=Gr("[RateLimiter]");class wo{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).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:e})}},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 e,i,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(Z))&&void 0!==e?e:{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 u=(xe(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.ha(u)&&(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 e=this.instance.config.property_denylist;return!ce(e)||!e.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=kt&&kt.pathname)return""+(null!==(t=kt.origin)&&void 0!==t?t:"")+kt.pathname}ha(t){var e,i,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$session_id")?null==(e=(i=this.instance).get_session_id)?void 0:e.call(i):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 e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var xo=Gr("[RemoteConfig]");class So{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.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()&&Et&&"hidden"!==Et.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.ya=setInterval((()=>{this.refresh()}),e))}}pa(t,e){!t&&e&&(0===e.statusCode?e.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 i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(t){xo.error("Error loading feature flags",t)}}}var Eo=Uint8Array,ko=Uint16Array,To=Uint32Array,$o=new Eo([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]),Po=new Eo([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]),Ro=new Eo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Co=function(t,e){for(var i=new ko(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new To(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},Oo=Co($o,2),Io=Oo[1];Oo[0][28]=258,Io[258]=28;for(var Ao=Co(Po,0)[1],Fo=new ko(32768),Mo=0;32768>Mo;++Mo){var Do=(43690&Mo)>>>1|(21845&Mo)<<1;Fo[Mo]=((65280&(Do=(61680&(Do=(52428&Do)>>>2|(13107&Do)<<2))>>>4|(3855&Do)<<4))>>>8|(255&Do)<<8)>>>1}var No=function(t,e,i){for(var r=t.length,s=0,n=new ko(e);r>s;++s)++n[t[s]-1];var o,a=new ko(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new ko(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[Fo[d]>>>l]=u}else for(o=new ko(r),s=0;r>s;++s)o[s]=Fo[a[t[s]-1]++]>>>15-t[s];return o},Lo=new Eo(288);for(Mo=0;144>Mo;++Mo)Lo[Mo]=8;for(Mo=144;256>Mo;++Mo)Lo[Mo]=9;for(Mo=256;280>Mo;++Mo)Lo[Mo]=7;for(Mo=280;288>Mo;++Mo)Lo[Mo]=8;var Uo=new Eo(32);for(Mo=0;32>Mo;++Mo)Uo[Mo]=5;var jo=No(Lo,9,0),Bo=No(Uo,5,0),zo=function(t){return(t/8>>0)+(7&t&&1)},qo=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof ko?ko:t instanceof To?To:Eo)(i-e);return r.set(t.subarray(e,i)),r},Ho=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Vo=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Wo=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new Eo(0),0];if(1==s){var o=new Eo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={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 ko(v+1),f=Go(i[h-1],c,0);if(f>e){r=0;var p=0,_=f-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<f-c[m]),c[m]=e}for(p>>>=_;p>0;){var y=n[r].s;e>c[y]?p-=1<<e-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p)}f=e}return[new Eo(c),f]},Go=function(t,e,i){return-1==t.s?Math.max(Go(t.l,e,i+1),Go(t.r,e,i+1)):e[t.s]=i},Ko=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new ko(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++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[i.subarray(0,r),e]},Jo=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Yo=function(t,e,i){var r=i.length,s=zo(e+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]=i[n];return 8*(s+4+r)},Qo=function(t,e,i,r,s,n,o,a,l,u,h){Ho(e,h++,i),++s[256];for(var d=Wo(s,15),v=d[0],c=d[1],f=Wo(n,15),p=f[0],_=f[1],g=Ko(v),m=g[0],y=g[1],b=Ko(p),w=b[0],x=b[1],S=new ko(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=Wo(S,7),T=k[0],P=k[1],R=19;R>4&&!T[Ro[R-1]];--R);var C,O,I,A,F=u+5<<3,M=Jo(s,Lo)+Jo(n,Uo)+o,D=Jo(s,v)+Jo(n,p)+o+14+3*R+Jo(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(M>=F&&D>=F)return Yo(e,h,t.subarray(l,l+u));if(Ho(e,h,1+(M>D)),h+=2,M>D){C=No(v,c,0),O=v,I=No(p,_,0),A=p;var N=No(T,P,0);for(Ho(e,h,y-257),Ho(e,h+5,x-1),Ho(e,h+10,R-4),h+=14,E=0;R>E;++E)Ho(e,h+3*E,T[Ro[E]]);h+=3*R;for(var L=[m,w],U=0;2>U;++U){var j=L[U];for(E=0;j.length>E;++E)Ho(e,h,N[B=31&j[E]]),h+=T[B],B>15&&(Ho(e,h,j[E]>>>5&127),h+=j[E]>>>12)}}else C=jo,O=Lo,I=Bo,A=Uo;for(E=0;a>E;++E)if(r[E]>255){var B;Vo(e,h,C[257+(B=r[E]>>>18&31)]),h+=O[B+257],B>7&&(Ho(e,h,r[E]>>>23&31),h+=$o[B]);var z=31&r[E];Vo(e,h,I[z]),h+=A[z],z>3&&(Vo(e,h,r[E]>>>5&8191),h+=Po[z])}else Vo(e,h,C[r[E]]),h+=O[r[E]];return Vo(e,h,C[256]),h+O[256]},Xo=new To([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Zo=function(){for(var t=new To(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ta=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ea(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=Zo[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new Eo(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Yo(l,u,t.subarray(h,d)):(l[h]=!0,u=Yo(l,u,t.subarray(h,o)))}else{for(var v=Xo[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new ko(32768),g=new ko(p+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&p},w=new To(25e3),x=new ko(288),S=new ko(32),E=0,k=0,T=(h=0,0),P=0,R=0;o>h;++h){var C=b(h),O=32767&h,I=g[C];if(_[O]=I,g[C]=O,h>=P){var A=o-h;if((E>7e3||T>24576)&&A>423){u=Qo(t,l,0,w,x,S,k,T,R,h-R,u),T=E=k=0,R=h;for(var F=0;286>F;++F)x[F]=0;for(F=0;30>F;++F)S[F]=0}var M=2,D=0,N=f,L=O-I&32767;if(A>2&&C==b(h-L))for(var U=Math.min(c,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=L&&--N&&O!=I;){if(t[h+M]==t[h+M-L]){for(var z=0;B>z&&t[h+z]==t[h+z-L];++z);if(z>M){if(M=z,D=L,z>U)break;var q=Math.min(L,z-2),H=0;for(F=0;q>F;++F){var V=h-L+F+32768&32767,W=V-_[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(O=I)-(I=_[O])+32768&32767}if(D){w[T++]=268435456|Io[M]<<18|Ao[D];var G=31&Io[M],K=31&Ao[D];k+=$o[G]+Po[K],++x[257+G],++S[K],P=h+M,++E}else w[T++]=t[h],++x[t[h]]}}u=Qo(t,l,!0,w,x,S,k,T,R,h-R,u)}return qo(a,0,r+zo(u)+s)}(n=t,null==(o=e).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)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&ta(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),ta(u,h-8,i.d()),ta(u,h-4,r),u}var ia=!!$t||!!Tt,ra="text/plain",sa=!1,na=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},oa=function(t,e,r){var s;void 0===r&&(r=!0);var n=t.split("?"),o=n[0],a=n[1],l=i({},e),u=null!==(s=null==a?void 0:a.split("&").map((t=>{var e,i=t.split("="),s=i[0],n=r&&null!==(e=l[s])&&void 0!==e?e:i[1];return delete l[s],s+"="+n})))&&void 0!==s?s:[],h=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Jr(t,(function(t,e){ge(t)||ge(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(l);return h&&u.push(h),u.length>0?o+"?"+u.join("&"):o},aa=t=>{if(t.ba)return t.ba;var e=t.data,i=t.compression;if(e){if(i===vo.GZipJS){var r=ea(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Eo(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new Eo(s+8+(i-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(e)),{mtime:0});return{contentType:ra,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===vo.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Dn(e)),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(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},la=t=>{var e,r,s=()=>"sendBeacon"===t.transport?{url:oa(t.url,{compression:vo.Base64}),encodedBody:aa(i({},t,{compression:vo.Base64,ba:void 0}))}:{url:na(t.url,"compression"),encodedBody:aa(i({},t,{compression:void 0,ba:void 0}))};try{e=aa(t)}catch(e){if(Vt(t.compression,Ln(t.url,"compression")))return Wr.error("Failed to gzip request body, sending uncompressed payload",e),s();throw e}return e&&Vt(t.compression,Ln(t.url,"compression"))&&!((r=e.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:e}},ua=t=>{try{return la(t)}catch(e){return Wr.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},ha=function(){var t=e((function*(t){var e=Dn(t.data),r=yield function(t,e,i){return Jt.apply(this,arguments)}(e,s.DEBUG,{rethrow:!0});if(!r)return t;var n=yield r.arrayBuffer();return i({},t,{ba:{contentType:ra,body:n,estimatedSize:n.byteLength}})}));return function(e){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 e=ua(t);if(e){var r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,u=new Headers;Jr(t.headers,(function(t,e){u.append(e,t)})),o&&u.append("Content-Type",o);var h=null,d=!1;if(Pt){var v=new Pt;h={signal:v.signal,timeout:setTimeout((()=>{var e,i;d=!0,v.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var c=e=>{d&&"AbortError"===(null==e?void 0:e.name)||va(e)?Wr.warn(e):Wr.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var f;Tt(r,i({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t._a&&52428.8>(l||0),body:a,signal:null==(f=h)?void 0:f.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Wr.error(t)}null==t.callback||t.callback(r)})))).catch(c).finally((()=>h?clearTimeout(h.timeout):null))}catch(t){h&&clearTimeout(h.timeout),c(t)}}},fa=t=>{try{var e,r=la(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(St.sendBeacon(s,u))return;var h=ce(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(ce(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>ce(t.data)?e:i({},t.data,{batch:e});return fa(i({},t,{data:v(h.slice(0,d))})),void fa(i({},t,{data:v(h.slice(d))}))}Wr.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ca(i({},t,{_a:!0}))}catch(t){Wr.warn("Beacon send failed",t)}},pa=(t,e,r,s)=>{var n="query"===s?"POST"===e?"sent_at":"_":void 0;return oa(r===vo.GZipJS?na(t,"compression"):t,i({},n?{[n]:Date.now().toString()}:{},r===vo.GZipJS?{}:{compression:r}))},_a=[];Tt&&_a.push({transport:"fetch",method:ca}),$t&&_a.push({transport:"XHR",method(t){var e=ua(t);if(e){var i=new $t,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Jr(t.headers,(function(t,e){i.setRequestHeader(e,t)})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(o)}}}),null!=St&&St.sendBeacon&&_a.push({transport:"sendBeacon",method:fa});var ga=3e3;class ma{constructor(t,e){this.wa=!0,this.ka=[],this.Sa=De((null==e?void 0:e.flush_interval_ms)||ga,250,5e3,Wr.createLogger("flush interval"),ga),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(i({},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 e=this.Ea(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&ce(i.data)&&Jr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(i)};for(var r in e)i()}}),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,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;ge(t[n])&&(t[n]=i({},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,!ge(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 e=t.retriesPerformedSoFar,s=r(t,ya);Se(e)&&(s.url=oa(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.xn(i({retriesPerformedSoFar:e},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!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}xn(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;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(),e=[],i=this.ka.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.ka=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,ge(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 e=t.requestOptions;try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(t){Wr.error(t)}}this.ka=[]}}class wa{constructor(t){this.Na=()=>{var t,e,i,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!==(e=this.qa.maxScrollHeight)&&void 0!==e?e:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(i=this.qa.maxContentY)&&void 0!==i?i: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=ce(this.ja)?this.ja:[this.ja];for(var e of t){var i=null==wt?void 0:wt.document.querySelector(e);if(i)return i}}Ba(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.ja){var i=this.scrollElement();return i&&i[e]||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,e,i,r){this.ot=t=>{var e=this.Ha();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ua(this._instance)};this.za.register({[X]:i})}},this._instance=t,this.Wa=e,this.za=i,this.Ua=r||xa,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[X]}getSetOnceProps(){var t,e=null==(t=this.Ha())?void 0:t.props;return e?"r"in e?eo(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return Jr(ts(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+le(i)]=e})),t}}class Ea{on(t,e){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(e),()=>{this.Va[t]=this.Va[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Va[t]||[])i(e);for(var r of this.Va["*"]||[])r(t,e)}constructor(){this.Va={}}}var ka=Gr("[SessionId]"),Ta=864e5;class $a{on(t,e){return this.Ga.on(t,e)}constructor(t,e,i){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new Ea,this.Xa=(t,e)=>!(!Se(t)||!Se(e))&&Math.abs(t-e)>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=e||ds,this.ro=i||ds;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*De(this.qi.session_idle_timeout_seconds||1800,60,36e3,ka.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=Os.Br(this.so),o=Os.Br(this.ao);n&&!o?this.st=n:Os.qr(this.so),Os.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 ge(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((e=>e!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&Os.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Os.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Os.Br(this.so):null}do(t){var e=this.Za;return!be(e)&&!be(t)&&5e3>Math.abs(t-e)}vo(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this._e||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this._e=t,s&&!r||s&&this.do(e)||(this.Za=e,this.za.register({[T]:[e,t,i]}))}co(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return Se(e)&&e>0}fo(){this.co()?this.za.refreshKey(T):(this.za.flush(),this.za.load())}po(){var t;if(!be(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var e=this.mo();e[1]===this._e&&e[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[T]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],e=Se(t)?t:0,i=Se(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[T];return ce(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,e){void 0===e&&(e=!1);var i=function(t,e){void 0===e&&(e=(new Date).getTime());try{var i=(t=>{var e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void ka.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void ka.error("Invalid sessionID in bootstrap",t)}}(t);return!ge(i)&&(e?this.eo={sessionId:t,sessionStartTimestamp:i}:this.vo(t,(new Date).getTime(),i),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&wt&&(wt.removeEventListener(_t,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Os.qr(this.ao)},rs(wt,_t,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=!1),this.qi.cookieless_mode===dt)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=e||(new Date).getTime(),s=this._e;if(i)this.Qa=r;else if(be(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],u=a[2],h=!ge(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ta),p=c?f:Se(u)&&Math.abs(r-u)>Ta,_=!1,g=h,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||ka.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.mo();l=w[1],u=w[2]}if(m||b||p){g=!1;var x=c&&!f;l=x?c.sessionId:this.io(),v=this.ro(),ka.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),u=x?c.sessionStartTimestamp:r,this.eo=void 0,_=!0}else v||(v=this.ro(),_=!0),(g=g||l!==y)&&(ka.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var S=Se(d)&&t&&!p?d:r,E=Se(u)?u:(new Date).getTime();this.uo(v),this.vo(l,S,E),t||this.no();var k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.Ja.forEach((t=>t(l,v,k))),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k: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 Pa=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&ne(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>ne(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function Ra(){return(Ra=e((function*(){var t=null==St?void 0:St.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return me(i)&&i.length>0?i:void 0}catch(t){return void Wr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Ca(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var Oa=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},Ia=t=>t.toLowerCase(),Aa={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>Oa(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Oa(e,t))))),icontains:(t,e)=>e.map(Ia).some((e=>t.map(Ia).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Ia).every((e=>t.map(Ia).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))};function Fa(t,e){return!t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(null==r)return!1;var s=Aa[i.operator];return!!s&&s(i.values,[String(r)])}))}function Ma(t,e,i){return Dn({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Da="custom",Na="i.posthog.com",La=/^\/static\//,Ua=["/s/","/e/","/i/"];class ja{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,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+Na,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}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 e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}So(t){var e=Nn(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}xo(t,e,i){if("ui"===t)return i;var r=i,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Nn(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&Ua.some((t=>0===e.indexOf(t)))){var a=this.So(r);if(a){var l,u=this.apiHost,h=this.Co;(null==(l=h)?void 0:l.apiHost)===u&&h.rewriteRequestPath===s||(h={apiHost:u,rewriteRequestPath:s,urls:new Set},this.Co=h),h.urls.add(a)}}return r}isIngestionEndpoint(t){var e=this.Co,i=this.So(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.xo(t,e,this.uiHost+e);if("flags"===t)return this.xo(t,e,this.flagsApiHost+e);if("assets"===t){var i=this.ko(e);if(i)return this.xo(t,e,""+i+e)}if(this.region===Da)return this.xo(t,e,this.apiHost+e);var r=Na+e;switch(t){case"assets":return this.xo(t,e,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,e,"https://"+this.region+"."+r)}}}var Ba=Gr("[Surveys]"),za="seenSurvey_",qa=t=>{try{var e=(t=>((t,e)=>""+za+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Ba.error("Failed to persist survey seen state",t)}},Ha=[fo.Popover,fo.Widget,fo.API],Va={ignoreConditions:!1,ignoreDelay:!1,displayType:go.Popover},Wa=Gr("[PostHog ExternalIntegrations]"),Ga={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Ka{constructor(t){this._instance=t}_s(t,e){var i;null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Wa.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=At.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t._s(Ga[n],(()=>{var e;null==(e=At.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=At.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=At.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e()}}}class Ja{constructor(t,e){this.I=t,this.ns=e,this.To=new Map,this.Xn=!1}add(t){var i=this;return e((function*(){if(i.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.To.set(t.name,t);try{var e=t.setup(i.ns);e&&(yield e)}catch(e){var r=i.To.get(t.name)===t;r&&i.To.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var e of(this.To.clear(),t))this.Mo(e)}}Mo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&fe(e.then)&&e.then(void 0,(e=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}))}catch(e){this.I.error('Failed to dispose browser extension "'+t.name+'"',e)}}}class Ya{constructor(t){this._instance=t}initialize(){}get(t){var e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);var i={};for(var r of t){var s=null==e?void 0:e.get_property(r);ge(s)||(i[r]=s)}return i}set(t,e){var i;null==(i=this._instance.persistence)||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null==(e=this._instance.persistence)||e.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=>ho(this.instance.on("eventCaptured",(e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return ho((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Ro.on(Qa,e);return this.Eo&&e(this.Eo),ho(i)},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,e;return null!==(t=null==(e=this.instance.persistence)?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",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,i,r){var s=this;return e((function*(){r?s.instance.capture(t,i,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):s.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return ho(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(Qa,t))}sendRequest(t,i){var r=this;return e((function*(){var e;void 0===i&&(i={});var s=r.instance.requestRouter.endpointFor(null!==(e=i.target)&&void 0!==e?e:"api",t),n={method:i.method,url:i.query?oa(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt};return"sendBeacon"===i.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,el=()=>{},il='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=!ia&&-1===(null==Ct?void 0:Ct.indexOf("MSIE"))&&-1===(null==Ct?void 0:Ct.indexOf("Mozilla")),ul=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:is(null==Et?void 0:Et.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:el,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:kt&&me(null==kt?void 0:kt.search)&&-1!==kt.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==(e=wt.location)?void 0:e.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:ga},error_tracking:{},_onCapture:el},(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))},hl=[["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 e={};for(var i of hl){var r=i[0],s=i[1];ge(t[r])||(e[s]=t[r])}var n=Yr({},e,t),o=t.__preview_external_dependency_versioned_paths;return ge(o)||(ge(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),me(o)&&ge(t.asset_host)&&(n.asset_host=o)),ce(t.property_blacklist)&&(ge(t.property_denylist)?n.property_denylist=t.property_blacklist:ce(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,e){if(t){var i=this.To.indexOf(t);-1!==i&&this.To.splice(i,1)}return this.To.push(e),null==e.initialize||e.initialize(),e}Oo(){return this.config.cookieless_mode===dt||this.config.cookieless_mode===ht&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===st){var t=this.persistence;if(t){this.$o()||t.load(!0);var e=this.get_distinct_id();if(!e||e===st){var i=this.config.get_device_id(ds());this.register({distinct_id:i,$device_id:i}),t.set_property(Q,vt)}this.No()}}}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.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 Ea,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ul(),this.SentryIntegration=Cn,this.sentryIntegration=t=>function(t,e){var i=Rn(t,e);return{name:Pn,processEvent:t=>i(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 On(this),this.rateLimiter=new wo(this),this.requestRouter=new ja(this),this.consent=new Is(this),this.externalIntegrations=new Ka(this);var e=null!==(t=cl.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=me(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=me(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Wr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==al){var r,s=null!==(r=Za[i])&&void 0!==r?r:new cl;return s._init(t,e,i),Za[i]=s,Za[al][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var n,o;void 0===e&&(e={});var a,u=me(t)?t.trim():"";if(!u)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 u!==(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('"+u+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=ul(e.defaults),e.debug=this.Go(e.debug),this.Zo=e,this.Qo=[],e.person_profiles?this.Wo=e.person_profiles:e.process_person&&(this.Wo=e.process_person);var h=ul(e.defaults),d=dl(e),v=Yr({},h,d,{name:r,token:u});pe(h.rageclick)&&pe(d.rageclick)&&(v.rageclick=Yr({},h.rageclick,d.rageclick)),pe(h.session_recording)&&pe(d.session_recording)&&(v.session_recording=Yr({},h.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=e.disable_compression?void 0:vo.GZipJS;var c=this.$o();if(this.persistence=new uo(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new uo(i({},this.config,{persistence:"sessionStorage"}),c,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&Os.Nr()){var f=Os.Br(this.Bo);ce(f)&&f.forEach((t=>{me(t)&&this.jo.add(t)}))}else Os.qr(this.Bo);var p=i({},this.persistence.props),_=i({},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 g=this.Oo();if(g||(this.sessionManager=new $a(this),this.sessionPropsManager=new Sa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,e,i)=>{(null!=i&&i.activityTimeout||null!=i&&i.sessionPastMaximumLength||null!=i&&i.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(Wr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(g)}),0)):(Wr.info("Initializing extensions synchronously"),this.el(g)),s.DEBUG=s.DEBUG||this.config.debug,s.DEBUG&&Wr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:p,s:_}),!this.config.identity_distinct_id||null!=(n=e.bootstrap)&&n.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var m=e.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Q);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===vt)this.identify(m);else if(e.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=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Q,e.bootstrap.isIdentifiedID?ct:vt),this.register({distinct_id:m,$device_id:x})}}if(g)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}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||ds();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Q,ct)),e()},s=i.user();"then"in s&&fe(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||$n.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||($n.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&($n.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,gt),identify:t=>e(t,yt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.il())):this.il(),fe(this.config._onCapture)&&this.config._onCapture!==el&&(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 Ra.apply(this,arguments)}().then((t=>{t&&this.register({[l]:t})})).catch(el),this}rl(t){var e=t;return me(e.name)&&fe(e.setup)}nl(t,e){this.rl(t)?e.push((()=>{this.sl().add(t).catch(el)})):this.To.push(t)}tl(){var t,e,i,r,s,n,o=null!==(t=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==t?t:null==(i=cl.__defaultExtensionClasses)?void 0:i.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),fe(this.featureFlags.onReloading)&&fe(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 e,r,s,n,o,a,l,u=performance.now(),h=i({},cl.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.exceptions&&this.To.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new h.exceptions(this)),h.historyAutocapture&&this.To.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.To.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.To.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.To.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.nl(this.autocapture=new h.autocapture(this),d),h.surveys&&this.nl(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new h.surveys(this),d),h.logs&&this.To.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new h.logs(this)),h.metrics&&this.To.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new h.metrics(this)),h.conversations&&this.To.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.To.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.To.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.To.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,kn)),h.toolbar&&this.To.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.To.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.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((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}})),this.ll(d,u)}ll(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Wr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);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 e;if(!Et||!Et.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 i,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=oe(r.supportedCompression,vo.GZipJS)?vo.GZipJS:oe(r.supportedCompression,vo.Base64)?vo.Base64:void 0),null!=(i=r.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:ft}),null==(e=this.ul)||e.handleRemoteConfig(t),this.To.forEach((e=>null==e.onRemoteConfig?void 0:e.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!=kt&&kt.hostname){var t=kt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.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,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(mt),null==(i=this.logs)||i.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=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(ge(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 e,r,s,n=i({},t);n.timeout=n.timeout||6e4;var o,a,l,u,h,d=null!==(e=n.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&ge(n.compression)&&n.data&&(n.compression=vo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(h=(u=(ce(o=n.data)?o:[o]).map((t=>i({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(l=h.properties)?void 0:l.token)&&void 0!==a?a:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),ce(t)?t.map((t=>i({},t,{sent_at:e}))):i({},t,{sent_at:e})}(n.data))),n.url=pa(n.url,n.method,n.compression,n.timestampMode);var v=_a.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),c=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(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.GZipJS&&Rt&&"undefined"!=typeof Promise&&!sa?ha(n).then((t=>{f(t)})).catch((e=>{if(Wt(e))return sa=!0,void f(i({},n,{compression:void 0,url:pa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return Wt(t)||e===qt})(e)&&(sa=!0),f(n)})):c(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))):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 e,i=[],r=[],s=[];Kr(t,(t=>{if(t)if(ce(e=t[0]))s.push(t);else if(fe(t))try{t.call(this)}catch(e){Wr.error("Error executing queued PostHog call",t,e)}else ce(t)&&"alias"===e?i.push(t):ce(t)&&-1!==e.indexOf("capture")&&fe(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Kr(t,(function(t){try{if(ce(t[0])){var i=e;Jr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Wr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{tl--}}push(t){if(tl>0&&ce(t)&&me(t[0])){var e=cl.prototype[t[0]];fe(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!ge(t)&&me(t)){this.Do();var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!me(null==e?void 0:e.$current_url)&&(Wr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$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=qi(null==r?void 0:r.uuid,ds),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===gt&&this.config.__preview_capture_bot_pageviews&&u&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),h&&(f.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var p="$feature_flag_called"===t&&!1===f.properties.$feature_flag_has_experiment&&!0===this.get_property(M);(null==r?void 0:r.$set)&&!p&&(f.$set=null==r?void 0:r.$set);var _=null==r?void 0:r.$unset;_&&(f.$unset=_);var g,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=>me(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){if(e!==Object(e))return a?a(e):e;if(!l.has(e)){var r;if(l.add(e),ce(e))r=[],Kr(e,(e=>{r.push(t(e))}));else{var s={};Jr(e,((e,i)=>{l.has(e)||(s[i]=t(e,i))})),r=s}return r}}(o)),f.timestamp=v,ge(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,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return Lt.forEach(r),e.forEach(r),i}(f.properties,ol)),t===po.DISMISSED||t===po.SENT){var w=null==e?void 0:e[_o.SURVEY_ID],x=null==e?void 0:e[_o.SURVEY_ITERATION];qa({id:w,current_iteration:x}),f.$set=i({},f.$set,{[(g={id:w,current_iteration:x},m=t===po.SENT?"responded":"dismissed",y="$survey_"+m+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(y="$survey_"+m+"/"+g.id+"/"+g.current_iteration),y)]:!0})}else t===po.SHOWN&&(f.$set=i({},f.$set,{[_o.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===mo.SHOWN){var S=null==e?void 0:e[yo.TOUR_TYPE];S&&(f.$set=i({},f.$set,{[yo.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}))}var E=i({},f.properties.$set,f.$set);if(_e(E)||this.setPersonPropertiesForFlags(E),!we(this.config.before_send)){var k=this.kn(f);if(!k)return;(f=k).uuid=qi(f.uuid,ds)}this.Ro.emit("eventCaptured",f);var T=null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),P={method:"POST",url:T,data:f,compression:"best-available",timestampMode:"recordings"===(null==r?void 0:r._batchKey)||/\/s\/(?:\?|$)/.test(T)?"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(P):this.Jo.enqueue(P),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",(e=>t(e.event,e)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new Xa(this)}Ao(t){this.Ho.push(t);var e=!0;return()=>{if(e){e=!1;var i=this.Ho.indexOf(t);-1!==i&&this.Ho.splice(i,1)}}}gl(t){var e,i,r;return void 0===t&&(t=!0),!(null==(e=this.persistence)||!e.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Q)===vt&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,e,r,n,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.gl();var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Oo()&&(l[nt]=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!me(l.distinct_id)&&!xe(l.distinct_id)||ye(l.distinct_id))&&Wr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i,r){var n,o,a,l;if(void 0===r&&(r=!1),!Ct)return{};var u,h=t?[...Hn,...e||[]]:[],d=function(t){for(var e=0;ji.length>e;e++){var i=ji[e],r=i[1],s=i[0].exec(t),n=s&&(fe(r)?r(s,t):r);if(n)return n}return["",""]}(Ct),v=d[0],c=d[1],f=null!=(u="undefined"!=typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},p={};ge(i)||(p.detectGoogleSearchApp=i);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;ge(g)||(_.userAgentDataPlatform=g),ge(m)||(_.maxTouchPoints=m),ge(y)||(_.screenWidth=y),ge(b)||(_.screenHeight=b),ge(w)||(_.devicePixelRatio=w);var x,S,E,k,T,P,R,C,O=Yr(ts({$os:v,$os_version:c,$browser:Ni(Ct,navigator.vendor,f,p),$device:Bi(Ct),$device_type:(S=Ct,E=_,C=Bi(S),C===qe||C===ze||"Kobo"===C||"Kindle Fire"===C||C===yi?Be:C===li||C===hi||C===ui||C===_i?"Console":C===Ve?"Wearable":C?Le:"Android"===(null==E?void 0:E.userAgentDataPlatform)&&(null!==(k=null==E?void 0:E.maxTouchPoints)&&void 0!==k?k:0)>0?600>Math.min(null!==(T=null==E?void 0:E.screenWidth)&&void 0!==T?T:0,null!==(P=null==E?void 0:E.screenHeight)&&void 0!==P?P:0)/(null!==(R=null==E?void 0:E.devicePixelRatio)&&void 0!==R?R:1)?Le:Be:"Desktop"),$timezone:io(),$timezone_offset:ro()}),{$current_url:Un(r?Hi(null==kt?void 0:kt.href):null==kt?void 0:kt.href,h,Wn),$host:null==kt?void 0:kt.host,$pathname:null==kt?void 0:kt.pathname,$raw_user_agent:Ct.length>1e3?Ct.substring(0,997)+"...":Ct,$browser_version:Ui(Ct,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&&(O.$sdk_dist_channel=s.SDK_DIST_CHANNEL),O}(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),h=t!==gt||o?t!==mt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),l=Yr(l,h),t===gt&&Et&&(l.title=Et.title),!ge(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}Ct&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties();Jr(["$referrer","$referring_domain"],(t=>{t in _&&delete g[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,i({},m,l))).$is_identified=this._isIdentified(),ce(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,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.yl())return t;if(this.qo&&!i)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")),e&&(this.qo=!0),_e(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e,i;null==(e=this.persistence)||e.syncCookieProperties(),this.gl(),null==(i=this.sessionPersistence)||i.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t),this.jo.delete(t),this.ml()}_l(t,e){this.register({[t]:e})}Xo(){this.jo.forEach((t=>{var e;null==(e=this.sessionPersistence)||e.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!Os.Nr())Os.qr(this.Bo);else{var e=[];this.jo.forEach((t=>e.push(t))),e.length>0?Os.Dr(this.Bo,e):Os.qr(this.Bo)}}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Ro.on(t,e)}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 e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:rl})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:rl})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Va),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:rl}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:rl})}wl(t){return!t||ye(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,e,i){if(!this.__loaded||!this.persistence)return Wr.uninitializedWarning("posthog.identify");if(xe(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 h=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:h},""),t!==h&&t!==this.get_property(u)&&(this.unregister(u),this.register({distinct_id:t}));var d,v=(this.persistence.get_property(Q)||vt)===vt,c=t!==h,f=!c&&v;if(c&&v)this.persistence.set_property(Q,ct),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(yt,{distinct_id:t,$anon_distinct_id:h},{$set:e||{},$set_once:i||{}}),this.Vo=Ma(t,e,i),null==(d=this.featureFlags)||d.setAnonymousDistinctId(h);else if(f){this.persistence.set_property(Q,ct);var p=e||{},_=i||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:p,$set_once:_}),this.Vo=Ma(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);c||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(G)):f&&(e||i)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Qs(l)}}}setPersonProperties(t,e){if((t||e)&&this.bl("posthog.setPersonProperties")){var i=Ma(this.get_distinct_id(),t,e);this.Vo!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Vo=i):Wr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(ce(t)?t:[t]).filter((t=>me(t)&&t.length>0));0!==i.length&&this.bl("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Vo=null)}group(t,e,r){var s;if(t&&e){null==(s=this.persistence)||s.syncCookieProperties(),this.gl();var n=this.getGroups(),o=n[t]!==e;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},n,{[t]:e})}),o||r){var a={$group_type:t,$group_key:e};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,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.bl("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e=Ee(t)?t:null==t?void 0:t.resetDeviceID,i=Ee(t)||null==t?void 0:t.bootstrap;this.kl(e,!1,i)}kl(t,e,r){var s,n,o;if(void 0===e&&(e=!1),Wr.info("reset"),!this.__loaded)return Wr.uninitializedWarning("posthog.reset");var u=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 h=this.get_property(a),d=this.get_property(l),v=this.get_property(b),c=this.is_capturing();this.consent.reset(),e||!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,E,k,T,P,R,C,O;if(null==(_=this.persistence)||_.clear(),null==(g=this.sessionPersistence)||g.clear(),this.jo.clear(),this.ml(),ge(v)||null==(P=this.persistence)||P.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==(E=this.metrics)||E.reset(),null==(k=this.persistence)||k.set_property(Q,vt),null==(T=this.sessionManager)||T.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:h},""),t||ge(d)||this.register({[l]:d})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),r)if(void 0===r.distinctID||this.Oo()||(null==(O=this.persistence)||O.set_property(Q,r.isIdentifiedID?ct:vt),this.register({distinct_id:r.distinctID})),null==(R=this.featureFlags)||R.initialize(),!(ge(u)||null!=(C=this.sessionManager)&&C.setBootstrapSessionId(u,!0))){var A=i({},r);delete A.sessionID,this.config.bootstrap=A}delete this.config.identity_distinct_id,delete this.config.identity_hash,p=!0}finally{var F;f&&(null==(F=this.persistence)||null==F.Qs||F.Qs(p))}this.reloadFeatureFlags()}shutdown(t){var i=this;return e((function*(){var t,e,r,s,n,o;if(i.__loaded){null==(t=i.vl)||t.stop(),i.sl().dispose(),null==(e=i.sessionRecording)||e.dispose(),null==(r=i.logs)||r.flushLogs("sendBeacon"),null==(s=i.metrics)||s.flush("sendBeacon"),null==(n=i.Jo)||n.unload(),null==(o=i.Yo)||o.unload();try{var a;null==(a=i.featureFlags)||a.destroy()}catch(t){Wr.error("Error while destroying feature flags",t)}}else Wr.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.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,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var e=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(n)?(Wr.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(ge(e)&&(e=this.get_distinct_id()),t!==e?(this._l(u,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Wr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(pe(t)){var r,n,o,a,l,u,h,d,v,c,f,p;Yr(this.config,dl(t));var _=this.$o();null==(r=this.persistence)||r.update_config(this.config,e,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new uo(i({},this.config,{persistence:"sessionStorage"}),_,!1);var g,m=this.Go(this.config.debug);Ee(m)&&(this.config.debug=m),Ee(this.config.debug)&&(this.config.debug?(s.DEBUG=!0,gs.Nr()&&gs.Dr("ph_debug",!0),Wr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(s.DEBUG=!1,gs.Nr()&&gs.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==(u=this.tracingHeaders)||u.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.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,e){s.LIB_NAME=t,s.LIB_VERSION=e}startSessionRecording(t){var e,i,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==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.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,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.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 e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:al;return e!==al&&(e=al+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Q))===ct||(null==(e=this.sessionPersistence)?void 0:e.get_property(Q))===ct}yl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ft&&!this._isIdentified()&&_e(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[u])&&(null==(e=this.persistence)||null==(e=e.props)||!e[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!==ht)}No(){var t,e,i,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==dt){if(this.Oo()){var i,r,s,n,o;this.kl(!0,!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new $a(this),this.pageViewManager=new On(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 u,h;this.consent.optInOut(!0),this.No(),this.hl(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ht&&(null==(u=this.surveys)||u.loadIfEnabled()),(ge(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else Wr.warn(il)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==dt?(this.config.cookieless_mode===ht&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===ht&&(this.register({distinct_id:st,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):Wr.warn(il)}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===ht?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?Pa(St,this.config.custom_blocked_useragents):void 0}dl(){Et&&("visible"===Et.visibilityState?this.Uo||(this.Uo=!0,this.capture(gt,{title:Et.title},{send_instantly:!0}),this.zo&&(Et.removeEventListener(pt,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),rs(Et,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,e,i,r,s){var n=e in t&&!we(t[e]),o=i in t&&!we(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Wr)}kn(t){var e;if(we(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter($e),r=ce(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),we(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Te(t.event)?Wr.warn(o+". This can cause unexpected behavior."):Wr.info(o),null}s.properties&&!_e(s.properties)||Wr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return Wr.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&we(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,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Go(t){var e=Ee(t)&&!t,i=gs.Nr()&&"true"===gs.Pr("ph_debug");return!e&&(!!i||t)}}cl.__defaultExtensionClasses={},cl.Cl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Zr(t.prototype[e[i]])}(cl,["identify"]);class fl{constructor(t){this.disabled=!1===t;var e=pe(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var pl="$copy_autocapture",_l=Gr("[AutoCapture]");function gl(t,e){return e.length>t?e.slice(0,t)+"...":e}function ml(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Us(e));return e}function yl(t,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,u=e.elementsChainAsString,h=e.disableCaptureUrlHashes;if(!Us(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!js(c,"body")&&qs>d.length;)if(zs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Us(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 e=un(t);if(js(t,"a")){var i=t.getAttribute("href");y=!!(e&&i&&mn(i))&&(h?Hi(i):i)}oe(Ws(t),"ph-no-capture")&&(b=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};Ys.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?gl(1024,yn(t)):gl(1024,Ks(t)));var a=Ws(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),Jr(t.attributes,(function(i){var n;if((!hn(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&mn(i.value)&&(!me(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=Hs(a).join(" ")),o["attr__"+i.name]=gl(1024,"href"===i.name&&s?Hi(a):a)}}));for(var l=1,u=1,h=t;h=ml(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,o,a,l,h));var r=function(t){if(!un(t))return{};var e={};return Jr(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&mn(r)&&(e[i]=r)}})),e}(t);Yr(m,r)})),b)return{props:{},explicitNoCapture:b};if(a||(g[0].$el_text=js(t,"a")||js(t,"button")?yn(t):Ks(t)),y){var w,x;g[0].attr__href=y;var S=null==(w=Nn(y))?void 0:w.host,E=null==wt||null==(x=wt.location)?void 0:x.host;S&&E&&S!==E&&(p=y)}return{props:Yr({$event_type:n.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(_=g,function(t){return t.map((t=>{var e,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=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e: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,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return a[wn(t[0].toString())]=wn(e.toString())})),(s+=":")+Qr(a).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.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}))}(_)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[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 e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?e.dispose():(this.ss=e,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,e;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==(e=this.qi.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),this.qi}us(){if(this.isBrowserSupported()){if(wt&&Et){var t=this.hs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t)}catch(t){_l.error("Failed to capture event",t)}};if(rs(Et,"submit",t,{capture:!0}),rs(Et,"change",t,{capture:!0}),rs(Et,"click",t,{capture:!0}),this.ls().capture_copied_text){var e=this.vs=t=>{t=t||(null==wt?void 0:wt.event);try{this.ds(t,pl)}catch(t){_l.error("Failed to capture copy/cut event",t)}};rs(Et,"copy",e,{capture:!0}),rs(Et,"cut",e,{capture:!0})}}}else _l.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==Et||Et.removeEventListener("submit",this.hs,!0),null==Et||Et.removeEventListener("change",this.hs,!0),null==Et||Et.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==Et||Et.removeEventListener("copy",this.vs,!0),null==Et||Et.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 e=t.config;e.elementsChainAsString&&(this.Yn=e.elementsChainAsString);var i,r=e.autocapture_opt_out;Ee(r)&&(null==(i=this.ns)||i.kv.set(d,r),this.Jn=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.es=t}getElementSelectors(t){var e,i=[];return null==(e=this.es)||e.forEach((e=>{var r=null==Et?void 0:Et.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e;if(this.Xn)return!1;var i=null==(t=this.ns)?void 0:t.kv.get(d),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(be(r)&&!Ee(i)&&!n)return!1;var o=null!==(e=this.Jn)&&void 0!==e?e:!!i;return!!s.enabled&&!o}ds(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i=Js(t);Bs(i)&&(i=i.parentNode||null);var r,s=this.rs();"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&s.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&on(i,s.rageclick)&&this.ds(t,"$rageclick");var n=e===pl;if(i&&function(t,e,i,r,s,n){var o;if(!wt||an(t))return!1;if(null!=i&&i.url_allowlist&&!Vs(i.url_allowlist,n))return!1;if(null!=i&&i.url_ignorelist&&Vs(i.url_ignorelist,n))return!1;if(null!=i&&i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some((t=>e.type===t)))return!1}var l=ln(t,r),u=l.parentIsUsefulElement,h=l.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(ge(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(h,i))return!1;if(!Qs(h,null==i?void 0:i.css_selector_allowlist))return!1;if(Qs(h,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Zs))return!1;try{var d=wt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return u?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Ys.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(i,t,s,n,n?["copy","cut"]:void 0,{config:{get_current_url:s.getCurrentUrl}})){var o,a=yl(i,{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 u=this.getElementSelectors(i);if(u&&u.length>0&&(l.$element_selectors=u),e===pl){var h,d=Gs(null==wt||null==(h=wt.getSelection())?void 0:h.toString()),v=t.type||"clipboard";if(!d)return!1;l.$selected_content=d,l.$copy_type=v}return null==(o=this.ns)||o.capture(e,l).catch((t=>_l.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return fe(null==Et?void 0:Et.querySelectorAll)}}class wl{constructor(t){this._instance=t}refresh(t){var e=this._instance.config,i=pe(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.ma(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}}var xl=Gr("[ExceptionAutocapture]"),Sl=()=>{},El=Gr("[TracingHeaders]"),kl=Gr("[Web Vitals]"),Tl=9e5,$l=["CLS","FCP","INP","LCP"],Pl=["INP","LCP"],Rl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Cl="disabled",Ol="lazy_loading",Il="awaiting_config",Al="missing_config";Gr("[SessionRecording]"),Gr("[SessionRecording]");var Fl="[SessionRecording]",Ml=Gr(Fl),Dl=Gr("[Heatmaps]");function Nl(t){return pe(t)&&"clientX"in t&&"clientY"in t&&xe(t.clientX)&&xe(t.clientY)}var Ll=Gr("[Product Tours]"),Ul=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(m))},jl=["$set_once","$set"],Bl=Gr("[SiteApps]"),zl="Error while initializing PostHog app with config id ",ql=(t,e)=>null!=t&&t.then?t.then(e):e(t),Hl="SDK is not enabled or survey functionality is not yet loaded",Vl="Disabled. Not loading surveys.";class Wl{constructor(t,e){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 Ba.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(we(e))return Ba.warn("Flags not loaded yet. Not loading surveys.");this.Pl=Ee(e)?e:e.length>0,Ba.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=e}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 e=t.onRemoteConfig(this.onRemoteConfig);this.Xn?e.dispose():(this.ss=e,this.loadIfEnabled())}}))}dispose(){var t,e,i;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,null==(e=this._surveyEventReceiver)||e.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==i.dispose||i.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 e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(za)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Xn&&this.ns){var t=this.qi;if(!this._surveyManager)if(this.Tl)Ba.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Ba.info(Vl);else if(t.cookielessMode&&this.ts.isOptedOut())Ba.info("Not loading surveys in cookieless mode without consent.");else{var e=this.ts.getExtensions();if(e){if(!ge(this.Pl)||t.advancedEnableSurveys){var i=this.Pl||t.advancedEnableSurveys;this.Tl=!0;try{var r=e.generateSurveys;if(r)return this.Ll(r,i),void(this.Tl=!1);var s=e.loadExternalDependency;if(!s)return this.Ol(ut),void(this.Tl=!1);s((t=>{try{if(this.Xn)return;var e=this.ts.getExtensions();t||null==e||!e.generateSurveys?this.Ol("Could not load surveys script",t):this.Ll(e.generateSurveys,i)}finally{this.Tl=!1}}))}catch(t){throw this.Tl=!1,this.Ol("Error initializing surveys",t),t}}}else Ba.error("PostHog Extensions not found.")}}}Ll(t,e){this.Xn||(this._surveyManager=t(e),this._surveyEventReceiver=this.ts.createEventReceiver(),Ba.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,e){Ba.error(t,e),this.Dl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ml.push(t),this._surveyManager&&this.Dl({isLoaded:!0}),()=>{this.Ml=this.Ml.filter((e=>e!==t))}}getSurveys(t,e){var i;void 0===e&&(e=!1);var r=null!==(i=this.ns)&&void 0!==i?i:this.Al;if(r&&!this.Xn){if(this.qi.disableSurveys)return Ba.info(Vl),t([]);var s=r.kv.get(B);if(s&&!e)return t(s,{isLoaded:!0}),void(this.$l()&&this.getSurveys((()=>{}),!0));if(this.El)this.El.then((e=>{this.Xn||t(e.surveys,e.context)})).catch((t=>Ba.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 Ba.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((e=>{o(),this.Xn||t(e.surveys,e.context)}),o).catch((t=>Ba.error("Error in survey callback",t)))}}}Nl(t,e){var i=this.ns;return i?i.sendRequest(t,e):new Promise((t=>t({statusCode:0,error:new Error(Hl)})))}ql(t,e){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:Hl}};var i=e.statusCode;if(200!==i||!e.json){var r="Surveys API could not be loaded, status: "+i;return 0!==i?Ba.error(r):e.error||Ba.warn(r),this.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Il=null;var s,n=e.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ca(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[B]:n,[z]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}$l(){return this.jl()&&!this.El&&!this.Bl()}jl(){var t,e,i=null==(t=null!==(e=this.ns)&&void 0!==e?e:this.Al)?void 0:t.kv.get(z);return xe(i)&&Date.now()-i>3e5}Bl(){return xe(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};qa(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Dl(t){for(var e of this.Ml)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Ba.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!we(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Ba.warn("init was not called")}Hl(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Ul(t){if(we(this._surveyManager))return{eligible:!1,reason:Hl};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}zl(t){if(we(this._surveyManager))return{eligible:!1,reason:Hl};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(we(this._surveyManager))return Ba.warn("init was not called"),{visible:!1,disabledReason:Hl};var e=this.zl(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return we(this._surveyManager)?(Ba.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Hl})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.zl(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(we(this._surveyManager))Ba.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==Et?void 0:Et.querySelector(e);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){Ba.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout((()=>{var t,e;this.Rl.delete(o),this.Xn||(Ba.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),Ba.info("Survey "+s.id+" rendered"))}),1e3*s.appearance.surveyPopupDelaySeconds);this.Rl.add(o)}else this._surveyManager.renderSurvey(s,n,i);else Ba.warn("Survey element not found")}else Ba.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ba.warn("Survey not found")}}displaySurvey(t,e){var r;if(we(this._surveyManager))Ba.warn("init was not called");else{var s=this.Hl(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==go.Popover&&e.initialResponses&&Ba.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.Ul(s);if(!o.eligible)return void Ba.warn("Survey is not eligible to be displayed: ",o.reason)}e.displayType!==go.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else Ba.warn("Survey not found")}}cancelPendingSurvey(t){we(this._surveyManager)?Ba.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function Gl(t,e,i){if(we(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Kl{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new Ea,this.Zl=(t,e)=>this.Ql(t,e)&&this.Jl(t,e)&&this.Kl(t,e)&&this.Yl(t,e),this.Ql=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t}init(){var t,e;ge(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Xl=null==(e=this._instance)?void 0:e._addCaptureHook(((t,e)=>{this.on(t,e)})))}dispose(){var t;null==(t=this.Xl)||t.call(this),this.Xl=void 0,this.Gl=new Ea}register(t){var e,i;if(!ge(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e;this.Wl.add(t),null==(e=t.steps)||e.forEach((t=>{this.Vl.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r=new Set;this.Wl.forEach((t=>{var e;null==(e=t.steps)||e.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,e){null!=e&&0!=t.length&&(this.Vl.has(t)||this.Vl.has(e.event))&&this.Wl.forEach((t=>{this.tu(e,t)&&this.Gl.emit("actionCaptured",t.name)}))}eu(t){this.onAction("actionCaptured",(e=>t(e)))}tu(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.Zl(t,i))return!0;return!1}onAction(t,e){return this.Gl.on(t,e)}Jl(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Gl(r,e.url,e.url_matching||"contains"))return!1}return!0}Kl(t,e){return!!this.iu(t,e)&&!!this.ru(t,e)&&!!this.nu(t,e)}iu(t,e){var i;if(null==e||!e.href)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Gl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}ru(t,e){var i;if(null==e||!e.text)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Gl(t.text,e.text,e.text_matching||"exact")||Gl(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!we(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Gl(t,n,o))))}nu(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}su(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Yl(t,e){return null==e||!e.properties||0===e.properties.length||Fa(e.properties.reduce(((t,e)=>{var i=ce(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Jl{constructor(t){var e;this.au=[],this._instance=t,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=null==(e=this._instance)||null==e.onSessionId?void 0:e.onSessionId((t=>this.du(t)))}vu(t){return!1}cu(){return null}fu(t){}pu(){}gu(t,e){return!!t&&Fa(t.propertyFilters,null==e?void 0:e.properties)}mu(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}yu(t,e,i){var r=(i===co.Activation?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[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.gu(n,e)}))}register(t){this._u(t,!1)}replace(t){this._u(t,!0)}_u(t,e){var i;ge(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.wu(t,e),this.ku(t,e))}ku(t,e){var i=t.filter((t=>{var e;return null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length}));if(e&&this.uu.clear(),0!==i.length){this.Su||(this.Su=new Kl(this._instance),this.Su.init(),this.Su.eu((t=>this.onAction(t))));var r=[];i.forEach((t=>{var e;null==(e=t.conditions)||null==(e=e.actions)||e.values.forEach((e=>{if(r.push(e),e.name){var i,s=null!==(i=this.uu.get(e.name))&&void 0!==i?i:[];s.includes(t.id)||s.push(t.id),this.uu.set(e.name,s)}}))})),e?this.Su.replace(r):this.Su.register(r)}else{var s;e&&(null==(s=this.Su)||s.replace([]))}}xu(t,e){e.forEach(((e,i)=>{var r,s=null!==(r=t.get(i))&&void 0!==r?r:[];e.forEach((t=>{s.includes(t)||s.push(t)})),t.set(i,s)}))}wu(t,e){var i,r,s=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),n=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0})),o=this.mu(t,co.Activation),a=this.mu(t,co.Cancellation);e?(this.ou=o,this.lu=a):(this.xu(this.ou,o),this.xu(this.lu,a)),(0!==s.length||0!==n.length)&&(null!==(i=this.Xl)&&void 0!==i||(this.Xl=null==(r=this._instance)?void 0:r._addCaptureHook(((t,e)=>{this.onEvent(t,e)}))))}onEvent(t,e){var i,r,s=this.Cu(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.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,e,co.Cancellation);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:e,items:this.ou.get(t)});var l=this.yu(t,e,co.Activation);this.Pu(l.map((t=>t.id)))}}onAction(t){this.uu.has(t)&&this.Pu(this.uu.get(t)||[])}Pu(t){var e;if(0!==t.length){var i=!(null==(e=this._instance)||null==e.get_session_id||!e.get_session_id()),r=[];for(var s of t)i&&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((e=>e!==t));var e=this.Fu();return!e.includes(t)&&(this.Lu([...e,t]),this.Ou(),!0)}Mu(t){var e=new Set(t);this.au=this.au.filter((t=>!e.has(t)));var i=this.Du(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.Lu(r),0===r.length&&this.$u()),this.Iu(t)}Nu(){var t,e=this.cu();if(!e)return{};var i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Au(t){if(this.cu()){var e=this.Nu();this.fu(i({},e,{[t]:Date.now()}))}}Iu(t){if(this.cu()){var e=this.Nu(),i={},r=!1;for(var s of Object.entries(e)){var n=s[0],o=s[1];t.includes(n)?r=!0:i[n]=o}r&&(_e(i)?this.pu():this.fu(i))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var e=this.Nu()[t];return xe(e)?e:void 0}}Du(){var t,e=this.ju();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}Fu(){var t,e,i=this.Du();if(0===i.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Bu()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}Ou(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.Hu(e)}$u(){this.Uu()}du(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Bu()];if(i&&i!==t){var r=this.Du(),s=this.Nu();r.length>0&&(this.Lu([]),r.filter((t=>xe(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,e,i;null==(t=this.hu)||t.call(this),this.hu=void 0,null==(e=this.Xl)||e.call(this),this.Xl=void 0,null==(i=this.Su)||i.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 e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[V]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(V)}vu(t){var e,i;this.bu((e=>{i=e.find((e=>e.id===t))}));var r=null==(e=i)||null==(e=e.appearance)?void 0:e.surveyPopupDelaySeconds;return xe(r)&&r>0}Vu(){return po.SHOWN}bu(t){var e;null==(e=this._instance)||e.getSurveys(t)}Ru(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Cu(){return Ba}Lu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[q]:t})}Hu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[H]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(H)}zu(){return!1}Tu(t,e){var i;this.bu((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e;return Ca(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===po.SHOWN?"consume":"ignore":t===po.SHOWN?"persist":t===po.DISMISSED||t===po.SENT?"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 e={};for(var i of t){var r=this._instance.get_property(i);ge(r)||(e[i]=r)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}: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==At?void 0:At.__PosthogExtensions__;if(t){var e=t.generateSurveys,i=t.loadExternalDependency;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new Yl(this._instance)}}var Zl=null!=wt&&wt.location?jn(wt.location.hash,"__posthog")||jn(location.hash,"state"):null,tu="_postHogToolbarParams",eu=Gr("[Toolbar]"),iu=Gr("[FeatureFlags]");class ru{constructor(t,e){void 0===e&&(e=!1),this.Gu=!1,this.update(t,e)}update(t,e){this.Zu=((t,e)=>{var i,r,s,n;return{bootstrap:{featureFlags:null==(i=t.bootstrap)?void 0:i.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:e,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:ce(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(iu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),ge(t.flag_keys)||ce(t.flag_keys)||iu.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var su=Gr("[FeatureFlags]"),nu=Gr("[FeatureFlags]",{debugEnabled:!0}),ou="\" failed. Feature flags didn't load in time.",au="connection_error",lu=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},uu=t=>{var e={};for(var i of Qr(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},hu=Gr("[Error tracking]"),du=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],vu=["__firefox__","__gCrWeb"],cu="Refusing to render web experiment since the viewer is a likely bot",fu={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Oa(e,t),not_regex:(t,e)=>!Oa(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class pu{get qi(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{pu.Qu("retrieved web experiments from the server"),e.Ju=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Ju&&(pu.Qu("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Ju)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);me(r)&&t.variants[r]&&e.Ku(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];pu.Yu(n,e._instance)&&e.Ku(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())pu.Qu(cu);else if(!this.qi.disable_web_experiments){if(we(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();pu.Qu("applying feature flags",t),t.forEach((t=>{var e;if(this.Ju&&null!=(e=this.Ju)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Ju)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Ku(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=pu.getWindowLocation();if(null!=t&&t.search){var e=Ln(null==t?void 0:t.search,"__experiment_id"),i=Ln(null==t?void 0:t.search,"__experiment_variant");e&&i&&(pu.Qu("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Xu(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.qi.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)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:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Xu(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(pu.Qu("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Ku(r[0].name,e,r[0].variants[e].transforms))}static Yu(t,e){return!we(t.conditions)&&pu.th(t,e)&&pu.eh(t)}static th(t,e){var i;if(we(t.conditions)||we(null==(i=t.conditions)?void 0:i.url))return!0;var r=pu.getWindowLocation();if(r){var s,n,o,a=As(e,r.href);return null==(s=t.conditions)||!s.url||fu[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 e;if(we(t.conditions)||we(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Kn();if(i.utm_source){var r,s,n,o,a,l,u,h,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)==i.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)==i.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)==i.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&f&&v}return!1}static Qu(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Wr.info("[WebExperiments] "+t,i)}Ku(t,e,i){this._is_bot()?pu.Qu(cu):"control"!==e?i.forEach((i=>{if(i.selector){var r;pu.Qu("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):pu.Qu("Control variants leave the page unmodified.")}_is_bot(){return St&&this._instance?Pa(St,this.qi.custom_blocked_useragents):void 0}}var _u=Gr("[Conversations]"),gu="Conversations not available yet.",mu="console",yu="__posthogHandledLogsRequestError",bu=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[yu]=!0,i},wu=t=>!!t&&"object"==typeof t&&!0===t[yu],xu={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=su,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 ru(t.config,t.ma()),this.ts=this.mh)}updateConfig(t,e){var i;null==(i=this.mh)||i.update(t,e)}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 e;return null==(e=this.ns)?void 0:e.kv.get(t)}Dr(t){this.xh((()=>{var e;return null==(e=this.ns)?void 0:e.kv.set(t)}))}qr(t){this.xh((()=>{var e;return null==(e=this.ns)?void 0:e.kv.remove(t)}))}xh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}wh(){var t={};for(var e of[C,A,F,D]){var r=this.Sh(e);ge(r)||(t[e]=r)}this.rh=t;var s=i({},t),n=this.Sh(R);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 e=this.Sh(Y);return"number"!=typeof e||Date.now()-e>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 e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}Mh(){var t=this.qi.flagKeys;if(!ge(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),e}))}initialize(){var t,e,i=this.qi,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(t[e]=o[e],t)),{});return this.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s,n,o=null!=r&&r.merge&&null!==(s=this.Sh(R))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.Sh(A))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var d of Object.entries(l)){var v=d[0],c=d[1];h[v]={key:v,enabled:Mt(c),variant:Dt(c),reason:void 0,metadata:ge(null==u?void 0:u[v])?void 0:{id:0,version:void 0,description:void 0,payload:u[v]}}}this.Eh({flags:h})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(I),e=this.Sh(D),r=this.Sh(N);if(!r&&!e)return t||{};var s=Yr({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,u=s[o],h=null==e?void 0:e[o],d=ge(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=ge(h)?null==u?void 0:u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],f=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.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(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:Mt(r),variant:Dt(r),payload:Ft(e[i])}}))}getFlagVariants(){var t=this.Sh(R),e=this.Sh(D);if(!e)return t||{};for(var i=Yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.ih=!0),i}getFlagPayloads(){var t=this.Sh(A),e=this.Sh(N);if(!e)return t||{};for(var i=Yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.ih=!0),i}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((e=>e!==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 e=this.ns;if(e&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var r={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},e.initialPersonProperties,this.Sh(L)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Sh(U),timezone:io()};ge(e.deviceId)||(r.$device_id=e.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();ge(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 u=()=>{this.hh&&(this.hh=!1,this.Rh())},h=t=>{this.oh=!1,l===this.lh?(this.Dr({[J]:[au]}),this.I.error("Feature flag request failed",t),u()):u()};try{e.sendRequest(a,{target:"flags",method:"POST",body:r,compression:"base64"===this.qi.compression?vo.Base64:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var e,i,s=null!==(e=t.json)&&void 0!==e?e:{},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?au:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var h=!(null==(i=s.quotaLimited)||!i.includes("feature_flags"));h&&a.push("quota_limited"),this.Dr({[J]:a}),h?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}),u()}}else u()})).catch(h)}catch(t){h(t)}}}gh(){return Bn(this.ph,3)}Ph(t){this.ph=zn(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,e){var i;if(void 0===e&&(e={}),!e.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+ou)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.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),u=this.Sh(F)||void 0,h=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(e.send_event||!("send_event"in e))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,E,k,T;ce(d[t])?d[t].push(l):d[t]=[l],this.Dr(i({[G]:d},r?{[K]:r}:{}));var P=this.getFeatureFlagDetails(t),R=[...null!==(p=this.Sh(J))&&void 0!==p?p:[]];ge(o)&&R.push("flag_missing");var C={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:u,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.qi.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_: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};ge(null==P||null==(b=P.metadata)?void 0:b.has_experiment)||(C.$feature_flag_has_experiment=P.metadata.has_experiment),ge(null==P||null==(w=P.metadata)?void 0:w.version)||(C.$feature_flag_version=P.metadata.version);var O,I=null!==(x=null==P||null==(S=P.reason)?void 0:S.description)&&void 0!==x?x:null==P||null==(E=P.reason)?void 0:E.code;I&&(C.$feature_flag_reason=I),null!=P&&null!=(k=P.metadata)&&k.id&&(C.$feature_flag_id=P.metadata.id),ge(null==P?void 0:P.original_variant)&&ge(null==P?void 0:P.original_enabled)||(C.$feature_flag_original_response=ge(P.original_variant)?P.original_enabled:P.original_variant),null!=P&&null!=(T=P.metadata)&&T.original_payload&&(C.$feature_flag_original_payload=null==P||null==(O=P.metadata)?void 0:O.original_payload),R.length&&(C.$feature_flag_error=R.join(",")),this.Ah(C)}else r&&this.Dr({[G]:d,[K]:r});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Ft(a)}}}else this.I.warn('getFeatureFlagResult for key "'+t+ou)}Ah(t){try{var e;null==(e=this.ns)||e.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,e){this.Fh(t,e)}Fh(t,i){var r=this;return e((function*(){var e=r.ns;if(e){var s={distinct_id:e.distinctId,token:e.projectToken,person_properties:{$lib:e.library.name,$lib_version:e.library.version}},n=r.Th();n.length&&(s.evaluation_contexts=n);var o,a=r.Mh();ge(a)||(s.flag_keys=a);try{var l,u=null==(l=(yield e.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===r.qi.compression?vo.Base64:void 0,sentAt:"body",timeoutMs:r.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==u?void 0:u[t])||void 0}catch(t){return void r.I.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){r.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,e){if(void 0===e&&(e={}),e.fresh&&!this.dh)return e.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+ou),e.defaultValue;var i=this.getFeatureFlag(t,e);return ge(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){this.Eh(t,e,i)}Eh(t,e,r){if(this.ns){this.ah=!0;var s=function(t,e,r,s,n,o){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={}),void 0===o&&(o=su);var a=((t,e)=>{var r=t.flags;return r?i({},t,{featureFlags:Object.fromEntries(Object.keys(r).map((t=>{var e;return[t,null!==(e=r[t].variant)&&void 0!==e?e:r[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(r).filter((t=>r[t].enabled)).filter((t=>{var e;return null==(e=r[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=r[t].metadata)?void 0:e.payload]})))}):(t.featureFlags&&e.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,u=a.featureFlags,h=a.featureFlagPayloads;if(u){var d=t.requestId,v=t.evaluatedAt;if(ce(u)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var f=0;u.length>f;f++)c[u[f]]=!0;return{[C]:u,[R]:c,[M]:!1}}var p=u,_=h,g=l;if(null!=n&&n.partialResponse)p=i({},e,p),_=i({},r,_),g=i({},s,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));p=i({},e,Object.fromEntries(Object.entries(p).filter((t=>m.has(t[0]))))),_=i({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0]))))),g=i({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else p=i({},e,p),_=i({},r,_),g=i({},s,g);return i({[C]:Object.keys(uu(p)),[R]:p||{},[A]:_||{},[I]:g||{},[M]:!0===t.minimalFlagCalledEvents},d?{[F]:d}:{},v?{[Y]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.I);s&&this.Dr(s),e||(this.fh=!1),this.Lh(e)}}override(t,e){void 0===e&&(e=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Oh(t)}Oh(t){if(this.ns){if(!1===t)return this.qr([D,N]),this.Lh(),void nu.info("All overrides cleared");if(ce(t))return this.Dr({[D]:lu(t)}),this.Lh(),void nu.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,i=t;this.ih=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);var r={},s=i.flags,n=i.payloads;return s&&(r[D]=ce(s)?lu(s):s),n&&(r[N]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([D,N]):!1===s?this.qr(D):!1===n&&this.qr(N),this.Lh(),!1===s?nu.info("Flag overrides cleared"):s&&nu.info("Flag overrides set",{flags:s}),void(!1===n?nu.info("Payload overrides cleared"):n&&nu.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[D]:t}),this.Lh(),void nu.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 e=this.Dh(),i=e.flags,r=e.flagVariants;try{t(i,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s=(this.Sh(O)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),r&&(o.$feature_enrollment_stage=r);var a=i({},this.getFlagVariants(),{[t]:e});this.Dr({[C]:Object.keys(uu(a)),[R]:a,[L]:i({},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,e,i){void 0===e&&(e=!1);var r=this.Sh(O);!r||e?this.$h(t,i):t(r)}$h(t,i){var r=this;return e((function*(){var e=r.ns;if(e){var s,n=i?"&"+i.map((t=>"stage="+t)).join("&"):"";try{var o=yield e.sendRequest("/api/early_access_features/?token="+e.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r.Dr({[O]: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(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}Lh(t){this.wh();var e=this.Dh(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0),this.Nh(t,e)}Nh(t,e){void 0===e&&(e=!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]:i({},r,o,s)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.Sh(L)||{});t.forEach((t=>{delete r[t]})),this.Dr({[L]:r}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(L),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.Sh(U)||{},s=i({},r);for(var n of Object.keys(t))s[n]=i({},r[n],t[n]);this.Dr({[U]:s}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Sh(U)||{};this.Dr({[U]:i({},e,{[t]:{}})})}else this.qr(U)}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}}},Su={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,e;return this.jh===Il||this.jh===Al?this.jh:null!==(t=null==(e=this.qh)?void 0:e.status)&&void 0!==t?t:this.jh}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=Cl,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var t;if(null==Et||!Et.visibilityState||"visible"===Et.visibilityState)return!0;var e=null==wt||null==(t=wt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==Et?void 0:Et.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=t,!this._instance.sessionManager)throw Ml.error("started without valid sessionManager"),new Error(Fl+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===dt)throw new Error(Fl+' cannot be used with cookieless_mode="always"');null!=Et&&Et.addEventListener&&rs(Et,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==Et||null==Et.removeEventListener||Et.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.qi.disable_session_recording,r=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return wt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!(this.Hh||this.Uh&&null!=(e=this.qh)&&e.isStarted)){var i=!ge(Object.assign)&&!ge(Array.from);this.Uh&&i?(this.zh(t),Ml.info("starting")):(this.jh=Cl,this.stopRecording())}}zh(t){var e,i,r;this.Uh&&(this.jh!==Il&&this.jh!==Al&&(this.jh=Ol),null!=At&&null!=(e=At.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=At.__PosthogExtensions__)&&i.initSessionRecording?this.Wh(t):null==(r=At.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(e=>{if(e)return this._instance.register_for_session({[lt]:!0}),Ml.error("could not load recorder",e);this.Wh(t)})))}stopRecording(){var t,e;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(e=this.qh)||e.stop()}Gh(){var t,e;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(e=this.qh)||e.discard()}Zh(){var t,e;null==(t=this.za)||t.unregister(P),null==(e=this.za)||e.unregister(w)}Qh(t,e){if(we(t))return null;var i,r=xe(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Ml.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var e,r,s=this.za,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Qh(null==(e=this.qi.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.Qh(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;we(a)&&this.Zh();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({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:ge(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==(e=this.Bh)||e.call(this),this.Bh=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.Jh(e),void this.Gh()):(this.Jh(e),void this.startIfEnabledOrStop()):(this.jh===Il&&(this.jh=Al,Ml.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.qh)&&i.log?this.qh.log(t,e):Ml.warn("log called before recorder was ready")}get Vh(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Kh(){var t,e=this._instance.get_property(b);if(!e)return!1;try{t="object"==typeof e?e:JSON.parse(e)}catch(t){return Ml.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!we(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var e,i,r;if(!this.Hh){if(null==(e=At.__PosthogExtensions__)||!e.initSessionRecording)return Ml.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=At.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Al||this.jh===Il)return;return this.jh=Il,Ml.info("persisted remote config is stale, requesting fresh config before starting"),void new So(this._instance).load()}this.jh=Ol,null==(i=(r=this.qh).setDocumentWasEverVisible)||i.call(r,this.kt),this.qh.start(t)}}onRRwebEmit(t){var e;null==(e=this.qh)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.qh||null==(e=this.za)||e.register({[S]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.qh||null==(e=this.za)||e.register({[x]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var e,i;this.qh||null==(i=this.za)||i.register({["url"===t?E:k]:!0}),null==(e=this.qh)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.qh)||!i.tryAddCustomEvent(t,e))}}},Eu={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 e;if(wt&&(null==(e=wt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return Sl;var r={next:t[e]},s=i((function(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];return r.next.apply(this,e)}));return fe(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]!==s)for(var i=t[e];fe(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===s)return void(n.next=r.next);i=n.next}else t[e]=r.next}}catch(t){return Sl}}(wt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.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}:pe(t)?t:{}}ed(t){return void 0===t&&(t=this.td()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ud(t){var e=this.td(),i=this.Yh;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.ed(e)&&t.hash!==i.hash))}ld(t){try{var e=this.Xh();if(!e)return;this.ud(e)&&this._instance.capture(gt,{navigation_type:t}),this.Yh=e}catch(e){Wr.error("Error capturing "+t+" pageview",e)}}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 e;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=t,this.hd=!(null==(e=this.instance.persistence)||!e.props[v]),this.rageclicks=new fl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return pe(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return we(this.qi.capture_heatmaps)?we(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 e=t.config;if("heatmaps"in e){var i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[v]:i}),this.hd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){Nl(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd="visible"===(null==Et?void 0:Et.visibilityState)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){wt&&Et&&(this.gd=this.La.bind(this),rs(wt,_t,this.gd),this.md=t=>this.ki(t||(null==wt?void 0:wt.event)),rs(Et,"click",this.md,{capture:!0}),this.yd=t=>this.bd(t||(null==wt?void 0:wt.event)),rs(Et,"mousemove",this.yd,{capture:!0}),this._d=new Tn(this.instance,En,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),rs(Et,pt,this.wd),this.Qn=!0)}fd(){var t;wt&&Et&&(this.gd&&wt.removeEventListener(_t,this.gd),this.md&&Et.removeEventListener("click",this.md,{capture:!0}),this.yd&&Et.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&Et.removeEventListener(pt,this.wd),clearTimeout(this.kd),null==(t=this._d)||t.stop(),this.Qn=!1)}Sd(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&Us(r)&&!js(r,"body");){if(r===i)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(oe(e,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:i),target_fixed:n,type:e}}ki(t,e){var r;if(void 0===e&&(e="click"),!Ls(t.target)&&Nl(t)){var s=this.Sd(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&on(Js(t),this.instance.config.rageclick)&&this.Nn(i({},s,{type:"rageclick"})),this.Nn(s)}}bd(t){!Ls(t.target)&&Nl(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(t){if(wt){var e=this.qi.disable_capture_url_hashes?Hi(wt.location.href):wt.location.href,i=this.qi.custom_personal_data_properties,r=this.qi.mask_personal_data_properties?[...Hn,...i||[]]:[],s=Un(e,r,Wn);this.ft=this.ft||{},this.ft[s]||(this.ft[s]=[]),this.ft[s].push(t)}}La(){this.ft&&!_e(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Tn,webVitalsAutocapture:class{constructor(t){var e;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",i({$current_url:this.ft.url},this.ft.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=t=>{var e;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},we(null==t?void 0:t.name)||we(null==t?void 0:t.value))kl.error("Invalid metric received",t);else{var r="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Md(r);if(!ge(s)){var n=xe(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)),ge(this.ft.navigationKey)&&(this.ft.navigationKey=n,this.ft.url=s),this.ft.firstMetricTimestamp=ge(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp;var o=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),a=i({},t,r?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,pe(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var u of Rl){var h="url"===u&&"string"==typeof t.attribution[u]?this.Md(t.attribution[u]):t.attribution[u];ge(h)||(l[u]=h)}a.attribution=l}else delete a.attribution;ge(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 kl.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,e,r,s,n=!1,o=At.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Rd])||("web-vitals"===this.Rd&&ge(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!ge(l)){var u=l.withoutAttribution,h=this.attributionMetrics;n=!ge(u),t=h.indexOf("LCP")>-1?l.onLCP:(null==u?void 0:u.onLCP)||l.onLCP,e=h.indexOf("CLS")>-1?l.onCLS:(null==u?void 0:u.onCLS)||l.onCLS,r=h.indexOf("FCP")>-1?l.onFCP:(null==u?void 0:u.onFCP)||l.onFCP,s=h.indexOf("INP")>-1?l.onINP:(null==u?void 0:u.onINP)||l.onINP}if(t&&e&&r&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?i({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Td.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&e(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 kl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(e=this._instance.persistence)||!e.props[_]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=pe(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return we(i)?(null==(e=this._instance.persistence)?void 0:e.props[y])||$l:i}get flushToCaptureTimeoutMs(){return(pe(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=pe(this.Pd)?this.Pd.web_vitals_attribution:void 0;return Ee(t)?t?$l:[]:ce(t)?t:Pl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=pe(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=pe(this.Pd)&&xe(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:Tl;return t>0&&6e4>=t?Tl:t}get isEnabled(){var t=null==kt?void 0:kt.protocol;if("http:"!==t&&"https:"!==t)return kl.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=pe(this.Pd)?this.Pd.web_vitals:Ee(this.Pd)?this.Pd:void 0;return Ee(e)?e:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(kl.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=pe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=pe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[_]:i}),this._instance.persistence.register({[y]:r})),this.hd=i,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 e=At.__PosthogExtensions__,i=this.Rd,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&ge(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?kl.error("failed to load script",e):t()}))}Md(t){var e=t||(null==wt?void 0:wt.location.href);if(e){var i=this._instance.config.disable_capture_url_hashes?Hi(e):e,r=this._instance.config.custom_personal_data_properties,s=this._instance.config.mask_personal_data_properties?[...Hn,...r||[]]:[];return Un(i,s,Wn)}kl.error("Could not determine current URL")}}},ku={exceptionObserver:class{constructor(t){var e;this.Id=()=>{var t;if(wt&&this.isEnabled&&null!=(t=At.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=At.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=At.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=At.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=e(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=i(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==(e=this._instance.persistence)||!e.props[c]),this.oe=new Ne(i({},function(t){var e,i,r,s;return void 0===t&&(t={}),{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e: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,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pe(t)?e=i({},e,t):(ge(t)?this.Dd:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}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 e,i;null!=(e=At.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return xl.error("failed to load script",e);t()}))}Od(){var t,e,i;null==(t=this.Ad)||t.call(this),this.Ad=void 0,null==(e=this.Fd)||e.call(this),this.Fd=void 0,null==(i=this.Ld)||i.call(this),this.Ld=void 0}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Dd=!!e.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 e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"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 e,r;this.Nd=[],this.qd=new pr([new $r,new Nr,new Rr,new Pr,new Mr,new Fr,new Or,new Dr],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=Tr.test(l)?l.replace(Tr,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var d=h(u,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||_r});var r}))}(n)}}("web:javascript",xr,kr)),this._instance=t,this.Nd=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(f))&&void 0!==e?e:[],this.jd=zr(this.Bd()),this.Hd=new qr(this.jd)}onConfigChange(){this.jd=zr(this.Bd()),this.Hd.setConfig(this.jd)}onRemoteConfig(t){var e,i,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(e=null==(i=s.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],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,e=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.qd.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.jd.enabled)try{if(!me(t)||0===t.trim().length)return void hu.warn("Ignoring exception step because message must be a non-empty string");var r=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>jr.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.zd(e)),s=r.sanitizedProperties,n=r.droppedKeys;n.length>0&&hu.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Hd.add(i({[Lr]:t,[Ur]:(new Date).toISOString()},s))}catch(t){hu.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Wd(e)){if(this.Vd(e))return this.Gd("Exception dropped: matched a suppression rule"),void hu.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(e))return this.Gd("Exception dropped: thrown by a browser extension"),void hu.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(e))return this.Gd("Exception dropped: thrown by an injected browser script"),void hu.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(e))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void hu.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.jd.enabled&&we(t.$exception_steps)?this.Kd(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(i.$release_id=r);try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fl:!0});return s&&this.Hd.clear(),s}catch(t){return hu.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void hu.error("Failed to process exception event. Ignoring this exception.",t)}var n}Kd(t){try{var e=this.Hd.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return hu.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Gd(t){this.jd.enabled&&this.Hd.add({[Lr]:t,[Ur]:(new Date).toISOString()})}zd(t){return pe(t)?i({},t):{}}Bd(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Vd(t){if(0===t.length)return!1;try{var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return me(i)&&i.length>0&&t.$exception_types.push(i),me(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Nd.some((t=>{var i=t.values.map((t=>{var i=Aa[t.operator],r=e[t.key];if(!i||!r)return!1;var s=ce(t.value)?t.value:[t.value];return s.length>0&&i(s,r)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}catch(t){return hu.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zd(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>{var e=t.filename;return!!e&&du.some((t=>e.startsWith(t)))}))}Qd(t){return t.some((t=>{var e=t.value;return me(e)&&vu.some((t=>e.includes(t)))}))}Jd(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],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!we(t)&&ce(t)}}},Tu=i({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 e=t.config;if("productTours"in e){var i,r;if(this.za&&this.za.register({[m]:!!e.productTours}),!Ul(this._instance))return!this.Yd&&we(null==(i=this.za)?void 0:i.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&&Ul(this._instance)&&this._s((()=>this.tv()))}_s(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ll.error("Could not load product tours script",e):t()}))}tv(){var t;!this.Yd&&null!=(t=At.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=At.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!ce(this.Xd)||e){var i=this.za;if(i){var r=i.props[W];if(ce(r)&&!e)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:e=>{if(Ul(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?e.error||Ll.warn(s):Ll.error(s),void t([],{isLoaded:!1,error:s})}var n=ce(e.json.product_tours)?e.json.product_tours:[];this.Xd=n,i&&i.register({[W]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){we(this.Yd)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Yd)||e.showTourById(t)}previewTour(t){this.Yd?this.Yd.previewTour(t):this._s((()=>{var e;this.tv(),null==(e=this.Yd)||e.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 e;null==(e=this.Yd)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Yd)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Yd)||e.cancelPendingTour(t)}}},xu),$u={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,e){if(e){var i=this.globalsForEvent(e);this.iv.push(i),this.iv.length>1e3&&(this.iv=this.iv.slice(10))}}get siteAppLoaders(){var t;return null==(t=At._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.rv.bind(this));this.nv=()=>{t(),this.iv=[],this.nv=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,u;if(!t)throw new Error("Event payload is required");var h={},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];h[f]={id:d[f],type:f,properties:c[1]}}var p=t.$set_once,_=t.$set;return{event:i({},r(t,jl),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},p?{$set_once:i({},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==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}sv(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Bl.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Bl.error("prepare_external_dependency_script returned null"),null):t}av(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==Et?void 0:Et.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.ev++,this.ov)return this.lv();var h=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),h.push((()=>{t[e]=r}))}},f=t=>{if(v.has(t))return t;var e=d.sv(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!be(t)));return c(u,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))}))})),[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 e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=p(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=f(i);return r?t.call(this,e,r):null})),this.ov=()=>{h.forEach((t=>t())),this.ov=void 0},this.lv()}lv(){var t=!1;return()=>{var e;t||(t=!0,this.ev--,0===this.ev&&(null==(e=this.ov)||e.call(this)))}}uv(t,e){void 0===e&&(e=!0);var i=this.av();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.iv.length&&(Bl.info("Processing "+this.iv.length+" events for site app with id "+t.id),this.iv.forEach((t=>this.uv((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.nv)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Bl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var n=this.uv((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1).processEvent;n&&(e.processEvent=n),r=!0}catch(e){Bl.error(zl+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Bl.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}hv(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}dv(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.uv((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Bl.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.hv(),void this._instance.on("eventCaptured",(t=>this.dv(t)))):void Bl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.nv)||i.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,e=a.id,i=a.url;At["__$$ph_site_app_"+e]=s._instance,null==(t=At.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return Bl.error(zl+e,t)}))};for(var a of n.siteApps)o()}else Bl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Pu={tracingHeaders:class{constructor(t){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var t,e,i=this.gv();i?(ge(this.vv)&&(this.vv=null==(t=At.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),ge(this.fv)&&(this.fv=null==(e=At.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Od()},this._instance=t}initialize(){this.startIfEnabledOrStop()}_s(t){var e,i;null!=(e=At.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=At.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return El.error("failed to load script",e);t()}))}mv(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}gv(){var t=this.mv();return ce(t)?(ce(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(ce(this.pv)&&this.pv.splice(0),this.pv=t||void 0,this.pv)}Od(){var t,e;null==(t=this.vv)||t.call(this),null==(e=this.fv)||e.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Od()}}},Ru=i({surveys:class extends Wl{constructor(t){var e;super(new Xl(t),{get projectToken(){return e.config.token},kv:new Ql(e=t)}),this._instance=t}Nl(t,e){var i=e.query?oa(t,e.query):t;return new Promise((t=>{var r;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})}))}}},xu),Cu={toolbar:class{constructor(t){this.instance=t}yv(t){At.ph_toolbar_state=t}bv(){var t;return null!==(t=At.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),ss(this.instance.config))return!1;if(!wt||!Et)return!1;t=null!=t?t:wt.location,i=null!=i?i:wt.history;try{if(!e){try{wt.localStorage.setItem("test","test"),wt.localStorage.removeItem("test")}catch(t){return!1}e=null==wt?void 0:wt.localStorage}var r,s=Zl||jn(t.hash,"__posthog")||jn(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:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(tu)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}_v(t){var e=At.ph_load_toolbar||At.ph_load_editor;!we(e)&&fe(e)?e(t,this.instance):eu.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==Et||!Et.getElementById(Fs));if(!wt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(wt.localStorage.setItem(tu,JSON.stringify(i({},s,{source:void 0}))),2===this.bv())this._v(s);else if(0===this.bv()){var n;this.yv(1),null==(n=At.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return eu.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,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},Ou=i({experiments:pu},xu),Iu={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 e=t.config.conversations;we(e)||(Ee(e)?this.Sv=e:(this.Sv=e.enabled,this.Me=e),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==At?void 0:At.__PosthogExtensions__;if(t&&!ge(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var e=t.initConversations;if(e)return this.Mv(e),void(this.xv=!1);var i=t.loadExternalDependency;if(!i)return void this.Ev(ut);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.Ev("Could not load conversations script",e):this.Mv(t.initConversations),this.xv=!1}))}catch(t){this.Ev("Error initializing conversations",t),this.xv=!1}}else _u.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,_u.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else _u.error("Cannot complete initialization: remote config is null")}Ev(t,e){_u.error(t,e),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():_u.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!be(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":ge(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?we(this.Me)||!this.Me.token?"missing_token":null!=At&&At.__PosthogExtensions__?this.xv?"initializing":this.Cv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(_u.warn(gu),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(_u.warn(gu),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(_u.warn(gu),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(_u.warn(gu),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(_u.warn(gu),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(_u.warn(gu),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(_u.warn(gu),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}Sl(){var t;null==(t=this._conversationsManager)||t.setIdentity()}xl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Au={logs:class{constructor(t){var e,r=this;this.Iv=!1,this.Rv=!1,this.I=Gr("[logs]"),this.Pv=i({},this.I,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(wu)||r.I.error(...e)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var t,e;this.ph=0,null==(t=this.Lv)||t.onReconnect(),null==(e=this.Ov)||e.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.Iv=!0),wt&&rs(wt,"online",this.Fv)}Dv(t,e,i,r){var s,n=function(t,e){var i,r,s,n,o,a,l,u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=ge(d)?Math.max(h,2048):Math.max(h,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==e?void 0:e.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:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new or(this.$v(t,e),n,this.Pv,(()=>this.Nv()),(t=>t()),void 0,r),n]}qv(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Lv||this.jv!==e){var i;null==(i=this.Lv)||i.reset(),this.jv=e;var r=this.Dv((()=>this.ka),(t=>{this.ka=t}));this.Lv=r[0],this.Bv=r[1]}return this.Lv}Hv(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Ov||this.Uv!==e){var i;null==(i=this.Ov)||i.reset(),this.Uv=e;var r=this.Dv((()=>this.Av),(t=>{this.Av=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},mu);this.Ov=r[0],this.zv=r[1]}return this.Ov}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e;if(t.ok){var i=null==(e=t.config.logs)?void 0:e.captureConsoleLogs;!we(i)&&i&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var t,e;this.ka=[],null==(t=this.Lv)||t.reset(),this.Av=[],null==(e=this.Ov)||e.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,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),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){wu(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==At?void 0:At.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.I.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.Rv=!0)})):this.I.error(ut)}else this.I.error("PostHog Extensions not found.")}}$v(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===Ut.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===Ut.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Mn:t=>this.Mn(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Mn(t){return new Promise((e=>{if(Bn(this.ph,3))e({kind:"fatal",error:bu(void 0,"logs endpoint is unreachable, dropping batch")});else{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:bu(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 e=t.statusCode;if(this.Qv(e),e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;0===e?(t.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:bu(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}}))}Qv(t){(0!==t||this._instance.__loaded)&&(this.ph=zn(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,mu,(t=>{this.Av=t}))}Jv(t,e,i,r,n){if(0!==e.length){var o=e.map((t=>t.record));n([]);var a=nr(o,sr(i,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,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=i.windowId,s=i.sessionStartTimestamp,n=i.lastActivityTimestamp;e.sessionId=i.sessionId,e.windowId=r,we(s)||(e.sessionStartTimestamp=s),we(n)||(e.lastActivityTimestamp=n)}if(null!=At&&null!=(t=At.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Hi(At.location.href):At.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Fu={metrics:class{constructor(t){this.I=Gr("[metrics]"),this._instance=t}initialize(){}qv(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Lv&&this.jv===i||(null==(e=this.Lv)||e.reset(),this.jv=i,this.Lv=new hr(this.$v(),function(t){var e,i,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i: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}}(i),this.I)),this.Lv}count(t,e,i){void 0===e&&(e=1),this.qv().count(t,e,i)}gauge(t,e,i){this.qv().gauge(t,e,i)}histogram(t,e,i){this.qv().histogram(t,e,i)}flush(t){if(!this.Lv)return Promise.resolve();if(t){var e=this.Lv.drainWindow();return e&&this.Un(e,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,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Un:t=>e.Un(t),getLibraryId:()=>s.LIB_NAME,getLibraryVersion:()=>s.LIB_VERSION}}Un(t,e){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(i({method:"POST",url:this.Kv(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}}))}))}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Mu=i({},xu,Su,Eu,ku,Tu,$u,Ru,Pu,Cu,Ou,Iu,Au,Fu);cl.__defaultExtensionClasses=i({},Mu);var Du=Gr("[ExternalScriptsLoader]"),Nu=t=>{var e=null==Et?void 0:Et.querySelectorAll("script");if(e)for(var i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},Lu=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Du.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=Nu(e);if(r){if(r.__posthog_loading_callback_fired)return i();var s=r.__posthog_loading_error;return s?i(s):(r.addEventListener("load",(t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)})),void r.addEventListener("error",(t=>{r.__posthog_loading_error=t,i(t)})))}var n=()=>{if(!Et)return i("document not found");if(Nu(e))return Lu(t,e,i);var r=Et.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)Et.head.appendChild(r);else{var s,n=Et.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):Et.body.appendChild(r)}};null!=Et&&Et.body?n():null==Et||Et.addEventListener("DOMContentLoaded",n)},Uu={},ju=(t,e)=>{var i="/static/"+e+".js?v="+t.version;if("toolbar"===e){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",i)};At.__PosthogExtensions__=At.__PosthogExtensions__||{},At.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js"),n=Uu[s];if("fallback"===r&&n){if(Nu(n))return void Lu(t,n,i);delete Uu[s]}Lu(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=ju(t,e);Uu[s]=a;var l=Nu(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Lu(t,a,i)}else i(void 0,n)}:i)}else Lu(t,ju(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Lu(t,o,i)}},At.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Lu(t,r,i)};var Bu=function(){s.SDK_DIST_CHANNEL="npm";var t=Za[al]=new cl;return function(){function t(){t.done||(t.done=!0,ll=!1,Jr(Za,(function(t){t._dom_loaded()})))}null!=Et&&Et.addEventListener?"complete"===Et.readyState?t():rs(Et,"DOMContentLoaded",t,{capture:!1}):wt&&Wr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=vo,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=go,exports.PostHog=cl,exports.ProductTourEventName=mo,exports.ProductTourEventProperties=yo,exports.SurveyEventName=po,exports.SurveyEventProperties=_o,exports.SurveyEventType=co,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=fo,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=Bu,exports.posthog=Bu,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
2
2
|
//# sourceMappingURL=main.js.map
|