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/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:t;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"0.5.2",LIB_NAME:"browser-common"};function f(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 p(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function _(){return _=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},_.apply(null,arguments)}function g(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}var m=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function y(t){return"string"==typeof t||t}function b(t){return"string"==typeof t?t:void 0}var w,S=["$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"],x=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}({}),E=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),k=["$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"],T=["token"],P="NativeGzipValidationError",R=t=>t.length>=2&&31===t[0]&&139===t[1],C=(t,e)=>t===E.GZipJS||e===E.GZipJS||"gzip"===e,O=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),I=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=P,e},A=function(){var t=p((function*(t,e){18>t.size&&I("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());R(i)&&8===i[2]||I("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(w)return w;w=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;w[t]=e>>>0}return w})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&I("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&I("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function F(){return F=p((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=p((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield A(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),F.apply(this,arguments)}var M=20,D=1e3,N=1e4,L="[Circular]",U="[Truncated]",j="[Unserializable]",B="[Function]";function z(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 q=["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"],H=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return q.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function V(t,e){return-1!==t.indexOf(e)}var W=function(t){return t.trim()},G=function(t){return t.replace(/^\$/,"")};function K(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 J=Object.prototype,Y=J.hasOwnProperty,Q=J.toString,X=Array.isArray||function(t){return"[object Array]"===Q.call(t)},Z=t=>"function"==typeof t,tt=t=>t===Object(t)&&!X(t),et=t=>{if(tt(t)){for(var e in t)if(Y.call(t,e))return!1;return!0}return!1},it=t=>void 0===t,rt=t=>"[object String]"==Q.call(t),st=t=>rt(t)&&0===t.trim().length,nt=t=>null===t,ot=t=>it(t)||nt(t),at=t=>"[object Number]"==Q.call(t)&&t==t,lt=t=>at(t)&&t>0,ut=t=>"[object Boolean]"===Q.call(t),ht=t=>t instanceof FormData,dt=t=>V(k,t),vt=t=>V(T,t);function ct(t){return null===t||"object"!=typeof t}function ft(t,e){return{}.toString.call(t)==="[object "+e+"]"}function pt(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 gt(t,Error)}}function _t(t){return"undefined"!=typeof Event&>(t,Event)}function gt(t,e){try{return t instanceof e}catch(t){return!1}}var mt=[!0,"true",1,"1","yes"],yt=t=>V(mt,t),bt=[!1,"false",0,"0","no"];function wt(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),at(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),wt(s||i,e,i,r))}class St{constructor(t){this.k={},this.S=t.S,this.C=wt(t.bucketSize,0,100,t.I),this.R=wt(t.refillRate,0,this.C,t.I),this.A=wt(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 xt="Mobile",Et="iOS",kt="Android",Tt="Tablet",$t=kt+" "+Tt,Pt="iPad",Rt="Apple",Ct=Rt+" Watch",Ot="Safari",It="BlackBerry",At="Samsung",Ft=At+"Browser",Mt=At+" Internet",Dt="Chrome",Nt=Dt+" OS",Lt=Dt+" "+Et,Ut="Internet Explorer",jt=Ut+" "+xt,Bt="Opera",zt=Bt+" Mini",qt="Edge",Ht="Microsoft "+qt,Vt="Firefox",Wt=Vt+" "+Et,Gt="Nintendo",Kt="PlayStation",Jt="Xbox",Yt=kt+" "+xt,Qt=xt+" "+Ot,Xt="Windows",Zt=Xt+" Phone",te="Nokia",ee="Ouya",ie="Generic",re=ie+" "+xt.toLowerCase(),se=ie+" "+Tt.toLowerCase(),ne="Konqueror",oe="Oculus Browser",ae="Vivaldi",le="Yandex",ue="Whale",he="DuckDuckGo",de="Pale Moon",ve="Waterfox",ce="Brave",fe="Google Search App",pe="(\\d+(\\.\\d+)?)",_e=new RegExp("Version/"+pe),ge=new RegExp(Jt,"i"),me=new RegExp(Kt+" \\w+","i"),ye=new RegExp(Gt+" \\w+","i"),be=new RegExp(It+"|PlayBook|BB10","i"),we={"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"},Se=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?ce:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&V(t,"GSA/")?fe:V(t," OPR/")&&V(t,"Mini")?zt:V(t," OPR/")?Bt:be.test(t)?It:V(t,"IE"+xt)||V(t,"WPDesktop")?jt:V(t,"OculusBrowser")?oe:V(t,Ft)?Mt:V(t,qt)||V(t,"Edg/")?Ht:V(t,ae+"/")?ae:V(t,"YaBrowser/")?le:V(t,ue+"/")?ue:V(t,he+"/")||V(t,"Ddg/")?he:V(t,"FBIOS")?"Facebook "+xt:V(t,"UCWEB")||V(t,"UCBrowser")?"UC Browser":V(t,"CriOS")?Lt:V(t,"CrMo")||V(t,Dt)?Dt:V(t,kt)&&V(t,Ot)?Yt:V(t,"FxiOS")?Wt:V(t.toLowerCase(),ne.toLowerCase())?ne:V(t,ce+"/")?ce:((t,e)=>e&&V(e,Rt)||function(t){return V(t,Ot)&&!V(t,Dt)&&!V(t,kt)}(t))(t,e)?V(t,xt)?Qt:Ot:V(t,"PaleMoon/")?de:V(t,ve+"/")?ve:V(t,Vt)?Vt:V(t,"MSIE")||V(t,"Trident/")?Ut:V(t,"Gecko")?Vt:"")},xe={[jt]:[new RegExp("rv:"+pe)],[Ht]:[new RegExp(qt+"?\\/"+pe)],[Dt]:[new RegExp("("+Dt+"|CrMo)\\/"+pe)],[Lt]:[new RegExp("CriOS\\/"+pe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pe)],[Ot]:[_e],[Qt]:[_e],[Bt]:[new RegExp("(Opera|OPR)\\/"+pe)],[Vt]:[new RegExp(Vt+"\\/"+pe)],[Wt]:[new RegExp("FxiOS\\/"+pe)],[ne]:[new RegExp("Konqueror[:/]?"+pe,"i")],[It]:[new RegExp(It+" "+pe),_e],[Yt]:[new RegExp("android\\s"+pe,"i")],[Mt]:[new RegExp(Ft+"\\/"+pe)],[oe]:[new RegExp("OculusBrowser\\/"+pe)],[ae]:[new RegExp(ae+"\\/"+pe)],[le]:[new RegExp("YaBrowser\\/"+pe)],[ue]:[new RegExp(ue+"\\/"+pe)],[ce]:[new RegExp(ce+"\\/"+pe)],[he]:[new RegExp("(DuckDuckGo|Ddg)\\/"+pe)],[de]:[new RegExp("PaleMoon\\/"+pe)],[ve]:[new RegExp(ve+"\\/"+pe)],[fe]:[new RegExp("GSA\\/"+pe)],[Ut]:[new RegExp("(rv:|MSIE )"+pe)],Mozilla:[new RegExp("rv:"+pe)]},Ee=function(t,e,i,r){var s=Se(t,e,i,r),n=xe[s];if(it(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},ke=[[new RegExp(Jt+"; "+Jt+" (.*?)[);]","i"),t=>[Jt,t&&t[1]||""]],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Kt,"i"),[Kt,""]],[be,[It,""]],[new RegExp(Xt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Zt,""];if(new RegExp(xt).test(e)&&!/IEMobile\b/.test(e))return[Xt+" "+xt,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=we[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Xt,r]}return[Xt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Et,[t[3],t[4],t[5]||"0"].join(".")]:[Et,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=it(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+kt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+kt+")","i"),t=>t&&t[2]?[kt,[t[2],t[3],t[4]||"0"].join(".")]:[kt,""]],[/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/,[Nt,""]],[/Linux|debian/i,["Linux",""]]],Te=function(t){return ye.test(t)?Gt:me.test(t)?Kt:ge.test(t)?Jt:new RegExp(ee,"i").test(t)?ee:new RegExp("("+Zt+"|WPDesktop)","i").test(t)?Zt:/iPad/.test(t)?Pt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ct:be.test(t)?It:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(te,"i").test(t)?te:/(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(xt).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)?kt:$t:new RegExp("(pda|"+xt+")","i").test(t)?re:new RegExp(Tt,"i").test(t)&&!new RegExp(Tt+" pc","i").test(t)?se:""},$e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Pe(t,e){return"string"==typeof(i=t)&&$e.test(i)?t:e();var i}function Re(t){return t?t.split("#")[0]:t}function Ce(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function Oe(t,e,i){return Ie.apply(this,arguments)}function Ie(){return(Ie=p((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ce((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ae={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}},Fe=Ae.info,Me=0x8000000000000000,De={}.propertyIsEnumerable;function Ne(t,e){try{return je(t,e,{ancestors:new WeakSet,remainingNodes:N},0)}catch(t){return[]}}function Le(t,e,i,r){if(0>=i.remainingNodes)return{stringValue:U};if(i.remainingNodes--,ut(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>=Me||-Me>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:z(t)};if("function"==typeof t)return{stringValue:B};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:L};if(r>=M)return{stringValue:U};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?z(o):String(o)}}i.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Le(a.call(t),e,i,r+1)}catch(t){}return X(t)?{arrayValue:{values:Ue(t,e,i,r+1)}}:{kvlistValue:{values:je(t,e,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:z(String(t))}}function Ue(t,e,i,r){for(var s=[],n=Math.min(t.length,D),o=0;n>o&&i.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(ot(a))continue;s.push(Le(a,e,i,r))}catch(t){s.push({stringValue:j})}return t.length>o&&s.push({stringValue:U}),s}function je(t,e,i,r){var s=[];for(var n in t)if(De.call(t,n)){if(s.length>=D||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(nt(o)||it(o))continue;s.push({key:z(n),value:Le(o,e,i,r)})}catch(t){s.push({key:z(n),value:{stringValue:j}})}}return s}function Be(t){try{return z(String(t))}catch(t){return j}}function ze(t,e,i){var r=Ae[t.level||"info"]||Fe,s=r.text,n=r.number,o=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),ot(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),ot(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=_({},a),u=t.attributes;if(u){var h=[];try{h=Object.keys(u)}catch(t){h=[]}for(var d of h){var v=void 0;try{v=u[d]}catch(t){v=j}Object.defineProperty(l,d,{value:v,enumerable:!0,writable:!0,configurable:!0})}}var c={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:Be(t.body)},attributes:Ne(l,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),it(t.trace_flags)||(c.flags=t.trace_flags),c}function qe(t,e,i){return _({},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":i})}function He(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ne(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Ve=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:ze(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=X(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 p((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return p((function*(){var e;t._n();var i=null!==(e=t._instance.getPersistedProperty(x.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=He(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(x.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}En(t){var e=this;return p((function*(){var i,r=Math.max(0,t-e.un),s=null!==(i=e._instance.getPersistedProperty(x.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(x.LogsQueue,s.slice(r)),yield e.sn()}))()}Tn(){return qe(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(x.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(x.LogsQueue,i),this.fn>i.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Ce((()=>{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(x.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return p((function*(){e._n();var i=e.flush().catch((()=>{}));void 0!==t?yield Oe(i,t):yield i}))()}flushWithTimeout(t){var e=this;return p((function*(){var i=e.flush();yield Oe(i,t,(()=>{i.catch((()=>{}))}))}))()}wn(){this.flush().then((()=>{this.hn=0}),(t=>{this.hn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())}))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var We=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ge(t){return String(t)+"000000"}function Ke(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 Je=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,e=this.ln,i=function(){var i=p((function*(){e&&(yield e.catch((()=>{}))),yield t.qn()}));return function(){return i.apply(this,arguments)}}(),r=i().finally((()=>{this.ln===r&&(this.ln=null)}));return this.ln=r,r}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 i,r;try{i=e.attributes?_({},e.attributes):void 0,r=Ke(e.type,e.name,e.unit,i)}catch(t){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var s=this.Fn.get(r);if(!s){if(!this.Bn())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.Fn.set(r,s)}var n=this.On.get(e.name);void 0===n?this.On.set(e.name,e.type):n===e.type||this.Dn.has(e.name)||(this.Dn.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(s,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(We.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,We)]+=1}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var i=X(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=Ce((()=>{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 p((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),i=function(t,e,i){return _({},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":i})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ne(i)},scopeMetrics:[{scope:{name:r,version:s},metrics:e}]}]};var e,i,r,s}Wn(t){var e=Ge(Date.now()),i=new Map;for(var r of t.values()){var s,n=Ke(r.type,r.name,r.unit,void 0),o=i.get(n);o||(o=_({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},i.set(n,o));var a=Ne(null!==(s=r.attributes)&&void 0!==s?s:{},this.I),l=Ge(r.windowStartMs);if("count"===r.type){var u,h={attributes:a,startTimeUnixNano:l,timeUnixNano:e,asDouble:null!==(u=r.total)&&void 0!==u?u:0};o.sum.dataPoints.push(h)}else if("gauge"===r.type){var d,v={attributes:a,timeUnixNano:e,asDouble:null!==(d=r.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(v)}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:e,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:We})}return Array.from(i.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 Ye,Qe,Xe;function Ze(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Xe&&i.length===Qe||(Qe=i.length,Xe=i.reduce(((i,r)=>{Ye||(Ye={});var s=Ye[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,Ye[r]=[l,u];break}}return i}),{})),Xe}}class ti{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 e=this;return p((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&X(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.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 i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),_({},t,{cause:i,stack:r})}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 e=this;return p((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,_({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:Ze(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return _({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}}var ei="?";function ii(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?ei:i,in_app:!(null!=e&&e.startsWith("webkit-masked-url://"))&&"<anonymous>"!==e};return it(r)||(n.lineno=r),it(s)||(n.colno=s),n}var ri=(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]:ei,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},si=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ni=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oi=/\((\S*)(?::(\d+))(?::(\d+))\)/,ai=(t,e)=>{var i=si.exec(t);if(i)return ii(e,i[1],ei,+i[2],+i[3]);var r=ni.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=oi.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=ri(r[1]||ei,r[2]);return ii(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},li=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ui=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hi=(t,e)=>{var i=li.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ui.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]||ei,o=ri(n,s);return ii(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},di=/\(error: (.*)\)/;class vi{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=rt(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 ft(t,"DOMException")}isDOMError(t){return ft(t,"DOMError")}}class ci{match(t){return pt(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 fi{constructor(){}match(t){return!!ft(t,"ErrorEvent")&&(null!=t.error||this.fi(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);var r=e.apply(t.message);return _({},r,{stack:null!==(i=this.pi(t))&&void 0!==i?i:r.stack,synthetic:!0})}fi(t){return rt(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(rt(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var pi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _i{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(pi);return r&&(e=r[1],i=r[2]),[e,i]}}var gi=["fatal","error","warning","log","info","debug"];function mi(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 yi{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(_t(t))return t.constructor.name;var e="name"in t?t.name:void 0;return rt(e)&&!st(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: "+mi(t)}isSeverityLevel(t){return rt(t)&&!st(t)&&gi.indexOf(t)>=0}getStack(t){try{return rt(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:rt(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(pt(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class bi{match(t){return _t(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+mi(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class wi{match(t){return ct(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 Si{match(t){return ft(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!_t(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 ct(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 xi="$message",Ei="$timestamp",ki=new Set([xi,Ei]),Ti={enabled:!0,max_bytes:32768};function $i(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Ti.enabled,max_bytes:Ri(t.max_bytes,Ti.max_bytes)}:_({},Ti)}class Pi{constructor(t){this.Vn=[],this.Gn=0,this.qi=$i(t)}setConfig(t){this.qi=$i(t),this.Zn()}add(t){var e=function(t){var e;try{e=K(t)}catch(t){return}try{var i=JSON.parse(e);if(!tt(i))return;var r=i,s=r[xi],n=r[Ei];if(!rt(s)||0===s.trim().length)return;if(!rt(n)&&!at(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 Ri(t,e){if(!at(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Ci=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={F(i){if(t&&(c.DEBUG||t.POSTHOG_DEBUG||r)&&!it(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>Ci(e+" "+t,i)};return s},Oi=Ci("[PostHog.js]"),Ii=Oi.createLogger,Ai=Ii("[ExternalScriptsLoader]"),Fi=t=>{var e=null==r?void 0:r.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]},Mi=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Ai.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=Fi(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(Fi(e))return Mi(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},Di={},Ni=(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)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__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=Di[s];if("fallback"===r&&n){if(Fi(n))return void Mi(t,n,i);delete Di[s]}Mi(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=Ni(t,e);Di[s]=a;var l=Fi(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Mi(t,a,i)}else i(void 0,n)}:i)}else Mi(t,Ni(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Mi(t,o,i)}},v.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Mi(t,r,i)};c.DEBUG=!1,c.LIB_VERSION="1.419.0",c.LIB_NAME="web";var Li="$people_distinct_id",Ui="distinct_id",ji="$device_id",Bi="$device_model",zi="__alias",qi="__timers",Hi="$autocapture_disabled_server_side",Vi="$heatmaps_enabled_server_side",Wi="$exception_capture_enabled_server_side",Gi="$error_tracking_suppression_rules",Ki="$error_tracking_capture_extension_exceptions",Ji="$web_vitals_enabled_server_side",Yi="$dead_clicks_enabled_server_side",Qi="$product_tours_enabled_server_side",Xi="$web_vitals_allowed_metrics",Zi="$session_recording_remote_config",tr="$replay_sample_rate",er="$replay_override_sampling",ir="$replay_override_linked_flag",rr="$replay_override_url_trigger",sr="$replay_override_event_trigger",nr="$sesid",or="$session_is_sampled",ar="$enabled_feature_flags",lr="$active_feature_flags",ur="$early_access_features",hr="$feature_flag_details",dr="$feature_flag_payloads",vr="$feature_flag_request_id",cr="$minimal_flag_called_events",fr="$override_feature_flags",pr="$override_feature_flag_payloads",_r="$stored_person_properties",gr="$stored_group_properties",mr="$groups",yr="$surveys",br="$surveys_loaded_at",wr="$surveys_activated",Sr="$surveys_activated_session",xr="$surveys_activated_timestamps",Er="ph_product_tours",kr="$flag_call_reported",Tr="$flag_call_reported_session_id",$r="$feature_flag_errors",Pr="$feature_flag_evaluated_at",Rr="$user_state",Cr="$client_session_props",Or="$capture_rate_limit",Ir="$initial_campaign_params",Ar="$initial_referrer_info",Fr="$initial_person_info",Mr="$epp",Dr="$posthog_cookieless",Nr="$cookieless_mode",Lr="$sdk_debug_extensions_init_method",Ur="$sdk_debug_extensions_init_time_ms",jr="$sdk_debug_recording_script_not_loaded",Br="PostHog loadExternalDependency extension not found.",zr="on_reject",qr="always",Hr="anonymous",Vr="identified",Wr="identified_only",Gr="visibilitychange",Kr="beforeunload",Jr="$pageview",Yr="$pageleave",Qr="$identify",Xr="$groupidentify";function Zr(t,e){X(t)&&t.forEach(e)}function ts(t,e){if(!ot(t))if(X(t))t.forEach(e);else if(ht(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Y.call(t,i)&&e(t[i],i)}var es=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 is(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 rs=function(t){try{return t()}catch(t){return}},ss=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){Oi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Oi.critical(t)}}},ns=function(t){var e={};return ts(t,(function(t,i){(rt(t)&&t.length>0||at(t))&&(e[i]=t)})),e};var os=["herokuapp.com","vercel.app","netlify.app"];function as(t){var e=null==t?void 0:t.hostname;if(!rt(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of os)if(i===r)return!1;return!0}function ls(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 us(t){return"ph_toolbar_internal"===t.name}var hs=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.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 at(t)&&isFinite(t)&&Math.floor(t)===t});class ds{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 ds(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 ds(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 vs{generate(){var t=this.generateOrAbort();if(!it(t))return t;this.Rr=0;var e=this.generateOrAbort();if(it(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 ds.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 ps}}var cs,fs=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};t&&!it(t.crypto)&&crypto.getRandomValues&&(fs=t=>crypto.getRandomValues(t));class ps{nextUint32(){return this.ft.length>this.Fr||(fs(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var _s=()=>gs().toString(),gs=()=>(cs||(cs=new vs)).generate(),ms="",ys=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var bs={Nr:()=>!!r,jr(t){Oi.error("cookieStore error: "+t)},Pr:hs,Br(t){var e;try{e=JSON.parse(bs.Pr(t))||{}}catch(t){}return e},Dr(t,e,i,s,n){if(!r)return!1;try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),ms)return ms;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+_s();!ms&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",ms=o)}return ms}(t);if(!i){var s=(t=>{var e=t.match(ys);return e?e[0]:""})(t);s!==i&&Oi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Oi.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,!0}catch(t){return!1}},qr(t,e){if(null!=r&&r.cookie)try{bs.Dr(t,"",-1,e)}catch(t){return}}},ws=null,Ss={Nr(){if(!nt(ws))return ws;var e=!0;if(it(t))e=!1;else try{var i="__mplssupport__";Ss.Dr(i,"xyz"),'"xyz"'!==Ss.Pr(i)&&(e=!1),Ss.qr(i)}catch(t){e=!1}return e||Oi.error("localStorage unsupported; falling back to cookie store"),ws=e,e},jr(t){Oi.error("localStorage error: "+t)},Pr(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ss.jr(t)}return null},Br(t){try{return JSON.parse(Ss.Pr(t))||{}}catch(t){}return null},Dr(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ss.jr(t)}return!1},qr(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ss.jr(t)}}},xs=[_r,lr,ar,hr,dr,vr,Pr,$r,kr],Es=[ji,Ui,nr,or,Mr,Fr,Rr],ks=t=>t+"_cpm",Ts=["__proto__","constructor","prototype"],$s=t=>{if(!tt(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ts.indexOf(i)&&(e[i]=t[i])})),e},Ps=function(t,e){void 0===e&&(e=[]);var i={};return[...Es,...e].forEach((e=>{var r=t[e];it(r)||nt(r)||""===r||(i[e]=r)})),i},Rs=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)},Cs=(t,e)=>({p:e,f:Rs(JSON.stringify(t))}),Os=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=bs.Br(ks(t)),r=(null==i?void 0:i.f)===Rs(e)&&X(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Is=(t,e)=>e+"|"+(bs.Pr(ks(t))||""),As={},Fs={Nr:()=>!0,jr(t){Oi.error("memoryStorage error: "+t)},Pr:t=>As[t]||null,Br:t=>As[t]||null,Dr:(t,e)=>(As[t]=e,!0),qr(t){delete As[t]}},Ms=null,Ds={Nr(){if(!nt(Ms))return Ms;if(Ms=!0,it(t))Ms=!1;else try{var e="__support__";Ds.Dr(e,"xyz"),'"xyz"'!==Ds.Pr(e)&&(Ms=!1),Ds.qr(e)}catch(t){Ms=!1}return Ms},jr(t){Oi.error("sessionStorage error: ",t)},Pr(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Ds.jr(t)}return null},Br(t){try{return JSON.parse(Ds.Pr(t))||null}catch(t){}return null},Dr(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ds.jr(t)}return!1},qr(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Ds.jr(t)}}};class Ns{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===qr||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===zr}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 yt(t)?1:V(bt,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,e="localStorage"===t?Ss:bs;if(!this.ys||this.ys!==e){this.ys=e;var i="localStorage"===t?bs:Ss;i.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(yt(i.Pr(this.gs))),i.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,v.doNotTrack].some((t=>yt(t)))}}function Ls(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!Z(r))return e;try{var s=r(e);return rt(s)&&s?s:e}catch(t){return Oi.error("Error in get_current_url, falling back to window.location.href",t),e}}var Us="__POSTHOG_TOOLBAR__",js=1,Bs=3,zs=11;function qs(t){return t instanceof Element&&(t.id===Us||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Hs(t){return!!t&&t.nodeType===js}function Vs(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Ws(t){return!!t&&t.nodeType===Bs}function Gs(t){return!!t&&t.nodeType===zs&&Hs(t.host)}var Ks=1e3;function Js(t){return t?W(t).split(/\s+/):[]}function Ys(e,i){var r=function(e){var i,r=null==t||null==(i=t.location)?void 0:i.href;return it(r)?void 0:Ls(e,r)}(i);return!!(r&&e&&e.some((t=>r.match(t))))}function Qs(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 Js(e)}function Xs(t){return ot(t)?null:W(t).split(/(\s+)/).filter((t=>xn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Zs(t){var e="";return fn(t)&&!pn(t)&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var i;Ws(t)&&t.textContent&&(e+=null!==(i=Xs(t.textContent))&&void 0!==i?i:"")})),W(e)}function tn(t){var e;return it(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var en=["a","button","form","input","select","textarea","label"];function rn(t,e){if(it(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 sn(t){var e=t.parentNode;return!(!e||!Hs(e))&&e}var nn=[".ph-no-autocapture","[data-ph-no-autocapture]"],on=["next","previous","prev",">","<"],an=[...on,"+","-","−","–"],ln=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,un=[".ph-no-rageclick",".ph-no-capture"],hn=["","text","search","email","password","url","tel","number"];function dn(e,i){if(!t||vn(e))return!1;var r,s,n,o,a;if(ut(i)?(r=!!i&&un,s=void 0,n=!1):(r=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:un,s=null==i?void 0:i.content_ignorelist,n=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===r)return!1;if(n&&function(t){return!(!t||!Hs(t))&&(!!Vs(t,"textarea")||(Vs(t,"input")?V(hn,(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)))}(e))return!1;var l=cn(e,!1).targetElementList;return!function(t,e){if(!1===t||it(t))return!1;var i;if(!0===t)i=on;else{if(!X(t))return!1;if(t.length>10)return Oi.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=>ln(e,t)||ln(r,t)))}))}(s,l.map((t=>{var e;return{safeText:Zs(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!rn(l,r)}var vn=t=>!t||Vs(t,"html")||!Hs(t),cn=(e,i)=>{if(!t||vn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[e],n=e;n.parentNode&&!Vs(n,"body");)if(Gs(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=sn(n);if(!o)break;if(i||en.indexOf(o.tagName.toLowerCase())>-1)r=!0;else try{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}catch(t){}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function fn(t){for(var e=new Set,i=0,r=t;r.parentNode&&!Vs(r,"body");r=r.parentNode){if(i++>=Ks||e.has(r))return!1;e.add(r);var s=Qs(r);if(V(s,"ph-sensitive")||V(s,"ph-no-capture"))return!1}if(V(Qs(t),"ph-include"))return!0;var n=t.type||"";if(rt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!rt(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 pn(t){return!!(Vs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Vs(t,"select")||Vs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var _n=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}))$"),gn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,mn=[16,15,14,13],yn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),bn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),wn=/[0-9A-Za-z_]/;function Sn(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 xn(t,e){if(void 0===e&&(e=!0),ot(t))return!1;if(rt(t)){t=W(t);var i=e?_n.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(gn.lastIndex=0;e=gn.exec(t);){var i=e[2];if(i)for(var r=i.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of mn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(_n.test(a)&&Sn(a))return!0}}}return!1}(t);if(i)return!1;var r=e?yn.test(t):function(t){var e;for(bn.lastIndex=0;e=bn.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&wn.test(i)&&wn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function En(t){var e=Zs(t);return xn(e=(e+" "+kn(t)).trim())?e:""}function kn(t){var e="";return t&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Zs(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+kn(t)).trim())}catch(t){Oi.error("[AutoCapture]",t)}})),e}function Tn(t){return t.replace(/"|\\"/g,'\\"')}function $n(t){var e=t.attr__class;if(e)return X(e)?e:Js(e)}var Pn=Ii("[Dead Clicks]"),Rn=()=>!0,Cn=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Yi)),r=t.instance.config.capture_dead_clicks;return ut(r)?r:!!tt(r)||i};class On{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({[Yi]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s((()=>{this.ws()})):this.stop()}_s(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Pn.error("failed to load script",e):t()}))}ws(){var t;if(r){if(!this.bs&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=tt(this.instance.config.capture_dead_clicks)?_({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.bs=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.bs.start(r),Pn.info("starting...")}}else Pn.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Pn.info("stopping..."))}}var In=Ii("[SegmentIntegration]");var An="posthog-js";function Fn(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,l=i.sendExceptionsToPostHog,u=void 0===l||l;return e=>{var i,o,l,h,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(i=e.exception)?void 0:i.values)||[],p=f.map((t=>_({},t,{stacktrace:t.stacktrace?_({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>_({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=f[0])?void 0:o.value)||e.message,$exception_type:null==(l=f[0])?void 0:l.type,$exception_level:e.level,$exception_list:p,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Mn{constructor(t,e,i,r,s,n){this.name=An,this.setupOnce=function(o){o(Fn(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Dn{constructor(t){this.ks=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Oi.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(e,i){var r,s=this.Ts(e,i);return this.Ss={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}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(!(it(n)||it(o)||it(a)||it(l)||it(u)||it(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?wt(o/n,0,1,Oi):1,v=n>1?wt(a/n,0,1,Oi):1,c=l>1?wt(u/l,0,1,Oi):1,f=l>1?wt(h/l,0,1,Oi):1;r=es(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 Nn=["flags","surveys"],Ln={[Li]:{exposure:"hidden"},[zi]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[qi]:{exposure:"hidden"},[Hi]:{exposure:"event"},[Vi]:{exposure:"hidden"},[Wi]:{exposure:"event"},[Gi]:{exposure:"hidden"},[Ki]:{exposure:"event"},[Ji]:{exposure:"event"},[Yi]:{exposure:"event"},[Qi]:{exposure:"hidden"},[Xi]:{exposure:"event"},[Zi]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[nr]:{exposure:"hidden"},[or]:{exposure:"event"},[tr]:{exposure:"event",shouldSkipFromEventProperties:t=>nt(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"},[ar]:{exposure:"hidden",storageGroup:"flags"},[lr]:{exposure:"hidden",storageGroup:"flags"},[ur]:{exposure:"hidden"},[hr]:{exposure:"hidden",storageGroup:"flags"},[dr]:{exposure:"hidden",storageGroup:"flags"},[vr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[cr]:{exposure:"hidden",storageGroup:"flags"},[fr]:{exposure:"hidden"},[pr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[yr]:{exposure:"hidden",storageGroup:"surveys"},[br]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[wr]:{exposure:"event"},[Sr]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Er]:{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"},[kr]:{exposure:"hidden"},[Tr]:{exposure:"hidden"},[mr]:{exposure:"event"},[$r]:{exposure:"hidden"},[Pr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Rr]:{exposure:"hidden"},[Cr]:{exposure:"hidden"},[Or]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Mr]:{exposure:"hidden"},[er]:{exposure:"event"},[ir]:{exposure:"event"},[rr]:{exposure:"event"},[sr]:{exposure:"event"},[Lr]:{exposure:"event"},[Ur]:{exposure:"event"},[jr]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Un=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],jn=t=>{var e=Ln[t];if(e)return e;for(var i of Un){var r=i[1];if(0===t.indexOf(i[0]))return r}},Bn=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return K(t)}},zn=t=>{var e=null==r?void 0:r.createElement("a");return it(e)?null:(e.href=t,e)},qn=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(!X(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Oi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Hn=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("=");X(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},Vn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Wn=(t,e)=>t>=e&&h(),Gn=(t,e,i,r)=>{if(0===t){if(h()){var s=e+1;return s===i&&r(),s}return e}return 0},Kn="https?://(.*)",Jn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Yn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Jn],Qn="<masked>",Xn=["li_fat_id"];function Zn(t,e,i){if(!r)return{};var s,n=e?[...Jn,...i||[]]:[],o=to(Hn(r.URL,n,Qn),t),a=(s={},ts(Xn,(function(t){var e=hs(t);s[t]=e||null})),s);return es(a,o)}function to(t,e){var i=Yn.concat(e||[]),r={};return ts(i,(function(e){var i=qn(t,e);r[e]=i||null})),r}function eo(t){var e=function(t){return t?0===t.search(Kn+"google.([^/?]*)")?"google":0===t.search(Kn+"bing.com")?"bing":0===t.search(Kn+"yahoo.com")?"yahoo":0===t.search(Kn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!nt(e)){s.$search_engine=e;var n=r?qn(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function io(){return navigator.language||navigator.userLanguage}var ro="$direct";function so(){return(null==r?void 0:r.referrer)||ro}function no(t,e,i){void 0===i&&(i=!1);var r=t?[...Jn,...e||[]]:[],n=i?Re(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:so().substring(0,1e3),u:o?Hn(o,r,Qn):void 0}}function oo(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Re(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==ro?ro:null==(i=zn(r))?void 0:i.host};if(n){o.$current_url=n;var a=zn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=to(n);es(o,l)}if(r){var u=eo(r);es(o,u)}return o}function ao(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function lo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var uo={flags:Pr,surveys:br},ho=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],vo=t=>t+"_cookie_identity_change_pending",co="main",fo=(t,e)=>{ts(t,((i,r)=>{var s=jn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class po{constructor(e,i,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=e,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"})(e),this.ps=this.Os(e),this.Is=this.Ds(e),this.load(),e.debug&&Oi.info("Persistence loaded",e.persistence,_({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();ls(t,"beforeunload",s,{capture:!1}),ls(t,"pagehide",s,{capture:!1})}}$s(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return at(e)&&e>0?e:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var e=Ps(t,this.qi.cookie_persisted_properties||[]),i=Cs(e,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=bs.Pr(this.Ls)||void 0;s&&Is(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=bs.Pr(this.Ls)||void 0;this.qs=n?Is(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=bs.Pr(this.Ls)||void 0}catch(t){}if(!i||i===this.js)return!1;var r,s=Is(this.Ls,i);try{r=$s(JSON.parse(i))}catch(t){return!1}if((bs.Pr(this.Ls)||void 0)!==i)return!1;this.qs=s,this.js=i;var n=Os(this.Ls,i),o=[...Es,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(it(e)||nt(e)||""===e||t===Rr&&e!==Hr&&e!==Vr)&&(a[t]=!0,delete r[t])})),et(r))return!1;var l=Ui in r||r[Rr]===Hr||r[Rr]===Vr,u=this.props[Ui],h=this.props[Rr],d=es({},this.props);[...Es,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||t!==Ui&&t!==Rr)){var e=d[t];!n.isValid&&-1!==Es.indexOf(t)&&(!1===e||0===e)||delete d[t]}})),this.props=es(d,r),!l||Rr in r||Rr in this.props||this.Us(Rr,Hr);var v=this.props[Ui],c=this.props[Rr];return!l||v===u&&c===h||(this.Rs=!0,Ds.Dr(vo(this.Ls),!0),this.zs(_r),this.zs(lr),this.zs(ar),this.zs(hr),this.zs(dr),this.zs(vr),this.zs(Pr),this.zs($r),this.zs(kr),c===Hr&&(h===Vr||r[Rr]===Hr||!it(u)&&v!==u)&&(fo(this.props,r),this.zs(gr)),c===Vr?this.props.$user_id=v:delete this.props.$user_id,this.zs(zi)),!0}consumeCookieIdentityChange(){var t=vo(this.Ls),e=this.Rs||!!Ds.Pr(t);return this.Rs=!1,e&&Ds.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&&(it(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[co],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():it(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(e){-1===ho.indexOf(e.persistence.toLowerCase())&&(Oi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Es,...e];return _({},Ss,{Br(t){try{var e,s={};try{e=bs.Pr(t)||void 0,s=e?$s(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Ss.Pr(t)||"{}");if(i){var a=Os(t,e),l=[...Es,...a.properties],u={};Object.keys(s).forEach((t=>{var e=s[t];nt(e)||""===e||t===Rr&&e!==Hr&&e!==Vr||(u[t]=e)}));var h=Ui in u||u[Rr]===Hr||u[Rr]===Vr;if(Object.keys(u).length>0){var d,v=o[Ui],c=null!==(d=o[Rr])&&void 0!==d?d:Hr;r.forEach((t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(h||t!==Ui&&t!==Rr)){var e=o[t];!a.isValid&&-1!==Es.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!h||Rr in s||Rr in o||(o[Rr]=Hr),!h||(Ui in u?u[Ui]:o[Ui])===v&&(Rr in u?u[Rr]:o[Rr])===c||(xs.forEach((t=>delete o[t])),u[Rr]===Vr&&Ui in u?o.$user_id=u[Ui]:delete o.$user_id,u[Rr]!==Vr&&(delete o[mr],delete o[gr]),delete o.__alias)}n=es(o,u)}else n=es(s,o);return Ss.Dr(t,n),n}catch(t){}return null},Dr(t,r,s,n,o,a){var l=Ss.Dr(t,r,void 0,void 0,a);try{var u=Ps(r,e);if(Object.keys(u).length){if(i){var h=ks(t),d=Cs(u,e);if(bs.Dr(h,d,s,n,o,a),bs.Pr(h)!==JSON.stringify(d)){bs.qr(h,n);var v=Ps(r);return bs.Dr(t,v,s,n,o,a),l}}bs.Dr(t,u,s,n,o,a)}}catch(t){Ss.jr(t)}return l},qr(e,i){try{null==t||t.localStorage.removeItem(e),bs.qr(e,i),bs.qr(ks(e),i)}catch(t){Ss.jr(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Ss.Nr()?(i=Ss,s=!0):"localstorage+cookie"===n&&r.Nr()?(i=r,s=!0):"sessionstorage"===n&&Ds.Nr()?i=Ds:"memory"===n?i=Fs:"cookie"===n?i=bs:r.Nr()?(i=r,s=!0):i=bs,this.Es=s,i}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return ts(this.props,((e,i)=>{var r=jn(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?Ss.Br(this.Ls):null,r={};if(e)try{ts(r=$s(bs.Br(this.Ls)),((t,e)=>{(it(t)||nt(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=es({},s)),this.Is&&this.Ks(),e&&s){var n,o,a=null==i?void 0:i[Ui],l=null!==(n=null==i?void 0:i[Rr])&&void 0!==n?n:Hr,u=s[Ui],h=null!==(o=s[Rr])&&void 0!==o?o:Hr;if(u!==a||h!==l){this.Rs=!0,Ds.Dr(vo(this.Ls),!0);var d=es({},this.props);xs.forEach((t=>delete d[t])),h===Hr&&(l===Vr||r[Rr]===Hr||!it(a)&&u!==a)&&(fo(d,r),delete d[gr]),this.props=d;var v=new Set;xs.forEach((t=>{var e,i=null==(e=jn(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};ts(this.props,((i,r)=>{var s;(null==(s=jn(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),et(e)?(Ss.qr(this.Js(t)),this.Ms[t]={}):Ss.Dr(this.Js(t),e)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(e,t)})}))}}Ds.Pr(vo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of Nn){var e=Ss.Br(this.Js(t));if(e&&!et(e)){var i=this.Xs(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Ys(e,t)),this.ea(t,e)||es(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=jn(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=uo[t];if(!i)return!1;var r=e[i],s=this.props[i];return at(r)&&at(s)&&s>r}refreshKey(t){var e;if(!this.Hs){var i=this.Is?null==(e=jn(t))?void 0:e.storageGroup:void 0,r=i?Ss.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?it(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){it(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,co)&&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,co)&&this.Ns(e),Nn)){var s,n=i[r];(!et(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(Ss,this.Js(r),n,r)}}na(){var t={},e={flags:{},surveys:{}};return ts(this.props,((i,r)=>{var s,n=null==(s=jn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ys(t,e){if(e===co)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var i={};return ts(t,((t,e)=>{var r;i[e]=null!=(r=jn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Xs(r);if(r!==co&&!n.dirty&&!it(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!==co&&(n.persisted=!0),it(s)||(n.fingerprint=s),!0):(this.qi.debug&&Oi.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(it(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 Nn)Ss.qr(this.Js(r));i?delete this.Ms[co]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(tt(t)){this.syncCookieProperties(),it(e)&&(e="None"),this.sa=it(i)?this.la:i;var r=!1;if(ts(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(tt(t)){this.syncCookieProperties(),this.sa=it(e)?this.la:e;var i=!1;if(ts(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||tt(e)||X(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==r?void 0:r.URL;if(t!==this.Fs){var e=Zn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);et(ns(e))||this.register(e),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?eo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:so(),$referring_domain:null!=r&&r.referrer&&(null==(t=zn(r.referrer))?void 0:t.host)||ro},void 0)}set_initial_person_info(){this.props[Ir]||this.props[Ar]||this.register_once({[Fr]:no(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={};ts([Ar,Ir],(e=>{var i=this.props[e];i&&ts(i,(function(e,i){t["$initial_"+G(i)]=e}))}));var e=this.props[Fr];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=oo(t,e),r={};return ts(i,(function(t,e){r["$initial_"+G(e)]=t})),r}(e,this.qi.disable_capture_url_hashes);es(t,i)}return t}safe_merge(t){return ts(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((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||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.Hs&&!a;a||this.Bs(e,l),this.qi=t,!a&&(r||s||o)&&(this.qs=void 0,this.js=void 0,this.Bs(_({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var u=n||o?this.Os(t):this.ps,h=this.Ds(t),d=n||h!==this.Is,v=!a&&(d||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(l);try{if(this.la=this.sa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.ps=u,this.Is=h,this.props=c,this.save()}else o&&(this.ps=u,a||(delete this.Ms[co],this.Zs()))}finally{v&&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[qi]||{};i[t]=e,this.Us(qi,i),this.save()}remove_event_timer(t){var e=this.props[qi]||{},i=e[t];return it(i)||(delete e[t],this.Us(qi,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=jn(t))&&i.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var e,i=null==(e=jn(t))?void 0:e.storageGroup;i&&(this.Xs(i).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function _o(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&Z(i.then)&&i.then(void 0,(()=>{}))}}}}var go={GZipJS:"gzip-js",Base64:"base64"},mo={Activation:"events",Cancellation:"cancelEvents"},yo={Button:"button",Tab:"tab",Selector:"selector"},bo={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"},wo={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},So={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},xo={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Eo={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},ko={Once:"once",Recurring:"recurring",Always:"always"},To={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"},Po={Popover:"popover",Inline:"inline"},Ro={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},Co={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"},Oo={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"},Io=Ii("[RateLimiter]");class Ao{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=>{Io.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Io.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text: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(Or))&&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=(at(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(Or,a),{isRateLimited:l,remainingTokens:a.tokens}}da(t){var e=this.instance.config.property_denylist;return!X(e)||!e.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.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 Fo=Ii("[RemoteConfig]");class Mo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=v.__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 Fo.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void Fo.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return Fo.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){Fo.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&r&&"hidden"!==r.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||Fo.warn("Failed to fetch remote config from PostHog."):Fo.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){Fo.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){Fo.error("Error loading feature flags",t)}}}var Do=["fatal","error","warning","log","info","debug"],No=Uint8Array,Lo=Uint16Array,Uo=Uint32Array,jo=new No([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Bo=new No([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),zo=new No([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qo=function(t,e){for(var i=new Lo(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Uo(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]},Ho=qo(jo,2),Vo=Ho[1];Ho[0][28]=258,Vo[258]=28;for(var Wo=qo(Bo,0)[1],Go=new Lo(32768),Ko=0;32768>Ko;++Ko){var Jo=(43690&Ko)>>>1|(21845&Ko)<<1;Go[Ko]=((65280&(Jo=(61680&(Jo=(52428&Jo)>>>2|(13107&Jo)<<2))>>>4|(3855&Jo)<<4))>>>8|(255&Jo)<<8)>>>1}var Yo=function(t,e,i){for(var r=t.length,s=0,n=new Lo(e);r>s;++s)++n[t[s]-1];var o,a=new Lo(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Lo(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[Go[d]>>>l]=u}else for(o=new Lo(r),s=0;r>s;++s)o[s]=Go[a[t[s]-1]++]>>>15-t[s];return o},Qo=new No(288);for(Ko=0;144>Ko;++Ko)Qo[Ko]=8;for(Ko=144;256>Ko;++Ko)Qo[Ko]=9;for(Ko=256;280>Ko;++Ko)Qo[Ko]=7;for(Ko=280;288>Ko;++Ko)Qo[Ko]=8;var Xo=new No(32);for(Ko=0;32>Ko;++Ko)Xo[Ko]=5;var Zo=Yo(Qo,9,0),ta=Yo(Xo,5,0),ea=function(t){return(t/8>>0)+(7&t&&1)},ia=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Lo?Lo:t instanceof Uo?Uo:No)(i-e);return r.set(t.subarray(e,i)),r},ra=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},sa=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},na=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 No(0),0];if(1==s){var o=new No(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 Lo(v+1),f=oa(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 No(c),f]},oa=function(t,e,i){return-1==t.s?Math.max(oa(t.l,e,i+1),oa(t.r,e,i+1)):e[t.s]=i},aa=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Lo(++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]},la=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},ua=function(t,e,i){var r=i.length,s=ea(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)},ha=function(t,e,i,r,s,n,o,a,l,u,h){ra(e,h++,i),++s[256];for(var d=na(s,15),v=d[0],c=d[1],f=na(n,15),p=f[0],_=f[1],g=aa(v),m=g[0],y=g[1],b=aa(p),w=b[0],S=b[1],x=new Lo(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=na(x,7),T=k[0],P=k[1],R=19;R>4&&!T[zo[R-1]];--R);var C,O,I,A,F=u+5<<3,M=la(s,Qo)+la(n,Xo)+o,D=la(s,v)+la(n,p)+o+14+3*R+la(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&D>=F)return ua(e,h,t.subarray(l,l+u));if(ra(e,h,1+(M>D)),h+=2,M>D){C=Yo(v,c,0),O=v,I=Yo(p,_,0),A=p;var N=Yo(T,P,0);for(ra(e,h,y-257),ra(e,h+5,S-1),ra(e,h+10,R-4),h+=14,E=0;R>E;++E)ra(e,h+3*E,T[zo[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)ra(e,h,N[B=31&j[E]]),h+=T[B],B>15&&(ra(e,h,j[E]>>>5&127),h+=j[E]>>>12)}}else C=Zo,O=Qo,I=ta,A=Xo;for(E=0;a>E;++E)if(r[E]>255){var B;sa(e,h,C[257+(B=r[E]>>>18&31)]),h+=O[B+257],B>7&&(ra(e,h,r[E]>>>23&31),h+=jo[B]);var z=31&r[E];sa(e,h,I[z]),h+=A[z],z>3&&(sa(e,h,r[E]>>>5&8191),h+=Bo[z])}else sa(e,h,C[r[E]]),h+=O[r[E]];return sa(e,h,C[256]),h+O[256]},da=new Uo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),va=function(){for(var t=new Uo(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ca=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function fa(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=va[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 No(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=ua(l,u,t.subarray(h,d)):(l[h]=!0,u=ua(l,u,t.subarray(h,o)))}else{for(var v=da[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new Lo(32768),g=new Lo(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 Uo(25e3),S=new Lo(288),x=new Lo(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=ha(t,l,0,w,S,x,k,T,R,h-R,u),T=E=k=0,R=h;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[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|Vo[M]<<18|Wo[D];var G=31&Vo[M],K=31&Wo[D];k+=jo[G]+Bo[K],++S[257+G],++x[K],P=h+M,++E}else w[T++]=t[h],++S[t[h]]}}u=ha(t,l,!0,w,S,x,k,T,R,h-R,u)}return ia(a,0,r+ea(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&&ca(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),ca(u,h-8,i.d()),ca(u,h-4,r),u}var pa=!!o||!!n,_a="text/plain",ga=!1,ma=(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:"")},ya=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=_({},e),l=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return ts(t,(function(t,e){it(t)||it(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)}(a);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},ba=t=>{if(t.ba)return t.ba;var e=t.data,i=t.compression;if(e){if(i===go.GZipJS){var r=fa(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new No(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new No(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 ia(r,0,s)}(Bn(e)),{mtime:0});return{contentType:_a,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===go.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Bn(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Bn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Bn(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},wa=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:ya(t.url,{compression:go.Base64}),encodedBody:ba(_({},t,{compression:go.Base64,ba:void 0}))}:{url:ma(t.url,"compression"),encodedBody:ba(_({},t,{compression:void 0,ba:void 0}))};try{e=ba(t)}catch(e){if(C(t.compression,qn(t.url,"compression")))return Oi.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&C(t.compression,qn(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?R(new Uint8Array(i)):ArrayBuffer.isView(i)&&R(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(ga=!0,r()):{url:t.url,encodedBody:e}},Sa=t=>{try{return wa(t)}catch(e){return Oi.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},xa=function(){var t=p((function*(t){var e=Bn(t.data),i=yield function(t,e,i){return F.apply(this,arguments)}(e,c.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return _({},t,{ba:{contentType:_a,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Ea=/Failed to fetch|NetworkError|Load failed/i,ka=t=>"TypeError"===(null==t?void 0:t.name)&&Ea.test((null==t?void 0:t.message)||""),Ta=t=>{var e=Sa(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,u=s.estimatedSize,h=new Headers;ts(t.headers,(function(t,e){h.append(e,t)})),o&&h.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e,i;v=!0,c.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var f=e=>{v&&"AbortError"===(null==e?void 0:e.name)||ka(e)?Oi.warn(e):Oi.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var p;n(i,_({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t._a&&52428.8>(u||0),body:l,signal:null==(p=d)?void 0:p.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){Oi.error(t)}null==t.callback||t.callback(r)})))).catch(f).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),f(t)}}},$a=t=>{try{var e,r=wa(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(i.sendBeacon(s,u))return;var h=X(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(X(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>X(t.data)?e:_({},t.data,{batch:e});return $a(_({},t,{data:v(h.slice(0,d))})),void $a(_({},t,{data:v(h.slice(d))}))}Oi.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ta(_({},t,{_a:!0}))}catch(t){Oi.warn("Beacon send failed",t)}},Pa=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return ya(i===go.GZipJS?ma(t,"compression"):t,_({},s?{[s]:Date.now().toString()}:{},i===go.GZipJS?{}:{compression:i}))},Ra=[];n&&Ra.push({transport:"fetch",method:Ta}),o&&Ra.push({transport:"XHR",method(t){var e=Sa(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;ts(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(a)}}}),null!=i&&i.sendBeacon&&Ra.push({transport:"sendBeacon",method:$a});var Ca=3e3;class Oa{constructor(t,e){this.wa=!0,this.ka=[],this.Sa=wt((null==e?void 0:e.flush_interval_ms)||Ca,250,5e3,Oi.createLogger("flush interval"),Ca),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(_({},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&&X(i.data)&&ts(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){Oi.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return ts(this.ka,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;it(t[s])&&(t[s]=_({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.ka=[],t}}var Ia=["retriesPerformedSoFar"];class Aa{constructor(e){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=e,this.ka=[],this.Aa=!0,!it(t)&&"onLine"in t.navigator&&(this.Aa=t.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},ls(t,"online",this.Fa),ls(t,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=g(t,Ia);lt(e)&&(i.url=ya(i.url,{retry_count:e})),this._instance._send_request(_({},i,{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(_({retriesPerformedSoFar:e},i));0===t.statusCode&&Oi.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==i.callback||i.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)"),Oi.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 e of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,it(t)||(this.Fa&&(t.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(t.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var i=e.requestOptions;try{this._instance._send_request(_({},i,{transport:"sendBeacon"}))}catch(t){Oi.error(t)}}this.ka=[]}}class Fa{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(){ls(t,"scroll",this.Na,{capture:!0}),ls(t,"scrollend",this.Na,{capture:!0}),ls(t,"resize",this.Na)}scrollElement(){if(!this.ja)return null==t?void 0:t.document.documentElement;var e=X(this.ja)?this.ja:[this.ja];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Ba(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var Ma=t=>no(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 Da{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({[Cr]:i})}},this._instance=t,this.Wa=e,this.za=i,this.Ua=r||Ma,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[Cr]}getSetOnceProps(){var t,e=null==(t=this.Ha())?void 0:t.props;return e?"r"in e?oo(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 ts(ns(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+G(i)]=e})),t}}class Na{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 La=Ii("[SessionId]"),Ua=864e5;class ja{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 Na,this.Xa=(t,e)=>!(!lt(t)||!lt(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===qr)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||_s,this.ro=i||_s;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*wt(this.qi.session_idle_timeout_seconds||1800,60,36e3,La.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=Ds.Br(this.so),o=Ds.Br(this.ao);n&&!o?this.st=n:Ds.qr(this.so),Ds.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 it(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&&Ds.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Ds.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Ds.Br(this.so):null}do(t){var e=this.Za;return!nt(e)&&!nt(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({[nr]:[e,t,i]}))}co(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return lt(e)&&e>0}fo(){this.co()?this.za.refreshKey(nr):(this.za.flush(),this.za.load())}po(){var t;if(!nt(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({[nr]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],e=lt(t)?t:0,i=lt(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[nr];return X(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 La.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void La.error("Invalid sessionID in bootstrap",t)}}(t);return!it(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&&t&&(t.removeEventListener(Kr,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Ds.qr(this.ao)},ls(t,Kr,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===qr)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(nt(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=!it(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ua),p=c?f:lt(u)&&Math.abs(r-u)>Ua,_=!1,g=h,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||La.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 S=c&&!f;l=S?c.sessionId:this.io(),v=this.ro(),La.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),u=S?c.sessionStartTimestamp:r,this.eo=void 0,_=!0}else v||(v=this.ro(),_=!0),(g=g||l!==y)&&(La.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var x=lt(d)&&t&&!p?d:r,E=lt(u)?u:(new Date).getTime();this.uo(v),this.vo(l,x,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 Ba=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&H(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>H(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function za(){return(za=p((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return rt(r)&&r.length>0?r:void 0}catch(t){return void Oi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function qa(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var Ha=(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}},Va=t=>t.toLowerCase(),Wa={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=>Ha(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ha(e,t))))),icontains:(t,e)=>e.map(Va).some((e=>t.map(Va).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Va).every((e=>t.map(Va).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 Ga(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=Wa[i.operator];return!!s&&s(i.values,[String(r)])}))}function Ka(t,e,i){return Bn({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Ja="custom",Ya="i.posthog.com",Qa=/^\/static\//,Xa=["/s/","/e/","/i/"];class Za{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("."+Ya,".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":Ja),this.wo[this.apiHost]}ko(t){if(Qa.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}So(t){var e=zn(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=zn(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&Xa.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===Ja)return this.xo(t,e,this.apiHost+e);var r=Ya+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 tl=Ii("[Surveys]"),el="seenSurvey_",il=t=>{try{var e=(t=>((t,e)=>""+el+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){tl.error("Failed to persist survey seen state",t)}},rl=[So.Popover,So.Widget,So.API],sl={ignoreConditions:!1,ignoreDelay:!1,displayType:Po.Popover},nl=Ii("[PostHog ExternalIntegrations]"),ol={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class al{constructor(t){this._instance=t}_s(t,e){var i;null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return nl.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=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t._s(ol[n],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=v.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=v.__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 ll{constructor(t,e){this.I=t,this.ns=e,this.To=new Map,this.Xn=!1}add(t){var e=this;return p((function*(){if(e.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.To.set(t.name,t);try{var i=t.setup(e.ns);i&&(yield i)}catch(i){var r=e.To.get(t.name)===t;r&&e.To.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var e of(this.To.clear(),t))this.Mo(e)}}Mo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&Z(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 ul{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);it(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 hl="extensionsRemoteConfig";class dl{constructor(t){this.Xn=!1,this.instance=t,this.I=Oi,this.Eo=t.Io,this.kv=new ul(t),this.onEvent=t=>_o(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 _o((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Ro.on(hl,e);return this.Eo&&e(this.Eo),_o(i)},this.Po=new ll(Oi.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(ji))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(ji);return"string"==typeof t?t:void 0}get library(){return{name:c.LIB_NAME,version:c.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,e,i){var r=this;return p((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return _o(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(hl,t))}sendRequest(t,e){var i=this;return p((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?ya(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var vl={},cl=0,fl=()=>{},pl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',_l="Surveys module not available",gl="sanitize_properties is deprecated. Use before_send instead",ml="Invalid value for property_denylist config: ",yl=["token","distinct_id",Nr],bl="posthog",wl=!pa&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),Sl=e=>{var i;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:as(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:fl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&rt(null==s?void 0:s.search)&&-1!==s.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==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Oi.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:Wr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Ca},error_tracking:{},_onCapture:fl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:an,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)}))(e))},xl=[["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"]],El=t=>{var e={};for(var i of xl){var r=i[0],s=i[1];it(t[r])||(e[s]=t[r])}var n=es({},e,t),o=t.__preview_external_dependency_versioned_paths;return it(o)||(it(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),rt(o)&&it(t.asset_host)&&(n.asset_host=o)),X(t.property_blacklist)&&(it(t.property_denylist)?n.property_denylist=t.property_blacklist:X(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Oi.error(ml+t.property_denylist)),n};class kl{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){Oi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Tl{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===qr||this.config.cookieless_mode===zr&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===Dr){var t=this.persistence;if(t){this.$o()||t.load(!0);var e=this.get_distinct_id();if(!e||e===Dr){var i=this.config.get_device_id(_s());this.register({distinct_id:i,$device_id:i}),t.set_property(Rr,Hr)}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 kl,this.qo=!1,this.version=c.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new Na,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Sl(),this.SentryIntegration=Mn,this.sentryIntegration=t=>function(t,e){var i=Fn(t,e);return{name:An,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 Fa(this),this.pageViewManager=new Dn(this),this.rateLimiter=new Ao(this),this.requestRouter=new Za(this),this.consent=new Ns(this),this.externalIntegrations=new al(this);var e=null!==(t=Tl.__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=rt(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=rt(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Oi.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==bl){var r,s=null!==(r=vl[i])&&void 0!==r?r:new Tl;return s._init(t,e,i),vl[i]=s,vl[bl][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=rt(e)?e.trim():"";if(!a)return Oi.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 a!==(null==(o=this.config)?void 0:o.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('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Sl(i.defaults),i.debug=this.Go(i.debug),this.Zo=i,this.Qo=[],i.person_profiles?this.Wo=i.person_profiles:i.process_person&&(this.Wo=i.process_person);var l=Sl(i.defaults),u=El(i),h=es({},l,u,{name:r,token:a});tt(l.rageclick)&&tt(u.rageclick)&&(h.rageclick=es({},l.rageclick,u.rageclick)),tt(l.session_recording)&&tt(u.session_recording)&&(h.session_recording=es({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&Oi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:go.GZipJS;var d=this.$o();if(this.persistence=new po(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(_({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Ds.Nr()){var v=Ds.Br(this.Bo);X(v)&&v.forEach((t=>{rt(t)&&this.jo.add(t)}))}else Ds.qr(this.Bo);var f=_({},this.persistence.props),p=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new Oa((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new Aa(this),this.__request_queue=[];var g=this.Oo();if(g||(this.sessionManager=new ja(this),this.sessionPropsManager=new Da(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?(Oi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(g)}),0)):(Oi.info("Initializing extensions synchronously"),this.el(g)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Oi.info("Starting in debug mode",{this:this,config:i,thisC:_({},this.config),p:f,s:p}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=_({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var m=i.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Rr);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Hr)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Vr)Oi.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(_s()),S=i.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Rr,i.bootstrap.isIdentifiedID?Vr:Hr),this.register({distinct_id:m,$device_id:S})}}if(g)this.register_once({distinct_id:Dr,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(_s());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(Rr,Hr)}return ls(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.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()||_s();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Rr,Vr)),e()},s=i.user();"then"in s&&Z(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||In.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()||(In.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(In.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,Jr),identify:t=>e(t,Qr),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.il())):this.il(),Z(this.config._onCapture)&&this.config._onCapture!==fl&&(Oi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Oi.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return za.apply(this,arguments)}().then((t=>{t&&this.register({[Bi]:t})})).catch(fl),this}rl(t){var e=t;return rt(e.name)&&Z(e.setup)}nl(t,e){this.rl(t)?e.push((()=>{this.sl().add(t).catch(fl)})):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=Tl.__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)),Z(this.featureFlags.onReloading)&&Z(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,i,r,s,n,o,a,l=performance.now(),u=_({},Tl.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.exceptions&&this.To.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.To.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.To.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.To.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.To.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.nl(this.autocapture=new u.autocapture(this),h),u.surveys&&this.nl(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new u.surveys(this),h),u.logs&&this.To.push(this.logs=null!==(r=this.logs)&&void 0!==r?r:new u.logs(this)),u.metrics&&this.To.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new u.metrics(this)),u.conversations&&this.To.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.To.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.To.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.To.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Cn)),u.toolbar&&this.To.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.To.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.To.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.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(h,l)}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){Oi.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Lr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ur]:r}),this.config.__preview_deferred_init_extensions&&Oi.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var e;if(!r||!r.body)return Oi.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,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=V(s.supportedCompression,go.GZipJS)?go.GZipJS:V(s.supportedCompression,go.Base64)?go.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:Wr}),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){Oi.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.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 Mo(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()&&Zr(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(Yr),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(Yr,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?wl?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=_({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(it(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,i,r,s=_({},t);s.timeout=s.timeout||6e4;var n,o,a,u,h,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&it(s.compression)&&s.data&&(s.compression=go.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(h=(u=(X(n=s.data)?n:[n]).map((t=>_({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=h.properties)?void 0:a.token)&&void 0!==o?o:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),X(t)?t.map((t=>_({},t,{sent_at:e}))):_({},t,{sent_at:e})}(s.data))),s.url=Pa(s.url,s.method,s.compression,s.timestampMode);var v=Ra.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){ka(t)?Oi.warn(t):Oi.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===go.GZipJS&&l&&"undefined"!=typeof Promise&&!ga?xa(s).then((t=>{f(t)})).catch((e=>{if(O(e))return ga=!0,void f(_({},s,{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 O(t)||e===P})(e)&&(ga=!0),f(s)})):c(s)})(_({},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){cl++;try{var e,i=[],r=[],s=[];Zr(t,(t=>{if(t)if(X(e=t[0]))s.push(t);else if(Z(t))try{t.call(this)}catch(e){Oi.error("Error executing queued PostHog call",t,e)}else X(t)&&"alias"===e?i.push(t):X(t)&&-1!==e.indexOf("capture")&&Z(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Zr(t,(function(t){try{if(X(t[0])){var i=e;ts(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Oi.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{cl--}}push(t){if(cl>0&&X(t)&&rt(t[0])){var e=Tl.prototype[t[0]];Z(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!it(t)&&rt(t)){this.Do();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!rt(null==e?void 0:e.$current_url)&&(Oi.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!=i&&i.fl||Oi.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 h=new Date,d=(null==i?void 0:i.timestamp)||h,v=Pe(null==i?void 0:i.uuid,_s),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===Jr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var f="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(cr);(null==i?void 0:i.$set)&&!f&&(c.$set=null==i?void 0:i.$set);var p=null==i?void 0:i.$unset;p&&(c.$unset=p);var g,m,y,b=f?void 0:this.pl(null==i?void 0:i.$set_once,t!==Xr,t===Qr);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>rt(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),X(e))r=[],Zr(e,(e=>{r.push(t(e))}));else{var s={};ts(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,it(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),f&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return S.forEach(r),e.forEach(r),i}(c.properties,yl)),t===To.DISMISSED||t===To.SENT){var w=null==e?void 0:e[$o.SURVEY_ID],x=null==e?void 0:e[$o.SURVEY_ITERATION];il({id:w,current_iteration:x}),c.$set=_({},c.$set,{[(g={id:w,current_iteration:x},m=t===To.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===To.SHOWN&&(c.$set=_({},c.$set,{[$o.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Co.SHOWN){var E=null==e?void 0:e[Oo.TOUR_TYPE];E&&(c.$set=_({},c.$set,{[Oo.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var k=_({},c.properties.$set,c.$set);if(et(k)||this.setPersonPropertiesForFlags(k),!ot(this.config.before_send)){var T=this.kn(c);if(!T)return;(c=T).uuid=Pe(c.uuid,_s)}this.Ro.emit("eventCaptured",c);var P=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),R={method:"POST",url:P,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Ko(R):this.Jo.enqueue(R),c}Oi.critical("This capture call is ignored due to client rate limiting.")}}else Oi.error("No event name provided to posthog.capture")}else Oi.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 dl(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(Rr)===Hr&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gl();var l=a?void 0:this.persistence.remove_event_timer(e),h=_({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Oo()&&(h[Nr]=!0),"$snapshot"===e){var d=_({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!rt(h.distinct_id)&&!at(h.distinct_id)||st(h.distinct_id))&&Oi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var v,f=function(e,i,r,n){var o,a,l,h;if(void 0===n&&(n=!1),!u)return{};var d,v=e?[...Jn,...i||[]]:[],f=function(t){for(var e=0;ke.length>e;e++){var i=ke[e],r=i[1],s=i[0].exec(t),n=s&&(Z(r)?r(s,t):r);if(n)return n}return["",""]}(u),p=f[0],_=f[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};it(r)||(m.detectGoogleSearchApp=r);var y={},b=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,w=null==(a=navigator)?void 0:a.maxTouchPoints,S=null==t||null==(l=t.screen)?void 0:l.width,x=null==t||null==(h=t.screen)?void 0:h.height,E=null==t?void 0:t.devicePixelRatio;it(b)||(y.userAgentDataPlatform=b),it(w)||(y.maxTouchPoints=w),it(S)||(y.screenWidth=S),it(x)||(y.screenHeight=x),it(E)||(y.devicePixelRatio=E);var k,T,P,R,C,O,I,A,F=es(ns({$os:p,$os_version:_,$browser:Se(u,navigator.vendor,g,m),$device:Te(u),$device_type:(T=u,P=y,A=Te(T),A===Pt||A===$t||"Kobo"===A||"Kindle Fire"===A||A===se?Tt:A===Gt||A===Jt||A===Kt||A===ee?"Console":A===Ct?"Wearable":A?xt:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(R=null==P?void 0:P.maxTouchPoints)&&void 0!==R?R:0)>0?600>Math.min(null!==(C=null==P?void 0:P.screenWidth)&&void 0!==C?C:0,null!==(O=null==P?void 0:P.screenHeight)&&void 0!==O?O:0)/(null!==(I=null==P?void 0:P.devicePixelRatio)&&void 0!==I?I:1)?xt:Tt:"Desktop"),$timezone:ao(),$timezone_offset:lo()}),{$current_url:Hn(n?Re(null==s?void 0:s.href):null==s?void 0:s.href,v,Qn),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Ee(u,navigator.vendor,g,m),$browser_language:io(),$browser_language_prefix:(k=io(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:c.LIB_NAME,$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return c.SDK_DIST_CHANNEL&&(F.$sdk_dist_channel=c.SDK_DIST_CHANNEL),F}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=p.windowId;h.$session_id=p.sessionId,h.$window_id=g}this.sessionPropsManager&&es(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&es(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Yo)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Ja&&(h.$lib_custom_api_host=this.config.api_host),v=e!==Jr||a?e!==Yr||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=es(h,v),e===Jr&&r&&(h.title=r.title),!it(l)){var y=n.getTime()-l;h.$duration=parseFloat((y/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties();ts(["$referrer","$referring_domain"],(t=>{t in b&&delete w[t]}));var S={};if(this.Ho.length>0)for(var x of this.Ho.slice())try{es(S,x())}catch(t){Oi.error("Failed to produce browser extension event properties",t)}(h=es({},f,b,w,_({},S,h))).$is_identified=this._isIdentified(),X(this.config.property_denylist)?ts(this.config.property_denylist,(function(t){delete h[t]})):Oi.error(ml+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(Oi.error(gl),h=E(h,e));var k=this.yl();return h.$process_person_profile=k,k&&!a&&this.bl("_calculate_event_properties"),h}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=es({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Oi.error(gl),o=a(o,"$set_once")),e&&(this.qo=!0),et(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||!Ds.Nr())Ds.qr(this.Bo);else{var e=[];this.jo.forEach((t=>e.push(t))),e.length>0?Ds.Dr(this.Bo,e):Ds.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:_l}),()=>{})}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:_l})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:_l})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=sl),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:_l}}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:_l})}wl(t){return!t||st(t)?(Oi.critical("Unique user id has not been set in posthog.identify"),!1):t===Dr?(Oi.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())||(Oi.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 Oi.uninitializedWarning("posthog.identify");if(at(t)&&(t=t.toString(),Oi.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(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(ji)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(zi)&&(this.unregister(zi),this.register({distinct_id:t}));var u,h=(this.persistence.get_property(Rr)||Hr)===Hr,d=t!==l,v=!d&&h;if(d&&h)this.persistence.set_property(Rr,Vr),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(Qr,{distinct_id:t,$anon_distinct_id:l},{$set:e||{},$set_once:i||{}}),this.Vo=Ka(t,e,i),null==(u=this.featureFlags)||u.setAnonymousDistinctId(l);else if(v){this.persistence.set_property(Rr,Vr);var c=e||{},f=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:c,$set_once:f}),this.Vo=Ka(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(kr)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Qs(a)}}}setPersonProperties(t,e){if((t||e)&&this.bl("posthog.setPersonProperties")){var i=Ka(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):Oi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(X(t)?t:[t]).filter((t=>rt(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,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.gl();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:_({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(Xr,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else Oi.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=ut(t)?t:null==t?void 0:t.resetDeviceID,i=ut(t)||null==t?void 0:t.bootstrap;this.kl(e,!1,i)}kl(t,e,i){var r,s,n;if(void 0===e&&(e=!1),Oi.info("reset"),!this.__loaded)return Oi.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.Zo)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.ma());var a=this.get_property(ji),l=this.get_property(Bi),u=this.get_property(Zi),h=this.is_capturing();this.consent.reset(),e||!h||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 d=null==(n=this.persistence)||null==n.Ws?void 0:n.Ws(),v=!1;try{var c,f,p,g,m,y,b,w,S,x,E,k,T,P;if(null==(c=this.persistence)||c.clear(),null==(f=this.sessionPersistence)||f.clear(),this.jo.clear(),this.ml(),it(u)||null==(E=this.persistence)||E.register({[Zi]:u}),null==(p=this.surveys)||p.reset(),null==(g=this.vl)||g.stop(),null==(m=this.featureFlags)||m.reset(),null==(y=this.conversations)||y.reset(),null==(b=this.logs)||b.reset(),null==(w=this.metrics)||w.reset(),null==(S=this.persistence)||S.set_property(Rr,Hr),null==(x=this.sessionManager)||x.resetSessionId(),this.Vo=null,this.config.cookieless_mode===qr)this.register_once({distinct_id:Dr,$device_id:null},"");else{var R=this.config.get_device_id(_s());this.register_once({distinct_id:R,$device_id:t?R:a},""),t||it(l)||this.register({[Bi]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Oo()||(null==(P=this.persistence)||P.set_property(Rr,i.isIdentifiedID?Vr:Hr),this.register({distinct_id:i.distinctID})),null==(k=this.featureFlags)||k.initialize(),!(it(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var C=_({},i);delete C.sessionID,this.config.bootstrap=C}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var O;d&&(null==(O=this.persistence)||null==O.Qs||O.Qs(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return p((function*(){var t,i,r,s,n,o;if(e.__loaded){null==(t=e.vl)||t.stop(),e.sl().dispose(),null==(i=e.sessionRecording)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.Jo)||n.unload(),null==(o=e.Yo)||o.unload();try{var a;null==(a=e.featureFlags)||a.destroy()}catch(t){Oi.error("Error while destroying feature flags",t)}}else Oi.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(Li)?(Oi.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(it(e)&&(e=this.get_distinct_id()),t!==e?(this._l(zi,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Oi.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=_({},this.config);if(tt(t)){var i,r,s,n,o,a,l,u,h,d,v,f;es(this.config,El(t));var p=this.$o();null==(i=this.persistence)||i.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(_({},this.config,{persistence:"sessionStorage"}),p,!1);var g,m=this.Go(this.config.debug);ut(m)&&(this.config.debug=m),ut(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Ss.Nr()&&Ss.Dr("ph_debug",!0),Oi.info("set_config",{config:t,oldConfig:e,newConfig:_({},this.config)})):(c.DEBUG=!1,Ss.Nr()&&Ss.qr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.ma()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this.No(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){c.LIB_NAME=t,c.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 i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(_({},r,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:Tl.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:bl;return e!==bl&&(e=bl+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Rr))===Vr||(null==(e=this.sessionPersistence)?void 0:e.get_property(Rr))===Vr}yl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===Wr&&!this._isIdentified()&&et(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[zi])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Mr]))}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?(Oi.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(Mr,!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!==zr)}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!==qr){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 ja(this),this.pageViewManager=new Dn(this),this.persistence&&(this.sessionPropsManager=new Da(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=Tl.__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==zr&&(null==(u=this.surveys)||u.loadIfEnabled()),(it(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 Oi.warn(pl)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==qr?(this.config.cookieless_mode===zr&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===zr&&(this.register({distinct_id:Dr,$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())):Oi.warn(pl)}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===qr||(this.config.cookieless_mode===zr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return i?Ba(i,this.config.custom_blocked_useragents):void 0}dl(){r&&("visible"===r.visibilityState?this.Uo||(this.Uo=!0,this.capture(Jr,{title:r.title},{send_instantly:!0}),this.zo&&(r.removeEventListener(Gr,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),ls(r,Gr,this.zo)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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?(Oi.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&&!ot(t[e]),o=i in t&&!ot(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,Oi)}kn(t){var e;if(ot(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(vt),r=X(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),ot(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return dt(t.event)?Oi.warn(o+". This can cause unexpected behavior."):Oi.info(o),null}s.properties&&!et(s.properties)||Oi.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return Oi.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&ot(s.properties[a]))return Oi.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=ut(t)&&!t,i=Ss.Nr()&&"true"===Ss.Pr("ph_debug");return!e&&(!!i||t)}}Tl.__defaultExtensionClasses={},Tl.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]]=ss(t.prototype[e[i]])}(Tl,["identify"]);class $l{constructor(t){this.disabled=!1===t;var e=tt(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",Rl=Ii("[AutoCapture]");function Cl(t,e){return e.length>t?e.slice(0,t)+"...":e}function Ol(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Hs(e));return e}function Il(e,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,u=i.elementsChainAsString,h=i.disableCaptureUrlHashes;if(!Hs(e))return{props:{}};for(var d=[e],v=new Set([e]),c=e;c.parentNode&&!Vs(c,"body")&&Ks>d.length;)if(Gs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Hs(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={},b=!1,w=!1;if(ts(d,(t=>{var e=fn(t);if(Vs(t,"a")){var i=t.getAttribute("href");b=!!(e&&i&&xn(i))&&(h?Re(i):i)}V(Qs(t),"ph-no-capture")&&(w=!0),m.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};en.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Cl(1024,En(t)):Cl(1024,Zs(t)));var a=Qs(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),ts(t.attributes,(function(i){var n;if((!pn(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&xn(i.value)&&(!rt(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=Js(a).join(" ")),o["attr__"+i.name]=Cl(1024,"href"===i.name&&s?Re(a):a)}}));for(var l=1,u=1,h=t;h=Ol(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(!fn(t))return{};var e={};return ts(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&&xn(r)&&(e[i]=r)}})),e}(t);es(y,r)})),w)return{props:{},explicitNoCapture:w};if(a||(m[0].$el_text=Vs(e,"a")||Vs(e,"button")?En(e):Zs(e)),b){var S,x;m[0].attr__href=b;var E=null==(S=zn(b))?void 0:S.host,k=null==t||null==(x=t.location)?void 0:x.host;E&&k&&E!==k&&(p=b)}return{props:es({$event_type:n.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(g=m,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=_({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return is(n).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return o[Tn(t[0].toString())]=Tn(e.toString())})),(r+=":")+is(o).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:$n(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return is(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(g)))},null!=(r=m[0])&&r.$el_text?{$el_text:null==(s=m[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},y)}}class Al{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 $l(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(t&&r){var e=this.hs=e=>{e=e||(null==t?void 0:t.event);try{this.ds(e)}catch(t){Rl.error("Failed to capture event",t)}};if(ls(r,"submit",e,{capture:!0}),ls(r,"change",e,{capture:!0}),ls(r,"click",e,{capture:!0}),this.ls().capture_copied_text){var i=this.vs=e=>{e=e||(null==t?void 0:t.event);try{this.ds(e,Pl)}catch(t){Rl.error("Failed to capture copy/cut event",t)}};ls(r,"copy",i,{capture:!0}),ls(r,"cut",i,{capture:!0})}}}else Rl.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==r||r.removeEventListener("submit",this.hs,!0),null==r||r.removeEventListener("change",this.hs,!0),null==r||r.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==r||r.removeEventListener("copy",this.vs,!0),null==r||r.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;ut(r)&&(null==(i=this.ns)||i.kv.set(Hi,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 s=null==r?void 0:r.querySelectorAll(e);null==s||s.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(Hi),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(nt(r)&&!ut(i)&&!n)return!1;var o=null!==(e=this.Jn)&&void 0!==e?e:!!i;return!!s.enabled&&!o}ds(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=tn(e);Ws(r)&&(r=r.parentNode||null);var s,n=this.rs();"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&dn(r,n.rageclick)&&this.ds(e,"$rageclick");var o=i===Pl;if(r&&function(e,i,r,s,n,o){var a;if(!t||vn(e))return!1;if(null!=r&&r.url_allowlist&&!Ys(r.url_allowlist,o))return!1;if(null!=r&&r.url_ignorelist&&Ys(r.url_ignorelist,o))return!1;if(null!=r&&r.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((t=>i.type===t)))return!1}var u=cn(e,s),h=u.parentIsUsefulElement,d=u.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(it(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}(d,r))return!1;if(!rn(d,null==r?void 0:r.css_selector_allowlist))return!1;if(rn(d,null!==(a=null==r?void 0:r.css_selector_ignorelist)&&void 0!==a?a:nn))return!1;try{var v=t.getComputedStyle(e);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var c=e.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return h?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(en.indexOf(c)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,n,o,o?["copy","cut"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a,l=Il(r,{e:e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=l.props;if(l.explicitNoCapture)return!1;var h=this.getElementSelectors(r);if(h&&h.length>0&&(u.$element_selectors=h),i===Pl){var d,v=Xs(null==t||null==(d=t.getSelection())?void 0:d.toString()),c=e.type||"clipboard";if(!v)return!1;u.$selected_content=v,u.$copy_type=c}return null==(a=this.ns)||a.capture(i,u).catch((t=>Rl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return Z(null==r?void 0:r.querySelectorAll)}}class Fl{constructor(t){this._instance=t}refresh(t){var e=this._instance.config,i=tt(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 Ml=Ii("[ExceptionAutocapture]"),Dl=()=>{},Nl=Ii("[TracingHeaders]"),Ll=Ii("[Web Vitals]"),Ul=9e5,jl=["CLS","FCP","INP","LCP"],Bl=["INP","LCP"],zl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],ql="disabled",Hl="lazy_loading",Vl="awaiting_config",Wl="missing_config";Ii("[SessionRecording]"),Ii("[SessionRecording]");var Gl="[SessionRecording]",Kl=Ii(Gl),Jl=Ii("[Heatmaps]");function Yl(t){return tt(t)&&"clientX"in t&&"clientY"in t&&at(t.clientX)&&at(t.clientY)}var Ql=Ii("[Product Tours]"),Xl=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(Qi))},Zl=["$set_once","$set"],tu=Ii("[SiteApps]"),eu="Error while initializing PostHog app with config id ",iu=(t,e)=>null!=t&&t.then?t.then(e):e(t),ru="SDK is not enabled or survey functionality is not yet loaded",su="Disabled. Not loading surveys.";class nu{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 tl.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(ot(e))return tl.warn("Flags not loaded yet. Not loading surveys.");this.Pl=ut(e)?e:e.length>0,tl.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=e}setup(t){if(!this.Xn)return this.Fl=t,iu(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(el)||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)tl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)tl.info(su);else if(t.cookielessMode&&this.ts.isOptedOut())tl.info("Not loading surveys in cookieless mode without consent.");else{var e=this.ts.getExtensions();if(e){if(!it(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(Br),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 tl.error("PostHog Extensions not found.")}}}Ll(t,e){this.Xn||(this._surveyManager=t(e),this._surveyEventReceiver=this.ts.createEventReceiver(),tl.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,e){tl.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 tl.info(su),t([]);var s=r.kv.get(yr);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=>tl.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 tl.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=>tl.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(ru)})))}ql(t,e){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:ru}};var i=e.statusCode;if(200!==i||!e.json){var r="Surveys API could not be loaded, status: "+i;return 0!==i?tl.error(r):e.error||tl.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)&&(qa(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({[yr]:n,[br]: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(br);return at(i)&&Date.now()-i>3e5}Bl(){return at(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};il(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){tl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!ot(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);tl.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(ot(this._surveyManager))return{eligible:!1,reason:ru};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}zl(t){if(ot(this._surveyManager))return{eligible:!1,reason:ru};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(ot(this._surveyManager))return tl.warn("init was not called"),{visible:!1,disabledReason:ru};var e=this.zl(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return ot(this._surveyManager)?(tl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ru})):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 s;if(ot(this._surveyManager))tl.warn("init was not called");else{var n="string"==typeof t?this.Hl(t):t;if(null!=n&&n.id)if(rl.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds){tl.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var t,e;this.Rl.delete(a),this.Xn||(tl.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),tl.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this.Rl.add(a)}else this._surveyManager.renderSurvey(n,o,i);else tl.warn("Survey element not found")}else tl.warn("Surveys of type "+n.type+" cannot be rendered in the app");else tl.warn("Survey not found")}}displaySurvey(t,e){var i;if(ot(this._surveyManager))tl.warn("init was not called");else{var r=this.Hl(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=_({},r,{appearance:_({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Po.Popover&&e.initialResponses&&tl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var n=this.Ul(r);if(!n.eligible)return void tl.warn("Survey is not eligible to be displayed: ",n.reason)}e.displayType!==Po.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else tl.warn("Survey not found")}}cancelPendingSurvey(t){ot(this._surveyManager)?tl.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function ou(t,e,i){if(ot(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 au{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new Na,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;it(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 Na}register(t){var e,i;if(!it(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(!ou(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=>ou(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&ou((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=>ou(t.text,e.text,e.text_matching||"exact")||ou(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;!ot(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=>ou(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||Ga(e.properties.reduce(((t,e)=>{var i=X(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 lu{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&&Ga(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===mo.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;it(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 au(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,mo.Activation),a=this.mu(t,mo.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,mo.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,mo.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(_({},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&&(et(i)?this.pu():this.fu(i))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var e=this.Nu()[t];return at(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=>at(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 uu extends lu{constructor(t){super(t)}ju(){return wr}Bu(){return Sr}cu(){return xr}fu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[xr]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(xr)}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 at(r)&&r>0}Vu(){return To.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 tl}Lu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[wr]:t})}Hu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[Sr]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Sr)}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 qa(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===To.SHOWN?"consume":"ignore":t===To.SHOWN?"persist":t===To.DISMISSED||t===To.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class hu{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);it(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 du{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==v?void 0:v.__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 uu(this._instance)}}var vu=null!=t&&t.location?Vn(t.location.hash,"__posthog")||Vn(location.hash,"state"):null,cu="_postHogToolbarParams",fu=Ii("[Toolbar]"),pu=Ii("[FeatureFlags]");class _u{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:X(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(pu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),it(t.flag_keys)||X(t.flag_keys)||pu.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var gu=Ii("[FeatureFlags]"),mu=Ii("[FeatureFlags]",{debugEnabled:!0}),yu="\" failed. Feature flags didn't load in time.",bu="connection_error",wu=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Su=t=>{var e={};for(var i of is(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},xu=Ii("[Error tracking]"),Eu=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],ku=["__firefox__","__gCrWeb"],Tu="Refusing to render web experiment since the viewer is a likely bot",$u={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Ha(e,t),not_regex:(t,e)=>!Ha(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);rt(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(Tu);else if(!this.qi.disable_web_experiments){if(ot(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=qn(null==t?void 0:t.search,"__experiment_id"),i=qn(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!ot(t.conditions)&&Pu.th(t,e)&&Pu.eh(t)}static th(t,e){var i;if(ot(t.conditions)||ot(null==(i=t.conditions)?void 0:i.url))return!0;var r=Pu.getWindowLocation();if(r){var s,n,o,a=Ls(e,r.href);return null==(s=t.conditions)||!s.url||$u[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==t?void 0:t.location}static eh(t){var e;if(ot(t.conditions)||ot(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Zn();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];Oi.info("[WebExperiments] "+t,i)}Ku(t,e,i){this._is_bot()?Pu.Qu(Tu):"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 i&&this._instance?Ba(i,this.qi.custom_blocked_useragents):void 0}}var Ru=Ii("[Conversations]"),Cu="Conversations not available yet.",Ou="console",Iu="__posthogHandledLogsRequestError",Au=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[Iu]=!0,i},Fu=t=>!!t&&"object"==typeof t&&!0===t[Iu],Mu={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=gu,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 _u(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]"),iu(t.kv.initialize(),(()=>{this.Fl===t&&(this.Fl=void 0,this.ns=t,this.yh(t))}))}yh(e){if(this.ns===e)return t&&ls(t,"online",this.Tt),this.bh=e.registerDynamicEventProperties((()=>this._h()?this.rh:this.nh)),this.wh(),this.initialize()}destroy(){null==t||t.removeEventListener("online",this.Tt)}dispose(){var e;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),null==(e=this.bh)||e.dispose(),this.bh=void 0,this.sh=[],null==t||t.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[lr,dr,vr,fr]){var i=this.Sh(e);it(i)||(t[e]=i)}this.rh=t;var r=_({},t),s=this.Sh(ar);if(s)for(var n of Object.entries(s))r["$feature/"+n[0]]=n[1];this.nh=r}_h(){var t=this.qi.cacheTtlMs;if(!t||0>=t)return!1;var e=this.Sh(Pr);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(!it(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,i){var r,s,n=null!=i&&i.merge&&null!==(r=this.Sh(ar))&&void 0!==r?r:{},o=null!=i&&i.merge&&null!==(s=this.Sh(dr))&&void 0!==s?s:{},a=_({},n,t),l=_({},o,e),u={};for(var h of Object.entries(a)){var d=h[0],v=h[1];u[d]={key:d,enabled:y(v),variant:b(v),reason:void 0,metadata:it(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this.Eh({flags:u})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(hr),e=this.Sh(fr),i=this.Sh(pr);if(!i&&!e)return t||{};var r=es({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=it(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=it(u)?null==l?void 0:l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=_({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=_({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.ih=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:y(r),variant:b(r),payload:m(e[i])}}))}getFlagVariants(){var t=this.Sh(ar),e=this.Sh(fr);if(!e)return t||{};for(var i=es({},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(dr),e=this.Sh(pr);if(!e)return t||{};for(var i=es({},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(kr)}Rh(t){this.kh();var e=this.ns;if(e&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},e.initialPersonProperties,this.Sh(_r)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Sh(gr),timezone:ao()};it(e.deviceId)||(i.$device_id=e.deviceId),(null!=t&&t.disableFlags||this.qi.featureFlagsDisabled)&&(i.disable_flags=!0);var r=this.Th();r.length&&(i.evaluation_contexts=r);var s=this.Mh();it(s)||(i.flag_keys=s);var n=this.qi.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.lh;this.oh=!0;var l=()=>{this.hh&&(this.hh=!1,this.Rh())},u=t=>{this.oh=!1,a===this.lh?(this.Dr({[$r]:[bu]}),this.I.error("Feature flag request failed",t),l()):l()};try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:"base64"===this.qi.compression?go.Base64:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var e,r,s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.oh=!1,a===this.lh){if(this.Ph(t.statusCode),o||this.hh||(this.$anon_distinct_id=void 0),!i.disable_flags||this.hh){this.dh=!o;var u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?bu:"unknown_error"):200!==t.statusCode&&u.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var h=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));h&&u.push("quota_limited"),this.Dr({[$r]:u}),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."):i.disable_flags||this.Eh(s,o,{partialResponse:n}),l()}}else l()})).catch(u)}catch(t){u(t)}}}gh(){return Wn(this.ph,3)}Ph(t){this.ph=Gn(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+yu)}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 i,r=this.getFlagVariants(),s=t in r,n=r[t],o=this.getFlagPayloads()[t],a=String(n),l=this.Sh(vr)||void 0,u=this.Sh(Pr)||void 0,h=this.Sh(kr)||{};if(this.qi.deduplicateCallsPerSession){var d,v=null==(d=this.ns)?void 0:d.session.sessionId,c=this.Sh(Tr);v&&v!==c&&(h={},i=v)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(a))i&&this.Dr({[kr]:h,[Tr]:i});else{var f,p,g,y,b,w,S,x,E,k,T,P;X(h[t])?h[t].push(a):h[t]=[a],this.Dr(_({[kr]:h},i?{[Tr]:i}:{}));var R=this.getFeatureFlagDetails(t),C=[...null!==(f=this.Sh($r))&&void 0!==f?f:[]];it(n)&&C.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(p=null==(g=this.qi.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(y=null==(b=this.qi.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.dh};it(null==R||null==(w=R.metadata)?void 0:w.has_experiment)||(O.$feature_flag_has_experiment=R.metadata.has_experiment),it(null==R||null==(S=R.metadata)?void 0:S.version)||(O.$feature_flag_version=R.metadata.version);var I,A=null!==(x=null==R||null==(E=R.reason)?void 0:E.description)&&void 0!==x?x:null==R||null==(k=R.reason)?void 0:k.code;A&&(O.$feature_flag_reason=A),null!=R&&null!=(T=R.metadata)&&T.id&&(O.$feature_flag_id=R.metadata.id),it(null==R?void 0:R.original_variant)&&it(null==R?void 0:R.original_enabled)||(O.$feature_flag_original_response=it(R.original_variant)?R.original_enabled:R.original_variant),null!=R&&null!=(P=R.metadata)&&P.original_payload&&(O.$feature_flag_original_payload=null==R||null==(I=R.metadata)?void 0:I.original_payload),C.length&&(O.$feature_flag_error=C.join(",")),this.Ah(O)}else i&&this.Dr({[kr]:h,[Tr]:i});if(s)return{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:m(o)}}}else this.I.warn('getFeatureFlagResult for key "'+t+yu)}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,e){var i=this;return p((function*(){var r=i.ns;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=i.Th();n.length&&(s.evaluation_contexts=n);var o,a=i.Mh();it(a)||(s.flag_keys=a);try{var l,u=null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===i.qi.compression?go.Base64:void 0,sentAt:"body",timeoutMs:i.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==u?void 0:u[t])||void 0}catch(t){return void i.I.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){i.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+yu),e.defaultValue;var i=this.getFeatureFlag(t,e);return it(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,i){if(this.ns){this.ah=!0;var r=function(t,e,i,r,s,n){void 0===e&&(e={}),void 0===i&&(i={}),void 0===r&&(r={}),void 0===n&&(n=gu);var o=((t,e)=>{var i=t.flags;return i?_({},t,{featureFlags:Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[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,n),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(X(l)){n.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;return{[lr]:l,[ar]:v,[cr]:!1}}var f=l,p=u,g=a;if(null!=s&&s.partialResponse)f=_({},e,f),p=_({},i,p),g=_({},r,g);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return!(null!=(e=a[t])&&e.failed)})));f=_({},e,Object.fromEntries(Object.entries(f).filter((t=>m.has(t[0]))))),p=_({},i,Object.fromEntries(Object.entries(p||{}).filter((t=>m.has(t[0]))))),g=_({},r,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else f=_({},e,f),p=_({},i,p),g=_({},r,g);return _({[lr]:Object.keys(Su(f)),[ar]:f||{},[dr]:p||{},[hr]:g||{},[cr]:!0===t.minimalFlagCalledEvents},h?{[vr]:h}:{},d?{[Pr]:d}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.I);r&&this.Dr(r),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([fr,pr]),this.Lh(),void mu.info("All overrides cleared");if(X(t))return this.Dr({[fr]:wu(t)}),this.Lh(),void mu.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[fr]=X(s)?wu(s):s),n&&(r[pr]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([fr,pr]):!1===s?this.qr(fr):!1===n&&this.qr(pr),this.Lh(),!1===s?mu.info("Flag overrides cleared"):s&&mu.info("Flag overrides set",{flags:s}),void(!1===n?mu.info("Payload overrides cleared"):n&&mu.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[fr]:t}),this.Lh(),void mu.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,i){var r=(this.Sh(ur)||[]).find((e=>e.flagKey===t)),s={["$feature_enrollment/"+t]:e},n={$feature_flag:t,$feature_enrollment:e,$set:s};r&&(n.$early_access_feature_name=r.name),i&&(n.$feature_enrollment_stage=i);var o=_({},this.getFlagVariants(),{[t]:e});this.Dr({[lr]:Object.keys(Su(o)),[ar]:o,[_r]:_({},this.Sh(_r)||{},s)}),this.Lh();try{var a;null==(a=this.ns)||a.capture("$feature_enrollment_update",n).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(ur);!r||e?this.$h(t,i):t(r)}$h(t,e){var i=this;return p((function*(){var r=i.ns;if(r){var s,n=e?"&"+e.map((t=>"stage="+t)).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;i.Dr({[ur]:s=o.json.earlyAccessFeatures})}catch(t){return void i.I.error("Early access feature request failed",t)}try{t(s)}catch(t){i.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 i=this.Sh(_r)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this.Dr({[_r]:_({},i,n,r)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=_({},this.Sh(_r)||{});t.forEach((t=>{delete i[t]})),this.Dr({[_r]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(_r),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.Sh(gr)||{},r=_({},i);for(var s of Object.keys(t))r[s]=_({},i[s],t[s]);this.Dr({[gr]:r}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Sh(gr)||{};this.Dr({[gr]:_({},e,{[t]:{}})})}else this.qr(gr)}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}}},Du={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===Vl||this.jh===Wl?this.jh:null!==(t=null==(e=this.qh)?void 0:e.status)&&void 0!==t?t:this.jh}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=ql,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var e;if(null==r||!r.visibilityState||"visible"===r.visibilityState)return!0;var i=null==t||null==(e=t.performance)||null==e.getEntriesByType?void 0:e.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==r?void 0:r.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Kl.error("started without valid sessionManager"),new Error(Gl+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===qr)throw new Error(Gl+' cannot be used with cookieless_mode="always"');null!=r&&r.addEventListener&&ls(r,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==r||null==r.removeEventListener||r.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var e,i=!(null==(e=this._instance.get_property(Zi))||!e.enabled),r=!this.qi.disable_session_recording,s=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!(this.Hh||this.Uh&&null!=(e=this.qh)&&e.isStarted)){var i=!it(Object.assign)&&!it(Array.from);this.Uh&&i?(this.zh(t),Kl.info("starting")):(this.jh=ql,this.stopRecording())}}zh(t){var e,i,r;this.Uh&&(this.jh!==Vl&&this.jh!==Wl&&(this.jh=Hl),null!=v&&null!=(e=v.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=v.__PosthogExtensions__)&&i.initSessionRecording?this.Wh(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(e=>{if(e)return this._instance.register_for_session({[jr]:!0}),Kl.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(or),null==(e=this.za)||e.unregister(tr)}Qh(t,e){if(ot(t))return null;var i,r=at(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Kl.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var e,i,r=this.za,s=()=>{var e,i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Qh(null==(e=this.qi.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.Qh(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;ot(o)&&this.Zh();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Zi]:_({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:_({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:it(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(e=this.Bh)||e.call(this),this.Bh=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}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===Vl&&(this.jh=Wl,Kl.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):Kl.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(Zi);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Kh(){var t,e=this._instance.get_property(Zi);if(!e)return!1;try{t="object"==typeof e?e:JSON.parse(e)}catch(t){return Kl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!ot(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var e,i,r;if(!this.Hh){if(null==(e=v.__PosthogExtensions__)||!e.initSessionRecording)return Kl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[jr]:!0});var s;if(this.qh||(this.qh=null==(s=v.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Wl||this.jh===Vl)return;return this.jh=Vl,Kl.info("persisted remote config is stale, requesting fresh config before starting"),void new Mo(this._instance).load()}this.jh=Hl,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({[ir]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.qh||null==(e=this.za)||e.register({[er]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var e,i;this.qh||null==(i=this.za)||i.register({["url"===t?rr:sr]:!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))}}},Nu={autocapture:class extends Al{constructor(t){super(new Fl(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&&(Oi.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,Oi.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(e){var i;if(t&&(null==(i=t.history[e])||!i.__posthog_wrapped__)){var r=this;!function(t,e,i){try{if(!(e in t))return Dl;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 Z(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];Z(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 Dl}}(t.history,e,(t=>function(i,s,n){t.call(this,i,s,n),r.ld(e)}))}}Xh(){var e=null==t?void 0:t.location;if(null!=e&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}td(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:tt(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(Jr,{navigation_type:t}),this.Yh=e}catch(e){Oi.error("Error capturing "+t+" pageview",e)}}ad(){if(!this.rd){var e=()=>{this.ld("popstate")};ls(t,"popstate",e),this.rd=()=>{t&&t.removeEventListener("popstate",e)}}}od(){if(!this.nd){var e=()=>{this.ld("hashchange")};ls(t,"hashchange",e),this.nd=()=>{t&&t.removeEventListener("hashchange",e)}}}},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[Vi]),this.rageclicks=new $l(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return tt(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return ot(this.qi.capture_heatmaps)?ot(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:!1!==this.qi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;Jl.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({[Vi]:i}),this.hd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){Yl(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd="visible"===(null==r?void 0:r.visibilityState)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){t&&r&&(this.gd=this.La.bind(this),ls(t,Kr,this.gd),this.md=e=>this.ki(e||(null==t?void 0:t.event)),ls(r,"click",this.md,{capture:!0}),this.yd=e=>this.bd(e||(null==t?void 0:t.event)),ls(r,"mousemove",this.yd,{capture:!0}),this._d=new On(this.instance,Rn,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),ls(r,Gr,this.wd),this.Qn=!0)}fd(){var e;t&&r&&(this.gd&&t.removeEventListener(Kr,this.gd),this.md&&r.removeEventListener("click",this.md,{capture:!0}),this.yd&&r.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&r.removeEventListener(Gr,this.wd),clearTimeout(this.kd),null==(e=this._d)||e.stop(),this.Qn=!1)}Sd(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&Hs(s)&&!Vs(s,"body");){if(s===r)return!1;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:t)?void 0:o.getComputedStyle(s).position}catch(t){return!1}if(V(i,n))return!0;s=sn(s)}return!1}(tn(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}ki(t,e){var i;if(void 0===e&&(e="click"),!qs(t.target)&&Yl(t)){var r=this.Sd(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&dn(tn(t),this.instance.config.rageclick)&&this.Nn(_({},r,{type:"rageclick"})),this.Nn(r)}}bd(t){!qs(t.target)&&Yl(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(e){if(t){var i=this.qi.disable_capture_url_hashes?Re(t.location.href):t.location.href,r=this.qi.custom_personal_data_properties,s=this.qi.mask_personal_data_properties?[...Jn,...r||[]]:[],n=Hn(i,s,Qn);this.ft=this.ft||{},this.ft[n]||(this.ft[n]=[]),this.ft[n].push(e)}}La(){this.ft&&!et(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:On,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",_({$current_url:this.ft.url},this.ft.metrics.reduce(((t,e)=>_({},t,{["$web_vitals_"+e.name+"_event"]:_({},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},ot(null==t?void 0:t.name)||ot(null==t?void 0:t.value))Ll.error("Invalid metric received",t);else{var i="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.Md(i);if(!it(r)){var s=at(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.Ed||this.Ed>t.value){this.ft.navigationKey!==s&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),it(this.ft.navigationKey)&&(this.ft.navigationKey=s,this.ft.url=r),this.ft.firstMetricTimestamp=it(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp;var n=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),o=_({},t,i?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete o.entries,tt(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var a={};for(var l of zl){var u="url"===l&&"string"==typeof t.attribution[l]?this.Md(t.attribution[l]):t.attribution[l];it(u)||(a[l]=u)}o.attribution=a}else delete o.attribution;it(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.ft.metrics.push(o),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else Ll.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,e,i,r,s=!1,n=v.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.Rd])||("web-vitals"===this.Rd&&it(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!it(a)){var l=a.withoutAttribution,u=this.attributionMetrics;s=!it(l),t=u.indexOf("LCP")>-1?a.onLCP:(null==l?void 0:l.onLCP)||a.onLCP,e=u.indexOf("CLS")>-1?a.onCLS:(null==l?void 0:l.onCLS)||a.onCLS,i=u.indexOf("FCP")>-1?a.onFCP:(null==l?void 0:l.onFCP)||a.onFCP,r=u.indexOf("INP")>-1?a.onINP:(null==l?void 0:l.onINP)||a.onINP}if(t&&e&&i&&r){var h={reportSoftNavs:this.useSoftNavs},d=s&&this.attributionMetrics.indexOf("INP")>-1?_({},h,{includeProcessedEventEntries:!1}):h;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Td.bind(this),h),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Td.bind(this),h),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Td.bind(this),h),this.allowedMetrics.indexOf("INP")>-1&&r(this.Td.bind(this),d),this.Qn=!0}else Ll.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(e=this._instance.persistence)||!e.props[Ji]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=tt(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return ot(i)?(null==(e=this._instance.persistence)?void 0:e.props[Xi])||jl:i}get flushToCaptureTimeoutMs(){return(tt(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=tt(this.Pd)?this.Pd.web_vitals_attribution:void 0;return ut(t)?t?jl:[]:X(t)?t:Bl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=tt(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=tt(this.Pd)&&at(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:Ul;return t>0&&6e4>=t?Ul:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Ll.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=tt(this.Pd)?this.Pd.web_vitals:ut(this.Pd)?this.Pd:void 0;return ut(e)?e:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(Ll.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=tt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=tt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ji]:i}),this._instance.persistence.register({[Xi]: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=v.__PosthogExtensions__,i=this.Rd,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&it(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?Ll.error("failed to load script",e):t()}))}Md(e){var i=e||(null==t?void 0:t.location.href);if(i){var r=this._instance.config.disable_capture_url_hashes?Re(i):i,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Jn,...s||[]]:[];return Hn(r,n,Qn)}Ll.error("Could not determine current URL")}}},Lu={exceptionObserver:class{constructor(e){var i;this.Id=()=>{var e;if(t&&this.isEnabled&&null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=i(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=r(this.captureException.bind(this))),!this.Ld&&this.qi.capture_console_errors&&(this.Ld=s(this.captureException.bind(this)))}catch(t){Ml.error("failed to start",t),this.Od()}}},this._instance=e,this.Dd=!(null==(i=this._instance.persistence)||!i.props[Wi]),this.oe=new St(_({},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:Ml})),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 tt(t)?e=_({},e,t):(it(t)?this.Dd:t)&&(e=_({},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?(Ml.info("enabled"),this.Od(),this._s(this.Id)):this.Od()}_s(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Ml.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({[Wi]: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)?Ml.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,i;this.Nd=[],this.qd=new ti([new vi,new Si,new fi,new ci,new bi,new yi,new _i,new wi],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];return function(e,r){void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=di.test(a)?a.replace(di,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.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 _({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||ei});var i}))}(s)}}("web:javascript",ai,hi)),this._instance=t,this.Nd=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(Gi))&&void 0!==e?e:[],this.jd=$i(this.Bd()),this.Hd=new Pi(this.jd)}onConfigChange(){this.jd=$i(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({[Gi]:this.Nd,[Ki]:o})}}}get Ud(){var t,e=!!this._instance.get_property(Ki),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(!rt(t)||0===t.trim().length)return void xu.warn("Ignoring exception step because message must be a non-empty string");var i=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>ki.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.zd(e)),r=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&xu.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Hd.add(_({[xi]:t,[Ei]:(new Date).toISOString()},r))}catch(t){xu.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 xu.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 xu.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 xu.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 xu.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.jd.enabled&&ot(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 xu.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void xu.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:_({},t,{$exception_steps:e})}catch(e){return xu.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Gd(t){this.jd.enabled&&this.Hd.add({[xi]:t,[Ei]:(new Date).toISOString()})}zd(t){return tt(t)?_({},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 rt(i)&&i.length>0&&t.$exception_types.push(i),rt(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=Wa[t.operator],r=e[t.key];if(!i||!r)return!1;var s=X(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 xu.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&&Eu.some((t=>e.startsWith(t)))}))}Qd(t){return t.some((t=>{var e=t.value;return rt(e)&&ku.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!ot(t)&&X(t)}}},Uu=_({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({[Qi]:!!e.productTours}),!Xl(this._instance))return!this.Yd&&ot(null==(i=this.za)?void 0:i.props[Er])||Ql.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&&Xl(this._instance)&&this._s((()=>this.tv()))}_s(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ql.error("Could not load product tours script",e):t()}))}tv(){var t;!this.Yd&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!X(this.Xd)||e){var i=this.za;if(i){var r=i.props[Er];if(X(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(Xl(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||Ql.warn(s):Ql.error(s),void t([],{isLoaded:!1,error:s})}var n=X(e.json.product_tours)?e.json.product_tours:[];this.Xd=n,i&&i.register({[Er]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){ot(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(Er)}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)}}},Mu),ju={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=v._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,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(h)){var v=d[0];l[v]={id:u[v],type:v,properties:d[1]}}var c=t.$set_once,f=t.$set;return{event:_({},g(t,Zl),{properties:_({},t.properties,f?{$set:_({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},f)}:{},c?{$set_once:_({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}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)||(tu.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)||(tu.error("prepare_external_dependency_script returned null"),null):t}av(){var t,e,i,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=null==r?void 0:r.defaultView,h=null==u||null==(t=u.Node)?void 0:t.prototype;if(!u||!h)return()=>{};if(this.ev++,this.ov)return this.lv();var d=[],v=this,c=new WeakSet,f=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),d.push((()=>{t[e]=r}))}},p=t=>{if(c.has(t))return t;var e=v.sv(t);return e&&c.add(e),e},_=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!nt(t)));return f(h,"appendChild",(t=>function(e){var i=p(e);return i?t.call(this,i):e})),f(h,"insertBefore",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):e})),f(h,"replaceChild",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):i})),[null==(e=u.Element)?void 0:e.prototype,null==(i=u.Document)?void 0:i.prototype,null==(s=u.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(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,_(i))})),f(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,_(i))}))})),[null==(n=u.Element)?void 0:n.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((t=>{f(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,_(i))})),f(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,_(i))})),f(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=_(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),f(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(e,i){var r=p(i);return r?t.call(this,e,r):null})),this.ov=()=>{d.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&&(tu.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,tu.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){tu.error(eu+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){tu.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){tu.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 tu.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;v["__$$ph_site_app_"+e]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return tu.error(eu+e,t)}))};for(var a of n.siteApps)o()}else tu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Bu={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?(it(this.vv)&&(this.vv=null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),it(this.fv)&&(this.fv=null==(e=v.__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=v.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Nl.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 X(t)?(X(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(X(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()}}},zu=_({surveys:class extends nu{constructor(t){var e;super(new du(t),{get projectToken(){return e.config.token},kv:new hu(e=t)}),this._instance=t}Nl(t,e){var i=e.query?ya(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})}))}}},Mu),qu={toolbar:class{constructor(t){this.instance=t}yv(t){v.ph_toolbar_state=t}bv(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),us(this.instance.config))return!1;if(!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}var n,o=vu||Vn(e.hash,"__posthog")||Vn(e.hash,"state"),a=o?rs((()=>JSON.parse(atob(decodeURIComponent(o)))))||rs((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(cu)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}_v(t){var e=v.ph_load_toolbar||v.ph_load_editor;!ot(e)&&Z(e)?e(t,this.instance):fu.warn("No toolbar load function found")}loadToolbar(e){var i=!(null==r||!r.getElementById(Us));if(!t||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=_({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(cu,JSON.stringify(_({},n,{source:void 0}))),2===this.bv())this._v(n);else if(0===this.bv()){var o;this.yv(1),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return fu.error("[Toolbar] Failed to load",t),void this.yv(0);this.yv(2),this._v(n)})),ls(t,"turbolinks:load",(()=>{this.yv(0),this.loadToolbar(n)}))}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)}}},Hu=_({experiments:Pu},Mu),Vu={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;ot(e)||(ut(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||us(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v?void 0:v.__PosthogExtensions__;if(t&&!it(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(Br);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 Ru.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,Ru.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else Ru.error("Cannot complete initialization: remote config is null")}Ev(t,e){Ru.error(t,e),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():Ru.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!nt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":us(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Tv?"remote_config_failed":it(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?ot(this.Me)||!this.Me.token?"missing_token":null!=v&&v.__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,e,i){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(Ru.warn(Cu),null)}))()}getMessages(t,e){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(Ru.warn(Cu),null)}))()}markAsRead(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ru.warn(Cu),null)}))()}getTickets(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ru.warn(Cu),null)}))()}requestRestoreLink(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ru.warn(Cu),null)}))()}restoreFromToken(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ru.warn(Cu),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ru.warn(Cu),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()}}},Wu={logs:class{constructor(e){var i,r=this;this.Iv=!1,this.Rv=!1,this.I=Ii("[logs]"),this.Pv=_({},this.I,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(Fu)||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=e,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Iv=!0),t&&ls(t,"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=it(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 Ve(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},Ou);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;!ot(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){Fu(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==v?void 0:v.__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(Br)}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===x.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===x.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Mn:t=>this.Mn(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Mn(t){return new Promise((e=>{if(Wn(this.ph,3))e({kind:"fatal",error:Au(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:Au(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:Au(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=Gn(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,c.LIB_NAME,(t=>{this.ka=t})),this.Av.length>0&&this.Jv(t,this.Av,this.zv,Ou,(t=>{this.Av=t}))}Jv(t,e,i,r,s){if(0!==e.length){var n=e.map((t=>t.record));s([]);var o=He(n,qe(i,c.LIB_NAME,c.LIB_VERSION),r,c.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:o,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,ot(s)||(e.sessionStartTimestamp=s),ot(n)||(e.lastActivityTimestamp=n)}if(null!=v&&null!=(t=v.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Re(v.location.href):v.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Gu={metrics:class{constructor(t){this.I=Ii("[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 Je(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:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Un(t,e){return new Promise((i=>{var r=!1,s=t=>{r||(r=!0,clearTimeout(n),i(t))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(_({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)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;s({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)}}},Ku=_({},Mu,Du,Nu,Lu,Uu,ju,zu,Bu,qu,Hu,Vu,Wu,Gu);Tl.__defaultExtensionClasses=_({},Ku);var Ju=function(){c.SDK_DIST_CHANNEL="npm";var e=vl[bl]=new Tl;return function(){function e(){e.done||(e.done=!0,wl=!1,ts(vl,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():ls(r,"DOMContentLoaded",e,{capture:!1}):t&&Oi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{go as Compression,Ro as DEFAULT_PRODUCT_TOUR_APPEARANCE,Po as DisplaySurveyType,Tl as PostHog,Co as ProductTourEventName,Oo as ProductTourEventProperties,To as SurveyEventName,$o as SurveyEventProperties,mo as SurveyEventType,bo as SurveyPosition,Eo as SurveyQuestionBranchingType,xo as SurveyQuestionType,ko as SurveySchedule,wo as SurveyTabPosition,So as SurveyType,yo as SurveyWidgetType,Ju as default,Ju as posthog,Do as severityLevels};
|
|
1
|
+
var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:t;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"0.5.2",LIB_NAME:"browser-common"};function f(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 p(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function _(){return _=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},_.apply(null,arguments)}function g(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}var m=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function y(t){return"string"==typeof t||t}function b(t){return"string"==typeof t?t:void 0}var w,S=["$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"],x=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}({}),E=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),k=["$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"],T=["token"],P="NativeGzipValidationError",R=t=>t.length>=2&&31===t[0]&&139===t[1],C=(t,e)=>t===E.GZipJS||e===E.GZipJS||"gzip"===e,O=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),I=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=P,e},A=function(){var t=p((function*(t,e){18>t.size&&I("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());R(i)&&8===i[2]||I("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(w)return w;w=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;w[t]=e>>>0}return w})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&I("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&I("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function F(){return F=p((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=p((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield A(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),F.apply(this,arguments)}var M=20,D=1e3,N=1e4,L="[Circular]",U="[Truncated]",j="[Unserializable]",B="[Function]";function z(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 q=["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"],H=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return q.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function V(t,e){return-1!==t.indexOf(e)}var W=function(t){return t.trim()},G=function(t){return t.replace(/^\$/,"")};function K(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 J=Object.prototype,Y=J.hasOwnProperty,Q=J.toString,X=Array.isArray||function(t){return"[object Array]"===Q.call(t)},Z=t=>"function"==typeof t,tt=t=>t===Object(t)&&!X(t),et=t=>{if(tt(t)){for(var e in t)if(Y.call(t,e))return!1;return!0}return!1},it=t=>void 0===t,rt=t=>"[object String]"==Q.call(t),st=t=>rt(t)&&0===t.trim().length,nt=t=>null===t,ot=t=>it(t)||nt(t),at=t=>"[object Number]"==Q.call(t)&&t==t,lt=t=>at(t)&&t>0,ut=t=>"[object Boolean]"===Q.call(t),ht=t=>t instanceof FormData,dt=t=>V(k,t),vt=t=>V(T,t);function ct(t){return null===t||"object"!=typeof t}function ft(t,e){return{}.toString.call(t)==="[object "+e+"]"}function pt(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 gt(t,Error)}}function _t(t){return"undefined"!=typeof Event&>(t,Event)}function gt(t,e){try{return t instanceof e}catch(t){return!1}}var mt=[!0,"true",1,"1","yes"],yt=t=>V(mt,t),bt=[!1,"false",0,"0","no"];function wt(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),at(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),wt(s||i,e,i,r))}class St{constructor(t){this.k={},this.S=t.S,this.C=wt(t.bucketSize,0,100,t.I),this.R=wt(t.refillRate,0,this.C,t.I),this.A=wt(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 xt="Mobile",Et="iOS",kt="Android",Tt="Tablet",$t=kt+" "+Tt,Pt="iPad",Rt="Apple",Ct=Rt+" Watch",Ot="Safari",It="BlackBerry",At="Samsung",Ft=At+"Browser",Mt=At+" Internet",Dt="Chrome",Nt=Dt+" OS",Lt=Dt+" "+Et,Ut="Internet Explorer",jt=Ut+" "+xt,Bt="Opera",zt=Bt+" Mini",qt="Edge",Ht="Microsoft "+qt,Vt="Firefox",Wt=Vt+" "+Et,Gt="Nintendo",Kt="PlayStation",Jt="Xbox",Yt=kt+" "+xt,Qt=xt+" "+Ot,Xt="Windows",Zt=Xt+" Phone",te="Nokia",ee="Ouya",ie="Generic",re=ie+" "+xt.toLowerCase(),se=ie+" "+Tt.toLowerCase(),ne="Konqueror",oe="Oculus Browser",ae="Vivaldi",le="Yandex",ue="Whale",he="DuckDuckGo",de="Pale Moon",ve="Waterfox",ce="Brave",fe="Google Search App",pe="(\\d+(\\.\\d+)?)",_e=new RegExp("Version/"+pe),ge=new RegExp(Jt,"i"),me=new RegExp(Kt+" \\w+","i"),ye=new RegExp(Gt+" \\w+","i"),be=new RegExp(It+"|PlayBook|BB10","i"),we={"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"},Se=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?ce:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&V(t,"GSA/")?fe:V(t," OPR/")&&V(t,"Mini")?zt:V(t," OPR/")?Bt:be.test(t)?It:V(t,"IE"+xt)||V(t,"WPDesktop")?jt:V(t,"OculusBrowser")?oe:V(t,Ft)?Mt:V(t,qt)||V(t,"Edg/")?Ht:V(t,ae+"/")?ae:V(t,"YaBrowser/")?le:V(t,ue+"/")?ue:V(t,he+"/")||V(t,"Ddg/")?he:V(t,"FBIOS")?"Facebook "+xt:V(t,"UCWEB")||V(t,"UCBrowser")?"UC Browser":V(t,"CriOS")?Lt:V(t,"CrMo")||V(t,Dt)?Dt:V(t,kt)&&V(t,Ot)?Yt:V(t,"FxiOS")?Wt:V(t.toLowerCase(),ne.toLowerCase())?ne:V(t,ce+"/")?ce:((t,e)=>e&&V(e,Rt)||function(t){return V(t,Ot)&&!V(t,Dt)&&!V(t,kt)}(t))(t,e)?V(t,xt)?Qt:Ot:V(t,"PaleMoon/")?de:V(t,ve+"/")?ve:V(t,Vt)?Vt:V(t,"MSIE")||V(t,"Trident/")?Ut:V(t,"Gecko")?Vt:"")},xe={[jt]:[new RegExp("rv:"+pe)],[Ht]:[new RegExp(qt+"?\\/"+pe)],[Dt]:[new RegExp("("+Dt+"|CrMo)\\/"+pe)],[Lt]:[new RegExp("CriOS\\/"+pe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pe)],[Ot]:[_e],[Qt]:[_e],[Bt]:[new RegExp("(Opera|OPR)\\/"+pe)],[Vt]:[new RegExp(Vt+"\\/"+pe)],[Wt]:[new RegExp("FxiOS\\/"+pe)],[ne]:[new RegExp("Konqueror[:/]?"+pe,"i")],[It]:[new RegExp(It+" "+pe),_e],[Yt]:[new RegExp("android\\s"+pe,"i")],[Mt]:[new RegExp(Ft+"\\/"+pe)],[oe]:[new RegExp("OculusBrowser\\/"+pe)],[ae]:[new RegExp(ae+"\\/"+pe)],[le]:[new RegExp("YaBrowser\\/"+pe)],[ue]:[new RegExp(ue+"\\/"+pe)],[ce]:[new RegExp(ce+"\\/"+pe)],[he]:[new RegExp("(DuckDuckGo|Ddg)\\/"+pe)],[de]:[new RegExp("PaleMoon\\/"+pe)],[ve]:[new RegExp(ve+"\\/"+pe)],[fe]:[new RegExp("GSA\\/"+pe)],[Ut]:[new RegExp("(rv:|MSIE )"+pe)],Mozilla:[new RegExp("rv:"+pe)]},Ee=function(t,e,i,r){var s=Se(t,e,i,r),n=xe[s];if(it(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},ke=[[new RegExp(Jt+"; "+Jt+" (.*?)[);]","i"),t=>[Jt,t&&t[1]||""]],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Kt,"i"),[Kt,""]],[be,[It,""]],[new RegExp(Xt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Zt,""];if(new RegExp(xt).test(e)&&!/IEMobile\b/.test(e))return[Xt+" "+xt,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=we[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Xt,r]}return[Xt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Et,[t[3],t[4],t[5]||"0"].join(".")]:[Et,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=it(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+kt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+kt+")","i"),t=>t&&t[2]?[kt,[t[2],t[3],t[4]||"0"].join(".")]:[kt,""]],[/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/,[Nt,""]],[/Linux|debian/i,["Linux",""]]],Te=function(t){return ye.test(t)?Gt:me.test(t)?Kt:ge.test(t)?Jt:new RegExp(ee,"i").test(t)?ee:new RegExp("("+Zt+"|WPDesktop)","i").test(t)?Zt:/iPad/.test(t)?Pt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ct:be.test(t)?It:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(te,"i").test(t)?te:/(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(xt).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)?kt:$t:new RegExp("(pda|"+xt+")","i").test(t)?re:new RegExp(Tt,"i").test(t)&&!new RegExp(Tt+" pc","i").test(t)?se:""},$e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Pe(t,e){return"string"==typeof(i=t)&&$e.test(i)?t:e();var i}function Re(t){return t?t.split("#")[0]:t}function Ce(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function Oe(t,e,i){return Ie.apply(this,arguments)}function Ie(){return(Ie=p((function*(t,e,i){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Ce((()=>{try{null==i||i(),t()}catch(t){s(t)}}),e)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Ae={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}},Fe=Ae.info,Me=0x8000000000000000,De={}.propertyIsEnumerable;function Ne(t,e){try{return je(t,e,{ancestors:new WeakSet,remainingNodes:N},0)}catch(t){return[]}}function Le(t,e,i,r){if(0>=i.remainingNodes)return{stringValue:U};if(i.remainingNodes--,ut(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>=Me||-Me>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:z(t)};if("function"==typeof t)return{stringValue:B};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:L};if(r>=M)return{stringValue:U};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?z(o):String(o)}}i.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Le(a.call(t),e,i,r+1)}catch(t){}return X(t)?{arrayValue:{values:Ue(t,e,i,r+1)}}:{kvlistValue:{values:je(t,e,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:z(String(t))}}function Ue(t,e,i,r){for(var s=[],n=Math.min(t.length,D),o=0;n>o&&i.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(ot(a))continue;s.push(Le(a,e,i,r))}catch(t){s.push({stringValue:j})}return t.length>o&&s.push({stringValue:U}),s}function je(t,e,i,r){var s=[];for(var n in t)if(De.call(t,n)){if(s.length>=D||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(nt(o)||it(o))continue;s.push({key:z(n),value:Le(o,e,i,r)})}catch(t){s.push({key:z(n),value:{stringValue:j}})}}return s}function Be(t){try{return z(String(t))}catch(t){return j}}function ze(t,e,i){var r=Ae[t.level||"info"]||Fe,s=r.text,n=r.number,o=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.windowId&&(a["window.id"]=e.windowId),ot(e.sessionStartTimestamp)||(a.sessionStartTimestamp=String(e.sessionStartTimestamp)),ot(e.lastActivityTimestamp)||(a.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=_({},a),u=t.attributes;if(u){var h=[];try{h=Object.keys(u)}catch(t){h=[]}for(var d of h){var v=void 0;try{v=u[d]}catch(t){v=j}Object.defineProperty(l,d,{value:v,enumerable:!0,writable:!0,configurable:!0})}}var c={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:Be(t.body)},attributes:Ne(l,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),it(t.trace_flags)||(c.flags=t.trace_flags),c}function qe(t,e,i){return _({},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":i})}function He(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ne(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Ve=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:ze(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=X(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 p((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return p((function*(){var e;t._n();var i=null!==(e=t._instance.getPersistedProperty(x.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=He(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(x.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}En(t){var e=this;return p((function*(){var i,r=Math.max(0,t-e.un),s=null!==(i=e._instance.getPersistedProperty(x.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(x.LogsQueue,s.slice(r)),yield e.sn()}))()}Tn(){return qe(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(x.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(x.LogsQueue,i),this.fn>i.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Ce((()=>{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(x.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return p((function*(){e._n();var i=e.flush().catch((()=>{}));void 0!==t?yield Oe(i,t):yield i}))()}flushWithTimeout(t){var e=this;return p((function*(){var i=e.flush();yield Oe(i,t,(()=>{i.catch((()=>{}))}))}))()}wn(){this.flush().then((()=>{this.hn=0}),(t=>{this.hn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())}))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var We=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ge(t){return String(t)+"000000"}function Ke(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 Je=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,e=this.ln,i=function(){var i=p((function*(){e&&(yield e.catch((()=>{}))),yield t.qn()}));return function(){return i.apply(this,arguments)}}(),r=i().finally((()=>{this.ln===r&&(this.ln=null)}));return this.ln=r,r}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 i,r;try{i=e.attributes?_({},e.attributes):void 0,r=Ke(e.type,e.name,e.unit,i)}catch(t){return void this.I.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var s=this.Fn.get(r);if(!s){if(!this.Bn())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.Fn.set(r,s)}var n=this.On.get(e.name);void 0===n?this.On.set(e.name,e.type):n===e.type||this.Dn.has(e.name)||(this.Dn.add(e.name),this.I.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(s,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(We.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,We)]+=1}}kn(t){var e=this.qi.beforeSend;if(!e)return t;var i=X(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=Ce((()=>{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 p((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),i=function(t,e,i){return _({},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":i})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ne(i)},scopeMetrics:[{scope:{name:r,version:s},metrics:e}]}]};var e,i,r,s}Wn(t){var e=Ge(Date.now()),i=new Map;for(var r of t.values()){var s,n=Ke(r.type,r.name,r.unit,void 0),o=i.get(n);o||(o=_({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},i.set(n,o));var a=Ne(null!==(s=r.attributes)&&void 0!==s?s:{},this.I),l=Ge(r.windowStartMs);if("count"===r.type){var u,h={attributes:a,startTimeUnixNano:l,timeUnixNano:e,asDouble:null!==(u=r.total)&&void 0!==u?u:0};o.sum.dataPoints.push(h)}else if("gauge"===r.type){var d,v={attributes:a,timeUnixNano:e,asDouble:null!==(d=r.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(v)}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:e,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:We})}return Array.from(i.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 Ye,Qe,Xe;function Ze(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Xe&&i.length===Qe||(Qe=i.length,Xe=i.reduce(((i,r)=>{Ye||(Ye={});var s=Ye[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,Ye[r]=[l,u];break}}return i}),{})),Xe}}class ti{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 e=this;return p((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&X(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.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 i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),_({},t,{cause:i,stack:r})}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 e=this;return p((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,_({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:Ze(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return _({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}}var ei="?";function ii(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?ei:i,in_app:!(null!=e&&e.startsWith("webkit-masked-url://"))&&"<anonymous>"!==e};return it(r)||(n.lineno=r),it(s)||(n.colno=s),n}var ri=(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]:ei,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},si=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ni=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oi=/\((\S*)(?::(\d+))(?::(\d+))\)/,ai=(t,e)=>{var i=si.exec(t);if(i)return ii(e,i[1],ei,+i[2],+i[3]);var r=ni.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=oi.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=ri(r[1]||ei,r[2]);return ii(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},li=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ui=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hi=(t,e)=>{var i=li.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ui.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]||ei,o=ri(n,s);return ii(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},di=/\(error: (.*)\)/;class vi{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=rt(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 ft(t,"DOMException")}isDOMError(t){return ft(t,"DOMError")}}class ci{match(t){return pt(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 fi{constructor(){}match(t){return!!ft(t,"ErrorEvent")&&(null!=t.error||this.fi(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);var r=e.apply(t.message);return _({},r,{stack:null!==(i=this.pi(t))&&void 0!==i?i:r.stack,synthetic:!0})}fi(t){return rt(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(rt(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var pi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _i{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(pi);return r&&(e=r[1],i=r[2]),[e,i]}}var gi=["fatal","error","warning","log","info","debug"];function mi(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 yi{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(_t(t))return t.constructor.name;var e="name"in t?t.name:void 0;return rt(e)&&!st(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: "+mi(t)}isSeverityLevel(t){return rt(t)&&!st(t)&&gi.indexOf(t)>=0}getStack(t){try{return rt(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:rt(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(pt(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class bi{match(t){return _t(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+mi(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class wi{match(t){return ct(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 Si{match(t){return ft(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!_t(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 ct(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 xi="$message",Ei="$timestamp",ki=new Set([xi,Ei]),Ti={enabled:!0,max_bytes:32768};function $i(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Ti.enabled,max_bytes:Ri(t.max_bytes,Ti.max_bytes)}:_({},Ti)}class Pi{constructor(t){this.Vn=[],this.Gn=0,this.qi=$i(t)}setConfig(t){this.qi=$i(t),this.Zn()}add(t){var e=function(t){var e;try{e=K(t)}catch(t){return}try{var i=JSON.parse(e);if(!tt(i))return;var r=i,s=r[xi],n=r[Ei];if(!rt(s)||0===s.trim().length)return;if(!rt(n)&&!at(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 Ri(t,e){if(!at(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Ci=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={F(i){if(t&&(c.DEBUG||t.POSTHOG_DEBUG||r)&&!it(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.F("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>Ci(e+" "+t,i)};return s},Oi=Ci("[PostHog.js]"),Ii=Oi.createLogger,Ai=Ii("[ExternalScriptsLoader]"),Fi=t=>{var e=null==r?void 0:r.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]},Mi=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Ai.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=Fi(e);if(s){if(s.__posthog_loading_callback_fired)return i();var n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,i(t)})))}var o=()=>{if(!r)return i("document not found");if(Fi(e))return Mi(t,e,i);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?o():null==r||r.addEventListener("DOMContentLoaded",o)},Di={},Ni=(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)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__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=Di[s];if("fallback"===r&&n){if(Fi(n))return void Mi(t,n,i);delete Di[s]}Mi(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)i(r);else{var o,a=Ni(t,e);Di[s]=a;var l=Fi(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Mi(t,a,i)}else i(void 0,n)}:i)}else Mi(t,Ni(t,e),i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Mi(t,o,i)}},v.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Mi(t,r,i)};c.DEBUG=!1,c.LIB_VERSION="1.419.2",c.LIB_NAME="web";var Li="$people_distinct_id",Ui="distinct_id",ji="$device_id",Bi="$device_model",zi="__alias",qi="__timers",Hi="$autocapture_disabled_server_side",Vi="$heatmaps_enabled_server_side",Wi="$exception_capture_enabled_server_side",Gi="$error_tracking_suppression_rules",Ki="$error_tracking_capture_extension_exceptions",Ji="$web_vitals_enabled_server_side",Yi="$dead_clicks_enabled_server_side",Qi="$product_tours_enabled_server_side",Xi="$web_vitals_allowed_metrics",Zi="$session_recording_remote_config",tr="$replay_sample_rate",er="$replay_override_sampling",ir="$replay_override_linked_flag",rr="$replay_override_url_trigger",sr="$replay_override_event_trigger",nr="$sesid",or="$session_is_sampled",ar="$enabled_feature_flags",lr="$active_feature_flags",ur="$early_access_features",hr="$feature_flag_details",dr="$feature_flag_payloads",vr="$feature_flag_request_id",cr="$minimal_flag_called_events",fr="$override_feature_flags",pr="$override_feature_flag_payloads",_r="$stored_person_properties",gr="$stored_group_properties",mr="$groups",yr="$surveys",br="$surveys_loaded_at",wr="$surveys_activated",Sr="$surveys_activated_session",xr="$surveys_activated_timestamps",Er="ph_product_tours",kr="$flag_call_reported",Tr="$flag_call_reported_session_id",$r="$feature_flag_errors",Pr="$feature_flag_evaluated_at",Rr="$user_state",Cr="$client_session_props",Or="$capture_rate_limit",Ir="$initial_campaign_params",Ar="$initial_referrer_info",Fr="$initial_person_info",Mr="$epp",Dr="$posthog_cookieless",Nr="$cookieless_mode",Lr="$sdk_debug_extensions_init_method",Ur="$sdk_debug_extensions_init_time_ms",jr="$sdk_debug_recording_script_not_loaded",Br="PostHog loadExternalDependency extension not found.",zr="on_reject",qr="always",Hr="anonymous",Vr="identified",Wr="identified_only",Gr="visibilitychange",Kr="beforeunload",Jr="$pageview",Yr="$pageleave",Qr="$identify",Xr="$groupidentify";function Zr(t,e){X(t)&&t.forEach(e)}function ts(t,e){if(!ot(t))if(X(t))t.forEach(e);else if(ht(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Y.call(t,i)&&e(t[i],i)}var es=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 is(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 rs=function(t){try{return t()}catch(t){return}},ss=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){Oi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Oi.critical(t)}}},ns=function(t){var e={};return ts(t,(function(t,i){(rt(t)&&t.length>0||at(t))&&(e[i]=t)})),e};var os=["herokuapp.com","vercel.app","netlify.app"];function as(t){var e=null==t?void 0:t.hostname;if(!rt(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of os)if(i===r)return!1;return!0}function ls(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 us(t){return"ph_toolbar_internal"===t.name}var hs=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.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 at(t)&&isFinite(t)&&Math.floor(t)===t});class ds{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 ds(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 ds(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 vs{generate(){var t=this.generateOrAbort();if(!it(t))return t;this.Rr=0;var e=this.generateOrAbort();if(it(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 ds.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 ps}}var cs,fs=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};t&&!it(t.crypto)&&crypto.getRandomValues&&(fs=t=>crypto.getRandomValues(t));class ps{nextUint32(){return this.ft.length>this.Fr||(fs(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var _s=()=>gs().toString(),gs=()=>(cs||(cs=new vs)).generate(),ms="",ys=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var bs={Nr:()=>!!r,jr(t){Oi.error("cookieStore error: "+t)},Pr:hs,Br(t){var e;try{e=JSON.parse(bs.Pr(t))||{}}catch(t){}return e},Dr(t,e,i,s,n){if(!r)return!1;try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),ms)return ms;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+_s();!ms&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",ms=o)}return ms}(t);if(!i){var s=(t=>{var e=t.match(ys);return e?e[0]:""})(t);s!==i&&Oi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Oi.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,!0}catch(t){return!1}},qr(t,e){if(null!=r&&r.cookie)try{bs.Dr(t,"",-1,e)}catch(t){return}}},ws=null,Ss={Nr(){if(!nt(ws))return ws;var e=!0;if(it(t))e=!1;else try{var i="__mplssupport__";Ss.Dr(i,"xyz"),'"xyz"'!==Ss.Pr(i)&&(e=!1),Ss.qr(i)}catch(t){e=!1}return e||Oi.error("localStorage unsupported; falling back to cookie store"),ws=e,e},jr(t){Oi.error("localStorage error: "+t)},Pr(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Ss.jr(t)}return null},Br(t){try{return JSON.parse(Ss.Pr(t))||{}}catch(t){}return null},Dr(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ss.jr(t)}return!1},qr(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Ss.jr(t)}}},xs=[_r,lr,ar,hr,dr,vr,Pr,$r,kr],Es=[ji,Ui,nr,or,Mr,Fr,Rr],ks=t=>t+"_cpm",Ts=["__proto__","constructor","prototype"],$s=t=>{if(!tt(t))return{};var e={};return Object.keys(t).forEach((i=>{-1===Ts.indexOf(i)&&(e[i]=t[i])})),e},Ps=function(t,e){void 0===e&&(e=[]);var i={};return[...Es,...e].forEach((e=>{var r=t[e];it(r)||nt(r)||""===r||(i[e]=r)})),i},Rs=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)},Cs=(t,e)=>({p:e,f:Rs(JSON.stringify(t))}),Os=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{var i=bs.Br(ks(t)),r=(null==i?void 0:i.f)===Rs(e)&&X(i.p);return{properties:r?i.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Is=(t,e)=>e+"|"+(bs.Pr(ks(t))||""),As={},Fs={Nr:()=>!0,jr(t){Oi.error("memoryStorage error: "+t)},Pr:t=>As[t]||null,Br:t=>As[t]||null,Dr:(t,e)=>(As[t]=e,!0),qr(t){delete As[t]}},Ms=null,Ds={Nr(){if(!nt(Ms))return Ms;if(Ms=!0,it(t))Ms=!1;else try{var e="__support__";Ds.Dr(e,"xyz"),'"xyz"'!==Ds.Pr(e)&&(Ms=!1),Ds.qr(e)}catch(t){Ms=!1}return Ms},jr(t){Oi.error("sessionStorage error: ",t)},Pr(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Ds.jr(t)}return null},Br(t){try{return JSON.parse(Ds.Pr(t))||null}catch(t){}return null},Dr(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Ds.jr(t)}return!1},qr(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Ds.jr(t)}}};class Ns{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===qr||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===zr}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 yt(t)?1:V(bt,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,e="localStorage"===t?Ss:bs;if(!this.ys||this.ys!==e){this.ys=e;var i="localStorage"===t?bs:Ss;i.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(yt(i.Pr(this.gs))),i.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,v.doNotTrack].some((t=>yt(t)))}}function Ls(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!Z(r))return e;try{var s=r(e);return rt(s)&&s?s:e}catch(t){return Oi.error("Error in get_current_url, falling back to window.location.href",t),e}}var Us="__POSTHOG_TOOLBAR__",js=1,Bs=3,zs=11;function qs(t){return t instanceof Element&&(t.id===Us||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Hs(t){return!!t&&t.nodeType===js}function Vs(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Ws(t){return!!t&&t.nodeType===Bs}function Gs(t){return!!t&&t.nodeType===zs&&Hs(t.host)}var Ks=1e3;function Js(t){return t?W(t).split(/\s+/):[]}function Ys(e,i){var r=function(e){var i,r=null==t||null==(i=t.location)?void 0:i.href;return it(r)?void 0:Ls(e,r)}(i);return!!(r&&e&&e.some((t=>r.match(t))))}function Qs(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 Js(e)}function Xs(t){return ot(t)?null:W(t).split(/(\s+)/).filter((t=>xn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Zs(t){var e="";return fn(t)&&!pn(t)&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var i;Ws(t)&&t.textContent&&(e+=null!==(i=Xs(t.textContent))&&void 0!==i?i:"")})),W(e)}function tn(t){var e;return it(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var en=["a","button","form","input","select","textarea","label"];function rn(t,e){if(it(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 sn(t){var e=t.parentNode;return!(!e||!Hs(e))&&e}var nn=[".ph-no-autocapture","[data-ph-no-autocapture]"],on=["next","previous","prev",">","<"],an=[...on,"+","-","−","–"],ln=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,un=[".ph-no-rageclick",".ph-no-capture"],hn=["","text","search","email","password","url","tel","number"];function dn(e,i){if(!t||vn(e))return!1;var r,s,n,o,a;if(ut(i)?(r=!!i&&un,s=void 0,n=!1):(r=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:un,s=null==i?void 0:i.content_ignorelist,n=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===r)return!1;if(n&&function(t){return!(!t||!Hs(t))&&(!!Vs(t,"textarea")||(Vs(t,"input")?V(hn,(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)))}(e))return!1;var l=cn(e,!1).targetElementList;return!function(t,e){if(!1===t||it(t))return!1;var i;if(!0===t)i=on;else{if(!X(t))return!1;if(t.length>10)return Oi.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=>ln(e,t)||ln(r,t)))}))}(s,l.map((t=>{var e;return{safeText:Zs(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!rn(l,r)}var vn=t=>!t||Vs(t,"html")||!Hs(t),cn=(e,i)=>{if(!t||vn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[e],n=e;n.parentNode&&!Vs(n,"body");)if(Gs(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=sn(n);if(!o)break;if(i||en.indexOf(o.tagName.toLowerCase())>-1)r=!0;else try{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}catch(t){}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function fn(t){for(var e=new Set,i=0,r=t;r.parentNode&&!Vs(r,"body");r=r.parentNode){if(i++>=Ks||e.has(r))return!1;e.add(r);var s=Qs(r);if(V(s,"ph-sensitive")||V(s,"ph-no-capture"))return!1}if(V(Qs(t),"ph-include"))return!0;var n=t.type||"";if(rt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!rt(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 pn(t){return!!(Vs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Vs(t,"select")||Vs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var _n=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}))$"),gn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,mn=[16,15,14,13],yn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),bn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),wn=/[0-9A-Za-z_]/;function Sn(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 xn(t,e){if(void 0===e&&(e=!0),ot(t))return!1;if(rt(t)){t=W(t);var i=e?_n.test((t||"").replace(/[- ]/g,"")):function(t){var e;for(gn.lastIndex=0;e=gn.exec(t);){var i=e[2];if(i)for(var r=i.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of mn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(_n.test(a)&&Sn(a))return!0}}}return!1}(t);if(i)return!1;var r=e?yn.test(t):function(t){var e;for(bn.lastIndex=0;e=bn.exec(t);){var i=e[1],r=e[3];if(!(i&&r&&wn.test(i)&&wn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function En(t){var e=Zs(t);return xn(e=(e+" "+kn(t)).trim())?e:""}function kn(t){var e="";return t&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Zs(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+kn(t)).trim())}catch(t){Oi.error("[AutoCapture]",t)}})),e}function Tn(t){return t.replace(/"|\\"/g,'\\"')}function $n(t){var e=t.attr__class;if(e)return X(e)?e:Js(e)}var Pn=Ii("[Dead Clicks]"),Rn=()=>!0,Cn=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Yi)),r=t.instance.config.capture_dead_clicks;return ut(r)?r:!!tt(r)||i};class On{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({[Yi]:e.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s((()=>{this.ws()})):this.stop()}_s(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Pn.error("failed to load script",e):t()}))}ws(){var t;if(r){if(!this.bs&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=tt(this.instance.config.capture_dead_clicks)?_({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.bs=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.bs.start(r),Pn.info("starting...")}}else Pn.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Pn.info("stopping..."))}}var In=Ii("[SegmentIntegration]");var An="posthog-js";function Fn(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,l=i.sendExceptionsToPostHog,u=void 0===l||l;return e=>{var i,o,l,h,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(i=e.exception)?void 0:i.values)||[],p=f.map((t=>_({},t,{stacktrace:t.stacktrace?_({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>_({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(o=f[0])?void 0:o.value)||e.message,$exception_type:null==(l=f[0])?void 0:l.type,$exception_level:e.level,$exception_list:p,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Mn{constructor(t,e,i,r,s,n){this.name=An,this.setupOnce=function(o){o(Fn(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Dn{constructor(t){this.ks=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Oi.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(e,i){var r,s=this.Ts(e,i);return this.Ss={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}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(!(it(n)||it(o)||it(a)||it(l)||it(u)||it(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?wt(o/n,0,1,Oi):1,v=n>1?wt(a/n,0,1,Oi):1,c=l>1?wt(u/l,0,1,Oi):1,f=l>1?wt(h/l,0,1,Oi):1;r=es(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 Nn=["flags","surveys"],Ln={[Li]:{exposure:"hidden"},[zi]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[qi]:{exposure:"hidden"},[Hi]:{exposure:"event"},[Vi]:{exposure:"hidden"},[Wi]:{exposure:"event"},[Gi]:{exposure:"hidden"},[Ki]:{exposure:"event"},[Ji]:{exposure:"event"},[Yi]:{exposure:"event"},[Qi]:{exposure:"hidden"},[Xi]:{exposure:"event"},[Zi]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[nr]:{exposure:"hidden"},[or]:{exposure:"event"},[tr]:{exposure:"event",shouldSkipFromEventProperties:t=>nt(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"},[ar]:{exposure:"hidden",storageGroup:"flags"},[lr]:{exposure:"hidden",storageGroup:"flags"},[ur]:{exposure:"hidden"},[hr]:{exposure:"hidden",storageGroup:"flags"},[dr]:{exposure:"hidden",storageGroup:"flags"},[vr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[cr]:{exposure:"hidden",storageGroup:"flags"},[fr]:{exposure:"hidden"},[pr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[yr]:{exposure:"hidden",storageGroup:"surveys"},[br]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[wr]:{exposure:"event"},[Sr]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Er]:{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"},[kr]:{exposure:"hidden"},[Tr]:{exposure:"hidden"},[mr]:{exposure:"event"},[$r]:{exposure:"hidden"},[Pr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Rr]:{exposure:"hidden"},[Cr]:{exposure:"hidden"},[Or]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Mr]:{exposure:"hidden"},[er]:{exposure:"event"},[ir]:{exposure:"event"},[rr]:{exposure:"event"},[sr]:{exposure:"event"},[Lr]:{exposure:"event"},[Ur]:{exposure:"event"},[jr]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_pending_trigger_conditions:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Un=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],jn=t=>{var e=Ln[t];if(e)return e;for(var i of Un){var r=i[1];if(0===t.indexOf(i[0]))return r}},Bn=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return K(t)}},zn=t=>{var e=null==r?void 0:r.createElement("a");return it(e)?null:(e.href=t,e)},qn=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(!X(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Oi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Hn=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("=");X(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},Vn=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Wn=(t,e)=>t>=e&&h(),Gn=(t,e,i,r)=>{if(0===t){if(h()){var s=e+1;return s===i&&r(),s}return e}return 0},Kn="https?://(.*)",Jn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Yn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Jn],Qn="<masked>",Xn=["li_fat_id"];function Zn(t,e,i){if(!r)return{};var s,n=e?[...Jn,...i||[]]:[],o=to(Hn(r.URL,n,Qn),t),a=(s={},ts(Xn,(function(t){var e=hs(t);s[t]=e||null})),s);return es(a,o)}function to(t,e){var i=Yn.concat(e||[]),r={};return ts(i,(function(e){var i=qn(t,e);r[e]=i||null})),r}function eo(t){var e=function(t){return t?0===t.search(Kn+"google.([^/?]*)")?"google":0===t.search(Kn+"bing.com")?"bing":0===t.search(Kn+"yahoo.com")?"yahoo":0===t.search(Kn+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!nt(e)){s.$search_engine=e;var n=r?qn(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function io(){return navigator.language||navigator.userLanguage}var ro="$direct";function so(){return(null==r?void 0:r.referrer)||ro}function no(t,e,i){void 0===i&&(i=!1);var r=t?[...Jn,...e||[]]:[],n=i?Re(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:so().substring(0,1e3),u:o?Hn(o,r,Qn):void 0}}function oo(t,e){var i;void 0===e&&(e=!1);var r=t.r,s=t.u,n=e?Re(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==ro?ro:null==(i=zn(r))?void 0:i.host};if(n){o.$current_url=n;var a=zn(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=to(n);es(o,l)}if(r){var u=eo(r);es(o,u)}return o}function ao(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function lo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var uo={flags:Pr,surveys:br},ho=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],vo=t=>t+"_cookie_identity_change_pending",co="main",fo=(t,e)=>{ts(t,((i,r)=>{var s=jn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,r)||delete t[r]}))};class po{constructor(e,i,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=e,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"})(e),this.ps=this.Os(e),this.Is=this.Ds(e),this.load(),e.debug&&Oi.info("Persistence loaded",e.persistence,_({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();ls(t,"beforeunload",s,{capture:!1}),ls(t,"pagehide",s,{capture:!1})}}$s(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return at(e)&&e>0?e:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var e=Ps(t,this.qi.cookie_persisted_properties||[]),i=Cs(e,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(e)+"|"+JSON.stringify(i),s=bs.Pr(this.Ls)||void 0;s&&Is(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=bs.Pr(this.Ls)||void 0;this.qs=n?Is(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=bs.Pr(this.Ls)||void 0}catch(t){}if(!i||i===this.js)return!1;var r,s=Is(this.Ls,i);try{r=$s(JSON.parse(i))}catch(t){return!1}if((bs.Pr(this.Ls)||void 0)!==i)return!1;this.qs=s,this.js=i;var n=Os(this.Ls,i),o=[...Es,...n.properties],a={};if(Object.keys(r).forEach((t=>{var e=r[t];(it(e)||nt(e)||""===e||t===Rr&&e!==Hr&&e!==Vr)&&(a[t]=!0,delete r[t])})),et(r))return!1;var l=Ui in r||r[Rr]===Hr||r[Rr]===Vr,u=this.props[Ui],h=this.props[Rr],d=es({},this.props);[...Es,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||t!==Ui&&t!==Rr)){var e=d[t];!n.isValid&&-1!==Es.indexOf(t)&&(!1===e||0===e)||delete d[t]}})),this.props=es(d,r),!l||Rr in r||Rr in this.props||this.Us(Rr,Hr);var v=this.props[Ui],c=this.props[Rr];return!l||v===u&&c===h||(this.Rs=!0,Ds.Dr(vo(this.Ls),!0),this.zs(_r),this.zs(lr),this.zs(ar),this.zs(hr),this.zs(dr),this.zs(vr),this.zs(Pr),this.zs($r),this.zs(kr),c===Hr&&(h===Vr||r[Rr]===Hr||!it(u)&&v!==u)&&(fo(this.props,r),this.zs(gr)),c===Vr?this.props.$user_id=v:delete this.props.$user_id,this.zs(zi)),!0}consumeCookieIdentityChange(){var t=vo(this.Ls),e=this.Rs||!!Ds.Pr(t);return this.Rs=!1,e&&Ds.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&&(it(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[co],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():it(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(e){-1===ho.indexOf(e.persistence.toLowerCase())&&(Oi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Es,...e];return _({},Ss,{Br(t){try{var e,s={};try{e=bs.Pr(t)||void 0,s=e?$s(JSON.parse(e)):{}}catch(t){}var n,o=JSON.parse(Ss.Pr(t)||"{}");if(i){var a=Os(t,e),l=[...Es,...a.properties],u={};Object.keys(s).forEach((t=>{var e=s[t];nt(e)||""===e||t===Rr&&e!==Hr&&e!==Vr||(u[t]=e)}));var h=Ui in u||u[Rr]===Hr||u[Rr]===Vr;if(Object.keys(u).length>0){var d,v=o[Ui],c=null!==(d=o[Rr])&&void 0!==d?d:Hr;r.forEach((t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(h||t!==Ui&&t!==Rr)){var e=o[t];!a.isValid&&-1!==Es.indexOf(t)&&(!1===e||0===e)||delete o[t]}})),!h||Rr in s||Rr in o||(o[Rr]=Hr),!h||(Ui in u?u[Ui]:o[Ui])===v&&(Rr in u?u[Rr]:o[Rr])===c||(xs.forEach((t=>delete o[t])),u[Rr]===Vr&&Ui in u?o.$user_id=u[Ui]:delete o.$user_id,u[Rr]!==Vr&&(delete o[mr],delete o[gr]),delete o.__alias)}n=es(o,u)}else n=es(s,o);return Ss.Dr(t,n),n}catch(t){}return null},Dr(t,r,s,n,o,a){var l=Ss.Dr(t,r,void 0,void 0,a);try{var u=Ps(r,e);if(Object.keys(u).length){if(i){var h=ks(t),d=Cs(u,e);if(bs.Dr(h,d,s,n,o,a),bs.Pr(h)!==JSON.stringify(d)){bs.qr(h,n);var v=Ps(r);return bs.Dr(t,v,s,n,o,a),l}}bs.Dr(t,u,s,n,o,a)}}catch(t){Ss.jr(t)}return l},qr(e,i){try{null==t||t.localStorage.removeItem(e),bs.qr(e,i),bs.qr(ks(e),i)}catch(t){Ss.jr(t)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Ss.Nr()?(i=Ss,s=!0):"localstorage+cookie"===n&&r.Nr()?(i=r,s=!0):"sessionstorage"===n&&Ds.Nr()?i=Ds:"memory"===n?i=Fs:"cookie"===n?i=bs:r.Nr()?(i=r,s=!0):i=bs,this.Es=s,i}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return ts(this.props,((e,i)=>{var r=jn(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?Ss.Br(this.Ls):null,r={};if(e)try{ts(r=$s(bs.Br(this.Ls)),((t,e)=>{(it(t)||nt(t)||""===t)&&delete r[e]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=es({},s)),this.Is&&this.Ks(),e&&s){var n,o,a=null==i?void 0:i[Ui],l=null!==(n=null==i?void 0:i[Rr])&&void 0!==n?n:Hr,u=s[Ui],h=null!==(o=s[Rr])&&void 0!==o?o:Hr;if(u!==a||h!==l){this.Rs=!0,Ds.Dr(vo(this.Ls),!0);var d=es({},this.props);xs.forEach((t=>delete d[t])),h===Hr&&(l===Vr||r[Rr]===Hr||!it(a)&&u!==a)&&(fo(d,r),delete d[gr]),this.props=d;var v=new Set;xs.forEach((t=>{var e,i=null==(e=jn(t))?void 0:e.storageGroup;i&&v.add(i)})),v.forEach((t=>{var e={};ts(this.props,((i,r)=>{var s;(null==(s=jn(r))?void 0:s.storageGroup)===t&&(e[r]=i)})),et(e)?(Ss.qr(this.Js(t)),this.Ms[t]={}):Ss.Dr(this.Js(t),e)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(e,t)})}))}}Ds.Pr(vo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of Nn){var e=Ss.Br(this.Js(t));if(e&&!et(e)){var i=this.Xs(t);i.persisted=!0,this.ta(t)||(i.fingerprint=this.Ys(e,t)),this.ea(t,e)||es(this.props,e)}}}ta(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=jn(e))?void 0:i.storageGroup)===t}))}ea(t,e){var i=uo[t];if(!i)return!1;var r=e[i],s=this.props[i];return at(r)&&at(s)&&s>r}refreshKey(t){var e;if(!this.Hs){var i=this.Is?null==(e=jn(t))?void 0:e.storageGroup:void 0,r=i?Ss.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?it(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){it(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,co)&&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,co)&&this.Ns(e),Nn)){var s,n=i[r];(!et(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(Ss,this.Js(r),n,r)}}na(){var t={},e={flags:{},surveys:{}};return ts(this.props,((i,r)=>{var s,n=null==(s=jn(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Ys(t,e){if(e===co)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var i={};return ts(t,((t,e)=>{var r;i[e]=null!=(r=jn(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}ra(t,e,i,r){var s,n=this.Xs(r);if(r!==co&&!n.dirty&&!it(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!==co&&(n.persisted=!0),it(s)||(n.fingerprint=s),!0):(this.qi.debug&&Oi.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(it(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 Nn)Ss.qr(this.Js(r));i?delete this.Ms[co]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if(tt(t)){this.syncCookieProperties(),it(e)&&(e="None"),this.sa=it(i)?this.la:i;var r=!1;if(ts(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(tt(t)){this.syncCookieProperties(),this.sa=it(e)?this.la:e;var i=!1;if(ts(t,((e,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==e||tt(e)||X(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==r?void 0:r.URL;if(t!==this.Fs){var e=Zn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);et(ns(e))||this.register(e),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?eo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:so(),$referring_domain:null!=r&&r.referrer&&(null==(t=zn(r.referrer))?void 0:t.host)||ro},void 0)}set_initial_person_info(){this.props[Ir]||this.props[Ar]||this.register_once({[Fr]:no(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={};ts([Ar,Ir],(e=>{var i=this.props[e];i&&ts(i,(function(e,i){t["$initial_"+G(i)]=e}))}));var e=this.props[Fr];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=oo(t,e),r={};return ts(i,(function(t,e){r["$initial_"+G(e)]=t})),r}(e,this.qi.disable_capture_url_hashes);es(t,i)}return t}safe_merge(t){return ts(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){var r=t.persistence!==e.persistence,s=!((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||[]),n=r||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.Hs&&!a;a||this.Bs(e,l),this.qi=t,!a&&(r||s||o)&&(this.qs=void 0,this.js=void 0,this.Bs(_({},t,{cookie_persisted_properties:e.cookie_persisted_properties}),l));var u=n||o?this.Os(t):this.ps,h=this.Ds(t),d=n||h!==this.Is,v=!a&&(d||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(l);try{if(this.la=this.sa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.ps=u,this.Is=h,this.props=c,this.save()}else o&&(this.ps=u,a||(delete this.Ms[co],this.Zs()))}finally{v&&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[qi]||{};i[t]=e,this.Us(qi,i),this.save()}remove_event_timer(t){var e=this.props[qi]||{},i=e[t];return it(i)||(delete e[t],this.Us(qi,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=jn(t))&&i.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var e,i=null==(e=jn(t))?void 0:e.storageGroup;i&&(this.Xs(i).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function _o(t){var e=!0;return{dispose(){if(e){e=!1;var i=t();i&&Z(i.then)&&i.then(void 0,(()=>{}))}}}}var go={GZipJS:"gzip-js",Base64:"base64"},mo={Activation:"events",Cancellation:"cancelEvents"},yo={Button:"button",Tab:"tab",Selector:"selector"},bo={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"},wo={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},So={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},xo={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Eo={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},ko={Once:"once",Recurring:"recurring",Always:"always"},To={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"},Po={Popover:"popover",Inline:"inline"},Ro={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},Co={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"},Oo={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"},Io=Ii("[RateLimiter]");class Ao{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=>{Io.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Io.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text: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(Or))&&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=(at(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(Or,a),{isRateLimited:l,remainingTokens:a.tokens}}da(t){var e=this.instance.config.property_denylist;return!X(e)||!e.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.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 Fo=Ii("[RemoteConfig]");class Mo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=v.__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 Fo.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void Fo.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return Fo.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){Fo.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&r&&"hidden"!==r.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||Fo.warn("Failed to fetch remote config from PostHog."):Fo.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){Fo.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){Fo.error("Error loading feature flags",t)}}}var Do=["fatal","error","warning","log","info","debug"],No=Uint8Array,Lo=Uint16Array,Uo=Uint32Array,jo=new No([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Bo=new No([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),zo=new No([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qo=function(t,e){for(var i=new Lo(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Uo(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]},Ho=qo(jo,2),Vo=Ho[1];Ho[0][28]=258,Vo[258]=28;for(var Wo=qo(Bo,0)[1],Go=new Lo(32768),Ko=0;32768>Ko;++Ko){var Jo=(43690&Ko)>>>1|(21845&Ko)<<1;Go[Ko]=((65280&(Jo=(61680&(Jo=(52428&Jo)>>>2|(13107&Jo)<<2))>>>4|(3855&Jo)<<4))>>>8|(255&Jo)<<8)>>>1}var Yo=function(t,e,i){for(var r=t.length,s=0,n=new Lo(e);r>s;++s)++n[t[s]-1];var o,a=new Lo(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Lo(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[Go[d]>>>l]=u}else for(o=new Lo(r),s=0;r>s;++s)o[s]=Go[a[t[s]-1]++]>>>15-t[s];return o},Qo=new No(288);for(Ko=0;144>Ko;++Ko)Qo[Ko]=8;for(Ko=144;256>Ko;++Ko)Qo[Ko]=9;for(Ko=256;280>Ko;++Ko)Qo[Ko]=7;for(Ko=280;288>Ko;++Ko)Qo[Ko]=8;var Xo=new No(32);for(Ko=0;32>Ko;++Ko)Xo[Ko]=5;var Zo=Yo(Qo,9,0),ta=Yo(Xo,5,0),ea=function(t){return(t/8>>0)+(7&t&&1)},ia=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Lo?Lo:t instanceof Uo?Uo:No)(i-e);return r.set(t.subarray(e,i)),r},ra=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},sa=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},na=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 No(0),0];if(1==s){var o=new No(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 Lo(v+1),f=oa(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 No(c),f]},oa=function(t,e,i){return-1==t.s?Math.max(oa(t.l,e,i+1),oa(t.r,e,i+1)):e[t.s]=i},aa=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Lo(++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]},la=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},ua=function(t,e,i){var r=i.length,s=ea(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)},ha=function(t,e,i,r,s,n,o,a,l,u,h){ra(e,h++,i),++s[256];for(var d=na(s,15),v=d[0],c=d[1],f=na(n,15),p=f[0],_=f[1],g=aa(v),m=g[0],y=g[1],b=aa(p),w=b[0],S=b[1],x=new Lo(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=na(x,7),T=k[0],P=k[1],R=19;R>4&&!T[zo[R-1]];--R);var C,O,I,A,F=u+5<<3,M=la(s,Qo)+la(n,Xo)+o,D=la(s,v)+la(n,p)+o+14+3*R+la(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&D>=F)return ua(e,h,t.subarray(l,l+u));if(ra(e,h,1+(M>D)),h+=2,M>D){C=Yo(v,c,0),O=v,I=Yo(p,_,0),A=p;var N=Yo(T,P,0);for(ra(e,h,y-257),ra(e,h+5,S-1),ra(e,h+10,R-4),h+=14,E=0;R>E;++E)ra(e,h+3*E,T[zo[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)ra(e,h,N[B=31&j[E]]),h+=T[B],B>15&&(ra(e,h,j[E]>>>5&127),h+=j[E]>>>12)}}else C=Zo,O=Qo,I=ta,A=Xo;for(E=0;a>E;++E)if(r[E]>255){var B;sa(e,h,C[257+(B=r[E]>>>18&31)]),h+=O[B+257],B>7&&(ra(e,h,r[E]>>>23&31),h+=jo[B]);var z=31&r[E];sa(e,h,I[z]),h+=A[z],z>3&&(sa(e,h,r[E]>>>5&8191),h+=Bo[z])}else sa(e,h,C[r[E]]),h+=O[r[E]];return sa(e,h,C[256]),h+O[256]},da=new Uo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),va=function(){for(var t=new Uo(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),ca=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function fa(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=va[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 No(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=ua(l,u,t.subarray(h,d)):(l[h]=!0,u=ua(l,u,t.subarray(h,o)))}else{for(var v=da[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new Lo(32768),g=new Lo(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 Uo(25e3),S=new Lo(288),x=new Lo(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=ha(t,l,0,w,S,x,k,T,R,h-R,u),T=E=k=0,R=h;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[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|Vo[M]<<18|Wo[D];var G=31&Vo[M],K=31&Wo[D];k+=jo[G]+Bo[K],++S[257+G],++x[K],P=h+M,++E}else w[T++]=t[h],++S[t[h]]}}u=ha(t,l,!0,w,S,x,k,T,R,h-R,u)}return ia(a,0,r+ea(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&&ca(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),ca(u,h-8,i.d()),ca(u,h-4,r),u}var pa=!!o||!!n,_a="text/plain",ga=!1,ma=(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:"")},ya=function(t,e,i){var r;void 0===i&&(i=!0);var s=t.split("?"),n=s[0],o=s[1],a=_({},e),l=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return ts(t,(function(t,e){it(t)||it(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)}(a);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},ba=t=>{if(t.ba)return t.ba;var e=t.data,i=t.compression;if(e){if(i===go.GZipJS){var r=fa(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new No(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new No(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 ia(r,0,s)}(Bn(e)),{mtime:0});return{contentType:_a,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===go.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Bn(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Bn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Bn(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},wa=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:ya(t.url,{compression:go.Base64}),encodedBody:ba(_({},t,{compression:go.Base64,ba:void 0}))}:{url:ma(t.url,"compression"),encodedBody:ba(_({},t,{compression:void 0,ba:void 0}))};try{e=ba(t)}catch(e){if(C(t.compression,qn(t.url,"compression")))return Oi.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&C(t.compression,qn(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?R(new Uint8Array(i)):ArrayBuffer.isView(i)&&R(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(ga=!0,r()):{url:t.url,encodedBody:e}},Sa=t=>{try{return wa(t)}catch(e){return Oi.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},xa=function(){var t=p((function*(t){var e=Bn(t.data),i=yield function(t,e,i){return F.apply(this,arguments)}(e,c.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return _({},t,{ba:{contentType:_a,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Ea=/Failed to fetch|NetworkError|Load failed/i,ka=t=>"TypeError"===(null==t?void 0:t.name)&&Ea.test((null==t?void 0:t.message)||""),Ta=t=>{var e=Sa(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,u=s.estimatedSize,h=new Headers;ts(t.headers,(function(t,e){h.append(e,t)})),o&&h.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e,i;v=!0,c.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i))}),t.timeout)}}var f=e=>{v&&"AbortError"===(null==e?void 0:e.name)||ka(e)?Oi.warn(e):Oi.error(e),null==t.callback||t.callback({statusCode:0,error:e})};try{var p;n(i,_({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t._a&&52428.8>(u||0),body:l,signal:null==(p=d)?void 0:p.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){Oi.error(t)}null==t.callback||t.callback(r)})))).catch(f).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),f(t)}}},$a=t=>{try{var e,r=wa(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(i.sendBeacon(s,u))return;var h=X(t.data)?t.data:null==(e=t.data)?void 0:e.batch;if(X(h)&&h.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(h.length/2),v=e=>X(t.data)?e:_({},t.data,{batch:e});return $a(_({},t,{data:v(h.slice(0,d))})),void $a(_({},t,{data:v(h.slice(d))}))}Oi.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ta(_({},t,{_a:!0}))}catch(t){Oi.warn("Beacon send failed",t)}},Pa=(t,e,i,r)=>{var s="query"===r?"POST"===e?"sent_at":"_":void 0;return ya(i===go.GZipJS?ma(t,"compression"):t,_({},s?{[s]:Date.now().toString()}:{},i===go.GZipJS?{}:{compression:i}))},Ra=[];n&&Ra.push({transport:"fetch",method:Ta}),o&&Ra.push({transport:"XHR",method(t){var e=Sa(t);if(e){var i=new o,r=e.encodedBody;i.open(t.method||"GET",e.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;ts(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(a)}}}),null!=i&&i.sendBeacon&&Ra.push({transport:"sendBeacon",method:$a});var Ca=3e3;class Oa{constructor(t,e){this.wa=!0,this.ka=[],this.Sa=wt((null==e?void 0:e.flush_interval_ms)||Ca,250,5e3,Oi.createLogger("flush interval"),Ca),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(_({},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&&X(i.data)&&ts(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){Oi.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return ts(this.ka,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;it(t[s])&&(t[s]=_({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.ka=[],t}}var Ia=["retriesPerformedSoFar"];class Aa{constructor(e){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=e,this.ka=[],this.Aa=!0,!it(t)&&"onLine"in t.navigator&&(this.Aa=t.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},ls(t,"online",this.Fa),ls(t,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=g(t,Ia);lt(e)&&(i.url=ya(i.url,{retry_count:e})),this._instance._send_request(_({},i,{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(_({retriesPerformedSoFar:e},i));0===t.statusCode&&Oi.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==i.callback||i.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)"),Oi.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 e of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,it(t)||(this.Fa&&(t.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(t.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var i=e.requestOptions;try{this._instance._send_request(_({},i,{transport:"sendBeacon"}))}catch(t){Oi.error(t)}}this.ka=[]}}class Fa{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(){ls(t,"scroll",this.Na,{capture:!0}),ls(t,"scrollend",this.Na,{capture:!0}),ls(t,"resize",this.Na)}scrollElement(){if(!this.ja)return null==t?void 0:t.document.documentElement;var e=X(this.ja)?this.ja:[this.ja];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}Ba(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var Ma=t=>no(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 Da{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({[Cr]:i})}},this._instance=t,this.Wa=e,this.za=i,this.Ua=r||Ma,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[Cr]}getSetOnceProps(){var t,e=null==(t=this.Ha())?void 0:t.props;return e?"r"in e?oo(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 ts(ns(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+G(i)]=e})),t}}class Na{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 La=Ii("[SessionId]"),Ua=864e5;class ja{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 Na,this.Xa=(t,e)=>!(!lt(t)||!lt(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===qr)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||_s,this.ro=i||_s;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*wt(this.qi.session_idle_timeout_seconds||1800,60,36e3,La.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=Ds.Br(this.so),o=Ds.Br(this.ao);n&&!o?this.st=n:Ds.qr(this.so),Ds.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 it(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&&Ds.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Ds.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Ds.Br(this.so):null}do(t){var e=this.Za;return!nt(e)&&!nt(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({[nr]:[e,t,i]}))}co(){var t,e=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return lt(e)&&e>0}fo(){this.co()?this.za.refreshKey(nr):(this.za.flush(),this.za.load())}po(){var t;if(!nt(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({[nr]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],e=lt(t)?t:0,i=lt(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[nr];return X(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 La.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void La.error("Invalid sessionID in bootstrap",t)}}(t);return!it(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&&t&&(t.removeEventListener(Kr,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Ds.qr(this.ao)},ls(t,Kr,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===qr)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(nt(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=!it(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ua),p=c?f:lt(u)&&Math.abs(r-u)>Ua,_=!1,g=h,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||La.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 S=c&&!f;l=S?c.sessionId:this.io(),v=this.ro(),La.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),u=S?c.sessionStartTimestamp:r,this.eo=void 0,_=!0}else v||(v=this.ro(),_=!0),(g=g||l!==y)&&(La.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var x=lt(d)&&t&&!p?d:r,E=lt(u)?u:(new Date).getTime();this.uo(v),this.vo(l,x,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 Ba=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&H(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>H(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver};function za(){return(za=p((function*(){var t=null==i?void 0:i.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return rt(r)&&r.length>0?r:void 0}catch(t){return void Oi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function qa(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var Ha=(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}},Va=t=>t.toLowerCase(),Wa={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=>Ha(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ha(e,t))))),icontains:(t,e)=>e.map(Va).some((e=>t.map(Va).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Va).every((e=>t.map(Va).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 Ga(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=Wa[i.operator];return!!s&&s(i.values,[String(r)])}))}function Ka(t,e,i){return Bn({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Ja="custom",Ya="i.posthog.com",Qa=/^\/static\//,Xa=["/s/","/e/","/i/"];class Za{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("."+Ya,".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":Ja),this.wo[this.apiHost]}ko(t){if(Qa.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}So(t){var e=zn(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=zn(i))?void 0:n.href)||i;r=s(new URL(o)).toString()}if(s&&"api"===t&&Xa.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===Ja)return this.xo(t,e,this.apiHost+e);var r=Ya+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 tl=Ii("[Surveys]"),el="seenSurvey_",il=t=>{try{var e=(t=>((t,e)=>""+el+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){tl.error("Failed to persist survey seen state",t)}},rl=[So.Popover,So.Widget,So.API],sl={ignoreConditions:!1,ignoreDelay:!1,displayType:Po.Popover},nl=Ii("[PostHog ExternalIntegrations]"),ol={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class al{constructor(t){this._instance=t}_s(t,e){var i;null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return nl.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=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t._s(ol[n],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)})),!o&&null!=(r=v.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=v.__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 ll{constructor(t,e){this.I=t,this.ns=e,this.To=new Map,this.Xn=!1}add(t){var e=this;return p((function*(){if(e.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');e.To.set(t.name,t);try{var i=t.setup(e.ns);i&&(yield i)}catch(i){var r=e.To.get(t.name)===t;r&&e.To.delete(t.name),e.I.error('Failed to set up browser extension "'+t.name+'"',i),r&&e.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var e of(this.To.clear(),t))this.Mo(e)}}Mo(t){try{var e=null==t.dispose?void 0:t.dispose();e&&Z(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 ul{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);it(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 hl="extensionsRemoteConfig";class dl{constructor(t){this.Xn=!1,this.instance=t,this.I=Oi,this.Eo=t.Io,this.kv=new ul(t),this.onEvent=t=>_o(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 _o((()=>{}));var e=e=>{try{t(e)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},i=this.instance.Ro.on(hl,e);return this.Eo&&e(this.Eo),_o(i)},this.Po=new ll(Oi.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(ji))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(ji);return"string"==typeof t?t:void 0}get library(){return{name:c.LIB_NAME,version:c.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,e,i){var r=this;return p((function*(){i?r.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):r.instance.capture(t,e)}))()}registerDynamicEventProperties(t){return _o(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(hl,t))}sendRequest(t,e){var i=this;return p((function*(){var r;void 0===e&&(e={});var s=i.instance.requestRouter.endpointFor(null!==(r=e.target)&&void 0!==r?r:"api",t),n={method:e.method,url:e.query?ya(s,e.query):s,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt};return"sendBeacon"===e.transport?(i.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,i.instance._send_request(n)}))}))()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var vl={},cl=0,fl=()=>{},pl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',_l="Surveys module not available",gl="sanitize_properties is deprecated. Use before_send instead",ml="Invalid value for property_denylist config: ",yl=["token","distinct_id",Nr],bl="posthog",wl=!pa&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),Sl=e=>{var i;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:as(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:fl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&rt(null==s?void 0:s.search)&&-1!==s.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==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Oi.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:Wr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Ca},error_tracking:{},_onCapture:fl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:an,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)}))(e))},xl=[["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"]],El=t=>{var e={};for(var i of xl){var r=i[0],s=i[1];it(t[r])||(e[s]=t[r])}var n=es({},e,t),o=t.__preview_external_dependency_versioned_paths;return it(o)||(it(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),rt(o)&&it(t.asset_host)&&(n.asset_host=o)),X(t.property_blacklist)&&(it(t.property_denylist)?n.property_denylist=t.property_blacklist:X(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Oi.error(ml+t.property_denylist)),n};class kl{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){Oi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Tl{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===qr||this.config.cookieless_mode===zr&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===Dr){var t=this.persistence;if(t){this.$o()||t.load(!0);var e=this.get_distinct_id();if(!e||e===Dr){var i=this.config.get_device_id(_s());this.register({distinct_id:i,$device_id:i}),t.set_property(Rr,Hr)}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 kl,this.qo=!1,this.version=c.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new Na,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Sl(),this.SentryIntegration=Mn,this.sentryIntegration=t=>function(t,e){var i=Fn(t,e);return{name:An,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 Fa(this),this.pageViewManager=new Dn(this),this.rateLimiter=new Ao(this),this.requestRouter=new Za(this),this.consent=new Ns(this),this.externalIntegrations=new al(this);var e=null!==(t=Tl.__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=rt(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=rt(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Oi.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==bl){var r,s=null!==(r=vl[i])&&void 0!==r?r:new Tl;return s._init(t,e,i),vl[i]=s,vl[bl][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o,a=rt(e)?e.trim():"";if(!a)return Oi.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 a!==(null==(o=this.config)?void 0:o.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('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Sl(i.defaults),i.debug=this.Go(i.debug),this.Zo=i,this.Qo=[],i.person_profiles?this.Wo=i.person_profiles:i.process_person&&(this.Wo=i.process_person);var l=Sl(i.defaults),u=El(i),h=es({},l,u,{name:r,token:a});tt(l.rageclick)&&tt(u.rageclick)&&(h.rageclick=es({},l.rageclick,u.rageclick)),tt(l.session_recording)&&tt(u.session_recording)&&(h.session_recording=es({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&Oi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:go.GZipJS;var d=this.$o();if(this.persistence=new po(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(_({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Ds.Nr()){var v=Ds.Br(this.Bo);X(v)&&v.forEach((t=>{rt(t)&&this.jo.add(t)}))}else Ds.qr(this.Bo);var f=_({},this.persistence.props),p=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new Oa((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new Aa(this),this.__request_queue=[];var g=this.Oo();if(g||(this.sessionManager=new ja(this),this.sessionPropsManager=new Da(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?(Oi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(g)}),0)):(Oi.info("Initializing extensions synchronously"),this.el(g)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Oi.info("Starting in debug mode",{this:this,config:i,thisC:_({},this.config),p:f,s:p}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=_({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var m=i.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Rr);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Hr)this.identify(m);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Vr)Oi.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(_s()),S=i.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Rr,i.bootstrap.isIdentifiedID?Vr:Hr),this.register({distinct_id:m,$device_id:S})}}if(g)this.register_once({distinct_id:Dr,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(_s());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(Rr,Hr)}return ls(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.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()||_s();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Rr,Vr)),e()},s=i.user();"then"in s&&Z(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||In.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()||(In.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(In.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,Jr),identify:t=>e(t,Qr),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.il())):this.il(),Z(this.config._onCapture)&&this.config._onCapture!==fl&&(Oi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Oi.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return za.apply(this,arguments)}().then((t=>{t&&this.register({[Bi]:t})})).catch(fl),this}rl(t){var e=t;return rt(e.name)&&Z(e.setup)}nl(t,e){this.rl(t)?e.push((()=>{this.sl().add(t).catch(fl)})):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=Tl.__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)),Z(this.featureFlags.onReloading)&&Z(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,i,r,s,n,o,a,l=performance.now(),u=_({},Tl.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.exceptions&&this.To.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.To.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.To.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.To.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.To.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.nl(this.autocapture=new u.autocapture(this),h),u.surveys&&this.nl(this.surveys=null!==(i=this.surveys)&&void 0!==i?i:new u.surveys(this),h),u.logs&&this.To.push(this.logs=null!==(r=this.logs)&&void 0!==r?r:new u.logs(this)),u.metrics&&this.To.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new u.metrics(this)),u.conversations&&this.To.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.To.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.To.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.To.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Cn)),u.toolbar&&this.To.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.To.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.To.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.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(h,l)}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){Oi.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Lr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ur]:r}),this.config.__preview_deferred_init_extensions&&Oi.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var e;if(!r||!r.body)return Oi.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,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=V(s.supportedCompression,go.GZipJS)?go.GZipJS:V(s.supportedCompression,go.Base64)?go.Base64:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:Wr}),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){Oi.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.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 Mo(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()&&Zr(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(Yr),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(Yr,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?wl?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=_({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(it(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,i,r,s=_({},t);s.timeout=s.timeout||6e4;var n,o,a,u,h,d=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===d&&it(s.compression)&&s.data&&(s.compression=go.Base64),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(h=(u=(X(n=s.data)?n:[n]).map((t=>_({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=h.properties)?void 0:a.token)&&void 0!==o?o:null==h?void 0:h.token,batch:u,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,e){return void 0===e&&(e=(new Date).toISOString()),X(t)?t.map((t=>_({},t,{sent_at:e}))):_({},t,{sent_at:e})}(s.data))),s.url=Pa(s.url,s.method,s.compression,s.timestampMode);var v=Ra.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===d)return t[i]}(v))?void 0:r.method)&&void 0!==i?i:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){ka(t)?Oi.warn(t):Oi.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===go.GZipJS&&l&&"undefined"!=typeof Promise&&!ga?xa(s).then((t=>{f(t)})).catch((e=>{if(O(e))return ga=!0,void f(_({},s,{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 O(t)||e===P})(e)&&(ga=!0),f(s)})):c(s)})(_({},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){cl++;try{var e,i=[],r=[],s=[];Zr(t,(t=>{if(t)if(X(e=t[0]))s.push(t);else if(Z(t))try{t.call(this)}catch(e){Oi.error("Error executing queued PostHog call",t,e)}else X(t)&&"alias"===e?i.push(t):X(t)&&-1!==e.indexOf("capture")&&Z(this[e])?s.push(t):r.push(t)}));var n=function(t,e){Zr(t,(function(t){try{if(X(t[0])){var i=e;ts(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){Oi.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{cl--}}push(t){if(cl>0&&X(t)&&rt(t[0])){var e=Tl.prototype[t[0]];Z(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!it(t)&&rt(t)){this.Do();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!rt(null==e?void 0:e.$current_url)&&(Oi.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!=i&&i.fl||Oi.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 h=new Date,d=(null==i?void 0:i.timestamp)||h,v=Pe(null==i?void 0:i.uuid,_s),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===Jr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var f="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(cr);(null==i?void 0:i.$set)&&!f&&(c.$set=null==i?void 0:i.$set);var p=null==i?void 0:i.$unset;p&&(c.$unset=p);var g,m,y,b=f?void 0:this.pl(null==i?void 0:i.$set_once,t!==Xr,t===Qr);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>rt(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),X(e))r=[],Zr(e,(e=>{r.push(t(e))}));else{var s={};ts(e,((e,i)=>{a.has(e)||(s[i]=t(e,i))})),r=s}return r}}(n)),c.timestamp=d,it(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),f&&(c.properties=function(t,e){void 0===e&&(e=[]);var i={},r=e=>{void 0!==t[e]&&(i[e]=t[e])};return S.forEach(r),e.forEach(r),i}(c.properties,yl)),t===To.DISMISSED||t===To.SENT){var w=null==e?void 0:e[$o.SURVEY_ID],x=null==e?void 0:e[$o.SURVEY_ITERATION];il({id:w,current_iteration:x}),c.$set=_({},c.$set,{[(g={id:w,current_iteration:x},m=t===To.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===To.SHOWN&&(c.$set=_({},c.$set,{[$o.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Co.SHOWN){var E=null==e?void 0:e[Oo.TOUR_TYPE];E&&(c.$set=_({},c.$set,{[Oo.TOUR_LAST_SEEN_DATE+"/"+E]:(new Date).toISOString()}))}var k=_({},c.properties.$set,c.$set);if(et(k)||this.setPersonPropertiesForFlags(k),!ot(this.config.before_send)){var T=this.kn(c);if(!T)return;(c=T).uuid=Pe(c.uuid,_s)}this.Ro.emit("eventCaptured",c);var P=null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),R={method:"POST",url:P,data:c,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(P)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Ko(R):this.Jo.enqueue(R),c}Oi.critical("This capture call is ignored due to client rate limiting.")}}else Oi.error("No event name provided to posthog.capture")}else Oi.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 dl(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(Rr)===Hr&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(i=this.featureFlags)||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gl();var l=a?void 0:this.persistence.remove_event_timer(e),h=_({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Oo()&&(h[Nr]=!0),"$snapshot"===e){var d=_({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!rt(h.distinct_id)&&!at(h.distinct_id)||st(h.distinct_id))&&Oi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var v,f=function(e,i,r,n){var o,a,l,h;if(void 0===n&&(n=!1),!u)return{};var d,v=e?[...Jn,...i||[]]:[],f=function(t){for(var e=0;ke.length>e;e++){var i=ke[e],r=i[1],s=i[0].exec(t),n=s&&(Z(r)?r(s,t):r);if(n)return n}return["",""]}(u),p=f[0],_=f[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};it(r)||(m.detectGoogleSearchApp=r);var y={},b=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,w=null==(a=navigator)?void 0:a.maxTouchPoints,S=null==t||null==(l=t.screen)?void 0:l.width,x=null==t||null==(h=t.screen)?void 0:h.height,E=null==t?void 0:t.devicePixelRatio;it(b)||(y.userAgentDataPlatform=b),it(w)||(y.maxTouchPoints=w),it(S)||(y.screenWidth=S),it(x)||(y.screenHeight=x),it(E)||(y.devicePixelRatio=E);var k,T,P,R,C,O,I,A,F=es(ns({$os:p,$os_version:_,$browser:Se(u,navigator.vendor,g,m),$device:Te(u),$device_type:(T=u,P=y,A=Te(T),A===Pt||A===$t||"Kobo"===A||"Kindle Fire"===A||A===se?Tt:A===Gt||A===Jt||A===Kt||A===ee?"Console":A===Ct?"Wearable":A?xt:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(R=null==P?void 0:P.maxTouchPoints)&&void 0!==R?R:0)>0?600>Math.min(null!==(C=null==P?void 0:P.screenWidth)&&void 0!==C?C:0,null!==(O=null==P?void 0:P.screenHeight)&&void 0!==O?O:0)/(null!==(I=null==P?void 0:P.devicePixelRatio)&&void 0!==I?I:1)?xt:Tt:"Desktop"),$timezone:ao(),$timezone_offset:lo()}),{$current_url:Hn(n?Re(null==s?void 0:s.href):null==s?void 0:s.href,v,Qn),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Ee(u,navigator.vendor,g,m),$browser_language:io(),$browser_language_prefix:(k=io(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:c.LIB_NAME,$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return c.SDK_DIST_CHANNEL&&(F.$sdk_dist_channel=c.SDK_DIST_CHANNEL),F}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),g=p.windowId;h.$session_id=p.sessionId,h.$window_id=g}this.sessionPropsManager&&es(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&es(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Yo)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Ja&&(h.$lib_custom_api_host=this.config.api_host),v=e!==Jr||a?e!==Yr||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=es(h,v),e===Jr&&r&&(h.title=r.title),!it(l)){var y=n.getTime()-l;h.$duration=parseFloat((y/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties();ts(["$referrer","$referring_domain"],(t=>{t in b&&delete w[t]}));var S={};if(this.Ho.length>0)for(var x of this.Ho.slice())try{es(S,x())}catch(t){Oi.error("Failed to produce browser extension event properties",t)}(h=es({},f,b,w,_({},S,h))).$is_identified=this._isIdentified(),X(this.config.property_denylist)?ts(this.config.property_denylist,(function(t){delete h[t]})):Oi.error(ml+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(Oi.error(gl),h=E(h,e));var k=this.yl();return h.$process_person_profile=k,k&&!a&&this.bl("_calculate_event_properties"),h}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=es({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Oi.error(gl),o=a(o,"$set_once")),e&&(this.qo=!0),et(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||!Ds.Nr())Ds.qr(this.Bo);else{var e=[];this.jo.forEach((t=>e.push(t))),e.length>0?Ds.Dr(this.Bo,e):Ds.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:_l}),()=>{})}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:_l})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:_l})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=sl),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:_l}}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:_l})}wl(t){return!t||st(t)?(Oi.critical("Unique user id has not been set in posthog.identify"),!1):t===Dr?(Oi.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())||(Oi.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 Oi.uninitializedWarning("posthog.identify");if(at(t)&&(t=t.toString(),Oi.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(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(ji)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(zi)&&(this.unregister(zi),this.register({distinct_id:t}));var u,h=(this.persistence.get_property(Rr)||Hr)===Hr,d=t!==l,v=!d&&h;if(d&&h)this.persistence.set_property(Rr,Vr),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(Qr,{distinct_id:t,$anon_distinct_id:l},{$set:e||{},$set_once:i||{}}),this.Vo=Ka(t,e,i),null==(u=this.featureFlags)||u.setAnonymousDistinctId(l);else if(v){this.persistence.set_property(Rr,Vr);var c=e||{},f=i||{};this.setPersonPropertiesForFlags({$set:c,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:c,$set_once:f}),this.Vo=Ka(t,e,i)}else(e||i)&&this.setPersonProperties(e,i);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(kr)):v&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Qs(a)}}}setPersonProperties(t,e){if((t||e)&&this.bl("posthog.setPersonProperties")){var i=Ka(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):Oi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(X(t)?t:[t]).filter((t=>rt(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,i){var r;if(t&&e){null==(r=this.persistence)||r.syncCookieProperties(),this.gl();var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:_({},s,{[t]:e})}),n||i){var o={$group_type:t,$group_key:e};i&&(o.$group_set=i),this.capture(Xr,o)}i&&this.setGroupPropertiesForFlags({[t]:i}),n&&!i&&this.reloadFeatureFlags()}else Oi.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=ut(t)?t:null==t?void 0:t.resetDeviceID,i=ut(t)||null==t?void 0:t.bootstrap;this.kl(e,!1,i)}kl(t,e,i){var r,s,n;if(void 0===e&&(e=!1),Oi.info("reset"),!this.__loaded)return Oi.uninitializedWarning("posthog.reset");var o=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null==(r=this.Zo)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.ma());var a=this.get_property(ji),l=this.get_property(Bi),u=this.get_property(Zi),h=this.is_capturing();this.consent.reset(),e||!h||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 d=null==(n=this.persistence)||null==n.Ws?void 0:n.Ws(),v=!1;try{var c,f,p,g,m,y,b,w,S,x,E,k,T,P;if(null==(c=this.persistence)||c.clear(),null==(f=this.sessionPersistence)||f.clear(),this.jo.clear(),this.ml(),it(u)||null==(E=this.persistence)||E.register({[Zi]:u}),null==(p=this.surveys)||p.reset(),null==(g=this.vl)||g.stop(),null==(m=this.featureFlags)||m.reset(),null==(y=this.conversations)||y.reset(),null==(b=this.logs)||b.reset(),null==(w=this.metrics)||w.reset(),null==(S=this.persistence)||S.set_property(Rr,Hr),null==(x=this.sessionManager)||x.resetSessionId(),this.Vo=null,this.config.cookieless_mode===qr)this.register_once({distinct_id:Dr,$device_id:null},"");else{var R=this.config.get_device_id(_s());this.register_once({distinct_id:R,$device_id:t?R:a},""),t||it(l)||this.register({[Bi]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(void 0===i.distinctID||this.Oo()||(null==(P=this.persistence)||P.set_property(Rr,i.isIdentifiedID?Vr:Hr),this.register({distinct_id:i.distinctID})),null==(k=this.featureFlags)||k.initialize(),!(it(o)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(o,!0))){var C=_({},i);delete C.sessionID,this.config.bootstrap=C}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var O;d&&(null==(O=this.persistence)||null==O.Qs||O.Qs(v))}this.reloadFeatureFlags()}shutdown(t){var e=this;return p((function*(){var t,i,r,s,n,o;if(e.__loaded){null==(t=e.vl)||t.stop(),e.sl().dispose(),null==(i=e.sessionRecording)||i.dispose(),null==(r=e.logs)||r.flushLogs("sendBeacon"),null==(s=e.metrics)||s.flush("sendBeacon"),null==(n=e.Jo)||n.unload(),null==(o=e.Yo)||o.unload();try{var a;null==(a=e.featureFlags)||a.destroy()}catch(t){Oi.error("Error while destroying feature flags",t)}}else Oi.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(Li)?(Oi.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(it(e)&&(e=this.get_distinct_id()),t!==e?(this._l(zi,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Oi.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=_({},this.config);if(tt(t)){var i,r,s,n,o,a,l,u,h,d,v,f;es(this.config,El(t));var p=this.$o();null==(i=this.persistence)||i.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(_({},this.config,{persistence:"sessionStorage"}),p,!1);var g,m=this.Go(this.config.debug);ut(m)&&(this.config.debug=m),ut(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Ss.Nr()&&Ss.Dr("ph_debug",!0),Oi.info("set_config",{config:t,oldConfig:e,newConfig:_({},this.config)})):(c.DEBUG=!1,Ss.Nr()&&Ss.qr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.ma()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(g=this.historyAutocapture)||g.startIfEnabledOrStop()),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this.No(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){c.LIB_NAME=t,c.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 i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(_({},r,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:Tl.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:bl;return e!==bl&&(e=bl+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Rr))===Vr||(null==(e=this.sessionPersistence)?void 0:e.get_property(Rr))===Vr}yl(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===Wr&&!this._isIdentified()&&et(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[zi])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Mr]))}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?(Oi.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(Mr,!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!==zr)}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!==qr){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 ja(this),this.pageViewManager=new Dn(this),this.persistence&&(this.sessionPropsManager=new Da(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=Tl.__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==zr&&(null==(u=this.surveys)||u.loadIfEnabled()),(it(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 Oi.warn(pl)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==qr?(this.config.cookieless_mode===zr&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===zr&&(this.register({distinct_id:Dr,$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())):Oi.warn(pl)}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===qr||(this.config.cookieless_mode===zr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.No()}_is_bot(){return i?Ba(i,this.config.custom_blocked_useragents):void 0}dl(){r&&("visible"===r.visibilityState?this.Uo||(this.Uo=!0,this.capture(Jr,{title:r.title},{send_instantly:!0}),this.zo&&(r.removeEventListener(Gr,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),ls(r,Gr,this.zo)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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?(Oi.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&&!ot(t[e]),o=i in t&&!ot(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,Oi)}kn(t){var e;if(ot(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(vt),r=X(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),ot(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return dt(t.event)?Oi.warn(o+". This can cause unexpected behavior."):Oi.info(o),null}s.properties&&!et(s.properties)||Oi.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(e){return Oi.error("Error in beforeSend function for event '"+t.event+"':",e),null}for(var a of i)if(s.properties&&ot(s.properties[a]))return Oi.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=ut(t)&&!t,i=Ss.Nr()&&"true"===Ss.Pr("ph_debug");return!e&&(!!i||t)}}Tl.__defaultExtensionClasses={},Tl.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]]=ss(t.prototype[e[i]])}(Tl,["identify"]);class $l{constructor(t){this.disabled=!1===t;var e=tt(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",Rl=Ii("[AutoCapture]");function Cl(t,e){return e.length>t?e.slice(0,t)+"...":e}function Ol(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Hs(e));return e}function Il(e,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,u=i.elementsChainAsString,h=i.disableCaptureUrlHashes;if(!Hs(e))return{props:{}};for(var d=[e],v=new Set([e]),c=e;c.parentNode&&!Vs(c,"body")&&Ks>d.length;)if(Gs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Hs(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={},b=!1,w=!1;if(ts(d,(t=>{var e=fn(t);if(Vs(t,"a")){var i=t.getAttribute("href");b=!!(e&&i&&xn(i))&&(h?Re(i):i)}V(Qs(t),"ph-no-capture")&&(w=!0),m.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};en.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Cl(1024,En(t)):Cl(1024,Zs(t)));var a=Qs(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),ts(t.attributes,(function(i){var n;if((!pn(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&xn(i.value)&&(!rt(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=Js(a).join(" ")),o["attr__"+i.name]=Cl(1024,"href"===i.name&&s?Re(a):a)}}));for(var l=1,u=1,h=t;h=Ol(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(!fn(t))return{};var e={};return ts(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&&xn(r)&&(e[i]=r)}})),e}(t);es(y,r)})),w)return{props:{},explicitNoCapture:w};if(a||(m[0].$el_text=Vs(e,"a")||Vs(e,"button")?En(e):Zs(e)),b){var S,x;m[0].attr__href=b;var E=null==(S=zn(b))?void 0:S.host,k=null==t||null==(x=t.location)?void 0:x.host;E&&k&&E!==k&&(p=b)}return{props:es({$event_type:n.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(g=m,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=_({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return is(n).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return o[Tn(t[0].toString())]=Tn(e.toString())})),(r+=":")+is(o).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:$n(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return is(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(g)))},null!=(r=m[0])&&r.$el_text?{$el_text:null==(s=m[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},y)}}class Al{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 $l(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(t&&r){var e=this.hs=e=>{e=e||(null==t?void 0:t.event);try{this.ds(e)}catch(t){Rl.error("Failed to capture event",t)}};if(ls(r,"submit",e,{capture:!0}),ls(r,"change",e,{capture:!0}),ls(r,"click",e,{capture:!0}),this.ls().capture_copied_text){var i=this.vs=e=>{e=e||(null==t?void 0:t.event);try{this.ds(e,Pl)}catch(t){Rl.error("Failed to capture copy/cut event",t)}};ls(r,"copy",i,{capture:!0}),ls(r,"cut",i,{capture:!0})}}}else Rl.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==r||r.removeEventListener("submit",this.hs,!0),null==r||r.removeEventListener("change",this.hs,!0),null==r||r.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==r||r.removeEventListener("copy",this.vs,!0),null==r||r.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;ut(r)&&(null==(i=this.ns)||i.kv.set(Hi,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 s=null==r?void 0:r.querySelectorAll(e);null==s||s.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(Hi),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(nt(r)&&!ut(i)&&!n)return!1;var o=null!==(e=this.Jn)&&void 0!==e?e:!!i;return!!s.enabled&&!o}ds(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=tn(e);Ws(r)&&(r=r.parentNode||null);var s,n=this.rs();"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&dn(r,n.rageclick)&&this.ds(e,"$rageclick");var o=i===Pl;if(r&&function(e,i,r,s,n,o){var a;if(!t||vn(e))return!1;if(null!=r&&r.url_allowlist&&!Ys(r.url_allowlist,o))return!1;if(null!=r&&r.url_ignorelist&&Ys(r.url_ignorelist,o))return!1;if(null!=r&&r.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((t=>i.type===t)))return!1}var u=cn(e,s),h=u.parentIsUsefulElement,d=u.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(it(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}(d,r))return!1;if(!rn(d,null==r?void 0:r.css_selector_allowlist))return!1;if(rn(d,null!==(a=null==r?void 0:r.css_selector_ignorelist)&&void 0!==a?a:nn))return!1;try{var v=t.getComputedStyle(e);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var c=e.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return h?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(en.indexOf(c)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,n,o,o?["copy","cut"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a,l=Il(r,{e:e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),u=l.props;if(l.explicitNoCapture)return!1;var h=this.getElementSelectors(r);if(h&&h.length>0&&(u.$element_selectors=h),i===Pl){var d,v=Xs(null==t||null==(d=t.getSelection())?void 0:d.toString()),c=e.type||"clipboard";if(!v)return!1;u.$selected_content=v,u.$copy_type=c}return null==(a=this.ns)||a.capture(i,u).catch((t=>Rl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return Z(null==r?void 0:r.querySelectorAll)}}class Fl{constructor(t){this._instance=t}refresh(t){var e=this._instance.config,i=tt(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 Ml=Ii("[ExceptionAutocapture]"),Dl=()=>{},Nl=Ii("[TracingHeaders]"),Ll=Ii("[Web Vitals]"),Ul=9e5,jl=["CLS","FCP","INP","LCP"],Bl=["INP","LCP"],zl=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],ql="disabled",Hl="lazy_loading",Vl="awaiting_config",Wl="missing_config";Ii("[SessionRecording]"),Ii("[SessionRecording]");var Gl="[SessionRecording]",Kl=Ii(Gl),Jl=Ii("[Heatmaps]");function Yl(t){return tt(t)&&"clientX"in t&&"clientY"in t&&at(t.clientX)&&at(t.clientY)}var Ql=Ii("[Product Tours]"),Xl=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(Qi))},Zl=["$set_once","$set"],tu=Ii("[SiteApps]"),eu="Error while initializing PostHog app with config id ",iu=(t,e)=>null!=t&&t.then?t.then(e):e(t),ru="SDK is not enabled or survey functionality is not yet loaded",su="Disabled. Not loading surveys.";class nu{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 tl.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(ot(e))return tl.warn("Flags not loaded yet. Not loading surveys.");this.Pl=ut(e)?e:e.length>0,tl.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=e}setup(t){if(!this.Xn)return this.Fl=t,iu(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(el)||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)tl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)tl.info(su);else if(t.cookielessMode&&this.ts.isOptedOut())tl.info("Not loading surveys in cookieless mode without consent.");else{var e=this.ts.getExtensions();if(e){if(!it(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(Br),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 tl.error("PostHog Extensions not found.")}}}Ll(t,e){this.Xn||(this._surveyManager=t(e),this._surveyEventReceiver=this.ts.createEventReceiver(),tl.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,e){tl.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 tl.info(su),t([]);var s=r.kv.get(yr);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=>tl.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 tl.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=>tl.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(ru)})))}ql(t,e){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:ru}};var i=e.statusCode;if(200!==i||!e.json){var r="Surveys API could not be loaded, status: "+i;return 0!==i?tl.error(r):e.error||tl.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)&&(qa(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({[yr]:n,[br]: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(br);return at(i)&&Date.now()-i>3e5}Bl(){return at(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};il(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){tl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!ot(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);tl.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(ot(this._surveyManager))return{eligible:!1,reason:ru};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}zl(t){if(ot(this._surveyManager))return{eligible:!1,reason:ru};var e="string"==typeof t?this.Hl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(ot(this._surveyManager))return tl.warn("init was not called"),{visible:!1,disabledReason:ru};var e=this.zl(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return ot(this._surveyManager)?(tl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ru})):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 s;if(ot(this._surveyManager))tl.warn("init was not called");else{var n="string"==typeof t?this.Hl(t):t;if(null!=n&&n.id)if(rl.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds){tl.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var t,e;this.Rl.delete(a),this.Xn||(tl.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),tl.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this.Rl.add(a)}else this._surveyManager.renderSurvey(n,o,i);else tl.warn("Survey element not found")}else tl.warn("Surveys of type "+n.type+" cannot be rendered in the app");else tl.warn("Survey not found")}}displaySurvey(t,e){var i;if(ot(this._surveyManager))tl.warn("init was not called");else{var r=this.Hl(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=_({},r,{appearance:_({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Po.Popover&&e.initialResponses&&tl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var n=this.Ul(r);if(!n.eligible)return void tl.warn("Survey is not eligible to be displayed: ",n.reason)}e.displayType!==Po.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else tl.warn("Survey not found")}}cancelPendingSurvey(t){ot(this._surveyManager)?tl.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function ou(t,e,i){if(ot(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 au{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new Na,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;it(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 Na}register(t){var e,i;if(!it(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(!ou(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=>ou(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&ou((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=>ou(t.text,e.text,e.text_matching||"exact")||ou(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;!ot(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=>ou(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||Ga(e.properties.reduce(((t,e)=>{var i=X(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 lu{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&&Ga(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===mo.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;it(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 au(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,mo.Activation),a=this.mu(t,mo.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,mo.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,mo.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(_({},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&&(et(i)?this.pu():this.fu(i))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var e=this.Nu()[t];return at(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=>at(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 uu extends lu{constructor(t){super(t)}ju(){return wr}Bu(){return Sr}cu(){return xr}fu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[xr]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(xr)}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 at(r)&&r>0}Vu(){return To.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 tl}Lu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[wr]:t})}Hu(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[Sr]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Sr)}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 qa(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===To.SHOWN?"consume":"ignore":t===To.SHOWN?"persist":t===To.DISMISSED||t===To.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class hu{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);it(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 du{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==v?void 0:v.__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 uu(this._instance)}}var vu=null!=t&&t.location?Vn(t.location.hash,"__posthog")||Vn(location.hash,"state"):null,cu="_postHogToolbarParams",fu=Ii("[Toolbar]"),pu=Ii("[FeatureFlags]");class _u{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:X(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(pu.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),it(t.flag_keys)||X(t.flag_keys)||pu.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var gu=Ii("[FeatureFlags]"),mu=Ii("[FeatureFlags]",{debugEnabled:!0}),yu="\" failed. Feature flags didn't load in time.",bu="connection_error",wu=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Su=t=>{var e={};for(var i of is(t||{})){var r=i[1];r&&(e[i[0]]=r)}return e},xu=Ii("[Error tracking]"),Eu=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],ku=["__firefox__","__gCrWeb"],Tu="Refusing to render web experiment since the viewer is a likely bot",$u={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>Ha(e,t),not_regex:(t,e)=>!Ha(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);rt(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(Tu);else if(!this.qi.disable_web_experiments){if(ot(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=qn(null==t?void 0:t.search,"__experiment_id"),i=qn(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!ot(t.conditions)&&Pu.th(t,e)&&Pu.eh(t)}static th(t,e){var i;if(ot(t.conditions)||ot(null==(i=t.conditions)?void 0:i.url))return!0;var r=Pu.getWindowLocation();if(r){var s,n,o,a=Ls(e,r.href);return null==(s=t.conditions)||!s.url||$u[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==t?void 0:t.location}static eh(t){var e;if(ot(t.conditions)||ot(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Zn();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];Oi.info("[WebExperiments] "+t,i)}Ku(t,e,i){this._is_bot()?Pu.Qu(Tu):"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 i&&this._instance?Ba(i,this.qi.custom_blocked_useragents):void 0}}var Ru=Ii("[Conversations]"),Cu="Conversations not available yet.",Ou="console",Iu="__posthogHandledLogsRequestError",Au=(t,e)=>{var i=t instanceof Error?t:new Error(e);return i[Iu]=!0,i},Fu=t=>!!t&&"object"==typeof t&&!0===t[Iu],Mu={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=gu,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 _u(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]"),iu(t.kv.initialize(),(()=>{this.Fl===t&&(this.Fl=void 0,this.ns=t,this.yh(t))}))}yh(e){if(this.ns===e)return t&&ls(t,"online",this.Tt),this.bh=e.registerDynamicEventProperties((()=>this._h()?this.rh:this.nh)),this.wh(),this.initialize()}destroy(){null==t||t.removeEventListener("online",this.Tt)}dispose(){var e;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),null==(e=this.bh)||e.dispose(),this.bh=void 0,this.sh=[],null==t||t.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[lr,dr,vr,fr]){var i=this.Sh(e);it(i)||(t[e]=i)}this.rh=t;var r=_({},t),s=this.Sh(ar);if(s)for(var n of Object.entries(s))r["$feature/"+n[0]]=n[1];this.nh=r}_h(){var t=this.qi.cacheTtlMs;if(!t||0>=t)return!1;var e=this.Sh(Pr);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(!it(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,i){var r,s,n=null!=i&&i.merge&&null!==(r=this.Sh(ar))&&void 0!==r?r:{},o=null!=i&&i.merge&&null!==(s=this.Sh(dr))&&void 0!==s?s:{},a=_({},n,t),l=_({},o,e),u={};for(var h of Object.entries(a)){var d=h[0],v=h[1];u[d]={key:d,enabled:y(v),variant:b(v),reason:void 0,metadata:it(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this.Eh({flags:u})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(hr),e=this.Sh(fr),i=this.Sh(pr);if(!i&&!e)return t||{};var r=es({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=it(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=it(u)?null==l?void 0:l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=_({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=_({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.ih=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return{key:i,enabled:y(r),variant:b(r),payload:m(e[i])}}))}getFlagVariants(){var t=this.Sh(ar),e=this.Sh(fr);if(!e)return t||{};for(var i=es({},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(dr),e=this.Sh(pr);if(!e)return t||{};for(var i=es({},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(kr)}Rh(t){this.kh();var e=this.ns;if(e&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},e.initialPersonProperties,this.Sh(_r)||{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Sh(gr),timezone:ao()};it(e.deviceId)||(i.$device_id=e.deviceId),(null!=t&&t.disableFlags||this.qi.featureFlagsDisabled)&&(i.disable_flags=!0);var r=this.Th();r.length&&(i.evaluation_contexts=r);var s=this.Mh();it(s)||(i.flag_keys=s);var n=this.qi.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.lh;this.oh=!0;var l=()=>{this.hh&&(this.hh=!1,this.Rh())},u=t=>{this.oh=!1,a===this.lh?(this.Dr({[$r]:[bu]}),this.I.error("Feature flag request failed",t),l()):l()};try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:"base64"===this.qi.compression?go.Base64:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var e,r,s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.oh=!1,a===this.lh){if(this.Ph(t.statusCode),o||this.hh||(this.$anon_distinct_id=void 0),!i.disable_flags||this.hh){this.dh=!o;var u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?bu:"unknown_error"):200!==t.statusCode&&u.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");var h=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));h&&u.push("quota_limited"),this.Dr({[$r]:u}),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."):i.disable_flags||this.Eh(s,o,{partialResponse:n}),l()}}else l()})).catch(u)}catch(t){u(t)}}}gh(){return Wn(this.ph,3)}Ph(t){this.ph=Gn(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+yu)}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 i,r=this.getFlagVariants(),s=t in r,n=r[t],o=this.getFlagPayloads()[t],a=String(n),l=this.Sh(vr)||void 0,u=this.Sh(Pr)||void 0,h=this.Sh(kr)||{};if(this.qi.deduplicateCallsPerSession){var d,v=null==(d=this.ns)?void 0:d.session.sessionId,c=this.Sh(Tr);v&&v!==c&&(h={},i=v)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(a))i&&this.Dr({[kr]:h,[Tr]:i});else{var f,p,g,y,b,w,S,x,E,k,T,P;X(h[t])?h[t].push(a):h[t]=[a],this.Dr(_({[kr]:h},i?{[Tr]:i}:{}));var R=this.getFeatureFlagDetails(t),C=[...null!==(f=this.Sh($r))&&void 0!==f?f:[]];it(n)&&C.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(p=null==(g=this.qi.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(y=null==(b=this.qi.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.dh};it(null==R||null==(w=R.metadata)?void 0:w.has_experiment)||(O.$feature_flag_has_experiment=R.metadata.has_experiment),it(null==R||null==(S=R.metadata)?void 0:S.version)||(O.$feature_flag_version=R.metadata.version);var I,A=null!==(x=null==R||null==(E=R.reason)?void 0:E.description)&&void 0!==x?x:null==R||null==(k=R.reason)?void 0:k.code;A&&(O.$feature_flag_reason=A),null!=R&&null!=(T=R.metadata)&&T.id&&(O.$feature_flag_id=R.metadata.id),it(null==R?void 0:R.original_variant)&&it(null==R?void 0:R.original_enabled)||(O.$feature_flag_original_response=it(R.original_variant)?R.original_enabled:R.original_variant),null!=R&&null!=(P=R.metadata)&&P.original_payload&&(O.$feature_flag_original_payload=null==R||null==(I=R.metadata)?void 0:I.original_payload),C.length&&(O.$feature_flag_error=C.join(",")),this.Ah(O)}else i&&this.Dr({[kr]:h,[Tr]:i});if(s)return{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:m(o)}}}else this.I.warn('getFeatureFlagResult for key "'+t+yu)}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,e){var i=this;return p((function*(){var r=i.ns;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=i.Th();n.length&&(s.evaluation_contexts=n);var o,a=i.Mh();it(a)||(s.flag_keys=a);try{var l,u=null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===i.qi.compression?go.Base64:void 0,sentAt:"body",timeoutMs:i.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==u?void 0:u[t])||void 0}catch(t){return void i.I.error("Remote config feature flag request failed",t)}try{e(o)}catch(t){i.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+yu),e.defaultValue;var i=this.getFeatureFlag(t,e);return it(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,i){if(this.ns){this.ah=!0;var r=function(t,e,i,r,s,n){void 0===e&&(e={}),void 0===i&&(i={}),void 0===r&&(r={}),void 0===n&&(n=gu);var o=((t,e)=>{var i=t.flags;return i?_({},t,{featureFlags:Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),featureFlagPayloads:Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[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,n),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(X(l)){n.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;return{[lr]:l,[ar]:v,[cr]:!1}}var f=l,p=u,g=a;if(null!=s&&s.partialResponse)f=_({},e,f),p=_({},i,p),g=_({},r,g);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return!(null!=(e=a[t])&&e.failed)})));f=_({},e,Object.fromEntries(Object.entries(f).filter((t=>m.has(t[0]))))),p=_({},i,Object.fromEntries(Object.entries(p||{}).filter((t=>m.has(t[0]))))),g=_({},r,Object.fromEntries(Object.entries(g||{}).filter((t=>m.has(t[0])))))}else f=_({},e,f),p=_({},i,p),g=_({},r,g);return _({[lr]:Object.keys(Su(f)),[ar]:f||{},[dr]:p||{},[hr]:g||{},[cr]:!0===t.minimalFlagCalledEvents},h?{[vr]:h}:{},d?{[Pr]:d}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.I);r&&this.Dr(r),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([fr,pr]),this.Lh(),void mu.info("All overrides cleared");if(X(t))return this.Dr({[fr]:wu(t)}),this.Lh(),void mu.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[fr]=X(s)?wu(s):s),n&&(r[pr]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([fr,pr]):!1===s?this.qr(fr):!1===n&&this.qr(pr),this.Lh(),!1===s?mu.info("Flag overrides cleared"):s&&mu.info("Flag overrides set",{flags:s}),void(!1===n?mu.info("Payload overrides cleared"):n&&mu.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[fr]:t}),this.Lh(),void mu.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,i){var r=(this.Sh(ur)||[]).find((e=>e.flagKey===t)),s={["$feature_enrollment/"+t]:e},n={$feature_flag:t,$feature_enrollment:e,$set:s};r&&(n.$early_access_feature_name=r.name),i&&(n.$feature_enrollment_stage=i);var o=_({},this.getFlagVariants(),{[t]:e});this.Dr({[lr]:Object.keys(Su(o)),[ar]:o,[_r]:_({},this.Sh(_r)||{},s)}),this.Lh();try{var a;null==(a=this.ns)||a.capture("$feature_enrollment_update",n).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(ur);!r||e?this.$h(t,i):t(r)}$h(t,e){var i=this;return p((function*(){var r=i.ns;if(r){var s,n=e?"&"+e.map((t=>"stage="+t)).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;i.Dr({[ur]:s=o.json.earlyAccessFeatures})}catch(t){return void i.I.error("Early access feature request failed",t)}try{t(s)}catch(t){i.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 i=this.Sh(_r)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this.Dr({[_r]:_({},i,n,r)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=_({},this.Sh(_r)||{});t.forEach((t=>{delete i[t]})),this.Dr({[_r]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(_r),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.Sh(gr)||{},r=_({},i);for(var s of Object.keys(t))r[s]=_({},i[s],t[s]);this.Dr({[gr]:r}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Sh(gr)||{};this.Dr({[gr]:_({},e,{[t]:{}})})}else this.qr(gr)}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}}},Du={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===Vl||this.jh===Wl?this.jh:null!==(t=null==(e=this.qh)?void 0:e.status)&&void 0!==t?t:this.jh}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=ql,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var e;if(null==r||!r.visibilityState||"visible"===r.visibilityState)return!0;var i=null==t||null==(e=t.performance)||null==e.getEntriesByType?void 0:e.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==r?void 0:r.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=e,!this._instance.sessionManager)throw Kl.error("started without valid sessionManager"),new Error(Gl+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===qr)throw new Error(Gl+' cannot be used with cookieless_mode="always"');null!=r&&r.addEventListener&&ls(r,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==r||null==r.removeEventListener||r.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var e,i=!(null==(e=this._instance.get_property(Zi))||!e.enabled),r=!this.qi.disable_session_recording,s=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!(this.Hh||this.Uh&&null!=(e=this.qh)&&e.isStarted)){var i=!it(Object.assign)&&!it(Array.from);this.Uh&&i?(this.zh(t),Kl.info("starting")):(this.jh=ql,this.stopRecording())}}zh(t){var e,i,r;this.Uh&&(this.jh!==Vl&&this.jh!==Wl&&(this.jh=Hl),null!=v&&null!=(e=v.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=v.__PosthogExtensions__)&&i.initSessionRecording?this.Wh(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(e=>{if(e)return this._instance.register_for_session({[jr]:!0}),Kl.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(or),null==(e=this.za)||e.unregister(tr)}Qh(t,e){if(ot(t))return null;var i,r=at(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Kl.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var e,i,r=this.za,s=()=>{var e,i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Qh(null==(e=this.qi.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.Qh(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;ot(o)&&this.Zh();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Zi]:_({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:_({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:it(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(e=this.Bh)||e.call(this),this.Bh=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}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===Vl&&(this.jh=Wl,Kl.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):Kl.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(Zi);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Kh(){var t,e=this._instance.get_property(Zi);if(!e)return!1;try{t="object"==typeof e?e:JSON.parse(e)}catch(t){return Kl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!ot(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var e,i,r;if(!this.Hh){if(null==(e=v.__PosthogExtensions__)||!e.initSessionRecording)return Kl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[jr]:!0});var s;if(this.qh||(this.qh=null==(s=v.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Wl||this.jh===Vl)return;return this.jh=Vl,Kl.info("persisted remote config is stale, requesting fresh config before starting"),void new Mo(this._instance).load()}this.jh=Hl,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({[ir]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.qh||null==(e=this.za)||e.register({[er]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var e,i;this.qh||null==(i=this.za)||i.register({["url"===t?rr:sr]:!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))}}},Nu={autocapture:class extends Al{constructor(t){super(new Fl(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&&(Oi.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,Oi.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(e){var i;if(t&&(null==(i=t.history[e])||!i.__posthog_wrapped__)){var r=this;!function(t,e,i){try{if(!(e in t))return Dl;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 Z(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];Z(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 Dl}}(t.history,e,(t=>function(i,s,n){t.call(this,i,s,n),r.ld(e)}))}}Xh(){var e=null==t?void 0:t.location;if(null!=e&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}td(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:tt(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(Jr,{navigation_type:t}),this.Yh=e}catch(e){Oi.error("Error capturing "+t+" pageview",e)}}ad(){if(!this.rd){var e=()=>{this.ld("popstate")};ls(t,"popstate",e),this.rd=()=>{t&&t.removeEventListener("popstate",e)}}}od(){if(!this.nd){var e=()=>{this.ld("hashchange")};ls(t,"hashchange",e),this.nd=()=>{t&&t.removeEventListener("hashchange",e)}}}},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[Vi]),this.rageclicks=new $l(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return tt(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return ot(this.qi.capture_heatmaps)?ot(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:!1!==this.qi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;Jl.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({[Vi]:i}),this.hd=i,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){Yl(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd="visible"===(null==r?void 0:r.visibilityState)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){t&&r&&(this.gd=this.La.bind(this),ls(t,Kr,this.gd),this.md=e=>this.ki(e||(null==t?void 0:t.event)),ls(r,"click",this.md,{capture:!0}),this.yd=e=>this.bd(e||(null==t?void 0:t.event)),ls(r,"mousemove",this.yd,{capture:!0}),this._d=new On(this.instance,Rn,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),ls(r,Gr,this.wd),this.Qn=!0)}fd(){var e;t&&r&&(this.gd&&t.removeEventListener(Kr,this.gd),this.md&&r.removeEventListener("click",this.md,{capture:!0}),this.yd&&r.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&r.removeEventListener(Gr,this.wd),clearTimeout(this.kd),null==(e=this._d)||e.stop(),this.Qn=!1)}Sd(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&Hs(s)&&!Vs(s,"body");){if(s===r)return!1;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:t)?void 0:o.getComputedStyle(s).position}catch(t){return!1}if(V(i,n))return!0;s=sn(s)}return!1}(tn(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}ki(t,e){var i;if(void 0===e&&(e="click"),!qs(t.target)&&Yl(t)){var r=this.Sd(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&dn(tn(t),this.instance.config.rageclick)&&this.Nn(_({},r,{type:"rageclick"})),this.Nn(r)}}bd(t){!qs(t.target)&&Yl(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(e){if(t){var i=this.qi.disable_capture_url_hashes?Re(t.location.href):t.location.href,r=this.qi.custom_personal_data_properties,s=this.qi.mask_personal_data_properties?[...Jn,...r||[]]:[],n=Hn(i,s,Qn);this.ft=this.ft||{},this.ft[n]||(this.ft[n]=[]),this.ft[n].push(e)}}La(){this.ft&&!et(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:On,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",_({$current_url:this.ft.url},this.ft.metrics.reduce(((t,e)=>_({},t,{["$web_vitals_"+e.name+"_event"]:_({},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},ot(null==t?void 0:t.name)||ot(null==t?void 0:t.value))Ll.error("Invalid metric received",t);else{var i="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.Md(i);if(!it(r)){var s=at(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.Ed||this.Ed>t.value){this.ft.navigationKey!==s&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),it(this.ft.navigationKey)&&(this.ft.navigationKey=s,this.ft.url=r),this.ft.firstMetricTimestamp=it(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp;var n=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),o=_({},t,i?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete o.entries,tt(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var a={};for(var l of zl){var u="url"===l&&"string"==typeof t.attribution[l]?this.Md(t.attribution[l]):t.attribution[l];it(u)||(a[l]=u)}o.attribution=a}else delete o.attribution;it(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.ft.metrics.push(o),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else Ll.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,e,i,r,s=!1,n=v.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.Rd])||("web-vitals"===this.Rd&&it(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!it(a)){var l=a.withoutAttribution,u=this.attributionMetrics;s=!it(l),t=u.indexOf("LCP")>-1?a.onLCP:(null==l?void 0:l.onLCP)||a.onLCP,e=u.indexOf("CLS")>-1?a.onCLS:(null==l?void 0:l.onCLS)||a.onCLS,i=u.indexOf("FCP")>-1?a.onFCP:(null==l?void 0:l.onFCP)||a.onFCP,r=u.indexOf("INP")>-1?a.onINP:(null==l?void 0:l.onINP)||a.onINP}if(t&&e&&i&&r){var h={reportSoftNavs:this.useSoftNavs},d=s&&this.attributionMetrics.indexOf("INP")>-1?_({},h,{includeProcessedEventEntries:!1}):h;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Td.bind(this),h),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Td.bind(this),h),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Td.bind(this),h),this.allowedMetrics.indexOf("INP")>-1&&r(this.Td.bind(this),d),this.Qn=!0}else Ll.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(e=this._instance.persistence)||!e.props[Ji]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=tt(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return ot(i)?(null==(e=this._instance.persistence)?void 0:e.props[Xi])||jl:i}get flushToCaptureTimeoutMs(){return(tt(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=tt(this.Pd)?this.Pd.web_vitals_attribution:void 0;return ut(t)?t?jl:[]:X(t)?t:Bl}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=tt(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=tt(this.Pd)&&at(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:Ul;return t>0&&6e4>=t?Ul:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Ll.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=tt(this.Pd)?this.Pd.web_vitals:ut(this.Pd)?this.Pd:void 0;return ut(e)?e:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(Ll.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=tt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=tt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ji]:i}),this._instance.persistence.register({[Xi]: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=v.__PosthogExtensions__,i=this.Rd,r=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;null!=r&&r[i]||"web-vitals"===i&&it(r)&&null!=e&&e.postHogWebVitalsCallbacks?t():null==e||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,i,(e=>{e?Ll.error("failed to load script",e):t()}))}Md(e){var i=e||(null==t?void 0:t.location.href);if(i){var r=this._instance.config.disable_capture_url_hashes?Re(i):i,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Jn,...s||[]]:[];return Hn(r,n,Qn)}Ll.error("Could not determine current URL")}}},Lu={exceptionObserver:class{constructor(e){var i;this.Id=()=>{var e;if(t&&this.isEnabled&&null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=i(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=r(this.captureException.bind(this))),!this.Ld&&this.qi.capture_console_errors&&(this.Ld=s(this.captureException.bind(this)))}catch(t){Ml.error("failed to start",t),this.Od()}}},this._instance=e,this.Dd=!(null==(i=this._instance.persistence)||!i.props[Wi]),this.oe=new St(_({},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:Ml})),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 tt(t)?e=_({},e,t):(it(t)?this.Dd:t)&&(e=_({},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?(Ml.info("enabled"),this.Od(),this._s(this.Id)):this.Od()}_s(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Ml.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({[Wi]: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)?Ml.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,i;this.Nd=[],this.qd=new ti([new vi,new Si,new fi,new ci,new bi,new yi,new _i,new wi],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];return function(e,r){void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=di.test(a)?a.replace(di,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.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 _({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||ei});var i}))}(s)}}("web:javascript",ai,hi)),this._instance=t,this.Nd=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(Gi))&&void 0!==e?e:[],this.jd=$i(this.Bd()),this.Hd=new Pi(this.jd)}onConfigChange(){this.jd=$i(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({[Gi]:this.Nd,[Ki]:o})}}}get Ud(){var t,e=!!this._instance.get_property(Ki),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(!rt(t)||0===t.trim().length)return void xu.warn("Ignoring exception step because message must be a non-empty string");var i=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>ki.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.zd(e)),r=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&xu.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Hd.add(_({[xi]:t,[Ei]:(new Date).toISOString()},r))}catch(t){xu.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 xu.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 xu.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 xu.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 xu.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.jd.enabled&&ot(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 xu.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void xu.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:_({},t,{$exception_steps:e})}catch(e){return xu.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Gd(t){this.jd.enabled&&this.Hd.add({[xi]:t,[Ei]:(new Date).toISOString()})}zd(t){return tt(t)?_({},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 rt(i)&&i.length>0&&t.$exception_types.push(i),rt(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=Wa[t.operator],r=e[t.key];if(!i||!r)return!1;var s=X(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 xu.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&&Eu.some((t=>e.startsWith(t)))}))}Qd(t){return t.some((t=>{var e=t.value;return rt(e)&&ku.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!ot(t)&&X(t)}}},Uu=_({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({[Qi]:!!e.productTours}),!Xl(this._instance))return!this.Yd&&ot(null==(i=this.za)?void 0:i.props[Er])||Ql.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&&Xl(this._instance)&&this._s((()=>this.tv()))}_s(t){var e,i;null!=(e=v.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Ql.error("Could not load product tours script",e):t()}))}tv(){var t;!this.Yd&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!X(this.Xd)||e){var i=this.za;if(i){var r=i.props[Er];if(X(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(Xl(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||Ql.warn(s):Ql.error(s),void t([],{isLoaded:!1,error:s})}var n=X(e.json.product_tours)?e.json.product_tours:[];this.Xd=n,i&&i.register({[Er]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){ot(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(Er)}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)}}},Mu),ju={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=v._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,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(h)){var v=d[0];l[v]={id:u[v],type:v,properties:d[1]}}var c=t.$set_once,f=t.$set;return{event:_({},g(t,Zl),{properties:_({},t.properties,f?{$set:_({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},f)}:{},c?{$set_once:_({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}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)||(tu.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)||(tu.error("prepare_external_dependency_script returned null"),null):t}av(){var t,e,i,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=null==r?void 0:r.defaultView,h=null==u||null==(t=u.Node)?void 0:t.prototype;if(!u||!h)return()=>{};if(this.ev++,this.ov)return this.lv();var d=[],v=this,c=new WeakSet,f=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),d.push((()=>{t[e]=r}))}},p=t=>{if(c.has(t))return t;var e=v.sv(t);return e&&c.add(e),e},_=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!nt(t)));return f(h,"appendChild",(t=>function(e){var i=p(e);return i?t.call(this,i):e})),f(h,"insertBefore",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):e})),f(h,"replaceChild",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):i})),[null==(e=u.Element)?void 0:e.prototype,null==(i=u.Document)?void 0:i.prototype,null==(s=u.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(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,_(i))})),f(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,_(i))}))})),[null==(n=u.Element)?void 0:n.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((t=>{f(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,_(i))})),f(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,_(i))})),f(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=_(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),f(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(e,i){var r=p(i);return r?t.call(this,e,r):null})),this.ov=()=>{d.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&&(tu.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,tu.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){tu.error(eu+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){tu.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){tu.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 tu.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;v["__$$ph_site_app_"+e]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return tu.error(eu+e,t)}))};for(var a of n.siteApps)o()}else tu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Bu={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?(it(this.vv)&&(this.vv=null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),it(this.fv)&&(this.fv=null==(e=v.__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=v.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=v.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Nl.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 X(t)?(X(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(X(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()}}},zu=_({surveys:class extends nu{constructor(t){var e;super(new du(t),{get projectToken(){return e.config.token},kv:new hu(e=t)}),this._instance=t}Nl(t,e){var i=e.query?ya(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})}))}}},Mu),qu={toolbar:class{constructor(t){this.instance=t}yv(t){v.ph_toolbar_state=t}bv(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),us(this.instance.config))return!1;if(!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}var n,o=vu||Vn(e.hash,"__posthog")||Vn(e.hash,"state"),a=o?rs((()=>JSON.parse(atob(decodeURIComponent(o)))))||rs((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(cu)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}_v(t){var e=v.ph_load_toolbar||v.ph_load_editor;!ot(e)&&Z(e)?e(t,this.instance):fu.warn("No toolbar load function found")}loadToolbar(e){var i=!(null==r||!r.getElementById(Us));if(!t||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=_({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(cu,JSON.stringify(_({},n,{source:void 0}))),2===this.bv())this._v(n);else if(0===this.bv()){var o;this.yv(1),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return fu.error("[Toolbar] Failed to load",t),void this.yv(0);this.yv(2),this._v(n)})),ls(t,"turbolinks:load",(()=>{this.yv(0),this.loadToolbar(n)}))}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)}}},Hu=_({experiments:Pu},Mu),Vu={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;ot(e)||(ut(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||us(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v?void 0:v.__PosthogExtensions__;if(t&&!it(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(Br);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 Ru.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,Ru.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else Ru.error("Cannot complete initialization: remote config is null")}Ev(t,e){Ru.error(t,e),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():Ru.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!nt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":us(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Tv?"remote_config_failed":it(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?ot(this.Me)||!this.Me.token?"missing_token":null!=v&&v.__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,e,i){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(Ru.warn(Cu),null)}))()}getMessages(t,e){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(Ru.warn(Cu),null)}))()}markAsRead(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ru.warn(Cu),null)}))()}getTickets(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ru.warn(Cu),null)}))()}requestRestoreLink(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ru.warn(Cu),null)}))()}restoreFromToken(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ru.warn(Cu),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ru.warn(Cu),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()}}},Wu={logs:class{constructor(e){var i,r=this;this.Iv=!1,this.Rv=!1,this.I=Ii("[logs]"),this.Pv=_({},this.I,{error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];e.some(Fu)||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=e,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.Iv=!0),t&&ls(t,"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=it(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 Ve(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},Ou);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;!ot(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){Fu(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==v?void 0:v.__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(Br)}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===x.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===x.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},Mn:t=>this.Mn(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Mn(t){return new Promise((e=>{if(Wn(this.ph,3))e({kind:"fatal",error:Au(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:Au(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:Au(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=Gn(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,c.LIB_NAME,(t=>{this.ka=t})),this.Av.length>0&&this.Jv(t,this.Av,this.zv,Ou,(t=>{this.Av=t}))}Jv(t,e,i,r,s){if(0!==e.length){var n=e.map((t=>t.record));s([]);var o=He(n,qe(i,c.LIB_NAME,c.LIB_VERSION),r,c.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:o,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,ot(s)||(e.sessionStartTimestamp=s),ot(n)||(e.lastActivityTimestamp=n)}if(null!=v&&null!=(t=v.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Re(v.location.href):v.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}},Gu={metrics:class{constructor(t){this.I=Ii("[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 Je(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:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Un(t,e){return new Promise((i=>{var r=!1,s=t=>{r||(r=!0,clearTimeout(n),i(t))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(_({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)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error("metrics request failed with status "+e)});else{var i;s({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)}}},Ku=_({},Mu,Du,Nu,Lu,Uu,ju,zu,Bu,qu,Hu,Vu,Wu,Gu);Tl.__defaultExtensionClasses=_({},Ku);var Ju=function(){c.SDK_DIST_CHANNEL="npm";var e=vl[bl]=new Tl;return function(){function e(){e.done||(e.done=!0,wl=!1,ts(vl,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():ls(r,"DOMContentLoaded",e,{capture:!1}):t&&Oi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();export{go as Compression,Ro as DEFAULT_PRODUCT_TOUR_APPEARANCE,Po as DisplaySurveyType,Tl as PostHog,Co as ProductTourEventName,Oo as ProductTourEventProperties,To as SurveyEventName,$o as SurveyEventProperties,mo as SurveyEventType,bo as SurveyPosition,Eo as SurveyQuestionBranchingType,xo as SurveyQuestionType,ko as SurveySchedule,wo as SurveyTabPosition,So as SurveyType,yo as SurveyWidgetType,Ju as default,Ju as posthog,Do as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|