PageSourceSearch

https://wavevisual.com/_next/static/chunks/533fc325.fd677f6b39933cf0.js

js wavevisual.com collected 2026-10-04 13:33:32 UTC 305,000 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[638],{16418:function(e,t,i){let s,r,n,o,a;i.r(t),i.d(t,{Compression:function(){return ny},DEFAULT_PRODUCT_TOUR_APPEARANCE:function(){return nC},DisplaySurveyType:function(){return nT},PostHog:function(){return ad},ProductTourEventName:function(){return nI},ProductTourEventProperties:function(){return nR},SurveyEventName:function(){return nM},SurveyEventProperties:function(){return nO},SurveyEventType:function(){return nb},SurveyPosition:function(){return nx},SurveyQuestionBranchingType:function(){return nk},SurveyQuestionType:function(){return nS},SurveySchedule:function(){return nP},SurveyTabPosition:function(){return nE},SurveyType:function(){return n$},SurveyWidgetType:function(){return nw},default:function(){return lg},posthog:function(){return lf},severityLevels:function(){return nj}});let l="u">typeof window?window:void 0,u="u">typeof globalThis?globalThis:l,d=null==u?void 0:u.navigator,h=null==u?void 0:u.document,c=null==u?void 0:u.location,p=null==u?void 0:u.fetch,v=(null==u?void 0:u.XMLHttpRequest)&&"withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:void 0,f=null==u?void 0:u.AbortController,g=null==u?void 0:u.CompressionStream,_=null==d?void 0:d.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.8.3",x={DEBUG:!1,LIB_VERSION:w,LIB_NAME:"browser-common",JS_SDK_VERSION:w};var E,$,S,k,P=(($={}).AnonymousId="anonymous_id",$.DistinctId="distinct_id",$.Props="props",$.EnablePersonProcessing="enable_person_processing",$.PersonMode="person_mode",$.FeatureFlagDetails="feature_flag_details",$.FeatureFlags="feature_flags",$.FeatureFlagPayloads="feature_flag_payloads",$.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",$.BootstrapFeatureFlags="bootstrap_feature_flags",$.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",$.OverrideFeatureFlags="override_feature_flags",$.Queue="queue",$.AiQueue="ai_queue",$.AiCaptureQueue="ai_capture_queue",$.LogsQueue="logs_queue",$.OptedOut="opted_out",$.SessionId="session_id",$.SessionStartTimestamp="session_start_timestamp",$.SessionLastTimestamp="session_timestamp",$.PersonProperties="person_properties",$.GroupProperties="group_properties",$.InstalledAppBuild="installed_app_build",$.InstalledAppVersion="installed_app_version",$.SessionReplay="session_replay",$.PushRegistered="push_registered",$.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",$.SurveyLastSeenDate="survey_last_seen_date",$.SurveysSeen="surveys_seen",$.Surveys="surveys",$.RemoteConfig="remote_config",$.FlagsEndpointWasHit="flags_endpoint_was_hit",$.DeviceId="device_id",$),M=((S={}).GZipJS="gzip-js",S.Base64="base64",S);let O=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],T=["token"];function F(e,t){return -1!==e.indexOf(t)}let C=function(e){return e.trim()},I=function(e){return e.replace(/^\$/,"")};function R(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}}))&&void 0!==t?t:"null"}let A=Object.prototype,L=A.hasOwnProperty,D=A.toString,N=Array.isArray||function(e){return"[object Array]"===D.call(e)},j=e=>"function"==typeof e,B=e=>e===Object(e)&&!N(e),U=e=>{if(B(e)){for(let t in e)if(L.call(e,t))return!1;return!0}return!1},H=e=>void 0===e,z=e=>"[object String]"==D.call(e),q=e=>z(e)&&0===e.trim().length,V=e=>null===e,W=e=>H(e)||V(e),G=e=>"[object Number]"==D.call(e)&&e==e,K=e=>G(e)&&e>0,Y=e=>"[object Boolean]"===D.call(e),J=e=>F(O,e),X=e=>F(T,e);function Z(e){return null===e||"object"!=typeof e}function Q(e,t){return({}).toString.call(e)===`[object ${t}]`}function ee(e){switch(({}
1).toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ei(e,Error)}}function et(e){return"u">typeof Event&&ei(e,Event)}function ei(e,t){try{return e instanceof t}catch(e){return!1}}let es=[!0,"true",1,"1","yes"],er=e=>F(es,e),en=[!1,"false",0,"0","no"];function eo(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 ea(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(e){eo(n,s,r,o,a,"next",e)}function a(e){eo(n,s,r,o,a,"throw",e)}o(void 0)})}}let el=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],eu=function(e,t=[]){if(!e)return!1;let i=e.toLowerCase();return el.concat(t).some(e=>{let t=e.toLowerCase();return -1!==i.indexOf(t)})};function ed(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),G(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),ed(null!=r?r:i,t,i,s))}var eh=class{constructor(e){this.C={},this.I=e.I,this.R=ed(e.bucketSize,0,100,e.$),this.A=ed(e.refillRate,0,this.R,e.$),this.O=ed(e.refillInterval,0,864e5,e.$)}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)||void 0===t||t.call(this,e)),0===r.tokens)}stop(){this.C={}}};let ec="Mobile",ep="Android",ev="Tablet",ef="Android Tablet",eg="iPad",e_="Apple Watch",em="Safari",ey="BlackBerry",eb="Samsung Internet",ew="Chrome",ex="Chrome iOS",eE="Internet Explorer",e$="Internet Explorer Mobile",eS="Opera",ek="Microsoft Edge",eP="Firefox",eM="Firefox iOS",eO="Nintendo",eT="PlayStation",eF="Xbox",eC="Android Mobile",eI="Mobile Safari",eR="Windows",eA="Windows Phone",eL="Nokia",eD="Ouya",eN="Generic "+ec.toLowerCase(),ej="Generic "+ev.toLowerCase(),eB="Konqueror",eU="Oculus Browser",eH="Vivaldi",ez="Yandex",eq="Whale",eV="DuckDuckGo",eW="Pale Moon",eG="Waterfox",eK="Brave",eY="Claude",eJ="Codex",eX="ChatGPT",eZ="Google Search App",eQ=RegExp("Version/(\\d+(\\.\\d+)?)"),e0=RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),e1=RegExp(eF,"i"),e2=RegExp("PlayStation \\w+","i"),e3=RegExp("Nintendo \\w+","i"),e5=RegExp("BlackBerry|PlayBook|BB10","i"),e6={"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"},e4=function(e,t,i,s){var r;return t=t||"",((null==i?void 0:i.brave)?eK:null)||((null==s?void 0:s.detectGoogleSearchApp)&&F(e,"GSA/")?eZ:F(e," OPR/")&&F(e,"Mini")?"Opera Mini":F(e," OPR/")?eS:e5.test(e)?ey:F(e,"IEMobile")||F(e,"WPDesktop")?e$:F(e,"OculusBrowser")?eU:F(e,"SamsungBrowser")?eb:F(e,"Edge")||F(e,"Edg/")?ek:F(e,"Vivaldi/")?eH:F(e,"YaBrowser/")?ez:F(e,"Whale/")?eq:F(e,"DuckDuckGo/")||F(e,"Ddg/")?eV:F(e,"Claude/")?eY:F(e,"Codex/")?eJ:F(e,"ChatGPT/")?eX:F(e,"FBIOS")?"Facebook Mobile":F(e,"UCWEB")||F(e,"UCBrowser")?"UC Browser":F(e,"CriOS")?ex:F(e,"CrMo")||F(e,ew)?ew:F(e,ep)&&F(e,em)?eC:F(e,"FxiOS")?eM:F(e.toLowerCase(),eB.toLowerCase())?eB:F(e,"Brave/")?eK:(r=t)&&F(r,"Apple")||F(e,em)&&!F(e,ew)&&!F(e,ep)?F(e,ec)?eI:em:F(e,"PaleMoon/")?eW:F(e,"Waterfox/")?eG:F(e,eP)?eP:F(e,"MSIE")||F(e,"Trident/")?eE:F(e,"Gecko")?eP:"")},e8={[e$]:[RegExp("rv:(\\d+(\\.\\d+)?)")],[ek]:[RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ew]:[RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ex]:[RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[em]:[eQ],[eI]:[eQ],[eS]:[RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[eP]:[RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[eM]:[RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[eB]:[RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ey]:[RegExp("BlackBerry (\\d+(\\.\\d+)?)"),eQ],[eC]:[RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[eb]:[RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[eU]:[RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[eH]:[RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[ez]:[RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[eq]:[RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[eK]:[RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[eY]:[e0],[eJ]:[e0],[eX]:[e0],[eV]:[RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[eW]:[RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[eG]:[RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[eZ]:[RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[eE]:[RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[RegExp("rv:(\\d+(\\.\\d+)?)")]},e9=function(e,t,i,s){let r=e8[e4(e,t,i,s)];if(H(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},e7=[[RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[eF,e&&e[1]||""]],[RegExp(eO,"i"),[eO,""]],[RegExp(eT,"i"),[eT,""]],[e5,[ey,""]],[RegExp(eR,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eA,""];if(new RegExp(ec).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];let i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let e=e6[i[1]]||"";return/arm/i.test(t)&&(e="RT"),[eR,e]}return[eR,""]}],[/((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=H(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[ep,[e[2],e[3],e[4]||"0"].join(".")]:[ep,""]],[/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",""]]],te=function(e){for(let t=0;e7.length>t;t++){let[i,s]=e7[t],r=i.exec(e),n=r&&(j(s)?s(r,e):s);if(n)return n}return["",""]},tt=function(e){return e3.test(e)?eO:e2.test(e)?eT:e1.test(e)?eF:RegExp(eD,"i").test(e)?eD:RegExp("(Windows Phone|WPDesktop)","i").test(e)?eA:/iPad/.test(e)?eg:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?e_:e5.test(e)?ey:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eL,"i").test(e)?eL:/(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(ec).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)?ep:ef:RegExp("(pda|Mobile)","i").test(e)?eN:RegExp(ev,"i").test(e)&&!RegExp("Tablet pc","i").test(e)?ej:""},ti=function(e,t){var i,s,r,n;let o=tt(e);return o===eg||o===ef||"Kobo"===o||"Kindle Fire"===o||o===ej?ev:o===eO||o===eF||o===eT||o===eD?"Console":o===e_?"Wearable":o?ec:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(n=null==t?void 0:t.maxTouchPoints)&&void 0!==n?n:0)>0?600>Math.min(null!==(i=null==t?void 0:t.screenWidth)&&void 0!==i?i:0,null!==(s=null==t?void 0:t.screenHeight)&&void 0!==s?s:0)/(null!==(r=null==t?void 0:t.devicePixelRatio)&&void 0!==r?r:1)?ec:ev:"Desktop"},ts=/\bFBAV\/(\d+(?:\.\d+)*)/i,tr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ts],[/\bFBAN\/EMA\b/i,"Facebook Lite",ts],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ts],[/\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"]],tn="[Truncated]",to="[Unserializable]";function ta(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 tl(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=to}Object.defineProperty(e,s,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}let tu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function td(e,t){return"string"==typeof e&&tu.test(e)?e:t()}function th(e,t){let i=Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return i}function tc(e){return e?e.split("#")[0]:e}function tp(e){try{return e()}catch(e){return}}function tv(e,t){let i=setTimeout(e,t);return null!=i&&i.unref&&(null==i||i.unref()),i}function tf(e,t,i){return tg.apply(this,arguments)}function tg(){return(tg=ea(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((e,r)=>{s=tv(()=>{try{null==i||i(),e()}catch(e){r(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function t_(e){return(t_="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 tm(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 ty(e){for(var t=1;arguments.length>t;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?tm(Object(i),!0).forEach(function(t){!function(e,t,i){var s;(s=function(e){if("object"!=t_(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=t_(i))return i;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==t_(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)):tm(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}var tb=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){let 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 ea(function*(){for(let i of e)i.stacktrace&&i.stacktrace.frames&&N(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?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){let i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),ty(ty({},e),{},{cause:i,stack:s})}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 ea(function*(){let i=e;for(let e of t.modifiers)i=yield e(i);return i})()}convertToExceptionList(e,t){var i,s,r;let n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(s=t.handled)||void 0===s||s,synthetic:null!==(r=e.synthetic)&&void 0!==r&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});let o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,ty(ty({},t),{},{handled:!0}))),o}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)&&void 0!==t?t:1}}buildCoercingContext(e,t,i=0){let s=(i,s)=>{if(4>
1=s){let r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return ty(ty({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}};let tw=/^([a-z][a-z0-9.+-]+):/i,tx=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function tE(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=tw.exec(e);return!t||tx.includes(t[1].toLowerCase())}(t)};return H(s)||(n.lineno=s),H(r)||(n.colno=r),n}let t$=(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:${t}`:`safari-web-extension:${t}`]:[e,t]},tS=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tk=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tP=/\((\S*)(?::(\d+))(?::(\d+))\)/,tM=(e,t)=>{let i=tS.exec(e);if(i){let[,e,s,r]=i;return tE(t,e,"?",+s,+r)}let s=tk.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){let e=tP.exec(s[2]);e&&(s[2]=e[1],s[3]=e[2],s[4]=e[3])}let[e,i]=t$(s[1]||"?",s[2]);return tE(t,i,e,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},tO=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tT=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tF=(e,t)=>{let i=tO.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){let e=tT.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]=t$(s,e),tE(t,e,s,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},tC=/\(error: (.*)\)/;function tI(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function tR(e,t){let i=t.start;for(;i>0&&tI(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function tA(e,t){let i=t.start+t.length,s=i;for(;e.length>s&&tI(e[s],e[s-t.length]);)s++;return s-i}var tL=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let i=z(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?`${t}: ${e.message}`:t}isDOMException(e){return Q(e,"DOMException")}isDOMError(e){return Q(e,"DOMError")}},tD=class{match(e){return ee(e)}coerce(e,t){var i;let s=this.getStack(e);return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=s?s:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:void 0===s}}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){return e.stacktrace||e.stack||void 0}},tN=class{match(e){return!!Q(e,"ErrorEvent")&&(null!=e.error||this.lr(e))}coerce(e,t){var i;if(null!=e.error)return t.apply(e.error);let s=t.apply(e.message);return ty(ty({},s),{},{stack:null!==(i=this.ur(e))&&void 0!==i?i:s.stack,synthetic:!0})}lr(e){return z(e.message)&&e.message.length>0}ur(e){var t,i;let s=null!==(t=e.lineno)&&void 0!==t?t:0,r=null!==(i=e.colno)&&void 0!==i?i:0;if(z(e.filename)&&0!==e.filename.length&&0!==s)return`Error
2    at ${e.filename}:${s}:${r}`}};let tj=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var tB=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?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e,s=e.match(tj);return s&&(t=s[1],i=s[2]),[t,i]}};let tU=["fatal","error","warning","log","info","debug"];function tH(e,t=40){let 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(", ");if(t>=s.length)return e===i.length?s:s.length>t?`${s.slice(0,t)}...`:s}return""}var tz=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))&&void 0!==i?i:null===(s=t.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(et(e))return e.constructor.name;let t="name"in e?e.name:void 0;return z(t)&&!q(t)?t:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;let t=this.getObjectClassName(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${tH(e)}`}isSeverityLevel(e){return z(e)&&!q(e)&&tU.indexOf(e)>=0}getStack(e){try{return z(e.stacktrace)&&e.stacktrace.length>
20?e.stacktrace:z(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(ee(i))return i}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}},tq=class{match(e){return et(e)}coerce(e,t){var i;let s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${tH(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},tV=class{match(e){return Z(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},tW=class{match(e){return Q(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!et(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 Z(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(i=t.syntheticException)||void 0===i?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 tG="$message",tK="$timestamp",tY=new Set([tG,tK]),tJ={enabled:!0,max_bytes:32768};function tX(e){var t;return e?{enabled:null!==(t=e.enabled)&&void 0!==t?t:tJ.enabled,max_bytes:function(e,t){if(!G(e)||1/0===e||-1/0===e)return t;let i=Math.floor(e);return 0>i?t:i}(e.max_bytes,tJ.max_bytes)}:ty({},tJ)}var tZ=class{constructor(e){this.ts=[],this.es=0,this.Mr=tX(e)}setConfig(e){this.Mr=tX(e),this.ns()}add(e){let t=function(e){let t;try{t=R(e)}catch(e){return}try{let e=JSON.parse(t);if(!B(e))return;let i=e[tG],s=e[tK];if(!z(i)||0===i.trim().length||!z(s)&&!G(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.Mr.max_bytes||(this.ts.push({step:t.step,bytes:i}),this.es+=i,this.ns())}getAttachable(){return this.ts.map(e=>e.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){let e=this.ts.shift();e&&(this.es-=e.bytes)}}};let tQ=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function t0(e){return"string"==typeof e||e}function t1(e){return"string"==typeof e?e:void 0}let t2=["$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"],t3="NativeGzipValidationError",t5=e=>e.length>=2&&31===e[0]&&139===e[1],t6=(e,t)=>e===M.GZipJS||t===M.GZipJS||"gzip"===t,t4=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),t8=e=>{throw th(t3,`Native gzip produced invalid output: ${e}`)},t9=(k=ea(function*(e,t){18>e.size&&t8("too-short");let i=new Uint8Array((yield e.slice(0,10).arrayBuffer()));t5(i)&&8===i[2]||t8("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?3988292384^t>>>1:t>>>1;o[e]=t>>>0}return o})(),i=4294967295;for(let s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(4294967295^i)>>>0})(t)&&t8("invalid-crc");let r=t.length>>>0;s.getUint32(4,!0)!==r&&t8("invalid-size")}),function(e,t){return k.apply(this,arguments)});function t7(){return(t7=ea(function*(e,t=!0,i){var s;try{let t=(new TextEncoder).encode(e),i=new globalThis.CompressionStream("gzip"),r=i.writable.getWriter(),n=r.write(t).then(()=>r.close()).catch((s=ea(function*(e){try{yield r.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,n]);return yield t9(a,t),a}catch(e){if(null==i?void 0:i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var ie=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.ss=i,void(this.rs=i+s);this.rs=Math.max(this.rs,Math.min(i+s,this.ss+3e5))}remainingMs(){let e=Date.now();if(this.ss-5e3>e)return this.reset(),0;let t=Math.min(3e5,Math.max(0,this.rs-e));return 0===t&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function it(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 ii={}.propertyIsEnumerable;function is(e,t){try{return function e(t,i,s,r){let n=[];for(let o in t)if(ii.call(t,o)){if(!o){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>
2=s.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{let a=t[o];if(V(a)||H(a))continue;n.push({key:ta(o),value:function t(i,s,r,n){if(0>=r.remainingNodes)return{stringValue:tn};if(r.remainingNodes--,Y(i))return{boolValue:i};if("bigint"==typeof i)return function(e,t){let i=e.toString(),s=BigInt("9223372036854775808");return e>=s||-s>e?(null==t||t.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(i,s);if("number"==typeof i){if(!Number.isFinite(i))return{stringValue:String(i)};if(Number.isInteger(i)){if(Number.isSafeInteger(i))return{intValue:String(i)};if(typeof BigInt>"u")return{stringValue:String(i)};let e=BigInt(i).toString();return i>=0x7fffffffffffffff||-0x8000000000000000>i?(null==s||s.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:i}}if("string"==typeof i)return{stringValue:ta(i)};if("function"==typeof i)return{stringValue:"[Function]"};if("symbol"==typeof i)return{stringValue:String(i)};if("object"==typeof i&&null!==i){if(r.ancestors.has(i))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:tn};if(i instanceof Date){let e=Number.isFinite(i.getTime())?i.toISOString():String(i);return{stringValue:"string"==typeof e?ta(e):String(e)}}r.ancestors.add(i);try{try{let e=i.toJSON;if("function"==typeof e)return t(e.call(i),s,r,n+1)}catch(e){}return N(i)?{arrayValue:{values:function(e,i,s,r){let n=[],o=Math.min(e.length,1e3),a=0;for(;o>a&&s.remainingNodes>0;a++)try{let o=a in e?e[a]:void 0;if(W(o))continue;n.push(t(o,i,s,r))}catch(e){n.push({stringValue:to})}return e.length>a&&n.push({stringValue:tn}),n}(i,s,r,n+1)}}:{kvlistValue:{values:e(i,s,r,n+1)}}}finally{r.ancestors.delete(i)}}return{stringValue:ta(String(i))}}(a,i,s,r)})}catch(e){n.push({key:ta(o),value:{stringValue:to}})}}return n}(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function ir(e,t,i){return ty(ty(ty(ty({},tl({},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 io=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function ia(e,t){let i=tl({},e),s={};for(let e of io)({}).hasOwnProperty.call(i,e)&&(s[e]=i[e],delete i[e]);return[...is(i,t),...is(s,t)]}let il={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"},iu={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}},id=iu.info;function ih(e,t,i,s){return{resourceLogs:[{resource:{attributes:ia(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var ic=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=tv(()=>{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)}};function ip(){return .75+.5*Math.random()}function iv(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 ig=class{constructor(e,t,i,s,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Mr=t,this.$=i,this.cs=s,this.ds=r,this.vs=n,this.fs=o,this.ps=new ic(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ie,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)&&void 0!==a?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(P.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.Mr.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}=iu[e.level||"info"]||id,o=function(e=Date.now()){return String(e)+"000000"}(G(s)?s:void 0),a={};t.distinctId&&(a.posthogDistinctId=t.distinctId),t.sessionId&&(a.sessionId=t.sessionId),t.windowId&&(a["window.id"]=t.windowId),W(t.sessionStartTimestamp)||(a.sessionStartTimestamp=String(t.sessionStartTimestamp)),W(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=ty({},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=to}Object.defineProperty(l,t,{value:e,enumerable:!0,writable:!0,configurable:!0})}}let d={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:r,body:{stringValue:function(e){try{return ta(String(e))}catch(e){return to}}(e.body)},attributes:is(l,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),H(e.trace_flags)||(d.flags=e.trace_flags),d}(s,null!==(i=null==t?void 0:t.context)&&void 0!==i?i:this.cs(),this.$,null==t?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){let t=this.Mr.beforeSend;if(!t)return e;let i=N(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 ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return ea(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return ea(function*(){var t,i,s;e.ps.clear();let r=null!==(t=e._instance.getPersistedProperty(P.LogsQueue))&&void 0!==t?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=ih(a.map(e=>e.record),e.qs(),null!==(i=e.fs)&&void 0!==i?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 ${a.length} was too large for the ingestion endpoint, reducing batch size to ${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 
2is larger than the server cap and cannot be split further."):"ok"===u.kind&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(a.length),r=null!==(s=e._instance.getPersistedProperty(P.LogsQueue))&&void 0!==s?s:[],o+=a.length,"fatal"===u.kind))throw u.error}})()}Bs(e){var t=this;return ea(function*(){var i;let s=Math.max(0,e-t.bs),r=null!==(i=t._instance.getPersistedProperty(P.LogsQueue))&&void 0!==i?i:[];t._instance.setPersistedProperty(P.LogsQueue,r.slice(s)),yield t.vs()})()}qs(){return ir(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;let i=null!==(t=this._instance.getPersistedProperty(P.LogsQueue))&&void 0!==t?t:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(P.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(iv(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(P.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return ea(function*(){t.ps.clear();let i=t.flush().catch(()=>{});void 0!==e?yield tf(i,e):yield i})()}flushWithTimeout(e){var t=this;return ea(function*(){let i=t.flush();yield tf(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=ip(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};let i_=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function im(e){return String(e)+"000000"}function iy(e,t,i,s){let r="";return s&&(r=Object.keys(s).sort().map(e=>`${JSON.stringify(e)}:${JSON.stringify(s[e])}`).join(",")),`${e}\0${t}\0${null!=i?i:""}\0${r}`}var ib=class{constructor(e,t,i){this._instance=e,this.Mr=t,this.$=i,this.zs=new Map,this.ps=new ic(()=>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 ie,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){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=ea(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 '${s.name}': value must be a finite number`);if("count"===s.type&&0>s.value)return void this.$.warn(`Dropping count '${s.name}': counters are monotonic, value must be >= 0`);try{t=s.attributes?ty({},s.attributes):void 0,i=iy(s.type,s.name,s.unit,t)}catch(e){return void this.$.warn(`Dropping metric '${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);void 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 '${s.name}' is already used as a ${n}; recording it as a ${s.type} too will blend both series in charts. Use a distinct name.`)),this.Ys(r,s.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ys(e,t){switch(e.type){case"count":var i;e.total=(null!==(i=e.total)&&void 0!==i?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(i_.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,i_)]+=1}}}Os(e){let t=this.Mr.beforeSend;if(!t)return e;let i=N(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(iv(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return ea(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.Xs(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),"retry-later"===s.kind?(e.ks++,e.Ss=ip()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),s.kind){case"ok":return;case"retry-later":return e.lo(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.ao(e),i=ir(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ia(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]}}ao(e){let t=im(Date.now()),i=new Map;for(let o of e.values()){var s,r,n;let e=iy(o.type,o.name,o.unit,void 0),a=i.get(e);a||(a=ty({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=is(null!==(s=o.attributes)&&void 0!==s?s:{},this.$),u=im(o.windowStartMs);if("count"===o.type){let e={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:null!==(r=o.total)&&void 0!==r?r:0};a.sum.dataPoints.push(e)}else if("gauge"===o.type){let e={attributes:l,timeUnixNano:t,asDouble:null!==(n=o.last)&&void 0!==n?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:i_})}return Array.from(i.values())}lo(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)&&void 0!==t?t:0)+(null!==(i=r.total)&&void 0!==i?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)}}};let iw=(e,{debugEnabled:t}={})=>{let i={N(i,...s){l&&(x.DEBUG||l.POSTHOG_DEBUG||t)&&!H(l.console)&&l.console&&("__rrweb_original__"in l.console[i]?l.console[i].__rrweb_original__:l.console[i])(e,...s)},debug(...e){i.N("debug",...e)},info(...e){i.N("log",...e)},warn(...e){i.N("warn",...e)},error(...e){i.N("error",...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){i.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,i)=>iw(`${e} ${t}`,i)};return i},ix=iw("[PostHog.js]"),iE=ix.createLogger,i$=iE("[ExternalScriptsLoader]"),iS=e=>{let t=null==h?void 0:h.querySelectorAll("script");
2if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},ik=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return i$.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");let s=iS(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(!h)return i("document not found");if(iS(t))return ik(e,t,i);let s=h.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)h.head.appendChild(s);else{var r;let e=h.querySelectorAll("body > script");e.length>0?null===(r=e[0].parentNode)||void 0===r||r.insertBefore(s,e[0]):h.body.appendChild(s)}};(null==h?void 0:h.body)?r():null==h||h.addEventListener("DOMContentLoaded",r)},iP={},iM=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return"toolbar"===t&&(i=`${i}&t=${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/${e.config.token}/config.js`);return void ik(e,t,i)}let s=e.config.strict_script_versioning;if(s){let r=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),n=iP[r];if("fallback"===s&&n){if(iS(n))return void ik(e,n,i);delete iP[r]}return void ik(e,r,"fallback"===s?(s,n)=>{if(s){if("string"==typeof s)i(s);else{var o;let s=iM(e,t);iP[r]=s;let n=iS(r);null==n||null===(o=n.parentNode)||void 0===o||o.removeChild(n),ik(e,s,i)}}else i(void 0,n)}:i)}ik(e,iM(e,t),i)},b.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{let s=e.requestRouter.endpointFor("api",t);ik(e,s,i)},x.DEBUG=!1,x.LIB_VERSION="1.430.4",x.LIB_NAME="web";let iO="distinct_id",iT="$device_id",iF="$device_model",iC="__alias",iI="$fbc",iR="$fbc_persistence",iA="__timers",iL="$autocapture_disabled_server_side",iD="$heatmaps_enabled_server_side",iN="$exception_capture_enabled_server_side",ij="$error_tracking_suppression_rules",iB="$error_tracking_capture_extension_exceptions",iU="$web_vitals_enabled_server_side",iH="$dead_clicks_enabled_server_side",iz="$product_tours_enabled_server_side",iq="$logs_capture_enabled_server_side",iV="$web_vitals_allowed_metrics",iW="$session_recording_remote_config",iG="$sesid",iK="$session_is_sampled",iY="$enabled_feature_flags",iJ="$active_feature_flags",iX="$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",i6="$stored_group_properties",i4="$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",sd="$initial_referrer_info",sh="$initial_person_info",sc="$epp",sp="$posthog_cookieless",sv="$cookieless_mode",sf="$sdk_debug_extensions_init_method",sg="$sdk_debug_extensions_init_time_ms",s_="$sdk_debug_recording_script_not_loaded",sm="PostHog loadExternalDependency extension not found.",sy="anonymous",sb="identified",sw="identified_only",sx="visibilitychange",sE="beforeunload",s$="$pageview",sS="$pageleave",sk="$identify",sP="$groupidentify";function sM(e,t){N(e)&&e.forEach(t)}function sO(e,t){if(!W(e)){if(N(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(let i in e)L.call(e,i)&&t(e[i],i)}}let sT=function(e,...t){for(let i of t)for(let t in i)void 0!==i[t]&&(e[t]=i[t]);return e};function sF(e){let t=Object.keys(e),i=t.length,s=Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}let sC=function(e){return function(...t){try{return e.apply(this,t)}catch(e){ix.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ix.critical(e)}}},sI=function(e){let t={};return sO(e,function(e,i){(z(e)&&e.length>0||G(e))&&(t[i]=e)}),t};function sR(e){let t=ty({},e);for(let i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch(e){}return t}let sA=["herokuapp.com","vercel.app","netlify.app"];function sL(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 sD(e){return"ph_toolbar_internal"===e.name}let sN=e=>{if(h){try{let t=e+"=",i=h.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 G(e)&&isFinite(e)&&Math.floor(e)===e});var sj=class e{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}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>1073741823||r>4294967295)throw RangeError("invalid field value");let n=new Uint8Array(16);return n[0]=t/1099511627776,n[1]=t/4294967296,n[2]=t/16777216,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>
2>>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}},sB=class{generate(){let e=this.generateOrAbort();if(!H(e))return e;{this.Ct=0;let e=this.generateOrAbort();if(H(e))throw Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){let e=(()=>{let e=Date.now();return G(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>4398046511103&&(this.Ct++,this.Mt())}return sj.fromFieldsV7(this.Ct,Math.trunc(this.It/1073741824),1073741823&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 sH}};let sU=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&&!H(l.crypto)&&crypto.getRandomValues&&(sU=e=>crypto.getRandomValues(e));var sH=class{nextUint32(){return this.Rt.length>this.$t||(sU(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let sz=()=>sq().toString(),sq=()=>(a||(a=new sB)).generate(),sV="",sW=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,sG=null,sK={Et(){if(!V(sG))return sG;if(sG=!1,h)try{let e=`__ph_cookie_support_${sz()}`;sK.At(e,"xyz"),sG='"xyz"'===sN(e),sK.Lt(e)}catch(e){sG=!1}return sG},Pt(e){ix.error("cookieStore error: "+e)},Ot:sN,Dt(e){let t;try{t=JSON.parse(sK.Ot(e))||{}}catch(e){}return t},At(e,t,i,s,r){if(!h)return!1;try{let n="",o="",a=function(e,t){if(t){let t=function(e,t=h){if(sV)return sV;if(!t||["localhost","127.0.0.1"].includes(e))return"";let i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+sz();for(;!sV&&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",sV=e)}return sV}(e);if(!t){let i=(e=>{let t=e.match(sW);return t?t[0]:""})(e);i!==t&&ix.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}(h.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&&ix.warn("cookieStore warning: large cookie, len="+l.length),h.cookie=l,!0}catch(e){return!1}},Lt(e,t){if(null==h?void 0:h.cookie)try{sK.At(e,"",-1,t)}catch(e){return}}},sY=null,sJ={Et(){if(!V(sY))return sY;let e=!0;if(H(l))e=!1;else try{let t="__mplssupport__";sJ.At(t,"xyz"),'"xyz"'!==sJ.Ot(t)&&(e=!1),sJ.Lt(t)}catch(t){e=!1}return e||ix.error("localStorage unsupported; falling back to cookie store"),sY=e,e},Pt(e){ix.error("localStorage error: "+e)},Ot(e){try{return null==l?void 0:l.localStorage.getItem(e)}catch(e){sJ.Pt(e)}return null},Dt(e){try{return JSON.parse(sJ.Ot(e))||{}}catch(e){}return null},At(e,t){try{return null==l||l.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){sJ.Pt(e)}return!1},Lt(e){try{null==l||l.localStorage.removeItem(e)}catch(e){sJ.Pt(e)}}},sX=[i5,iJ,iY,iZ,iQ,i0,so,sn,ss],sZ=[iT,iO,iG,iK,sc,sh,iR,sa],sQ=e=>e+"_cpm",s0=["__proto__","constructor","prototype"],s1=e=>{if(!B(e))return{};let t={};return Object.keys(e).forEach(i=>{-1===s0.indexOf(i)&&(t[i]=e[i])}),t},s2=(e,t=[])=>{let i={};return[...sZ,...t].forEach(t=>{let s=e[t];H(s)||V(s)||""===s||(i[t]=s)}),i},s3=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){let r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},s5=(e,t)=>({p:t,f:s3(JSON.stringify(e))}),s6=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let i=sK.Dt(sQ(e)),s=(null==i?void 0:i.f)===s3(t)&&N(i.p);return{properties:s?i.p:[],isValid:s}}catch(e){return{properties:[],isValid:!1}}},s4=(e,t)=>
2t+"|"+(sK.Ot(sQ(e))||""),s8={},s9={Et:()=>!0,Pt(e){ix.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(!V(s7))return s7;if(s7=!0,H(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){ix.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{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}isOptedOut(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.Fo.At(this.Oo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){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 Ao(){let e=this.Fo.Ot(this.Oo);return er(e)?1:F(en,e)?0:-1}get Fo(){let e=this.Mr.opt_out_capturing_persistence_type,t="localStorage"===e?sJ:sK,i=t.Et()?t:s9;if(!this.Do||this.Do!==i){this.Do=i;let t="localStorage"===e?sK:sJ;t.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(er(t.Ot(this.Oo))),t.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[null==d?void 0:d.doNotTrack,null==d?void 0:d.msDoNotTrack,b.doNotTrack,null==d?void 0:d.globalPrivacyControl].some(e=>er(e))}};function ri(e,t){var i;let s=null==e||null===(i=e.config)||void 0===i?void 0:i.get_current_url;if(!j(s))return t;try{let e=s(t);return z(e)&&e?e:t}catch(e){return ix.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?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?C(e).split(/\s+/):[]}function ru(e,t){let i=function(e){var t;let i=null==l||null===(t=l.location)||void 0===t?void 0:t.href;return H(i)?void 0:ri(e,i)}(t);return!!(i&&e&&e.some(e=>i.match(e)))}function rd(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 rh(e){return W(e)?null:C(e).split(/(\s+)/).filter(e=>rA(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rc(e){let t="";return rP(e)&&!rM(e)&&e.childNodes&&e.childNodes.length&&sO(e.childNodes,function(e){var i;ro(e)&&e.textContent&&(t+=null!==(i=rh(e.textContent))&&void 0!==i?i:"")}),C(t)}function rp(e){var t;return H(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}let rv=["a","button","form","input","select","textarea","label"];function rf(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 rg(e,t){if(H(t))return!0;for(let i of e)if(t.some(e=>rf(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"],r
2E=["","text","search","email","password","url","tel","number"];function r$(e,t){var i,s,r;let n,o,a;if(!l||rS(e)||(Y(t)?(n=!!t&&rx,o=void 0,a=!1):(n=null!==(i=null==t?void 0:t.css_selector_ignorelist)&&void 0!==i?i:rx,o=null==t?void 0:t.content_ignorelist,a=null!==(s=null==t?void 0:t.ignore_text_selection)&&void 0!==s&&s),!1===n)||a&&!(!(r=e)||!rr(r))&&(rn(r,"textarea")||(rn(r,"input")?F(rE,(r.getAttribute("type")||"").toLowerCase()):function(e){var t;if(e.isContentEditable)return!0;let i=null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return"true"===i||""===i}(r))))return!1;let{targetElementList:u}=rk(e,!1);return!function(e,t){let i;if(!1===e||H(e))return!1;if(!0===e)i=ry;else{if(!N(e))return!1;if(e.length>10)return ix.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(({safeText:e,ariaLabel:t})=>i.some(i=>rw(e,i)||rw(t,i)))}(o,u.map(e=>{var t;return{safeText:rc(e).toLowerCase(),ariaLabel:(null===(t=e.getAttribute("aria-label"))||void 0===t?void 0:t.toLowerCase().trim())||""}}))&&!rg(u,n)}let rS=e=>!e||rn(e,"html")||!rr(e),rk=(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||rv.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=rd(s);if(F(e,"ph-sensitive")||F(e,"ph-no-capture"))return!1}if(F(rd(e),"ph-include"))return!0;let s=e.type||"";if(z(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}let r=e.name||e.id||"";return!z(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 rM(e){return!!(rn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rn(e,"select")||rn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}let rO=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}))$"),rT=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,rF=[16,15,14,13],rC=RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),rI=RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),rR=/[0-9A-Za-z_]/;function rA(e,t=!0){return!(W(e)||z(e)&&(e=C(e),(t?rO.test((e||"").replace(/[- ]/g,"")):function(e){let t;for(rT.lastIndex=0;t=rT.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 rF){let s=e+t;if(i.length>=s){let t=i.slice(e,s);if(rO.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(rI.lastIndex=0;t=rI.exec(e);){let e=t[1],i=t[3];if(!(e&&i&&rR.test(e)&&rR.test(i)))return!0}return!1}(e))))}function rL(e){let t=rc(e);return rA(t=`${t} ${(function e(t){let i="";return t&&t.childNodes&&t.childNodes.length&&sO(t.childNodes,function(t){var s;if(t&&"span"===(null===(s=t.tagName)||void 0===s?void 0:s.toLowerCase()))try{let s=rc(t);i=`${i} ${s}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${e(t)}`.trim())}catch(e){ix.error("[AutoCapture]",e)}}),i})(e)}`.trim())?t:""}function rD(e){return e.replace(/"|\\"/g,'\\"')}let rN=iE("[Dead Clicks]"),rj=()=>!0,rB=e=>{var t;let i=!!(null===(t=e.instance.persistence)||void 0===t?void 0:t.get_property(iH)),s=e.instance.config.capture_dead_clicks;return Y(s)?s:!!B(s)||i};var rU=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}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.No(()=>{this.qo()}):this.stop()}No(e){var t,i,s;(null===(t=b.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)?e():null===(i=b.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this.instance,"dead-clicks-autocapture",t=>{t?rN.error("failed to load script",t):e()})}qo(){var e;if(h){if(!this.Lo&&(null===(e=b.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)){let e=B(this.instance.config.capture_dead_clicks)?ty({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=!1),this.Lo=b.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Lo.start(h),rN.info("starting...")}}else rN.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,rN.info("stopping..."))}};let rH=iE("[SegmentIntegration]");function rz(e,t,i=!0){let s=e.config.segment;if(!s)return t();let{analytics:r,filterProperties:n}=j(s.register)?{analytics:s}:s;!function(e,t,i,s){let r=t=>{let r=()=>t.anonymousId()||sz();e.config.get_device_id=r,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:r()}),e.persistence.set_property(sa,sb)),i(s?void 0:t.anonymousId()||void 0)},n=t.user();"then"in n&&j(n.then)?n.then(r):r(n)}(e,r,i=>{r.register(((e,t,{filterProperties:i}={})=>{"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)
2);let o=e.calculateEventProperties(r,s.event.properties);if(!W(i)){let e=s.event.properties||{},t={};for(let i of Object.keys(o))L.call(e,i)||(t[i]=o[i]);let r=((e,t)=>{let i=N(e)?e:[e],s=ty({},t);for(let e of i)try{if(s=e(s),W(s))return null}catch(e){return rH.error("Error in Segment filterProperties:",e),null}return s})(i,t);if(W(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,s$),identify:e=>s(e,sk),screen:e=>s(e,"$screen")}})(e,i,{filterProperties:n})).then(()=>{t()},e=>{rH.error("Failed to register the Segment integration",e),t()})},i)}let rq="posthog-js";function rV(e,{organization:t,projectId:i,prefix:s,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,u,d,h,c;if("*"!==r&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});let p=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${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 v=(null===(a=o.exception)||void 0===a?void 0:a.values)||[],f=v.map(e=>ty(ty({},e),{},{stacktrace:e.stacktrace?ty(ty({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>ty(ty({},e),{},{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null===(l=v[0])||void 0===l?void 0:l.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(d=v[0])||void 0===d?void 0:d.value)||o.message,$sentry_exception_type:null===(h=v[0])||void 0===h?void 0:h.type,$sentry_tags:o.tags};return t&&i&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),n&&(null===(c=e.exceptions)||void 0===c||c.sendExceptionEvent(g)),o}}var rW=class{constructor(e,t,i,s,r,n){this.name=rq,this.setupOnce=function(o){o(rV(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}},rG=class{constructor(e){this.jo=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ix.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Ho()}Ho(){var e;this.zo=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(this.jo)}destroy(){var e;null===(e=this.zo)||void 0===e||e.call(this),this.zo=void 0}doPageView(e,t){var i;let s=this.Uo(e,t);return this.Bo={pathname:null!==(i=null==l?void 0:l.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Uo(e,null===(t=this.Bo)||void 0===t?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null===(e=this.Bo)||void 0===e?void 0:e.pageViewId}}Uo(e,t){let i=this.Bo;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(!(H(e)||H(t)||H(i)||H(n)||H(o)||H(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?ed(t/e,0,1,ix):1,l=e>1?ed(i/e,0,1,ix):1,u=n>1?ed(o/n,0,1,ix):1,d=n>1?ed(a/n,0,1,ix):1;s=sT(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:d})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};let rK=["flags","surveys"],rY={$people_distinct_id:{exposure:"hidden"},[iC]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[iA]:{exposure:"hidden"},[iR]:{exposure:"hidden"},[iL]:{exposure:"event"},[iD]:{exposure:"hidden"},[iq]:{exposure:"hidden"},[iN]:{exposure:"event"},[ij]:{exposure:"hidden"},[iB]:{exposure:"event"},[iU]:{exposure:"event"}
2,[iH]:{exposure:"event"},[iz]:{exposure:"hidden"},[iV]:{exposure:"event"},[iW]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[iG]:{exposure:"hidden"},[iK]:{exposure:"event"},$replay_sample_rate:{exposure:"event",shouldSkipFromEventProperties:e=>V(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"},[iY]:{exposure:"hidden",storageGroup:"flags"},[iJ]:{exposure:"hidden",storageGroup:"flags"},[iX]:{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"},[i6]:{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"},[i4]:{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"},[sd]:{exposure:"hidden"},[sh]:{exposure:"hidden"},[sc]:{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"},[sf]:{exposure:"event"},[sg]:{exposure:"event"},[s_]:{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"}
2,$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"}]],rX=e=>{let t=rY[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)=>{var s;return ee(t)?(null!==(s=i)&&void 0!==s||(i=new WeakMap),i.has(t)||i.set(t,sR(t)),i.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return R(e)}},rQ=e=>{let t=null==h?void 0:h.createElement("a");return H(t)?null:(t.href=e,t)},r0=function(e,t){let i;let 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(!N(i)||2>i.length)return"";{let e=i[1];try{e=decodeURIComponent(e)}catch(t){ix.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("=");N(s)&&(t.includes(s[0])?u.push(s[0]+"="+i):u.push(l[e]))}let d=a;return null!=o&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},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},r6=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],r4=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...r6],r8="<masked>",r9=["li_fat_id"];function r7(e,t,i){if(!h)return{};let s=t?[...r6,...i||[]]:[],r=ne(r1(h.URL,s,r8),e);return sT(function(){let e={};return sO(r9,function(t){let i=sN(t);e[t]=i||null}),e}(),r)}function ne(e,t){let i=r4.concat(t||[]),s={};return sO(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(!V(t)){i.$search_engine=t;let e=h?r0(h.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==h?void 0:h.referrer)||ns}function nn(e,t,i=!1){let s=e?[...r6,...t||[]]:[],r=i?tc(null==c?void 0:c.href):null==c?void 0:c.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,t=!1){var i;let{r:s,u:r}=e,n=t?tc(r):r,o={$referrer:s,$referring_domain:null==s?void 0:s==ns?ns:null===(i=rQ(s))||void 0===i?void 0:i.host};
2if(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,sT(o,ne(n))}return s&&sT(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"],nd=e=>`${e}_cookie_identity_change_pending`,nh=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},nc="main",np=[iY,iJ,iZ,iQ,i0,so,i1,i5],nv=e=>-1!==np.indexOf(e),nf=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(i){return e===t}},ng=e=>{if(!e)return{};let t=JSON.parse(e);return B(t)?t:{}},n_=(e,t)=>{sO(e,(i,s)=>{let r=rX(s);r&&"event"!==r.exposure||({}).hasOwnProperty.call(t,s)||delete e[s]})};var nm=class{constructor(e,t,i=!0){let s;if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Yo=!1,this.Xo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=e,this.nl=i,this.props={},this.sl=void 0,this.rl=(s="",e.token&&(s=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+s+"_posthog"),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&ix.info("Persistence loaded",e.persistence,ty({},this.props)),this.update_config(e,e,t),this.save(),l){let e=()=>this.flush();sL(l,"beforeunload",e,{capture:!1}),sL(l,"pagehide",e,{capture:!1}),this.ul=e=>{if(this.Vo&&(!e.storageArea||e.storageArea===(null==l?void 0:l.localStorage))&&e.key){if(e.key!==this.rl){if(this.Zo){let t=rK.find(t=>e.key===this.hl(t));t&&this.cl(e.key,t)}}else this.cl(e.key,nc)}},sL(l,"storage",this.ul)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([e,t])=>{let i=this.Ko.get(e);if(!nv(e)||!0===i)return;if(!0===t)return void this.dl(e,!0);let s=new Set(i||[]);t.forEach(e=>s.add(e)),s.size&&this.dl(e,s)})}onCrossTabFeatureFlagChange(e){return this.il.add(e),()=>this.il.delete(e)}destroy(){this.ul&&l&&(l.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(e,t,i=!0){let s,r;if(this.pi)return!1;try{if(r=sJ.Ot(e),V(r)){let e=this.vl(t);return e.storageValue=null,t!==nc&&(e.persisted=!1),!1}s=ng(r)}catch(e){return!1}let n=t===nc?s:sJ.Dt(this.rl);if(n&&this.fl(n))return!1;let o=this.pl(s,t,i);return t===nc&&this.Zo&&!nf(this.gl().main,s)||this.ml(s,t,!0,r),o}fl(e){let t=this.props[iO],i=e[iO];return!H(t)&&!H(i)&&t!==i}ml(e,t,i,s){let r=this.vl(t);r.storageValue=s,t!==nc&&(r.persisted=i);try{r.fingerprint=this.yl(e,t)}catch(e){r.fingerprint=void 0}}pl(e,t,i){let s=!1;return np.forEach(i=>{var r;let n=null===(r=rX(i))||void 0===r?void 0:r.storageGroup;if(t===nc&&this.Zo&&n||t!==nc&&n!==t)return;let o=i in e,a=this.bl(i,o?e[i]:void 0),l=this.Ko.has(i)?i in this.props:o;l===i in this.props&&nf(a,this.props[i])||(l?this._l(i,a,!1):this.wl(i,!1),s=!0)}),s&&i&&this.il.forEach(e=>e()),s}kl(){if(!this.Vo)return!1;try{this.tl=!1;let e=sJ.Ot(this.rl),t=this.vl(nc),i,s=!1,r=!1;if(e!==t.storageValue){if(V(e))t.storageValue=null;else{if(i=ng(e),this.tl=!this.Xo&&this.fl(i),this.tl)return!1;r=this.pl(i,nc,!1),!this.Zo||nf(this.gl().main,i)?this.ml(i,nc,!0,e):t.storageValue=e,s=!0}}return this.Zo&&rK.forEach(e=>{let t=sJ.Ot(this.hl(e)),n=this.vl(e),o=i||{},a=s&&np.some(t=>{var i;return(null===(i=rX(t))||void 0===i?void 0:i.storageGroup)===e&&t in o});if(t===n.storageValue&&!a)return;if(V(t))return n.storageValue=null,n.persisted=!1,void(a&&(r=this.pl(o,e,!1)||r));let l=ng(t);r=this.pl(l,e,!1)||r,this.ml(l,e,!0,t)}),r}catch(e){return!1}}dl(e,t){this.Ko.set(e,t);let i=rX(e);(null==i?void 0:i.volatile)||(this.vl((this.Zo?null==i?void 0:i.storageGroup:void 0)||nc).fingerprint=void 0,this.Sl(e))}xl(){np.forEach(e=>this.Ko.set(e,!0))}al(){if(this.Vo)try{let e=sJ.Ot(this.rl),t=ng(e);this.vl(nc).storageValue=e,np.forEach(e=>{var i;let s=this.Zo?null===(i=rX(e))||void 0===i?void 0:i.storageGroup:void 0,r=s?sJ.Ot(this.hl(s)):null;if(s){let e=this.vl(s);e.storageValue=r,e.persisted=!V(r)}let n=s&&!V(r)?ng(r):t;e in this.props?this.Cl(e,n[e],this.props[e]):e in n&&this.dl(e,!0)})}catch(e){}}bl(e,t){let i=this.Ko.get(e);if(!i)return t;if(!0===i)return this.props[e];if("$active_feature_flags"===e){let s=new Set(N(t)?t:[]),r=new Set(N(this.props[e])?this.props[e]:[]);
2return i.forEach(e=>r.has(e)?s.add(e):s.delete(e)),Array.from(s)}let s=B(t)?ty({},t):{},r=B(this.props[e])?this.props[e]:{};return i.forEach(e=>{e in r?s[e]=r[e]:delete s[e]}),s}Cl(e,t,i){if(!nv(e))return;let s=this.Ko.get(e);if(!0===s)return;let r=t;if(this.Vo)try{var n;let t=this.Zo?null===(n=rX(e))||void 0===n?void 0:n.storageGroup:void 0,i=t?this.hl(t):this.rl;r=ng(sJ.Ot(i))[e]}catch(e){}let o=new Set(s||[]);if("$active_feature_flags"===e){if(!H(t)&&!N(t)||!H(r)&&!N(r)||!N(i))return void this.dl(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(!B(i))return void(nf(r,i)?this.Ko.delete(e):this.dl(e,!0));{if(!H(t)&&!B(t)||H(t)&&U(i)&&H(r))return void this.dl(e,!0);let s=B(t)?t:{},n=B(r)?r:{};new Set([...Object.keys(s),...Object.keys(i)]).forEach(e=>{e in s==e in i&&nf(s[e],i[e])||o.add(e)}),o.forEach(e=>{e in n==e in i&&nf(n[e],i[e])&&o.delete(e)})}}o.size?this.dl(e,o):this.Ko.delete(e)}$l(){var e;let t=null===(e=this.Mr)||void 0===e?void 0:e.persistence_save_debounce_ms;return G(t)&&t>0?t:0}Tl(e){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()){if(e)try{let t=s2(e,this.Mr.cookie_persisted_properties||[]),i=s5(t,this.Mr.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=sK.Ot(this.rl)||void 0;r&&s4(this.rl,r)===s&&(this.Il=s,this.Ml=r)}catch(e){}else try{let e=sK.Ot(this.rl)||void 0;this.Il=e?s4(this.rl,e):void 0,this.Ml=e}catch(e){}}}syncCookieProperties(){return this.El(this.Mr)}El(e,t=!1){let i,s;if(this.pi&&!t||this.Jo||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;try{i=sK.Ot(this.rl)||void 0}catch(e){}if(!i||i===this.Ml)return!1;let r=s4(this.rl,i);try{s=s1(JSON.parse(i))}catch(e){return!1}if((sK.Ot(this.rl)||void 0)!==i)return!1;this.Il=r,this.Ml=i;let n=s6(this.rl,i),o=[...sZ,...n.properties],a={};if(Object.keys(s).forEach(e=>{let t=s[e];(H(t)||V(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(a[e]=!0,delete s[e])}),U(s))return!1;let l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,d=u[iO],h=u[sa],c=sT({},u);[...sZ,...e.cookie_persisted_properties||[]].forEach(e=>{if(-1!==o.indexOf(e)&&!(e in s)&&!a[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){let t=c[e];(n.isValid||-1===sZ.indexOf(e)||!1!==t&&0!==t)&&delete c[e]}}
2),this.props=sT(c,s),np.forEach(e=>{let t=e in this.props;e in u===t&&nf(u[e],this.props[e])||(t?this.Cl(e,u[e],this.props[e]):this.dl(e,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this._l(sa,sy);let p=this.props[iO],v=this.props[sa];return l&&(p!==d||v!==h)&&(this.Xo=!0,this.Qo=!0,re.At(nd(this.rl),!0),this.wl(i5),this.wl(iJ),this.wl(iY),this.wl(iZ),this.wl(iQ),this.wl(i0),this.wl(so),this.wl(sn),this.wl(ss),"anonymous"!==v||"identified"!==h&&"anonymous"!==s.$user_state&&(H(d)||p===d)||(n_(this.props,s),this.wl(i6)),"identified"===v?this.props.$user_id=p:delete this.props.$user_id,this.wl(iC)),!0}consumeCookieIdentityChange(){let e=nd(this.rl),t=this.Qo||!!re.Ot(e);return this.Qo=!1,t&&re.Lt(e),t}Pl(e=!1){return!(this.Jo||this.pi&&!e||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}Rl(){this.Jo&&(H(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[nc],this.Fl(!0))}Ol(e=!0){if(this.Jo)try{e?this.Rl():H(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){-1===nu.indexOf(e.persistence.toLowerCase())&&(ix.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");let t=((e=[],t=!1)=>{let i=[...sZ,...e];return ty(ty({},sJ),{},{Dt(e){try{let r,n,o={};try{o=(n=sK.Ot(e)||void 0)?s1(JSON.parse(n)):{}}catch(e){}let a=JSON.parse(sJ.Ot(e)||"{}");if(t){let t=s6(e,n),l=[...sZ,...t.properties],u={};Object.keys(o).forEach(e=>{let t=o[e];V(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});let d="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var s;let e=a[iO],r=null!==(s=a.$user_state)&&void 0!==s?s:sy;i.forEach(e=>{if(-1!==l.indexOf(e)&&!(e in o)&&(d||"distinct_id"!==e&&"$user_state"!==e)){let i=a[e];(t.isValid||-1===sZ.indexOf(e)||!1!==i&&0!==i)&&delete a[e]}}),!d||"$user_state"in o||"$user_state"in a||(a[sa]=sy),d&&(("distinct_id"in u?u[iO]:a[iO])!==e||("$user_state"in u?u[sa]:a[sa])!==r)&&(sX.forEach(e=>delete a[e]),"identified"===u.$user_state&&"distinct_id"in u?a.$user_id=u[iO]:delete a.$user_id,"identified"!==u.$user_state&&(delete a[i4],delete a[i6]),delete a.__alias)}r=sT(a,u)}else r=sT(o,a);return sJ.At(e,r),r}catch(e){}return null},At(i,s,r,n,o,a){let l=sJ.At(i,s,void 0,void 0,a);try{let u=s2(s,e);if(Object.keys(u).length){if(t){let t=sQ(i),d=s5(u,e);if(sK.At(t,d,r,n,o,a),sK.Ot(t)!==JSON.stringify(d)){sK.Lt(t,n);let e=s2(s);return sK.At(i,e,r,n,o,a),l}}sK.At(i,u,r,n,o,a)}}catch(e){sJ.Pt(e)}return l},Lt(e,t){try{null==l||l.localStorage.removeItem(e),sK.Lt(e,t),sK.Lt(sQ(e),t)}catch(e){sJ.Pt(e)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i,s=!1,r=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&sJ.Et()?(i=sJ,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&&sK.Et()?(i=sK,s=!0):t.Et()?(i=t,r=!0,s=!0):sK.Et()?(i=sK,s=!0):i=s9,this.Vo=r,this.Go=s,i}hl(e){return`${this.rl}__${e}`}ll(e){return this.Vo&&!!e.split_storage}properties(){let e={};return sO(this.props,(t,i)=>{let s=rX(i);if(!s||"event"===s.exposure){var r;if(null==s||null===(r=s.shouldSkipFromEventProperties)||void 0===r?void 0:r.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.pi&&!e)return;let t=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=t?sJ.Dt(this.rl):null,s={};if(t)try{s=s1(sK.Dt(this.rl)),sO(s,(e,t)=>{(H(e)||V(e)||""===e)&&delete s[t]})}catch(e){}let r=this.Fo.Dt(this.rl);if(r&&(this.props=sT({},r)),this.Zo&&this.Dl(),t&&r){var n,o;let e=null==i?void 0:i[iO],t=null!==(n=null==i?void 0:i.$user_state)&&void 0!==n?n:sy,a=r[iO],l=null!==(o=r.$user_state)&&void 0!==o?o:sy;if(a!==e||l!==t){this.Qo=!0,re.At(nd(this.rl),!0);let i=sT({},this.props);sX.forEach(e=>delete i[e]),"anonymous"!==l||"identified"!==t&&"anonymous"!==s.$user_state&&(H(e)||a===e)||(n_(i,s),delete i[i6]),this.props=i;let r=new Set;sX.forEach(e=>{var t;let i=null===(t=rX(e))||void 0===t?void 0:t.storageGroup;i&&r.add(i)}
2),r.forEach(e=>{let t={};sO(this.props,(i,s)=>{var r;(null===(r=rX(s))||void 0===r?void 0:r.storageGroup)===e&&(t[s]=i)}),U(t)?(sJ.Lt(this.hl(e)),this.Wo[e]={}):sJ.At(this.hl(e),t)&&(this.Wo[e]={persisted:!0,fingerprint:this.yl(t,e)})})}}re.Ot(nd(this.rl))&&(this.Qo=!0)}Dl(){for(let e of rK){let t=sJ.Dt(this.hl(e));if(t&&!U(t)){let i=this.vl(e);i.persisted=!0,this.Ll(e)||(i.fingerprint=this.yl(t,e)),this.Nl(e,t)||sT(this.props,t)}}}Ll(e){return Object.keys(this.props).some(t=>{var i;return(null===(i=rX(t))||void 0===i?void 0:i.storageGroup)===e})}Nl(e,t){let i=nl[e];if(!i)return!1;let s=t[i],r=this.props[i];return G(s)&&G(r)&&r>s}refreshKey(e){var t;if(this.pi||"$fbc_persistence"===e&&this.el)return;let i=this.Zo?null===(t=rX(e))||void 0===t?void 0:t.storageGroup:void 0,s=i?sJ.Dt(this.hl(i)):this.Fo.Dt(this.rl);if(s&&e in s)this._l(e,s[e],!1);else{if(i){let t=this.Fo.Dt(this.rl);if(t&&e in t)return void this._l(e,t[e],!1)}this.wl(e,!1)}}save(){if(this.pi)return;let e=this.$l();e>0?H(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},e)):this.Fl()}flush(){H(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(e=!1){if(this.pi||this.Jo&&!e)return;e||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(iR));let t=!e&&!this.Yo;t||(this.tl=!1);let i=!!t&&this.kl();if(this.tl)return void(this.Mr.debug&&ix.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(i&&this.il.forEach(e=>e()));let s=this.jl(this.Fo,this.rl,this.props,nc);"written"===s&&this.Tl(this.props),"failed"!==s&&(this.Ko.clear(),this.Xo=!1,this.el=!1),i&&this.il.forEach(e=>e())}ql(){let{main:e,groups:t}=this.gl(),i=this.jl(this.Fo,this.rl,e,nc);for(let r of("written"===i&&this.Tl(e),"failed"!==i&&(this.Xo=!1,this.el=!1,np.forEach(e=>{var t;(null===(t=rX(e))||void 0===t?void 0:t.storageGroup)||this.Ko.delete(e)})),rK)){var s;let e=t[r];if(U(e)&&!(null===(s=this.Wo[r])||void 0===s?void 0:s.persisted)){np.forEach(e=>{var t;(null===(t=rX(e))||void 0===t?void 0:t.storageGroup)===r&&this.Ko.delete(e)});continue}let i=this.jl(sJ,this.hl(r),e,r);"failed"!==i&&np.forEach(e=>{let t=rX(e);(null==t?void 0:t.storageGroup)!==r||"written"!==i&&t.volatile||this.Ko.delete(e)})}}gl(){let e={},t={flags:{},surveys:{}};return sO(this.props,(i,s)=>{var r;let n=null===(r=rX(s))||void 0===r?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}yl(e,t){if(t===nc)return JSON.stringify(e)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;let i={};return sO(e,(e,t)=>{var s;i[t]=(null===(s=rX(t))||void 0===s?void 0:s.volatile)?"__volatile__":e}),JSON.stringify(i)}jl(e,t,i,s){let r;let n=this.vl(s);if(s!==nc&&!n.dirty&&!H(n.fingerprint))return"skipped";try{if((r=this.yl(i,s))===n.fingerprint)return n.dirty=!1,"skipped"}catch(e){r=void 0}return e.At(t,i,this.Bl,this.Hl,this.zl,this.Mr.debug)?(n.dirty=!1,s!==nc&&(n.persisted=!0),H(r)||(n.fingerprint=r),this.Vo&&(n.storageValue=sJ.Ot(t)),"written"):(this.Mr.debug&&ix.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.xl(),H(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!e&&this.nl)for(let e of rK)sJ.Lt(this.hl(e));e?delete this.Wo[nc]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(B(e)){this.syncCookieProperties(),H(t)&&(t="None"),this.Bl=H(i)?this.Ul:i;let s=!1;if(sO(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this._l(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(B(e)){this.syncCookieProperties(),this.Bl=H(t)?this.Ul:t;let i=!1;if(sO(e,(t,s)=>{e.hasOwnProperty(s)&&(this.props[s]!==t||B(t)||N(t))&&(this._l(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.wl(i),t=!0);t&&this.save()}update_campaign_params(){let e=null==h?void 0:h.URL;if(e===this.sl)return;let t=r7(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!U(sI(t));return i&&this.register(t),this.sl=e,i?t:void 0}update_search_keyword(){this.register(function(){let e=null==h?void 0:h.referrer;return e?nt(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:nr(),$referring_domain:(null==h?void 0:h.referrer)&&(null===(e=rQ(h.referrer))||void 0===e?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.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes
2);this.register_once({[sh]:this.Go?{r:nh(e.r),u:e.u?nh(e.u):void 0}:e},void 0)}get_initial_props(){let e={};sO([sd,su],t=>{let i=this.props[t];i&&sO(i,function(t,i){e["$initial_"+I(i)]=t})});let t=this.props[sh];return t&&sT(e,function(e,t=!1){let i=no(e,t),s={};return sO(i,function(e,t){s[`$initial_${I(t)}`]=e}),s}(t,this.Mr.disable_capture_url_hashes)),e}safe_merge(e){return sO(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.pi&&!a;a||this.El(t,l),this.Mr=e,!a&&(s||r||o)&&(this.Il=void 0,this.Ml=void 0,this.El(ty(ty({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));let u=n||o?this.ol(e):this.Fo;this.Wl();let d=this.ll(e),h=n||d!==this.Zo,c=!a&&(h||e.cross_subdomain_cookie!==this.Hl||e.secure_cookie!==this.zl)&&this.Pl(l);this.Yo=h;try{if(this.Ul=this.Bl=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){let e=this.props;this.clear(),this.Fo=u,this.Zo=d,this.props=e,this.save()}else o&&(this.Fo=u,a||(delete this.Wo[nc],this.Fl()))}finally{this.Yo=!1,c&&this.Ol()}}Wl(){let e=this.props[sh];if(!this.Go||!B(e)||"string"!=typeof e.r)return;let t=nh(e.r),i="string"==typeof e.u?nh(e.u):e.u;t===e.r&&i===e.u||this._l(sh,ty(ty({},e),{},{r:t,u:i}))}set_disabled(e){this.pi=e,this.pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Hl&&(this.Hl=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let i=this.props.__timers||{};i[e]=t,this._l(iA,i),this.save()}remove_event_timer(e){let t=this.props.__timers||{},i=t[e];return H(i)||(delete t[e],this._l(iA,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this._l(e,t),this.save()}_l(e,t,i=!0){var s;let r=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this.Xo=!0),"$fbc_persistence"!==e||nf(r,t)||(this.el=!0),this.Cl(e,r,t),(null===(s=rX(e))||void 0===s?void 0:s.volatile)||this.Sl(e))}wl(e,t=!0){delete this.props[e],t&&(nv(e)&&this.dl(e,!0),"$fbc_persistence"===e&&(this.el=!0),this.Sl(e))}Sl(e){var t;let i=null===(t=rX(e))||void 0===t?void 0:t.storageGroup;i&&(this.vl(i).dirty=!0)}vl(e){return this.Wo[e]||(this.Wo[e]={})}};let ny={GZipJS:"gzip-js",Base64:"base64"},nb={Activation:"events",Cancellation:"cancelEvents"},nw={Button:"button",Tab:"tab",Selector:"selector"},nx={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},nE={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},n$={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},nS={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},nk={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},nP={Once:"once",Recurring:"recurring",Always:"always"},nM={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},nO={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},nT={Popover:"popover",Inline:"inline"};function nF(e){let t=!0;return{dispose(){if(t){t=!1;let i=e();i&&j(i.then)&&i.then(void 0,()=>{})}}}}let nC={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},nI={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},nR={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},nA=iE("[RateLimiter]");var nL=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{let t=e.text;
vendor: 7,743 bytes, line 2
2if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{nA.info(`${e||"events"} is quota limited.`),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void nA.warn(`could not rate limit - continuing. Error: "${null==e?void 0:e.message}"`,{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null===(e=this.instance.config.rate_limiting)||void 0===e?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;let{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==t?t:{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||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){let e=(G(a.dropped)?a.dropped:0)+1;a.dropped=e,!this.lastEventRateLimited&&this.Vl(e)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Gl(e){let t=this.instance.config.property_denylist;return!N(t)||!t.includes(e)}Zl(){var e;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==c?void 0:c.pathname))return`${null!==(e=c.origin)&&void 0!==e?e:""}${c.pathname}`}Vl(e){var t,i;let{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,n=this.Zl(),o=this.Gl("$session_id")?null===(t=(i=this.instance).get_session_id)||void 0===t?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,n?`triggered on ${n}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${r} events per second and ${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}};let nD=iE("[RemoteConfig]");var nN=class{constructor(e){this._instance=e}get remoteConfig(){var e;return null===(e=b._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.config}Ql(e){var t,i,s;(null===(t=b.__PosthogExtensions__)||void 0===t?void 0:t.loadExternalDependency)?null===(i=b.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Jl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return nD.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Yl())return void nD.warn("Remote config is disabled. Falling back to local config.");this.Ql(e=>{if(!e)return nD.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(e=>{this.Kl(e.json,e)});this.Kl(e)})}catch(e){nD.error("Error loading remote config",e),this.Kl()}}Kl(e,t){!e&&t&&(0===t.statusCode?t.error||nD.warn("Failed to fetch remote config from PostHog."):nD.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(e?{ok:!0,config:e}:{ok:!1})}catch(e){nD.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)||void 0===i||i.ensureFlagsLoaded()}catch(e){nD.error("Error loading feature flags",e)}}};let nj=["fatal","error","warning","log","info","debug"];var nB=Uint8Array,nU=Uint16Array,nH=Uint32Array,nz=new nB([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]),nq=new nB([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]),nV=new nB([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nW=function(e,t){for(var i=new nU(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new nH(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]},nG=nW(nz,2),nK=nG[1];nG[0][28]=258,nK[258]=28;for(var nY=nW(nq,0)[1],nJ=new nU(32768),nX=0;32768>nX;++nX){var nZ=(43690&nX)>>>1|(21845&nX)<<1;nJ[nX]=((65280&(nZ=(61680&(nZ=(52428&nZ)>>>2|(13107&nZ)<<2))>>>4|(3855&nZ)<<4))>>>8|(255&nZ)<<8)>>>1}var nQ=function(e,t,i){for(var s=e.length,r=0,n=new nU(t);s>r;++r)++n[e[r]-1];var o,a=new nU(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new nU(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],d=t-e[r],h=a[e[r]-1]++<<d,c=h|(1<<d)-1;c>=h;++h)o[nJ[h]>>>l]=u}else for(o=new nU(s),r=0;s>r;++r)o[r]=nJ[a[e[r]-1]++]>>>15-e[r];return o},n0=new nB(288);for(nX=0;144>nX;++nX)n0[nX]=8;for(nX=144;256>nX;++nX)n0[nX]=9;for(nX=256;280>nX;++nX)n0[nX]=7;for(nX=280;288>nX;++nX)n0[nX]=8;var n1=new nB(32);for(nX=0;32>nX;++nX)n1[nX]=5;var n2=nQ(n0,9,0),n3=nQ(n1,5,0),n5=function(e){return(e/8|0)+(7&e&&1)},n6=function(e,t,i){(null==t||0>t)&&(t=0),(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof nU?nU:e instanceof nH?nH:nB)(i-t);return s.set(e.subarray(t,i)),s},n4=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},n8=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},n9=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 nB(0),0];if(1==r){var o=new nB(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,d=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=r-1;)a=i[i[h].f>i[u].f?u++:h++],l=i[u!=d&&i[h].f>i[u].f?u++:h++],i[d++]={s:-1,f:a.f+l.f,l:a,r:l};var c=n[0].s;for(s=1;r>s;++s)n[s].s>c&&(c=n[s].s);var p=new nU(c+1),v=n7(i[d-1],p,0);if(v>t){s=0;var f=0,g=v-t,_=1<<g;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;f+=_-(1<<v-p[m]),p[m]=t}for(f>>>=g;f>0;){var y=n[s].s;t>p[y]?f-=1<<t-p[y]++-1:++s}for(;s>=0&&f;--s){var b=n[s].s;p[b]==t&&(--p[b],++f)}v=t}return[new nB(p),v]},n7=function(e,t,i){return -1==e.s?Math.max(n7(e.l,t,i+1),n7(e.r,t,i+1)):t[e.s]=i},oe=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new nU(++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]},ot=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},oi=function(e,t,i){var s=i.length,r=n5(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)},os=function(e,t,i,s,r,n,o,a,l,u,d){n4(t,d++,i),++r[256];for(var h=n9(r,15),c=h[0],p=h[1],v=n9(n,15),f=v[0],g=v[1],_=oe(c),m=_[0],y=_[1],b=oe(f),w=b[0],x=b[1],E=new nU(19),$=0;m.length>$;++$)E[31&m[$]]++;for($=0;w.length>$;++$)E[31&w[$]]++;for(var S=n9(E,7),k=S[0],P=S[1],M=19;M>4&&!k[nV[M-1]];--M);var O,T,F,C,I=u+5<<3,R=ot(r,n0)+ot(n,n1)+o,A=ot(r,c)+ot(n,f)+o+14+3*M+ot(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(R>=I&&A>=I)return oi(t,d,e.subarray(l,l+u));if(n4(t,d,1+(R>A)),d+=2,R>A){O=nQ(c,p,0),T=c,F=nQ(f,g,0),C=f;var L=nQ(k,P,0);for(n4(t,d,y-257),n4(t,d+5,x-1),n4(t,d+10,M-4),d+=14,$=0;M>$;++$)n4(t,d+3*$,k[nV[$]]);d+=3*M;for(var D=[m,w],N=0;2>N;++N){var j=D[N];for($=0;j.length>$;++$)n4(t,d,L[B=31&j[$]]),d+=k[B],B>15&&(n4(t,d,j[$]>>>5&127),d+=j[$]>>>12)}}else O=n2,T=n0,F=n3,C=n1;for($=0;a>$;++$)if(s[$]>
2255){n8(t,d,O[257+(B=s[$]>>>18&31)]),d+=T[B+257],B>7&&(n4(t,d,s[$]>>>23&31),d+=nz[B]);var B,U=31&s[$];n8(t,d,F[U]),d+=C[U],U>3&&(n8(t,d,s[$]>>>5&8191),d+=nq[U])}else n8(t,d,O[s[$]]),d+=T[s[$]];return n8(t,d,O[256]),d+T[256]},or=new nH([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),on=new nB(0),oo=function(){for(var e=new nH(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),oa=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};let ol=!!v||!!p,ou="text/plain",od=!1,oh=(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`${r}${o?`?${o}`:""}${s?`#${s}`:""}`},oc=(e,t,i=!0)=>{var s;let[r,n]=e.split("?"),o=ty({},t),a=null!==(s=null==n?void 0:n.split("&").map(e=>{var t;let[s,r]=e.split("="),n=i&&null!==(t=o[s])&&void 0!==t?t:r;return delete o[s],`${s}=${n}`}))&&void 0!==s?s:[],l=function(e,t="&"){let i,s;let r=[];return sO(e,function(e,t){H(e)||H(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)}),r.join(t)}(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},op=e=>{var t,i,s,r,n,o,a,l,u,d;if(e.Xl)return e.Xl;let{data:h,compression:c}=e;if(!h)return;if(c===ny.GZipJS){let e=(t=function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new nB(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 nB(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 n6(i,0,s)}(rZ(h)),i={mtime:0},s=4294967295,r={p(e){for(var t=s,i=0;e.length>i;++i)t=oo[255&t^e[i]]^t>>>8;s=t},d:()=>4294967295^s},n=t.length,r.p(t),u=(o=10+(i.filename&&i.filename.length+1||0),l=function(e,t,i,s,r,n){var o=e.length,a=new nB(s+o+5*(1+Math.floor(o/7e3))+8),l=a.subarray(s,a.length-8),u=0;if(!t||8>o)for(var d=0;o>=d;d+=65535){var h=d+65535;o>h?u=oi(l,u,e.subarray(d,h)):(l[d]=n,u=oi(l,u,e.subarray(d,o)))}else{for(var c=or[t-1],p=c>>>13,v=8191&c,f=(1<<i)-1,g=new nU(32768),_=new nU(f+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&f},w=new nH(25e3),x=new nU(288),E=new nU(32),$=0,S=0,k=(d=0,0),P=0,M=0;o>d;++d){var O=b(d),T=32767&d,F=_[O];if(g[T]=F,_[O]=T,d>=P){var C=o-d;if(($>7e3||k>24576)&&C>423){u=os(e,l,0,w,x,E,S,k,M,d-M,u),k=$=S=0,M=d;for(var I=0;286>I;++I)x[I]=0;for(I=0;30>I;++I)E[I]=0}var R=2,A=0,L=v,D=T-F&32767;if(C>2&&O==b(d-D))for(var N=Math.min(p,C)-1,j=Math.min(32767,d),B=Math.min(258,C);j>=D&&--L&&T!=F;){if(e[d+R]==e[d+R-D]){for(var U=0;B>U&&e[d+U]==e[d+U-D];++U);if(U>R){if(R=U,A=D,U>N)break;var H=Math.min(D,U-2),z=0;for(I=0;H>I;++I){var q=d-D+I+32768&32767,V=q-g[q]+32768&32767;V>z&&(z=V,F=q)}}}D+=(T=F)-(F=g[T])+32768&32767}if(A){w[k++]=268435456|nK[R]<<18|nY[A];var W=31&nK[R],G=31&nY[A];S+=nz[W]+nq[G],++x[257+W],++E[G],P=d+R,++$}else w[k++]=e[d],++x[e[d]]}}u=os(e,l,n,w,x,E,S,k,M,d-M,u),n||(u=oi(l,u,on))}return n6(a,0,s+n5(u)+8)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,o,8,!a)).length,function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&oa(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)}}(l,i),oa(l,u-8,r.d()),oa(l,u-4,n),l);return{contentType:ou,body:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),estimatedSize:e.byteLength}}if(c===ny.Base64){let e;let t="data="+encodeURIComponent("string"==typeof(e=(d=rZ(h))?btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):d)?e:rZ(e));return{contentType:"application/x-www-form-urlencoded",body:t,estimatedSize:new Blob([t]).size}}let p=rZ(h);return{contentType:"application/json",body:p,estimatedSize:new Blob([p]).size}},ov=e=>{var t;let i;let s=()=>"sendBeacon"===e.transport?{url:oc(e.url,{compression:ny.Base64}),encodedBody:op(ty(ty({},e),{},{compression:ny.Base64,Xl:void 0}))}:{url:oh(e.url,"compression"),encodedBody:op(ty(ty({},e),{},{compression:void 0,Xl:void 0}))};try{i=op(e)}catch(t){if(t6(e.compression,r0(e.url,"compression")))return ix.error("Failed to gzip request body, sending uncompressed payload",t),s();throw t}return!(i&&t6(e.compression,r0(e.url,"compression")))||((t=i.body)instanceof ArrayBuffer?t5(new Uint8Array(t)):ArrayBuffer.isView(t)&&t5(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:i}:(od=!0,s())},of=e=>{try{return ov(e)}catch(i){var t;return ix.error(i),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0,error:i}))}},og=(E=ea(function*(e){let t=yield function(e){return t7.apply(this,arguments)}(rZ(e.data),x.DEBUG,{rethrow:!0});if(!t)return e;let i=yield t.arrayBuffer();return ty(ty({},e),{},{Xl:{contentType:ou,body:i,estimatedSize:i.byteLength}})}),function(e){return E.apply(this,arguments)}),o_=/Failed to fetch|NetworkError|Load failed/i,om=e=>"TypeError"===(null==e?void 0:e.name)&&o_.test((null==e?void 0:e.message)||""),oy=e=>
2{let t=of(e);if(!t)return;let i=new v,{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);let{contentType:n,body:o}=null!=r?r:{};sO(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)||void 0===t||t.call(e,s)}},i.send(o)},ob=e=>{let t=of(e);if(!t)return;let{url:i,encodedBody:s}=t,{contentType:r,body:n,estimatedSize:o}=null!=s?s:{},a=new Headers;sO(e.headers,function(e,t){a.append(t,e)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(f){let t=new f;l={signal:t.signal,timeout:setTimeout(()=>{var i;u=!0,t.abort(th("AbortError","PostHog request timed out"+((i=e.timeout)?` after ${i}ms`:"")))},e.timeout)}}let d=t=>{var i;u&&"AbortError"===(null==t?void 0:t.name)||om(t)?ix.warn(t):ix.error(t),null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0,error:t})};try{p(i,ty({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&!e.ta&&52428.8>(o||0),body:n,signal:null==l?void 0:l.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s;let r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(e){ix.error(e)}null===(s=e.callback)||void 0===s||s.call(e,r)})).catch(d).finally(()=>l?clearTimeout(l.timeout):null)}catch(e){l&&clearTimeout(l.timeout),d(e)}},ow=e=>{try{var t;let{url:i,encodedBody:s}=ov(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(d.sendBeacon(i,a))return;let l=N(e.data)?e.data:null===(t=e.data)||void 0===t?void 0:t.batch;if(N(l)&&l.length>1&&(null!=o?o:0)>16384){let t=Math.ceil(l.length/2),i=t=>N(e.data)?t:ty(ty({},e.data),{},{batch:t});return ow(ty(ty({},e),{},{data:i(l.slice(0,t))})),void ow(ty(ty({},e),{},{data:i(l.slice(t))}))}ix.warn(`Beacon of ~${null!=o?o:0} bytes was rejected by the browser, falling back to ${p?"fetch":"XHR"}`),p?ob(ty(ty({},e),{},{ta:!0})):oy(e)}catch(e){ix.warn("Beacon send failed",e)}},ox=(e,t,i,s)=>{let r="query"===s?"POST"===t?"sent_at":"_":void 0;return oc(i===ny.GZipJS?oh(e,"compression"):e,ty(ty({},r?{[r]:Date.now().toString()}:{}),i===ny.GZipJS?{}:{compression:i}))},oE=(()=>{let e=[];return p&&e.push({transport:"fetch",method:ob}),v&&e.push({transport:"XHR",method:oy}),(null==d?void 0:d.sendBeacon)&&e.push({transport:"sendBeacon",method:ow}),e})();var o$=class{constructor(e,t){this.ea=!0,this.ia=[],this.na=ed((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,ix.createLogger("flush interval"),3e3),this.sa=e}enqueue(e){this.ia.push(e),this.ra||this.oa()}unload(){this.la();let e=Object.values(this.ia.length>0?this.aa():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.ua(ty(ty({},e),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){let e=this.aa();for(let t in e)this.ua(e[t])}},this.na))}ua(e){try{this.sa(e)}catch(e){ix.error(e)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){let e={};return sO(this.ia,t=>{var i;let s=((t?t.batchKey:null)||t.url)+(t.batchGroup?`:${t.batchGroup}`:"");H(e[s])&&(e[s]=ty(ty({},t),{},{data:[]})),null===(i=e[s].data)||void 0===i||i.push(t.data)}),this.ia=[],e}};let oS=["retriesPerformedSoFar"];var ok=class{constructor(e){this._instance=e,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){!H(l)&&"onLine"in l.navigator&&(this.da=l.navigator.onLine,this.va||(this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},sL(l,"online",this.va),sL(l,"offline",this.pa)))}get length(){return this.ia.length}retriableRequest(e){let{retriesPerformedSoFar:t}=e,i=it(e,oS);K(t)&&(i.url=oc(i.url,{retry_count:t})),this._instance._send_request(ty(ty({},i),{},{callback:e=>{var s;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this.Ls(ty({retriesPerformedSoFar:t},i));0===e.statusCode&&ix.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=t?t:0} retries.`)}null===(s=i.callback)||void 0===s||s.call(i,e)}}))}Ls(e){let t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;let i=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)}(t),s=Date.now()+i;this.ia.push({retryAt:s,requestOptions:e});let r=`Enqueued failed request for retry in ${i}`;navigator.onLine||(r+=" (Browser is offline)"),ix.warn(r),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),0===this.ia.length)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){let e=Date.now(),t=[],i=this.ia.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ia=t,i.length>0)for(let{requestOptions:e}of i)this.retriableRequest(e)}unload(){for(let{requestOptions:e}of(this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,H(l)||(this.va&&(l.removeEventListener("online",this.va),this.va=void 0),this.pa&&(l.removeEventListener("offline",this.pa),this.pa=void 0)),this.ia))try{this._instance._send_request(ty(ty({},e),{},{transport:"sendBeacon"}))}catch(e){ix.error(e)}this.ia=[]}},oP=class{constructor(e){this._instance=e,this.ya=()=>{var e,t,i,s;this.ba||(this.ba={});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.ba.lastScrollY=Math.ceil(n),this.ba.maxScrollY=Math.max(n,null!==(e=this.ba.maxScrollY)&&void 0!==e?e:0),this.ba.maxScrollHeight=Math.max(o,null!==(t=this.ba.maxScrollHeight)&&void 0!==t?t:0),this.ba.lastContentY=a,this.ba.maxContentY=Math.max(a,null!==(i=this.ba.maxContentY)&&void 0!==i?i:0),this.ba.maxContentHeight=Math.max(l,null!==(s=this.ba.maxContentHeight)&&void 0!==s?s:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){let e=this.ba;return this.ba=void 0,setTimeout(this.ya,0),e}startMeasuringScrollPosition(){sL(l,"scroll",this.ya,{capture:!0}),sL(l,"scrollend",this.ya,{capture:!0}),sL(l,"resize",this.ya)}scrollElement(){var e,t;if(this._a){for(let t of N(this._a)?this._a:[this._a]){let i=null==l||null===(e=l.document)||void 0===e?void 0:e.querySelector(t);if(i)return i}return}return null==l||null===(t=l.document)||void 0===t?void 0:t.documentElement}wa(e){var t,i;if(this._a){let t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return l?"y"===e?l.scrollY||l.pageYOffset||(null===(t=l.document)||void 0===t||null===(t=t.documentElement)||void 0===t?void 0:t.scrollTop)||0:l.scrollX||l.pageXOffset||(null===(i=l.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};let oM=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
2);var oO=class{constructor(e,t,i,s){this.je=e=>{let t=this.ka();if(t&&t.sessionId===e)return;let i={sessionId:e,props:this.Sa(this._instance)};this.xa.register({[sl]:i})},this._instance=e,this.Ca=t,this.xa=i,this.Sa=s||oM,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[sl]}getSetOnceProps(){var e;let t=null===(e=this.ka())||void 0===e?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 sO(sI(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e[`$session_entry_${I(i)}`]=t}),e}},oT=class{on(e,t){return this.$a[e]||(this.$a[e]=[]),this.$a[e].push(t),()=>{this.$a[e]=this.$a[e].filter(e=>e!==t)}}emit(e,t){for(let i of this.$a[e]||[])i(t);for(let i of this.$a["*"]||[])i(e,t)}constructor(){this.$a={}}};let oF=iE("[SessionId]");var oC=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,i){var s;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new oT,this.Aa=(e,t)=>!(!K(e)||!K(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.Mr=e.config,this.xa=e.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=t||sz,this.Da=i||sz;let r=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*ed(this.Mr.session_idle_timeout_seconds||1800,60,36e3,oF.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+r+"_window_id",this.qa="ph_"+r+"_primary_window_exists",this.ja()){let e=re.Dt(this.Na),t=re.Dt(this.qa);e&&!t?this.Be=e:re.Lt(this.Na),re.At(this.qa,!0)}(null===(s=this.Mr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return H(this.Ea)&&(this.Ea=[]),this.Ea.push(e),this.Xt&&e(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(t=>t!==e)}}ja(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&re.Et()}Ha(e){e!==this.Be&&(this.Be=e,this.ja()&&re.At(this.Na,e))}za(){return this.Be?this.Be:this.ja()?re.Dt(this.Na):null}Ua(e){let t=this.Ia;return!V(t)&&!V(e)&&5e3>Math.abs(e-t)}Wa(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.Ua(t)||(this.Ia=t,this.xa.register({[iG]:[t,e,i]}))}Va(){var e;let t=null===(e=this.Mr)||void 0===e?void 0:e.persistence_save_debounce_ms;return K(t)&&t>0}Ga(){this.Va()?this.xa.refreshKey(iG):(this.xa.flush(),this.xa.load())}Za(){var e;if(V(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();let[,t,i]=this.Qa();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[iG]:[this._sessionActivityTimestamp,null!==(e=this.Xt)&&void 0!==e?e:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){let[e]=this.Qa();return Math.max(K(e)?e:0,K(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}Ka(e){return this.Ga(),this.Aa(e,this.Ja())}Qa(){let e=this.xa.props[iG];return N(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Ya),this.Ya=void 0,this.Wa(null,null,null)}setBootstrapSessionId(e,t=!1){let i=((e,t=(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!H(i)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:i}:this.Wa(e,(new Date).getTime(),i),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Ya),this.Ya=void 0,this.Pa&&l&&(l.removeEventListener(sE,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&re.Lt(this.qa)},sL(l,sE,this.Pa,{capture:!1})}
2checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if("always"===this.Mr.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.Ma=s;else if(V(this.Ma)||this.Ma>s||s-this.Ma>=1e3){var n,o;null===(n=(o=this.xa).syncCookieProperties)||void 0===n||n.call(o),this.Ma=s}let[,a,l]=this.Qa(),u=!H(r)&&a!==r,d=this.Ja(),h=this.za(),c=this.Fa,p=!!c&&(c.sessionStartTimestamp>s+6e4||s-c.sessionStartTimestamp>864e5),v=c?p:K(l)&&Math.abs(s-l)>864e5,f=!1,g=u,_=!a||!!c,m=a,y=!_&&!e&&this.Aa(s,d);if(y&&((y=this.Ka(s))||oF.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Qa()),_||y||v){g=!1;let e=c&&!p;a=e?c.sessionId:this.Oa(),h=this.Da(),oF.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!e,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:v}}),l=e?c.sessionStartTimestamp:s,this.Fa=void 0,f=!0}else h||(h=this.Da(),f=!0),(g=g||a!==m)&&(oF.info("adopted cross-tab session id",{sessionId:a,windowId:h}),f=!0);let b=K(d)&&e&&!v?d:s,w=K(l)?l:(new Date).getTime();this.Ha(h),this.Wa(a,b,w),e||this.La();let x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:v,crossTabAdoption:g};return f&&this.Ea.forEach(e=>e(a,h,x)),{sessionId:a,windowId:h,sessionStartTimestamp:w,changeReason:f?x:void 0,lastActivityTimestamp:d}}La(){this.Ra||(clearTimeout(this.Ya),this.Ya=setTimeout(()=>{if(!this.Ra){if(this.Ka((new Date).getTime())){let e=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:e})}else this.La()}},1.1*this.sessionTimeoutMs))}};let oI=function(e,t){if(!e)return!1;let i=e.userAgent;if(i&&eu(i,t))return!0;try{let i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(e=>eu(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function oR(){return(oR=ea(function*(){let e=null==d?void 0:d.userAgentData;if(null==e?void 0:e.getHighEntropyValues)try{let t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return z(i)&&i.length>0?i:void 0}catch(e){return void ix.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function oA(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}let oL=(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}},oD=e=>e.toLowerCase(),oN={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=>oL(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!oL(t,e))),icontains:(e,t)=>t.map(oD).some(t=>e.map(oD).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(oD).every(t=>e.map(oD).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 oj(e,t){return!e||Object.entries(e).every(([e,i])=>{let s=null==t?void 0:t[e];if(null==s)return!1;let r=oN[i.operator];return!!r&&r(i.values,[String(s)])})}function oB(e,t,i){return rZ({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}let oU="custom",oH="i.posthog.com",oz=/^\/static\//,oq=["/s/","/e/","/i/"];var oV=class{constructor(e){this.Xa={},this.instance=e}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?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${oH}`,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Xa[this.apiHost]||(this.Xa[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":
2oU),this.Xa[this.apiHost]}tu(e){if(!oz.test(e))return;let t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}eu(e){let t=rQ(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}iu(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?void 0:n.href)||i)).toString()}if(r&&"api"===e&&oq.some(e=>0===t.indexOf(e))){let e=this.eu(s);if(e){let t=this.apiHost,i=this.nu;(null==i?void 0:i.apiHost)===t&&i.rewriteRequestPath===r||(i={apiHost:t,rewriteRequestPath:r,urls:new Set},this.nu=i),i.urls.add(e)}}return s}isIngestionEndpoint(e){let t=this.nu,i=this.eu(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t="/"===t[0]?t:`/${t}`),"ui"===e)return this.iu(e,t,this.uiHost+t);if("flags"===e)return this.iu(e,t,this.flagsApiHost+t);if("assets"===e){let i=this.tu(t);if(i)return this.iu(e,t,`${i}${t}`)}if(this.region===oU)return this.iu(e,t,this.apiHost+t);let i=oH+t;switch(e){case"assets":return this.iu(e,t,`https://${this.region}-assets.${i}`);case"api":return this.iu(e,t,`https://${this.region}.${i}`)}}};let oW=iE("[Surveys]"),oG=e=>{try{let t=`seenSurvey_${e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}`;if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){oW.error("Failed to persist survey seen state",e)}},oK=[n$.Popover,n$.Widget,n$.API],oY={ignoreConditions:!1,ignoreDelay:!1,displayType:nT.Popover},oJ=iE("[PostHog ExternalIntegrations]"),oX={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var oZ=class{constructor(e){this._instance=e}No(e,t){var i,s;null===(i=b.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,e,e=>{if(e)return oJ.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)&&void 0!==e?e:{}))!n||(null===(t=b.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t?void 0:t[r])||this.No(oX[r],()=>{var e;null===(e=b.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e||null===(e=e[r])||void 0===e||e.start(this._instance)}),!n&&(null===(i=b.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[r])&&(null===(s=b.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[r])||void 0===s||s.stop())}},oQ=class{constructor(e,t){this.$=e,this.po=t,this.su=new Map,this.So=!1}add(e){var t=this;return ea(function*(){if(t.So)throw Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.su.has(e.name))throw Error(`Browser extension "${e.name}" is already registered`);t.su.set(e.name,e);try{let i=e.setup(t.po);i&&(yield i)}catch(s){let i=t.su.get(e.name)===e;i&&t.su.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,s),i&&t.ru(e)}})()}getExtension(e){return this.su.get(e)}dispose(){if(this.So)return;this.So=!0;let e=Array.from(this.su.values()).reverse();for(let t of(this.su.clear(),e))this.ru(t)}ru(e){try{var t;let i=null===(t=e.dispose)||void 0===t?void 0:t.call(e);i&&j(i.then)&&i.then(void 0,t=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,t)})}catch(t){this.$.error(`Failed to dispose browser extension "${e.name}"`,t)}}},o0=class{constructor(e){this._instance=e}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);H(e)||(i[s]=e)}return i}set(e,t){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}};let o1="extensionsRemoteConfig";var o2=class{constructor(e){this.instance=e,this.So=!1,this.$=ix,this.ou=e.lu,this.kv=new o0(e),this.onEvent=e=>nF(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.So)return nF(()=>{});let t=t=>{try{e(t)}catch(e){this.$.error("Browser extension remote config listener failed",e)}},i=this.instance.au.on(o1,t);return this.ou&&t(this.ou),nF(i)},this.uu=new oQ(ix.createLogger("[BrowserExtensions]"),this)}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"))&&void 0!==e?e:this.distinctId}get deviceId(){let e=this.instance.get_property(iT);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?void 0:t.get_initial_props())&&void 0!==e?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?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==r?void 0:r.sessionId)&&void 0!==t?t:"",windowId:null!==(i=null==r?void 0:r.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?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.uu.add(e)}getExtension(e){return this.uu.getExtension(e)}capture(e,t,i){var s=this;return ea(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return nF(this.instance.hu(e))}handleRemoteConfig(e){this.So||(this.ou=e,this.instance.au.emit(o1,e))}sendRequest(e){var t=this;return ea(function*(e,i={}){var s;let r=t.instance.requestRouter.endpointFor(null!==(s=i.target)&&void 0!==s?s:"api",e),n={method:i.method,url:i.query?oc(r,i.query
2):r,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?M.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(t.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,t.instance._send_request(n)})}).apply(this,arguments)}dispose(){this.So||(this.So=!0,this.uu.dispose())}};let o3={},o5=0,o6=()=>{},o4='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',o8="Surveys module not available",o9="sanitize_properties is deprecated. Use before_send instead",o7="Invalid value for property_denylist config: ",ae=/^[A-Za-z0-9_-]{1,400}$/,at=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,ai=["token","distinct_id",sv],as="posthog",ar=!ol&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),an=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},ao=e=>{var t;return ty({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(!z(t))return!1;let i=t.split(".").slice(-2).join(".");for(let e of sA)if(i===e)return!1;return!0}(null==h?void 0:h.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:o6,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:c&&z(null==c?void 0:c.search)&&-1!==c.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?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,surveys_request_timeout_ms:1e4,on_request_error(e){ix.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:sw,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:o6},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:rb,ignore_text_selection:!0}
2:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:an(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)})},aa=[["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"]],al=e=>{let t={};for(let[i,s]of aa)H(e[i])||(t[s]=e[i]);let i=sT({},t,e),s=e.__preview_external_dependency_versioned_paths;return H(s)||(H(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),z(s)&&H(e.asset_host)&&(i.asset_host=s)),N(e.property_blacklist)&&(H(e.property_denylist)?i.property_denylist=e.property_blacklist:N(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:ix.error(o7+e.property_denylist)),i};var au=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(e){ix.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ad=class e{du(e){if(!e)return;let t=this.su.indexOf(e);-1!==t&&this.su.splice(t,1)}vu(e,t){var i;return this.du(e),this.su.push(t),null===(i=t.initialize)||void 0===i||i.call(t),t}fu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}pu(){let e,t,i;if(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())return;let s="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(s||this.config.disable_persistence)&&(this.mu||(s?(e=`persistence is set to '${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.gu=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${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. ${i}`)))}yu(){if(this.fu()||"$posthog_cookieless"!==this.get_distinct_id())return;let e=this.persistence;if(!e)return;this.bu()||e.load(!0);let t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){let t=this.config.get_device_id(sz());this.register({distinct_id:t,$device_id:t}),e.set_property(sa,sy)}this._u()}get decideEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new au,this.Su=!1,this.version=x.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new oT,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ao(),this.SentryIntegration=rW,this.sentryIntegration=e=>(function(e,t){let i=rV(e,t);return{name:rq,processEvent:e=>i(e)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new oP(this),this.pageViewM
2anager=new rG(this),this.rateLimiter=new nL(this),this.requestRouter=new oV(this),this.consent=new rt(this),this.externalIntegrations=new oZ(this);let i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(e,t,i)=>{let s=z(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{let s=z(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>ix.info(`send "${null==e?void 0:e.event}"`,e))}init(t,i,s){if(s&&s!==as){var r;let n=null!==(r=o3[s])&&void 0!==r?r:new e;return n._init(t,i,s),o3[s]=n,o3[as][s]=n,n}return this._init(t,i,s)}_init(e,t={},i){var s,r,n,o;let a=z(e)?e.trim():"";if(!a)return ix.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return a!==(null===(o=this.config)||void 0===o?void 0:o.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=ao(t.defaults),t.debug=this.Pu(t.debug),this.Ru=t,this.Au=[],t.person_profiles?this.Mu=t.person_profiles:t.process_person&&(this.Mu=t.process_person);let u=ao(t.defaults),d=al(t),h=sT({},u,d,{name:i,token:a});B(u.rageclick)&&B(d.rageclick)&&(h.rageclick=sT({},u.rageclick,d.rageclick)),B(u.session_recording)&&B(d.session_recording)&&(h.session_recording=sT({},u.session_recording,d.session_recording)),this.set_config(h),this.config.on_xhr_error&&ix.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ny.GZipJS;let c=this.bu();if(this.persistence=new nm(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nm(ty(ty({},this.config),{},{persistence:"sessionStorage"}),c,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&re.Et()){let e=re.Dt(this.Cu);N(e)&&e.forEach(e=>{z(e)&&this.xu.add(e)})}else re.Lt(this.Cu);let p=ty({},this.persistence.props),v=ty({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new o$(e=>this.Ou(e),this.config.request_queue_config),this.Du=new ok(this),this.__request_queue=[];let f=this.fu();f||(this.sessionManager=new oC(this),this.sessionPropsManager=new oO(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.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(ix.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(f)},0)):(ix.info("Initializing extensions synchronously"),this.qu(f)),x.DEBUG=x.DEBUG||this.config.debug,x.DEBUG&&ix.info("Starting in debug mode",{this:this,config:t,thisC:ty({},this.config),p:p,s:v}),!this.config.identity_distinct_id||(null===(s=t.bootstrap)||void 0===s?void 0:s.distinctID)||(t.bootstrap=ty(ty({},t.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let g=null===(r=t.bootstrap)||void 0===r?void 0:r.distinctID;if(this.mu=!!g&&!q(g),null===(n=t.bootstrap)||void 0===n?void 0:n.distinctID){let e=t.bootstrap.distinctID,i=this.get_distinct_id(),s=this.persistence.get_property(sa);if(t.bootstrap.isIdentifiedID&&null!=i&&i!==e&&"anonymous"===s)this.identify(e);else if(t.bootstrap.isIdentifiedID&&null!=i&&i!==e&&"identified"===s)ix.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 i=this.config.get_device_id(sz()),s=t.bootstrap.isIdentifiedID?i:e;this.persistence.set_property(sa,t.bootstrap.isIdentifiedID?sb:sy),this.register({distinct_id:e,$device_id:s})}}if(f)this.register_once({distinct_id:sp,$device_id:null},"");else if(!this.get_distinct_id()){let e=this.config.get_device_id(sz());this.register_once({distinct_id:e,$device_id:e},""),this.persistence.set_property(sa,sy)}return sL(l,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),sL(l,"pageshow",()=>{var e;this.wu=!1,this.ku||null===(e=this.Du)||void 0===e||e.resume()}),t.segment?rz(this,()=>this.ju()):this.ju(),j(this.config._onCapture)&&this.config._onCapture!==o6&&(ix.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&ix.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 oR.apply(this,arguments)})().then(e=>{e&&this.register({[iF]:e})}).catch(o6),this}Bu(e){return z(e.name)&&j(e.setup)}Hu(e,t){this.Bu(e)?t.push(()=>{this.zu().add(e).catch(()=>{var t;return null===(t=e.dispose)||void 0===t?void 0:t.call(e)}).catch(t=>{ix.error(`Failed to dispose browser extension "${e.name}"`,t)})}):this.su.push(e)}Nu(){var t,i,s,r,n,o;let a=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(s=e.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null===(r=this.Uu)||void 0===r||r.call(this),this.Uu=void 0,this.featureFlags=new a(this)),j(this.featureFlags.onReloading)&&j(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null===(n=(o=this.featureFlags).initialize)||void 0===n||n.call(o))}qu(t){var i,s,r,n,o,a,l;let u=performance.now(),d=ty(ty({},e.__defaultExtensionClasses),this.config.__extensionClasses),h=[];d.exceptions&&this.su.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new d.exceptions(this)),d.historyAutocapture&&this.su.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.su.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.su.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!t&&this.su.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||h.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Hu(this.autocapture=new d.autocapture(this),h),d.surveys&&this.Hu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),h),d.logs&&this.Hu(this.logs=null!==(r=this.logs)&&void 0!==r?r:new d.logs(this),h),d.metrics&&this.su.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new d.metrics(this)),d.conversations&&this.su.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new d.conversations(this)),d.productTours&&this.su.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.su.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.su.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,rB)),d.toolbar&&this.su.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new d.toolbar(this)),d.experiments&&this.su.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new d.experiments(this)),this.su.forEach(e
2=>{e.initialize&&h.push(()=>{var t;null===(t=e.initialize)||void 0===t||t.call(e)})}),h.push(()=>{if(this.Wu){let e=this.Wu;this.Wu=void 0,this.su.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}}),this.Vu(h,u)}Vu(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Vu(e,t)},0);let i=e.shift();if(i)try{i()}catch(e){ix.error("Error initializing extension:",e)}}let i=Math.round(performance.now()-t);this.register_for_session({[sf]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[sg]:i}),this.config.__preview_deferred_init_extensions&&ix.info(`PostHog extensions initialized (${i}ms)`)}Kl(e){var t,i;if(!h||!h.body)return ix.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=e),this.lu=e,this.compression=void 0,e.ok){let t=e.config;t.supportedCompression&&!this.config.disable_compression&&(this.compression=F(t.supportedCompression,ny.GZipJS)?ny.GZipJS:F(t.supportedCompression,ny.Base64)?ny.Base64:void 0),(null===(i=t.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=t.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:sw}),null===(t=this.Gu)||void 0===t||t.handleRemoteConfig(e),this.su.forEach(t=>{var i;return null===(i=t.onRemoteConfig)||void 0===i?void 0:i.call(t,e)})}ju(){try{this.config.loaded(this)}catch(e){ix.critical("`loaded` function failed",e)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==c?void 0:c.hostname)){let e=c.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.fu())&&this.Qu()},1),this.Ju=new nN(this),this.Ju.load()}Zu(){var e;this.is_capturing()&&this.config.request_batching&&(null===(e=this.Fu)||void 0===e||e.enable())}_dom_loaded(){this.is_capturing()&&sM(this.__request_queue,e=>this.Ou(e)),this.__request_queue=[],this.Zu()}_handle_unload(){var e,t,i,s,r,n;this.wu=!0,null===(e=this.surveys)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(sS),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(r=this.Fu)||void 0===r||r.unload(),null===(n=this.Du)||void 0===n||n.unload()):this.Ku()&&this.capture(sS,null,{transport:"sendBeacon"})}_send_request(e){var t,i,s;this.__loaded?ar?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(i=e.callback)||void 0===i||i.call(e,{statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=ty(ty({},this.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(t=this.compression)&&void 0!==t?t:e.compressionFallback:e.compression,(H(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s;let r=ty({},e);r.timeout=r.timeout||6e4;let n=null!==(t=r.transport)&&void 0!==t?t:"fetch";"sendBeacon"===n&&H(r.compression)&&r.data&&(r.compression=ny.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(e=>{var t,i;let s=(N(e)?e:[e]).map(e=>ty(ty({},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?void 0:i.token)&&void 0!==t?t:null==r?void 0:r.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((e,t=(new Date).toISOString())=>N(e)?e.map(e=>ty(ty({},e),{},{sent_at:t})):ty(ty({},e),{},{sent_at:t}))(r.data))),r.url=ox(r.url,r.method,r.compression,r.timestampMode);let o=oE.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),a=null!==(i=null===(s=function(e,t){for(let i=0;e.length>i;i++)if(t(e[i]))return e[i]}(o,e=>e.transport===n))||void 0===s?void 0:s.method)&&void 0!==i?i:o[0].method;if(!a)throw Error("No available transport method");let l=e=>{try{a(e)}catch(e){var t;om(e)?ix.warn(e):ix.error(e),null===(t=r.callback)||void 0===t||t.call(r,{statusCode:0,error:e})}};"sendBeacon"!==n&&r.data&&r.compression===ny.GZipJS&&g&&"undefined"!=typeof Promise&&!od?og(r).then(e=>{l(e)}).catch(t=>{if(t4(t))return od=!0,void l(ty(ty({},r),{},{compression:void 0,url:ox(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 t4(e)||t===t3})(t)&&(od=!0),l(r)}):a(r)})(ty(ty({},e),{},{callback:t=>{var i,s,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null===(s=(r=this.config).on_request_error)||void 0===s||s.call(r,t),null===(i=e.callback)||void 0===i||i.call(e,t)}}))):e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:0}))}Ou(e){this.Du?this.Du.retriableRequest(e):this._send_request(e)}_execute_array(e){o5++;try{let t;let i=[],s=[],r=[];sM(e,e=>{if(e){if(t=e[0],N(t))r.push(e);else if(j(e))try{e.call(this)}catch(t){ix.error("Error executing queued PostHog call",e,t)}else N(e)&&"alias"===t?i.push(e):N(e)&&-1!==t.indexOf("capture")&&j(this[t])?r.pu
2sh(e):s.push(e)}});let n=function(e,t){sM(e,function(e){try{if(N(e[0])){let i=t;sO(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){ix.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{o5--}}push(t){if(o5>0&&N(t)&&z(t[0])){let i=e.prototype[t[0]];return void(j(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}Yu(){var e;let t=null===(e=this.persistence)||void 0===e?void 0:e.get_property(iR);return z(t)&&at.test(t)?{value:t,delivered:!1}:B(t)&&z(t.value)&&at.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}Xu(e,t,i,s){if(!this.persistence)return;this.persistence.refreshKey(iR);let r=this.Yu();if(!s){if(i)return z(t)&&at.test(t)?(t!==(null==r?void 0:r.value)&&this.persistence.register({[iR]:{value:t,delivered:!1}}),{value:t,pending:t!==(null==r?void 0:r.value)||!r.delivered}):void this.persistence.unregister(iR);if(z(e)&&ae.test(e)){if((null==r?void 0:r.value.split(".")[3])===e)return{value:r.value,pending:!r.delivered};let t=`fb.1.${Date.now()}.${e}`;return this.persistence.register({[iR]:{value:t,delivered:!1}}),{value:t,pending:!0}}return r?{value:r.value,pending:!r.delivered}:void 0}this.persistence.unregister(iR)}th(e){if(!this.persistence)return;this.persistence.refreshKey(iR);let t=this.Yu();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register({[iR]:{value:e,delivered:!0}})}capture(e,t,i){var s,r,n,o,a,l,u,d,h,c;let p;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void ix.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(H(e)||!z(e))return void ix.error("No event name provided to posthog.capture");this.yu();let v=!this.config.opt_out_useragent_filter&&this._is_bot();if(v&&!this.config.__preview_capture_bot_pageviews)return;let f=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==f?void 0:f.isRateLimited)return void ix.critical("This capture call is ignored due to client rate limiting.");(null==t?void 0:t.$current_url)&&!z(null==t?void 0:t.$current_url)&&(ix.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.eh)||ix.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&&(p=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 g=new Date,_=(null==i?void 0:i.timestamp)||g,m=td(null==i?void 0:i.uuid,sz),y={uuid:m,event:e,properties:this.calculateEventProperties(e,t||{},_,m)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&v&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),f&&(y.properties.$lib_rate_limit_remaining_tokens=f.remainingTokens);let b="$feature_flag_called"===e&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==i?void 0:i.$set)&&!b&&(y.$set=null==i?void 0:i.$set);let w=B(null==t?void 0:t.$set)?t.$set:void 0,x=!!(null==i?void 0:i.$set)&&"$fbc"in i.$set,E=x||!!w&&"$fbc"in w,$=x?null==i||null===(s=i.$set)||void 0===s?void 0:s[iI]:null==w?void 0:w[iI],S=N(null==t?void 0:t.$unset)?t.$unset:[],k=(null==i?void 0:i.$unset)||[],P=-1!==S.indexOf("$fbc")||-1!==k.indexOf("$fbc"),M=this.Xu(null==p?void 0:p.fbclid,$,E,P);M&&!0===y.properties.$process_person_profile&&M.pending&&!E&&!b&&(y.$set=ty({[iI]:M.value},y.$set));let O=null==i?void 0:i.$unset;O&&(y.$unset=O);let T=b?void 0:this.ih(null==i?void 0:i.$set_once,e!==sP,e===sk);if(T&&(y.$set_once=T),(null==i?void 0:i._noTruncate)||(u=this.config.properties_string_max_length,y=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),N(s))n=[],sM(s,t=>{n.push(e(t))});else{let t={};sO(ee(s)?sR(s):s,(s,r)=>{i.has(s)||(t[r]=e(s,r))}),n=t}return n}}(e)}(y,e=>z(e)?e.slice(0,u):e)),y.timestamp=_,H(null==i?void 0:i.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=g),b&&(y.properties=((e,t=[])=>{let i={},s=t=>{void 0!==e[t]&&(i[t]=e[t])};return t2.forEach(s),t.forEach(s),i})(y.properties,ai)),e===nM.DISMISSED||e===nM.SENT){let i;let s=null==t?void 0:t[nO.SURVEY_ID],r=null==t?void 0:t[nO.SURVEY_ITERATION];oG({id:s,current_iteration:r}),y.$set=ty(ty({},y.$set),{},{[(h={id:s,current_iteration:r},c=e===nM.SENT?"responded":"dismissed",i=`$survey_${c}/${h.id}`,h.current_iteration&&h.current_iteration>0&&(i=`$survey_${c}/${h.id}/${h.current_iteration}`),i)]:!0})}else e===nM.SHOWN&&(y.$set=ty(ty({},y.$set),{},{[nO.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===nI.SHOWN){let e=null==t?void 0:t[nR.TOUR_TYPE];e&&(y.$set=ty(ty({},y.$set),{},{[`${nR.TOUR_LAST_SEEN_DATE}/${e}`]:(new Date).toISOString()}))}let F=ty(ty({},y.properties.$set),y.$set);if(U(F)||this.setPersonPropertiesForFlags(F),!W(this.config.before_send)){let e=this.Os(y);if(!e)return;(y=e).uuid=td(y.uuid,sz)}let C=null!==(r=null===(n=y.$set)||void 0===n?void 0:n.$fbc)&&void 0!==r?r:B(null===(o=y.properties)||void 0===o?void 0:o.$set)?y.properties.$set[iI]:void 0,I=(null==M?void 0:M.pending)&&C===M.value?M.value:void 0;this.au.emit("eventCaptured",y);let R=null!==(a=null==i?void 0:i._url)&&void 0!==a?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),A="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(R),L=ty(ty(ty({method:"POST",url:R,data:y,compression:"best-available",timestampMode:A?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},A&&(null===(l=y.properties)||void 0===l?void 0:l.$session_id)?{batchGroup:y.properties.$session_id}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),I?{fireCallbackOnDrop:!0,callback:e=>{e.statusCode>=200&&300>e.statusCode&&this.th(I)}}:{});return!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||I?(!L.transport&&!L.callback&&U(null!==(d=this.config.request_headers)&&void 0!==d?d:{})&&this.wu&&(L.transport="sendBeacon"),this.Ou(L)):this.Fu.enqueue(L),y}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}getExtension(e){var t;return null===(t=this.Gu)||void 0===t?void 0:t.getExtension(e)}zu(){var e;return null!==(e=this.Gu)&&void 0!==e?e:this.Gu=new o2(this)}hu(e){this.$u.push(e);let t=!0;return()=>{if(!t)return;t=!1;let i=this.$u.indexOf(e);-1!==i&&this.$u.splice(i,1)}}nh(e=!0){var t,i,s;return!!(null===(t=this.persistence)||void 0===t?void 0:t.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.xu.clear(),this.sh()),null===(i=this.featureFlags)||void 0===i||i.reset(),e&&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.nh();let o=r?void 0:this.persistence.remove_event_timer(e),a=ty({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.fu()&&(a[sv]=!0),"$
2snapshot"===e){let e=ty(ty({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=e.distinct_id,(!z(a.distinct_id)&&!G(a.distinct_id)||q(a.distinct_id))&&ix.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}let u=function(e,t,i,s=!1){var r,n,o,a;if(!_)return{};let u=e?[...r6,...t||[]]:[],[d,h]=te(_),[p,v]=function(e){for(let t=0;tr.length>t;t++){let[i,s,r]=tr[t],n=e.match(i);if(n){let t=r&&e.match(r)||n;return[s,(null==t?void 0:t[1])||""]}}return["",""]}(_),f=function(){let e="u">typeof navigator?navigator:void 0;return(null==e?void 0:e.brave)?{brave:!0}:{}}(),g={};H(i)||(g.detectGoogleSearchApp=i);let m={},y=null===(r=navigator)||void 0===r||null===(r=r.userAgentData)||void 0===r?void 0:r.platform,b=null===(n=navigator)||void 0===n?void 0:n.maxTouchPoints,w=null==l||null===(o=l.screen)||void 0===o?void 0:o.width,E=null==l||null===(a=l.screen)||void 0===a?void 0:a.height,$=null==l?void 0:l.devicePixelRatio;H(y)||(m.userAgentDataPlatform=y),H(b)||(m.maxTouchPoints=b),H(w)||(m.screenWidth=w),H(E)||(m.screenHeight=E),H($)||(m.devicePixelRatio=$);let S=sT(sI({$os:d,$os_version:h,$browser:e4(_,navigator.vendor,f,g),$webview_app:p,$webview_app_version:v,$device:tt(_),$device_type:ti(_,m),$timezone:na(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:r1(s?tc(null==c?void 0:c.href):null==c?void 0:c.href,u,r8),$host:null==c?void 0:c.host,$pathname:null==c?void 0:c.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:e9(_,navigator.vendor,f,g),$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.innerHeight,$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&&sT(a,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&sT(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null===(d=this.Du)||void 0===d?void 0:d.length}catch(e){a.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===oU&&(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=sT(a,n),"$pageview"===e&&h&&(a.title=h.title),!H(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(),v=this.sessionPersistence.properties(),f=a.$groups,g=p.$groups;B(f)&&!U(f)&&(a.$groups=ty(ty({},B(g)?g:{}),f)),sO(["$referrer","$referring_domain"],e=>{e in p&&delete v[e]});let m={};if(this.$u.length>0)for(let e of this.$u.slice())try{sT(m,e())}catch(e){ix.error("Failed to produce browser extension event properties",e)}(a=sT({},u,p,v,ty(ty({},m),a))).$is_identified=this._isIdentified(),N(this.config.property_denylist)?sO(this.config.property_denylist,function(e){delete a[e]}):ix.error(o7+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);let y=this.config.sanitize_properties;y&&(ix.error(o9),a=y(a,e));let b=this.rh();return a.$process_person_profile=b,b&&!r&&this.oh("_calculate_event_properties"),a}ih(e,t=!0,i=!1){var s;if(!this.persistence||!this.rh()||this.Su&&!i)return e;let r=sT({},this.persistence.get_initial_props(),(null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(ix.error(o9),r=n(r,"$set_once")),t&&(this.Su=!0),U(r)?void 0:r}register(e,t){var i;null===(i=this.persistence)||void 0===i||i.register(e,t)}register_once(e,t,i){var s;null===(s=this.persistence)||void 0===s||s.register_once(e,t,i)}register_for_session(e){var t,i;null===(t=this.persistence)||void 0===t||t.syncCookieProperties(),this.nh(),null===(i=this.sessionPersistence)||void 0===i||i.register(e),Object.keys(e).forEach(e
2=>this.xu.add(e)),this.sh()}unregister(e){var t;null===(t=this.persistence)||void 0===t||t.unregister(e)}unregister_for_session(e){var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e),this.xu.delete(e),this.sh()}ah(e,t){this.register({[e]:t})}Lu(){this.xu.forEach(e=>{var t;null===(t=this.sessionPersistence)||void 0===t||t.unregister(e)}),this.xu.clear(),this.sh()}sh(){var e;if(!this.Cu)return;if("memory"===this.config.persistence||(null===(e=this.sessionPersistence)||void 0===e?void 0:e.pi)||!re.Et())return void re.Lt(this.Cu);let t=[];this.xu.forEach(e=>t.push(e)),t.length>0?re.At(this.Cu,t):re.Lt(this.Cu)}getFeatureFlag(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null===(t=this.featureFlags)||void 0===t?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!==(e=null===(t=this.featureFlags)||void 0===t?void 0:t.getAllFeatureFlags())&&void 0!==e?e:[]}isFeatureEnabled(e,t){var i,s;return null!==(i=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(e,t))&&void 0!==i?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null===(e=this.featureFlags)||void 0===e||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t=!1,i){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.au.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:o8}),()=>{})}onSessionId(e){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t=!1){this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:o8})}getActiveMatchingSurveys(e,t=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:o8})}renderSurvey(e,t){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(e,t)}displaySurvey(e,t=oY){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null===(t=this.surveys)||void 0===t||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!==(t=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(e))&&void 0!==t?t:{visible:!1,disabledReason:o8}}canRenderSurveyAsync(e,t=!1){var i,s;return null!==(i=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:o8})}uh(e){return!e||q(e)?(ix.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(ix.critical(`The string "${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())||(ix.critical(`The string "${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 ix.uninitializedWarning("posthog.identify");if(G(e)&&(e=e.toString(),ix.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(e)||!this.oh("posthog.identify"))return;this.yu();let s=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,n=this.nh(!1),o=this.persistence.Pl(),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(iC),this.register({distinct_id:e}));let o=(this.persistence.get_property("$user_state")||"anonymous")===sy,u=e!==s,d=!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,sb),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(sk,r,{$set:t||{},$set_once:i||{}}),this.Eu=oB(e,t,i),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(d){this.persistence.set_property(sa,sb);let s=t||{},r=i||{};this.setPersonPropertiesForFlags({$set:s,$set_once:r},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:s,$set_once:r}),this.Eu=oB(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);u||r||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ss)):d&&(t||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}setPersonProperties(e,t){if(!e&&!t||!this.oh("posthog.setPersonProperties"))return;let i=oB(this.get_distinct_id(),e,t);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Eu=i):ix.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var t;let i=(N(e)?e:[e]).filter(e=>z(e)&&e.length>0);0!==i.length&&this.oh("posthog.unsetPersonProperties")&&(null===(t=this.featureFlags)||void 0===t||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(e,t,i){var s;if(!e||!t)return void ix.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.nh();let r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ty(ty({},r),{},{[e]:t})}),(n||i)&&this.rh()){let s={$group_type:e,$group_key:t};
2i&&(s.$group_set=i),this.capture(sP,s)}i&&this.setGroupPropertiesForFlags({[e]:i}),n&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e=!0){var t;null===(t=this.featureFlags)||void 0===t||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t=!0){var i;this.oh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null===(t=this.featureFlags)||void 0===t||t.resetGroupPropertiesForFlags(e)}reset(e){let t=Y(e)?e:null==e?void 0:e.resetDeviceID,i=Y(e)||null==e?void 0:e.bootstrap;this.hh(t,!1,i)}hh(e,t=!1,i){var s,r,n,o,a,l,u,d,h,c,p,v,f,g,_,m,y,b,w,x,E;if(ix.info("reset"),!this.__loaded)return ix.uninitializedWarning("posthog.reset");let $=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(s=this.Ru)||void 0===s?void 0:s.bootstrap)||{},null===(r=this.featureFlags)||void 0===r||null===(n=r.updateConfig)||void 0===n||n.call(r,this.config,this.Yl());let S=this.get_property(iT),k=this.get_property(iF),P=this.get_property(iW);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();let M=this.is_capturing();this.consent.reset(),t||!M||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 O=null===(a=this.persistence)||void 0===a||null===(l=a.Pl)||void 0===l?void 0:l.call(a),T=!1;try{if(null===(u=this.persistence)||void 0===u||u.clear(),null===(d=this.sessionPersistence)||void 0===d||d.clear(),this.xu.clear(),this.sh(),H(P)||null===(m=this.persistence)||void 0===m||m.register({$session_recording_remote_config:P}),null===(h=this.surveys)||void 0===h||h.reset(),null===(c=this.featureFlags)||void 0===c||c.reset(),null===(p=this.conversations)||void 0===p||p.reset(),null===(v=this.logs)||void 0===v||v.reset(),null===(f=this.metrics)||void 0===f||f.reset(),null===(g=this.persistence)||void 0===g||g.set_property("$user_state","anonymous"),null===(_=this.sessionManager)||void 0===_||_.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:sp,$device_id:null},"");else{let t=this.config.get_device_id(sz());this.register_once({distinct_id:t,$device_id:e?t:S},""),e||H(k)||this.register({[iF]:k})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i&&(i.distinctID&&!this.fu()&&(null===(w=this.persistence)||void 0===w||w.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(y=this.featureFlags)||void 0===y||y.initialize(),!W($)&&!(null===(b=this.sessionManager)||void 0===b?void 0:b.setBootstrapSessionId($,!0)))){let e=ty({},i);delete e.sessionID,this.config.bootstrap=e}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,T=!0}finally{O&&(null===(x=this.persistence)||void 0===x||null===(E=x.Ol)||void 0===E||E.call(x,T))}this.reloadFeatureFlags()}shutdown(e){var t=this;return ea(function*(){var e,i,s,r,n,o,a,l;if(t.__loaded){t.ku=!0,t.zu().dispose(),null===(e=t.sessionRecording)||void 0===e||e.dispose(),null===(i=t.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(s=t.metrics)||void 0===s||s.flush("sendBeacon"),null===(r=t.Fu)||void 0===r||r.unload(),null===(n=t.Du)||void 0===n||n.unload();try{null===(l=t.featureFlags)||void 0===l||l.destroy()}catch(e){ix.error("Error while destroying feature flags",e)}null===(o=t.persistence)||void 0===o||o.destroy(),null===(a=t.sessionPersistence)||void 0===a||a.destroy()}else ix.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)||void 0===i||i.dh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(e=this.conversations)||void 0===e||e.fh()}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?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?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/${this.config.token}/replay/${t}`);if((null==e?void 0:e.withTimestamp)&&i){var r;let t=null!==(r=e.timestampLookBack)&&void 0!==r?r:10;if(!i)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-t,0)}`}return s}alias(e,t){return e===this.get_property("$people_distinct_id")?(ix.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(H(t)&&(t=this.get_distinct_id()),e!==t?(this.ah(iC,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(ix.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){let t=ty({},this.config);if(B(e)){var i,s,r,n,o,a,l,u,d,h,c,p,v,f;sT(this.config,al(e));let g=this.bu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new nm(ty(ty({},this.config),{},{persistence:"sessionStorage"}),g,!1);let _=this.Pu(this.config.debug);Y(_)&&(this.config.debug=_),Y(this.config.debug)&&(this.config.debug?(x.DEBUG=!0,sJ.Et()&&sJ.At("ph_debug",!0),ix.info("set_config",{config:e,oldConfig:t,newConfig:ty({},this.config)})):(x.DEBUG=!1,sJ.Et()&&sJ.Lt("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(r=s.updateConfig)||void 0===r||r.call(s,this.config,this.Yl()),null===(n=this.exceptionObserver)||void 0===n||n.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(l=this.tracingHeaders)||void 0===l||l.startIfEnabledOrStop(),null===(u=this.autocapture)||void 0===u||u.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null===(f=this.historyAutocapture)||void 0===f||f.startIfEnabledOrStop()),null===(h=this.exceptionObserver)||void 0===h||h.startIfEnabledOrStop(),null===(c=this.deadClicksAutocapture)||void 0===c||c.startIfEnabledOrStop(),null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),this._u(),null===(v=this.externalIntegrations)||void 0===v||v.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&rz(this,o6,!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)||void 0===t||t.checkAndGetSessionAndWindowId(),a.sampling&&(null===(i=this.sessionRecording)||void 0===i||i.overrideSampling()),a.linked_flag&&(null===(s=this.sessionRecording)||void 0===s||s.overrideLinkedFlag()),a.url_trigger&&(null===(r=this.sessionRecording)||void 0===r||r.overrideTrigger("url")),a.event_trigger&&(null===(n=this.sessionRecording)||void 0===n||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?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(ty(ty({},i),t))}catch(e){return}}addExceptionStep(e,t){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(e,t)}captureLog(e){var t;null===(t=this.logs)||void 0===t||t.captureLog(e)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e.ph}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?void 0:i.loadToolbar(e))&&void 0!==t&&t}get_property(e){var t;return null===(t=this.persistence)||void 0===t?void 0:t.props[e]}getSessionProperty(e){var t;return null===(t=this.sessionPersistence)||void 0===t?void 0:t.props[e]}toString(){var e;let t=null!==(e=this.config.name)&&void 0!==e?e:as;return t!==as&&(t="posthog."+t),t}_isIdentified(){var e,t;return"identified"===(null===(e=this.persistence)||void 0===e?void 0:e.get_property("$user_state"))||"identified"===(null===(t=this.sessionPersistence)||void 0===t?void 0:t.get_property("$user_state"))}rh(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&
2!this._isIdentified()&&U(this.getGroups())&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.__alias)&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.$epp))}Ku(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(e){return"never"===this.config.person_profiles?(ix.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(sc,!0),!0)}bu(){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)}_u(){var e,t,i,s,r;let n=this.bu();return this.is_capturing()||null===(i=this.logs)||void 0===i||i.gh(),(null===(e=this.persistence)||void 0===e?void 0:e.pi)!==n&&(null===(s=this.persistence)||void 0===s||s.set_disabled(n)),(null===(t=this.sessionPersistence)||void 0===t?void 0:t.pi)!==n&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(n)),n&&(this.xu.clear(),this.sh()),n}opt_in_capturing(t){var i,s,r,n,o,a,l,u,d,h,c;if("always"!==this.config.cookieless_mode){if(this.fu()){null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null===(r=this.sessionManager)||void 0===r||r.destroy(),null===(n=this.pageViewManager)||void 0===n||n.destroy(),this.sessionManager=new oC(this),this.pageViewManager=new rG(this),this.persistence&&(this.sessionPropsManager=new oO(this,this.sessionManager,this.persistence));let t=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=e.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;t&&(this.sessionRecording=this.vu(this.sessionRecording,new t(this)),this.lu&&(null===(u=this.sessionRecording)||void 0===u||null===(d=u.onRemoteConfig)||void 0===d||d.call(u,this.lu)))}this.consent.optInOut(!0),this._u(),this.Zu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(h=this.surveys)||void 0===h||h.loadIfEnabled()),(H(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(c=null==t?void 0:t.captureEventName)&&void 0!==c?c:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else ix.warn(o4)}opt_out_capturing(){var e,t;if("always"===this.config.cookieless_mode)return void ix.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.hh(!0,!0),this.consent.optInOut(!1),this._u(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:sp,$device_id:null}),this.du(i),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(t=this.pageViewManager)||void 0===t||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}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._u()}_is_bot(){return d?oI(d,this.config.custom_blocked_useragents):void 0}Qu(){h&&("visible"===h.visibilityState?this.Tu||(this.Tu=!0,this.capture(s$,{title:h.title},{send_instantly:!0}),this.Iu&&(h.removeEventListener(sx,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),sL(h,sx,this.Iu)))}
2debug(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}))}Yl(){let e=this.Ru||{};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?(ix.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&&!W(e[t]),o=i in e&&!W(e[i]);return n?e[t]:!!o&&(r&&r.warn(`Config field '${i}' is deprecated. Please use '${t}' instead. The old field will be removed in a future major version.`),e[i])}(e,"advanced_disable_flags","advanced_disable_decide",0,ix)}Os(e){var t;if(W(this.config.before_send))return e;let i=Object.keys(null!==(t=e.properties)&&void 0!==t?t:{}).filter(X),s=N(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(let t of s)try{if(r=t(r),W(r)){let t=`Event '${e.event}' was rejected in beforeSend function`;return J(e.event)?ix.warn(`${t}. This can cause unexpected behavior.`):ix.info(t),null}r.properties&&!U(r.properties)||ix.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(t){return ix.error(`Error in beforeSend function for event '${e.event}':`,t),null}for(let t of i)if(r.properties&&W(r.properties[t]))return ix.warn(`Event '${e.event}' had its '${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.Bo)||void 0===e?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)})}Pu(e){let t=Y(e)&&!e,i=sJ.Et()&&"true"===sJ.Ot("ph_debug");return!t&&(!!i||e)}};ad.__defaultExtensionClasses={},ad.ph=(()=>{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]]=sC(e.prototype[t[i]])}(ad,["identify"]);var ah=class{constructor(e){this.disabled=!1===e;let t=B(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}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}};let ac="$copy_autocapture",ap=iE("[AutoCapture]");function av(e,t){return t.length>e?t.slice(0,e)+"...":t}var af=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(e){var t;if(!rP(e))return!0;let i=null!==(t=this.vo().css_selector_ignorelist)&&void 0!==t?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=rd(e);if(F(t,"ph-no-capture")||F(t,"ph-sensitive")||rM(e)||i.some(t=>rf(e,t)))return!0;let n=r.parentNode;r=ra(n)?n.host:n&&rr(n)?n:null}return!1}fo(e){if(!this.isEnabled||"pointercancel"===e.type)return void this.uo();if("pointerdown"===e.type){var t;this.uo();let i=rp(e);return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&rr(i)&&(this.ho={target:i,excluded:this.do(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null===(t=this.po)||void 0===t?void 0:t.distinctId}))}let i=this.ho;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.uo():"pointerup"===e.type&&(i.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(e){var t,i;let s=this.ho;this.uo();let r=rp(e);if((null==s?void 0:s.released)&&s.target.isConnected&&s.distinctId===(null===(t=this.po)||void 0===t?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.vo().css_selector_ignorelist)&&void 0!==i?i:rm;return[r,null==h?void 0:h.documentElement,null==h?void 0:h.body].some(t=>{if(!t)return!1;let i=rd(t);return F(i,"ph-no-capture")||F(i,"ph-sensitive")||!rP(t)||rM(t)||e.some(e=>rf(t,e))})?null:s.target}}constructor(e){this.yo=e,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new ah(this.Mr.rageclick),this.xo=null}setup(e){this.Co(),this.po=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?t.dispose():(this.$o=t,this.startIfEnabled())}dispose(){var e;this.So||(this.So=!0,this.po=void 0,null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var e,t;return this.vo(),this.Mr.url_allowlist=null===(e=this.Mr.url_allowlist)||void 0===e?void 0:e.map(e=>new RegExp(e)),this.Mr.url_ignorelist=null===(t=this.Mr.url_ignorelist)||void 0===t?void 0:t.map(e=>new RegExp(e)),this.Mr}Io(){if(!this.isBrowserSupported())return void ap.info("Disabling Automatic Event Collection because this browser is not supported");if(!l||!h)return;let e=this.Mo=e=>{e=e||(null==l?void 0:l.event);try{if("blur"===e.type)return void this.uo();if(0===e.type.indexOf("pointer"))return void this.fo(e);let t="click"===e.type?this.mo(e):void 0;if(V(t))return;this.Eo(e,"$autocapture",t)}catch(e){ap.error("Failed to capture event",e)}};if(sL(l,"blur",e),sL(h,"submit",e,{capture:!0}),sL(h,"change",e,{capture:!0}),sL(h,"click",e,{capture:!0}),sO(["pointerdown","pointermove","pointerup","pointercancel"],t=>{sL(h,t,e,{capture:!0})}),this.vo().capture_copied_text){let e=this.Po=e=>{e=e||(null==l?void 0:l.event);try{this.Eo(e,ac)}catch(e){ap.error("Failed to capture clipboard event",e)}};sL(h,"copy",e,{capture:!0}),sL(h,"cut",e,{capture:!0}),sL(h,"paste",e,{capture:!0})}}To(){this.uo(),this.Mo&&(null==l||l.removeEventListener("blur",this.Mo),sO(["pointerdown","pointermove","pointerup","pointercancel"],e=>{null==h||h.removeEventListener(e,this.Mo,!0)}),null==h||h.removeEventListener("submit",this.Mo,!0),null==h||h.removeEventListener("change",this.Mo,!0),null==h||h.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==h||h.removeEventListener("copy",this.Po,!0),null==h||h.removeEventListener("cut",this.Po,!0),null==h||h.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(e){var t;if(this.So)return;if(this.wo=!0,!e.ok)return void this.startIfEnabled();let i=e.config;
2i.elementsChainAsString&&(this.ko=i.elementsChainAsString);let s=i.autocapture_opt_out;Y(s)&&(null===(t=this.po)||void 0===t||t.kv.set("$autocapture_disabled_server_side",s),this._o=s),this.startIfEnabled()}setElementSelectors(e){this.xo=e}getElementSelectors(e,t){var i;let s=[];return null===(i=this.xo)||void 0===i||i.forEach(i=>{let r=null==h?void 0:h.querySelectorAll(i);null==r||r.forEach(r=>{e!==r&&t!==r||F(s,i)||s.push(i)})}),s}get isEnabled(){var e,t;if(this.So)return!1;let i=null===(e=this.po)||void 0===e?void 0:e.kv.get(iL),s=this._o,r=this.vo();if(!r.remoteRequestsDisabled&&!this.wo)return!1;let n=r.remoteRequestsDisabled&&!this.wo;if(V(s)&&!Y(i)&&!n)return!1;let o=null!==(t=this._o)&&void 0!==t?t:!!i;return!!r.enabled&&!o}Eo(e,t="$autocapture",i){var s,r,n,o;if(!this.isEnabled)return void this.uo();let a=i||rp(e);ro(a)&&(a=a.parentNode||null);let u=this.Co();"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&u.rageclick&&(null===(s=this.rageclicks)||void 0===s?void 0:s.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&r$(a,u.rageclick)&&this.Eo(e,"$rageclick",i);let d=t===ac,h=d?ty(ty({},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}=rk(e,s);if(!function(e,t){let i=null==t?void 0:t.element_allowlist;if(H(i))return!0;for(let t of e)if(i.some(e=>t.tagName.toLowerCase()===e))return!0;return!1}(u,i)||!rg(u,null==i?void 0:i.css_selector_allowlist)||rg(u,null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:rm))return!1;try{let i=l.getComputedStyle(e);if(i&&"pointer"===i.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}let d=e.tagName.toLowerCase();switch(d){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&&(rv.indexOf(d)>-1||"true"===e.getAttribute("contenteditable"))}}(a,e,h,d,d?["copy","cut","paste"]:void 0,{config:{get_current_url:u.getCurrentUrl}})){let{props:i,explicitNoCapture:s,target:d}=function(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:n,disableCaptureUrlHashes:o}){var a,u,d,h;if(!rr(e))return{props:{}};let c=[e],p=new Set([e]),v=e;for(;v.parentNode&&!rn(v,"body")&&1e3>c.length;){if(ra(v.parentNode)){let e=v.parentNode.host;if(p.has(e))break;p.add(e),c.push(e),v=e;continue}if(!rr(v.parentNode)||p.has(v.parentNode))break;p.add(v.parentNode),c.push(v.parentNode),v=v.parentNode}let f="click"===t.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?c.findIndex(e=>rn(e,"button")||rn(e,"a")):-1;f>0&&(s=s||c.slice(0,f+1).some(e=>!rP(e)||rM(e)));let g=[],_={},m,y=!1,b=!1;if(sO(c,e=>{let t=rP(e);if(rn(e,"a")){let i=e.getAttribute("href");y=!!(t&&i&&rA(i))&&(o?tc(i):i)}F(rd(e),"ph-no-capture")&&(b=!0),g.push(function(e,t,i,s,r=!1){let n=e.tagName.toLowerCase(),o={tag_name:n};rv.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?av(1024,rL(e)):av(1024,rc(e)));let a=rd(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),sO(e.attributes,function(i){var n;if((!rM(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==s?void 0:s.includes(i.name))&&!t&&rA(i.value)&&(!z(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]=av(1024,"href"===i.name&&r?tc(e):e)}});let l=1,u=1,d=e;for(;d=function(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!rr(t));return t}(d);)l++,d.tagName===e.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(e,i,s,r,o)),sO(function(e){if(!rP(e))return{};let t={};return sO(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&&rA(s)&&(t[i]=s)}}),t}(e),(e,t)=>{({}).hasOwnProperty.call(_,t)||(_[t]=e)})}),b)return{props:{},explicitNoCapture:b};if(f>0&&(e=c[f],g.splice(0,f)),s||(g[0].$el_text=rn(e,"a")||rn(e,"button")?rL(e):rc(e)),y){g[0].attr__href=y;let e=null===(d=rQ(y))||void 0===d?void 0:d.host,t=null==l||null===(h=l.location)||void 0===h?void 0:h.host;e&&t&&e!==t&&(m=y)}return{props:sT({$event_type:t.type,$ce_version:1},n?{}:{$elements:g},{$elements_chain:N(g)?g.map(e=>{var t,i;let s={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:function(e){let t=e.attr__class;if(t)return N(t)?t:rl(t)}
2(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return sF(e).filter(([e])=>0===e.indexOf("attr__")).forEach(([e,t])=>s.attributes[e]=t),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+=`.${t.replace(/"/g,"")}`;let r=ty(ty(ty(ty({},e.text?{text:e.text}:{}),{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),n={};return sF(r).sort(([e],[t])=>t>e?-1:e>t?1:0).forEach(([e,t])=>n[rD(e.toString())]=rD(t.toString())),s+=":"+sF(n).map(([e,t])=>`${e}="${t}"`).join("")}).join(";"):""},(null===(a=g[0])||void 0===a?void 0:a.$el_text)?{$el_text:null===(u=g[0])||void 0===u?void 0:u.$el_text}:{},m&&"click"===t.type?{$external_click_url:m}:{},_),target:e}}(a,{e:e,maskAllElementAttributes:u.maskAllElementAttributes,maskAllText:u.maskAllText,elementAttributeIgnoreList:u.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:u.disableCaptureUrlHashes});if(s)return!1;let h=this.getElementSelectors(a,d);if(h&&h.length>0&&(i.$element_selectors=h),t===ac){let t=e.type||"clipboard";if("paste"!==t){let e=null==l||null===(n=l.getSelection())||void 0===n?void 0:n.toString(),t=rh(e);if(!t)return!1;i.$selected_content=t,i.$clipboard_text_length=null!==(o=null==e?void 0:e.length)&&void 0!==o?o:0}i.$copy_type=t}return null===(r=this.po)||void 0===r||r.capture(t,i).catch(e=>ap.error("Failed to capture event",e)),!0}}isBrowserSupported(){return j(null==h?void 0:h.querySelectorAll)}},ag=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,i=B(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.Yl(),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}};let a_=iE("[ExceptionAutocapture]"),am=()=>{},ay=e=>{var t;if(j(e))return null!==(t=e.__posthog_layer__)&&void 0!==t?t:e.__rrweb_layer__};function ab(e,t,i){try{if(!(t in e))return am;let s={next:e[t]},r=i(function(...e){return s.next.apply(this,e)});return j(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=ay(i);for(;n;){if(n.next===r)return void(n.next=s.next);i=n.next,n=ay(i)}}}catch(e){return am}}let aw=iE("[TracingHeaders]"),ax=iE("[Web Vitals]"),aE=["CLS","FCP","INP","LCP"],a$=["INP","LCP"],aS=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],ak="disabled",aP="lazy_loading",aM=iE("[SessionRecording]"),aO=iE("[Heatmaps]");function aT(e){return B(e)&&"clientX"in e&&"clientY"in e&&G(e.clientX)&&G(e.clientY)}let aF=iE("[Product Tours]"),aC=e=>{var t;return!e.config.disable_product_tours&&!!(null===(t=e.persistence)||void 0===t?void 0:t.get_property(iz))},aI=["$set_once","$set"],aR=iE("[SiteApps]"),aA="Error while initializing PostHog app with config id ",aL=(e,t)=>(null==e?void 0:e.then)?e.then(t):t(e),aD="SDK is not enabled or survey functionality is not yet loaded",aN="Disabled. Not loading surveys.";var aj=class{constructor(e,t){this.yo=e,this.mh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=e=>{if(this.So||this.Mr.disableSurveys)return;if(!e.ok)return oW.warn("Remote config unavailable. Not loading surveys.");let t=e.config.surveys;if(W(t))return oW.warn("Flags not loaded yet. Not loading surveys.");this.Sh=Y(t)?t:t.length>0,oW.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(e){if(!this.So)return this.xh=e,aL(e.kv.initialize(),()=>{if(this.xh!==e||this.So)return;this.xh=void 0,this.po=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.So?t.dispose():(this.$o=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,null===(t=this._surveyEventReceiver)||void 0===t||t.dis
2pose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(s=i.dispose)||void 0===s||s.call(i),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(e=>clearTimeout(e)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");let t=[];for(let e=0;e<localStorage.length;e++){let i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(this.So||!this.po)return;let e=this.Mr;if(this._surveyManager)return;if(this.yh)return void oW.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void oW.info(aN);if(e.cookielessMode&&this.yo.isOptedOut())return void oW.info("Not loading surveys in cookieless mode without consent.");let t=this.yo.getExtensions();if(!t)return void oW.error("PostHog Extensions not found.");if(H(this.Sh)&&!e.advancedEnableSurveys)return;let i=this.Sh||e.advancedEnableSurveys;this.yh=!0;try{let e=t.generateSurveys;if(e)return this.Ch(e,i),void(this.yh=!1);let s=t.loadExternalDependency;if(!s)return this.$h(sm),void(this.yh=!1);s(e=>{try{if(this.So)return;let t=this.yo.getExtensions();!e&&(null==t?void 0:t.generateSurveys)?this.Ch(t.generateSurveys,i):this.$h("Could not load surveys script",e)}finally{this.yh=!1}})}catch(e){throw this.yh=!1,this.$h("Error initializing surveys",e),e}}Ch(e,t){this.So||(this._surveyManager=e(t),this._surveyEventReceiver=this.yo.createEventReceiver(),oW.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(e,t){oW.error(e,t),this.Th({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.bh.push(e),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;let s=null!==(i=this.po)&&void 0!==i?i:this.mh;if(!s||this.So)return;if(this.Mr.disableSurveys)return oW.info(aN),e([]);let r=s.kv.get(i8);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:t,context:i})=>{this.So||e(t,i)}).catch(e=>oW.error("Error in survey callback",e));let n=this.Mh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(e=>{try{return this.Eh(s,e)}catch(e){return oW.error("Error processing surveys response",e),this.Eh(s,{statusCode:0,error:e})}},e=>this.Eh(s,{statusCode:0,error:e}));this._h=n;let o=()=>{this._h===n&&(this._h=null)};n.then(t=>{o(),this.So||e(t.surveys,t.context)},o).catch(e=>oW.error("Error in survey callback",e))}Mh(e,t){let i=this.po;return i?i.sendRequest(e,t):new Promise(e=>e({statusCode:0,error:Error(aD)}))}Eh(e,t){var i;if(this.So)return{surveys:[],context:{isLoaded:!1,error:aD}};let s=t.statusCode;if(200!==s||!t.json){let e=`Surveys API could not be loaded, status: ${s}`;return 0!==s?oW.error(e):t.error||oW.warn(e),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:e}}}this.wh=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)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length))});return n.length>0&&(null===(i=this._surveyEventReceiver)||void 0===i||i.register(n)),e.kv.set({[i8]:r,[i9]:Date.now()}),{surveys:r,context:{isLoaded:!0}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var e,t;let i=null===(e=null!==(t=this.po)&&void 0!==t?t:this.mh)||void 0===e?void 0:e.kv.get(i9);return G(i)&&Date.now()-i>3e5}Rh(){return G(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(e,t){var i;oG({id:e,current_iteration:null!==(i=null==t?void 0:t.iteration)&&void 0!==i?i:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}Th(e){for(let t of this.bh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){oW.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t=!1){if(!W(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);
2oW.warn("init was not called")}Ah(e){let t=null;return this.getSurveys(i=>{var s;t=null!==(s=i.find(t=>t.id===e))&&void 0!==s?s:null}),t}Fh(e){if(W(this._surveyManager))return{eligible:!1,reason:aD};let t="string"==typeof e?this.Ah(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Oh(e){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(W(this._surveyManager))return{eligible:!1,reason:aD};let t="string"==typeof e?this.Ah(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(W(this._surveyManager))return oW.warn("init was not called"),{visible:!1,disabledReason:aD};let t=this.Oh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return W(this._surveyManager)?(oW.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:aD})):new Promise(i=>{this.getSurveys(t=>{var s;let r=null!==(s=t.find(t=>t.id===e))&&void 0!==s?s:null;if(r){let e=this.Oh(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.yo.isCapturing())return;if(W(this._surveyManager))return void oW.warn("init was not called");let r="string"==typeof e?this.Ah(e):e;if(!(null==r?void 0:r.id))return void oW.warn("Survey not found");if(!oK.includes(r.type))return void oW.warn(`Surveys of type ${r.type} cannot be rendered in the app`);let n=null==h?void 0:h.querySelector(t);if(n){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){oW.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);let e=setTimeout(()=>{var t,s;this.kh.delete(e),!this.So&&this.yo.isCapturing()&&(oW.info(`Rendering survey ${r.id} with delay of ${null===(t=r.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds} seconds`),null===(s=this._surveyManager)||void 0===s||s.renderSurvey(r,n,i),oW.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.kh.add(e)}this._surveyManager.renderSurvey(r,n,i)}else oW.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.yo.isCapturing())return;if(W(this._surveyManager))return void oW.warn("init was not called");let s=this.Ah(e);if(!s)return void oW.warn("Survey not found");let r=s;if((null===(i=s.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&t.ignoreDelay&&(r=ty(ty({},s),{},{appearance:ty(ty({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==nT.Popover&&t.initialResponses&&oW.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){let e=this.Fh(s);if(!e.eligible)return void oW.warn("Survey is not eligible to be displayed: ",e.reason)}t.displayType!==nT.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){W(this._surveyManager)?oW.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;null===(e=this._surveyManager)||void 0===e||null===(t=e.handlePageUnload)||void 0===t||t.call(e)}};function aB(e,t,i){if(W(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 aU=class{constructor(e){this._instance=e,this.Dh=new Set,this.Lh=new Set,this.Nh=new oT,this.qh=(e,t)=>this.jh(e,t)&&this.Bh(e,t)&&this.Hh(e,t)&&this.zh(e,t),this.jh=(e,t)=>!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}init(){var e,t;H(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)||(this.Uh=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook((e,t)=>{this.on(e,t)}))}dispose(){var e;null===(e=this.Uh)||void 0===e||e.call(this),this.Uh=void 0,this.Nh=new oT}register(e){var t,i;if(!H(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)&&(e.forEach(e
2=>{var t;this.Dh.add(e),null===(t=e.steps)||void 0===t||t.forEach(e=>{this.Lh.add((null==e?void 0:e.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){let e=new Set;this.Dh.forEach(t=>{var i;null===(i=t.steps)||void 0===i||i.forEach(t=>{(null==t?void 0:t.selector)&&e.add(t.selector)})}),this._instance.autocapture.setElementSelectors(e)}}replace(e){this.Dh.clear(),this.Lh.clear(),this.register(e)}on(e,t){null!=t&&0!=e.length&&(this.Lh.has(e)||this.Lh.has(t.event))&&this.Dh.forEach(e=>{this.Wh(t,e)&&this.Nh.emit("actionCaptured",e.name)})}Vh(e){this.onAction("actionCaptured",t=>e(t))}Wh(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.Nh.on(e,t)}Bh(e,t){if(null==t?void 0:t.url){var i;let s=null==e||null===(i=e.properties)||void 0===i?void 0:i.$current_url;if(!s||"string"!=typeof s||!aB(s,t.url,t.url_matching||"contains"))return!1}return!0}Hh(e,t){return!!this.Gh(e,t)&&!!this.Zh(e,t)&&!!this.Qh(e,t)}Gh(e,t){var i;if(!(null==t?void 0:t.href))return!0;let s=this.Jh(e);if(s.length>0)return s.some(e=>aB(e.href,t.href,t.href_matching||"exact"));let r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!r&&aB(function(e){let t=e.match(/(?::|")href="(.*?)"/);return t?t[1]:""}(r),t.href,t.href_matching||"exact")}Zh(e,t){var i,s,r,n;if(!(null==t?void 0:t.text))return!0;let o=this.Jh(e);if(o.length>0)return o.some(e=>aB(e.text,t.text,t.text_matching||"exact")||aB(e.$el_text,t.text,t.text_matching||"exact"));let a=(null==e||null===(n=e.properties)||void 0===n?void 0:n.$elements_chain)||"";return!!a&&(i=function(e){let t;let i=[],s=/(?::|")text="(.*?)"/g;for(;!W(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=>aB(e,s,r)))}Qh(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?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?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}Jh(e){var t;return null==(null==e||null===(t=e.properties)||void 0===t?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}zh(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||oj(t.properties.reduce((e,t)=>{let i=N(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)}},aH=class{constructor(e){var t,i;this.Kh=[],this._instance=e,this.Yh=new Map,this.Xh=new Map,this.tc=new Map,this.ec=null===(t=this._instance)||void 0===t||null===(i=t.onSessionId)||void 0===i?void 0:i.call(t,e=>this.nc(e))}sc(e){return!1}rc(){return null}oc(e){}lc(){}ac(e,t){return!!e&&oj(e.propertyFilters,null==t?void 0:t.properties)}uc(e,t){let i=new Map;return e.forEach(e=>{var s;null===(s=e.conditions)||void 0===s||null===(s=s[t])||void 0===s||null===(s=s.values)||void 0===s||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}hc(e,t,i){let s=(i===nb.Activation?this.Yh:this.Xh).get(e),r=[];return this.cc(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r;let n=null===(r=s.conditions)||void 0===r||null===(r=r[i])||void 0===r||null===(r=r.values)||void 0===r?void 0:r.find(t=>t.name===e);return this.ac(n,t)})}register(e){this.dc(e,!1)}replace(e){this.dc(e,!0)}dc(e,t){var i;H(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.vc(e,t),this.fc(e,t))}fc(e,t){var i;let s=e.filter(e=>{var t;return null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length});if(t&&this.tc.clear(),0===s.length)return void(t&&(null===(i=this.gc)||void 0===i||i.replace([])));this.gc||(this.gc=new aU(this._instance),this.gc.init(),this.gc.Vh(e=>this.onAction(e)));let r=[];s.forEach(e=>{var t;null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||t.values.forEac
2h(t=>{if(r.push(t),t.name){var i;let s=null!==(i=this.tc.get(t.name))&&void 0!==i?i:[];s.includes(e.id)||s.push(e.id),this.tc.set(t.name,s)}})}),t?this.gc.replace(r):this.gc.register(r)}mc(e,t){t.forEach((t,i)=>{var s;let r=null!==(s=e.get(i))&&void 0!==s?s:[];t.forEach(e=>{r.includes(e)||r.push(e)}),e.set(i,r)})}vc(e,t){var i,s;let r=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.events)&&(null===(i=e.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),n=e.filter(e=>{var t,i;return(null===(t=e.conditions)||void 0===t?void 0:t.cancelEvents)&&(null===(i=e.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this.uc(e,nb.Activation),a=this.uc(e,nb.Cancellation);t?(this.Yh=o,this.Xh=a):(this.mc(this.Yh,o),this.mc(this.Xh,a)),(0!==r.length||0!==n.length)&&(null!==(i=this.Uh)&&void 0!==i||(this.Uh=null===(s=this._instance)||void 0===s?void 0:s._addCaptureHook((e,t)=>{this.onEvent(e,t)})))}onEvent(e,t){var i,s;let r=this.yc(),n=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$survey_id)||(null==t||null===(s=t.properties)||void 0===s?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){let t=this.bc(e,n);if("consume"===t)return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this._c([n]);if("persist"===t)return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.wc(n),void this.kc([n])}if(this.Xh.has(e)){let i=this.hc(e,t,nb.Cancellation);i.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:i.map(e=>e.id)}),this._c(i.map(e=>e.id)),i.forEach(e=>this.Sc(e.id)))}if(!this.Yh.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.Yh.get(e)});let o=this.hc(e,t,nb.Activation);this.xc(o.map(e=>e.id))}onAction(e){this.tc.has(e)&&this.xc(this.tc.get(e)||[])}xc(e){var t,i;if(0===e.length)return;let s=!!(null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t)),r=[];for(let t of e)s&&this.sc(t)?this.wc(t)&&this.Cc(t):r.push(t);r.length>0&&(this.Kh=[...new Set([...this.Kh,...r])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(e){this.Kh=this.Kh.filter(t=>t!==e);let t=this.$c();return!t.includes(e)&&(this.Tc([...t,e]),this.Ic(),!0)}_c(e){let t=new Set(e);this.Kh=this.Kh.filter(e=>!t.has(e));let i=this.Mc(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this.Tc(s),0===s.length&&this.Ec()),this.kc(e)}Pc(){var e;let t=this.rc();if(!t)return{};let i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t];return i&&"object"==typeof i?i:{}}Cc(e){if(!this.rc())return;let t=this.Pc();this.oc(ty(ty({},t),{},{[e]:Date.now()}))}kc(e){if(!this.rc())return;let t=this.Pc(),i={},s=!1;for(let[r,n]of Object.entries(t))e.includes(r)?s=!0:i[r]=n;s&&(U(i)?this.lc():this.oc(i))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(e){if(!this.$c().includes(e))return;let t=this.Pc()[e];return G(t)?t:void 0}Mc(){var e;let t=this.Ac();return(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[t])||[]}$c(){var e,t,i;let s=this.Mc();if(0===s.length)return[];let r=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Fc()],n=null===(t=this._instance)||void 0===t||null===(i=t.get_session_id)||void 0===i?void 0:i.call(t);return n&&r===n?s:[]}Ic(){var e,t;let i=null===(e=this._instance)||void 0===e||null===(t=e.get_session_id)||void 0===t?void 0:t.call(e);i&&this.Oc(i)}Ec(){this.Dc()}nc(e){var t;let i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Fc()];if(i&&i!==e){let e=this.Mc(),t=this.Pc();e.length>0&&(this.Tc([]),e.filter(e=>G(t[e])).forEach(e=>this.Sc(e))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(e=>!this.Lc(e))}dispose(){var e,t,i;null===(e=this.ec)||void 0===e||e.call(this),this.ec=void 0,null===(t=this.Uh)||void 0===t||t.call(this),this.Uh=void 0,null===(i=this.gc)||void 0===i||i.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}
2getEventToItemsMap(){return this.Yh}Nc(){return this.gc}},az=class extends aH{constructor(e){super(e)}Ac(){return i7}Fc(){return se}rc(){return st}oc(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_timestamps:e})}lc(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_timestamps")}sc(e){var t;let i;this.cc(t=>{i=t.find(t=>t.id===e)});let s=null==i||null===(t=i.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds;return G(s)&&s>0}qc(){return nM.SHOWN}cc(e){var t;null===(t=this._instance)||void 0===t||t.getSurveys(e)}Sc(e){var t;null===(t=this._instance)||void 0===t||t.cancelPendingSurvey(e)}yc(){return oW}Tc(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated:e})}Oc(e){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.register({$surveys_activated_session:e})}Dc(){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.unregister("$surveys_activated_session")}Lc(){return!1}bc(e,t){var i,s;let r;return this.cc(e=>{r=e.find(e=>e.id===t)}),!r||oA(i=r)&&(null===(s=i.conditions)||void 0===s||null===(s=s.events)||void 0===s?void 0:s.repeatedActivation)||"always"===i.schedule?e===nM.SHOWN?"consume":"ignore":e===nM.SHOWN?"persist":e===nM.DISMISSED||e===nM.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},aq=class{constructor(e){this._instance=e}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);H(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)}},aV=class{constructor(e){this._instance=e}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 az(this._instance)}};let aW=(null==l?void 0:l.location)?r2(l.location.hash,"__posthog")||r2(location.hash,"state"):null,aG="_postHogToolbarParams",aK=iE("[Toolbar]"),aY=iE("[FeatureFlags]");var aJ=class{constructor(e,t=!1){this.jc=!1,this.update(e,t)}update(e,t){var i,s,r,n,o,a,l;this.Bc={bootstrap:{featureFlags:null!==(i=null===(s=e.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(r=null===(n=e.bootstrap)||void 0===n?void 0:n.featureFlagPayloads)&&void 0!==r?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)&&void 0!==o?o:3e5,idleRefreshBackoff:H(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,compression:e.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(l=e.evaluation_contexts)&&void 0!==l?l:e.evaluation_environments)&&void 0!==a?a:[],flagKeys:N(e.flag_keys)?e.flag_keys:void 0},!e.evaluation_environments||e.evaluation_contexts||this.jc||(aY.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),H(e.flag_keys)||N(e.flag_keys)||aY.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};let aX=iE("[FeatureFlags]"),aZ=iE("[FeatureFlags]",{debugEnabled:!0}),aQ="\" failed. Feature flags didn't load in time.",a0=["click","keydown","wheel","touchstart","pointerdown"],a1="connection_error",a2=e=>{let t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},a3=e=>{let t={};for(let[i,s]of sF(e||{}))s&&(t[i]=s);return t},a5=e=>ee(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message),a6=iE("[Error tracking]"),a4="webkit-masked-url:",a8=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],a9=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",a4],a7=["__firefox__","__gCrWeb"],le="Refusing to render web experiment since the viewer is a likely bot",lt={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>oL(t,e),not_regex:(e,t)=>!oL(t,e),exact:(e,t)=>
2t===e,is_not:(e,t)=>t!==e},li=iE("[Conversations]"),ls="Conversations not available yet.";function lr(e,t){var i,s,r,n,o,a,l;let u=null!==(i=null==e?void 0:e.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(s=null==e?void 0:e.maxBufferSize)&&void 0!==s?s:100,c=(null==t?void 0:t.consoleCapture)?void 0:null!==(r=null==e?void 0:e.maxLogsPerInterval)&&void 0!==r?r:1e3,p=H(c)?Math.max(h,2048):Math.max(h,c),v=ty(ty({},function(){let e="",t="";try{let i=null==d?void 0:d.userAgent;i&&([e,t]=te(i))}catch(e){}return function(e,t){let i=function(e){if(e)return({}).hasOwnProperty.call(il,e)?il[e]:e}(e);return ty(ty({},i?{"os.name":i}:{}),t?{"os.version":t}:{})}(e,t)}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!==(n=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==e?void 0:e.serviceName)&&void 0!==n?n:null==t?void 0:t.serviceNameDefault,serviceVersion:null!==(a=null==v?void 0:v["service.version"])&&void 0!==a?a:null==e?void 0:e.serviceVersion,environment:null!==(l=null==v?void 0:v["deployment.environment"])&&void 0!==l?l:null==e?void 0:e.environment,resourceAttributes:v,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}let ln=["debug","log","warn","error","info"],lo=e=>{for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},la="console",ll="__posthogHandledLogsRequestError",lu=(e,t)=>{let i=e instanceof Error?e:Error(t);return i[ll]=!0,i},ld=e=>!!e&&"object"==typeof e&&!0===e[ll],lh={featureFlags:class{constructor(e){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=aX,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Yc=!1,this.Xc=0,this.td=!1,this.sn=()=>{let e=this.ed();this.Xc=0,e&&this.reloadFeatureFlags()},this.nd=()=>{var e,t;let i=this.sd,s=null!==(e=this.rd)&&void 0!==e?e:i;H(i)||H(s)||this.Mr.remoteRequestsDisabled||!h||"hidden"===h.visibilityState||Date.now()-(null!==(t=this.od)&&void 0!==t?t:0)<s||(this.rd=this.td||!this.Mr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{"visible"===(null==h?void 0:h.visibilityState)&&this.ud()},"get"in e?this.yo=e:(this._instance=e,this.hd=new aJ(e.config,e.Yl()),this.yo=this.hd)}updateConfig(e,t){var i;null===(i=this.hd)||void 0===i||i.update(e,t),this.po&&this.dd()}setup(e){return this.xh=e,this.$=e.logger.createLogger("[FeatureFlags]"),aL(e.kv.initialize(),()=>{this.xh===e&&(this.xh=void 0,this.po=e,this.vd(e))})}vd(e){var t;if(this.po===e)return l&&sL(l,"online",this.sn),this.dd(),this.fd=e.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){let e=this.Mr.refreshIntervalMs,t=!this.Mr.remoteRequestsDisabled&&h&&!H(e)&&e>0?e:void 0;this.Mr.idleRefreshBackoff||(this.rd=t),t!==this.sd&&(this._d(),H(t)||(this.sd=t,this.rd=t,this.ld(),(null==h?void 0:h.addEventListener)&&(sL(h,sx,this.an),sM(a0,e=>{sL(h,e,this.ad,{capture:!0})}))))}ld(){H(this.sd)||(H(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var e;H(this.wd)||(clearInterval(this.wd),this.wd=void 0,null==h||null===(e=h.removeEventListener)||void 0===e||e.call(h,"visibilitychange",this.an),sM(a0,e=>{var t;null==h||null===(t=h.removeEventListener)||void 0===t||t.call(h,e,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var e,t;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),null===(e=this.fd)||void 0===e||e.dispose(),this.fd=void 0,null===(t=this.gd)||void 0===t||t.call(this),this.gd=void 0,this.Wc=[],null==l||l.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(e){var t;return this.Cd&&e in this.Cd?this.Cd[e]:null===(t=this.po)||void 0===t?void 0:t.kv.get(e)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var e;return!H(null===(e=this.po)||void 0===e?void 0:e.kv.get("$enabled_feature_flags"))&&this.md()}At(e){this.Td(()=>{var t;return null===(t=this.po)||void 0===t?void 0:t.kv.set(e)})}Id(e,t,i){var s;if(!(null===(s=this._instance)||void 0===s?void 0:s.persistence)||!e.$enabled_feature_flags)return;let r=this.xd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,e])=>!(null==e?void 0:e.failed)).map(([e])=>e):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:i&&!N(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),d=this.xd("$feature_flag_payloads")||{},h=e.$feature_flag_payloads||{},c=l||i?u:Array.from(new Set([...Object.keys(d),...Object.keys(h)])),p=!l&&!i,v=!!p||u,f={[iJ]:v,[iY]:v,[iQ]:!!p||c};for(let t of(e.$feature_flag_details&&(f[iZ]=v),[i0,so,i1]))H(e[t])||(f[t]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(f)}Lt(e){this.Td(()=>{var t;return null===(t=this.po)||void 0===t?void 0:t.kv.remove(e)})}Td(e){try{e()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}yd(){let e={};for(let t of[iJ,iQ,i0,i2]){let i=this.xd(t);H(i)||(e[t]=i)}this.zc=e;let t=ty({},e),i=this.xd(iY);if(i)for(let[e,s]of Object.entries(i))t[`$feature/${e}`]=s;this.Uc=t}pd(){let e=this.Mr.cacheTtlMs;
2if(!e||0>=e)return!1;let t=this.xd(so);return"number"!=typeof t||Date.now()-t>e}Md(){return!!this.pd()&&(this.Yc||this.Gc||(this.Yc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){let e=this.Mr.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}):[]}Pd(){let e=this.Mr.flagKeys;if(!H(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.Mr,n=null!==(e=null===(t=r.bootstrap)||void 0===t?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(n).length){let e=null!==(i=null===(s=r.bootstrap)||void 0===s?void 0:s.featureFlagPayloads)&&void 0!==i?i:{},t=Object.keys(n).filter(e=>!H(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.Rd({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.xd("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==i?void 0:i.merge)&&null!==(r=this.xd("$feature_flag_payloads"))&&void 0!==r?r:{},a=ty(ty({},n),e),l=ty(ty({},o),t),u={};for(let[e,t]of Object.entries(a))u[e]={key:e,enabled:t0(t),variant:t1(t),reason:void 0,metadata:H(null==l?void 0:l[e])?void 0:{id:0,version:void 0,description:void 0,payload:l[e]}};this.Rd({flags:u})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.xd(iZ),t=this.xd(i2),i=this.xd(i3);if(!i&&!t)return e||{};let s=sT({},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=H(a)?null!==(r=null==o?void 0:o.enabled)&&void 0!==r&&r:!!a,u=H(a)?null==o?void 0:o.variant:"string"==typeof a?a:void 0,d=null==i?void 0:i[e],h=ty(ty({},o),{},{enabled:l,variant:l?null!=u?u:null==o?void 0:o.variant:void 0});l!==(null==o?void 0:o.enabled)&&(h.original_enabled=null==o?void 0:o.enabled),u!==(null==o?void 0:o.variant)&&(h.original_variant=null==o?void 0:o.variant),d&&(h.metadata=ty(ty({},null==o?void 0:o.metadata),{},{payload:d,original_payload:null==o||null===(n=o.metadata)||void 0===n?void 0:n.payload})),s[e]=h}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Hc=!0),s}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{let s=e[i];return{key:i,enabled:t0(s),variant:t1(s),payload:tQ(t[i])}})}getFlagVariants(){let e=this.xd(iY),t=this.xd(i2);if(!t)return e||{};let i=sT({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Hc=!0),i}getFlagPayloads(){let e=this.xd(iQ),t=this.xd(i3);if(!t)return e||{};let i=sT({},e||{}),s=Object.keys(t);for(let e=0;s.length>e;e++)i[s[e]]=t[s[e]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Hc=!0),i}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(e=>{try{e()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(e){return this.Wc.push(e),()=>{this.Wc=this.Wc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Qc=e}resetFlagCallReported(){this.Lt(ss)}Fd(e){this.Sd();let t=this.po;if(!t||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!0);let i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:ty(ty(ty({},t.initialPersonProperties),this.xd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.xd(i6),timezone:na()};H(t.deviceId)||(i.$device_id=t.deviceId),((null==e?void 0:e.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);let s=this.Ed();s.length&&(i.evaluation_contexts=s);let r=this.Pd();H(r)||(i.flag_keys=r);let n=this.Mr.onlyEvaluateSurveyFeatureFlags,o=this.Zc;this.Gc=!0;let a=()=>{this.Jc&&(this.Jc=!1,this.Fd())},l=e=>{this.Gc=!1,o===this.Zc&&(this.At({[sn]:[a1]}),this.$.error("Feature flag request failed",e),this.$d()&&this.bd(!0)),a()};try{t.sendRequest("/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(e=>{var t,s;let r=null!==(t=e.json)&&void 0!==t?t:{},l=200!==e.statusCode;if(this.Gc=!1,o!==this.Zc)return void a();if(this.Od(e.statusCode),l||this.Jc||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.Jc)return;this.Kc=!l;let u=[];e.error?u.push(e.error instanceof Error&&"AbortError"===e.error.name?"timeout":e.error instanceof Error?a1:"unknown_error"):200!==e.statusCode&&u.push(`api_error_${e.statusCode}`),r.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");let d=!!(null===(s=r.quotaLimited)||void 0===s?void 0:s.includes("feature_flags"));d&&u.push("quota_limited"),this.At({[sn]:u}),d?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.Rd(r,l,{partialResponse:n}),a()}).catch(l)}catch(e){l(e)}}ed(){return r3(this.Xc,3)}Od(e){this.Xc=r5(e,this.Xc,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,t={}){var i;if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+aQ);if(this.Md())return;let s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i: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,t={}){var i,s,r,n,o,a,l,u,d,h,c,p,v,f;if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+aQ);if(this.Md())return;let g=this.getFlagVariants(),_=e in g,m=g[e],y=this.getFlagPayloads()[e],b=String(m),w=this.xd("$feature_flag_request_id")||void 0,x=this.xd("$feature_flag_evaluated_at")||void 0,E,$=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){let e=null===(i=this.po)||void 0===i?void 0:i.session.sessionId,t=this.xd(sr);e&&e!==t&&($={},E=e)}if(!t.send_event&&"send_event"in t)E&&this.At({[ss]:$,[sr]:E});else if(e in $&&$[e].includes(b))E&&this.At({[ss]:$,[sr]:E});else{N($[e])?$[e].push(b):$[e]=[b],this.At(ty({[ss]:$},E?{[sr]:E}:{}));let t=this.getFeatureFlagDetails(e),i=[...null!==(s=this.xd("$feature_flag_errors"))&&void 0!==s?s:[]];H(m)&&i.push("flag_missing");let g={$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!==(r=null===(n=this.Mr.bootstrap)||void 0===n||null===(n=n.featureFlags)||void 0===n?void 0:n[e])&&void 0!==r?r:null,$feature_flag_bootstrapped_payload:null!==(o=null===(a=this.Mr.bootstrap)||void 0===a||null===(a=a.featureFlagPayloads)||void 0===a?void 0:a[e])&&void 0!==o?o:null,$used_bootstrap_value:!this.Kc};H(null==t||null===(l=t.metadata)||void 0===l?void 0:l.has_experiment)||(g.$feature_flag_has_experiment=t.metadata.has_experiment),H(null==t||null===(u=t.metadata)||void 0===u?void 0:u.version)||(g.$feature_flag_version=t.metadata.version);let _=null!==(d=null==t||null===(h=t.reason)||void 0===h?void 0:h.description)&&void 0!==d?d:null==t||null===(c=t.reason)||void 0===c?void 0:c.code;_&&(g.$feature_flag_reason=_),(null==t||null===(p=t.metadata)||void 0===p?void 0:p.id)&&(g.$feature_flag_id=t.metadata.id),H(null==t?void 0:t.original_variant)&&H(null==t?void 0:t.original_enabled)||(g.$feature_flag_original_response=H(t.original_variant)?t.original_enabled:t.original_variant),(null==t||null===(v=t.metadata)||void 0===v?void 0:v.original_payload)&&(g.$feature_flag_original_payload=null==t||null===(f=t.metadata)||void 0===f?void 0:f.original_payload),i.length&&(g.$feature_flag_error=i.join(",")),this.Dd(g)}return _?{key:e,enabled:!!m,variant:"string"==typeof m?m:void 0,payload:tQ(y)}:void 0}Dd(e){try{var t;null===(t=this.po)||void 0===t||t.capture("$feature_flag_called",e).catch(e=>{this.$.error("Failed to capture feature flag call",e)}
2)}catch(e){this.$.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(e,t){this.Ld(e,t)}Ld(e,t){var i=this;return ea(function*(){let s;let r=i.po;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.Ed();o.length&&(n.evaluation_contexts=o);let a=i.Pd();H(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.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)||void 0===l?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,t={}){if(t.fresh&&!this.Kc)return t.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+aQ),t.defaultValue;let i=this.getFeatureFlag(e,t);return H(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.Rd(e,t,i)}Rd(e,t,i){if(!this.po)return;this.Vc=!0;let s=((e,t={},i={},s={},r,n=aX)=>{let 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)&&void 0!==t?t:i[e].enabled]})),s=Object.fromEntries(Object.keys(i).filter(e=>i[e].enabled).filter(e=>{var t;return!H(null===(t=i[e].metadata)||void 0===t?void 0:t.payload)}).map(e=>{var t;return[e,null===(t=i[e].metadata)||void 0===t?void 0:t.payload]}));return ty(ty({},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 d=e.requestId,h=e.evaluatedAt;if(N(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,[iY]:e,[i1]:!1}}let c=l,p=u,v=a;if(null==r?void 0:r.partialResponse){let e=Object.keys(c),r=p||{};c=ty(ty({},t),c),p=ty(ty({},i),r),e.forEach(e=>{e in r||null==p||delete p[e]}),v=ty(ty({},s),v)}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?void 0:t.failed)}));c=ty(ty({},t),Object.fromEntries(Object.entries(c).filter(([t])=>e.has(t))));let r=Object.fromEntries(Object.entries(p||{}).filter(([t])=>e.has(t)));p=ty(ty({},i),r),e.forEach(e=>{e in r||null==p||delete p[e]}),v=ty(ty({},s),Object.fromEntries(Object.entries(v||{}).filter(([t])=>e.has(t))))}else c=ty(ty({},t),c),p=ty(ty({},i),p),v=ty(ty({},s),v)}return ty(ty({[iJ]:Object.keys(a3(c)),[iY]:c||{},[iQ]:p||{},[iZ]:v||{},[i1]:!0===e.minimalFlagCalledEvents},d?{[i0]:d}:{}),h?{[so]:h}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(s){if(!1===(null==i?void 0:i.persist)){let e=!H(this.po.kv.get(iY));this.Cd=s,e||this.At(s)}else this.md(),this.Id(s,e,!!(null==i?void 0:i.partialResponse)),this.At(s)}else t&&this.$d();t||(this.Yc=!1),this.bd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Nd(e)}Nd(e){if(this.po){if(!1===e)return this.Lt([i2,i3]),this.bd(),void aZ.info("All overrides cleared");if(N(e))return this.At({[i2]:a2(e)}),this.bd(),void aZ.info("Flag overrides set",{flags:e});if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t;this.Hc=!!(null!==(t=e.suppressWarning)&&void 0!==t&&t);let i={},s=e.flags,r=e.payloads;return s&&(i[i2]=N(s)?a2(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.bd(),!1===s?aZ.info("Flag overrides cleared"):s&&aZ.info("Flag overrides set",{flags:s}),void(!1===r?aZ.info("Payload overrides cleared"):r&&aZ.info("Payload overrides set",{payloads:r}))}if(e&&"object"==typeof e)return this.At({[i2]:e}),this.bd(),void aZ.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.Vc){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.xd("$early_access_features")||[]).find(t=>t.flagKey===e),o={[`$feature_enrollment/${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=ty(ty({},this.getFlagVariants()),{},{[e]:t});null===(s=this._instance)||void 0===s||null===(s=s.persistence)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(o)}),this.At({[iJ]:Object.keys(a3(l)),[iY]:l,[i5]:ty(ty({},this.xd("$stored_person_properties")||{}),o)}),this.bd();try{null===(r=this.po)||void 0===r||r.capture("$feature_enrollment_update",a).catch(e=>{this.$.error("Failed to capture early access feature enrollment",e)})}catch(e){this.$.error("Failed to capture early access feature enrollment",e)}}getEarlyAccessFeatures(e,t=!1,i){let s=this.xd(iX);!s||t?this.jd(e,i):e(s)}jd(e,t){var i=this;return ea(function*(){let s;let r=i.po;if(!r)return;let n=t?`&${t.map(e=>`stage=${e}`).join("&")}`:"";try{let e=yield r.sendRequest(`/api/early_access_features/?token=${r.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!e.json)return;s=e.json.earlyAccessFeatures,i.At({[iX]: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),{})}}bd(e){this.yd();let{flags:t,flagVariants:i}=this.qd();
2this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(e){this.$.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t=!0){this.Bd(e,t)}Bd(e,t=!0){let i=this.xd("$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]:ty(ty(ty({},i),n),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let i=ty({},this.xd("$stored_person_properties")||{});e.forEach(e=>{delete i[e]}),this.At({[i5]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(i5),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let i=this.xd("$stored_group_properties")||{},s=ty({},i);for(let t of Object.keys(e))s[t]=ty(ty({},i[t]),e[t]);this.At({[i6]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.xd("$stored_group_properties")||{};this.At({[i6]:ty(ty({},t),{},{[e]:{}})})}else this.Lt(i6)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Xc=0}}},lc=ty({productTours:class{get xa(){return this._instance.persistence}constructor(e){this.ef=null,this.if=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if("productTours"in t){var i,s;if(this.xa&&this.xa.register({[iz]:!!t.productTours}),!aC(this._instance))return!this.ef&&W(null===(i=this.xa)||void 0===i?void 0:i.props.ph_product_tours)||aF.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.ef)||void 0===s||s.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&aC(this._instance)&&this.No(()=>this.nf())}No(e){var t,i,s;(null===(t=b.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)?e():null===(i=b.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"product-tours",t=>{t?aF.error("Could not load product tours script",t):e()})}nf(){var e;!this.ef&&(null===(e=b.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)&&(this.ef=b.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(N(this.if)&&!t)return void e(this.if,{isLoaded:!0});let i=this.xa;if(i){let s=i.props[si];if(N(s)&&!t)return this.if=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:t=>{if(!aC(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: ${s}`;return 0===s?t.error||aF.warn(i):aF.error(i),void e([],{isLoaded:!1,error:i})}let r=N(t.json.product_tours)?t.json.product_tours:[];this.if=r,i&&i.register({[si]:r}),e(r,{isLoaded:!0})}})}getActiveProductTours(e){W(this.ef)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(e)}showProductTour(e){var t;null===(t=this.ef)||void 0===t||t.showTourById(e)}previewTour(e){this.ef?this.ef.previewTour(e):this.No(()=>{var t;this.nf(),null===(t=this.ef)||void 0===t||t.previewTour(e)})}dismissProductTour(){var e;null===(e=this.ef)||void 0===e||e.dismissTour("user_clicked_skip")}nextStep(){var e;null===(e=this.ef)||void 0===e||e.nextStep()}previousStep(){var e;null===(e=this.ef)||void 0===e||e.previousStep()}clearCache(){var e;this.if=null,null===(e=this.xa)||void 0===e||e.unregister("ph_product_tours")}resetTour(e){var t;null===(t=this.ef)||void 0===t||t.resetTour(e)}resetAllTours(){var e;null===(e=this.ef)||void 0===e||e.resetAllTours()}cancelPendingTour(e){var t;null===(t=this.ef)||void 0===t||t.cancelPendingTour(e)}}},lh),lp=ty({surveys:class extends aj{constructor(e){super(new aV(e),{get projectToken(){return e.config.token},kv:new aq(e)}),this._instance=e}Mh(e,t){let i=t.query?oc(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)&&void 0!==s?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})})}}},lh),lv=ty({experiments:class e{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Cf("retrieved web experiments from the server"),this.$f=new Map,t.forEach(t=>
2{if(t.feature_flag_key){var i;this.$f&&(e.Cf("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.$f)||void 0===i||i.set(t.feature_flag_key,t));let s=this._instance.getFeatureFlag(t.feature_flag_key);z(s)&&t.variants[s]&&this.Tf(t.name,s,t.variants[s].transforms)}else if(t.variants)for(let i in t.variants){let s=t.variants[i];e.If(s,this._instance)&&this.Tf(t.name,i,s.transforms)}})},t)},this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Cf(le);else if(!this.Mr.disable_web_experiments){if(W(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Cf("applying feature flags",t),t.forEach(e=>{var t,i;if(this.$f&&(null===(t=this.$f)||void 0===t?void 0:t.has(e))){let t=this._instance.getFeatureFlag(e),s=null===(i=this.$f)||void 0===i?void 0:i.get(e);t&&(null==s?void 0:s.variants[t])&&this.Tf(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.Cf(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(e=>{this.Mf(parseInt(i),s,e)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Mr.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=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Mf(t,i,s){let r=s.filter(e=>e.id===t);r&&r.length>0&&(e.Cf(`Previewing web experiment [${r[0].name}] with variant [${i}]`),this.Tf(r[0].name,i,r[0].variants[i].transforms))}static If(t,i){return!W(t.conditions)&&e.Ef(t,i)&&e.Pf(t)}static Ef(t,i){var s,r,n,o;if(W(t.conditions)||W(null===(s=t.conditions)||void 0===s?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?void 0:r.url)||lt[null!==(n=null===(o=t.conditions)||void 0===o?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,e)}return!1}
2static getWindowLocation(){return null==l?void 0:l.location}static Pf(e){var t,i,s,r,n,o,a,l,u;if(W(e.conditions)||W(null===(t=e.conditions)||void 0===t?void 0:t.utm))return!0;let d=r7();if(d.utm_source){let t=!(null===(i=e.conditions)||void 0===i||null===(i=i.utm)||void 0===i?void 0:i.utm_campaign)||(null===(s=e.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==d.utm_campaign,h=!(null===(r=e.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(n=e.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_source)==d.utm_source,c=!(null===(o=e.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_medium)||(null===(a=e.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==d.utm_medium,p=!(null===(l=e.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_term)||(null===(u=e.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)==d.utm_term;return t&&c&&p&&h}return!1}static Cf(e,...t){ix.info(`[WebExperiments] ${e}`,t)}Tf(t,i,s){this._is_bot()?e.Cf(le):"control"!==i?s.forEach(s=>{if(s.selector){var r;e.Cf(`applying transform of variant ${i} for experiment ${t} `,s);let n=null===(r=document)||void 0===r?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.Cf("Control variants leave the page unmodified.")}_is_bot(){return d&&this._instance?oI(d,this.Mr.custom_blocked_useragents):void 0}}},lh);ad.__defaultExtensionClasses=ty({},ty(ty(ty(ty(ty(ty(ty(ty(ty(ty(ty(ty(ty({},lh),{sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var e;return!!(null===(e=this.Hd)||void 0===e?void 0:e.isStarted)}get status(){var e,t;return"awaiting_config"===this.zd||"missing_config"===this.zd?this.zd:null!==(e=null===(t=this.Hd)||void 0===t?void 0:t.status)&&void 0!==e?e:this.zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.zd=ak,this.Ud=void 0,this.Wd=!1,this.Ke=(()=>{var e,t;if(!(null==h?void 0:h.visibilityState)||"visible"===h.visibilityState)return!0;let i=null==l||null===(e=l.performance)||void 0===e||null===(t=e.getEntriesByType)||void 0===t?void 0:t.call(e,"visibility-state");return!(null==i?void 0:i.length)||i.some(e=>"visible"===e.name)})(),this.an=()=>{var e,t;"visible"===(null==h?void 0:h.visibilityState)&&(this.Ke=!0,null===(e=this.Hd)||void 0===e||null===(t=e.setDocumentWasEverVisible)||void 0===t||t.call(e,!0))},!this._instance.sessionManager)throw aM.error("started without valid sessionManager"),Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Mr.cookieless_mode)throw Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==h?void 0:h.addEventListener)&&sL(h,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Wd=!0,null==h||null===(t=h.removeEventListener)||void 0===t||t.call(h,"visibilitychange",this.an),e?this.Vd(!0):this.stopRecording()}get Gd(){var e;let t=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),i=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return l&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.Wd||this.Gd&&(null===(t=this.Hd)||void 0===t?void 0:t.isStarted))return;let i=!H(Object.assign)&&!H(Array.from);this.Gd&&i?(this.Zd(e),aM.info("starting")):(this.zd=ak,this.stopRecording())}Zd(e){var t,i,s,r;if(this.Gd){if("awaiting_config"!==this.zd&&"missing_config"!==this.zd&&(this.zd=aP),(null==b||null===(t=b.__PosthogExtensions__)||void 0===t||null===(t=t.rrweb)||void 0===t?void 0:t.record)&&(null===(i=b.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.Qd(e);else{let t=this._instance.sessionManager;null===(s=b.__PosthogExtensions__)||void 0===s||null===(r=s.loadExternalDependency)||void 0===r||r.call(s,this._instance,this.Jd,i=>
2{if(!this.Wd&&this.Gd&&this._instance.sessionManager===t)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),aM.error("could not load recorder",i)):void this.Qd(e);this.zd="disabled"})}}}stopRecording(){var e,t;null===(e=this.Ud)||void 0===e||e.call(this),this.Ud=void 0,null===(t=this.Hd)||void 0===t||t.stop()}Vd(e=!1){var t,i;null===(t=this.Ud)||void 0===t||t.call(this),this.Ud=void 0,null===(i=this.Hd)||void 0===i||i.discard({discardProducerEvents:e})}Kd(){var e,t;null===(e=this.xa)||void 0===e||e.unregister("$session_is_sampled"),null===(t=this.xa)||void 0===t||t.unregister("$replay_sample_rate")}Yd(e,t){if(W(e))return null;let i=G(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(aM.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i}Xd(e){if(this.xa){var t,i;let s=this.xa,r=()=>{var t;let i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.Yd(null===(t=this.Mr.session_recording)||void 0===t?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.Yd(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=r?r:n;W(o)&&this.Kd();let a=null==i?void 0:i.minimumDurationMilliseconds;s.register({[iW]:ty(ty({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:ty({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:H(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.Ud)||void 0===t||t.call(this),this.Ud=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(r)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.Xd(t),void this.Vd()):(this.Xd(t),void this.startIfEnabledOrStop()):("awaiting_config"===this.zd&&(this.zd="missing_config",aM.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;(null===(i=this.Hd)||void 0===i?void 0:i.log)?this.Hd.log(e,t):aM.warn("log called before recorder was ready")}get Jd(){var e,t;let i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.get_property(iW);return(null==i||null===(t=i.scriptConfig)||void 0===t?void 0:t.script)||"lazy-recorder"}tv(){let e;let t=this._instance.get_property(iW);if(!t)return!1;try{e="object"==typeof t?t:JSON.parse(t)}catch(e){return aM.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}return!W(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}Qd(e){var t,i,s,r;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(null===(t=b.__PosthogExtensions__)||void 0===t?void 0:t.initSessionRecording))return aM.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.Hd||(this.Hd=null===(r=b.__PosthogExtensions__)||void 0===r?void 0:r.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv()){if("missing_config"===this.zd||"awaiting_config"===this.zd)return;return this.zd="awaiting_config",aM.info("persisted remote config is stale, requesting fresh config before starting"),void new nN(this._instance).load()}this.zd=aP,null===(i=(s=this.Hd).setDocumentWasEverVisible)||void 0===i||i.call(s,this.Ke),this.Hd.start(e)}else this.zd=ak}onRRwebEmit(e){var t,i;null===(t=this.Hd)||void 0===t||null===(i=t.onRRwebEmit)||void 0===i||i.call(t,e)}overrideLinkedFlag(){var e,t;this.Hd||null===(t=this.xa)||void 0===t||t.register({$replay_override_linked_flag:!0}),null===(e=this.Hd)||void 0===e||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Hd||null===(t=this.xa)||void 0===t||t.register({$replay_override_sampling:!0}),null===(e=this.Hd)||void 0===e||e.overrideSampling()}overrideTrigger(e){var t,i;this.Hd||null===(i=this.xa)||void 0===i||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}
2),null===(t=this.Hd)||void 0===t||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null===(e=this.Hd)||void 0===e?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(null===(i=this.Hd)||void 0===i?void 0:i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;null===(e=this.Hd)||void 0===e||null===(t=e.flushBeforeIdentityReset)||void 0===t||t.call(e)}}}),{autocapture:class extends af{constructor(e){super(new ag(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this.nv();return!!(e.path||e.search||this.sv(e))}startIfEnabled(){this.isEnabled&&(ix.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,ix.info("History API monitoring stopped")}monitorHistoryChanges(){l&&l.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(e){var t;if(!l||(null===(t=l.history[e])||void 0===t?void 0:t.__posthog_wrapped__))return;let i=this;ab(l.history,e,t=>function(s,r,n){t.call(this,s,r,n),i.hv(e)})}iv(){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}}nv(){let e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:B(e)?e:{}}sv(e=this.nv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}dv(e){let t=this.nv(),i=this.ev;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.sv(t)&&e.hash!==i.hash))}hv(e){try{let t=this.iv();if(!t)return;this.dv(t)&&this._instance.capture(s$,{navigation_type:e}),this.ev=t}catch(t){ix.error(`Error capturing ${e} pageview`,t)}}av(){if(this.rv)return;let e=()=>{this.hv("popstate")};sL(l,"popstate",e),this.rv=()=>{l&&l.removeEventListener("popstate",e)}}uv(){if(this.ov)return;let e=()=>{this.hv("hashchange")};sL(l,"hashchange",e),this.ov=()=>{l&&l.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.vv=!1,this.bo=!1,this.fv=null,this.instance=e,this.vv=!!(null===(t=this.instance.persistence)||void 0===t?void 0:t.props[iD]),this.rageclicks=new ah(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return B(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return W(this.Mr.capture_heatmaps)?W(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.bo||(aO.info("starting..."),this.pv(),this.an());else{var e;clearInterval(null!==(e=this.fv)&&void 0!==e?e:void 0),this.gv(),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.vv=i,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}mv(e){aT(e.originalEvent)&&this.Cr(e.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv="visible"===(null==h?void 0:h.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){l&&h&&(this.yv=this.fa.bind(this),sL(l,sE,this.yv),this.bv=e=>this.Cr(e||(null==l?void 0:l.event)),sL(h,"click",this.bv,{capture:!0}),this._v=e=>this.wv(e||(null==l?void 0:l.event)),sL(h,"mousemove",this._v,{capture:!0}),this.Sv=new rU(this.instance,rj,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),sL(h,sx,this.xv),this.bo=!0)}gv(){var e;l&&h&&(this.yv&&l.removeEventListener(sE,this.yv),this.bv&&h.removeEventListener("click",this.bv,{capture:!0}),this._v&&h.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&h.removeEventListener(sx,this.xv),clearTimeout(this.Cv),null===(e=this.Sv)||void 0===e||e.stop(),this.bo=!1)}$v(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?void 0:o.defaultView)&&void 0!==n?n:l)||void 0===r?void 0:r.getComputedStyle(s).position}catch(e){break}if(F(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}}
2Cr(e,t="click"){var i;if(rs(e.target)||!aT(e))return;let s=this.$v(e,t);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&r$(rp(e),this.instance.config.rageclick)&&this.Zs(ty(ty({},s),{},{type:"rageclick"})),this.Zs(s)}wv(e){!rs(e.target)&&aT(e)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(e,"mousemove"))},500))}Zs(e){if(!l)return;let t=this.Mr.disable_capture_url_hashes?tc(l.location.href):l.location.href,i=this.Mr.custom_personal_data_properties,s=r1(t,this.Mr.mask_personal_data_properties?[...r6,...i||[]]:[],r8);this.Rt=this.Rt||{},this.Rt[s]||(this.Rt[s]=[]),this.Rt[s].push(e)}fa(){this.Rt&&!U(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:rU,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",ty({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>ty(ty({},e),{},{[`$web_vitals_${t.name}_event`]:ty({},t),[`$web_vitals_${t.name}_value`]:t.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mv=e=>{var t;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},W(null==e?void 0:e.name)||W(null==e?void 0:e.value))return void ax.error("Invalid metric received",e);let i="string"==typeof e.navigationURL?e.navigationURL:void 0,s=this.Ev(i);if(H(s))return;let r=G(e.navigationId)||"string"==typeof e.navigationId?`navigation:${e.navigationId}`:`url:${s}`;if(this.Pv&&e.value>=this.Pv)return void ax.error("Ignoring metric with value >= "+this.Pv,e);this.Rt.navigationKey!==r&&(this.Tv(),this.Iv=setTimeout(this.Tv,this.flushToCaptureTimeoutMs)),H(this.Rt.navigationKey)&&(this.Rt.navigationKey=r,this.Rt.url=s),this.Rt.firstMetricTimestamp=H(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let n=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0),o=ty(ty(ty({},e),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,B(e.attribution)&&this.attributionMetrics.indexOf(e.name)>-1){let t={};for(let i of aS){let s="url"===i&&"string"==typeof e.attribution[i]?this.Ev(e.attribution[i]):e.attribution[i];H(s)||(t[i]=s)}o.attribution=t}else delete o.attribution;H(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Tv()},this.Rv=()=>{if(this.bo)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.Av])||("web-vitals"===this.Av&&H(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!H(a)){let n=a.withoutAttribution,o=this.attributionMetrics;r=!H(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 ax.error("web vitals callbacks not loaded - not starting");let l={reportSoftNavs:this.useSoftNavs},u=r&&this.attributionMetrics.indexOf("INP")>-1?ty(ty({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&e(this.Mv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Mv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Mv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&s(this.Mv.bind(this),u),this.bo=!0},this.vv=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[iU]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;let i=B(this.Fv)?null===(e=this.Fv)||void 0===e?void 0:e.web_vitals_allowed_metrics:void 0;return W(i)?(null===(t=this._instance.persistence)||void 0===t?void 0:t.props.$web_vitals_allowed_metrics)||aE:i}get flushToCaptureTimeoutMs(){return(B(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=B(this.Fv)?this.Fv.web_vitals_attribution:void 0;return Y(e)?e?aE:[]:N(e)?e:a$}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=B(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}get Pv(){let e=B(this.Fv)&&G(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){let e=null==c?void 0:c.protocol;if("http:"!==e&&"https:"!==e)return ax.info("Web Vitals are disabled on non-http/https protocols"),!1;let t=B(this.Fv)?this.Fv.web_vitals:Y(this.Fv)?this.Fv:void 0;return Y(t)?t:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&(ax.info("enabled, starting..."),this.No(this.Rv))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("capturePerformance"in t))return;let i=B(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=B(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[iU]:i}),this._instance.persistence.register({[iV]:s})),this.vv=i,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(e){var t;let i=b.__PosthogExtensions__,s=this.Av,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==r?void 0:r[s])||"web-vitals"===s&&H(r)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?e():null==i||null===(t=i.loadExternalDependency)||void 0===t||t.call(i,this._instance,s,t=>{t?ax.error("failed to load script",t):e()})}Ev(e){let t=e||(null==l?void 0:l.location.href);if(!t)return void ax.error("Could not determine current URL");let i=this._instance.config.disable_capture_url_hashes?tc(t):t,s=this._instance.config.custom_personal_data_properties;return r1(i,this._instance.config.mask_personal_data_properties?[...r6,...s||[]]:[],r8)}}}),{exceptionObserver:class{constructor(e){var t;this.Rv=()=>{var e;if(!l||!this.isEnabled||!(null===(e=b.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;let t=b.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=b.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=b.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=t(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=i(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=s(this.captureException.bind(this)))}catch(e){a_.error("failed to start",e),this.Nv()}},this._instance=e,this.qv=!!(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[iN]),this.wt=new eh(ty(ty({},function(e={}){var t,i,s,r;return{refillRate:null!==(t=null!==(i=e.exceptionRateLimiterRefillRate)&&void 0!==i?i:e.__exceptionRateLimiterRefillRate)&&void 0!==t?t:1,bucketSize:null!==(s=null!==(r=e.exceptionRateLimiterBucketSize)&&void 0!==r?r:e.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:a_})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return B(e)?t=ty(ty({},t),e):(H(e)?this.qv:e)&&(t=ty(ty({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(a_.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(e){var t,i,s;(null===(t=b.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions)?e():null===(i=b.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"exception-autocapture",t=>{if(t)return a_.error("failed to load script",t);e()})}Nv(){var e,t,i;null===(e=this.Ov)||void 0===e||e.call(this),this.Ov=void 0,null===(t=this.Dv)||void 0===t||t.call(this),this.Dv=void 0,null===(i=this.Lv)||void 0===i||i.call(this),this.Lv=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.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}captureException(e){try{var t,i,s;let r=null!==(t=null==e||null===(i=e.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==t?t:"Exception";if(this.wt.consumeRateLimit(r))return void a_.info("Skipping exception capture because of client rate limiting.",{exception:r});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(e)}catch(e){}}},exceptions:class{constructor(e){var t,i;this.Bv=[],this.Hv=new tb([new tL,new tW,new tN,new tD,new tq,new tz,new tB,new tV],function(e,...t){return(i,s=0)=>{let r=[],n=i.split("\n"),o=Math.min(n.length,s+1e3),a=[];for(let i=s;o>i;i++){let s=n[i];if(s.length>1024)continue;
2let o=tC.test(s)?s.replace(tC,"$1"):s;if(!o.match(/\S*Error: /)){for(let i of t){let t=i(o,e);if(t){r.push(t);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(!tI(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?tR(e,i):0);for(let i of t)s-=tA(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=tR(r,u);for(let t of(r.splice(u.start-e,e),l))t.start-=e}for(let e of l)(function(e,t){let i=t.start+t.length,s=tA(e,t);s&&e.splice(i+s===e.length?i:t.start,s)})(r,e);return a.some(e=>0===e.start&&r.length===e.length)&&function(e){let t=e.map(e=>`${e.function}|${e.filename}|${e.lineno}|${e.colno}|${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=>ty(ty({},e),{},{filename:e.filename||(t[t.length-1]||{}).filename,function:e.function||"?"}))}(r)}}("web:javascript",tM,tF)),this._instance=e,this.Bv=null!==(t=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==t?t:[],this.zv=tX(this.Uv()),this.Wv=new tZ(this.zv)}onConfigChange(){this.zv=tX(this.Uv()),this.Wv.setConfig(this.zv)}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?void 0:i.suppressionRules)&&void 0!==t?t:[],o=null===(s=r.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.Bv=n,this._instance.persistence&&this._instance.persistence.register({[ij]:this.Bv,[iB]:o})}get Vv(){var e;let t=!!this._instance.get_property(iB),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.Hv.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.zv.enabled)try{if(!z(e)||0===e.trim().length)return void a6.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)=>(tY.has(s)?t.push(s):i[s]=e[s],i),{}),droppedKeys:t}}(this.Gv(t));s.length>0&&a6.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Wv.add(ty({[tG]:e,[tK]:(new Date).toISOString()},i))}catch(e){a6.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this.Zv(t)){if(this.Qv(t))return this.Jv("Exception dropped: matched a suppression rule"),void a6.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(t))return this.Jv("Exception dropped: thrown by a browser extension"),void a6.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Yv(t))return this.Jv("Exception dropped: thrown by an injected browser script"),void a6.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Xv(t))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void a6.info("Skipping exception capture because it was thrown by the PostHog SDK")}let i=this.zv.enabled&&W(e.$exception_steps)?this.tf(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",eh:!0});return e&&this.Wv.clear(),e}catch(e){return a5(e)||a6.error("Failed to capture exception event. Dropping this exception.",e),void this.Wv.clear()}}catch(e){return void(a5(e)||a6.error("Failed to process exception event. Ignoring this exception.",e))}}tf(e){try{let t=this.Wv.getAttachable();return 0===t.length?e:ty(ty({},e),{},{$exception_steps:t})}catch(t){return a6.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Jv(e){this.zv.enabled&&this.Wv.add({[tG]:e,[tK]:(new Date).toISOString()})}Gv(e){return B(e)?ty({},e):{}}Uv(){var e,t;return null!==(e=null===(t=this._instance.config.error_tracking)||void 0===t?void 0:t.exception_steps)&&void 0!==e?e:{}}Qv(e){if(0===e.length)return!1;try{let t=e.reduce((e,{type:t,value:i})=>(z(t)&&t.length>0&&e.$exception_types.push(t),z(i)&&i.length>0&&e.$exception_values.push(i),e),{$exception_types:[],$exception_values:[]});return this.Bv.some(e=>{let i=e.values.map(e=>
2{let i=oN[e.operator],s=t[e.key];if(!i||!s)return!1;let r=N(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 a6.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}Kv(e){let t=e.flatMap(e=>{var t,i;return null!==(t=null===(i=e.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[]}),i=t.filter(({filename:e})=>!!e&&a9.some(t=>e.startsWith(t)));return 0!==i.length&&(!i.every(({filename:e})=>!!e&&e.startsWith(a4))||e.some(({type:e,value:t})=>"NoResponse"===e||z(t)&&a8.some(({value:e,exact:i})=>i?t===e:t.includes(e)))&&!t.some(({in_app:e,filename:t})=>e&&!(null==t?void 0:t.startsWith(a4))))}Yv(e){return e.some(({value:e})=>z(e)&&a7.some(t=>e.includes(t)))}Xv(e){if(e.length>0){var t,i,s,r;let n=null!==(t=null===(i=e[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null===(r=o.filename)||void 0===r?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Zv(e){return!W(e)&&N(e)}}}),lc),{siteApps:class{constructor(e){this._instance=e,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(e,t){if(!t)return;let i=this.globalsForEvent(t);this.rf.push(i),this.rf.length>1e3&&(this.rf=this.rf.slice(10))}get siteAppLoaders(){var e;return null===(e=b._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[this._instance.config.token])||void 0===e?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.lf.bind(this));this.af=()=>{e(),this.rf=[],this.af=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:d,$set:h}=e;return{event:ty(ty({},it(e,aI)),{},{properties:ty(ty(ty({},e.properties),h?{$set:ty(ty({},null!==(t=null===(i=e.properties)||void 0===i?void 0:i.$set)&&void 0!==t?t:{}),h)}:{}),d?{$set_once:ty(ty({},null!==(s=null===(r=e.properties)||void 0===r?void 0:r.$set_once)&&void 0!==s?s:{}),d)}:{}),elements_chain:null!==(n=null===(o=e.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null===(a=e.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}uf(e){var t;let i=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(aR.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)||(aR.error("prepare_external_dependency_script returned null"),null):e}hf(){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==h?void 0:h.defaultView,u=null==l||null===(e=l.Node)||void 0===e?void 0:e.prototype;if(!l||!u)return()=>{};if(this.sf++,this.cf)return this.df();let d=[],c=this,p=new WeakSet,v=(e,t,i)=>{if(!(null==e?void 0:e[t]))return;let s=e[t];e[t]=i(s),d.push(()=>{e[t]=s})},f=e=>{if(p.has(e))return e;let t=c.uf(e);return t&&p.add(t),t},g=e=>e.map(e=>"string"==typeof e?e:f(e)).filter(e=>!V(e));return v(u,"appendChild",e=>function(t){let i=f(t);return i?e.call(this,i):t}),v(u,"insertBefore",e=>function(t,i){let s=f(t);return s?e.call(this,s,i):t}),v(u,"replaceChild",e=>function(t,i){let s=f(t);return s?e.call(this,s,i):i}),[null===(t=l.Element)||void 0===t?void 0:t.prototype,null===(i=l.Document)||void 0===i?void 0:i.prototype,null===(s=l.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(e=>{v(e,"append",e=>function(...t){return e.apply(this,g(t))}),v(e,"prepend",e=>function(...t){return e.apply(this,g(t))})}),[null===(r=l.Element)||void 0===r?void 0:r.prototype,null===(n=l.CharacterData)||void 0===n?void 0:n.prototype,null===(o=l.DocumentType)||void 0===o?void 0:o.prototype].forEach(e
2=>{v(e,"before",e=>function(...t){return e.apply(this,g(t))}),v(e,"after",e=>function(...t){return e.apply(this,g(t))}),v(e,"replaceWith",e=>function(...t){let i=g(t);return t.length&&!i.length?void 0:e.apply(this,i)})}),v(null===(a=l.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",e=>function(t,i){let s=f(i);return s?e.call(this,t,s):null}),this.cf=()=>{d.forEach(e=>e()),this.cf=void 0},this.df()}df(){let e=!1;return()=>{var t;e||(e=!0,this.sf--,0===this.sf&&(null===(t=this.cf)||void 0===t||t.call(this)))}}vf(e,t=!0){let i=this.hf();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.rf.length&&(aR.info(`Processing ${this.rf.length} events for site app with id ${e.id}`),this.rf.forEach(e=>this.vf(()=>{var i;return null===(i=t.processEvent)||void 0===i?void 0:i.call(t,e)})),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null===(i=this.af)||void 0===i||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,aR.info(`Site app with id ${e.id} ${r?"loaded":"errored"}`),s&&i()};try{let{processEvent:i}=this.vf(t=>e.init({posthog:this._instance,callback(e){t(),r(e)}}),!1);i&&(t.processEvent=i),s=!0}catch(t){aR.error(aA+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){aR.error(`Error while processing buffered events PostHog app with config id ${e.id}`,i),t.errored=!0}}ff(){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)}pf(e){if(0===Object.keys(this.apps).length)return;let t=this.globalsForEvent(e);for(let i of Object.values(this.apps))try{this.vf(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})}catch(t){aR.error(`Error while processing event ${e.event} for site app ${i.id}`,t)}}onRemoteConfig(e){var t,i,s,r,n;if(null===(t=this.siteAppLoaders)||void 0===t?void 0:t.length)return this.isEnabled?(this.ff(),void this._instance.on("eventCaptured",e=>this.pf(e))):void aR.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.af)||void 0===i||i.call(this),!e.ok)return;let o=e.config;if(null===(s=o.siteApps)||void 0===s?void 0:s.length){if(this.isEnabled)for(let{id:e,url:t}of o.siteApps)b[`__$$ph_site_app_${e}`]=this._instance,null===(r=b.__PosthogExtensions__)||void 0===r||null===(n=r.loadSiteApp)||void 0===n||n.call(r,this._instance,t,t=>{if(t)return aR.error(aA+e,t)});else aR.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}}),lp),{tracingHeaders:class{constructor(e){this._instance=e,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{var e,t;let i=this.bf();i?(H(this.gf)&&(this.gf=null===(e=b.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),H(this.mf)&&(this.mf=null===(t=b.__PosthogExtensions__)||void 0===t||null===(t=t.tracingHeadersPatchFns)||void 0===t?void 0:t._patchFetch(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Nv()}}initialize(){this.startIfEnabledOrStop()}No(e){var t,i,s;(null===(t=b.__PosthogExtensions__)||void 0===t?void 0:t.tracingHeadersPatchFns)?e():null===(i=b.__PosthogExtensions__)||void 0===i||null===(s=i.loadExternalDependency)||void 0===s||s.call(i,this._instance,"tracing-headers",t=>{if(t)return aw.error("failed to load script",t);e()})}_f(){var e,t;return null!==(e=null!==(t=this._instance.config.tracing_headers)&&void 0!==t?t:this._instance.config.addTracingHeaders)&&void 0!==e?e:this._instance.config.__add_tracing_headers}bf(){let e=this._f();return N(e)?(N(this.yf)?this.yf.splice(0,this.yf.length,...e):this.yf=[...e],e.length>0?this.yf:void 0):(N(this.yf)&&this.yf.splice(0),this.yf=e||void 0,this.yf)}Nv(){var e,t;null===(e=this.gf)||void 0===e||e.call(this),null===(t=this.mf)||void 0===t||t.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}}),{toolbar:class{constructor(e){this.instance=e}wf(e){b.ph_toolbar_state=e}kf(){var e;return null!==(e=b.ph_toolbar_state)&&void 0!==e?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){var s,r;if(sD(this.instance.config)||!l||!h)return!1;e=null!==(s=e)&&void 0!==s?s:l.location,i=null!==(r=i)&&void 0!==r?r:l.history;try{let s;if(!t){try{l.localStorage.setItem("test","test"),l.localStorage.removeItem("test")}catch(e){return!1}t=null==l?void 0:l.localStorage}let r=aW||r2(e.hash,"__posthog")||r2(e.hash,"state"),n=r?tp(()=>JSON.parse(atob(decodeURIComponent(r))))||tp(()=>JSON.parse(decodeURIComponent(r))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(aG)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}Sf(e){let t=b.ph_load_toolbar||b.ph_load_editor;!W(t)&&j(t)?t(e,this.instance):aK.warn("No toolbar load function found")}loadToolbar(e){let t=!!(null==h?void 0:h.getElementById("__POSTHOG_TOOLBAR__"));if(!l||t)return!1;let i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=ty(ty({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(l.localStorage.setItem(aG,JSON.stringify(ty(ty({},s),{},{source:void 0}))),2===this.kf())this.Sf(s);else if(0===this.kf()){var r,n;this.wf(1),null===(r=b.__PosthogExtensions__)||void 0===r||null===(n=r.loadExternalDependency)||void 0===n||n.call(r,this.instance,"toolbar",e=>{if(e)return aK.error("[Toolbar] Failed to load",e),void this.wf(0);this.wf(2),this.Sf(s)}),sL(l,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(s)})}return!0}xf(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return this.maybeLoadToolbar(e,t,i)}}}),lv),{conversations:class{constructor(e){this._instance=e,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Of=e.ok,!e.ok))return;let t=e.config.conversations;W(t)||(Y(t)?this.Rf=t:(this.Rf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;null===(e=this._conversationsManager)||void 0===e||e.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager||this.Af||this._instance.config.disable_conversations||sD(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=null==b?void 0:b.__PosthogExtensions__;if(e&&!H(this.Rf)&&this.Rf){if(this.ne&&this.ne.token){this.Af=!0;try{let t=e.initConversations;if(t)return this.Df(t),void(this.Af=!1);let i=e.loadExternalDependency;if(!i)return void this.Lf(sm);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Lf("Could not load conversations script",t):this.Df(e.initConversations),this.Af=!1})}catch(e){this.Lf("Error initializing conversations",e),this.Af=!1}}else li.error("Conversations enabled but missing token in remote config.")}}Df(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Ff=!1,li.info("Conversations loaded successfully")}catch(e){this.Lf("Error completing conversations initialization",e)}else li.error("Cannot complete initialization: remote config is null")}Lf(e,t){li.error(e,t),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():li.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rf&&!V(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":sD(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Of?"remote_config_failed":H(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?W(this.ne)||!this.ne.token?"missing_token":(null==b?void 0:b.__PosthogExtensions__)?this.Af?"initializing":this.Ff?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.isVisible())&&void 0!==e&&e}
2sendMessage(e,t,i){var s=this;return ea(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(li.warn(ls),null)})()}getMessages(e,t){var i=this;return ea(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(li.warn(ls),null)})()}markAsRead(e){var t=this;return ea(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(li.warn(ls),null)})()}getTickets(e){var t=this;return ea(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(li.warn(ls),null)})()}requestRestoreLink(e){var t=this;return ea(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(li.warn(ls),null)})()}restoreFromToken(e){var t=this;return ea(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(li.warn(ls),null)})()}restoreFromUrlToken(){var e=this;return ea(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(li.warn(ls),null)})()}getCurrentTicketId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null===(t=this._conversationsManager)||void 0===t?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}dh(){var e;null===(e=this._conversationsManager)||void 0===e||e.setIdentity()}fh(){var e;null===(e=this._conversationsManager)||void 0===e||e.clearIdentity()}}}),{logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Nf=!1,this.qf=!1,this.jf=!1,this.$=iE("[logs]"),this.Bf=ty(ty({},this.$),{},{error:(...e)=>{e.some(ld)||this.$.error(...e)}}),this.ia=[],this.Hf=[],this.Xc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var e,t;this.So||(this.Xc=0,null===(e=this.Zf)||void 0===e||e.onReconnect(),null===(t=this.Qf)||void 0===t||t.onReconnect())},this._instance&&(null===(t=this._instance.config.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this.Nf=!0),l&&sL(l,"online",this.Gf)}Jf(e,t,i,s){var r;let n=lr(null===(r=this._instance)||void 0===r||null===(r=r.config)||void 0===r?void 0:r.logs,i);return[new ig(this.Kf(e,t),n,this.Bf,()=>this.Yf(),e=>e(),void 0,s),n]}Xf(){var e,t;let i=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;return this.Zf&&this.tp===i||(null===(t=this.Zf)||void 0===t||t.reset(),this.tp=i,[this.Zf,this.ep]=this.Jf(()=>this.ia,e=>{this.ia=e})),this.Zf}np(){var e,t;let i=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs;return this.Qf&&this.sp===i||(null===(t=this.Qf)||void 0===t||t.reset(),this.sp=i,[this.Qf,this.rp]=this.Jf(()=>this.Hf,e=>{this.Hf=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},la)),this.Qf}setup(e){var t;if(this.So)return;this.po=e,(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.logs)||void 0===t?void 0:t.captureConsoleLogs)&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();let i=!1,s=e.onRemoteConfig(e=>{var t;i=e.ok&&!0===(null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs),this.onRemoteConfig(e)});this.So?s.dispose():(this.$o=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.So||(this.So=!0,this.up(),null===(e=this.$o)||void 0===e||e.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,null==l||l.removeEventListener("online",this.Gf),null===(t=this.hp)||void 0===t||t.call(this),this.hp=void 0,null===(i=this.Zf)||void 0===i||i.reset(),null===(s=this.Qf)||void 0===s||s.reset())}onRemoteConfig(e){var t,i;if(this.So)return;let s=e.ok?null===(t=e.config.logs)||void 0===t?void 0:t.captureConsoleLogs:void 0;W(s)?this.cp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var e,t,i,s;this.up(),null===(e=this.Zf)||void 0===e||e.clearQueue(),this.ia=[],null===(t=this.Zf)||void 0===t||t.reset(),null===(i=this.Qf)||void 0===i||i.clearQueue(),this.Hf=[],null===(s=this.Qf)||void 0===s||s.reset(),this.Xc=0}captureLog(e){this.So||this.Xf().captureLog(e)}captureConsoleLog(e){this.So||this.np().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.So||this.np().captureLog(e,{context:t,occurredAtMs:i})}lp(){var e;return!!(null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e[iq])}op(){var e,t,i;return!(null===(e=this._instance)||void 0===e||null===(t=e.Yl)||void 0===t?void 0:t.call(e))||!!(null===(i=b._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}gh(){var e;this.up(),null===(e=this.Qf)||void 0===e||e.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var e;if(this.Wf||!(null==b?void 0:b.console))return;let t=lr(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.logs).maxBufferSize,i=!0;for(let e of(this.Uf.push(()=>{i=!1}
2),ln)){let s;try{s=lo(b.console[e])}catch(e){continue}s&&this.Uf.push(ab(b.console,e,r=>{let n=(...s)=>{try{i&&this.dp(e,s,t)}catch(e){}return r.apply(b.console,s)};return n.__rrweb_original__=s,n}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(e,t,i){var s;if(this.Wf&&!this.Vf&&0!==t.length){if(null===(s=this._instance)||void 0===s?void 0:s.is_capturing()){if(i>this.zf.length){this.Vf=!0;try{this.zf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Yf()})}finally{this.Vf=!1}}}else this.up()}}up(){if(this.zf=[],this.Wf){for(let e of(this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0),this.Uf))e();this.Uf=[]}}fp(){let e=this.zf;return this.up(),e}get logger(){return this.pp||(this.pp={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)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.pp}flushLogs(e){e?this.gp(e):(this.Zf&&this.Zf.flush().catch(e=>this.mp(e)),this.Qf&&this.Qf.flush().catch(e=>this.mp(e)))}mp(e){ld(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;let e=null==b?void 0:b.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.up();let t=e.loadExternalDependency;if(!t)return this.$.error(sm),void this.up();this.jf=!0;try{t(this._instance,"logs",t=>{if(this.jf=!1,this.So||!this.Nf)return;let i=e.logs;if(!t&&(null==i?void 0:i.initializeLogs)){var s,r,n;let e=this.fp();this.hp=i.initializeLogs(null!==(s=this.po)&&void 0!==s?s:this._instance),this.qf=!0,e.length>0&&(null===(r=i.replayConsoleBuffer)||void 0===r||r.call(i,null!==(n=this.po)&&void 0!==n?n:this._instance,e))}else this.$.error("Could not load logs script",t),this.up()})}catch(e){throw this.jf=!1,e}}Kf(e,t){let i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===P.LogsQueue?e():void 0,setPersistedProperty(e,i){e===P.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.Xc,3))return void t({kind:"fatal",error:lu(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:lu(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{let t=e.statusCode;if(this.bp(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 ${t}`)});else{var i;0===t?(e.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:lu(e.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:Error(`logs request failed with status ${t}`)})}}})})}bp(e){(0!==e||this._instance.__loaded)&&(this.Xc=r5(e,this.Xc,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.")))}gp(e){this.ia.length>0&&this._p(e,this.ia,this.ep,x.LIB_NAME,e=>{this.ia=e}),this.Hf.length>0&&this._p(e,this.Hf,this.rp,la,e=>{this.Hf=e})}_p(e,t,i,s,r){if(0===t.length)return;let n=t.map(e=>e.record);r([]);let o=ih(n,ir(i,x.LIB_NAME,x.LIB_VERSION),s,x.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Yf(){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,W(s)||(t.sessionStartTimestamp=s),W(r)||(t.lastActivityTimestamp=r)}if((null==b||null===(e=b.location)||void 0===e?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tc(b.location.href):b.location.href),this._instance.featureFlags){let e=this._instance.featureFlags.getFlags();e&&e.length>0&&(t.activeFeatureFlags=e)}return t}}}),{metrics:class{constructor(e){this._instance=e,this.$=iE("[metrics]")}initialize(){}Xf(){var e,t;let i=null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e?void 0:e.metrics;return this.Zf&&this.tp===i||(null===(t=this.Zf)||void 0===t||t.reset(),this.tp=i,this.Zf=new ib(this.Kf(),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"])&&void 0!==t?t:null==e?void 0:e.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==e?void 0:e.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?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)&&void 0!==r?r:1e4,maxSeriesPerFlush:null!==(n=null==e?void 0:e.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(i),this.$)),this.Zf}count(e,t=1,i){this.Xf().count(e,t,i)}
2gauge(e,t,i){this.Xf().gauge(e,t,i)}histogram(e,t,i){this.Xf().histogram(e,t,i)}flush(e){if(!this.Zf)return Promise.resolve();if(e){let t=this.Zf.drainWindow();return t&&this.Xs(t,e),Promise.resolve()}return this.Zf.flush().catch(e=>this.$.error("PostHog metrics flush failed:",e))}reset(){var e;null===(e=this.Zf)||void 0===e||e.reset()}Kf(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Xs:e=>t.Xs(e),getLibraryId:()=>x.LIB_NAME,getLibraryVersion:()=>x.LIB_VERSION}}Xs(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(ty(ty({method:"POST",url:this.wp(),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 ${t}`)});else{var i;r({kind:"retry-later",error:null!==(i=e.error)&&void 0!==i?i:Error(`metrics request failed with status ${t}`)})}}}))})}wp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}}));let lf=function(){x.SDK_DIST_CHANNEL="npm";let e=o3[as]=new ad;return function(){function e(){e.done||(e.done=!0,ar=!1,sO(o3,function(e){e._dom_loaded()}))}(null==h?void 0:h.addEventListener)?"complete"===h.readyState?e():sL(h,"DOMContentLoaded",e,{capture:!1}):l&&ix.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var lg=lf}}]);

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.