1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5732],{62702:(e,t,i)=>{let s,r,n,o,a;i.d(t,{Ay:()=>lw});let l="u">typeof window?window:void 0,u="u">typeof globalThis?globalThis:l,h=null==u?void 0:u.navigator,c=null==u?void 0:u.document,d=null==u?void 0:u.location,p=null==u?void 0:u.fetch,f=(null==u?void 0:u.XMLHttpRequest)&&"withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:void 0,g=null==u?void 0:u.AbortController,v=null==u?void 0:u.CompressionStream,_=null==h?void 0:h.userAgent;function m(){return!(!l||!1===l.navigator.onLine)}let y="undefined"!=typeof globalThis?globalThis:l;y&&"undefined"==typeof self&&(y.self=y),y&&"undefined"==typeof File&&(y.File=function(){});let b=null!=l?l:{},w="0.9.0",x={DEBUG:!1,LIB_VERSION:w,LIB_NAME:"browser-common",JS_SDK_VERSION:w};var k,E=function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),S=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});let $=["$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"],P=["token"];function R(e,t){return -1!==e.indexOf(t)}let I=function(e){return e.trim()},F=function(e){return e.replace(/^\$/,"")};function O(e){var t;let i=[];return null!=(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))?t:"null"}let C=Object.prototype,M=C.hasOwnProperty,A=C.toString,T=Array.isArray||function(e){return"[object Array]"===A.call(e)},L=e=>"function"==typeof e,D=e=>e===Object(e)&&!T(e),N=e=>{if(D(e)){for(let t in e)if(M.call(e,t))return!1;return!0}return!1},j=e=>void 0===e,q=e=>"[object String]"==A.call(e),B=e=>q(e)&&0===e.trim().length,H=e=>null===e,z=e=>j(e)||H(e),U=e=>"[object Number]"==A.call(e)&&e==e,V=e=>U(e)&&e>0,W=e=>"[object Boolean]"===A.call(e),G=e=>R($,e),Y=e=>R(P,e);function X(e){return null===e||"object"!=typeof e}function J(e,t){return({}).toString.call(e)==="[object ".concat(t,"]")}function K(e){switch(({}).toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Q(e,Error)}}function Z(e){return"u">typeof Event&&Q(e,Event)}function Q(e,t){try{return e instanceof t}catch(e){return!1}}let ee=[!0,"true",1,"1","yes"],et=e=>R(ee,e),ei=[!1,"false",0,"0","no"];function es(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function er(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){es(n,s,r,o,a,"next",e)}function a(e){es(n,s,r,o,a,"throw",e)}o(void 0)})}}let en=["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","hub
1spot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],eo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e)return!1;let i=e.toLowerCase();return en.concat(t).some(e=>{let t=e.toLowerCase();return -1!==i.indexOf(t)})};function ea(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),U(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),ea(null!=r?r:i,t,i,s))}var el=class{F(e,t){let i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.A,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;let i=Date.now(),s=String(e),r=this.C[s];return r?this.F(r,i):(r={tokens:this.R,lastAccess:i},this.C[s]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.I)||t.call(this,e)),0===r.tokens)}stop(){this.C={}}constructor(e){this.C={},this.I=e.I,this.R=ea(e.bucketSize,0,100,e.$),this.A=ea(e.refillRate,0,this.R,e.$),this.O=ea(e.refillInterval,0,864e5,e.$)}};let eu="Mobile",eh="Android",ec="Tablet",ed="Android Tablet",ep="iPad",ef="Apple Watch",eg="Safari",ev="BlackBerry",e_="Samsung Internet",em="Chrome",ey="Chrome iOS",eb="Internet Explorer",ew="Internet Explorer Mobile",ex="Opera",ek="Microsoft Edge",eE="Firefox",eS="Firefox iOS",e$="Nintendo",eP="PlayStation",eR="Xbox",eI="Android Mobile",eF="Mobile Safari",eO="Windows",eC="Windows Phone",eM="Nokia",eA="Ouya",eT="Generic "+eu.toLowerCase(),eL="Generic "+ec.toLowerCase(),eD="Konqueror",eN="Oculus Browser",ej="Vivaldi",eq="Yandex",eB="Whale",eH="DuckDuckGo",ez="Pale Moon",eU="Waterfox",eV="Brave",eW="Claude",eG="Codex",eY="ChatGPT",eX="Google Search App",eJ=RegExp("Version/(\\d+(\\.\\d+)?)"),eK=RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),eZ=RegExp(eR,"i"),eQ=RegExp("PlayStation \\w+","i"),e0=RegExp("Nintendo \\w+","i"),e1=RegExp("BlackBerry|PlayBook|BB10","i"),e2={"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"},e3=function(e,t,i,s){var r;return t=t||"",((null==i?void 0:i.brave)?eV:null)||((null==s?void 0:s.detectGoogleSearchApp)&&R(e,"GSA/")?eX:R(e," OPR/")&&R(e,"Mini")?"Opera Mini":R(e," OPR/")?ex:e1.test(e)?ev:R(e,"IEMobile")||R(e,"WPDesktop")?ew:R(e,"OculusBrowser")?eN:R(e,"SamsungBrowser")?e_:R(e,"Edge")||R(e,"Edg/")?ek:R(e,"Vivaldi/")?ej:R(e,"YaBrowser/")?eq:R(e,"Whale/")?eB:R(e,"DuckDuckGo/")||R(e,"Ddg/")?eH:R(e,"Claude/")?eW:R(e,"Codex/")?eG:R(e,"ChatGPT/")?eY:R(e,"FBIOS")?"Facebook Mobile":R(e,"UCWEB")||R(e,"UCBrowser")?"UC Browser":R(e,"CriOS")?ey:R(e,"CrMo")||R(e,em)?em:R(e,eh)&&R(e,eg)?eI:R(e,"FxiOS")?eS:R(e.toLowerCase(),eD.toLowerCase())?eD:R(e,"Brave/")?eV:(r=t)&&R(r,"Apple")||R(e,eg)&&!R(e,em)&&!R(e,eh)?R(e,eu)?eF:eg:R(e,"PaleMoon/")?ez:R(e,"Waterfox/")?eU:R(e,eE)?eE:R(e,"MSIE")||R(e,"Trident/")?eb:R(e,"Gecko")?eE:"")},e5={[ew]:[RegExp("rv:(\\d+(\\.\\d+)?)")],[ek]:[RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[em]:[RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ey]:[RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[eg]:[eJ],[eF]:[eJ],[ex]:[RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[eE]:[RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[eS]:[RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[eD]:[RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ev]:[RegExp("BlackBerry (\\d+(\\.\\d+)?)"),eJ],[eI]:[RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[e_]:[RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[eN]:[RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ej]:[RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[eq]:[RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[eB]:[RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[eV]:[RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[eW]:[eK],[eG]:[eK],[eY]:[eK],[eH]:[RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[ez]:[RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[eU]:[RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[eX]:[RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[eb]:[RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[RegExp("rv:(\\d+(\\.\\d+)?)")]},e4=function(e,t,i,s){let r=e5[e3(e,t,i,s)];if(j(r))return null;for(let t=0;r.length>t;t++){let i=e.match(r[t]);if(i)return parseFloat(i[i.length-2])}return null},e6=[[RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[eR,e&&e[1]||""]],[RegExp(e$,"i"),[e$,""]],[RegExp(eP,"i"),[eP,""]],[e1,[ev,""]],[RegExp(eO,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eC,""];if(new RegExp(eu).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];let i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=e2[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[eO,e]}return[eO,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=j(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[eh,[e[2],e[3],e[4]||"0"].join(".")]:[eh,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],e8=function(e){for(let t=0;e6.length>t;t++){let[i,s]=e6[t],r=i.exec(e),n=r&&(L(s)?s(r,e):s);if(n)return n}return["",""]},e9=function(e){return e0.test(e)?e$:eQ.test(e)?eP:eZ.test(e)?eR:RegExp(eA,"i").test(e)?eA:RegExp("(Windows Phone|WPDesktop)","i").test(e)?eC:/iPad/.test(e)?ep:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?ef:e1.test(e)?ev:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eM,"i").test(e)?eM:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(eu).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?eh:ed:RegExp("(pda|Mobile)","i").test(e)?eT:RegExp(ec,"i").test(e)&&!RegExp("Tablet pc","i").test(e)?eL:""},e7=function(e,t){var i,s,r,n;let o=e9(e);return o===ep||o===ed||"Kobo"===o||"Kindle Fire"===o||o===eL?ec:o===e$||o===eR||o===eP||o===eA?"Console":o===ef?"Wearable":o?eu:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!=(n=null==t?void 0:t.maxTouchPoints)?n:0)>0?600>Math.min(null!=(i=null==t?void 0:t.screenWidth)?i:0,null!=(s=null==t?void 0:t.screenHeight)?s:0)/(null!=(r=null==t?void 0:t.devicePixelRatio)?r:1)?eu:ec:"Desktop"},te=/\bFBAV\/(\d+(?:\.\d+)*)/i,tt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",te],[/\bFBAN\/EMA\b/i,"Facebook Lite",te],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",te],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?
1:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],ti="[Truncated]",ts="[Unserializable]";function tr(e){let t="";for(let i=0;e.length>i;i++){let s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{let s=e.charCodeAt(i+1);56320>s||s>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function tn(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch(e){i=[]}for(let s of i){let i;try{i=t[s]}catch(e){i=ts}Object.defineProperty(e,s,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}var to=class{record(e){if("too-large"===e.kind)return;if("retry-later"!==e.kind)return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,3e5);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+3e5))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(3e5,Math.max(0,this.es-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};let ta=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tl(e,t){return"string"==typeof e&&ta.test(e)?e:t()}function tu(e,t){let i=Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function th(e){return e?e.split("#")[0]:e}function tc(e){try{return e()}catch(e){return}}function td(e,t){let i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function tp(e,t,i){return tf.apply(this,arguments)}function tf(){return(tf=er(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,r)=>{s=td(()=>{try{null==i||i(),e()}catch(e){r(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function tg(e){return(tg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tv(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,s)}return i}function t_(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?tv(Object(i),!0).forEach(function(t){!function(e,t,i){var s;(s=function(e){if("object"!=tg(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=tg(i))return i;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==tg(s)?s:s+"")in e)?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i}(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):tv(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var tm=class{buildFromUnknown(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return er(function*(){for(let i of e)i.stacktrace&&i.stacktrace.frames&&T(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,r;if(null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)}catch(e){}return t_(t_({},e),{},{cause:s,stack:r,errors:null==(i=e.errors)?void 0:i.map(e=>this.parseStacktrace(e,t))})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(let i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return er(function*(){let i=e;for(let e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){let i=[],s=(e,r,n)=>{var o;let a=i.length,l=void 0===r?t_(t_({type:"string"==typeof t.type&&t.type.length>0?t.type:"generic"},"boolean"==typeof t.handled?{handled:t.handled}:void 0===t.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof t.synthetic?t.synthetic:e.synthetic,exception_id:a}):{type:"chained",source:n,synthetic:e.synthetic,exception_id:a,parent_id:r},u={type:e.type,value:e.value,mechanism:l};for(let t of(e.stack&&(u.stacktrace={type:"raw",frames:e.stack}),i.push(u),e.cause&&s(e.cause,a,"cause"),null!=(o=e.errors)?o:[]))s(t,a,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:function(e){let t=globalThis._posthogChunkIds;if(!t)return;let i=Object.keys(t);return n&&i.length===r||(r=i.length,n=i.reduce((i,r)=>{s||(s={});let n=s[r];if(n)i[n[0]]=n[1];else{let n=e(r);for(let e=n.length-1;e>=0;e--){let o=n[e],a=null==o?void 0:o.filename,l=t[r];if(a&&l){i[a]=l,s[r]=[a,l];break}}}return i},{})),n}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}getAggregateErrors(e){try{if(K(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;let s=null==(t=Object.getOwnPropertyDescriptor(i,"constructor"))?void 0:t.value;if("function"==typeof s&&"AggregateError"===s.name){let t=e.errors;return T(t)?t:void 0}i=Object.getPrototypeOf(i)}}}catch(e){}}buildCoercingContext(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;var s=this;let r=0,n=0,o=!1,a=new Set,l=[],u={},h=function(e,t){let i,h,d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,p=c(t,d),f=p.apply;if(p.apply=t=>{l.push(e);try{return f(t)}finally{l.pop()}},d>4||d>
10&&-1!==l.indexOf(e))return s.coerceFallback(p);let g="object"==typeof e&&null!==e||"function"==typeof e;if(0===d&&r>=50||g&&a.has(e))return;g&&a.add(e),0===d&&r++;let v=s.getAggregateErrors(e);o||(o=!!v);try{if(!(i=s.applyCoercers(e,p)))throw u}catch(e){if(e===u)return void(0===d&&r--);if(!o)throw e;i=s.coerceFallback(p)}if(!v||r>=50)return i;try{h=v.length}catch(e){return i}if(!Number.isInteger(h)||0>h||h>0xffffffff)return i;let _=[];for(let e=0;50>r&&1e3>n&&h>e;e++){let i;n++;try{i=p.next(v[e])}catch(e){r++,i=s.coerceFallback(c(t+1))}i&&_.push(i)}return t_(t_({},i),{},{errors:_})},c=function(i){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t_(t_({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:0==i?e:{},apply(e){let t=h(e,i,s+1);if(!t)throw u;return t},next:e=>h(e,i+1)})},d=c(i);return t_(t_({},d),{},{apply:e=>{var t;return null!=(t=h(e,i))?t:this.coerceFallback(d)}})}constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}};let ty=/^([a-z][a-z0-9.+-]+):/i,tb=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function tw(e,t,i,s,r){let n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:function(e){if(!e||"<anonymous>"===e)return!1;let t=ty.exec(e);return!t||tb.includes(t[1].toLowerCase())}(t)};return j(s)||(n.lineno=s),j(r)||(n.colno=r),n}let tx=(e,t)=>{let i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},tk=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tE=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tS=/\((\S*)(?::(\d+))(?::(\d+))\)/,t$=(e,t)=>{let i=tk.exec(e);if(i){let[,e,s,r]=i;return tw(t,e,"?",+s,+r)}let s=tE.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){let e=tS.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}let[e,i]=tx(s[1]||"?",s[2]);return tw(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},tP=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tR=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tI=(e,t)=>{let i=tP.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){let e=tR.exec(i[3]);e&&(i[1]=i[1]||"eval",i[3]=e[1],i[4]=e[2],i[5]="")}let e=i[3],s=i[1]||"?";return[s,e]=tx(s,e),tw(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},tF=/\(error: (.*)\)/;function tO(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function tC(e,t){let i=t.start;for(;i>0&&tO(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function tM(e,t){let i=t.start+t.length,s=i;for(;e.length>s&&tO(e[s],e[s-t.length]);)s++;return s-i}var tA=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let i=q(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?"".concat(t,": ").concat(e.message):t}isDOMException(e){return J(e,"DOMException")}isDOMError(e){return J(e,"DOMError")}},tT=class{match(e){return K(e)}coerce(e,t){var i;let s=this.getStack(e),r=void 0===s?null==(i=t.syntheticException)?void 0:i.stack:void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:r,cause:e.cause?t.next(e.cause):void 0,synthetic:!!r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){try{let t=e.stacktrace;if("string"==typeof t&&t.length>0)return t;let i=e.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(e){return}}},tL=class{match(e){return!!J(e,"ErrorEvent")&&(null!=e.error||this.ur(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);let s=t.apply(e.message);return t_(t_({},s),{},{stack:null!=(i=this.cr(e))?i:s.stack,synthetic:!0})}ur(e){return q(e.message)&&e.message.length>0}cr(e){var t,i;let s=null!=(t=e.lineno)?t:0,r=null!=(i=e.colno)?i:0;if(q(e.filename)&&0!==e.filename.length&&0!==s)return"Error\n at ".concat(e.filename,":").concat(s,":").concat(r)}};let tD=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var tN=class{match(e){return"string"==typeof e}coerce(e,t){var i;let[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e,s=e.match(tD);return s&&(t=s[1],i=s[2]),[t,i]}};let tj=["fatal","error","warning","log","info","debug"];function tq(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let e=i.length;e>0;e--){let s=i.slice(0,e).join(", ");
1if(t>=s.length)return e===i.length?s:s.length>t?"".concat(s.slice(0,t),"..."):s}return""}var tB=class{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s;let r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null!=(i=this.getStack(e))?i:null==(s=t.syntheticException)?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Z(e))return e.constructor.name;let t="name"in e?e.name:void 0;return q(t)&&!B(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t="'".concat(e.name,"' captured as exception");return"message"in e&&"string"==typeof e.message&&(t+=" with message: '".concat(e.message,"'")),t}if("message"in e&&"string"==typeof e.message)return e.message;let t=this.getObjectClassName(e);return"".concat(t&&"Object"!==t?"'".concat(t,"'"):"Object"," captured as exception with keys: ").concat(tq(e))}isSeverityLevel(e){return q(e)&&!B(e)&&tj.indexOf(e)>=0}getStack(e){try{return q(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:q(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(let t in e)if(({}).hasOwnProperty.call(e,t)){let i=e[t];if(K(i))return i}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},tH=class{match(e){return Z(e)}coerce(e,t){var i;let s=e.constructor.name;return{type:s,value:"".concat(s," captured as exception with keys: ").concat(tq(e)),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},tz=class{match(e){return X(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: ".concat(String(e)),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}},tU=class{match(e){return J(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Z(e))return!1;try{let t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i;let s=this.getUnhandledRejectionReason(e);return X(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: ".concat(String(s)),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}};let tV="$message",tW="$timestamp",tG=new Set([tV,tW]),tY={enabled:!0,max_bytes:32768};function tX(e){var t;return e?{enabled:null!=(t=e.enabled)?t:tY.enabled,max_bytes:function(e,t){if(!U(e)||1/0===e||-1/0===e)return t;let i=Math.floor(e);return 0>i?t:i}(e.max_bytes,tY.max_bytes)}:t_({},tY)}var tJ=class{setConfig(e){this.Rr=tX(e),this.rs()}add(e){let t=function(e){let t;try{t=O(e)}catch(e){return}try{let e=JSON.parse(t);if(!D(e))return;let i=e[tV],s=e[tW];if(!q(i)||0===i.trim().length||!q(s)&&!U(s))return;return{step:e,json:t}}catch(e){return}}(e);if(!t)return;let i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;let t=encodeURIComponent(e),i=0;for(let e=0;t.length>e;e++)"%"===t[e]?(i+=1,e+=2):i+=1;return i}(t.json);i>this.Rr.max_bytes||(this.ns.push({step:t.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){let e=this.ns.shift();e&&(this.ss-=e.bytes)}}constructor(e){this.ns=[],this.ss=0,this.Rr=tX(e)}};let tK=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function tZ(e){return"string"==typeof e||e}function tQ(e){return"string"==typeof e?e:void 0}let t0=["$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"],t1="NativeGzipValidationError",t2=e=>e.length>=2&&31===e[0]&&139===e[1],t3=(e,t)=>
1e===S.GZipJS||t===S.GZipJS||"gzip"===t,t5=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),t4=e=>{throw tu(t1,"Native gzip produced invalid output: ".concat(e))},t6=(k=er(function*(e,t){18>e.size&&t4("too-short");let i=new Uint8Array((yield e.slice(0,10).arrayBuffer()));t2(i)&&8===i[2]||t4("invalid-header");let s=new DataView((yield e.slice(e.size-8).arrayBuffer()));s.getUint32(0,!0)!==(e=>{let t=(()=>{if(o)return o;o=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?0xedb88320^t>>>1:t>>>1;o[e]=t>>>0}return o})(),i=0xffffffff;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(0xffffffff^i)>>>0})(t)&&t4("invalid-crc");let r=t.length>>>0;s.getUint32(4,!0)!==r&&t4("invalid-size")}),function(e,t){return k.apply(this,arguments)});function t8(){return(t8=er(function*(e){var t;let i=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=arguments.length>2?arguments[2]:void 0;try{let i=(new TextEncoder).encode(e),s=new globalThis.CompressionStream("gzip"),r=s.writable.getWriter(),n=r.write(i).then(()=>r.close()).catch((t=er(function*(e){try{yield r.abort(e)}catch(e){}throw e}),function(e){return t.apply(this,arguments)})),o=new Response(s.readable).blob(),[a]=yield Promise.all([o,n]);return yield t6(a,i),a}catch(e){if(null==s?void 0:s.rethrow)throw e;return i&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}function t9(e,t){if(null==e)return{};var i,s,r=function(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(t.includes(s))continue;i[s]=e[s]}return i}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;n.length>s;s++)t.includes(i=n[s])||({}).propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}let t7={}.propertyIsEnumerable;function ie(e,t){try{return it(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function it(e,t,i,s){let r=[];for(let n in e)if(t7.call(e,n)){if(!n){null==t||t.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=i.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{let o=e[n];if(H(o)||j(o))continue;r.push({key:tr(n),value:function e(t,i,s,r){if(0>=s.remainingNodes)return{stringValue:ti};if(s.remainingNodes--,W(t))return{boolValue:t};if("bigint"==typeof t){let e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>t?(null==i||i.debug("Attribute ".concat(e," is outside the int64 range; encoding it as a string")),{stringValue:e}):{intValue:e}}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(typeof BigInt>"u")return{stringValue:String(t)};let e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug("Attribute ".concat(e," is outside the int64 range; encoding it as a string")),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:tr(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(s.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:ti};if(t instanceof Date){let e=Number.isFinite(t.getTime())?t.toISOString():String(t);return{stringValue:"string"==typeof e?tr(e):String(e)}}s.ancestors.add(t);try{try{let n=t.toJSON;if("function"==typeof n)return e(n.call(t),i,s,r+1)}catch(e){}return T(t)?{arrayValue:{values:function(t,i,s,r){let n=[],o=Math.min(t.length,1e3),a=0;for(;o>a&&s.remainingNodes>0;a++)try{let o=a in t?t[a]:void 0;if(z(o))continue;n.push(e(o,i,s,r))}catch(e){n.push({stringValue:ts})}return t.length>a&&n.push({stringValue:ti}),n}(t,i,s,r+1)}}:{kvlistValue:{values:it(t,i,s,r+1)}}}finally{s.ancestors.delete(t)}}return{stringValue:tr(String(t))}}(o,t,i,s)})}catch(e){r.push({key:tr(n),value:{stringValue:ts}})}}return r}function ii(e,t,i){return t_(t_(t_(t_({},tn({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}let is=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function ir(e,t){let i=tn({},e),s={};for(let e of is)({}).hasOwnProperty.call(i,e)&&(s[e]=i[e],delete i[e]);return[...ie(i,t),...ie(s,t)]}let io={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},ia={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}},il=ia.info;function iu(e,t,i,s){return{resourceLogs:[{resource:{attributes:ir(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var ih=class{get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=td(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}constructor(e){this.ls=e,this.us=0}};function ic(){return .75+.5*Math.random()}function id(e,t,i,s){let r=e*Math.pow(2,Math.min(Math.max(0,t-1),6));return Math.round((void 0===s?r:Math.min(r,Math.max(s,e)))*i)}var ip=class{clearQueue(){this._s++,this._instance.setPersistedProperty(E.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var i;if(this._instance.isDisabled||this._instance.optedOut||!(null==e?void 0:e.body))return;let s=this.Os(e);if(null===s)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;let r={record:function(e,t,i,s){let{text:r,number:n}=ia[e.level||"info"]||il,o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();return String(e)+"000000"}(U(s)?s:void 0),a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),z(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),z(t.lastActivityTimestamp)||(a.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(a["url.full"]=t.currentUrl),t.screenName&&(a["screen.name"]=t.screenName),t.appState&&(a["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(a.feature_flags=t.activeFeatureFlags);let l=t_({},a),u=e.attributes;if(u){let e=[];try{e=Object.keys(u)}catch(t){e=[]}for(let t of e){let e;try{e=u[t]}catch(t){e=ts}Object.defineProperty(l,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}let h={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:r,body:{stringValue:function(e){try{return tr(String(e))}catch(e){return ts}}(e.body)},attributes:ie(l,i)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),j(e.trace_flags)||(h.flags=e.trace_flags),h}(s,null!=(i=null==t?void 0:t.context)?i:this.cs(),this.$,null==t?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){let t=this.Rr.beforeSend;if(!t)return e;let i=T(t)?t:[t],s=e;for(let e of i)try{let t=e(s);if(!t)return this.$.info("Log was rejected in beforeSend function"),null;s=t}catch(e){return this.$.error("Error in beforeSend function for log:",e),null}return s}Ds(){if(void 0===this.Rs)return!0;let e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn("captureLog dropping logs: exceeded ".concat(this.Rs," logs per ").concat(this.Ps,"ms")),this.$s=!0),!1)}flush(){var e=this;return er(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return er(function*(){var t,i,s;e.ps.clear();let r=null!=(t=e._instance.getPersistedProperty(E.LogsQueue))?t:[];if(0===r.length)return;let n=r.length,o=0;for(;r.length>0&&n>o;){let t=e._s;e.bs=0;let n=Math.min(r.length,e.Es),a=r.slice(0,n),l=iu(a.map(e=>e.record),e.qs(),null!=(i=e.fs)?i:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(l);if(e._s!==t)return;if("too-large"===u.kind&&a.length>1)e.Es=Math.max(1,Math.floor(a.length/2)),e.$.warn("Logs batch of size ".concat(a.length," was too large for the ingestion endpoint, reducing batch size to ").concat(e.Es));else if(e.ws.record(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),"retry-later"===u.kind||("too-large"===u.kind?e.$.warn("Dropping a single log record with batch size 1 â the record
1is larger than the server cap and cannot be split further."):"ok"===u.kind&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(a.length),r=null!=(s=e._instance.getPersistedProperty(E.LogsQueue))?s:[],o+=a.length,"fatal"===u.kind))throw u.error}})()}Bs(e){var t=this;return er(function*(){var i;let s=Math.max(0,e-t.bs),r=null!=(i=t._instance.getPersistedProperty(E.LogsQueue))?i:[];t._instance.setPersistedProperty(E.LogsQueue,r.slice(s)),yield t.vs()})()}qs(){var e;return e=this.Rr,ii(e,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;let i=null!=(t=this._instance.getPersistedProperty(E.LogsQueue))?t:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(E.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(id(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(E.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return er(function*(){t.ps.clear();let i=t.flush().catch(()=>{});void 0!==e?yield tp(i,e):yield i})()}flushWithTimeout(e){var t=this;return er(function*(){let i=t.flush();yield tp(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=ic(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}constructor(e,t,i,s,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Rr=t,this.$=i,this.cs=s,this.ds=r,this.vs=n,this.fs=o,this.ps=new ih(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new to,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max(null!=(a=t.maxQueueSize)?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}};let ig=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function iv(e){return String(e)+"000000"}function i_(e,t,i,s){let r="";return s&&(r=Object.keys(s).sort().map(e=>"".concat(JSON.stringify(e),":").concat(JSON.stringify(s[e]))).join(",")),"".concat(e,"\0").concat(t,"\0").concat(null!=i?i:"","\0").concat(r)}var im=class{count(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;this.Zs({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this.Zs({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this.Zs({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e,t=this;let i=this.ys,s=(e=er(function*(){i&&(yield i.catch(()=>{})),yield t.Qs()}),function(){return e.apply(this,arguments)})().finally(()=>{this.ys===s&&(this.ys=null)});return this.ys=s,s}drainWindow(){if(0===this.zs.size)return null;let e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){let t,i;if(this._instance.isDisabled||this._instance.optedOut)return;let s=this.Os(e);if(null===s)return;if(!s.name||"string"!=typeof s.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof s.value||!Number.isFinite(s.value))return void this.$.warn("Dropping metric '".concat(s.name,"': value must be a finite number"));if("count"===s.type&&0>s.value)return void this.$.warn("Dropping count '".concat(s.name,"': counters are monotonic, value must be >= 0"));try{t=s.attributes?t_({},s.attributes):void 0,i=i_(s.type,s.name,s.unit,t)}catch(e){return void this.$.warn("Dropping metric '".concat(s.name,"': attributes could not be serialized"),e)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:s.name,type:s.type,unit:s.unit,attributes:t,windowStartMs:Date.now()},this.zs.set(i,r)}let n=this.Ws.get(s.name);
1void 0===n?this.Ws.set(s.name,s.type):n===s.type||this.Vs.has(s.name)||(this.Vs.add(s.name),this.$.warn("Metric name '".concat(s.name,"' is already used as a ").concat(n,"; recording it as a ").concat(s.type," too will blend both series in charts. Use a distinct name."))),this.Xs(r,s.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn("Metric series cap reached (".concat(this.Rr.maxSeriesPerFlush," per flush window); dropping new series until the next flush. Reduce attribute cardinality."))),!1)}Xs(e,t){switch(e.type){case"count":var i;e.total=(null!=(i=e.total)?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(ig.length+1).fill(0)});let i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(e,t){for(let i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,ig)]+=1}}}Os(e){let t=this.Rr.beforeSend;if(!t)return e;let i=T(t)?t:[t],s=e;for(let e of i)try{let t=e(s);if(!t)return this.$.info("Metric was rejected in beforeSend function"),null;s=t}catch(e){return this.$.error("Error in beforeSend function for metric:",e),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(id(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return er(function*(){if(e.ps.clear(),0===e.zs.size)return;let t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;let i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),"retry-later"===s.kind?(e.ks++,e.Ss=ic()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),s.kind){case"ok":return;case"retry-later":return e.ho(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",s.error)}})()}Js(e){var t,i,s,r;return t=this.vo(e),i=ii(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ir(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]}}vo(e){let t=iv(Date.now()),i=new Map;for(let o of e.values()){var s,r,n;let e=i_(o.type,o.name,o.unit,void 0),a=i.get(e);a||(a=t_({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(e,a));let l=ie(null!=(s=o.attributes)?s:{},this.$),u=iv(o.windowStartMs);if("count"===o.type){let e={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:null!=(r=o.total)?r:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){let e={attributes:l,timeUnixNano:t,asDouble:null!=(n=o.last)?n:0};a.gauge.dataPoints.push(e)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:ig})}return Array.from(i.values())}ho(e){for(let[s,r]of e){let e=this.zs.get(s);if(e)switch(e.windowStartMs=Math.min(e.windowStartMs,r.windowStartMs),e.type){case"count":var t,i;e.total=(null!=(t=e.total)?t:0)+(null!=(i=r.total)?i:0);break;case"gauge":break;case"histogram":if(r.hist)if(e.hist){e.hist.count+=r.hist.count,e.hist.sum+=r.hist.sum,e.hist.min=Math.min(e.hist.min,r.hist.min),e.hist.max=Math.max(e.hist.max,r.hist.max);for(let t=0;e.hist.bucketCounts.length>t;t++)e.hist.bucketCounts[t]+=r.hist.bucketCounts[t]}else e.hist=r.hist}else this.Ks()&&this.zs.set(s,r)}}constructor(e,t,i){this._instance=e,this.Rr=t,this.$=i,this.zs=new Map,this.ps=new ih(()=>this.flush().catch(e=>{this.$.error("Metrics flush failed:",e)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new to,this.ks=0,this.Ss=1,this.Gs=0}};let iy=function(e){let{debugEnabled:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={N(i){for(var s=arguments.length,r=Array(s>1?s-1:0),n=1;n<s;n++)r[n-1]=arguments[n];l&&(x.DEBUG||l.POSTHOG_DEBUG||t)&&!j(l.console)&&l.console&&("__rrweb_original__"in l.console[i]?l.console[i].__rrweb_original__:l.console[i])(e,...r)},debug(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];i.N("debug",...t)},info(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];i.N("log",...t)},warn(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];i.N("warn",...t)},error(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];i.N("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){i.error("You must initialize PostHog before calling ".concat(e))},createLogger:(t,i)=>iy("".concat(e," ").concat(t),i)};return i},ib=iy("[PostHog.js]"),iw=ib.createLogger,ix=iw("[ExternalScriptsLoader]"),ik=e=>{let t=null==c?void 0:c.querySelectorAll("script");
1if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},iE=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return ix.warn("".concat(t," was requested but loading of external scripts is disabled.")),i("Loading of external scripts is disabled");let s=ik(t);if(s){if(s.__posthog_loading_callback_fired)return i();let e=s.__posthog_loading_error;return e?i(e):(s.addEventListener("load",e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)}),void s.addEventListener("error",e=>{s.__posthog_loading_error=e,i(e)}))}let r=()=>{if(!c)return i("document not found");if(ik(t))return iE(e,t,i);let s=c.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>{s.__posthog_loading_error=e,i(e)},e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)c.head.appendChild(s);else{var r;let e=c.querySelectorAll("body > script");e.length>0?null==(r=e[0].parentNode)||r.insertBefore(s,e[0]):c.body.appendChild(s)}};(null==c?void 0:c.body)?r():null==c||c.addEventListener("DOMContentLoaded",r)},iS={},i$=(e,t)=>{let i="/static/".concat(t,".js?v=").concat(e.version);return"toolbar"===t&&(i="".concat(i,"&t=").concat(3e5*Math.floor(Date.now()/3e5))),e.requestRouter.endpointFor("assets",i)};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"===t){let t=e.requestRouter.endpointFor("assets","/array/".concat(e.config.token,"/config.js"));return void iE(e,t,i)}let s=e.config.strict_script_versioning;if(s){let r=e.requestRouter.endpointFor("assets","/static/".concat(e.version,"/").concat(t,".js")),n=iS[r];if("fallback"===s&&n){if(ik(n))return void iE(e,n,i);delete iS[r]}return void iE(e,r,"fallback"===s?(s,n)=>{if(s)if("string"==typeof s)i(s);else{var o;let s=i$(e,t);iS[r]=s;let n=ik(r);null==n||null==(o=n.parentNode)||o.removeChild(n),iE(e,s,i)}else i(void 0,n)}:i)}iE(e,i$(e,t),i)},b.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{let s=e.requestRouter.endpointFor("api",t);iE(e,s,i)},x.DEBUG=!1,x.LIB_VERSION="1.434.11",x.LIB_NAME="web";let iP="distinct_id",iR="$device_id",iI="$device_model",iF="__alias",iO="$fbc",iC="$fbc_persistence",iM="$fbp",iA="$fbp_persistence",iT="__timers",iL="$autocapture_disabled_server_side",iD="$heatmaps_enabled_server_side",iN="$exception_capture_enabled_server_side",ij="$error_tracking_suppression_rules",iq="$error_tracking_capture_extension_exceptions",iB="$web_vitals_enabled_server_side",iH="$dead_clicks_enabled_server_side",iz="$product_tours_enabled_server_side",iU="$logs_capture_enabled_server_side",iV="$web_vitals_allowed_metrics",iW="$session_recording_remote_config",iG="$sesid",iY="$session_is_sampled",iX="$enabled_feature_flags",iJ="$active_feature_flags",iK="$early_access_features",iZ="$feature_flag_details",iQ="$feature_flag_payloads",i0="$feature_flag_request_id",i1="$minimal_flag_called_events",i2="$override_feature_flags",i3="$override_feature_flag_payloads",i5="$stored_person_properties",i4="$stored_group_properties",i6="$groups",i8="$surveys",i9="$surveys_loaded_at",i7="$surveys_activated",se="$surveys_activated_session",st="$surveys_activated_timestamps",si="ph_product_tours",ss="$flag_call_reported",sr="$flag_call_reported_session_id",sn="$feature_flag_errors",so="$feature_flag_evaluated_at",sa="$user_state",sl="$client_session_props",su="$initial_campaign_params",sh="$initial_referrer_info",sc="$initial_person_info",sd="$epp",sp="$posthog_cookieless",sf="$cookieless_mode",sg="$sdk_debug_extensions_init_method",sv="$sdk_debug_extensions_init_time_ms",s_="$sdk_debug_recording_script_not_loaded",sm="$sdk_debug_replay_stale_config",sy="PostHog loadExternalDependency extension not found.",sb="anonymous",sw="identified",sx="identified_only",sk="visibilitychange",sE="beforeunload",sS="$pageview",s$="$pageleave",sP="$identify",sR="$groupidentify";function sI(e,t){T(e)&&e.forEach(t)}function sF(e,t){if(!z(e))if(T(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(let i in e)M.call(e,i)&&t(e[i],i)}let sO=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];for(let t of i)for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e};function sC(e){let t=Object.keys(e),i=t.length,s=Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}let sM=function(e){return function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];try{return e.apply(this,i)}catch(e){ib.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ib.critical(e)}}},sA=function(e){let t={};return sF(e,function(e,i){(q(e)&&e.length>0||U(e))&&(t[i]=e)}),t};function sT(e){let t=t_({},e);for(let i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}let sL=["herokuapp.com","vercel.app","netlify.app"];function sD(e,t,i,s){let{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function sN(e){return"ph_toolbar_internal"===e.name}let sj=e=>{if(c){try{let t=e+"=",i=c.cookie.split(";").filter(e=>e.length);for(let e=0;i.length>e;e++){let s=i[e];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return U(e)&&isFinite(e)&&Math.floor(e)===e});var sq=class e{static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>0x3fffffff||r>0xffffffff)throw RangeError("invalid field value");let n=new Uint8Array(16);return n[0]=t/0x10000000000,n[1]=t/0x100000000,n[2]=t/0x1000000,n[3]=t/65536,n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>
1>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new e(n)}toString(){let e="";for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){let i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}},sB=class{generate(){let e=this.generateOrAbort();if(!j(e))return e;{this.Ct=0;let e=this.generateOrAbort();if(j(e))throw Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){let e=(()=>{let e=Date.now();return U(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>0x3ffffffffff&&(this.Ct++,this.Mt())}return sq.fromFieldsV7(this.Ct,Math.trunc(this.It/0x40000000),0x3fffffff&this.It,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new sz}};let sH=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};l&&!j(l.crypto)&&crypto.getRandomValues&&(sH=e=>crypto.getRandomValues(e));var sz=class{nextUint32(){return this.Rt.length>this.$t||(sH(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let sU=()=>sV().toString(),sV=()=>(a||(a=new sB)).generate(),sW="",sG=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,sY=null,sX={Et(){if(!H(sY))return sY;if(sY=!1,c)try{let e="__ph_cookie_support_".concat(sU());sX.At(e,"xyz"),sY='"xyz"'===sj(e),sX.Lt(e)}catch(e){sY=!1}return sY},Pt(e){ib.error("cookieStore error: "+e)},Ot:sj,Dt(e){let t;try{t=JSON.parse(sX.Ot(e))||{}}catch(e){}return t},At(e,t,i,s,r){if(!c)return!1;try{let n="",o="",a=function(e,t){if(t){let t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;if(sW)return sW;if(!t||["localhost","127.0.0.1"].includes(e))return"";let i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+sU();for(;!sW&&s--;){let e=i.slice(s).join("."),n=r+"=1;domain=."+e+";path=/";t.cookie=n+";max-age=3",t.cookie.includes(r)&&(t.cookie=n+";max-age=0",sW=e)}return sW}(e);if(!t){let i=(e=>{let t=e.match(sG);return t?t[0]:""})(e);i!==t&&ib.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(c.location.hostname,s);if(i){let e=new Date;e.setTime(e.getTime()+864e5*i),n="; expires="+e.toUTCString()}r&&(o="; secure");let l=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&ib.warn("cookieStore warning: large cookie, len="+l.length),c.cookie=l,!0}catch(e){return!1}},Lt(e,t){if((null==c?void 0:c.cookie)&&(!t||!H(sj(e))))try{sX.At(e,"",-1,t)}catch(e){return}}},sJ=null,sK={Et(){if(!H(sJ))return sJ;let e=!0;if(j(l))e=!1;else try{let t="__mplssupport__";sK.At(t,"xyz"),'"xyz"'!==sK.Ot(t)&&(e=!1),sK.Lt(t)}catch(t){e=!1}return e||ib.error("localStorage unsupported; falling back to cookie store"),sJ=e,e},Pt(e){ib.error("localStorage error: "+e)},Ot(e){try{return null==l?void 0:l.localStorage.getItem(e)}catch(e){sK.Pt(e)}return null},Dt(e){try{return JSON.parse(sK.Ot(e))||{}}catch(e){}return null},At(e,t){try{return null==l||l.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){sK.Pt(e)}return!1},Lt(e){try{null==l||l.localStorage.removeItem(e)}catch(e){sK.Pt(e)}}},sZ=[i5,iJ,iX,iZ,iQ,i0,so,sn,ss],sQ=[iR,iP,iG,iY,sd,sc,iC,sa],s0=["__proto__","constructor","prototype"],s1=e=>{if(!D(e))return{};let t={};return Object.keys(e).forEach(i=>{-1===s0.indexOf(i)&&(t[i]=e[i])}),t},s2=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i={};return[...sQ,...t].forEach(t=>{let s=e[t];j(s)||H(s)||""===s||(i[t]=s)}),i},s3=e=>{let t=5381,i=0x811c9dc5;for(let s=0;e.length>s;s++){let r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,0x1000193)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},s5=(e,t)=>({p:t,f:s3(JSON.stringify(e))}),s4=(e,t)=>
1{if(!t)return{properties:[],isValid:!1};try{let i=sX.Dt(e+"_cpm"),s=(null==i?void 0:i.f)===s3(t)&&T(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},s6=(e,t)=>t+"|"+(sX.Ot(e+"_cpm")||""),s8={},s9={Et:()=>!0,Pt(e){ib.error("memoryStorage error: "+e)},Ot:e=>e in s8?s8[e]:null,Dt:e=>e in s8?s8[e]:null,At:(e,t)=>(s8[e]=t,!0),Lt(e){delete s8[e]}},s7=null,re={Et(){if(!H(s7))return s7;if(s7=!0,j(l))s7=!1;else try{let e="__support__";re.At(e,"xyz"),'"xyz"'!==re.Ot(e)&&(s7=!1),re.Lt(e)}catch(e){s7=!1}return s7},Pt(e){ib.error("sessionStorage error: ",e)},Ot(e){try{return null==l?void 0:l.sessionStorage.getItem(e)}catch(e){re.Pt(e)}return null},Dt(e){try{return JSON.parse(re.Ot(e))||null}catch(e){}return null},At(e,t){try{return null==l||l.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){re.Pt(e)}return!1},Lt(e){try{null==l||l.sessionStorage.removeItem(e)}catch(e){re.Pt(e)}}};var rt=class{get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return"always"===this.Rr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Rr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,+!!e,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){let{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get No(){let e=this.qo.Ot(this.jo);return et(e)?1:R(ei,e)?0:-1}get qo(){let e=this.Rr.opt_out_capturing_persistence_type,t="localStorage"===e?sK:sX,i=t.Et()?t:s9;if(!this.Bo||this.Bo!==i){this.Bo=i;let t="localStorage"===e?sX:sK;t.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(et(t.Ot(this.jo))),t.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[null==h?void 0:h.doNotTrack,null==h?void 0:h.msDoNotTrack,b.doNotTrack,null==h?void 0:h.globalPrivacyControl].some(e=>et(e))}constructor(e){this._instance=e}};function ri(e,t){var i;let s=null==e||null==(i=e.config)?void 0:i.get_current_url;if(!L(s))return t;try{let e=s(t);return q(e)&&e?e:t}catch(e){return ib.error("Error in get_current_url, falling back to window.location.href",e),t}}function rs(e){var t;return e instanceof Element&&("__POSTHOG_TOOLBAR__"===e.id||!!(null==(t=e.closest)?void 0:t.call(e,".toolbar-global-fade-container")))}function rr(e){return!!e&&1===e.nodeType}function rn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ro(e){return!!e&&3===e.nodeType}function ra(e){return!!e&&11===e.nodeType&&rr(e.host)}function rl(e){return e?I(e).split(/\s+/):[]}function ru(e,t){let i=function(e){var t;let i=null==l||null==(t=l.location)?void 0:t.href;return j(i)?void 0:ri(e,i)}(t);return!!(i&&e&&e.some(e=>i.match(e)))}function rh(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return rl(t)}function rc(e){return z(e)?null:I(e).split(/(\s+)/).filter(e=>rT(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rd(e){let t="";return rP(e)&&!rR(e)&&e.childNodes&&e.childNodes.length&&sF(e.childNodes,function(e){var i;ro(e)&&e.textContent&&(t+=null!=(i=rc(e.textContent))?i:"")}),I(t)}function rp(e){var t;return j(e.target)?e.srcElement||null:(null==(t=e.target)?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}let rf=["a","button","form","input","select","textarea","label"];function rg(e,t){let i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}}function rv(e,t){if(j(t))return!0;for(let i of e)if(t.some(e=>rg(i,e)))return!0;return!1}function r_(e){let t=e.parentNode;return!(!t||!rr(t))&&t}let rm=[".ph-no-autocapture","[data-ph-no-autocapture]"],ry=["next","previous","prev",">","<"],rb=[...ry,"+","-","â","â"],rw=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,rx=[".ph-no-rageclick",".ph-no-capture"],rk=["","text","search","email","password","url","tel","number"];function rE(e,t){var i,s,r;let n,o,a;if(!l||rS(e)||(W(t)?(n=!!t&&rx,o=void 0,a=!1):(n=null!=(i=null==t?void 0:t.css_selector_ignorelist)?i:rx,o=null==t?void 0:t.content_ignorelist,a=null!=(s=null==t?void 0:t.ignore_text_selection)&&s),!1===n)||a&&!(!(r=e)||!rr(r))&&(rn(r,"textarea")||(rn(r,"input")?R(rk,(r.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;let i=null==(t=e.getAttribute)?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(r))))return!1;let{targetElementList:u}=r$(e,!1);return!function(e,t){let i;if(!1===e||j(e))return!1;if(!0===e)i=ry;else{if(!T(e))return!1;if(e.length>10)return ib.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{let{safeText:t,ariaLabel:s}=e;return i.some(e=>rw(t,e)||rw(s,e))})}(o,u.map(e=>{var t;return{safeText:rd(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!rv(u,n)}let rS=e=>!e||rn(e,"html")||!rr(e),r$=(e,t)=>{if(!l||rS(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1,s=[e],r=e;for(;r.parentNode&&!rn(r,"body");){if(ra(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}let e=r_(r);if(!e)break;if(t||rf.indexOf(e.tagName.toLowerCase())>-1)i=!0;else try{let t=l.getComputedStyle(e);t&&"pointer"===t.getPropertyValue("cursor")&&(i=!0)}catch(e){}s.push(e),r=e}return{parentIsUsefulElement:i,targetElementList:s}};function rP(e){let t=new Set,i=0;for(let s=e;s.parentNode&&!rn(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);let e=rh(s);if(R(e,"ph-sensitive")||R(e,"ph-no-capture"))return!1}if(R(rh(e),"ph-include"))return!0;let s=e.type||"";if(q(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}
1let r=e.name||e.id||"";return!q(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function rR(e){return!!(rn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rn(e,"select")||rn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}let rI=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}))$"),rF=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,rO=[16,15,14,13],rC=RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),rM=RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),rA=/[0-9A-Za-z_]/;function rT(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return!(z(e)||q(e)&&(e=I(e),(t?rI.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(rF.lastIndex=0;t=rF.exec(e);){let e=t[2];if(!e)continue;let i=e.replace(/[- ]/g,"");for(let e=0;i.length>e;e++)for(let t of rO){let s=e+t;if(i.length>=s){let t=i.slice(e,s);if(rI.test(t)&&function(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let r=e.charCodeAt(s)-48;i&&(r*=2)>9&&(r-=9),t+=r,i=!i}return t%10==0}(t))return!0}}}return!1}(e))||(t?rC.test(e):function(e){let t;for(rM.lastIndex=0;t=rM.exec(e);){let e=t[1],i=t[3];if(!(e&&i&&rA.test(e)&&rA.test(i)))return!0}return!1}(e))))&&!0}function rL(e){let t=rd(e);return rT(t="".concat(t," ").concat(function e(t){let i="";return t&&t.childNodes&&t.childNodes.length&&sF(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{let s=rd(t);i="".concat(i," ").concat(s).trim(),t.childNodes&&t.childNodes.length&&(i="".concat(i," ").concat(e(t)).trim())}catch(e){ib.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function rD(e){return e.replace(/"|\\"/g,'\\"')}let rN=iw("[Dead Clicks]"),rj=()=>!0,rq=e=>{var t;let i=!!(null==(t=e.instance.persistence)?void 0:t.get_property(iH)),s=e.instance.config.capture_dead_clicks;return W(s)?s:!!D(s)||i};var rB=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[iH]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var t,i,s;(null==(t=b.__PosthogExtensions__)?void 0:t.initDeadClicksAutocapture)?e():null==(i=b.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?rN.error("failed to load script",t):e()})}Uo(){var e;if(c){if(!this.Ho&&(null==(e=b.__PosthogExtensions__)?void 0:e.initDeadClicksAutocapture)){let e=D(this.instance.config.capture_dead_clicks)?t_({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Ho=b.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Ho.start(c),rN.info("starting...")}}else rN.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,rN.info("stopping..."))}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}};let rH=iw("[SegmentIntegration]");function rz(e,t){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=e.config.segment;if(!s)return t();let{analytics:r,filterProperties:n}=L(s.register)?{analytics:s}:s,o=s=>{var o;let a=()=>s.anonymousId()||sU();e.config.get_device_id=a,i&&s.id()&&(e.register({distinct_id:s.id(),$device_id:a()}),e.persistence.set_property(sa,sw)),o=i?void 0:s.anonymousId()||void 0,r.register(function(e,t){let{filterProperties:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"undefined"!=typeof Promise&&Promise.resolve||rH.warn("This browser does not have Promise support, and can not use the segment integration");let s=(s,r)=>{if(!r)return s;let n=!!t&&s.event.anonymousId===t&&!s.event.userId;n||s.event.userId||s.event.anonymousId===e.get_distinct_id()||(rH.info("No userId set, resetting PostHog"),e.reset()),n||(t=void 0),s.event.userId&&s.event.userId!==e.get_distinct_id()&&(rH.info("UserId set, identifying with PostHog"),e.identify(s.event.userId)
1);let o=e.calculateEventProperties(r,s.event.properties);if(!z(i)){let e=s.event.properties||{},t={};for(let i of Object.keys(o))M.call(e,i)||(t[i]=o[i]);let r=((e,t)=>{let i=T(e)?e:[e],s=t_({},t);for(let e of i)try{if(s=e(s),z(s))return null}catch(e){return rH.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(z(r))return s;o=r}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,sS),identify:e=>s(e,sP),screen:e=>s(e,"$screen")}}(e,o,{filterProperties:n})).then(()=>{t()},e=>{rH.error("Failed to register the Segment integration",e),t()})},a=r.user();"then"in a&&L(a.then)?a.then(o):o(a)}let rU="posthog-js";function rV(e){let{organization:t,projectId:i,prefix:s,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o=>{var a,l,u,h,c,d;if("*"!==r&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});let p=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));o.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));let f=(null==(a=o.exception)?void 0:a.values)||[],g=f.map(e=>t_(t_({},e),{},{stacktrace:e.stacktrace?t_(t_({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>t_(t_({},e),{},{platform:"web:javascript"}))}):void 0})),v={$exception_message:(null==(l=f[0])?void 0:l.value)||o.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||o.message,$sentry_exception_type:null==(c=f[0])?void 0:c.type,$sentry_tags:o.tags};return t&&i&&(v.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),n&&(null==(d=e.exceptions)||d.sendExceptionEvent(v)),o}}var rW=class{constructor(e,t,i,s,r,n){this.name=rU,this.setupOnce=function(o){o(rV(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},rG=class{Go(){var e;this.Zo=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.Wo)}destroy(){var e;null==(e=this.Zo)||e.call(this),this.Zo=void 0}doPageView(e,t){var i;let s=this.Qo(e,t);return this.Vo={pathname:null!=(i=null==l?void 0:l.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qo(e,null==(t=this.Vo)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Vo)?void 0:e.pageViewId}}Qo(e,t){let i=this.Vo;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:e,lastScrollY:t,maxScrollY:i,maxContentHeight:n,lastContentY:o,maxContentY:a}=r;if(!(j(e)||j(t)||j(i)||j(n)||j(o)||j(a))){e=Math.ceil(e),t=Math.ceil(t),i=Math.ceil(i),n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a);let r=e>1?ea(t/e,0,1,ib):1,l=e>1?ea(i/e,0,1,ib):1,u=n>1?ea(o/n,0,1,ib):1,h=n>1?ea(a/n,0,1,ib):1;s=sO(s,{$prev_pageview_last_scroll:t,$prev_pageview_last_scroll_percentage:r,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}constructor(e){this.Wo=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ib.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}};let rY=["flags","surveys"],rX={$people_distinct_id:{exposure:"hidden"}
1,[iF]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[iT]:{exposure:"hidden"},[iC]:{exposure:"hidden"},[iA]:{exposure:"hidden"},[iL]:{exposure:"event"},[iD]:{exposure:"hidden"},[iU]:{exposure:"hidden"},[iN]:{exposure:"event"},[ij]:{exposure:"hidden"},[iq]:{exposure:"event"},[iB]:{exposure:"event"},[iH]:{exposure:"event"},[iz]:{exposure:"hidden"},[iV]:{exposure:"event"},[iW]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[iG]:{exposure:"hidden"},[iY]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>H(e)},$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"},[iX]:{exposure:"hidden",storageGroup:"flags"},[iJ]:{exposure:"hidden",storageGroup:"flags"},[iK]:{exposure:"hidden"},[iZ]:{exposure:"hidden",storageGroup:"flags"},[iQ]:{exposure:"hidden",storageGroup:"flags"},[i0]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[i1]:{exposure:"hidden",storageGroup:"flags"},[i2]:{exposure:"hidden"},[i3]:{exposure:"hidden"},[i5]:{exposure:"hidden"},[i4]:{exposure:"hidden"},[i8]:{exposure:"hidden",storageGroup:"surveys"},[i9]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[i7]:{exposure:"event"},[se]:{exposure:"hidden"},[st]:{exposure:"hidden"},[si]:{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"},[ss]:{exposure:"hidden"},[sr]:{exposure:"hidden"},[i6]:{exposure:"event"},[sn]:{exposure:"hidden"},[so]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[sa]:{exposure:"hidden"},[sl]:{exposure:"hidden"},$capture_rate_limit:{exposure:"hidden"},[su]:{exposure:"hidden"},[sh]:{exposure:"hidden"},[sc]:{exposure:"hidden"},[sd]:{exposure:"hidden"},$replay_override_sampling:{exposure:"event"},$replay_override_linked_flag:{exposure:"event"},$replay_override_url_trigger:{exposure:"event"},$replay_override_event_trigger:{exposure:"event"},[sg]:{exposure:"event"},[sv]:{exposure:"event"},[s_]:{exposure:"event"},[sm]:{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"}
1,$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"}},rJ=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],rK=e=>{let t=rX[e];if(t)return t;for(let[t,i]of rJ)if(0===e.indexOf(t))return i},rZ=(e,t)=>{try{let i;return JSON.stringify(e,(e,t)=>K(t)?(null!=i||(i=new WeakMap),i.has(t)||i.set(t,sT(t)),i.get(t)):"bigint"==typeof t?t.toString():t,t)}catch(t){return O(e)}},rQ=e=>{let t=null==c?void 0:c.createElement("a");return j(t)?null:(t.href=e,t)},r0=function(e,t){let i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");for(let e=0;s.length>e;e++){let r=s[e].split("=");if(r[0]===t){i=r;break}}if(!T(i)||2>i.length)return"";{let e=i[1];try{e=decodeURIComponent(e)}catch(t){ib.error("Skipping decoding for malformed query param: "+e)}return e.replace(/\+/g," ")}},r1=function(e,t,i){if(!e||!t||!t.length)return e;let s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[];for(let e=0;l.length>e;e++){let s=l[e].split("=");T(s)&&(t.includes(s[0])?u.push(s[0]+"="+i):u.push(l[e]))}let h=a;return null!=o&&(h+="?"+u.join("&")),null!=r&&(h+="#"+r),h},r2=function(e,t){let i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},r3=(e,t)=>e>=t&&m(),r5=(e,t,i,s)=>{if(0===e){if(m()){let e=t+1;return e===i&&s(),e}return t}return 0},r4=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],r6=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...r4],r8="<masked>",r9=["li_fat_id"];function r7(e,t,i){if(!c)return{};let s=t?[...r4,...i||[]]:[],r=ne(r1(c.URL,s,r8),e);return sO(function(){let e={};return sF(r9,function(t){let i=sj(t);e[t]=i||null}),e}(),r)}function ne(e,t){let i=r6.concat(t||[]),s={};return sF(i,function(t){let i=r0(e,t);s[t]=i||null}),s}function nt(e){let t=e?0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null,i={};if(!H(t)){i.$search_engine=t;let e=c?r0(c.referrer,"yahoo"!=t?"q":"p"):"";e.length&&(i.ph_keyword=e)}return i}function ni(){return navigator.language||navigator.userLanguage}let ns="$direct";function nr(){return(null==c?void 0:c.referrer)||ns}function nn(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e?[...r4,...t||[]]:[],r=i?th(null==d?void 0:d.href):null==d?void 0:d.href,n=null==r?void 0:r.substring(0,1e3);return{r:nr().substring(0,1e3),u:n?r1(n,s,r8):void 0}}function no(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{r:s,u:r}=e,n=i?th(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==ns?ns:null==(t=rQ(s))?void 0:t.host};if(n){o.$current_url=n;let e=rQ(n);o.$host=null==e?void 0:e.host,o.$pathname=null==e?void 0:e.pathname,sO(o,ne(n))}return s&&sO(o,nt(s)),o}function na(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}let nl={flags:so,surveys:i9},nu=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],nh=e=>"".concat(e,"_cookie_identity_change_pending"),nc=e=>{let t="",i=0;for(let s of e){let e=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+e>1e3)break;t+=s,i+=e}return t},nd="main",np=[iX,iJ,iZ,iQ,i0,so,i1,i5],nf=e=>-1!==np.indexOf(e),ng=[iC,iA],nv=e=>-1!==ng.indexOf(e),n_=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},nm=e=>{if(!e)return{};let t=JSON.parse(e);return D(t)?t:{}},ny=(e,t)=>{sF(e,(i,s)=>{let r=rK(s);r&&"event"!==r.exposure||({}).hasOwnProperty.call(t,s)||delete e[s]})};var nb=class{markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(e=>{let[t,i]=e,s=this.ia.get(t);if(!nf(t)||!0===s)return;if(!0===i)return void this.ma(t,!0);let r=new Set(s||[]);
1i.forEach(e=>r.add(e)),r.size&&this.ma(t,r)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&l&&(l.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,t){let i,s,r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(this.mi)return!1;try{if(s=sK.Ot(e),H(s)){let e=this.ya(t);return e.storageValue=null,t!==nd&&(e.persisted=!1),!1}i=nm(s)}catch(e){return!1}let n=t===nd?i:sK.Dt(this.ha);if(n&&this.ba(n))return!1;let o=this._a(i,t,r);return t===nd&&this.Yo&&!n_(this.wa().main,i)||this.ka(i,t,!0,s),o}ba(e){let t=this.props[iP],i=e[iP];return!j(t)&&!j(i)&&t!==i}ka(e,t,i,s){let r=this.ya(t);r.storageValue=s,t!==nd&&(r.persisted=i);try{r.fingerprint=this.Sa(e,t)}catch(e){r.fingerprint=void 0}}_a(e,t,i){let s=!1;return np.forEach(i=>{var r;let n=null==(r=rK(i))?void 0:r.storageGroup;if(t===nd&&this.Yo&&n||t!==nd&&n!==t)return;let o=i in e,a=this.xa(i,o?e[i]:void 0),l=this.ia.has(i)?i in this.props:o;l===i in this.props&&n_(a,this.props[i])||(l?this.Ca(i,a,!1):this.$a(i,!1),s=!0)}),s&&i&&this.aa.forEach(e=>e()),s}Ta(){if(!this.Ko)return!1;try{this.ra=!1;let e=sK.Ot(this.ha),t=this.ya(nd),i,s=!1,r=!1;if(e!==t.storageValue)if(H(e))t.storageValue=null;else{if(i=nm(e),this.ra=!this.sa&&this.ba(i),this.ra)return!1;r=this._a(i,nd,!1),!this.Yo||n_(this.wa().main,i)?this.ka(i,nd,!0,e):t.storageValue=e,s=!0}return this.Yo&&rY.forEach(e=>{let t=sK.Ot(this.pa(e)),n=this.ya(e),o=i||{},a=s&&np.some(t=>{var i;return(null==(i=rK(t))?void 0:i.storageGroup)===e&&t in o});if(t===n.storageValue&&!a)return;if(H(t))return n.storageValue=null,n.persisted=!1,void(a&&(r=this._a(o,e,!1)||r));let l=nm(t);r=this._a(l,e,!1)||r,this.ka(l,e,!0,t)}),r}catch(e){return!1}}ma(e,t){this.ia.set(e,t);let i=rK(e);(null==i?void 0:i.volatile)||(this.ya((this.Yo?null==i?void 0:i.storageGroup:void 0)||nd
1).fingerprint=void 0,this.Ia(e))}Ma(){np.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{let e=sK.Ot(this.ha),t=nm(e);this.ya(nd).storageValue=e,np.forEach(e=>{var i;let s=this.Yo?null==(i=rK(e))?void 0:i.storageGroup:void 0,r=s?sK.Ot(this.pa(s)):null;if(s){let e=this.ya(s);e.storageValue=r,e.persisted=!H(r)}let n=s&&!H(r)?nm(r):t;e in this.props?this.Ea(e,n[e],this.props[e]):e in n&&this.ma(e,!0)})}catch(e){}}xa(e,t){let i=this.ia.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){let s=new Set(T(t)?t:[]),r=new Set(T(this.props[e])?this.props[e]:[]);return i.forEach(e=>r.has(e)?s.add(e):s.delete(e)),Array.from(s)}let s=D(t)?t_({},t):{},r=D(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in r?s[e]=r[e]:delete s[e]}),s}Ea(e,t,i){if(!nf(e))return;let s=this.ia.get(e);if(!0===s)return;let r=t;if(this.Ko)try{var n;let t=this.Yo?null==(n=rK(e))?void 0:n.storageGroup:void 0,i=t?this.pa(t):this.ha;r=nm(sK.Ot(i))[e]}catch(e){}let o=new Set(s||[]);if("$active_feature_flags"===e){if(!j(t)&&!T(t)||!j(r)&&!T(r)||!T(i))return void this.ma(e,!0);let s=new Set(t||[]),n=new Set(r||[]),a=new Set(i);new Set([...s,...a]).forEach(e=>{s.has(e)!==a.has(e)&&o.add(e)}),o.forEach(e=>{n.has(e)===a.has(e)&&o.delete(e)})}else{if(!D(i))return void(n_(r,i)?this.ia.delete(e):this.ma(e,!0));{if(!j(t)&&!D(t)||j(t)&&N(i)&&j(r))return void this.ma(e,!0);let s=D(t)?t:{},n=D(r)?r:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&n_(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in n==e in i&&n_(n[e],i[e])&&o.delete(e)})}}o.size?this.ma(e,o):this.ia.delete(e)}Pa(){var e;let t=null==(e=this.Rr)?void 0:e.persistence_save_debounce_ms;return U(t)&&t>0?t:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase())if(e)try{let t=s2(e,this.Rr.cookie_persisted_properties||[]),i=s5(t,this.Rr.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=sX.Ot(this.ha)||void 0;r&&s6(this.ha,r)===s&&(this.Aa=s,this.Fa=r)}catch(e){}else try{let e=sX.Ot(this.ha)||void 0;this.Aa=e?s6(this.ha,e):void 0,this.Fa=e}catch(e){}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e){let t,i,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.mi&&!s||this.ea||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;try{t=sX.Ot(this.ha)||void 0}catch(e){}if(!t||t===this.Fa)return!1;let r=s6(this.ha,t);try{i=s1(JSON.parse(t))}catch(e){return!1}if((sX.Ot(this.ha)||void 0)!==t)return!1;this.Aa=r,this.Fa=t;let n=s4(this.ha,t),o=[...sQ,...n.properties],a={};
1if(Object.keys(i).forEach(e=>{let t=i[e];(j(t)||H(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete i[e])}),N(i))return!1;let l="distinct_id"in i||"anonymous"===i.$user_state||"identified"===i.$user_state,u=this.props,h=u[iP],c=u[sa],d=sO({},u);[...sQ,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in i)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){let t=d[e];(n.isValid||-1===sQ.indexOf(e)||!1!==t&&0!==t)&&delete d[e]}}),this.props=sO(d,i),np.forEach(e=>{let t=e in this.props;e in u===t&&n_(u[e],this.props[e])||(t?this.Ea(e,u[e],this.props[e]):this.ma(e,!0))}),!l||"$user_state"in i||"$user_state"in this.props||this.Ca(sa,sb);let p=this.props[iP],f=this.props[sa];return l&&(p!==h||f!==c)&&(this.sa=!0,this.ta=!0,re.At(nh(this.ha),!0),this.$a(i5),this.$a(iJ),this.$a(iX),this.$a(iZ),this.$a(iQ),this.$a(i0),this.$a(so),this.$a(sn),this.$a(ss),"anonymous"!==f||"identified"!==c&&"anonymous"!==i.$user_state&&(j(h)||p===h)||(ny(this.props,i),this.$a(i4)),"identified"===f?this.props.$user_id=p:delete this.props.$user_id,this.$a(iF)),!0}
1consumeCookieIdentityChange(){let e=nh(this.ha),t=this.ta||!!re.Ot(e);return this.ta=!1,t&&re.Lt(e),t}Da(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||"localstorage+cookie"!==this.Rr.persistence.toLowerCase()||(this.ea=!0,0))}La(){this.ea&&(j(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[nd],this.qa(!0))}ja(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(this.ea)try{e?this.La():j(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){-1===nu.indexOf(e.persistence.toLowerCase())&&(ib.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");let t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[...sQ,...e];return t_(t_({},sK),{},{Dt(e){try{let r,n,o={};try{o=(n=sX.Ot(e)||void 0)?s1(JSON.parse(n)):{}}catch(e){}let a=JSON.parse(sK.Ot(e)||"{}");if(t){let t=s4(e,n),l=[...sQ,...t.properties],u={};Object.keys(o).forEach(e=>{let t=o[e];H(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});let h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var s;let e=a[iP],r=null!=(s=a.$user_state)?s:sb;i.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in o)&&(h||"distinct_id"!==e&&"$user_state"!==e)){let i=a[e];(t.isValid||-1===sQ.indexOf(e)||!1!==i&&0!==i)&&delete a[e]}}),!h||"$user_state"in o||"$user_state"in a||(a[sa]=sb),h&&(("distinct_id"in u?u[iP]:a[iP])!==e||("$user_state"in u?u[sa]:a[sa])!==r)&&(sZ.forEach(e=>delete a[e]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[iP]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[i6],delete a[i4]),delete a.__alias)}r=sO(a,u)}else r=sO(o,a);return sK.At(e,r),r}catch(e){}return null},At(i,s,r,n,o,a){let l=sK.At(i,s,void 0,void 0,a);try{let u=s2(s,e);if(Object.keys(u).length){if(t){let t=i+"_cpm",h=s5(u,e);if(sX.At(t,h,r,n,o,a),sX.Ot(t)!==JSON.stringify(h)){sX.Lt(t,n);let e=s2(s);return sX.At(i,e,r,n,o,a),l}}sX.At(i,u,r,n,o,a)}}catch(e){sK.Pt(e)}return l},Lt(e,t){try{null==l||l.localStorage.removeItem(e),sX.Lt(e,t),sX.Lt(e+"_cpm",t)}catch(e){sK.Pt(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i,s=!1,r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&sK.Et()?(i=sK,r=!0):"localstorage+cookie"===n&&t.Et()?(i=t,r=!0,s=!0):"sessionstorage"===n&&re.Et()?i=re:"memory"===n?i=s9:"cookie"===n&&sX.Et()?(i=sX,s=!0):t.Et()?(i=t,r=!0,s=!0):sX.Et()?(i=sX,s=!0):i=s9,this.Ko=r,this.Xo=s,i}pa(e){return"".concat(this.ha,"__").concat(e)}da(e){return this.Ko&&!!e.split_storage}properties(){let e={};return sF(this.props,(t,i)=>{let s=rK(i);if(!s||"event"===s.exposure){var r;if(null==s||null==(r=s.shouldSkipFromEventProperties)?void 0:r.call(s,t))return;e[i]=t}}),e}load(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.mi&&!e)return;let t=this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase(),i=t?sK.Dt(this.ha):null,s={};if(t)try{s=s1(sX.Dt(this.ha)),sF(s,(e,t)=>{(j(e)||H(e)||""===e)&&delete s[t]})}catch(e){}let r=this.qo.Dt(this.ha);if(r&&(this.props=sO({},r)),this.Yo&&this.Ba(),t&&r){var n,o;let e=null==i?void 0:i[iP],t=null!=(n=null==i?void 0:i.$user_state)?n:sb,a=r[iP],l=null!=(o=r.$user_state)?o:sb;if(a!==e||l!==t){this.ta=!0,re.At(nh(this.ha),!0);let i=sO({},this.props);sZ.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(j(e)||a===e)||(ny(i,s),delete i[i4]),this.props=i;let r=new Set;sZ.forEach(e=>{var t;let i=null==(t=rK(e))?void 0:t.storageGroup;i&&r.add(i)}),r.forEach(e=>{let t={};sF(this.props,(i,s)=>{var r;(null==(r=rK(s))?void 0:r.storageGroup)===e&&(t[s]=i)}),N(t)?(sK.Lt(this.pa(e)),this.Jo[e]={}):sK.At(this.pa(e),t)&&(this.Jo[e]={persisted:!0,fingerprint:this.Sa(t,e)})})}}re.Ot(nh(this.ha))&&(this.ta=!0)}Ba(){for(let e of rY){let t=sK.Dt(this.pa(e));if(t&&!N(t)){let i=this.ya(e);i.persisted=!0,this.Ha(e)||(i.fingerprint=this.Sa(t,e)),this.za(e,t)||sO(this.props,t)}}}Ha(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=rK(t))?void 0:i.storageGroup)===e})}za(e,t){let i=nl[e];
1if(!i)return!1;let s=t[i],r=this.props[i];return U(s)&&U(r)&&r>s}refreshKey(e){var t;if(this.mi||this.oa.has(e))return;let i=this.Yo?null==(t=rK(e))?void 0:t.storageGroup:void 0,s=i?sK.Dt(this.pa(i)):this.qo.Dt(this.ha);if(s&&e in s)this.Ca(e,s[e],!1);else{if(i){let t=this.qo.Dt(this.ha);if(t&&e in t)return void this.Ca(e,t[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;let e=this.Pa();e>0?j(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){j(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase()||ng.forEach(e=>this.refreshKey(e)));let t=!e&&!this.na;t||(this.ra=!1);let i=!!t&&this.Ta();if(this.ra)return void(this.Rr.debug&&ib.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(i&&this.aa.forEach(e=>e()));let s=this.Wa(this.qo,this.ha,this.props,nd);"written"===s&&this.Ra(this.props),"failed"!==s&&(this.ia.clear(),this.sa=!1,this.oa.clear()),i&&this.aa.forEach(e=>e())}Ua(){let{main:e,groups:t}=this.wa(),i=this.Wa(this.qo,this.ha,e,nd);for(let r of("written"===i&&this.Ra(e),"failed"!==i&&(this.sa=!1,this.oa.clear(),np.forEac
1h(e=>{var t;(null==(t=rK(e))?void 0:t.storageGroup)||this.ia.delete(e)})),rY)){var s;let e=t[r];if(N(e)&&!(null==(s=this.Jo[r])?void 0:s.persisted)){np.forEach(e=>{var t;(null==(t=rK(e))?void 0:t.storageGroup)===r&&this.ia.delete(e)});continue}let i=this.Wa(sK,this.pa(r),e,r);"failed"!==i&&np.forEach(e=>{let t=rK(e);(null==t?void 0:t.storageGroup)!==r||"written"!==i&&t.volatile||this.ia.delete(e)})}}wa(){let e={},t={flags:{},surveys:{}};return sF(this.props,(i,s)=>{var r;let n=null==(r=rK(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}Sa(e,t){if(t===nd)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;let i={};return sF(e,(e,t)=>{var s;i[t]=(null==(s=rK(t))?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}Wa(e,t,i,s){let r,n=this.ya(s);if(s!==nd&&!n.dirty&&!j(n.fingerprint))return"skipped";try{if((r=this.Sa(i,s))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e.At(t,i,this.Va,this.Ga,this.Za,this.Rr.debug)?(n.dirty=!1,s!==nd&&(n.persisted=!0),j(r)||(n.fingerprint=r),this.Ko&&(n.storageValue=sK.Ot(t)),"written"):(this.Rr.debug&&ib.warn('failed to persist storage entry "'.concat(t,'"; will retry on next save')),"failed")}remove(){let{keepGroupEntries:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.Ma(),j(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(let e of rY)sK.Lt(this.pa(e));e?delete this.Jo[nd]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(D(e)){this.syncCookieProperties(),j(t)&&(t="None"),this.Va=j(i)?this.Qa:i;let s=!1;if(sF(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.Ca(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(D(e)){this.syncCookieProperties(),this.Va=j(t)?this.Qa:t;let i=!1;if(sF(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||D(t)||T(t))&&(this.Ca(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=!1;for(let i of"string"==typeof e?[e]:e)i in this.props&&(this.$a(i),t=!0);t&&this.save()}update_campaign_params(){let e=null==c?void 0:c.URL;if(e===this.ua)return;let t=r7(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),i=!N(sA(t));return i&&this.register(t),this.ua=e,i?t:void 0}update_search_keyword(){this.register(function(){let e=null==c?void 0:c.referrer;return e?nt(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:nr(),$referring_domain:(null==c?void 0:c.referrer)&&(null==(e=rQ(c.referrer))?void 0:e.host)||ns},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=nn(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[sc]:this.Xo?{r:nc(e.r),u:e.u?nc(e.u):void 0}:e},void 0)}get_initial_props(){let e={};sF([sh,su],t=>{let i=this.props[t];i&&sF(i,function(t,i){e["$initial_"+F(i)]=t})});let t=this.props[sc];return t&&sO(e,function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=no(e,t),s={};return sF(i,function(e,t){s["$initial_".concat(F(t))]=e}),s}(t,this.Rr.disable_capture_url_hashes)),e}safe_merge(e){return sF(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){let s=e.persistence!==t.persistence,r=!((e,t)=>{if(e.length!==t.length)return!1;let i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=s||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.mi&&!a;a||this.Oa(t,l),this.Rr=e,!a&&(s||r||o)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(t_(t_({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));let u=n||o?this.ca(e):this.qo;this.Ja();let h=this.da(e),c=n||h!==this.Yo,d=!a&&(c||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(l);this.na=c;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){let e=this.props;this.clear(),this.qo=u,this.Yo=h,this.props=e,this.save()}else o&&(this.qo=u,a||(delete this.Jo[nd],this.qa()))}finally{this.na=!1,d&&this.ja()}}Ja(){let e=this.props[sc];if(!this.Xo||!D(e)||"string"!=typeof e.r)return;let t=nc(e.r),i="string"==typeof e.u?nc(e.u):e.u;t===e.r&&i===e.u||this.Ca(sc,t_(t_({},e),{},{r:t,u:i}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let i=this.props.__timers||{};i[e]=t,this.Ca(iT,i),this.save()}remove_event_timer(e){let t=this.props.__timers||{},i=t[e];return j(i)||(delete t[e],this.Ca(iT,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Ca(e,t),this.save()}Ca(e,t){var i;let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=this.props[e];
1this.props[e]=t,s&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this.sa=!0),nv(e)&&!n_(r,t)&&this.oa.add(e),this.Ea(e,r,t),(null==(i=rK(e))?void 0:i.volatile)||this.Ia(e))}$a(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];delete this.props[e],t&&(nf(e)&&this.ma(e,!0),nv(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var t;let i=null==(t=rK(e))?void 0:t.storageGroup;i&&(this.ya(i).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}constructor(e,t,i=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=i,this.props={},this.ua=void 0,this.ha=(e=>{let t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&ib.info("Persistence loaded",e.persistence,t_({},this.props)),this.update_config(e,e,t),this.save(),l){let e=()=>this.flush();sD(l,"beforeunload",e,{capture:!1}),sD(l,"pagehide",e,{capture:!1}),this.fa=e=>{if(this.Ko&&(!e.storageArea||e.storageArea===(null==l?void 0:l.localStorage))&&e.key)if(e.key!==this.ha){if(this.Yo){let t=rY.find(t=>e.key===this.pa(t));t&&this.ga(e.key,t)}}else this.ga(e.key,nd)},sD(l,"storage",this.fa)}}};let nw={GZipJS:"gzip-js",Base64:"base64"},nx={Activation:"events",Cancellation:"cancelEvents"},nk={Popover:"popover",API:"api",Widget:"widget"},nE={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},nS={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},n$={Popover:"popover",Inline:"inline"};function nP(e){let t=!0;return{dispose(){if(t){t=!1;let i=e();i&&L(i.then)&&i.then(void 0,()=>{})}}}}let nR={SHOWN:"product tour shown"},nI={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},nF=iw("[RateLimiter]");var nO=class{get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(){var e,t,i;let s=arguments.length>0&&void 0!==arguments[0]&&arguments[0],{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!=(e=null==(t=this.instance.persistence)?void 0:t.get_property("$capture_rate_limit"))?e:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);let l=1>a.tokens;if(l||s||(a.tokens=Math.max(0,a.tokens-1)),l&&!s){let e=(U(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.Ka(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(i=this.instance.persistence)||i.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Xa(e){let t=this.instance.config.property_denylist;return!T(t)||!t.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&(null==d?void 0:d.pathname))return"".concat(null!=(e=d.origin)?e:"").concat(d.pathname)}Ka(e){var t,i;let{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,n=this.Ya(),o=this.Xa("$session_id")?null==(t=(i=this.instance).get_session_id)?void 0:t.call(i):void 0,a=["".concat(e," event(s) dropped since the last warning"),n?"triggered on ".concat(n):void 0,o?"session ".concat(o):void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: ".concat(a,". Config is set to ").concat(r," events per second and ").concat(s," events burst limit.")},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{let t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{nF.info("".concat(e||"events"," is quota limited.")),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void nF.warn('could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}};let nC=iw("[RemoteConfig]");var nM=class{get remoteConfig(){var e;return null==(e=b._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}tl(e){var t,i,s;(null==(t=b.__PosthogExtensions__)?void 0:t.loadExternalDependency)?null==(i=b.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/".concat(this._instance.config.token,"/config")),callback:e})}load(){try{if(this.remoteConfig)return nC.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void nC.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return nC.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(e=>{this.il(e.json,e)});this.il(e)})}catch(e){nC.error("Error loading remote config",e),this.il()}}il(e,t){!e&&t&&(0===t.statusCode?t.error||nC.warn("Failed to fetch remote config from PostHog."):nC.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(e){nC.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded()}catch(e){nC.error("Error loading feature flags",e)}}constructor(e){this._instance=e}},nA=Uint8Array,nT=Uint16Array,nL=Uint32Array,nD=new nA([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]),nN=new nA([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]),nj=new nA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nq=function(e,t){for(var i=new nT(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new nL(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},nB=nq(nD,2),nH=nB[1];nB[0][28]=258,nH[258]=28;for(var nz=nq(nN,0)[1],nU=new nT(32768),nV=0;32768>nV;++nV){var nW=(43690&nV)>>>1|(21845&nV)<<1;nU[nV]=((65280&(nW=(61680&(nW=(52428&nW)>>>2|(13107&nW)<<2))>>>4|(3855&nW)<<4))>>>8|(255&nW)<<8)>>>1}var nG=function(e,t,i){for(var s=e.length,r=0,n=new nT(t);s>r;++r)++n[e[r]-1];var o,a=new nT(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new nT(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],h=t-e[r],c=a[e[r]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[nU[c]>>>l]=u}else for(o=new nT(s),r=0;s>r;++r)o[r]=nU[a[e[r]-1]++]>>>15-e[r];return o},nY=new nA(288);for(nV=0;144>nV;++nV)nY[nV]=8;for(nV=144;256>nV;++nV)nY[nV]=9;for(nV=256;280>nV;++nV)nY[nV]=7;for(nV=280;288>nV;++nV)nY[nV]=8;var nX=new nA(32);for(nV=0;32>nV;++nV)nX[nV]=5;var nJ=nG(nY,9,0),nK=nG(nX,5,0),nZ=function(e){return(e/8|0)+(7&e&&1)},nQ=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof nT?nT:e instanceof nL?nL:nA)(i-t);return s.set(e.subarray(t,i)),s},n0=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},n1=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},n2=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new nA(0),0];if(1==r){var o=new nA(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=r-1;)a=i[i[c].f>i[u].f?u++:c++],l=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new nT(d+1),f=n3(i[h-1],p,0);if(f>t){s=0;var g=0,v=f-t,_=1<<v;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=_-(1<<f-p[m]),p[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}f=t}return[new nA(p),f]},n3=function(e,t,i){return -1==e.s?Math.max(n3(e.l,t,i+1),n3(e.r,t,i+1)):t[e.s]=i},n5=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new nT(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},n4=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},n6=function(e,t,i){var s=i.length,r=nZ(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},n8=function(e,t,i,s,r,n,o,a,l,u,h){n0(t,h++,i),++r[256];for(var c=n2(r,15),d=c[0],p=c[1],f=n2(n,15),g=f[0],v=f[1],_=n5(d),m=_[0],y=_[1],b=n5(g),w=b[0],x=b[1],k=new nT(19),E=0;m.length>E;++E)k[31&m[E]]++;for(E=0;w.length>E;++E)k[31&w[E]]++;for(var S=n2(k,7),$=S[0],P=S[1],R=19;R>4&&!$[nj[R-1]];--R);
1var I,F,O,C,M=u+5<<3,A=n4(r,nY)+n4(n,nX)+o,T=n4(r,d)+n4(n,g)+o+14+3*R+n4(k,$)+(2*k[16]+3*k[17]+7*k[18]);if(A>=M&&T>=M)return n6(t,h,e.subarray(l,l+u));if(n0(t,h,1+(A>T)),h+=2,A>T){I=nG(d,p,0),F=d,O=nG(g,v,0),C=g;var L=nG($,P,0);for(n0(t,h,y-257),n0(t,h+5,x-1),n0(t,h+10,R-4),h+=14,E=0;R>E;++E)n0(t,h+3*E,$[nj[E]]);h+=3*R;for(var D=[m,w],N=0;2>N;++N){var j=D[N];for(E=0;j.length>E;++E)n0(t,h,L[q=31&j[E]]),h+=$[q],q>15&&(n0(t,h,j[E]>>>5&127),h+=j[E]>>>12)}}else I=nJ,F=nY,O=nK,C=nX;for(E=0;a>E;++E)if(s[E]>255){n1(t,h,I[257+(q=s[E]>>>18&31)]),h+=F[q+257],q>7&&(n0(t,h,s[E]>>>23&31),h+=nD[q]);var q,B=31&s[E];n1(t,h,O[B]),h+=C[B],B>3&&(n1(t,h,s[E]>>>5&8191),h+=nN[B])}else n1(t,h,I[s[E]]),h+=F[s[E]];return n1(t,h,I[256]),h+F[256]},n9=new nL([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),n7=new nA(0),oe=function(){for(var e=new nL(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),ot=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};let oi=!!f||!!p,os=new WeakMap,or="text/plain",on=0,oo=!1,oa=(e,t)=>{let[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;let o=n.split("&").filter(e=>e.split("=")[0]!==t).join("&");return"".concat(r).concat(o?"?".concat(o):"").concat(s?"#".concat(s):"")},ol=function(e,t){var i;let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2],[r,n]=e.split("?"),o=t_({},t),a=null!=(i=null==n?void 0:n.split("&").map(e=>{var t;let[i,r]=e.split("="),n=s&&null!=(t=o[i])?t:r;return delete o[i],"".concat(i,"=").concat(n)}))?i:[],l=function(e){let t,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",r=[];return sF(e,function(e,s){j(e)||j(s)||"undefined"===s||(t=encodeURIComponent(e instanceof File?e.name:e.toString()),i=encodeURIComponent(s),r[r.length]=i+"="+t)}),r.join(s)}(o);return l&&a.push(l),a.length>0?"".concat(r,"?").concat(a.join("&")):r},ou=e=>{if(e.sl)return e.sl;let{data:t,compression:i}=e;if(!t)return;if(i===nw.GZipJS){let e=function(e,t){void 0===t&&(t={});var i=(r=0xffffffff,{p(e){for(var t=r,i=0;e.length>i;++i)t=oe[255&t^e[i]]^t>>>8;r=t},d:()=>0xffffffff^r}),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((n=t).filename&&n.filename.length+1||0),function(e,t,i,s,r,n){var o=e.length,a=new nA(s+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(s,a.length-8),u=0;if(!t||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=n6(l,u,e.subarray(h,c)):(l[h]=n,u=n6(l,u,e.subarray(h,o)))}else{for(var d=n9[t-1],p=d>>>13,f=8191&d,g=(1<<i)-1,v=new nT(32768),_=new nT(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new nL(25e3),x=new nT(288),k=new nT(32),E=0,S=0,$=(h=0,0),P=0,R=0;o>h;++h){var I=b(h),F=32767&h,O=_[I];if(v[F]=O,_[I]=F,h>=P){var C=o-h;if((E>7e3||$>24576)&&C>423){u=n8(e,l,0,w,x,k,S,$,R,h-R,u),$=E=S=0,R=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)k[M]=0}var A=2,T=0,L=f,D=F-O&32767;if(C>2&&I==b(h-D))for(var N=Math.min(p,C)-1,j=Math.min(32767,h),q=Math.min(258,C);j>=D&&--L&&F!=O;){if(e[h+A]==e[h+A-D]){for(var B=0;q>B&&e[h+B]==e[h+B-D];++B);if(B>A){if(A=B,T=D,B>N)break;var H=Math.min(D,B-2),z=0;for(M=0;H>M;++M){var U=h-D+M+32768&32767,V=U-v[U]+32768&32767;V>z&&(z=V,O=U)}}}D+=(F=O)-(O=v[F])+32768&32767}if(T){w[$++]=0x10000000|nH[A]<<18|nz[T];var W=31&nH[A],G=31&nz[T];S+=nD[W]+nN[G],++x[257+W],++k[G],P=h+A,++E}else w[$++]=e[h],++x[e[h]]}}u=n8(e,l,n,w,x,k,S,$,R,h-R,u),n||(u=n6(l,u,n7))}return nQ(a,0,s+nZ(u)+r)}(e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+o.mem,a,8,!l)),h=u.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&ot(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,t),ot(u,h-8,i.d()),ot(u,h-4,s),u}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new nA(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var o=new nA(s+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);128>a?r(a):(2048>a?r(192|a>>>6):(a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),r(128|a>>>12&63)):r(224|a>>>12),r(128|a>>>6&63)),r(128|63&a))}return nQ(i,0,s)}(rZ(t)),{mtime:0});return{contentType:or,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(i===nw.Base64){let e=(e=>"data="+encodeURIComponent("string"==typeof e?e:rZ(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>
1String.fromCharCode(parseInt(t,16)))):e}(rZ(t)));return{contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}let s=rZ(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},oh=e=>{var t;let i,s=()=>"sendBeacon"===e.transport?{url:ol(e.url,{compression:nw.Base64}),encodedBody:ou(t_(t_({},e),{},{compression:nw.Base64,sl:void 0}))}:{url:oa(e.url,"compression"),encodedBody:ou(t_(t_({},e),{},{compression:void 0,sl:void 0}))};try{i=ou(e)}catch(t){if(t3(e.compression,r0(e.url,"compression")))return ib.error("Failed to gzip request body, sending uncompressed payload",t),s();throw t}return!(i&&t3(e.compression,r0(e.url,"compression")))||((t=i.body)instanceof ArrayBuffer?t2(new Uint8Array(t)):ArrayBuffer.isView(t)&&t2(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:i}:(oo=!0,s())},oc=e=>{try{return oh(e)}catch(i){var t;return ib.error(i),void(null==(t=e.callback)||t.call(e,{statusCode:0,error:i}))}},od=function(){var e=er(function*(e){let t=yield function(e){return t8.apply(this,arguments)}(rZ(e.data),x.DEBUG,{rethrow:!0});if(!t)return e;let i=yield t.arrayBuffer();return t_(t_({},e),{},{sl:{contentType:or,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),op=/Failed to fetch|NetworkError|Load failed/i,of=e=>"TypeError"===(null==e?void 0:e.name)&&op.test((null==e?void 0:e.message)||""),og=e=>{try{let t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();if("string"!=typeof e||!e)return;let i=e.trim(),s=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(s)){let e=1e3*Math.min(Number(s),300);return e>0?e:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;let r=/^\w{3} \w{3} /.test(s)?s+" GMT":s,n=Date.parse(r)-t;return Number.isFinite(n)&&n>0?Math.min(n,3e5):void 0}(e());return j(t)?void 0:Math.min(t,3e4)}catch(e){return}},ov=e=>{let t=oc(e);if(!t)return;let i=new f;os.set(i,!0);let{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);let{contentType:n,body:o}=null!=r?r:{};sF(e.headers,function(e,t){i.setRequestHeader(t,e)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t;let s={statusCode:i.status,text:i.responseText};if(200===i.status)try{s.json=JSON.parse(i.responseText)}catch(e){}null==(t=e.callback)||t.call(e,s,og(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},o_=e=>{let t=oc(e);if(!t)return;let{url:i,encodedBody:s}=t,{contentType:r,body:n,estimatedSize:o}=null!=s?s:{},a=new Headers;sF(e.headers,function(e,t){a.append(t,e)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(g){let t=new g;l={signal:t.signal,timeout:setTimeout(()=>{var i;u=!0;try{t.abort(tu("AbortError","PostHog request timed out"+((i=e.timeout)?" after ".concat(i,"ms"):"")))}catch(e){c(e)}},e.timeout)}}let h=!1,c=t=>{var i;h||(h=!0,u&&"AbortError"===(null==t?void 0:t.name)||of(t)?ib.warn(t):ib.error(t),null==(i=e.callback)||i.call(e,{statusCode:0,error:t}))},d=0,f=()=>{on-=d,d=0,l&&clearTimeout(l.timeout)};try{let t=t_({method:(null==e?void 0:e.method)||"GET",headers:a,referrerPolicy:"strict-origin",body:n,signal:null==l?void 0:l.signal},e.fetchOptions),s=null!=o?o:j(n)?0:void 0;t.keepalive="POST"===t.method&&!e.rl&&!1!==t.keepalive&&t.body===n&&!j(s)&&s>=0&&52428.8>on+s,t.keepalive&&(d=s,on+=d),p(i,t).then(t=>t.text().then(i=>{var s;if(h)return;let r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){ib.error(e)}h=!0,f(),null==(s=e.callback)||s.call(e,r,og(()=>t.headers.get("Retry-After")))})).catch(e=>{f(),c(e)}).finally(f)}catch(e){f(),c(e)}},om=e=>{try{var t;let{url:i,encodedBody:s}=oh(e),{contentType:r,body:n,estimatedSize:o}=null!=s?s:{};if(!n)return;let a=n instanceof Blob?n:new Blob([n],{type:r});if(h.sendBeacon(i,a))return;let l=T(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(T(l)&&l.length>1&&(null!=o?o:0)>16384){let t=Math.ceil(l.length/2),i=t=>T(e.data)?t:t_(t_({},e.data),{},{batch:t});return om(t_(t_({},e),{},{data:i(l.slice(0,t))})),void om(t_(t_({},e),{},{data:i(l.slice(t))}))}ib.warn("Beacon of ~".concat(null!=o?o:0," bytes was rejected by the browser, falling back to ").concat(p?"fetch":"XHR")),p?o_(t_(t_({},e),{},{rl:!0})):ov(e)}catch(e){ib.warn("Beacon send failed",e)}},oy=(e,t,i,s)=>{let r="query"===s?"POST"===t?"sent_at":"_":void 0;return ol(i===nw.GZipJS?oa(e,"compression"):e,t_(t_({},r?{[r]:Date.now().toString()}:{}),i===nw.GZipJS?{}:{compression:i}))},ob=(()=>{let e=[];return p&&e.push({transport:"fetch",method:o_}),f&&e.push({transport:"XHR",method:ov}),(null==h?void 0:h.sendBeacon)&&e.push({transport:"sendBeacon",method:om}),e})(),ow=!oi&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla"));function ox(e,t,i){var s,r,n;i&&(t=t_(t_({},t),{},{callback:e=>i(e)})),e.__loaded?ow?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==(r=t.callback)||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=t_(t_({},e.config.request_headers),t.headers),t.compression="best-available"===t.compression?null!=(s=e.compression)?s:t.compressionFallback:t.compression,(j(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,
1((e,t)=>{var i,s,r;let n=t_(t_({},e),{},{callback:null!=t?t:t=>{var i;return null==(i=e.callback)?void 0:i.call(e,t)}});n.timeout=n.timeout||6e4;let o=null!=(i=n.transport)?i:"fetch";"sendBeacon"===o&&j(n.compression)&&n.data&&(n.compression=nw.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data=(e=>{var t,i;let s=(T(e)?e:[e]).map(e=>t_(t_({},e),e.timestamp instanceof Date&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})),r=s[0];return{api_key:null!=(t=null==r||null==(i=r.properties)?void 0:i.token)?t:null==r?void 0:r.token,batch:s,sent_at:(new Date).toISOString()}})(n.data):"body"===n.timestampMode&&(n.data=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).toISOString();return T(e)?e.map(e=>t_(t_({},e),{},{sent_at:t})):t_(t_({},e),{},{sent_at:t})}(n.data))),n.url=oy(n.url,n.method,n.compression,n.timestampMode);let a=ob.filter(e=>!n.disableTransport||!e.transport||!n.disableTransport.includes(e.transport)),l=null!=(s=null==(r=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(a,e=>e.transport===o))?void 0:r.method)?s:a[0].method;if(!l)throw Error("No available transport method");let u=e=>{try{l(e)}catch(e){var t;of(e)?ib.warn(e):ib.error(e),null==(t=n.callback)||t.call(n,{statusCode:0,error:e})}};"sendBeacon"!==o&&!n.preferSyncCompression&&n.data&&n.compression===nw.GZipJS&&v&&"undefined"!=typeof Promise&&!oo?od(n).then(e=>{u(e)}).catch(t=>{if(t5(t))return oo=!0,void u(t_(t_({},n),{},{compression:void 0,url:oy(e.url,e.method,void 0,e.timestampMode)}));(e=>{if(!e||"object"!=typeof e)return!1;let t="name"in e?String(e.name):"";return t5(e)||t===t1})(t)&&(oo=!0),u(n)}):u(n)})(t,(s,r)=>{var n,o,a;e.rateLimiter.checkForLimiting(s),400>s.statusCode||null==(n=(o=e.config).on_request_error)||n.call(o,s),i?i(s,r):null==(a=t.callback)||a.call(t,s)})):t.fireCallbackOnDrop&&(null==(n=t.callback)||n.call(t,{statusCode:0}))}var ok=class{enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();let e=Object.values(this.al.length>0?this.vl():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.fl(e,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){let e=this.vl();for(let t in e)this.fl(e[t])}},this.ll))}fl(e,t){try{this.ul(e,t)}catch(e){ib.error(e)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){let e={};return sF(this.al,t=>{var i;let s=((t?t.batchKey:null)||t.url)+(t.batchGroup?":".concat(t.batchGroup):"");j(e[s])&&(e[s]=t_(t_({},t),{},{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.al=[],e}constructor(e,t){this.ol=!0,this.al=[],this.ll=ea((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,ib.createLogger("flush interval"),3e3),this.ul=e}};let oE=["retriesPerformedSoFar"];var oS=class{resume(){!j(l)&&"onLine"in l.navigator&&(this.ml=l.navigator.onLine,this.yl||(this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},sD(l,"online",this.yl),sD(l,"offline",this._l)))}get length(){return this.al.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=t9(e,oE);V(i)&&(s.url=ol(s.url,{retry_count:i})),ox(this._instance,t?t_(t_({},s),{},{transport:t}):s,(e,t)=>{var r;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=i?i:0))return void this.Ls(t_({retriesPerformedSoFar:i},s),t);0===e.statusCode&&ib.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ".concat(null!=i?i:0," retries."))}null==(r=s.callback)||r.call(s,e)})}Ls(e,t){let i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;let s=Math.max(function(e){let t=3e3*Math.pow(2,e),i=Math.min(18e5,t),s=(Math.random()-.5)*(i-t/2);return Math.ceil(i+s)}(i),null!=t?t:0),r=Date.now()+s;this.al.push({retryAt:r,requestOptions:e});let n="Enqueued failed request for retry in ".concat(s);navigator.onLine||(n+=" (Browser is offline)"),ib.warn(n),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),0===this.al.length)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){let e=Date.now(),t=[],i=this.al.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.al=t,i.length>0)for(let{requestOptions:e}of i)this.retriableRequest(e)}unload(){for(let{requestOptions:e}of(this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,j(l)||(this.yl&&(l.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(l.removeEventListener("offline",this._l),this._l=void 0)),this.al))try{this._instance._send_request(t_(t_({},e),{},{transport:"sendBeacon"}))}catch(e){ib.error(e)}this.al=[]}constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}},o$=class{get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){let e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){sD(l,"scroll",this.Sl,{capture:!0}),sD(l,"scrollend",this.Sl,{capture:!0}),sD(l,"resize",this.Sl)}scrollElement(){var e,t;if(this.Cl){for(let t of T(this.Cl)?this.Cl:[this.Cl]){let i=null==l||null==(e=l.document)?void 0:e.querySelector(t);if(i)return i}return}return null==l||null==(t=l.document)?void 0:t.documentElement}$l(e){var t,i;if(this.Cl){let t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return l?"y"===e?l.scrollY||l.pageYOffset||(null==(t=l.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:l.scrollX||l.pageXOffset||(null==(i=l.document)||null==(i=i.documentElement)?void 0:i.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}constructor(e){this._instance=e,this.Sl=()=>{var e,t,i,s;this.xl||(this.xl={});let r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.xl.lastScrollY=Math.ceil(n),this.xl.maxScrollY=Math.max(n,null!=(e=this.xl.maxScrollY)?e:0),this.xl.maxScrollHeight=Math.max(o,null!=(t=this.xl.maxScrollHeight)?t:0),this.xl.lastContentY=a,this.xl.maxContentY=Math.max(a,null!=(i=this.xl.maxContentY)?i:0),this.xl.maxContentHeight=Math.max(l,null!=(s=this.xl.maxContentHeight)?s:0)}}};let oP=e=>nn(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes
1);var oR=class{Tl(){return this.Ml.props[sl]}getSetOnceProps(){var e;let t=null==(e=this.Tl())?void 0:e.props;return t?"r"in t?no(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){let e={};return sF(sA(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_".concat(F(i))]=t}),e}constructor(e,t,i,s){this.Be=e=>{let t=this.Tl();if(t&&t.sessionId===e)return;let i={sessionId:e,props:this.Il(this._instance)};this.Ml.register({[sl]:i})},this._instance=e,this.El=t,this.Ml=i,this.Il=s||oP,this.El.onSessionId(this.Be)}},oI=class{on(e,t){return this.Pl[e]||(this.Pl[e]=[]),this.Pl[e].push(t),()=>{this.Pl[e]=this.Pl[e].filter(e=>e!==t)}}emit(e,t){for(let i of this.Pl[e]||[])i(t);for(let i of this.Pl["*"]||[])i(e,t)}constructor(){this.Pl={}}};let oF=iw("[SessionId]");var oO=class{on(e,t){return this.Rl.on(e,t)}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return j(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(t=>t!==e)}}Wl(){return"memory"!==this.Rr.persistence&&!this.Ml.mi&&re.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&re.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?re.Dt(this.zl):null}Ql(e){let t=this.Al;return!H(t)&&!H(e)&&5e3>Math.abs(e-t)}Jl(e,t,i){let s=t!==this._sessionActivityTimestamp,r=e===this.Xt&&i===this._sessionStartTimestamp;this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,r&&!s||r&&this.Ql(t)||(this.Al=t,this.Ml.register({[iG]:[t,e,i]}))}Kl(){var e;let t=null==(e=this.Rr)?void 0:e.persistence_save_debounce_ms;return V(t)&&t>0}Xl(){this.Kl()?this.Ml.refreshKey(iG):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(H(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();let[,t,i]=this.tu();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[iG]:[this._sessionActivityTimestamp,null!=(e=this.Xt)?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){let[e]=this.tu();return Math.max(V(e)?e:0,V(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){let e=this.Ml.props[iG];return T(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).getTime();try{let i=(e=>{let t=e.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})(e);return i>t+6e4?void oF.error("Bootstrap sessionID cannot be in the future"):i}catch(e){return void oF.error("Invalid sessionID in bootstrap",e)}}(e);return!j(i)&&(t?this.ql={sessionId:e,sessionStartTimestamp:i}:this.Jl(e,(new Date).getTime(),i),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&l&&(l.removeEventListener(sE,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&re.Lt(this.Ul)},sD(l,sE,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("always"===this.Rr.cookieless_mode)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');let s=t||(new Date).getTime(),r=this.Xt;if(i)this.Fl=s;else if(H(this.Fl)||this.Fl>s||s-this.Fl>=1e3){var n,o;null==(n=(o=this.Ml).syncCookieProperties)||n.call(o),this.Fl=s}let[,a,l]=this.tu(),u=!j(r)&&a!==r,h=this.eu(),c=this.Zl(),d=this.ql,p=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>864e5),f=d?p:V(l)&&Math.abs(s-l)>864e5,g=!1,v=u,_=!a||!!d,m=a,y=!_&&!e&&this.Nl(s,h);if(y&&((y=this.iu(s))||oF.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.tu(),y||(_=!a||!!d)),_||y||f){v=!1;let e=d&&!p;a=e?d.sessionId:this.jl(),c=this.Bl(),oF.info("new session ID assigned",{sessionId:a,windowId:c,bootstrapped:!!e,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f}}),l=e?d.sessionStartTimestamp:s,this.ql=void 0,g=!0}else c||(c=this.Bl(),g=!0),(v=v||a!==m)&&(oF.info("adopted cross-tab session id",{sessionId:a,windowId:c}),g=!0);let b=V(h)&&e&&!f?h:s,w=V(l)?l:(new Date).getTime();this.Gl(c),this.Jl(a,b,w),e||this.Hl();let x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:v};
1return g&&this.Ol.forEach(e=>e(a,c,x)),{sessionId:a,windowId:c,sessionStartTimestamp:w,changeReason:g?x:void 0,lastActivityTimestamp:h}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu((new Date).getTime())){let e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.Hl()},1.1*this.sessionTimeoutMs))}constructor(e,t,i){var s;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new oI,this.Nl=(e,t)=>!(!V(e)||!V(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=t||sU,this.Bl=i||sU;let r=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*ea(this.Rr.session_idle_timeout_seconds||1800,60,36e3,oF.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+r+"_window_id",this.Ul="ph_"+r+"_primary_window_exists",this.Wl()){let e=re.Dt(this.zl),t=re.Dt(this.Ul);e&&!t?this.He=e:re.Lt(this.zl),re.At(this.Ul,!0)}(null==(s=this.Rr.bootstrap)?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}};let oC=function(e,t){if(!e)return!1;let i=e.userAgent;if(i&&eo(i,t))return!0;try{let i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>eo(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};
1function oM(){return(oM=er(function*(){let e=null==h?void 0:h.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{let t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return q(i)&&i.length>0?i:void 0}catch(e){return void ib.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function oA(e){var t;return!!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)?void 0:t.length)}let oT=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},oL=e=>e.toLowerCase(),oD={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>oT(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!oT(t,e))),icontains:(e,t)=>t.map(oL).some(t=>e.map(oL).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(oL).every(t=>e.map(oL).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{let i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{let i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})};function oN(e,t){return!e||Object.entries(e).every(e=>{let[i,s]=e,r=null==t?void 0:t[i];if(null==r)return!1;let n=oD[s.operator];return!!n&&n(s.values.map(String),[String(r)])})}function oj(e,t,i){return rZ({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}let oq="custom",oB="i.posthog.com",oH=/^\/static\//,oz=["/s/","/e/","/i/"];var oU=class{get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){let e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(oB),".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.su[this.apiHost]||(this.su[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":oq),this.su[this.apiHost]}ru(e){if(!oH.test(e))return;let t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}ou(e){let t=rQ(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}au(e,t,i){if("ui"===e)return i;let s=i,r=this.instance.config.rewriteRequestPath;if(r){var n;s=r(new URL((null==(n=rQ(i))?void 0:n.href)||i)).toString()}if(r&&"api"===e&&oz.some(e=>0===t.indexOf(e))){let e=this.ou(s);if(e){let t=this.apiHost,i=this.lu;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===r||(i={apiHost:t,rewriteRequestPath:r,urls:new Set},this.lu=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){let t=this.lu,i=this.ou(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(t)),"ui"===e)return this.au(e,t,this.uiHost+t);if("flags"===e)return this.au(e,t,this.flagsApiHost+t);if("assets"===e){let i=this.ru(t);if(i)return this.au(e,t,"".concat(i).concat(t))}if(this.region===oq)return this.au(e,t,this.apiHost+t);let i=oB+t;switch(e){case"assets":return this.au(e,t,"https://".concat(this.region,"-assets.").concat(i));case"api":return this.au(e,t,"https://".concat(this.region,".").concat(i))}}constructor(e){this.su={},this.instance=e}};let oV=iw("[Surveys]"),oW=e=>{try{let t=(e=>"seenSurvey_".concat(function(e){return e.current_iteration&&e.current_iteration>0?"".concat(e.id,"_").concat(e.current_iteration):e.id}(e)))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){oV.error("Failed to persist survey seen state",e)}},oG=[nk.Popover,nk.Widget,nk.API],oY={ignoreConditions:!1,ignoreDelay:!1,displayType:n$.Popover},oX=iw("[PostHog ExternalIntegrations]"),oJ={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var oK=class{zo(e,t){var i,s;null==(i=b.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,e,e=>{if(e)return oX.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t,i,s;for(let[r,n]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))!n||(null==(t=b.__PosthogExtensions__)||null==(t=t.integrations)?void 0:t[r])||this.zo(oJ[r],()=>{var e;null==(e=b.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[r])||e.start(this._instance)}),!n&&(null==(i=b.__PosthogExtensions__)||null==(i=i.integrations)?void 0:i[r])&&(null==(s=b.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[r])||s.stop())}constructor(e){this._instance=e}},oZ=class{add(e){var t=this;return er(function*(){if(t.Io)throw Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.uu.has(e.name))throw Error('Browser extension "'.concat(e.name,'" is already registered'));t.uu.set(e.name,e);try{let i=e.setup(t.wo);i&&(yield i)}
1catch(s){let i=t.uu.get(e.name)===e;i&&t.uu.delete(e.name),t.$.error('Failed to set up browser extension "'.concat(e.name,'"'),s),i&&t.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;let e=Array.from(this.uu.values()).reverse();for(let t of(this.uu.clear(),e))this.hu(t)}hu(e){try{var t;let i=null==(t=e.dispose)?void 0:t.call(e);i&&L(i.then)&&i.then(void 0,t=>{this.$.error('Failed to dispose browser extension "'.concat(e.name,'"'),t)})}catch(t){this.$.error('Failed to dispose browser extension "'.concat(e.name,'"'),t)}}constructor(e,t){this.$=e,this.wo=t,this.uu=new Map,this.Io=!1}},oQ=class{initialize(){}get(e){let t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);let i={};for(let s of e){let e=null==t?void 0:t.get_property(s);j(e)||(i[s]=e)}return i}set(e,t){var i;null==(i=this._instance.persistence)||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}constructor(e){this._instance=e}};let o0="extensionsRemoteConfig";var o1=class{get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!=(e=this.instance.get_property("$device_id"))?e:this.distinctId}get deviceId(){let e=this.instance.get_property(iR);return"string"==typeof e?e:void 0}get library(){return{name:x.LIB_NAME,version:x.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!=(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;let r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!=(t=null==r?void 0:r.sessionId)?t:"",windowId:null!=(i=null==r?void 0:r.windowId)?i:"",sessionStartTimestamp:null!=(s=null==r?void 0:r.sessionStartTimestamp)?s:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.fu.add(e)}getExtension(e){return this.fu.getExtension(e)}capture(e,t,i){i?this.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return nP(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(o0,e))}sendRequest(e){var t=this;return er(function*(e){var i;let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.instance.requestRouter.endpointFor(null!=(i=s.target)?i:"api",e),n={method:s.method,url:s.query?ol(r,s.query):r,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:"flags"===s.target&&"best-available"===s.compression?S.Base64:void 0,timestampMode:s.sentAt};return"sendBeacon"===s.transport?(t.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,t.instance._send_request(n)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}constructor(e){this.instance=e,this.Io=!1,this.$=ib,this.cu=e.du,this.kv=new oQ(e),this.onEvent=e=>nP(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this.$.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this.Io)return nP(()=>{});let t=t=>{try{e(t)}catch(e){this.$.error("Browser extension remote config listener failed",e)}},i=this.instance.vu.on(o0,t);return this.cu&&t(this.cu),nP(i)},this.fu=new oZ(ib.createLogger("[BrowserExtensions]"),this)}};let o2={},o3=0,o5=()=>{},o4='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',o6="Surveys module not available",o8="sanitize_properties is deprecated. Use before_send instead",o9="Invalid value for property_denylist config: ",o7=/^[A-Za-z0-9_-]{1,400}$/,ae=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,at=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,ai=["token","distinct_id",sf],as="posthog",ar=e=>{var t;return t_({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){let t=null==e?void 0:e.hostname;if(!q(t))return!1;let i=t.split(".").slice(-2).join(".");for(let e of sL)if(i===e)return!1;return!0}(null==c?void 0:c.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:o5,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:d&&q(null==d?void 0:d.search)&&-1!==d.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==l||null==(t=l.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(e){ib.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:sx,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:o5},(e=>({rageclick:e&&e>="2026-05-30"?{content_ignorelist:rb,ignore_text_selection:!0}
1:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:(e=>{let t={};return e&&"unset"!==e&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t})(e),external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e),cookieWinsOnConflict:!(!e||"unset"===e||"2026-08-29">e)}))(e))},an=[["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"]],ao=e=>{let t={};for(let[i,s]of an)j(e[i])||(t[s]=e[i]);let i=sO({},t,e),s=e.__preview_external_dependency_versioned_paths;return j(s)||(j(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),q(s)&&j(e.asset_host)&&(i.asset_host=s)),T(e.property_blacklist)&&(j(e.property_denylist)?i.property_denylist=e.property_blacklist:T(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:ib.error(o9+e.property_denylist)),i};var aa=class{get gu(){return this.__forceAllowLocalhost}set gu(e){ib.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}constructor(){this.__forceAllowLocalhost=!1}},al=class e{mu(e){if(!e)return;let t=this.uu.indexOf(e);-1!==t&&this.uu.splice(t,1)}yu(e,t){var i;return this.mu(e),this.uu.push(t),null==(i=t.initialize)||i.call(t),t}bu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_u(){let e,t,i;if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;let s="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(s||this.config.disable_persistence)&&(this.ku||(s?(e="persistence is set to '".concat(this.config.persistence,"'"),t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",t="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]","".concat(e," but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ").concat(t,", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ").concat(i))))}Su(){if(this.bu()||"$posthog_cookieless"!==this.get_distinct_id())return;let e=this.persistence;if(!e)return;this.xu()||e.load(!0);let t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){let t=this.config.get_device_id(sU());this.register({distinct_id:t,$device_id:t}),e.set_property(sa,sb)}this.Cu()}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}init(t,i,s){if(s&&s!==as){var r;let n=null!=(r=o2[s])?r:new e;return n._init(t,i,s),o2[s]=n,o2[as][s]=n,n}return this._init(t,i,s)}_init(e){var t,i,s,r;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0,a=q(e)?e.trim():"";if(!a)return ib.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==(r=this.config)?void 0:r.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('".concat(a,"', { ... }, 'project2')")):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=ar(n.defaults),n.debug=this.Du(n.debug),this.Lu=n,this.Nu=[],n.person_profiles?this.Fu=n.person_profiles:n.process_person&&(this.Fu=n.process_person);let u=ar(n.defaults),h=ao(n),c=sO({},u,h,{name:o,token:a});D(u.rageclick)&&D(h.rageclick)&&(c.rageclick=sO({},u.rageclick,h.rageclick)),D(u.session_recording)&&D(h.session_recording)&&(c.session_recording=sO({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&ib.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:nw.GZipJS;let d=this.xu();if(this.persistence=new nb(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nb(t_(t_({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&re.Et()){let e=re.Dt(this.Eu);
1T(e)&&e.forEach(e=>{q(e)&&this.Mu.add(e)})}else re.Lt(this.Eu);let p=t_({},this.persistence.props),f=t_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qu=new ok((e,t)=>this.ju(e,t),this.config.request_queue_config),this.Bu=new oS(this),this.__request_queue=[];let g=this.bu();g||(this.sessionManager=new oO(this),this.sessionPropsManager=new oR(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((e,t,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(ib.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(g)},0)):(ib.info("Initializing extensions synchronously"),this.Uu(g)),x.DEBUG=x.DEBUG||this.config.debug,x.DEBUG&&ib.info("Starting in debug mode",{this:this,config:n,thisC:t_({},this.config),p:p,s:f}),!this.config.identity_distinct_id||(null==(t=n.bootstrap)?void 0:t.distinctID)||(n.bootstrap=t_(t_({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let v=null==(i=n.bootstrap)?void 0:i.distinctID;if(this.ku=!!v&&!B(v),null==(s=n.bootstrap)?void 0:s.distinctID){let e=n.bootstrap.distinctID,t=this.get_distinct_id(),i=this.persistence.get_property(sa);if(n.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"anonymous"===i)this.identify(e);else if(n.bootstrap.isIdentifiedID&&null!=t&&t!==e&&"identified"===i)ib.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{let t=this.config.get_device_id(sU()),i=n.bootstrap.isIdentifiedID?t:e;this.persistence.set_property(sa,n.bootstrap.isIdentifiedID?sw:sb),this.register({distinct_id:e,$device_id:i})}}if(g)this.register_once({distinct_id:sp,$device_id:null},"");else if(!this.get_distinct_id()){let e=this.config.get_device_id(sU());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(sa,sb)}return sD(l,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),sD(l,"pageshow",()=>{var e;this.$u=!1,this.Tu||null==(e=this.Bu)||e.resume()}),n.segment?rz(this,()=>this.Wu()):this.Wu(),L(this.config._onCapture)&&this.config._onCapture!==o5&&(ib.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&ib.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 oM.apply(this,arguments)})().then(e=>{e&&this.register({[iI]:e})}).catch(o5),this}Vu(e){return q(e.name)&&L(e.setup)}Gu(e,t){this.Vu(e)?t.push(()=>{this.Zu().add(e).catch(()=>{var t;return null==(t=e.dispose)?void 0:t.call(e)}).catch(t=>{ib.error('Failed to dispose browser extension "'.concat(e.name,'"'),t)})}):this.uu.push(e)}zu(){var t,i,s,r,n,o;let a=null!=(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)?t:null==(s=e.__defaultExtensionClasses)?void 0:s.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(r=this.Qu)||r.call(this),this.Qu=void 0,this.featureFlags=new a(this)),L(this.featureFlags.onReloading)&&L(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):null==(n=(o=this.featureFlags).initialize)||n.call(o))}Uu(t){var i,s,r,n,o,a,l;let u=performance.now(),h=t_(t_({},e.__defaultExtensionClasses),this.config.__extensionClasses),c=[];h.exceptions&&this.uu.push(this.exceptions=null!=(i=this.exceptions)?i:new h.exceptions(this)),h.historyAutocapture&&this.uu.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.uu.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.uu.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.uu.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.Gu(this.autocapture=new h.autocapture(this),c),h.surveys&&this.Gu(this.surveys=null!=(s=this.surveys)?s:new h.surveys(this),c),h.logs&&this.Gu(this.logs=null!=(r=this.logs)?r:new h.logs(this),c),h.metrics&&this.uu.push(this.metrics=null!=(n=this.metrics)?n:new h.metrics(this)),h.conversations&&this.uu.push(this.conversations=null!=(o=this.conversations)?o:new h.conversations(this)),h.productTours&&this.uu.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.uu.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.uu.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,rq)),h.toolbar&&this.uu.push(this.toolbar=null!=(a=this.toolbar)?a:new h.toolbar(this)),h.experiments&&this.uu.push(this.experiments=null!=(l=this.experiments)?l:new h.experiments(this)),this.uu.forEach(e
1=>{e.initialize&&c.push(()=>{var t;null==(t=e.initialize)||t.call(e)})}),c.push(()=>{if(this.Ju){let e=this.Ju;this.Ju=void 0,this.uu.forEach(t=>{var i;return null==(i=t.onRemoteConfig)?void 0:i.call(t,e)})}}),this.Ku(c,u)}Ku(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,t)},0);let i=e.shift();if(i)try{i()}catch(e){ib.error("Error initializing extension:",e)}}let i=Math.round(performance.now()-t);this.register_for_session({[sg]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[sv]:i}),this.config.__preview_deferred_init_extensions&&ib.info("PostHog extensions initialized (".concat(i,"ms)"))}il(e){var t,i;if(!c||!c.body)return ib.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.du=e,this.compression=void 0,e.ok){let t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=R(t.supportedCompression,nw.GZipJS)?nw.GZipJS:R(t.supportedCompression,nw.Base64)?nw.Base64:void 0),(null==(i=t.analytics)?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:sx}),null==(t=this.Xu)||t.handleRemoteConfig(e),this.uu.forEach(t=>{var i;return null==(i=t.onRemoteConfig)?void 0:i.call(t,e)})}Wu(){try{this.config.loaded(this)}catch(e){ib.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&(null==d?void 0:d.hostname)){let e=d.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new nM(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.qu)||e.enable())}_dom_loaded(){this.is_capturing()&&sI(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,t,i,s,r,n;this.$u=!0,null==(e=this.surveys)||null==(t=e.handlePageUnload)||t.call(e),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(s$),null==(s=this.logs)||s.flushLogs("sendBeacon"),null==(r=this.qu)||r.unload(),null==(n=this.Bu)||n.unload()):this.ih()&&this.capture(s$,null,{transport:"sendBeacon"})}_send_request(e){ox(this,e)}ju(e,t){this.Bu?this.Bu.retriableRequest(e,t):this._send_request(t?t_(t_({},e),{},{transport:t}):e)}_execute_array(e){o3++;try{let t,i=[],s=[],r=[];sI(e,e=>{if(e)if(t=e[0],T(t))r.push(e);else if(L(e))try{e.call(this)}catch(t){ib.error("Error executing queued PostHog call",e,t)}else T(e)&&"alias"===t?i.push(e):T(e)&&-1!==t.indexOf("capture")&&L(this[t])?r.push(e):s.push(e)});let n=function(e,t){sI(e,function(e){try{if(T(e[0])){let i=t;sF(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){ib.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{o3--}}push(t){if(o3>0&&T(t)&&q(t[0])){let i=e.prototype[t[0]];return void(L(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get nh(){return{property:iO,persistenceKey:iC,cookieName:"_fbc",pattern:ae,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[iC]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(iC)}}}get sh(){return{property:iM,persistenceKey:iA,cookieName:"_fbp",pattern:at,register:(e,t)=>{var i;return null==(i=this.persistence)?void 0:i.register({[iA]:{value:e,delivered:t}})},unregister:()=>{var e;return null==(e=this.persistence)?void 0:e.unregister(iA)}}}rh(e){var t;let i=null==(t=this.persistence)?void 0:t.get_property(e.persistenceKey);return q(i)&&e.pattern.test(i)?{value:i,delivered:!1}:D(i)&&q(i.value)&&e.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}oh(e,t,i){return t===(null==i?void 0:i.value)?{value:t,pending:!i.delivered}:(e.register(t,!1),{value:t,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.bu())return;let t=sj(e.cookieName);return q(t)&&e.pattern.test(t)?t:void 0}uh(e,t,i,s){if(!this.persistence)return;let r=this.nh;this.persistence.refreshKey(r.persistenceKey);let n=this.rh(r);if(s)return void r.unregister();if(i)return q(t)&&ae.test(t)?this.oh(r,t,n):void r.unregister();let o=q(e)&&o7.test(e)?e:void 0,a=this.ah(r);return a&&((e,t,i)=>{let s=e.split(".");if(t)return s[3]===t;if(!i)return!0;let r=i.value.split(".");return s[3]===r[3]||Number(s[2])>Number(r[2])})(a,o,n)?this.oh(r,a,n):o?(null==n?void 0:n.value.split(".")[3])===o?{value:n.value,pending:!n.delivered}:this.oh(r,"fb.1.".concat(Date.now(),".").concat(o),n):n?{value:n.value,pending:!n.delivered}:void 0}hh(e,t,i){if(!this.persistence)return;let s=this.sh;this.persistence.refreshKey(s.persistenceKey);let r=this.rh(s);if(i)return void s.unregister();if(t)return q(e)&&at.test(e)?this.oh(s,e,r):void s.unregister();let n=this.ah(s);return n?this.oh(s,n,r):r?{value:r.value,pending:!r.delivered}:void 0}dh(e,t){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);let i=this.rh(e);(null==i?void 0:i.value)!==t||i.delivered||e.register(t,!0)}capture(e,t,i){var s,r,n,o,a,l;let u;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void ib.uninitializedWarning("posthog.capture");
1if(!this.is_capturing())return;if(j(e)||!q(e))return void ib.error("No event name provided to posthog.capture");this.Su();let h=!this.config.opt_out_useragent_filter&&this._is_bot();if(h&&!this.config.__preview_capture_bot_pageviews)return;let c=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==c?void 0:c.isRateLimited)return void ib.critical("This capture call is ignored due to client rate limiting.");(null==t?void 0:t.$current_url)&&!q(null==t?void 0:t.$current_url)&&(ib.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||(null==i?void 0:i.fh)||ib.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&&(u=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();let d=new Date,p=(null==i?void 0:i.timestamp)||d,f=tl(null==i?void 0:i.uuid,sU),g={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},p,f)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&h&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),c&&(g.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);let v="$feature_flag_called"===e&&!1===g.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!v&&(g.$set=null==i?void 0:i.$set);let _=D(null==t?void 0:t.$set)?t.$set:void 0,m=T(null==t?void 0:t.$unset)?t.$unset:[],y=(null==i?void 0:i.$unset)||[],b=e=>{var t;let s=!!(null==i?void 0:i.$set)&&e in i.$set;return{hasProvided:s||!!_&&e in _,provided:s?null==i||null==(t=i.$set)?void 0:t[e]:null==_?void 0:_[e],unset:-1!==m.indexOf(e)||-1!==y.indexOf(e)}},w=b(iO),x=b(iM),k=[{channel:this.nh,hasProvided:w.hasProvided,update:this.uh(null==u?void 0:u.fbclid,w.provided,w.hasProvided,w.unset)},{channel:this.sh,hasProvided:x.hasProvided,update:this.hh(x.provided,x.hasProvided,x.unset)}];for(let{channel:e,hasProvided:t,update:i}of k)i&&!0===g.properties.$process_person_profile&&i.pending&&!t&&!v&&(g.$set=t_({[e.property]:i.value},g.$set));let E=null==i?void 0:i.$unset;E&&(g.$unset=E);let S=v?void 0:this.ph(null==i?void 0:i.$set_once,e!==sR,e===sP);if(S&&(g.$set_once=S),(null==i?void 0:i._noTruncate)||(n=this.config.properties_string_max_length,g=function(e,t){let i=new Set;return function e(s,r){let n;if(s!==Object(s))return t?t(s):s;if(!i.has(s)){if(i.add(s),T(s))n=[],sI(s,t=>{n.push(e(t))});else{let t={};sF(K(s)?sT(s):s,(s,r)=>{i.has(s)||(t[r]=e(s,r))}),n=t}return n}}(e)}(g,e=>q(e)?e.slice(0,n):e)),g.timestamp=p,j(null==i?void 0:i.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=d),v&&(g.properties=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return t0.forEach(s),t.forEach(s),i}(g.properties,ai)),e===nE.DISMISSED||e===nE.SENT){let i,s=null==t?void 0:t[nS.SURVEY_ID],r=null==t?void 0:t[nS.SURVEY_ITERATION];oW({id:s,current_iteration:r}),g.$set=t_(t_({},g.$set),{},{[(a={id:s,current_iteration:r},l=e===nE.SENT?"responded":"dismissed",i="$survey_".concat(l,"/").concat(a.id),a.current_iteration&&a.current_iteration>0&&(i="$survey_".concat(l,"/").concat(a.id,"/").concat(a.current_iteration)),i)]:!0})}else e===nE.SHOWN&&(g.$set=t_(t_({},g.$set),{},{[nS.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===nR.SHOWN){let e=null==t?void 0:t[nI.TOUR_TYPE];e&&(g.$set=t_(t_({},g.$set),{},{["".concat(nI.TOUR_LAST_SEEN_DATE,"/").concat(e)]:(new Date).toISOString()}))}let $=t_(t_({},g.properties.$set),g.$set);
1if(N($)||this.setPersonPropertiesForFlags($),!z(this.config.before_send)){let e=this.Os(g);if(!e)return;(g=e).uuid=tl(g.uuid,sU)}let P=k.filter(e=>{var t,i,s;let{channel:r,update:n}=e,o=null!=(t=null==(i=g.$set)?void 0:i[r.property])?t:D(null==(s=g.properties)?void 0:s.$set)?g.properties.$set[r.property]:void 0;return(null==n?void 0:n.pending)&&o===n.value});this.vu.emit("eventCaptured",g);let R=null!=(s=null==i?void 0:i._url)?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(R),F=t_(t_(t_({method:"POST",url:R,data:g,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:I?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},I&&(null==(r=g.properties)?void 0:r.$session_id)?{batchGroup:g.properties.$session_id+(g.properties.$window_id?"-".concat(g.properties.$window_id):"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),P.length?{fireCallbackOnDrop:!0,callback:e=>{if(e.statusCode>=200&&300>e.statusCode)for(let{channel:e,update:t}of P)this.dh(e,t.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||P.length){let e;!F.transport&&!F.callback&&N(null!=(o=this.config.request_headers)?o:{})&&this.$u&&(e="sendBeacon"),this.ju(F,e)}else this.qu.enqueue(F);return g}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null==(t=this.Xu)?void 0:t.getExtension(e)}Zu(){var e;return null!=(e=this.Xu)?e:this.Xu=new o1(this)}pu(e){this.Pu.push(e);let t=!0;return()=>{if(!t)return;t=!1;let i=this.Pu.indexOf(e);-1!==i&&this.Pu.splice(i,1)}}gh(){var e,t,i;let s=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return!!(null==(e=this.persistence)?void 0:e.consumeCookieIdentityChange())&&(this.Ou=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(i=this.sessionPersistence)||i.clear(),this.Mu.clear(),this.mh()),null==(t=this.featureFlags)||t.reset(),s&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,t,i,s,r){let n;if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.gh();let o=r?void 0:this.persistence.remove_event_timer(e),a=t_({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.bu()&&(a[sf]=!0),"$snapshot"===e){let e=t_(t_({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=e.distinct_id,(!q(a.distinct_id)&&!U(a.distinct_id)||B(a.distinct_id))&&ib.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}let u=function(e,t,i){var s,r,n,o;let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!_)return{};let u=e?[...r4,...t||[]]:[],[h,c]=e8(_),[p,f]=function(e){for(let t=0;tt.length>t;t++){let[i,s,r]=tt[t],n=e.match(i);if(n){let t=r&&e.match(r)||n;return[s,(null==t?void 0:t[1])||""]}}return["",""]}(_),g=function(){let e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),v={};j(i)||(v.detectGoogleSearchApp=i);let m={},y=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,b=null==(r=navigator)?void 0:r.maxTouchPoints,w=null==l||null==(n=l.screen)?void 0:n.width,k=null==l||null==(o=l.screen)?void 0:o.height,E=null==l?void 0:l.devicePixelRatio;j(y)||(m.userAgentDataPlatform=y),j(b)||(m.maxTouchPoints=b),j(w)||(m.screenWidth=w),j(k)||(m.screenHeight=k),j(E)||(m.devicePixelRatio=E);let S=sO(sA({$os:h,$os_version:c,$browser:e3(_,navigator.vendor,g,v),$webview_app:p,$webview_app_version:f,$device:e9(_),$device_type:e7(_,m),$timezone:na(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:r1(a?th(null==d?void 0:d.href):null==d?void 0:d.href,u,r8),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:e4(_,navigator.vendor,g,v),$browser_language:ni(),$browser_language_prefix:function(){let e=ni();return"string"==typeof e?e.split("-")[0]:void 0}(),$screen_height:null==l?void 0:l.screen.height,$screen_width:null==l?void 0:l.screen.width,$viewport_height:null==l?void 0:l.innerHe
1ight,$viewport_width:null==l?void 0:l.innerWidth,$lib:x.LIB_NAME,$lib_version:x.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return x.SDK_DIST_CHANNEL&&(S.$sdk_dist_channel=x.SDK_DIST_CHANNEL),S}(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){let{sessionId:e,windowId:t}=this.sessionManager.checkAndGetSessionAndWindowId(r,i.getTime(),!0);a.$session_id=e,a.$window_id=t}this.sessionPropsManager&&sO(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&sO(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(h=this.Bu)?void 0:h.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===oq&&(a.$lib_custom_api_host=this.config.api_host),n="$pageview"!==e||r?"$pageleave"!==e||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),a=sO(a,n),"$pageview"===e&&c&&(a.title=c.title),!j(o)){let e=i.getTime()-o;a.$duration=parseFloat((e/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");let p=this.persistence.properties(),f=this.sessionPersistence.properties(),g=a.$groups,v=p.$groups;D(g)&&!N(g)&&(a.$groups=t_(t_({},D(v)?v:{}),g)),sF(["$referrer","$referring_domain"],e=>{e in p&&delete f[e]});let m={};if(this.Pu.length>0)for(let e of this.Pu.slice())try{sO(m,e())}catch(e){ib.error("Failed to produce browser extension event properties",e)}(a=sO({},u,p,f,t_(t_({},m),a))).$is_identified=this._isIdentified(),T(this.config.property_denylist)?sF(this.config.property_denylist,function(e){delete a[e]}):ib.error(o9+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);let y=this.config.sanitize_properties;y&&(ib.error(o8),a=y(a,e));let b=this.yh();return a.$process_person_profile=b,b&&!r&&this.bh("_calculate_event_properties"),a}ph(e){var t;let i=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.persistence||!this.yh()||this.Iu&&!s)return e;let r=sO({},this.persistence.get_initial_props(),(null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(ib.error(o8),r=n(r,"$set_once")),i&&(this.Iu=!0),N(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t,i;null==(t=this.persistence)||t.syncCookieProperties(),this.gh(),null==(i=this.sessionPersistence)||i.register(e),Object.keys(e).forEach(e=>this.Mu.add(e)),this.mh()}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this.Mu.delete(e),this.mh()}_h(e,t){this.register({[e]:t})}Hu(){this.Mu.forEach(e=>{var t;null==(t=this.sessionPersistence)||t.unregister(e)}),this.Mu.clear(),this.mh()}mh(){var e;if(!this.Eu)return;if("memory"===this.config.persistence||(null==(e=this.sessionPersistence)?void 0:e.mi)||!re.Et())return void re.Lt(this.Eu);let t=[];this.Mu.forEach(e=>t.push(e)),t.length>0?re.At(this.Eu,t):re.Lt(this.Eu)}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())?e:[]}isFeatureEnabled(e,t){var i,s;return null!=(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2?arguments[2]:void 0;return null==(t=this.featureFlags)?void 0:t.getEarlyAccessFeatures(e,i,s)}on(e,t){return this.vu.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:o6}
1),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:o6})}getActiveMatchingSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:o6})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oY;null==(t=this.surveys)||t.displaySurvey(e,i)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))?t:{visible:!1,disabledReason:o6}}canRenderSurveyAsync(e){var t,i;let s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurveyAsync(e,s))?t:Promise.resolve({visible:!1,disabledReason:o6})}wh(e){return!e||B(e)?(ib.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(ib.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.')),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(ib.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.')),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return ib.uninitializedWarning("posthog.identify");if(U(e)&&(e=e.toString(),ib.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(e)||!this.bh("posthog.identify"))return;this.Su();let s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this.gh(!1),o=this.persistence.Da(),a=!1;try{let s=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property("__alias")&&(this.unregister(iF),this.register({distinct_id:e}));let o=(this.persistence.get_property("$user_state")||"anonymous")===sb,u=e!==s,h=!u&&o;if(u&&o){var l;let r=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:s};this.persistence.set_property(sa,sw),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",r,{$set:t||{},$set_once:i||{}})&&(this.Ou=oj(e,t,i)),null==(l=this.featureFlags)||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(sa,sw);let s=t||{},r=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:r},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:s,$set_once:r})&&(this.Ou=oj(e,t,i))}else(t||i)&&this.setPersonProperties(t,i);u||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ss)):h&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ja(a)}}setPersonProperties(e,t){if(!e&&!t||!this.bh("posthog.setPersonProperties"))return;let i=oj(this.get_distinct_id(),e,t);this.Ou!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}})&&(this.Ou=i)):ib.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;let i=(T(e)?e:[e]).filter(e=>q(e)&&e.length>0);0!==i.length&&this.bh("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ou=null)}group(e,t,i){var s;if(!e||!t)return void ib.error("posthog.group requires a group type and group key");null==(s=this.persistence)||s.syncCookieProperties(),this.gh();let r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:t_(t_({},r),{},{[e]:t})}),(n||i)&&this.yh()){let s={$group_type:e,$group_key:t};
1i&&(s.$group_set=i),this.capture(sR,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),n&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t;let i=!(arguments.length>1)||void 0===arguments[1]||arguments[1];null==(t=this.featureFlags)||t.setPersonPropertiesForFlags(e,i)}resetPersonPropertiesForFlags(){var e;let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(e){var t;let i=!(arguments.length>1)||void 0===arguments[1]||arguments[1];this.bh("posthog.setGroupPropertiesForFlags")&&(null==(t=this.featureFlags)||t.setGroupPropertiesForFlags(e,i))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){let t=W(e)?e:null==e?void 0:e.resetDeviceID,i=W(e)||null==e?void 0:e.bootstrap;this.kh(t,!1,i)}kh(e){var t,i,s,r,n,o,a,l,u,h,c,d,p,f,g,v,_,m,y,b,w;let x=arguments.length>1&&void 0!==arguments[1]&&arguments[1],k=arguments.length>2?arguments[2]:void 0;if(ib.info("reset"),!this.__loaded)return ib.uninitializedWarning("posthog.reset");let E=null==k?void 0:k.sessionID;this.config.bootstrap=k||(null==(t=this.Lu)?void 0:t.bootstrap)||{},null==(i=this.featureFlags)||null==(s=i.updateConfig)||s.call(i,this.config,this.nl());let S=this.get_property(iR),$=this.get_property(iI),P=this.get_property(iW);null==(r=this.sessionRecording)||r.flushBeforeIdentityReset();let R=this.is_capturing();this.consent.reset(),x||!R||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.");let I=null==(n=this.persistence)||null==(o=n.Da)?void 0:o.call(n),F=!1;try{if(null==(a=this.persistence)||a.clear(),null==(l=this.sessionPersistence)||l.clear(),this.Mu.clear(),this.mh(),j(P)||null==(v=this.persistence)||v.register({$session_recording_remote_config:P}),null==(u=this.surveys)||u.reset(),null==(h=this.featureFlags)||h.reset(),null==(c=this.conversations)||c.reset(),null==(d=this.logs)||d.reset(),null==(p=this.metrics)||p.reset(),null==(f=this.persistence)||f.set_property("$user_state","anonymous"),null==(g=this.sessionManager)||g.resetSessionId(),this.Ou=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:sp,$device_id:null},"");else{let t=this.config.get_device_id(sU());this.register_once({distinct_id:t,$device_id:e?t:S},""),e||j($)||this.register({[iI]:$})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),k&&(k.distinctID&&!this.bu()&&(null==(y=this.persistence)||y.set_property("$user_state",k.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:k.distinctID})),null==(_=this.featureFlags)||_.initialize(),!z(E)&&!(null==(m=this.sessionManager)?void 0:m.setBootstrapSessionId(E,!0)))){let e=t_({},k);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,F=!0}finally{I&&(null==(b=this.persistence)||null==(w=b.ja)||w.call(b,F))}this.reloadFeatureFlags()}shutdown(e){var t=this;return er(function*(){var e,i,s,r,n,o,a,l,u;if(t.__loaded){t.Tu=!0,t.Zu().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(i=t.logs)||i.flushLogs("sendBeacon"),null==(s=t.metrics)||s.flush("sendBeacon"),null==(r=t.metrics)||r.dispose(),null==(n=t.qu)||n.unload(),null==(o=t.Bu)||o.unload();try{null==(u=t.featureFlags)||u.destroy()}catch(e){ib.error("Error while destroying feature flags",e)}null==(a=t.persistence)||a.destroy(),null==(l=t.sessionPersistence)||l.destroy()}else ib.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(e=this.conversations)||e.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";let{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if((null==e?void 0:e.withTimestamp)&&i){var r;let t=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+="?t=".concat(Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0))}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(ib.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(j(t)&&(t=this.get_distinct_id()),e!==t?(this._h(iF,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ib.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){let t=t_({},this.config);if(D(e)){var i,s,r,n,o,a,l,u,h,c,d,p,f,g,v;sO(this.config,ao(e));let _=this.xu();null==(i=this.persistence)||i.update_config(this.config,t,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nb(t_(t_({},this.config),{},{persistence:"sessionStorage"}),_,!1);let m=this.Du(this.config.debug);W(m)&&(this.config.debug=m),W(this.config.debug)&&(this.config.debug?(x.DEBUG=!0,sK.Et()&&sK.At("ph_debug",!0),ib.info("set_config",{config:e,oldConfig:t,newConfig:t_({},this.config)})):(x.DEBUG=!1,sK.Et()&&sK.Lt("ph_debug"))),null==(s=this.featureFlags)||null==(r=s.updateConfig)||r.call(s,this.config,this.nl()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.metrics)||a.onConfigChange(),null==(l=this.sessionRecording)||l.startIfEnabledOrStop(),null==(u=this.tracingHeaders)||u.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(c=this.heatmaps)||c.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(p=this.deadClicksAutocapture)||p.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.Cu(),null==(g=this.externalIntegrations)||g.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&rz(this,o5,!1)}}_overrideSDKInfo(e,t){x.LIB_NAME=e,x.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n;let o=!0===e,a={sampling:o||!!(null==e?void 0:e.sampling),linked_flag:o||!!(null==e?void 0:e.linked_flag),url_trigger:o||!!(null==e?void 0:e.url_trigger),event_trigger:o||!!(null==e?void 0:e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(null==(e=this.sessionRecording)?void 0:e.started)}captureException(e,t){try{if(!this.exceptions)return;let i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(t_(t_({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var t,i;return null!=(t=null==(i=this.logs)?void 0:i.logger)?t:e.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!=(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e;let t=null!=(e=this.config.name)?e:as;return t!==as&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}yh(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&
1!this._isIdentified()&&N(this.getGroups())&&!(null==(e=this.persistence)||null==(e=e.props)?void 0:e.__alias)&&!(null==(t=this.persistence)||null==(t=t.props)?void 0:t.$epp))}ih(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return"never"===this.config.person_profiles?(ib.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(sd,!0),!0)}xu(){if("always"===this.config.cookieless_mode)return!0;let e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}Cu(){var e,t,i,s,r;let n=this.xu();return this.is_capturing()||null==(i=this.logs)||i.$h(),(null==(e=this.persistence)?void 0:e.mi)!==n&&(null==(s=this.persistence)||s.set_disabled(n)),(null==(t=this.sessionPersistence)?void 0:t.mi)!==n&&(null==(r=this.sessionPersistence)||r.set_disabled(n)),n&&(this.Mu.clear(),this.mh()),n}opt_in_capturing(t){var i,s,r,n,o,a,l,u,h,c,d;if("always"!==this.config.cookieless_mode){if(this.bu()){null==(s=this.sessionRecording)||s.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewManager)||n.destroy(),this.sessionManager=new oO(this),this.pageViewManager=new rG(this),this.persistence&&(this.sessionPropsManager=new oR(this,this.sessionManager,this.persistence));let t=null!=(o=null==(a=this.config.__extensionClasses)?void 0:a.sessionRecording)?o:null==(l=e.__defaultExtensionClasses)?void 0:l.sessionRecording;t&&(this.sessionRecording=this.yu(this.sessionRecording,new t(this)),this.du&&(null==(u=this.sessionRecording)||null==(h=u.onRemoteConfig)||h.call(u,this.du)))}this.consent.optInOut(!0),this.Cu(),this.Yu(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(c=this.surveys)||c.loadIfEnabled()),(j(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!=(d=null==t?void 0:t.captureEventName)?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else ib.warn(o4)}opt_out_capturing(){var e,t;if("always"===this.config.cookieless_mode)return void ib.warn(o4);let i="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==i||i.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:sp,$device_id:null}),this.mu(i),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){let e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Cu()}_is_bot(){return h?oC(h,this.config.custom_blocked_useragents):void 0}th(){c&&("visible"===c.visibilityState?this.Ru||(this.Ru=!0,this.capture(sS,{title:c.title},{send_instantly:!0}),this.Au&&(c.removeEventListener(sk,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),sD(c,sk,this.Au)))}debug(e){!1===e?(null==l||l.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==l||l.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}))}nl(){let e=this.Lu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(ib.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(e,t,i,s,r){let n=t in e&&!z(e[t]),o=i in e&&!z(e[i]);return n?e[t]:!!o&&(r&&r.warn("Config field '".concat(i,"' is deprecated. Please use '").concat(t,"' instead. The old field will be removed in a future major version.")),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,ib)}Os(e){var t;if(z(this.config.before_send))return e;let i=Object.keys(null!=(t=e.properties)?t:{}).filter(Y),s=T(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;
1for(let t of s)try{if(r=t(r),z(r)){let t="Event '".concat(e.event,"' was rejected in beforeSend function");return G(e.event)?ib.warn("".concat(t,". This can cause unexpected behavior.")):ib.info(t),null}r.properties&&!N(r.properties)||ib.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}catch(t){return ib.error("Error in beforeSend function for event '".concat(e.event,"':"),t),null}for(let t of i)if(r.properties&&z(r.properties[t]))return ib.warn("Event '".concat(e.event,"' had its '").concat(t,"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.")),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager.Vo)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Du(e){let t=W(e)&&!e,i=sK.Et()&&"true"===sK.Ot("ph_debug");return!t&&(!!i||e)}constructor(){var t;this.$u=!1,this.Tu=!1,this.webPerformance=new aa,this.Iu=!1,this.version=x.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new oI,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ar(),this.SentryIntegration=rW,this.sentryIntegration=e=>(function(e,t){let i=rV(e,t);return{name:rU,processEvent:e=>i(e)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new o$(this),this.pageViewManager=new rG(this),this.rateLimiter=new nO(this),this.requestRouter=new oU(this),this.consent=new rt(this),this.externalIntegrations=new oK(this);let i=null!=(t=e.__defaultExtensionClasses)?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{let s=q(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{let s=q(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>ib.info('send "'.concat(null==e?void 0:e.event,'"'),e))}};al.__defaultExtensionClasses={},al.Ch=(()=>{let e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=sM(e.prototype[t[i]])}(al,["identify"]);var au=class{isRageClick(e,t,i){if(this.disabled)return!1;let s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}constructor(e){this.disabled=!1===e;let t=D(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}};let ah="$copy_autocapture",ac=iw("[AutoCapture]");function ad(e,t){return t.length>e?t.slice(0,e)+"...":t}var ap=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var t;if(!rP(e))return!0;let i=null!=(t=this.bo().css_selector_ignorelist)?t:rm,s=new Set,r=e;for(;r;){if(s.size>=1e3||s.has(r))return!0;s.add(r);let e=r,t=rh(e);if(R(t,"ph-no-capture")||R(t,"ph-sensitive")||rR(e)||i.some(t=>rg(e,t)))return!0;let n=r.parentNode;r=ra(n)?n.host:n&&rr(n)?n:null}return!1}_o(e){if(!this.isEnabled||"pointercancel"===e.type)return void this.fo();if("pointerdown"===e.type){var t;this.fo();let i=rp(e);return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&rr(i)&&(this.po={target:i,excluded:this.yo(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null==(t=this.wo)?void 0:t.distinctId}))}let i=this.po;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.fo():"pointerup"===e.type&&(i.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(e){var t,i;let s=this.po;this.fo();let r=rp(e);if((null==s?void 0:s.released)&&s.target.isConnected&&s.distinctId===(null==(t=this.wo)?void 0:t.distinctId)&&e.pointerId===s.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-s.x)&&5>=Math.abs(e.clientY-s.y)&&r&&(rn(r,"html")||rn(r,"body"))){if(s.excluded)return null;let e=null!=(i=this.bo().css_selector_ignorelist)?i:rm;return[r,null==c?void 0:c.documentElement,null==c?void 0:c.body].some(t=>{if(!t)return!1;let i=rh(t);return R(i,"ph-no-capture")||R(i,"ph-sensitive")||!rP(t)||rR(t)||e.some(e=>rg(t,e))})?null:s.target}}setup(e){this.Eo(),this.wo=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?t.dispose():(this.Po=t,this.startIfEnabled())}dispose(){var e;this.Io||(this.Io=!0,this.wo=void 0,null==(e=this.Po)||e.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var e,t;return this.bo(),this.Rr.url_allowlist=null==(e=this.Rr.url_allowlist)?void 0:e.map(e=>new RegExp(e)),this.Rr.url_ignorelist=null==(t=this.Rr.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),this.Rr}Ao(){if(!this.isBrowserSupported())return void ac.info("Disabling Automatic Event Collection because this browser is not supported");if(!l||!c)return;let e=this.Fo=e=>{e=e||(null==l?void 0:l.event);try{if("blur"===e.type)return void this.fo();if(0===e.type.indexOf("pointer"))return void this._o(e);let t="click"===e.type?this.ko(e):void 0;if(H(t))return;this.Oo(e,"$autocapture",t)}catch(e){ac.error("Failed to capture event",e)}};if(sD(l,"blur",e),sD(c,"submit",e,{capture:!0}),sD(c,"change",e,{capture:!0}),sD(c,"click",e,{capture:!0}),sF(["pointerdown","pointermove","pointerup","pointercancel"],t=>{sD(c,t,e,{capture:!0})}),this.bo().capture_copied_text){let e=this.Do=e=>{e=e||(null==l?void 0:l.event);try{this.Oo(e,ah)}catch(e){ac.error("Failed to capture clipboard event",e)}};sD(c,"copy",e,{capture:!0}),sD(c,"cut",e,{capture:!0}),sD(c,"paste",e,{capture:!0})}}Ro(){this.fo(),this.Fo&&(null==l||l.removeEventListener("blur",this.Fo),sF(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==c||c.removeEventListener(e,this.Fo,!0)}),null==c||c.removeEventListener("submit",this.Fo,!0),null==c||c.removeEventListener("change",this.Fo,!0),null==c||c.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(null==c||c.removeEventListener("copy",this.Do,!0),null==c||c.removeEventListener("cut",this.Do,!0),null==c||c.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(e){var t;if(this.Io)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();let i=e.config;
1i.elementsChainAsString&&(this.To=i.elementsChainAsString);let s=i.autocapture_opt_out;W(s)&&(null==(t=this.wo)||t.kv.set("$autocapture_disabled_server_side",s),this.Co=s),this.startIfEnabled()}setElementSelectors(e){this.Mo=e}getElementSelectors(e,t){var i;let s=[];return null==(i=this.Mo)||i.forEach(i=>{let r=null==c?void 0:c.querySelectorAll(i);null==r||r.forEach(r=>{e!==r&&t!==r||R(s,i)||s.push(i)})}),s}get isEnabled(){var e,t;if(this.Io)return!1;let i=null==(e=this.wo)?void 0:e.kv.get(iL),s=this.Co,r=this.bo();if(!r.remoteRequestsDisabled&&!this.$o)return!1;let n=r.remoteRequestsDisabled&&!this.$o;if(H(s)&&!W(i)&&!n)return!1;let o=null!=(t=this.Co)?t:!!i;return!!r.enabled&&!o}Oo(e){var t,i,s,r;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture",o=arguments.length>2?arguments[2]:void 0;if(!this.isEnabled)return void this.fo();let a=o||rp(e);ro(a)&&(a=a.parentNode||null);let u=this.Eo();"$autocapture"===n&&"click"===e.type&&e instanceof MouseEvent&&u.rageclick&&(null==(t=this.rageclicks)?void 0:t.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&rE(a,u.rageclick)&&this.Oo(e,"$rageclick",o);let h=n===ah,c=h?t_(t_({},u),{},{dom_event_allowlist:void 0}):u;if(a&&function(e,t,i,s,r,n){var o;if(!l||rS(e)||(null==i?void 0:i.url_allowlist)&&!ru(i.url_allowlist,n)||(null==i?void 0:i.url_ignorelist)&&ru(i.url_ignorelist,n))return!1;if(null==i?void 0:i.dom_event_allowlist){let e=i.dom_event_allowlist;if(e&&!e.some(e=>t.type===e))return!1}let{parentIsUsefulElement:a,targetElementList:u}=r$(e,s);if(!function(e,t){let i=null==t?void 0:t.element_allowlist;if(j(i))return!0;for(let t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(u,i)||!rv(u,null==i?void 0:i.css_selector_allowlist)||rv(u,null!=(o=null==i?void 0:i.css_selector_ignorelist)?o:rm))return!1;try{let i=l.getComputedStyle(e);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}let h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(rf.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(a,e,c,h,h?["copy","cut","paste"]:void 0,{config:{get_current_url:u.getCurrentUrl}})){let{props:t,explicitNoCapture:o,target:h}=function(e,t){var i,s,r,n;let{e:o,maskAllElementAttributes:a,maskAllText:u,elementAttributeIgnoreList:h,elementsChainAsString:c,disableCaptureUrlHashes:d}=t;if(!rr(e))return{props:{}};let p=[e],f=new Set([e]),g=e;for(;g.parentNode&&!rn(g,"body")&&1e3>p.length;){if(ra(g.parentNode)){let e=g.parentNode.host;if(f.has(e))break;f.add(e),p.push(e),g=e;continue}if(!rr(g.parentNode)||f.has(g.parentNode))break;f.add(g.parentNode),p.push(g.parentNode),g=g.parentNode}let v="click"===o.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?p.findIndex(e=>rn(e,"button")||rn(e,"a")):-1;v>0&&(u=u||p.slice(0,v+1).some(e=>!rP(e)||rR(e)));let _=[],m={},y,b=!1,w=!1;if(sF(p,e=>{let t=rP(e);if(rn(e,"a")&&!a&&!(null==h?void 0:h.includes("href"))){let i=e.getAttribute("href");b=!!(t&&i&&rT(i))&&(d?th(i):i)}R(rh(e),"ph-no-capture")&&(w=!0),_.push(function(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=e.tagName.toLowerCase(),o={tag_name:n};rf.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?ad(1024,rL(e)):ad(1024,rd(e)));let a=rh(e);t||(null==s?void 0:s.includes("class"))||0>=a.length||(o.classes=a.filter(function(e){return""!==e})),sF(e.attributes,function(i){var n;if((!rR(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&rT(i.value)&&(!q(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){let e=i.value;"class"===i.name&&(e=rl(e).join(" ")),o["attr__"+i.name]=ad(1024,"href"===i.name&&r?th(e):e)}});let l=1,u=1,h=e;for(;h=function(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!rr(t));return t}(h);)l++,h.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,a,u,h,d)),sF(function(e){if(!rP(e))return{};let t={};return sF(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){let i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&rT(s)&&(t[i]=s)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(m,t)||(m[t]=e)})}),w)return{props:{},explicitNoCapture:w};if(v>0&&(e=p[v],_.splice(0,v)),u||(_[0].$el_text=rn(e,"a")||rn(e,"button")?rL(e):rd(e)),b){_[0].attr__href=b;let e=null==(r=rQ(b))?void 0:r.host,t=null==l||null==(n=l.location)?void 0:n.host;e&&t&&e!==t&&(y=b)}return{props:sO({$event_type:o.type,$ce_version:1},c?{}:{$elements:_},{$elements_chain:T(_)?_.map(e=>{var t,i;let s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:function(e){let t=e.attr__class;if(t)return T(t)?t:rl(t)}
1(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return sC(e).filter(e=>{let[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{let[t,i]=e;return s.attributes[t]=i}),s}).map(e=>{var t,i;let s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(let t of(e.attr_class.sort(),e.attr_class))s+=".".concat(t.replace(/"/g,""));let r=t_(t_(t_(t_({},e.text?{text:e.text}:{}),{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),n={};return sC(r).sort((e,t)=>{let[i]=e,[s]=t;return s>i?-1:+(i>s)}).forEach(e=>{let[t,i]=e;return n[rD(t.toString())]=rD(i.toString())}),s+=":",s+=sC(n).map(e=>{let[t,i]=e;return"".concat(t,'="').concat(i,'"')}).join("")}).join(";"):""},(null==(i=_[0])?void 0:i.$el_text)?{$el_text:null==(s=_[0])?void 0:s.$el_text}:{},y&&"click"===o.type?{$external_click_url:y}:{},m),target:e}}(a,{e:e,maskAllElementAttributes:u.maskAllElementAttributes,maskAllText:u.maskAllText,elementAttributeIgnoreList:u.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:u.disableCaptureUrlHashes});if(o)return!1;let c=this.getElementSelectors(a,h);if(c&&c.length>0&&(t.$element_selectors=c),n===ah){let i=e.type||"clipboard";if("paste"!==i){let e=null==l||null==(s=l.getSelection())?void 0:s.toString(),i=rc(e);if(!i)return!1;t.$selected_content=i,t.$clipboard_text_length=null!=(r=null==e?void 0:e.length)?r:0}t.$copy_type=i}return null==(i=this.wo)||i.capture(n,t),!0}}isBrowserSupported(){return L(null==c?void 0:c.querySelectorAll)}constructor(e){this.So=e,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new au(this.Rr.rageclick),this.Mo=null}},af=class{refresh(e){let t=this._instance.config,i=D(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=null==i?void 0:i.url_allowlist,e.url_ignorelist=null==i?void 0:i.url_ignorelist,e.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,e.element_allowlist=null==i?void 0:i.element_allowlist,e.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,e.capture_copied_text=null==i?void 0:i.capture_copied_text}constructor(e){this._instance=e}};let ag=iw("[ExceptionAutocapture]"),av=()=>{},a_=e=>{var t;if(L(e))return null!=(t=e.__posthog_layer__)?t:e.__rrweb_layer__};function am(e,t,i){try{if(!(t in e))return av;let s={next:e[t]},r=i(function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return s.next.apply(this,t)});return L(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=s.next);let i=e[t],n=a_(i);for(;n;){if(n.next===r)return void(n.next=s.next);i=n.next,n=a_(i)}}}catch(e){return av}}let ay=iw("[TracingHeaders]"),ab=iw("[Web Vitals]"),aw=["CLS","FCP","INP","LCP"],ax=["INP","LCP"],ak=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],aE="disabled",aS="lazy_loading",a$=iw("[SessionRecording]"),aP=iw("[Heatmaps]");function aR(e){return D(e)&&"clientX"in e&&"clientY"in e&&U(e.clientX)&&U(e.clientY)}
1let aI=iw("[Product Tours]"),aF=e=>{var t;return!e.config.disable_product_tours&&!!(null==(t=e.persistence)?void 0:t.get_property(iz))},aO=["$set_once","$set"],aC=iw("[SiteApps]"),aM="Error while initializing PostHog app with config id ",aA=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),aT="SDK is not enabled or survey functionality is not yet loaded",aL="Disabled. Not loading surveys.";var aD=class{setup(e){if(!this.Io)return this.Fh=e,aA(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.Io?t.dispose():(this.Po=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,null==(e=this.Po)||e.dispose(),this.Po=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(i=this._surveyManager)||null==(s=i.dispose)||s.call(i),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(e=>clearTimeout(e)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,t,i;null==(e=this._surveyManager)||null==(t=e.clearInMemoryInProgressSurveyState)||t.call(e);try{null==(i=this._surveyEventReceiver)||i.reset(),localStorage.removeItem("lastSeenSurveyDate");let e=[];for(let t=0;t<localStorage.length;t++){let i=localStorage.key(t);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(this.Io||!this.wo)return;let e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void oV.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void oV.info(aL);if(e.cookielessMode&&this.So.isOptedOut())return void oV.info("Not loading surveys in cookieless mode without consent.");let t=this.So.getExtensions();if(!t)return void oV.error("PostHog Extensions not found.");if(j(this.Ah)&&!e.advancedEnableSurveys)return;let i=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{let e=t.generateSurveys;if(e)return this.Oh(e,i),void(this.Ih=!1);let s=t.loadExternalDependency;if(!s)return this.Dh(sy),void(this.Ih=!1);s(e=>{try{if(this.Io)return;let t=this.So.getExtensions();!e&&(null==t?void 0:t.generateSurveys)?this.Oh(t.generateSurveys,i):this.Dh("Could not load surveys script",e)}finally{this.Ih=!1}})}catch(e){throw this.Ih=!1,this.Dh("Error initializing surveys",e),e}}Oh(e,t){this.Io||(this._surveyManager=e(t),this._surveyEventReceiver=this.So.createEventReceiver(),oV.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,t){oV.error(e,t),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(t=>t!==e)}}getSurveys(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=null!=(t=this.wo)?t:this.Th;if(!s||this.Io)return;if(this.Rr.disableSurveys)return oV.info(aL),e([]);let r=s.kv.get(i8);if(r&&!i)return e(r,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(t=>{let{surveys:i,context:s}=t;this.Io||e(i,s)}).catch(e=>oV.error("Error in survey callback",e));let n=this.qh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(e=>{try{return this.jh(s,e)}catch(e){return oV.error("Error processing surveys response",e),this.jh(s,{statusCode:0,error:e})}},e=>this.jh(s,{statusCode:0,error:e}));this.Eh=n;let o=()=>{this.Eh===n&&(this.Eh=null)};n.then(t=>{o(),this.Io||e(t.surveys,t.context)},o).catch(e=>oV.error("Error in survey callback",e))}qh(e,t){let i=this.wo;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:Error(aT)}))}jh(e,t){var i;if(this.Io)return{surveys:[],context:{isLoaded:!1,error:aT}};let s=t.statusCode;if(200!==s||!t.json){let e="Surveys API could not be loaded, status: ".concat(s);return 0!==s?oV.error(e):t.error||oV.warn(e),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this.Ph=null;let r=t.json.surveys||[],n=r.filter(e=>{var t;return!(!e.start_date||e.end_date)&&(oA(e)||!!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length))});return n.length>0&&(null==(i=this._surveyEventReceiver)||i.register(n)),e.kv.set({[i8]:r,[i9]:Date.now()}),{surveys:r,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,t;let i=null==(e=null!=(t=this.wo)?t:this.Th)?void 0:e.kv.get(i9);return U(i)&&Date.now()-i>3e5}Hh(){return U(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,t){var i;oW({id:e,current_iteration:null!=(i=null==t?void 0:t.iteration)?i:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}
1Lh(e){for(let t of this.Mh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){oV.error("Error in survey callback",e)}}getActiveMatchingSurveys(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!z(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);oV.warn("init was not called")}zh(e){let t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}Uh(e){if(z(this._surveyManager))return{eligible:!1,reason:aT};let t="string"==typeof e?this.zh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(z(this._surveyManager))return{eligible:!1,reason:aT};let t="string"==typeof e?this.zh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(z(this._surveyManager))return oV.warn("init was not called"),{visible:!1,disabledReason:aT};let t=this.Wh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return z(this._surveyManager)?(oV.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:aT})):new Promise(i=>{this.getSurveys(t=>{var s;let r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){let e=this.Wh(r);i({visible:e.eligible,disabledReason:e.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.So.isCapturing())return;if(z(this._surveyManager))return void oV.warn("init was not called");let r="string"==typeof e?this.zh(e):e;if(!(null==r?void 0:r.id))return void oV.warn("Survey not found");if(!oG.includes(r.type))return void oV.warn("Surveys of type ".concat(r.type," cannot be rendered in the app"));let n=null==c?void 0:c.querySelector(t);if(n){if(null==(s=r.appearance)?void 0:s.surveyPopupDelaySeconds){oV.info("Rendering survey ".concat(r.id," with delay of ").concat(r.appearance.surveyPopupDelaySeconds," seconds"));let e=setTimeout(()=>{var t,s;this.Rh.delete(e),!this.Io&&this.So.isCapturing()&&(oV.info("Rendering survey ".concat(r.id," with delay of ").concat(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds," seconds")),null==(s=this._surveyManager)||s.renderSurvey(r,n,i),oV.info("Survey ".concat(r.id," rendered")))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(e)}this._surveyManager.renderSurvey(r,n,i)}else oV.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.So.isCapturing())return;if(z(this._surveyManager))return void oV.warn("init was not called");let s=this.zh(e);if(!s)return void oV.warn("Survey not found");let r=s;if((null==(i=s.appearance)?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(r=t_(t_({},s),{},{appearance:t_(t_({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==n$.Popover&&t.initialResponses&&oV.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){let e=this.Uh(s);if(!e.eligible)return void oV.warn("Survey is not eligible to be displayed: ",e.reason)}t.displayType!==n$.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){z(this._surveyManager)?oV.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null==(e=this._surveyManager)||null==(t=e.handlePageUnload)||t.call(e)}constructor(e,t){this.So=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=e=>{if(this.Io||this.Rr.disableSurveys)return;if(!e.ok)return oV.warn("Remote config unavailable. Not loading surveys.");let t=e.config.surveys;if(z(t))return oV.warn("Flags not loaded yet. Not loading surveys.");this.Ah=W(t)?t:t.length>0,oV.info("flags response received, isSurveysEnabled: ".concat(this.Ah)),this.loadIfEnabled()}}};function aN(e,t,i){if(z(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}var aj=class{init(){var e,t;j(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.tc=null==(t=this._instance)?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null==(e=this.tc)||e.call(this),this.tc=void 0,this.Zh=new oI}register(e){var t,i;if(!j(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e
1=>{var t;this.Vh.add(e),null==(t=e.steps)||t.forEach(e=>{this.Gh.add((null==e?void 0:e.event)||"")})}),null==(i=this._instance)?void 0:i.autocapture)){let e=new Set;this.Vh.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this.Gh.has(e)||this.Gh.has(t.event))&&this.Vh.forEach(e=>{this.ec(t,e)&&this.Zh.emit("actionCaptured",e.name)})}nc(e){this.onAction("actionCaptured",t=>e(t))}ec(e,t){if(null==(null==t?void 0:t.steps))return!1;for(let i of t.steps)if(this.Qh(e,i))return!0;return!1}onAction(e,t){return this.Zh.on(e,t)}Kh(e,t){if(null==t?void 0:t.url){var i;let s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!aN(s,t.url,t.url_matching||"contains"))return!1}return!0}Xh(e,t){return!!this.sc(e,t)&&!!this.rc(e,t)&&!!this.oc(e,t)}sc(e,t){var i;if(!(null==t?void 0:t.href))return!0;let s=this.ac(e);if(s.length>0)return s.some(e=>aN(e.href,t.href,t.href_matching||"exact"));let r=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!r&&aN(function(e){let t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(r),t.href,t.href_matching||"exact")}rc(e,t){var i,s,r,n;if(!(null==t?void 0:t.text))return!0;let o=this.ac(e);if(o.length>0)return o.some(e=>aN(e.text,t.text,t.text_matching||"exact")||aN(e.$el_text,t.text,t.text_matching||"exact"));let a=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!a&&(i=function(e){let t,i=[],s=/(?::|")text="(.*?)"/g;for(;!z(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),s=t.text,r=t.text_matching||"exact",i.some(e=>aN(e,s,r)))}oc(e,t){var i,s;if(!(null==t?void 0:t.selector))return!0;let r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null==r?void 0:r.includes(t.selector))return!0;let n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}ac(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Yh(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||oN(t.properties.reduce((e,t)=>{let i=T(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new oI,this.Qh=(e,t)=>this.Jh(e,t)&&this.Kh(e,t)&&this.Xh(e,t)&&this.Yh(e,t),this.Jh=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}},aq=class{fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,t){return!!e&&oN(e.propertyFilters,null==t?void 0:t.properties)}_c(e,t){let i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null==t?void 0:t.name){let s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}wc(e,t,i){let s=(i===nx.Activation?this.uc:this.hc).get(e),r=[];return this.kc(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r;let n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.bc(n,t)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,t){var i;j(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.xc(e,t),this.Cc(e,t))}Cc(e,t){var i;let s=e.filter(e=>{var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length});if(t&&this.cc.clear(),0===s.length)return void(t&&(null==(i=this.$c)||i.replace([])));this.$c||(this.$c=new aj(this._instance),this.$c.init(),this.$c.nc(e=>this.onAction(e)));let r=[];s.forEach(e=>{var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach(t=>{if(r.push(t),t.name){var i;let s=null!=(i=this.cc.get(t.name))?i:[];s.includes(e.id)||s.push(e.id),this.cc.set(t.name,s)}})}),t?this.$c.replace(r):this.$c.register(r)}Tc(e,t){t.forEach((t,i)=>{var s;let r=null!=(s=e.get(i))?s:[];t.forEach(e=>{r.includes(e)||r.push(e)}),e.set(i,r)})}xc(e,t){var i;let s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),r=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}),n=this._c(e,nx.Activation),o=this._c(e,nx.Cancellation);t?(this.uc=n,this.hc=o):(this.Tc(this.uc,n),this.Tc(this.hc,o)),(0!==s.length||0!==r.length)&&(null!=this.tc||(this.tc=null==(i=this._instance)?void 0:i._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;let r=this.Ic(),n=(null==t||null==(i=t.properties)?void 0:i.$survey_id)||(null==t||null==(s=t.properties)?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){let t=this.Mc(e,n);if("consume"===t)return r.info("event consumed activated item, remov
1ing it",{event:e,itemId:n}),void this.Ec([n]);if("persist"===t)return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.Pc(n),void this.Rc([n])}if(this.hc.has(e)){let i=this.wc(e,t,nx.Cancellation);i.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this.Ec(i.map(e=>e.id)),i.forEach(e=>this.Ac(e.id)))}if(!this.uc.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.uc.get(e)});let o=this.wc(e,t,nx.Activation);this.Fc(o.map(e=>e.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var t,i;if(0===e.length)return;let s=!!(null==(t=this._instance)||null==(i=t.get_session_id)?void 0:i.call(t)),r=[];for(let t of e)s&&this.fc(t)?this.Pc(t)&&this.Oc(t):r.push(t);r.length>0&&(this.lc=[...new Set([...this.lc,...r])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(t=>t!==e);let t=this.Dc();return!t.includes(e)&&(this.Lc([...t,e]),this.Nc(),!0)}Ec(e){let t=new Set(e);this.lc=this.lc.filter(e=>!t.has(e));let i=this.qc(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this.Lc(s),0===s.length&&this.jc()),this.Rc(e)}Bc(){var e;let t=this.gc();if(!t)return{};let i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return i&&"object"==typeof i?i:{}}Oc(e){if(!this.gc())return;let t=this.Bc();this.mc(t_(t_({},t),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;let t=this.Bc(),i={},s=!1;for(let[r,n]of Object.entries(t))e.includes(r)?s=!0:i[r]=n;s&&(N(i)?this.yc():this.mc(i))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;let t=this.Bc()[e];return U(t)?t:void 0}qc(){var e;let t=this.zc();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}Dc(){var e,t,i;let s=this.qc();if(0===s.length)return[];let r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Uc()],n=null==(t=this._instance)||null==(i=t.get_session_id)?void 0:i.call(t);return n&&r===n?s:[]}Nc(){var e,t;let i=null==(e=this._instance)||null==(t=e.get_session_id)?void 0:t.call(e);i&&this.Wc(i)}jc(){this.Vc()}vc(e){var t;let i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Uc()];if(i&&i!==e){let e=this.qc(),t=this.Bc();e.length>0&&(this.Lc([]),e.filter(e=>U(t[e])).forEach(e=>this.Ac(e))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,t,i;null==(e=this.dc)||e.call(this),this.dc=void 0,null==(t=this.tc)||t.call(this),this.tc=void 0,null==(i=this.$c)||i.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}constructor(e){var t,i;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=null==(t=this._instance)||null==(i=t.onSessionId)?void 0:i.call(t,e=>this.vc(e))}},aB=class extends aq{zc(){return i7}Uc(){return se}gc(){return st}mc(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated_timestamps:e})}yc(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister("$surveys_activated_timestamps")}fc(e){var t;let i;this.kc(t=>{i=t.find(t=>t.id===e)});let s=null==i||null==(t=i.appearance)?void 0:t.surveyPopupDelaySeconds;return U(s)&&s>0}Qc(){return nE.SHOWN}kc(e){var t;null==(t=this._instance)||t.getSurveys(e)}Ac(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}Ic(){return oV}Lc(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated:e})}Wc(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated_session:e})}Vc(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister("$surveys_activated_session")}Gc(){return!1}Mc(e,t){var i,s;let r;return this.kc(e=>{r=e.find(e=>e.id===t)}),!r||oA(i=r)&&(null==(s=i.conditions)||null==(s=s.events)?void 0:s.repeatedActivation)||"always"===i.schedule?e===nE.SHOWN?"consume":"ignore":e===nE.SHOWN?"persist":e===nE.DISMISSED||e===nE.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}
1getEventToSurveys(){return this.getEventToItemsMap()}constructor(e){super(e)}},aH=class{initialize(){}get(e){if("string"==typeof e)return this._instance.get_property(e);let t={};for(let i of e){let e=this._instance.get_property(i);j(e)||(t[i]=e)}return t}set(e,t){this._instance.register("string"==typeof e?{[e]:t}:e)}remove(e){"string"!=typeof e?e.forEach(e=>this._instance.unregister(e)):this._instance.unregister(e)}constructor(e){this._instance=e}},az=class{get(){let e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){let e=null==b?void 0:b.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?e=>t(this._instance,e):void 0,loadExternalDependency:i?e=>i(this._instance,"surveys",e):void 0}}createEventReceiver(){return new aB(this._instance)}constructor(e){this._instance=e}};let aU=(null==l?void 0:l.location)?r2(l.location.hash,"__posthog")||r2(location.hash,"state"):null,aV="_postHogToolbarParams",aW=iw("[Toolbar]"),aG=iw("[FeatureFlags]");var aY=class{update(e,t){var i,s,r,n,o,a,l,u;this.Kc={bootstrap:{featureFlags:null!=(i=null==(s=e.bootstrap)?void 0:s.featureFlags)?i:void 0,featureFlagPayloads:null!=(r=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)?r:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!=(o=e.remote_config_refresh_interval_ms)?o:3e5,idleRefreshBackoff:j(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!=(a=e.feature_flag_request_max_retries)?a:1),compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!=(l=null!=(u=e.evaluation_contexts)?u:e.evaluation_environments)?l:[],flagKeys:T(e.flag_keys)?e.flag_keys:void 0},!e.evaluation_environments||e.evaluation_contexts||this.Jc||(aG.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),j(e.flag_keys)||T(e.flag_keys)||aG.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}constructor(e,t=!1){this.Jc=!1,this.update(e,t)}};let aX=iw("[FeatureFlags]"),aJ=iw("[FeatureFlags]",{debugEnabled:!0}),aK="\" failed. Feature flags didn't load in time.",aZ=[502,504],aQ=["click","keydown","wheel","touchstart","pointerdown"],a0="connection_error",a1=e=>{let t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},a2=e=>{let t={};for(let[i,s]of sC(e||{}))s&&(t[i]=s);return t},a3=e=>K(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),a5=iw("[Error tracking]"),a4="webkit-masked-url:",a6=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],a8=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",a4],a9=["__firefox__","__gCrWeb"],a7="Refusing to render web experiment since the viewer is a likely bot",le={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>oT(t,e),not_regex:(e,t)=>!oT(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},lt=iw("[Conversations]"),li="Conversations not available yet.";function ls(e,t){var i,s,r,n,o,a,l;let u=null!=(i=null==e?void 0:e.flushIntervalMs)?i:3e3,c=null!=(s=null==e?void 0:e.maxBufferSize)?s:100,d=(null==t?void 0:t.consoleCapture)?void 0:null!=(r=null==e?void 0:e.maxLogsPerInterval)?r:1e3,p=j(d)?Math.max(c,2048):Math.max(c,d),f=t_(t_({},function(){let e="",t="";try{let i=null==h?void 0:h.userAgent;i&&([e,t]=e8(i))}catch(e){}var i=t;let s=function(e){if(e)return({}).hasOwnProperty.call(io,e)?io[e]:e}(e);return t_(t_({},s?{"os.name":s}:{}),i?{"os.version":i}:{})}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!=(n=null!=(o=null==f?void 0:f["service.name"])?o:null==e?void 0:e.serviceName)?n:null==t?void 0:t.serviceNameDefault,serviceVersion:null!=(a=null==f?void 0:f["service.version"])?a:null==e?void 0:e.serviceVersion,environment:null!=(l=null==f?void 0:f["deployment.environment"])?l:null==e?void 0:e.environment,resourceAttributes:f,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}
1let lr=["debug","log","warn","error","info"],ln=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},lo="console",la="__posthogHandledLogsRequestError",ll=(e,t)=>{let i=e instanceof Error?e:Error(t);return i[la]=!0,i},lu=e=>!!e&&"object"==typeof e&&!0===e[la],lh=iw("[NetworkMetrics]"),lc=()=>{var e;return(null==l||null==(e=l.performance)?void 0:e.now)?l.performance.now():Date.now()},ld={"http:":80,"https:":443},lp=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),lf=(e,t)=>{var i;let s=String(t);return{method:String(e).toUpperCase(),url:(null==(i=rQ(s))?void 0:i.href)||s}},lg=function(e,t,i,s,r,n){let o=arguments.length>6&&void 0!==arguments[6]&&arguments[6];try{var a,l;let u=r();if(!u)return;let h=i||void 0,c=lc()-s,d=rQ(t.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;let p={url:(null==d?void 0:d.href)||t.url,method:t.method},f=L(u.name)?u.name(p):q(u.name)?u.name:"http.client.request.duration";if(!f)return;let g=o&&!h?void 0:h?400>h?void 0:String(h):(null==n?void 0:n.name)||"_OTHER",v=t_(t_(t_(t_(t_({},(e=>{let t=lp.has(e)?e:"_OTHER";return t_({"http.request.method":t},"_OTHER"===t&&e!==t?{"http.request.method_original":e}:{})})(p.method)),d?{"server.address":d.hostname.startsWith("[")&&d.hostname.endsWith("]")?d.hostname.slice(1,-1):d.hostname,"server.port":Number(d.port)||ld[d.protocol],"url.scheme":d.protocol.slice(0,-1),"url.template":d.pathname.split("/").map(e=>/^\d+$/.test(e)||e.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(e)?":id":e).join("/")}:{}),h?{"http.response.status_code":h}:{}),g?{"error.type":g}:{}),null==(a=u.attributes)?void 0:a.call(u,p,{status:h,durationMs:c}));null==(l=e.metrics)||l.histogram(f,c,{unit:"ms",attributes:v})}catch(e){lh.error("Failed to record network metric",e)}},lv=()=>{},l_={featureFlags:class{updateConfig(e,t){var i;null==(i=this.wd)||i.update(e,t),this.wo&&this.kd()}setup(e){return this.Fh=e,this.$=e.logger.createLogger("[FeatureFlags]"),aA(e.kv.initialize(),()=>{this.Fh===e&&(this.Fh=void 0,this.wo=e,this.Sd(e))})}Sd(e){var t;if(this.wo===e)return l&&sD(l,"online",this.an),this.kd(),this.xd=e.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){let e=this.Rr.refreshIntervalMs,t=!this.Rr.remoteRequestsDisabled&&c&&!j(e)&&e>0?e:void 0;this.Rr.idleRefreshBackoff||(this.gd=t),t!==this.pd&&(this.Ed(),j(t)||(this.pd=t,this.gd=t,this.yd(),(null==c?void 0:c.addEventListener)&&(sD(c,sk,this.ln),sI(aQ,e=>{sD(c,e,this.bd,{capture:!0})}))))}yd(){j(this.pd)||(j(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var e;j(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,null==c||null==(e=c.removeEventListener)||e.call(c,"visibilitychange",this.ln),sI(aQ,e=>{var t;null==c||null==(t=c.removeEventListener)||t.call(c,e,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var e,t;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),null==(e=this.xd)||e.dispose(),this.xd=void 0,null==(t=this.$d)||t.call(this),this.$d=void 0,this.ed=[],null==l||l.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(e){var t;return this.Od&&e in this.Od?this.Od[e]:null==(t=this.wo)?void 0:t.kv.get(e)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var e;return!j(null==(e=this.wo)?void 0:e.kv.get("$enabled_feature_flags"))&&this.Td()}At(e){this.Ld(()=>{var t;return null==(t=this.wo)?void 0:t.kv.set(e)})}Nd(e,t,i){var s;if(!(null==(s=this._instance)?void 0:s.persistence)||!e.$enabled_feature_flags)return;let r=this.Fd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(e=>{let[,t]=e;return!(null==t?void 0:t.failed)}).map(e=>{let[t]=e;return t}):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:i&&!T(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),h=this.Fd("$feature_flag_payloads")||{},c=e.$feature_flag_payloads||{},d=l||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),p=!l&&!i,f=!!p||u,g={[iJ]:f,[iX]:f,[iQ]:!!p||d};for(let t of(e.$feature_flag_details&&(g[iZ]=f),[i0,so,i1]))j(e[t])||(g[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(e){this.Ld(()=>{var t;return null==(t=this.wo)?void 0:t.kv.remove(e)})}Ld(e){try{e()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}Id(){let e={};for(let t of[iJ,iQ,i0,i2]){let i=this.Fd(t);j(i)||(e[t]=i)}this.Yc=e;let t=t_({},e),i=this.Fd(iX);
1if(i)for(let[e,s]of Object.entries(i))t["$feature/".concat(e)]=s;this.td=t}Cd(){let e=this.Rr.cacheTtlMs;if(!e||0>=e)return!1;let t=this.Fd(so);return"number"!=typeof t||Date.now()-t>e}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){let e=this.Rr.evaluationContexts;return(null==e?void 0:e.length)?e.filter(e=>{let t=e&&"string"==typeof e&&e.trim().length>0;return t||this.$.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Bd(){let e=this.Rr.flagKeys;if(!j(e))return e.filter(e=>{let t=e&&"string"==typeof e&&e.trim().length>0;return t||this.$.error("Invalid flag key found:",e,"Expected non-empty string"),t})}initialize(){var e,t,i,s;let r=this.Rr,n=null!=(e=null==(t=r.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(n).length){let e=null!=(i=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)?i:{},t=Object.keys(n).filter(e=>!j(n[e])).reduce((e,t)=>(e[t]=n[t],e),{}),o=Object.keys(e).filter(e=>t[e]).reduce((t,i)=>(t[i]=e[i],t),{});return this.Hd({featureFlags:t,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(e,t,i){var s,r;let n=(null==i?void 0:i.merge)&&null!=(s=this.Fd("$enabled_feature_flags"))?s:{},o=(null==i?void 0:i.merge)&&null!=(r=this.Fd("$feature_flag_payloads"))?r:{},a=t_(t_({},n),e),l=t_(t_({},o),t),u={};for(let[e,t]of Object.entries(a))u[e]={key:e,enabled:tZ(t),variant:tQ(t),reason:void 0,metadata:j(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this.Hd({flags:u})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.Fd(iZ),t=this.Fd(i2),i=this.Fd(i3);if(!i&&!t)return e||{};let s=sO({},e||{});for(let e of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var r,n;let o=s[e],a=null==t?void 0:t[e],l=j(a)?null!=(r=null==o?void 0:o.enabled)&&r:!!a,u=j(a)?null==o?void 0:o.variant:"string"==typeof a?a:void 0,h=null==i?void 0:i[e],c=t_(t_({},o),{},{enabled:l,variant:l?null!=u?u:null==o?void 0:o.variant:void 0});l!==(null==o?void 0:o.enabled)&&(c.original_enabled=null==o?void 0:o.enabled),u!==(null==o?void 0:o.variant)&&(c.original_variant=null==o?void 0:o.variant),h&&(c.metadata=t_(t_({},null==o?void 0:o.metadata),{},{payload:h,original_payload:null==o||null==(n=o.metadata)?void 0:n.payload})),s[e]=c}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Xc=!0),s}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{let s=e[i];return{key:i,enabled:tZ(s),variant:tQ(s),payload:tK(t[i])}})}getFlagVariants(){let e=this.Fd(iX),t=this.Fd(i2);if(!t)return e||{};let i=sO({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Xc=!0),i}getFlagPayloads(){let e=this.Fd(iQ),t=this.Fd(i3);if(!t)return e||{};let i=sO({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Xc=!0),i}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(e=>{try{e()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(e){return this.ed.push(e),()=>{this.ed=this.ed.filter(t=>t!==e)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.od=e}resetFlagCallReported(){this.Lt(ss)}Ud(e){this.Ad();let t=this.wo;if(!t||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);let i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:t_(t_(t_({},t.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Fd(i4),timezone:na()};j(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this.Rr.featureFlagsDisabled)&&(i.disable_flags=!0);let s=this.jd();s.length&&(i.evaluation_contexts=s);let r=this.Bd();j(r)||(i.flag_keys=r);let n=this.Rr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;let l=()=>{this.ad&&(this.ad=!1,this.Ud())},u=e=>{var t,s;let r=null!=(t=e.json)?t:{},o=200!==e.statusCode;if(this.sd=!1,a!==this.rd)return void l();if(this.Wd(e.statusCode),o||this.ad||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.ad)return;this.ld=!o;let u=[];e.error?u.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?a0:"unknown_error"):200!==e.statusCode&&u.push("api_error_".concat(e.statusCode)),r.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");let h=!!(null==(s=r.quotaLimited)?void 0:s.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[sn]:u}),h?this.$.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.Hd(r,o,{partialResponse:n}),l()},h=e=>{this.sd=!1,a===this.rd&&(this.At({[sn]:[a0]}),this.$.error("Feature flag request failed",e),this.Dd()&&this.Md(!0)),l()},c=this.Rr.requestMaxRetries,d=()=>c>0&&a===this.rd,p=()=>
1{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void l();try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(e=>{if((aZ.includes(e.statusCode)||0===e.statusCode&&e.error instanceof Error&&"AbortError"===e.error.name)&&d())return c--,void setTimeout(p,500);u(e)}).catch(h)}catch(e){h(e)}};p()}vd(){return r3(this.hd,3)}Wd(e){this.hd=r5(e,this.hd,3,()=>this.$.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(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+aK);if(this.qd())return;let s=this.getFeatureFlagResult(e,i);return null!=(t=null==s?void 0:s.variant)?t:null==s?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){let t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e){var t,i,s,r,n,o,a,l,u,h,c,d,p,f;let g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(g.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+aK);if(this.qd())return;let v=this.getFlagVariants(),_=e in v,m=v[e],y=this.getFlagPayloads()[e],b=String(m),w=this.Fd("$feature_flag_request_id")||void 0,x=this.Fd("$feature_flag_evaluated_at")||void 0,k,E=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){let e=null==(t=this.wo)?void 0:t.session.sessionId,i=this.Fd(sr);e&&e!==i&&(E={},k=e)}if(!g.send_event&&"send_event"in g)k&&this.At({[ss]:E,[sr]:k});else if(e in E&&E[e].includes(b))k&&this.At({[ss]:E,[sr]:k});else{T(E[e])?E[e].push(b):E[e]=[b],this.At(t_({[ss]:E},k?{[sr]:k}:{}));let t=this.getFeatureFlagDetails(e),g=[...null!=(i=this.Fd("$feature_flag_errors"))?i:[]];j(m)&&g.push("flag_missing");let v={$feature_flag:e,$feature_flag_response:m,$feature_flag_payload:null!=y?y:null,$feature_flag_request_id:w,$feature_flag_evaluated_at:x,$feature_flag_bootstrapped_response:null!=(s=null==(r=this.Rr.bootstrap)||null==(r=r.featureFlags)?void 0:r[e])?s:null,$feature_flag_bootstrapped_payload:null!=(n=null==(o=this.Rr.bootstrap)||null==(o=o.featureFlagPayloads)?void 0:o[e])?n:null,$used_bootstrap_value:!this.ld};j(null==t||null==(a=t.metadata)?void 0:a.has_experiment)||(v.$feature_flag_has_experiment=t.metadata.has_experiment),j(null==t||null==(l=t.metadata)?void 0:l.version)||(v.$feature_flag_version=t.metadata.version);let _=null!=(u=null==t||null==(h=t.reason)?void 0:h.description)?u:null==t||null==(c=t.reason)?void 0:c.code;_&&(v.$feature_flag_reason=_),(null==t||null==(d=t.metadata)?void 0:d.id)&&(v.$feature_flag_id=t.metadata.id),j(null==t?void 0:t.original_variant)&&j(null==t?void 0:t.original_enabled)||(v.$feature_flag_original_response=j(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null==(p=t.metadata)?void 0:p.original_payload)&&(v.$feature_flag_original_payload=null==t||null==(f=t.metadata)?void 0:f.original_payload),g.length&&(v.$feature_flag_error=g.join(",")),this.Vd(v)}return _?{key:e,enabled:!!m,variant:"string"==typeof m?m:void 0,payload:tK(y)}:void 0}Vd(e){try{var t;null==(t=this.wo)||t.capture("$feature_flag_called",e)}catch(e){this.$.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this.Gd(e,t)}Gd(e,t){var i=this;return er(function*(){let s,r=i.wo;if(!r)return;let n={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},o=i.jd();o.length&&(n.evaluation_contexts=o);let a=i.Bd();j(a)||(n.flag_keys=a);try{var l;let t=null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i.Rr.compression,sentAt:"body",timeoutMs:i.Rr.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;s=(null==t?void 0:t[e])||void 0}catch(e){return void i.$.error("Remote config feature flag request failed",e)}try{t(s)}catch(e){i.$.error("Remote config feature flag callback failed",e)}})()}isFeatureEnabled(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.fresh&&!this.ld)return t.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+aK),t.defaultValue;let i=this.getFeatureFlag(e,t);return j(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.Hd(e,t,i)}Hd(e,t,i){if(!this.wo)return;this.nd=!0;let s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4?arguments[4]:void 0,n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:aX,o=((e,t)=>{let i=e.flags;if(i){let t=Object.fromEntries(Object.keys(i).map(e=>{var t;return[e,null!=(t=i[e].variant)?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!j(null==(t=i[e].metadata)?void 0:t.payload)}).map(e=>{var t;return[e,null==(t=i[e].metadata)?void 0:t.payload]}));return t_(t_({},e),{},{featureFlags:t,featureFlagPayloads:s})}return e.featureFlags&&t.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e,n),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(!l)return;let h=e.requestId,c=e.evaluatedAt;if(T(l)){n.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");let e={};if(l)for(let t=0;l.length>t;t++)e[l[t]]=!0;return{[iJ]:l,[iX]:e,[i1]:!1}}let d=l,p=u,f=a;if(null==r?void 0:r.partialResponse){let e=Object.keys(d),r=p||{};d=t_(t_({},t),d),p=t_(t_({}
1,i),r),e.forEach(e=>{e in r||null==p||delete p[e]}),f=t_(t_({},s),f)}else if(e.errorsWhileComputingFlags)if(a){let e=new Set(Object.keys(a).filter(e=>{var t;return!(null==(t=a[e])?void 0:t.failed)}));d=t_(t_({},t),Object.fromEntries(Object.entries(d).filter(t=>{let[i]=t;return e.has(i)})));let r=Object.fromEntries(Object.entries(p||{}).filter(t=>{let[i]=t;return e.has(i)}));p=t_(t_({},i),r),e.forEach(e=>{e in r||null==p||delete p[e]}),f=t_(t_({},s),Object.fromEntries(Object.entries(f||{}).filter(t=>{let[i]=t;return e.has(i)})))}else d=t_(t_({},t),d),p=t_(t_({},i),p),f=t_(t_({},s),f);return t_(t_({[iJ]:Object.keys(a2(d)),[iX]:d||{},[iQ]:p||{},[iZ]:f||{},[i1]:!0===e.minimalFlagCalledEvents},h?{[i0]:h}:{}),c?{[so]:c}:{})}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(s)if(!1===(null==i?void 0:i.persist)){let e=!j(this.wo.kv.get(iX));this.Od=s,e||this.At(s)}else this.Td(),this.Nd(s,e,!!(null==i?void 0:i.partialResponse)),this.At(s);else t&&this.Dd();t||(this.ud=!1),this.Md(t)}override(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Zd(e)}Zd(e){if(this.wo){if(!1===e)return this.Lt([i2,i3]),this.Md(),void aJ.info("All overrides cleared");if(T(e))return this.At({[i2]:a1(e)}),this.Md(),void aJ.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;this.Xc=!!(null!=(t=e.suppressWarning)&&t);let i={},s=e.flags,r=e.payloads;return s&&(i[i2]=T(s)?a1(s):s),r&&(i[i3]=r),Object.keys(i).length&&this.At(i),!1===s&&!1===r?this.Lt([i2,i3]):!1===s?this.Lt(i2):!1===r&&this.Lt(i3),this.Md(),!1===s?aJ.info("Flag overrides cleared"):s&&aJ.info("Flag overrides set",{flags:s}),void(!1===r?aJ.info("Payload overrides cleared"):r&&aJ.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this.At({[i2]:e}),this.Md(),void aJ.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.nd){let{flags:t,flagVariants:i}=this.Qd();try{e(t,i)}catch(e){this.$.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r;let n=(this.Fd("$early_access_features")||[]).find(t=>t.flagKey===e),o={["$feature_enrollment/".concat(e)]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),i&&(a.$feature_enrollment_stage=i);let l=t_(t_({},this.getFlagVariants()),{},{[e]:t});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(o)}),this.At({[iJ]:Object.keys(a2(l)),[iX]:l,[i5]:t_(t_({},this.Fd("$stored_person_properties")||{}),o)}),this.Md();try{null==(r=this.wo)||r.capture("$feature_enrollment_update",a)}catch(e){this.$.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0,s=this.Fd(iK);!s||t?this.Jd(e,i):e(s)}Jd(e,t){var i=this;return er(function*(){let s,r=i.wo;if(!r)return;let n=t?"&".concat(t.map(e=>"stage=".concat(e)).join("&")):"";try{let e=yield r.sendRequest("/api/early_access_features/?token=".concat(r.projectToken).concat(n),{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;s=e.json.earlyAccessFeatures,i.At({[iK]:s})}catch(e){return void i.$.error("Early access feature request failed",e)}try{e(s)}catch(e){i.$.error("Early access feature callback failed",e)}})()}Qd(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}Md(e){this.Id();let{flags:t,flagVariants:i}=this.Qd();
1this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this.$.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];this.Kd(e,t)}Kd(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=this.Fd("$stored_person_properties")||{},s=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(let e in r)({}).hasOwnProperty.call(r,e)&&(e in i||(n[e]=r[e]));this.At({[i5]:t_(t_(t_({},i),n),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=t_({},this.Fd("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this.At({[i5]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.Lt(i5),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=this.Fd("$stored_group_properties")||{},s=t_({},i);for(let t of Object.keys(e))s[t]=t_(t_({},i[t]),e[t]);this.At({[i4]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Fd("$stored_group_properties")||{};this.At({[i4]:t_(t_({},t),{},{[e]:{}})})}else this.Lt(i4)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}constructor(e){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=aX,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{let e=this.vd();this.hd=0,e&&this.reloadFeatureFlags()},this.fd=()=>{var e,t;let i=this.pd,s=null!=(e=this.gd)?e:i;j(i)||j(s)||this.Rr.remoteRequestsDisabled||!c||"hidden"===c.visibilityState||Date.now()-(null!=(t=this.md)?t:0)<s||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{"visible"===(null==c?void 0:c.visibilityState)&&this._d()},"get"in e?this.So=e:(this._instance=e,this.wd=new aY(e.config,e.nl()),this.So=this.wd)}}},lm=t_({productTours:class{get Ml(){return this._instance.persistence}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if("productTours"in t){var i,s;if(this.Ml&&this.Ml.register({[iz]:!!t.productTours}),!aF(this._instance))return!this.df&&z(null==(i=this.Ml)?void 0:i.props.ph_product_tours)||aI.info("product tours disabled; stopping and clearing cached tours"),null==(s=this.df)||s.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&aF(this._instance)&&this.zo(()=>this.ff())}zo(e){var t,i,s;(null==(t=b.__PosthogExtensions__)?void 0:t.generateProductTours)?e():null==(i=b.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"product-tours",t=>{t?aI.error("Could not load product tours script",t):e()})}ff(){var e;!this.df&&(null==(e=b.__PosthogExtensions__)?void 0:e.generateProductTours)&&(this.df=b.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(T(this.vf)&&!t)return void e(this.vf,{isLoaded:!0});let i=this.Ml;if(i){let s=i.props[si];if(T(s)&&!t)return this.vf=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token=".concat(this._instance.config.token)),method:"GET",timestampMode:"query",callback:t=>{if(!aF(this._instance))return void e([],{isLoaded:!0});let s=t.statusCode;if(200!==s||!t.json){let i="Product Tours API could not be loaded, status: ".concat(s);return 0===s?t.error||aI.warn(i):aI.error(i),void e([],{isLoaded:!1,error:i})}let r=T(t.json.product_tours)?t.json.product_tours:[];this.vf=r,i&&i.register({[si]:r}),e(r,{isLoaded:!0})}})}getActiveProductTours(e){z(this.df)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.df.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.df)||t.showTourById(e)}previewTour(e){this.df?this.df.previewTour(e):this.zo(()=>{var t;this.ff(),null==(t=this.df)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.df)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.df)||e.nextStep()}previousStep(){var e;null==(e=this.df)||e.previousStep()}clearCache(){var e;this.vf=null,null==(e=this.Ml)||e.unregister("ph_product_tours")}resetTour(e){var t;null==(t=this.df)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.df)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.df)||t.cancelPendingTour(e)}constructor(e){this.df=null,this.vf=null,this._instance=e}}},l_),ly=t_({surveys:class extends aD{qh(e,t){let i=t.query?ol(e,t.query):e;return new Promise(e=>{var s;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor(null!=(s=t.target)?s:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}constructor(e){super(new az(e),{get projectToken(){return e.config.token},kv:new aH(e)}),this._instance=e}}},l_),lb=t_({experiments:class e{get Rr(){return this._instance.config}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Of(a7);else if(!this.Rr.disable_web_experiments){if(z(this.Df))return this.Df=new Map,this.loadIfEnabled(),void this.previewWebExperiment();
1e.Of("applying feature flags",t),t.forEach(e=>{var t,i;if(this.Df&&(null==(t=this.Df)?void 0:t.has(e))){let t=this._instance.getFeatureFlag(e),s=null==(i=this.Df)?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this.Lf(s.name,t,s.variants[t].transforms)}})}}previewWebExperiment(){let t=e.getWindowLocation();if(null==t?void 0:t.search){let i=r0(null==t?void 0:t.search,"__experiment_id"),s=r0(null==t?void 0:t.search,"__experiment_variant");i&&s&&(e.Of("previewing web experiments ".concat(i," && ").concat(s)),this.getWebExperiments(e=>{this.qf(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Rr.disable_web_experiments&&!i)return e([]);let s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.Rr.token)),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}qf(t,i,s){let r=s.filter(e=>e.id===t);r&&r.length>0&&(e.Of("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(i,"]")),this.Lf(r[0].name,i,r[0].variants[i].transforms))}static Nf(t,i){return!z(t.conditions)&&e.jf(t,i)&&e.Bf(t)}static jf(t,i){var s,r,n,o;if(z(t.conditions)||z(null==(s=t.conditions)?void 0:s.url))return!0;let a=e.getWindowLocation();if(a){let e=ri(i,a.href);return!(null==(r=t.conditions)?void 0:r.url)||le[null!=(n=null==(o=t.conditions)?void 0:o.urlMatchType)?n:"icontains"](t.conditions.url,e)}return!1}
1static getWindowLocation(){return null==l?void 0:l.location}static Bf(e){var t,i,s,r,n,o,a,l,u;if(z(e.conditions)||z(null==(t=e.conditions)?void 0:t.utm))return!0;let h=r7();if(h.utm_source){let t=!(null==(i=e.conditions)||null==(i=i.utm)?void 0:i.utm_campaign)||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==h.utm_campaign,c=!(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_source)||(null==(n=e.conditions)||null==(n=n.utm)?void 0:n.utm_source)==h.utm_source,d=!(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_medium)||(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_medium)==h.utm_medium,p=!(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_term)||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==h.utm_term;return t&&d&&p&&c}return!1}static Of(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];ib.info("[WebExperiments] ".concat(e),i)}Lf(t,i,s){this._is_bot()?e.Of(a7):"control"!==i?s.forEach(s=>{if(s.selector){var r;e.Of("applying transform of variant ".concat(i," for experiment ").concat(t," "),s);let n=null==(r=document)?void 0:r.querySelectorAll(s.selector);null==n||n.forEach(e=>{s.html&&(e.innerHTML=s.html),s.css&&e.setAttribute("style",s.css)})}}):e.Of("Control variants leave the page unmodified.")}_is_bot(){return h&&this._instance?oC(h,this.Rr.custom_blocked_useragents):void 0}constructor(t){var i=this;this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i.getWebExperiments(t=>{e.Of("retrieved web experiments from the server"),i.Df=new Map,t.forEach(t=>{if(t.feature_flag_key){var s;i.Df&&(e.Of("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(s=i.Df)||s.set(t.feature_flag_key,t));let r=i._instance.getFeatureFlag(t.feature_flag_key);q(r)&&t.variants[r]&&i.Lf(t.name,r,t.variants[r].transforms)}else if(t.variants)for(let s in t.variants){let r=t.variants[s];e.Nf(r,i._instance)&&i.Lf(t.name,s,r.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}}},l_);al.__defaultExtensionClasses=t_({},t_(t_(t_(t_(t_(t_(t_(t_(t_(t_(t_(t_(t_({},l_),{sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var e;return!!(null==(e=this.Xd)?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this.Yd||"missing_config"===this.Yd?this.Yd:null!=(e=null==(t=this.Xd)?void 0:t.status)?e:this.Yd}initialize(){this.startIfEnabledOrStop()}dispose(){var e;let{discardBufferedEvents:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.ev=!0,null==c||null==(e=c.removeEventListener)||e.call(c,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var e;let t=!!(null==(e=this._instance.get_property("$session_recording_remote_config"))?void 0:e.enabled),i=!this.Rr.disable_session_recording,s=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return l&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.ev||this.nv&&(null==(t=this.Xd)?void 0:t.isStarted))return;let i=!j(Object.assign)&&!j(Array.from);this.nv&&i?(this.sv(e),a$.info("starting")):(this.Yd=aE,this.stopRecording())}sv(e){var t,i,s,r;if(this.nv)if("awaiting_config"!==this.Yd&&"missing_config"!==this.Yd&&(this.Yd=aS),(null==b||null==(t=b.__PosthogExtensions__)||null==(t=t.rrweb)?void 0:t.record)&&(null==(i=b.__PosthogExtensions__)?void 0:i.initSessionRecording))this.rv(e);else{let t=this._instance.sessionManager;null==(s=b.__PosthogExtensions__)||null==(r=s.loadExternalDependency)||r.call(s,this._instance,this.ov,i=>{if(!this.ev&&this.nv&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),a$.error("could not load recorder",i)):void this.rv(e);this.Yd="disabled"})}}stopRecording(){var e,t;null==(e=this.tv)||e.call(this),this.tv=void 0,null==(t=this.Xd)||t.stop()}iv(){var e,t;let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null==(e=this.tv)||e.call(this),this.tv=void 0,null==(t=this.Xd)||t.discard({discardProducerEvents:i})}av(){var e,t;null==(e=this.Ml)||e.unregister("$session_is_sampled"),null==(t=this.Ml)||t.unregister("$replay_sample_rate")}lv(e,t){if(z(e))return null;let i=U(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(a$.warn("".concat(t," must be between 0 and 1. Ignoring invalid value:"),e),null):i}uv(e){if(this.Ml){var t,i;let s=this.Ml,r=()=>{var t;let i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.lv(null==(t=this.Rr.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.lv(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;z(o)&&this.av();let a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[iW]:t_(t_({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:t_({capturePerformance:e.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:j(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})})};r(),null==(t=this.tv)||t.call(this),this.tv=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.uv(t),void this.iv()):(this.uv(t),void this.startIfEnabledOrStop()):("awaiting_config"===this.Yd&&(this.Yd="missing_config",this._instance.register_for_session({[sm]:!0}),a$.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";(null==(t=this.Xd)?void 0:t.log)?this.Xd.log(e,i):a$.warn("log called before recorder was ready")}get ov(){var e,t;let i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(iW);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}hv(){let e,t=this._instance.get_property(iW);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return a$.warn("persisted remote config for session recording is invali
1d and will be ignored",e),!1}return!z(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(e){var t,i,s,r;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(null==(t=b.__PosthogExtensions__)?void 0:t.initSessionRecording))return a$.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[s_]:!0});if(this.Xd||(this.Xd=null==(r=b.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv()){if("missing_config"===this.Yd||"awaiting_config"===this.Yd)return;return this.Yd="awaiting_config",a$.info("persisted remote config is stale, requesting fresh config before starting"),void new nM(this._instance).load()}this.Yd=aS,null==(i=(s=this.Xd).setDocumentWasEverVisible)||i.call(s,this.Xe),this.Xd.start(e)}else this.Yd=aE}onRRwebEmit(e){var t,i;null==(t=this.Xd)||null==(i=t.onRRwebEmit)||i.call(t,e)}overrideLinkedFlag(){var e,t;this.Xd||null==(t=this.Ml)||t.register({$replay_override_linked_flag:!0}),null==(e=this.Xd)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Xd||null==(t=this.Ml)||t.register({$replay_override_sampling:!0}),null==(e=this.Xd)||e.overrideSampling()}overrideTrigger(e){var t,i;this.Xd||null==(i=this.Ml)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.Xd)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Xd)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(null==(i=this.Xd)?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null==(e=this.Xd)||null==(t=e.flushBeforeIdentityReset)||t.call(e)}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=aE,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,t;if(!(null==c?void 0:c.visibilityState)||"visible"===c.visibilityState)return!0;let i=null==l||null==(e=l.performance)||null==(t=e.getEntriesByType)?void 0:t.call(e,"visibility-state");return!(null==i?void 0:i.length)||i.some(e=>"visible"===e.name)})(),this.ln=()=>{var e,t;"visible"===(null==c?void 0:c.visibilityState)&&(this.Xe=!0,null==(e=this.Xd)||null==(t=e.setDocumentWasEverVisible)||t.call(e,!0))},!this._instance.sessionManager)throw a$.error("started without valid sessionManager"),Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Rr.cookieless_mode)throw Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==c?void 0:c.addEventListener)&&sD(c,"visibilitychange",this.ln)}}}),{autocapture:class extends ap{constructor(e){super(new af(e)),this.instance=e}},historyAutocapture:class{initialize(){this.startIfEnabled()}get isEnabled(){let e=this.fv();return!!(e.path||e.search||this.pv(e))}startIfEnabled(){this.isEnabled&&(ib.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,ib.info("History API monitoring stopped")}monitorHistoryChanges(){l&&l.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(e){var t;if(!l||(null==(t=l.history[e])?void 0:t.__posthog_wrapped__))return;let i=this;am(l.history,e,t=>function(s,r,n){t.call(this,s,r,n),i.wv(e)})}vv(){let e=null==l?void 0:l.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}fv(){let e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:D(e)?e:{}}pv(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.fv();return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Sv(e){let t=this.fv(),i=this.dv;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.pv(t)&&e.hash!==i.hash))}wv(e){try{let t=this.vv();if(!t)return;this.Sv(t)&&this._instance.capture(sS,{navigation_type:e}),this.dv=t}catch(t){ib.error("Error capturing ".concat(e," pageview"),t)}}bv(){if(this.gv)return;let e=()=>{this.wv("popstate")};sD(l,"popstate",e),this.gv=()=>{l&&l.removeEventListener("popstate",e)}}_v(){if(this.mv)return;let e=()=>{this.wv("hashchange")};
1sD(l,"hashchange",e),this.mv=()=>{l&&l.removeEventListener("hashchange",e)}}constructor(e){this._instance=e,this.dv=this.vv()}},heatmaps:class{get Rr(){return this.instance.config}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return D(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return z(this.Rr.capture_heatmaps)?z(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:!1!==this.Rr.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.xo||(aP.info("starting..."),this.$v(),this.ln());else{var e;clearInterval(null!=(e=this.Cv)?e:void 0),this.Tv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("heatmaps"in t))return;let i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[iD]:i}),this.xv=i,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}Iv(e){aR(e.originalEvent)&&this.Tr(e.originalEvent,"deadclick")}ln(){this.Cv&&clearInterval(this.Cv),this.Cv="visible"===(null==c?void 0:c.visibilityState)?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){l&&c&&(this.Mv=this.bl.bind(this),sD(l,sE,this.Mv),this.Ev=e=>this.Tr(e||(null==l?void 0:l.event)),sD(c,"click",this.Ev,{capture:!0}),this.Pv=e=>this.Rv(e||(null==l?void 0:l.event)),sD(c,"mousemove",this.Pv,{capture:!0}),this.Av=new rB(this.instance,rj,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),sD(c,sk,this.Fv),this.xo=!0)}Tv(){var e;l&&c&&(this.Mv&&l.removeEventListener(sE,this.Mv),this.Ev&&c.removeEventListener("click",this.Ev,{capture:!0}),this.Pv&&c.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Fv&&c.removeEventListener(sk,this.Fv),clearTimeout(this.Ov),null==(e=this.Av)||e.stop(),this.xo=!1)}Dv(e,t){let i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){let s=e;for(;s&&rr(s)&&!rn(s,"body");){let e;if(s===i)break;try{var r,n,o;e=null==(r=null!=(n=null==(o=s.ownerDocument)?void 0:o.defaultView)?n:l)?void 0:r.getComputedStyle(s).position}catch(e){break}if(R(t,e))return!0;s=r_(s)}return!1}(rp(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Tr(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(rs(e.target)||!aR(e))return;let s=this.Dv(e,i);(null==(t=this.rageclicks)?void 0:t.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&rE(rp(e),this.instance.config.rageclick)&&this.Zs(t_(t_({},s),{},{type:"rageclick"})),this.Zs(s)}Rv(e){!rs(e.target)&&aR(e)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(e,"mousemove"))},500))}Zs(e){if(!l)return;let t=this.Rr.disable_capture_url_hashes?th(l.location.href):l.location.href,i=this.Rr.custom_personal_data_properties,s=r1(t,this.Rr.mask_personal_data_properties?[...r4,...i||[]]:[],r8);this.Rt=this.Rt||{},this.Rt[s]||(this.Rt[s]=[]),this.Rt[s].push(e)}bl(){this.Rt&&!N(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}constructor(e){var t;this.xv=!1,this.xo=!1,this.Cv=null,this.instance=e,this.xv=!!(null==(t=this.instance.persistence)?void 0:t.props[iD]),this.rageclicks=new au(e.config.rageclick)}},deadClicksAutocapture:rB,webVitalsAutocapture:class{get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;let i=D(this.Uv)?null==(e=this.Uv)?void 0:e.web_vitals_allowed_metrics:void 0;return z(i)?(null==(t=this._instance.persistence)?void 0:t.props.$web_vitals_allowed_metrics)||aw:i}get flushToCaptureTimeoutMs(){return(D(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=D(this.Uv)?this.Uv.web_vitals_attribution:void 0;return W(e)?e?aw:[]:T(e)?e:ax}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=D(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get Bv(){let e=D(this.Uv)&&U(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){let e=null==d?void 0:d.protocol;
1if("http:"!==e&&"https:"!==e)return ab.info("Web Vitals are disabled on non-http/https protocols"),!1;let t=D(this.Uv)?this.Uv.web_vitals:W(this.Uv)?this.Uv:void 0;return W(t)?t:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(ab.info("enabled, starting..."),this.zo(this.Hv))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("capturePerformance"in t))return;let i=D(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=D(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[iB]:i}),this._instance.persistence.register({[iV]:s})),this.xv=i,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(e){var t;let i=b.__PosthogExtensions__,s=this.zv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==r?void 0:r[s])||"web-vitals"===s&&j(r)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null==(t=i.loadExternalDependency)||t.call(i,this._instance,s,t=>{t?ab.error("failed to load script",t):e()})}jv(e){let t=e||(null==l?void 0:l.location.href);if(!t)return void ab.error("Could not determine current URL");let i=this._instance.config.disable_capture_url_hashes?th(t):t,s=this._instance.config.custom_personal_data_properties;return r1(i,this._instance.config.mask_personal_data_properties?[...r4,...s||[]]:[],r8)}constructor(e){var t;this._instance=e,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",t_({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>t_(t_({},e),{},{["$web_vitals_".concat(t.name,"_event")]:t_({},t),["$web_vitals_".concat(t.name,"_value")]:t.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=e=>{var t;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},z(null==e?void 0:e.name)||z(null==e?void 0:e.value))return void ab.error("Invalid metric received",e);let i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this.jv(i);if(j(s))return;let r=U(e.navigationId)||"string"==typeof e.navigationId?"navigation:".concat(e.navigationId):"url:".concat(s);if(this.Bv&&e.value>=this.Bv)return void ab.error("Ignoring metric with value >= "+this.Bv,e);this.Rt.navigationKey!==r&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),j(this.Rt.navigationKey)&&(this.Rt.navigationKey=r,this.Rt.url=s),this.Rt.firstMetricTimestamp=j(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),o=t_(t_(t_({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,D(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){let t={};for(let i of ak){let s="url"===i&&"string"==typeof e.attribution[i]?this.jv(e.attribution[i]):e.attribution[i];j(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;j(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Lv()},this.Hv=()=>{if(this.xo)return;let e,t,i,s,r=!1,n=b.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.zv])||("web-vitals"===this.zv&&j(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!j(a)){let n=a.withoutAttribution,o=this.attributionMetrics;r=!j(n),e=o.indexOf("LCP")>-1?a.onLCP:(null==n?void 0:n.onLCP)||a.onLCP,t=o.indexOf("CLS")>-1?a.onCLS:(null==n?void 0:n.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==n?void 0:n.onFCP)||a.onFCP,s=o.indexOf("INP")>-1?a.onINP:(null==n?void 0:n.onINP)||a.onINP}if(!(e&&t&&i&&s))return void ab.error("web vitals callbacks not loaded - not starting");let l={reportSoftNavs:this.useSoftNavs},u=r&&this.attributionMetrics.indexOf("INP")>-1?t_(t_({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this.qv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this.qv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.qv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this.qv.bind(this),u),this.xo=!0},this.xv=!!(null==(t=this._instance.persistence)?void 0:t.props[iB]),this.startIfEnabled()}}}),{exceptionObserver:class{Jv(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return D(e)?t=t_(t_({},t),e):(j(e)?this.Qv:e)&&(t=t_(t_({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ag.info("enabled"),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(e){var t,i,s;(null==(t=b.__PosthogExtensions__)?void 0:t.errorWrappingFunctions)?e():null==(i=b.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return ag.error("failed to load script",t);e()})}Zv(){var e,t,i;null==(e=this.Wv)||e.call(this),this.Wv=void 0,null==(t=this.Vv)||t.call(this),this.Vv=void 0,null==(i=this.Gv)||i.call(this),this.Gv=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"autocaptureExceptions"in t&&(this.Qv=!!t.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[iN]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}captureException(e){try{var t,i,s;let r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";if(this.wt.consumeRateLimit(r))return void ag.info("Skipping exception capture because of client rate limiting.",{exception:r});null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}catch(e){}}constructor(e){var t;this.Hv=()=>{var e;if(!l||!this.isEnabled||!(null==(e=b.__PosthogExtensions__)?void 0:e.errorWrappingFunctions))return;let t=b.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=b.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=b.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=t(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=i(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=s(this.captureException.bind(this)))}catch(e){ag.error("failed to start",e),this.Zv()}},this._instance=e,this.Qv=!!(null==(t=this._instance.persistence)?void 0:t.props[iN]),this.wt=new el(t_(t_({},function(){var e,t,i,s;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{refillRate:null!=(e=null!=(t=r.exceptionRateLimiterRefillRate)?t:r.__exceptionRateLimiterRefillRate)?e:1,bucketSize:null!=(i=null!=(s=r.exceptionRateLimiterBucketSize)?s:r.__exceptionRateLimiterBucketSize)?i:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:ag})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}},exceptions:class{onConfigChange(){this.Yv=tX(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;let r=e.config;if(!("errorTracking"in r))return;let n=null!=(t=null==(i=r.errorTracking)?void 0:i.suppressionRules)?t:[],o=null==(s=r.errorTracking)?void 0:s.captureExtensionExceptions;this.Kv=n,this._instance.persistence&&this._instance.persistence.register({[ij]:this.Kv,[iq]:o})}get if(){var e;let t=!!this._instance.get_property(iq),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.Xv.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.Yv.enabled)try{if(!q(e)||0===e.trim().length)return void a5.warn("Ignoring exception step because message must be a non-empty string");let{sanitizedProperties:i,droppedKeys:s}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};let t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>(tG.has(s)?t.push(s):i[s]=e[s],i),{}),droppedKeys:t}}(this.nf(t));s.length>0&&a5.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.ef.add(t_({[tV]:e,[tW]:(new Date).toISOString()},i))}catch(e){a5.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this.sf(t)){if(this.rf(t))return this.af("Exception dropped: matched a suppression rule"),void a5.info("Skipping exception capture because a suppression rule matched");if(!this.if&&this.lf(t))return this.af("Exception dropped: thrown by a browser extension"),void a5.info("Skipping exception capture because it was thrown by an extension");if(!this.if&&this.uf(t))return this.af("Exception dropped: thrown by an injected browser script"),void a5.info("Skipping exception capture because it was thrown by an injected browser script");
1if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(t))return this.af("Exception dropped: thrown by the PostHog SDK"),void a5.info("Skipping exception capture because it was thrown by the PostHog SDK")}let i=this.Yv.enabled&&z(e.$exception_steps)?this.cf(e):e,s=function(){let e=globalThis._posthogReleaseId;return"string"==typeof e&&e.length>0?e:void 0}();s&&(i.$release_id=s);try{let e=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return e&&this.ef.clear(),e}catch(e){return a3(e)||a5.error("Failed to capture exception event. Dropping this exception.",e),void this.ef.clear()}}catch(e){return void(a3(e)||a5.error("Failed to process exception event. Ignoring this exception.",e))}}cf(e){try{let t=this.ef.getAttachable();return 0===t.length?e:t_(t_({},e),{},{$exception_steps:t})}catch(t){return a5.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}af(e){this.Yv.enabled&&this.ef.add({[tV]:e,[tW]:(new Date).toISOString()})}nf(e){return D(e)?t_({},e):{}}tf(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}rf(e){if(0===e.length)return!1;try{let t=e.reduce((e,t)=>{let{type:i,value:s}=t;return q(i)&&i.length>0&&e.$exception_types.push(i),q(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.Kv.some(e=>{let i=e.values.map(e=>{let i=oD[e.operator],s=t[e.key];if(!i||!s)return!1;let r=T(e.value)?e.value:[e.value];return r.length>0&&i(r,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return a5.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}lf(e){let t=e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}),i=t.filter(e=>{let{filename:t}=e;return!!t&&a8.some(e=>t.startsWith(e))});return 0!==i.length&&(!i.every(e=>{let{filename:t}=e;return!!t&&t.startsWith(a4)})||e.some(e=>{let{type:t,value:i}=e;return"NoResponse"===t||q(i)&&a6.some(e=>{let{value:t,exact:s}=e;return s?i===t:i.includes(t)})})&&!t.some(e=>{let{in_app:t,filename:i}=e;return t&&!(null==i?void 0:i.startsWith(a4))}))}uf(e){return e.some(e=>{let{value:t}=e;return q(t)&&a9.some(e=>t.includes(e))})}hf(e){if(e.length>0){var t,i,s,r;let n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],o=n[n.length-1];return null!=(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}sf(e){return!z(e)&&T(e)}constructor(e){var t,i;this.Kv=[],this.Xv=new tm([new tA,new tU,new tL,new tT,new tH,new tB,new tN,new tz],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=t.split("\n"),o=Math.min(n.length,s+1e3),a=[];for(let t=s;o>t;t++){let s=n[t];if(s.length>1024)continue;let o=tF.test(s)?s.replace(tF,"$1"):s;if(!o.match(/\S*Error: /)){for(let t of i){let i=t(o,e);if(i){r.push(i);let e=function(e){for(let t=1;10>=t;t++){let i=e.length-2*t;if(0>i)break;let s=!0;for(let r=0;t>r;r++)if(!tO(e[i+r],e[i+t+r])){s=!1;break}if(s){for(let s=0;t>s;s++)e[i+s]=e[i+t+s];return e.length=i+t,{start:i,length:t}}}}(r);if(e){for(let t=a.length-1;t>=0;t--){let i=a[t];if(e.start>=i.start+i.length)break;a.pop()}a.push(e)}break}}if(function(e,t){let i=t[0],s=e.length-(i?tC(e,i):0);for(let i of t)s-=tM(e,i);return s}(r,a)>=50)break}}let l=[...a].sort((e,t)=>t.start-e.start),u=l[l.length-1];if(u){let e=tC(r,u);for(let t of(r.splice(u.start-e,e),l))t.start-=e}for(let e of l){let t=e.start+e.length,i=tM(r,e);i&&r.splice(t+i===r.length?t:e.start,i)}return a.some(e=>0===e.start&&r.length===e.length)&&function(e){let t=e.map(e=>"".concat(e.function,"|").concat(e.filename,"|").concat(e.lineno,"|").concat(e.colno,"|").concat(e.module)),i=0;for(let e=1;t.length>e;e++)(function(e,t,i){for(let s=0;e.length>s;s++){let r=e[(t+s)%e.length],n=e[(i+s)%e.length];if(r!==n)return n>r}return!1})(t,e,i)&&(i=e);e.push(...e.splice(0,i))}(r),function(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>t_(t_({},e),{},{filename:e.filename||(t[t.length-1]||{}).filename,function:e.function||"?"}))}(r)}}("web:javascript",t$,tI)),this._instance=e,this.Kv=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property("$error_tracking_suppression_rules"))?t:[],this.Yv=tX(this.tf()),this.ef=new tJ(this.Yv)}}}),lm),{siteApps:class{get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(e,t){if(!t)return;let i=this.globalsForEvent(t);this.gf.push(i),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var e;return null==(e=b._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.mf.bind(this));this.yf=()=>{e(),this.gf=[],this.yf=void 0}}}globalsForEvent(e){var t,i,s,r,n,o,a;if(!e)throw Error("Event payload is required");let l={},u=this._instance.get_property("$groups")||[];for(let[e,t]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[e]={id:u[e],type:e,properties:t};let{$set_once:h,$set:c}=e;return{event:t_(t_({},t9(e,aO)),{},{properties:t_(t_(t_({},e.properties),c?{$set:t_(t_({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{}),c)}:{}),h?{$set_once:t_(t_({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{}),h)}:{}),elements_chain:null!=(n=null==(o=e.properties)?void 0:o.$elements_chain)?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}bf(e){var t;let i=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(aC.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(aC.error("prepare_external_dependency_script returned null"),null):e}_f(){var e,t,i,s,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let l=null==c?void 0:c.defaultView,u=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!u)return()=>{};if(this.pf++,this.wf)return this.kf();let h=[],d=this,p=new WeakSet,f=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;let s=e[t];e[t]=i(s),h.push(()=>{e[t]=s})},g=e=>{if(p.has(e))return e;let t=d.bf(e);return t&&p.add(t),t},v=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!H(e));return f(u,"appendChild",e=>function(t){let i=g(t);return i?e.call(this,i):t}),f(u,"insertBefore",e=>function(t,i){let s=g(t);return s?e.call(this,s,i):t}),f(u,"replaceChild",e=>function(t,i){let s=g(t);return s?e.call(this,s,i):i}),[null==(t=l.Element)?void 0:t.prototype,null==(i=l.Document)?void 0:i.prototype,null==(s=l.DocumentFragment)?void 0:s.prototype].forEach(e
1=>{f(e,"append",e=>function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.apply(this,v(i))}),f(e,"prepend",e=>function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.apply(this,v(i))})}),[null==(r=l.Element)?void 0:r.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(e=>{f(e,"before",e=>function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.apply(this,v(i))}),f(e,"after",e=>function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];return e.apply(this,v(i))}),f(e,"replaceWith",e=>function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];let r=v(i);return i.length&&!r.length?void 0:e.apply(this,r)})}),f(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",e=>function(t,i){let s=g(i);return s?e.call(this,t,s):null}),this.wf=()=>{h.forEach(e=>e()),this.wf=void 0},this.kf()}kf(){let e=!1;return()=>{var t;e||(e=!0,this.pf--,0===this.pf&&(null==(t=this.wf)||t.call(this)))}}Sf(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=this._f();try{let s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){let t=this.apps[e.id],i=()=>{var i;!t.errored&&this.gf.length&&(aC.info("Processing ".concat(this.gf.length," events for site app with id ").concat(e.id)),this.gf.forEach(e=>this.Sf(()=>{var i;return null==(i=t.processEvent)?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.yf)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,aC.info("Site app with id ".concat(e.id," ").concat(r?"loaded":"errored")),s&&i()};try{let{processEvent:i}=this.Sf(t=>e.init({posthog:this._instance,callback(e){t(),r(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){aC.error(aM+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){aC.error("Error while processing buffered events PostHog app with config id ".concat(e.id),i),t.errored=!0}}xf(){let e=this.siteAppLoaders||[];for(let t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(let t of e)this.setupSiteApp(t)}Cf(e){if(0===Object.keys(this.apps).length)return;let t=this.globalsForEvent(e);for(let i of Object.values(this.apps))try{this.Sf(()=>{var e;return null==(e=i.processEvent)?void 0:e.call(i,t)})}catch(t){aC.error("Error while processing event ".concat(e.event," for site app ").concat(i.id),t)}}onRemoteConfig(e){var t,i,s,r,n;if(null==(t=this.siteAppLoaders)?void 0:t.length)return this.isEnabled?(this.xf(),void this._instance.on("eventCaptured",e=>this.Cf(e))):void aC.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.yf)||i.call(this),!e.ok)return;let o=e.config;if(null==(s=o.siteApps)?void 0:s.length)if(this.isEnabled)for(let{id:e,url:t}of o.siteApps)b["__$$ph_site_app_".concat(e)]=this._instance,null==(r=b.__PosthogExtensions__)||null==(n=r.loadSiteApp)||n.call(r,this._instance,t,t=>{if(t)return aC.error(aM+e,t)});else aC.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}constructor(e){this._instance=e,this.pf=0,this.gf=[],this.apps={}}}}),ly),{tracingHeaders:class{initialize(){this.startIfEnabledOrStop()}zo(e){var t,i,s;(null==(t=b.__PosthogExtensions__)?void 0:t.tracingHeadersPatchFns)?e():null==(i=b.__PosthogExtensions__)||null==(s=i.loadExternalDependency)||s.call(i,this._instance,"tracing-headers",t=>{if(t)return ay.error("failed to load script",t);e()})}Ef(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}Mf(){let e=this.Ef();return T(e)?(T(this.If)?this.If.splice(0,this.If.length,...e):this.If=[...e],e.length>0?this.If:void 0):(T(this.If)&&this.If.splice(0),this.If=e||void 0,this.If)}Zv(){var e,t;null==(e=this.$f)||e.call(this),null==(t=this.Tf)||t.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}constructor(e){this._instance=e,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{var e,t;let i=this.Mf();i?(j(this.$f)&&(this.$f=null==(e=b.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),j(this.Tf)&&(this.Tf=null==(t=b.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Zv()}}}}),{toolbar:class{Pf(e){b.ph_toolbar_state=e}Rf(){var e;return null!=(e=b.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(){var e,t;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(sN(this.instance.config)||!l||!c)return!1;i=null!=(e=i)?e:l.location,r=null!=(t=r)?t:l.history;try{let e;if(!s){try{l.localStorage.setItem("test","test"),l.localStorage.removeItem("test")}catch(e){return!1}s=null==l?void 0:l.localStorage}let t=aU||r2(i.hash,"__posthog")||r2(i.hash,"state"),n=t?tc(()=>JSON.parse(atob(decodeURIComponent(t))))||tc(()=>JSON.parse(decodeURIComponent(t))):null;return n&&"ph_authorize"===n.action?((e=n).source="url",e&&Object.keys(e).length>0&&(n.desiredHash?i.hash=n.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((e=JSON.parse(s.getItem(aV)||"{}")).source="localstorage",delete e.userIntent),!(!e.token||this.instance.config.token!==e.token||(this.loadToolbar(e),0))}catch(e){return!1}}Af(e){let t=b.ph_load_toolbar||b.ph_load_editor;!z(t)&&L(t)?t(e,this.instance):aW.warn("No toolbar load function found")}loadToolbar(e){let t=!!(null==c?void 0:c.getElementById("__POSTHOG_TOOLBAR__"));if(!l||t)return!1;let i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=t_(t_({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(l.localStorage.setItem(aV,JSON.stringify(t_(t_({},s),{},{source:void 0}))),2===this.Rf())this.Af(s);else if(0===this.Rf()){var r,n;this.Pf(1),null==(r=b.__PosthogExtensions__)||null==(n=r.loadExternalDependency)||n.call(r,this.instance,"toolbar",e=>{if(e)return aW.error("[Toolbar] Failed to load",e),void this.Pf(0);this.Pf(2),this.Af(s)}),sD(l,"turbolinks:load",()=>{this.Pf(0),this.loadToolbar(s)})}return!0}Ff(e){return this.loadToolbar(e)}maybeLoadEditor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,i)}constructor(e){this.instance=e}}}),lb),{conversations:class{initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Wf=e.ok,!e.ok))return;let t=e.config.conversations;z(t)||(W(t)?this.Hf=t:(this.Hf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager||this.zf||this._instance.config.disable_conversations||sN(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=null==b?void 0:b.__PosthogExtensions__;if(e&&!j(this.Hf)&&this.Hf)if(this.ne&&this.ne.token){this.zf=!0;try{let t=e.initConversations;
1if(t)return this.Vf(t),void(this.zf=!1);let i=e.loadExternalDependency;if(!i)return void this.Gf(sy);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Gf("Could not load conversations script",t):this.Vf(e.initConversations),this.zf=!1})}catch(e){this.Gf("Error initializing conversations",e),this.zf=!1}}else lt.error("Conversations enabled but missing token in remote config.")}Vf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Uf=!1,lt.info("Conversations loaded successfully")}catch(e){this.Gf("Error completing conversations initialization",e)}else lt.error("Cannot complete initialization: remote config is null")}Gf(e,t){lt.error(e,t),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():lt.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Hf&&!H(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":sN(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Wf?"remote_config_failed":j(this.Hf)?this.Wf?"disabled_in_project":"remote_config_pending":this.Hf?z(this.ne)||!this.ne.token?"missing_token":(null==b?void 0:b.__PosthogExtensions__)?this.zf?"initializing":this.Uf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return er(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(lt.warn(li),null)})()}getMessages(e,t){var i=this;return er(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(lt.warn(li),null)})()}markAsRead(e){var t=this;return er(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(lt.warn(li),null)})()}getTickets(e){var t=this;return er(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(lt.warn(li),null)})()}requestRestoreLink(e){var t=this;return er(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(lt.warn(li),null)})()}restoreFromToken(e){var t=this;return er(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(lt.warn(li),null)})()}restoreFromUrlToken(){var e=this;return er(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(lt.warn(li),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}Sh(){var e;null==(e=this._conversationsManager)||e.setIdentity()}xh(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}constructor(e){this._instance=e,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}}}),{logs:class{ap(e,t,i,s){var r;let n=ls(null==(r=this._instance)||null==(r=r.config)?void 0:r.logs,i);return[new ip(this.lp(e,t),n,this.Kf,()=>this.up(),e=>e(),void 0,s),n]}hp(){var e,t;let i=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.rp&&this.cp===i||(null==(t=this.rp)||t.reset(),this.cp=i,[this.rp,this.dp]=this.ap(()=>this.al,e=>{this.al=e})),this.rp}vp(){var e,t;let i=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.op&&this.fp===i||(null==(t=this.op)||t.reset(),this.fp=i,[this.op,this.pp]=this.ap(()=>this.Xf,e=>{this.Xf=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},lo)),this.op}setup(e){var t;if(this.Io)return;this.wo=e,(null==(t=this._instance)||null==(t=t.config)||null==(t=t.logs)?void 0:t.captureConsoleLogs)&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let i=!1,s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null==(t=e.config.logs)?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this.Io?s.dispose():(this.Po=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.Io||(this.Io=!0,this.bp(),null==(e=this.Po)||e.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,null==l||l.removeEventListener("online",this.sp),null==(t=this._p)||t.call(this),this._p=void 0,null==(i=this.rp)||i.reset(),null==(s=this.op)||s.reset())}onRemoteConfig(e){var t,i;if(this.Io)return;let s=e.ok?null==(t=e.config.logs)?void 0:t.captureConsoleLogs:void 0;z(s)?this.wp():(null==(i=this._instance)||null==(i=i.persistence)||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var e,t,i,s;this.bp(),null==(e=this.rp)||e.clearQueue(),this.al=[],null==(t=this.rp)||t.reset(),null==(i=this.op)||i.clearQueue(),this.Xf=[],null==(s=this.op)||s.reset(),this.hd=0}captureLog(e){this.Io||this.hp().captureLog(e)}captureConsoleLog(e){this.Io||this.vp().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.Io||this.vp().captureLog(e,{context:t,occurredAtMs:i})}mp(){var e;return!!(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.props)?void 0:e[iU])}gp(){var e,t,i;return!(null==(e=this._instance)||null==(t=e.nl)?void 0:t.call(e))||!!(null==(i=b._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])?void 0:i.config)}$h(){var e;this.bp(),null==(e=this.op)||e.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var e;if(this.ep||!(null==b?void 0:b.console))return;let t=ls(null==(e=this._instance)||null==(e=e.config)?void 0:e.logs).maxBufferSize,i=!0;for(let e of(this.tp.push(()=>{i=!1}),lr)){let s;try{s=ln(b.console[e])}catch(e){continue}s&&this.tp.push(am(b.console,e,r=>{var n=this;let o=function(){for(var s=arguments.length,o=Array(s),a=0;a<s;a++)o[a]=arguments[a];try{i&&n.kp(e,o,t)}catch(e){}return r.apply(b.console,o)};return o.__rrweb_original__=s,o}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(e,t,i){var s;if(this.ep&&!this.np&&0!==t.length)if(null==(s=this._instance)?void 0:s.is_capturing()){if(i>this.Yf.length){this.np=!0;try{this.Yf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}bp(){if(this.Yf=[],this.ep){for(let e of(this.ep=!1,this.Sp&&(clearTimeout(this.Sp),this.Sp=void 0),this.tp))e();this.tp=[]}}xp(){let e=this.Yf;return this.bp(),e}get logger(){return this.Cp||(this.Cp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>
1this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Cp}flushLogs(e){e?this.$p(e):(this.rp&&this.rp.flush().catch(e=>this.Tp(e)),this.op&&this.op.flush().catch(e=>this.Tp(e)))}Tp(e){lu(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;let e=null==b?void 0:b.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.bp();let t=e.loadExternalDependency;if(!t)return this.$.error(sy),void this.bp();this.Jf=!0;try{t(this._instance,"logs",t=>{if(this.Jf=!1,this.Io||!this.Zf)return;let i=e.logs;if(!t&&(null==i?void 0:i.initializeLogs)){var s,r,n;let e=this.xp();this._p=i.initializeLogs(null!=(s=this.wo)?s:this._instance),this.Qf=!0,e.length>0&&(null==(r=i.replayConsoleBuffer)||r.call(i,null!=(n=this.wo)?n:this._instance,e))}else this.$.error("Could not load logs script",t),this.bp()})}catch(e){throw this.Jf=!1,e}}lp(e,t){let i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===E.LogsQueue?e():void 0,setPersistedProperty(e,i){e===E.LogsQueue&&t(null!=i?i:[])},js:e=>this.js(e),getLibraryId:()=>x.LIB_NAME,getLibraryVersion:()=>x.LIB_VERSION}}js(e){return new Promise(t=>{if(r3(this.hd,3))return void t({kind:"fatal",error:ll(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1,s=e=>{i||(i=!0,clearTimeout(r),t(e))},r=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:ll(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Ip(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{let t=e.statusCode;if(this.Mp(t),t>=200&&300>t)s({kind:"ok"});else if(413===t)s({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)s({kind:"fatal",error:Error("logs request failed with status ".concat(t))});else{var i;0===t?(e.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:ll(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!=(i=e.error)?i:Error("logs request failed with status ".concat(t))})}}})})}Mp(e){(0!==e||this._instance.__loaded)&&(this.hd=r5(e,this.hd,3,()=>this.$.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.")))}$p(e){this.al.length>0&&this.Ep(e,this.al,this.dp,x.LIB_NAME,e=>{this.al=e}),this.Xf.length>0&&this.Ep(e,this.Xf,this.pp,lo,e=>{this.Xf=e})}Ep(e,t,i,s,r){if(0===t.length)return;let n=t.map(e=>e.record);r([]);let o=iu(n,ii(i,x.LIB_NAME,x.LIB_VERSION),s,x.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ip(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}up(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:e,windowId:i,sessionStartTimestamp:s,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=e,t.windowId=i,z(s)||(t.sessionStartTimestamp=s),z(r)||(t.lastActivityTimestamp=r)}if((null==b||null==(e=b.location)?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?th(b.location.href):b.location.href),this._instance.featureFlags){let e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}constructor(e){var t,i=this;this._instance=e,this.name="logs",this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=iw("[logs]"),this.Kf=t_(t_({},this.$),{},{error:function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];t.some(lu)||i.$.error(...t)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var e,t;this.Io||(this.hd=0,null==(e=this.rp)||e.onReconnect(),null==(t=this.op)||t.onReconnect())},this._instance&&(null==(t=this._instance.config.logs)?void 0:t.captureConsoleLogs)&&(this.Zf=!0),l&&sD(l,"online",this.sp)}}}),{metrics:class{initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.Io)return;let t=!!(null==(e=this._instance.config.metrics)?void 0:e.network);t&&!this.Pp?this.Pp=(e=>{let t=!0,i=()=>t?(e=>{var t;let i=null==(t=e.config.metrics)?void 0:t.network;return!0===i?{}:i||void 0})(e):void 0,s=L(null==l?void 0:l.fetch)?am(l,"fetch",t=>function(){for(var s,r,n,o=arguments.length,a=Array(o),l=0;l<o;l++)a[l]=arguments[l];let u=lc(),h=t.apply(this,a);if(!i())return h;try{let[t,o]=a,l=lf(null!=(s=null!=(r=null==o?void 0:o.method)?r:null==t?void 0:t.method)?s:"GET",null!=(n=null==t?void 0:t.url)?n:t);return h.then(t=>(lg(e,l,null==t?void 0:t.status,u,i,void 0,!0),t),t=>{throw lg(e,l,void 0,u,i,t),t})}catch(e){return lh.error("Failed to observe fetch",e),h}}):lv,r=((e,t)=>{var i;let s=null==l||null==(i=l.XMLHttpRequest)?void 0:i.prototype;if(!s)return lv;let r=new WeakMap,n=am(s,"open",e=>function(){for(var t=arguments.length,i=Array(t),s=0;s<t;s++)i[s]=arguments[s];try{os.has(this)||r.set(this,lf(i[0],i[1]))}catch(e){lh.error("Failed to observe XHR open",e)}return e.apply(this,i)}),o=am(s,"send",i=>function(){let s;for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];try{let i=r.get(this);if(i&&t()){let r=lc();s=()=>{this.removeEventListener("loadend",s),lg(e,i,this.status,r,t)},sD(this,"loadend",s)}}catch(e){lh.error("Failed to observe XHR send",e)}try{return i.apply(this,o)}catch(e){throw s&&this.removeEventListener("loadend",s),e}});return()=>{n(),o()}})(e,i);return()=>{t=!1,s(),r()}})(this._instance):!t&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){var e,t;let i=null==(e=this._instance)||null==(e=e.config)?void 0:e.metrics;return this.rp&&this.cp===i||(null==(t=this.rp)||t.reset(),this.cp=i,this.rp=new im(this.lp(),function(e){var t,i,s,r,n;let o=null==e?void 0:e.resourceAttributes;return{serviceName:null!=(t=null==o?void 0:o["service.name"])?t:null==e?void 0:e.serviceName,serviceVersion:null!=(i=null==o?void 0:o["service.version"])?i:null==e?void 0:e.serviceVersion,environment:null!=(s=null==o?void 0:o["deployment.environment"])?s:null==e?void 0:e.environment,resourceAttributes:o,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:null!=(r=null==e?void 0:e.flushIntervalMs)?r:1e4,maxSeriesPerFlush:null!=(n=null==e?void 0:e.maxSeriesPerFlush)?n:1e3}}(i),this.$)),this.rp}count(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;this.hp().count(e,t,i)}
1gauge(e,t,i){this.hp().gauge(e,t,i)}histogram(e,t,i){this.hp().histogram(e,t,i)}flush(e){if(!this.rp)return Promise.resolve();if(e){let t=this.rp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.rp.flush().catch(e=>this.$.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this.rp)||e.reset()}dispose(){var e,t;this.Io=!0,null==(e=this.Pp)||e.call(this),this.Pp=void 0,null==(t=this.rp)||t.reset()}lp(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:e=>t.Ys(e),getLibraryId:()=>x.LIB_NAME,getLibraryVersion:()=>x.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1,r=e=>{s||(s=!0,clearTimeout(n),i(e))},n=setTimeout(()=>r({kind:"retry-later",error:Error("metrics request timed out")}),9e4);this._instance._send_request(t_(t_({method:"POST",url:this.Rp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(e){let t=e.statusCode;if(t>=200&&300>t)r({kind:"ok"});else if(413===t)r({kind:"too-large"});else if(0!==t&&408!==t&&429!==t&&500>t)r({kind:"fatal",error:Error("metrics request failed with status ".concat(t))});else{var i;r({kind:"retry-later",error:null!=(i=e.error)?i:Error("metrics request failed with status ".concat(t))})}}}))})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}constructor(e){this._instance=e,this.$=iw("[metrics]"),this.Io=!1}}}));var lw=function(){x.SDK_DIST_CHANNEL="npm";let e=o2[as]=new al;return function(){function e(){e.done||(e.done=!0,ow=!1,sF(o2,function(e){e._dom_loaded()}))}(null==c?void 0:c.addEventListener)?"complete"===c.readyState?e():sD(c,"DOMContentLoaded",e,{capture:!1}):l&&ib.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.