1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="3e34e231-84f8-4b6b-c3ed-bc0f657839d5")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,669430,e=>{"use strict";var t,n,i,r,s,o,a,u,l,c,h,d,f,v,p=e.i(381772),g=e.i(754452),_=e.i(61106),y=e.i(540151),m=e.i(912037),b=e.i(511938),k=e.i(317608),w=e.i(855111),x=e.i(524906),E=e.i(71495),S="u">("u"<typeof window?"undefined":(0,x._)(window))?window:void 0,$="u">("u"<typeof globalThis?"undefined":(0,x._)(globalThis))?globalThis:S,P=null==$?void 0:$.navigator,M=null==$?void 0:$.document,F=null==$?void 0:$.location,C=null==$?void 0:$.fetch,O=(null==$?void 0:$.XMLHttpRequest)&&"withCredentials"in new $.XMLHttpRequest?$.XMLHttpRequest:void 0,I=null==$?void 0:$.AbortController,A=null==$?void 0:$.CompressionStream,R=null==P?void 0:P.userAgent;function T(){return!(!S||!1===S.navigator.onLine)}var L="u">typeof globalThis?globalThis:S;L&&"u"<typeof self&&(L.self=L),L&&"u"<typeof File&&(L.File=function(){});var D=null!=S?S:{},N="0.8.3",j={DEBUG:!1,LIB_VERSION:N,LIB_NAME:"browser-common",JS_SDK_VERSION:N},B=((t={}).AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t),H=((n={}).GZipJS="gzip-js",n.Base64="base64",n),z=["$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"],q=["token"];function V(e,t){return -1!==e.indexOf(t)}var U=function(e){return e.trim()},W=function(e){return e.replace(/^\$/,"")};function G(e){var t,n=[];return null!=(t=JSON.stringify(e,function(e,t){if("bigint"==(void 0===t?"undefined":(0,x._)(t)))return t.toString();if("function"!=typeof t&&"symbol"!=(void 0===t?"undefined":(0,x._)(t))){if((0,b._)(t,Error))return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==(void 0===t?"undefined":(0,x._)(t))){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(t))return"[Circular]";n.push(t)}return t}}))?t:"null"}var K=Object.prototype,X=K.hasOwnProperty,J=K.toString,Y=Array.isArray||function(e){return"[object Array]"===J.call(e)},Z=function(e){return"function"==typeof e},Q=function(e){return e===Object(e)&&!Y(e)},ee=function(e){if(Q(e)){for(var t in e)if(X.call(e,t))return!1;return!0}return!1},et=function(e){return void 0===e},en=function(e){return"[object String]"==J.call(e)},ei=function(e){return en(e)&&0===e.trim().length},er=function(e){return null===e},es=function(e){return et(e)||er(e)},eo=function(e){return"[object Number]"==J.call(e)&&e==e},ea=function(e){return eo(e)&&e>0},eu=function(e){return"[object Boolean]"===J.call(e)},el=function(e){return V(q,e)};function ec(e){return null===e||"object"!=(void 0===e?"undefined":(0,x._)(e))}function eh(e,t){return({}).toString.call(e)==="[object ".concat(t,"]")}function ed(e){switch(({}
2).toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ev(e,Error)}}function ef(e){return"u">("u"<typeof Event?"undefined":(0,x._)(Event))&&ev(e,Event)}function ev(e,t){try{return(0,b._)(e,t)}catch(e){return!1}}var ep=[!0,"true",1,"1","yes"],eg=function(e){return V(ep,e)},e_=[!1,"false",0,"0","no"];function ey(e,t,n,i,r,s,o){try{var a=e[s](o),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(i,r)}function em(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var s=e.apply(t,n);function o(e){ey(s,i,r,o,a,"next",e)}function a(e){ey(s,i,r,o,a,"throw",e)}o(void 0)})}}var eb=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hub
2spot","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"],ek=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!e)return!1;var n=e.toLowerCase();return eb.concat(t).some(function(e){var t=e.toLowerCase();return -1!==n.indexOf(t)})};function ew(e,t,n,i,r){return t>n&&(i.warn("min cannot be greater than max."),t=n),eo(e)?e>n?(i.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+r),ew(null!=r?r:n,t,n,i))}var ex=function(){function e(t){(0,g._)(this,e),this.C={},this.I=t.I,this.R=ew(t.bucketSize,0,100,t.$),this.A=ew(t.refillRate,0,this.R,t.$),this.O=ew(t.refillInterval,0,864e5,t.$)}return(0,_._)(e,[{key:"F",value:function(e,t){var n=Math.floor((t-e.lastAccess)/this.O);n>0&&(e.tokens=Math.min(e.tokens+n*this.A,this.R),e.lastAccess=e.lastAccess+n*this.O)}},{key:"consumeRateLimit",value:function(e){var t,n=Date.now(),i=String(e),r=this.C[i];return r?this.F(r,n):(r={tokens:this.R,lastAccess:n},this.C[i]=r),0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.I)||t.call(this,e)),0===r.tokens)}},{key:"stop",value:function(){this.C={}}}]),e}(),eE="Mobile",eS="Android",e$="Tablet",eP="Android Tablet",eM="iPad",eF="Apple Watch",eC="Safari",eO="BlackBerry",eI="Samsung Internet",eA="Chrome",eR="Chrome iOS",eT="Internet Explorer",eL="Internet Explorer Mobile",eD="Opera",eN="Microsoft Edge",ej="Firefox",eB="Firefox iOS",eH="Nintendo",ez="PlayStation",eq="Xbox",eV="Android Mobile",eU="Mobile Safari",eW="Windows",eG="Windows Phone",eK="Nokia",eX="Ouya",eJ="Generic "+eE.toLowerCase(),eY="Generic "+e$.toLowerCase(),eZ="Konqueror",eQ="Oculus Browser",e0="Vivaldi",e1="Yandex",e2="Whale",e3="DuckDuckGo",e5="Pale Moon",e4="Waterfox",e6="Brave",e8="Claude",e9="Codex",e7="ChatGPT",te="Google Search App",tt=RegExp("Version/(\\d+(\\.\\d+)?)"),tn=RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ti=RegExp(eq,"i"),tr=RegExp("PlayStation \\w+","i"),ts=RegExp("Nintendo \\w+","i"),to=RegExp("BlackBerry|PlayBook|BB10","i"),ta={"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"},tu=function(e,t,n,i){var r;return t=t||"",((null==n?void 0:n.brave)?e6:null)||((null==i?void 0:i.detectGoogleSearchApp)&&V(e,"GSA/")?te:V(e," OPR/")&&V(e,"Mini")?"Opera Mini":V(e," OPR/")?eD:to.test(e)?eO:V(e,"IEMobile")||V(e,"WPDesktop")?eL:V(e,"OculusBrowser")?eQ:V(e,"SamsungBrowser")?eI:V(e,"Edge")||V(e,"Edg/")?eN:V(e,"Vivaldi/")?e0:V(e,"YaBrowser/")?e1:V(e,"Whale/")?e2:V(e,"DuckDuckGo/")||V(e,"Ddg/")?e3:V(e,"Claude/")?e8:V(e,"Codex/")?e9:V(e,"ChatGPT/")?e7:V(e,"FBIOS")?"Facebook Mobile":V(e,"UCWEB")||V(e,"UCBrowser")?"UC Browser":V(e,"CriOS")?eR:V(e,"CrMo")||V(e,eA)?eA:V(e,eS)&&V(e,eC)?eV:V(e,"FxiOS")?eB:V(e.toLowerCase(),eZ.toLowerCase())?eZ:V(e,"Brave/")?e6:(r=t)&&V(r,"Apple")||V(e,eC)&&!V(e,eA)&&!V(e,eS)?V(e,eE)?eU:eC:V(e,"PaleMoon/")?e5:V(e,"Waterfox/")?e4:V(e,ej)?ej:V(e,"MSIE")||V(e,"Trident/")?eT:V(e,"Gecko")?ej:"")},tl=(a={},(0,y._)(a,eL,[RegExp("rv:(\\d+(\\.\\d+)?)")]),(0,y._)(a,eN,[RegExp("Edge?\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,eA,[RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,eR,[RegExp("CriOS\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,"UC Browser",[RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,eC,[tt]),(0,y._)(a,eU,[tt]),(0,y._)(a,eD,[RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,ej,[RegExp("Firefox\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,eB,[RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,eZ,[RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")]),(0,y._)(a,eO,[RegExp("BlackBerry (\\d+(\\.\\d+)?)"),tt]),(0,y._)(a,eV,[RegExp("android\\s(\\d+(\\.\\d+)?)","i")]),(0,y._)(a,eI,[RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,eQ,[RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,e0,[RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,e1,[RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,e2,[RegExp("Whale\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,e6,[RegExp("Brave\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,e8,[tn]),(0,y._)(a,e9,[tn]),(0,y._)(a,e7,[tn]),(0,y._)(a,e3,[RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,e5,[RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,e4,[RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,te,[RegExp("GSA\\/(\\d+(\\.\\d+)?)")]),(0,y._)(a,eT,[RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")]),(0,y._)(a,"Mozilla",[RegExp("rv:(\\d+(\\.\\d+)?)")]),a),tc=function(e,t,n,i){var r=tl[tu(e,t,n,i)];if(et(r))return null;for(var s=0;r.length>s;s++){var o=e.match(r[s]);if(o)return parseFloat(o[o.length-2])}return null},th=[[RegExp("Xbox; Xbox (.*?)[);]","i"),function(e){return[eq,e&&e[1]||""]}],[RegExp(eH,"i"),[eH,""]],[RegExp(ez,"i"),[ez,""]],[to,[eO,""]],[RegExp(eW,"i"),function(e,t){if(/Phone/.test(t)||/WPDesktop/.test(t))return[eG,""];if(new RegExp(eE).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=ta[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[eW,i]}return[eW,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,function(e){return e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,function(e){var t="";return e&&e.length>=3&&(t=et(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),function(e){return e&&e[2]?[eS,[e[2],e[3],e[4]||"0"].join(".")]:[eS,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,function(e){var 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",""]]],td=function(e){for(var t=0;th.length>t;t++){var n=(0,k._)(th[t],2),i=n[0],r=n[1],s=i.exec(e),o=s&&(Z(r)?r(s,e):r);if(o)return o}return["",""]},tf=function(e){return ts.test(e)?eH:tr.test(e)?ez:ti.test(e)?eq:RegExp(eX,"i").test(e)?eX:RegExp("(Windows Phone|WPDesktop)","i").test(e)?eG:/iPad/.test(e)?eM:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?eF:to.test(e)?eO:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eK,"i").test(e)?eK:/(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(eE).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)?eS:eP:RegExp("(pda|Mobile)","i").test(e)?eJ:RegExp(e$,"i").test(e)&&!RegExp("Tablet pc","i").test(e)?eY:""},tv=function(e,t){var n,i,r,s,o=tf(e);return o===eM||o===eP||"Kobo"===o||"Kindle Fire"===o||o===eY?e$:o===eH||o===eq||o===ez||o===eX?"Console":o===eF?"Wearable":o?eE:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!=(s=null==t?void 0:t.maxTouchPoints)?s:0)>0?600>Math.min(null!=(n=null==t?void 0:t.screenWidth)?n:0,null!=(i=null==t?void 0:t.screenHeight)?i:0)/(null!=(r=null==t?void 0:t.devicePixelRatio)?r:1)?eE:e$:"Desktop"},tp=/\bFBAV\/(\d+(?:\.\d+)*)/i,tg=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",tp],[/\bFBAN\/EMA\b/i,"Facebook Lite",tp],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",tp],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?
2:\/(\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"]],t_="[Truncated]",ty="[Unserializable]";function tm(e){for(var t="",n=0;e.length>n;n++){var i=e.charCodeAt(n);if(55296>i||i>56319)t+=56320>i||i>57343?e[n]:"�";else{var r=e.charCodeAt(n+1);56320>r||r>57343?t+="�":(t+=e[n]+e[n+1],n++)}}return t}function tb(e,t){if(!t)return e;var n=[];try{n=Object.keys(t)}catch(e){n=[]}var i=!0,r=!1,s=void 0;try{for(var o,a=n[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value,l=void 0;try{l=t[u]}catch(e){l=ty}Object.defineProperty(e,u,{value:l,enumerable:!0,writable:!0,configurable:!0})}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return e}var tk=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tw(e,t){return"string"==typeof e&&tk.test(e)?e:t()}function tx(e,t){var n=Error(t);try{Object.defineProperty(n,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch(e){}return n}function tE(e){return e?e.split("#")[0]:e}function tS(e){try{return e()}catch(e){return}}function t$(e,t){var n=setTimeout(e,t);return null!=n&&n.unref&&(null==n||n.unref()),n}function tP(e,t,n){return tM.apply(this,arguments)}function tM(){return(tM=em(function(e,t,n){var i;return(0,E._)(this,function(r){switch(r.label){case 0:return r.trys.push([0,,2,3]),[4,Promise.race([e,new Promise(function(e,r){i=t$(function(){try{null==n||n(),e()}catch(e){r(e)}},t)})])];case 1:return[2,r.sent()];case 2:return clearTimeout(i),[7];case 3:return[2]}})})).apply(this,arguments)}function tF(e){return(tF="function"==typeof Symbol&&"symbol"==(0,x._)(Symbol.iterator)?function(e){return void 0===e?"undefined":(0,x._)(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":(0,x._)(e)})(e)}function tC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function tO(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tC(Object(n),!0).forEach(function(t){!function(e,t,n){var i;(i=function(e){if("object"!=tF(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=tF(n))return n;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t),(t="symbol"==tF(i)?i:i+"")in e)?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var tI=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];(0,g._)(this,e),this.coercers=t,this.stackParser=n,this.modifiers=i}return(0,_._)(e,[{key:"buildFromUnknown",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(n,t,0).apply(e),r=this.buildParsingContext(t),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,n),$exception_level:"error"}}},{key:"modifyFrames",value:function(e){var t=this;return em(function(){var n,i,r,s,o,a,u,l;return(0,E._)(this,function(c){switch(c.label){case 0:n=!0,i=!1,r=void 0,c.label=1;case 1:c.trys.push([1,7,8,9]),s=e[Symbol.iterator](),c.label=2;case 2:if(n=(o=s.next()).done)return[3,6];if(!((a=o.value).stacktrace&&a.stacktrace.frames&&Y(a.stacktrace.frames)))return[3,4];return u=a.stacktrace,[4,t.applyModifiers(a.stacktrace.frames)];case 3:u.frames=c.sent(),c.label=4;case 4:c.label=5;case 5:return n=!0,[3,2];case 6:return[3,9];case 7:return l=c.sent(),i=!0,r=l,[3,9];case 8:try{n||null==s.return||s.return()}finally{if(i)throw r}
2return[7];case 9:return[2,e]}})})()}},{key:"coerceFallback",value:function(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}},{key:"parseStacktrace",value:function(e,t){var n,i;return null!=e.cause&&(n=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),tO(tO({},e),{},{cause:n,stack:i})}},{key:"applyChunkIds",value:function(e,t){return e.map(function(e){return e.filename&&t&&(e.chunk_id=t[e.filename]),e})}},{key:"applyCoercers",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=this.coercers[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;if(a.match(e))return a.coerce(e,t)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return this.coerceFallback(t)}},{key:"applyModifiers",value:function(e){var t=this;return em(function(){var n,i,r,s,o,a,u;return(0,E._)(this,function(l){switch(l.label){case 0:n=e,i=!0,r=!1,s=void 0,l.label=1;case 1:l.trys.push([1,6,7,8]),o=t.modifiers[Symbol.iterator](),l.label=2;case 2:if(i=(a=o.next()).done)return[3,5];return[4,(0,a.value)(n)];case 3:n=l.sent(),l.label=4;case 4:return i=!0,[3,2];case 5:return[3,8];case 6:return u=l.sent(),r=!0,s=u,[3,8];case 7:try{i||null==o.return||o.return()}finally{if(r)throw s}return[7];case 8:return[2,n]}})})()}},{key:"convertToExceptionList",value:function(e,t){var n,i,r,s={type:e.type,value:e.value,mechanism:{type:null!=(n=t.type)?n:"generic",handled:null==(i=t.handled)||i,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(s.stacktrace={type:"raw",frames:e.stack});var o=[s];return null!=e.cause&&o.push.apply(o,(0,w._)(this.convertToExceptionList(e.cause,tO(tO({},t),{},{handled:!0})))),o}},{key:"buildParsingContext",value:function(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return c&&n.length===l||(l=n.length,c=n.reduce(function(n,i){u||(u={});var r=u[i];if(r)n[r[0]]=r[1];else for(var s=e(i),o=s.length-1;o>=0;o--){var a=s[o],l=null==a?void 0:a.filename,c=t[i];if(l&&c){n[l]=c,u[i]=[l,c];break}}return n},{})),c}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}},{key:"buildCoercingContext",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=function(i,r){if(4>=r){var s=n.buildCoercingContext(e,t,r);return n.applyCoercers(i,s)}};return tO(tO({},t),{},{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:function(e){return r(e,i)},next:function(e){return r(e,i+1)}})}}]),e}(),tA=/^([a-z][a-z0-9.+-]+):/i,tR=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function tT(e,t,n,i,r){var s={platform:e,filename:t,function:"<anonymous>"===n?"?":n,in_app:function(e){if(!e||"<anonymous>"===e)return!1;var t=tA.exec(e);return!t||tR.includes(t[1].toLowerCase())}(t)};return et(i)||(s.lineno=i),et(r)||(s.colno=r),s}var tL=function(e,t){var n=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return n||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},tD=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tN=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tj=/\((\S*)(?::(\d+))(?::(\d+))\)/,tB=function(e,t){var n=tD.exec(e);if(n){var i=(0,k._)(n,4);return tT(t,i[1],"?",+i[2],+i[3])}var r=tN.exec(e);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=tj.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var o=(0,k._)(tL(r[1]||"?",r[2]),2),a=o[0];return tT(t,o[1],a,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},tH=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tz=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tq=function(e,t){var n=tH.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i,r=tz.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var s=n[3],o=n[1]||"?";return o=(i=(0,k._)(tL(o,s),2))[0],tT(t,s=i[1],o,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},tV=/\(error: (.*)\)/;function tU(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function tW(e,t){for(var n=t.start;n>0&&tU(e[n-1],e[n-1+t.length]);)n--;return t.start-n}function tG(e,t){for(var n=t.start+t.length,i=n;e.length>i&&tU(e[i],e[i-t.length]);)i++;return i-n}var tK=function(){function e(){(0,g._)(this,e)}return(0,_._)(e,[{key:"match",value:function(e){return this.isDOMException(e)||this.isDOMError(e)}},{key:"coerce",value:function(e,t){var n=en(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}},{key:"getType",value:function(e){return this.isDOMError(e)?"DOMError":"DOMException"}},{key:"getValue",value:function(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?"".concat(t,": ").concat(e.message):t}},{key:"isDOMException",value:function(e){return eh(e,"DOMException")}},{key:"isDOMError",value:function(e){return eh(e,"DOMError")}}]),e}(),tX=function(){function e(){(0,g._)(this,e)}return(0,_._)(e,[{key:"match",value:function(e){return ed(e)}},{key:"coerce",value:function(e,t){var n,i=this.getStack(e);return{type:this.getType(e),value:this.getMessage(e,t),stack:null!=i?i:null==(n=t.syntheticException)?void 0:n.stack,cause:e.cause?t.next(e.cause):void 0,synthetic:void 0===i}}},{key:"getType",value:function(e){return e.name||e.constructor.name}},{key:"getMessage",value:function(e,t){var n=e.message;return String(n.error&&"string"==typeof n.error.message?n.error.message:n)}},{key:"getStack",value:function(e){return e.stacktrace||e.stack||void 0}}]),e}(),tJ=function(){function e(){(0,g._)(this,e)}
2return(0,_._)(e,[{key:"match",value:function(e){return!!eh(e,"ErrorEvent")&&(null!=e.error||this.lr(e))}},{key:"coerce",value:function(e,t){if(null!=e.error)return t.apply(e.error);var n,i=t.apply(e.message);return tO(tO({},i),{},{stack:null!=(n=this.ur(e))?n:i.stack,synthetic:!0})}},{key:"lr",value:function(e){return en(e.message)&&e.message.length>0}},{key:"ur",value:function(e){var t,n,i=null!=(t=e.lineno)?t:0,r=null!=(n=e.colno)?n:0;if(en(e.filename)&&0!==e.filename.length&&0!==i)return"Error\n at ".concat(e.filename,":").concat(i,":").concat(r)}}]),e}(),tY=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,tZ=function(){function e(){(0,g._)(this,e)}return(0,_._)(e,[{key:"match",value:function(e){return"string"==typeof e}},{key:"coerce",value:function(e,t){var n,i=(0,k._)(this.getInfos(e),2),r=i[0],s=i[1];return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}},{key:"getInfos",value:function(e){var t="Error",n=e,i=e.match(tY);return i&&(t=i[1],n=i[2]),[t,n]}}]),e}(),tQ=["fatal","error","warning","log","info","debug"];function t0(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,n=Object.keys(e);if(n.sort(),!n.length)return"[object has no keys]";for(var i=n.length;i>0;i--){var r=n.slice(0,i).join(", ");if(t>=r.length)return i===n.length?r:r.length>t?"".concat(r.slice(0,t),"..."):r}return""}var t1=function(){function e(){(0,g._)(this,e)}return(0,_._)(e,[{key:"match",value:function(e){return"object"==(void 0===e?"undefined":(0,x._)(e))&&null!==e}},{key:"coerce",value:function(e,t){var n,i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null!=(n=this.getStack(e))?n:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}},{key:"getType",value:function(e){if(ef(e))return e.constructor.name;var t="name"in e?e.name:void 0;return en(t)&&!ei(t)?t:"Error"}},{key:"getValue",value:function(e){if("name"in e&&"string"==typeof e.name){var t="'".concat(e.name,"' captured as exception");return"message"in e&&"string"==typeof e.message&&(t+=" with message: '".concat(e.message,"'")),t}if("message"in e&&"string"==typeof e.message)return e.message;var n=this.getObjectClassName(e);return"".concat(n&&"Object"!==n?"'".concat(n,"'"):"Object"," captured as exception with keys: ").concat(t0(e))}},{key:"isSeverityLevel",value:function(e){return en(e)&&!ei(e)&&tQ.indexOf(e)>=0}},{key:"getStack",value:function(e){try{return en(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:en(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}},{key:"getErrorPropertyFromObject",value:function(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var n=e[t];if(ed(n))return n}}},{key:"getObjectClassName",value:function(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}]),e}(),t2=function(){function e(){(0,g._)(this,e)}return(0,_._)(e,[{key:"match",value:function(e){return ef(e)}},{key:"coerce",value:function(e,t){var n,i=e.constructor.name;return{type:i,value:"".concat(i," captured as exception with keys: ").concat(t0(e)),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),t3=function(){function e(){(0,g._)(this,e)}return(0,_._)(e,[{key:"match",value:function(e){return ec(e)}},{key:"coerce",value:function(e,t){var n;return{type:"Error",value:"Primitive value captured as exception: ".concat(String(e)),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}}}]),e}(),t5=function(){function e(){(0,g._)(this,e)}return(0,_._)(e,[{key:"match",value:function(e){return eh(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}},{key:"isCustomEventWrappingRejection",value:function(e){if(!ef(e))return!1;try{var t=e.detail;return null!=t&&"object"==(void 0===t?"undefined":(0,x._)(t))&&"reason"in t}catch(e){return!1}}},{key:"coerce",value:function(e,t){var n,i=this.getUnhandledRejectionReason(e);return ec(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: ".concat(String(i)),stack:null==(n=t.syntheticException)?void 0:n.stack,synthetic:!0}:t.apply(i)}},{key:"getUnhandledRejectionReason",value:function(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==(0,x._)(e.detail)&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}]),e}(),t4="$message",t6="$timestamp",t8=new Set([t4,t6]),t9={enabled:!0,max_bytes:32768};function t7(e){var t;return e?{enabled:null!=(t=e.enabled)?t:t9.enabled,max_bytes:function(e,t){if(!eo(e)||1/0===e||-1/0===e)return t;var n=Math.floor(e);return 0>n?t:n}(e.max_bytes,t9.max_bytes)}:tO({},t9)}var ne=function(){function e(t){(0,g._)(this,e),this.ts=[],this.es=0,this.Mr=t7(t)}return(0,_._)(e,[{key:"setConfig",value:function(e){this.Mr=t7(e),this.ns()}},{key:"add",value:function(e){var t=function(e){var t;try{t=G(e)}catch(e){return}try{var n=JSON.parse(t);if(!Q(n))return;var i=n[t4],r=n[t6];if(!en(i)||0===i.trim().length||!en(r)&&!eo(r))return;return{step:n,json:t}}catch(e){return}}(e);if(t){var n=function(e){if("u">("u"<typeof TextEncoder?"undefined":(0,x._)(TextEncoder)))return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),n=0,i=0;t.length>i;i++)"%"===t[i]?(n+=1,i+=2):n+=1;return n}(t.json);n>this.Mr.max_bytes||(this.ts.push({step:t.step,bytes:n}),this.es+=n,this.ns())}}},{key:"getAttachable",value:function(){return this.ts.map(function(e){return e.step})}},{key:"clear",value:function(){this.ts=[],this.es=0}},{key:"size",value:function(){return this.ts.length}},{key:"ns",value:function(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){var e=this.ts.shift();e&&(this.es-=e.bytes)}}}]),e}(),nt=function(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function nn(e){return"string"==typeof e||e}function ni(e){return"string"==typeof e?e:void 0}var nr=["$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"],ns="NativeGzipValidationError",no=function(e){return e.length>=2&&31===e[0]&&139===e[1]},na=function(e,t){return e===H.GZipJS||t===H.GZipJS||"gzip"===t},nu=function(e){return!(!e||"object"!=(void 0===e?"undefined":(0,x._)(e)))&&"NotReadableError"===("name"in e?String(e.name):"")}
2,nl=function(e){throw tx(ns,"Native gzip produced invalid output: ".concat(e))},nc=(d=em(function(e,t){var n,i,r,s,o;return(0,E._)(this,function(a){switch(a.label){case 0:return 18>e.size&&nl("too-short"),i=Uint8Array.bind,[4,e.slice(0,10).arrayBuffer()];case 1:return no(n=new(i.apply(Uint8Array,[void 0,a.sent()])))&&8===n[2]||nl("invalid-header"),s=DataView.bind,[4,e.slice(e.size-8).arrayBuffer()];case 2:return(r=new(s.apply(DataView,[void 0,a.sent()]))).getUint32(0,!0)!==function(e){for(var t=function(){if(h)return h;h=[];for(var e=0;256>e;e++){for(var t=e,n=0;8>n;n++)t=1&t?0xedb88320^t>>>1:t>>>1;h[e]=t>>>0}return h}(),n=0xffffffff,i=0;e.length>i;i++)n=t[255&(n^e[i])]^n>>>8;return(0xffffffff^n)>>>0}(t)&&nl("invalid-crc"),o=t.length>>>0,r.getUint32(4,!0)!==o&&nl("invalid-size"),[2]}})}),function(e,t){return d.apply(this,arguments)});function nh(){return(nh=em(function(e){var t,n,i,r,s,o,a,u,l,c=arguments;return(0,E._)(this,function(h){switch(h.label){case 0:t=!(c.length>1)||void 0===c[1]||c[1],n=c.length>2?c[2]:void 0,h.label=1;case 1:return h.trys.push([1,4,,5]),i=(new TextEncoder).encode(e),o=(s=(r=new globalThis.CompressionStream("gzip")).writable.getWriter()).write(i).then(function(){return s.close()}).catch((l=em(function(e){return(0,E._)(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,s.abort(e)];case 1:case 2:return t.sent(),[3,3];case 3:throw e}})}),function(e){return l.apply(this,arguments)})),[4,Promise.all([new Response(r.readable).blob(),o])];case 2:return[4,nc(a=k._.apply(void 0,[h.sent(),1])[0],i)];case 3:return[2,(h.sent(),a)];case 4:if(u=h.sent(),null==n?void 0:n.rethrow)throw u;return[2,(t&&console.error("Failed to gzip compress data",u),null)];case 5:return[2]}})})).apply(this,arguments)}var nd=function(){function e(){(0,g._)(this,e),this.rs=0,this.ss=0}return(0,_._)(e,[{key:"record",value:function(e){if("too-large"!==e.kind){if("retry-later"!==e.kind)return void this.reset();if(e.retryAfterMs){var t=this.isOpen(),n=Date.now(),i=Math.min(e.retryAfterMs,3e5);if(!t)return this.ss=n,void(this.rs=n+i);this.rs=Math.max(this.rs,Math.min(n+i,this.ss+3e5))}}}},{key:"remainingMs",value:function(){var e=Date.now();if(this.ss-5e3>e)return this.reset(),0;var t=Math.min(3e5,Math.max(0,this.rs-e));return 0===t&&this.reset(),t}},{key:"isOpen",value:function(){return this.remainingMs()>0}},{key:"reset",value:function(){this.rs=0,this.ss=0}}]),e}();function nf(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if(({}).hasOwnProperty.call(e,i)){if(t.includes(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;s.length>i;i++)t.includes(n=s[i])||({}).propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var nv={}.propertyIsEnumerable;function np(e,t){try{return ng(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(e){return[]}}function ng(e,t,n,i){var r=[];for(var s in e)if(nv.call(e,s)){if(!s){null==t||t.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=n.remainingNodes){null==t||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=e[s];if(er(o)||et(o))continue;r.push({key:tm(s),value:function e(t,n,i,r){if(0>=i.remainingNodes)return{stringValue:t_};if(i.remainingNodes--,eu(t))return{boolValue:t};if("bigint"==(void 0===t?"undefined":(0,x._)(t))){var s,o;return s=t.toString(),t>=(o=BigInt("9223372036854775808"))||-o>t?(null==n||n.debug("Attribute ".concat(s," is outside the int64 range; encoding it as a string")),{stringValue:s}):{intValue:s}}if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(("u"<typeof BigInt?"undefined":(0,x._)(BigInt))>"u")return{stringValue:String(t)};var a=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==n||n.debug("Attribute ".concat(a," is outside the int64 range; encoding it as a string")),{stringValue:a}):{intValue:a}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:tm(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==(void 0===t?"undefined":(0,x._)(t)))return{stringValue:String(t)};if("object"==(void 0===t?"undefined":(0,x._)(t))&&null!==t){if(i.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:t_};if((0,b._)(t,Date)){var u=Number.isFinite(t.getTime())?t.toISOString():String(t);return{stringValue:"string"==typeof u?tm(u):String(u)}}i.ancestors.add(t);try{try{var l=t.toJSON;if("function"==typeof l)return e(l.call(t),n,i,r+1)}catch(e){}return Y(t)?{arrayValue:{values:function(t,n,i,r){for(var s=[],o=Math.min(t.length,1e3),a=0;o>a&&i.remainingNodes>0;a++)try{var u=a in t?t[a]:void 0;if(es(u))continue;s.push(e(u,n,i,r))}catch(e){s.push({stringValue:ty})}return t.length>a&&s.push({stringValue:t_}),s}(t,n,i,r+1)}}:{kvlistValue:{values:ng(t,n,i,r+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:tm(String(t))}}(o,t,n,i)})}catch(e){r.push({key:tm(s),value:{stringValue:ty}})}}return r}function n_(e,t,n){return tO(tO(tO(tO({},tb({},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":n})}var ny=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function nm(e,t){var n=tb({},e),i={},r=!0,s=!1,o=void 0;try{for(var a,u=ny[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;({}).hasOwnProperty.call(n,l)&&(i[l]=n[l],delete n[l])}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return(0,w._)(np(n,t)).concat((0,w._)(np(i,t)))}var nb={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"},nk={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}},nw=nk.info;function nx(e,t,n,i){return{resourceLogs:[{resource:{attributes:nm(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}var nE=function(){function e(t){(0,g._)(this,e),this.ls=t,this.us=0}return(0,_._)(e,[{key:"pending",get:function(){return!!this.hs}},{key:"arm",value:function(e){var t=this;this.clear(),this.us=Date.now()+e,this.hs=t$(function(){t.hs=void 0,t.ls()},e)}},{key:"armNoEarlierThan",value:function(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}},{key:"clear",value:function(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}}]),e}();function nS(){return .75+.5*Math.random()}function n$(e,t,n,i){var r=e*Math.pow(2,Math.min(Math.max(0,t-1),6));return Math.round((void 0===i?r:Math.min(r,Math.max(i,e)))*n)}var nP=function(){function e(t,n,i,r,s){var o,a=this,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:function(){return Promise.resolve()},l=arguments.length>6?arguments[6]:void 0;(0,g._)(this,e),this._instance=t,this.Mr=n,this.$=i,this.cs=r,this.ds=s,this.vs=u,this.fs=l,this.ps=new nE(function(){return a.gs()}),this.ys=null,this.bs=0,this._s=0,this.ws=new nd,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=n.maxBufferSize,this.Is=Math.max(null!=(o=n.maxQueueSize)?o:n.maxBufferSize,n.maxBufferSize),this.Ms=n.flushIntervalMs,this.Es=n.maxBatchRecordsPerPost,this.Ps=n.rateCapWindowMs,this.Rs=n.maxLogsPerInterval}return(0,_._)(e,[{key:"clearQueue",value:function(){this._s++,this._instance.setPersistedProperty(B.LogsQueue,[])}},{key:"reset",value:function(){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}},{key:"onReconnect",value:function(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}},{key:"captureLog",value:function(e,t){var n,i=this;if(!this._instance.isDisabled&&!this._instance.optedOut&&(null==e?void 0:e.body)){var r=this.Os(e);if(null!==r){if(!r.body)return void this.$.info("Log was rejected in beforeSend function");if(this.Ds()){var s={record:function(e,t,n,i){var r=nk[e.level||"info"]||nw,s=r.text,o=r.number,a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Date.now();return String(e)+"000000"}(eo(i)?i:void 0),u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),es(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),es(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(u["url.full"]=t.currentUrl),t.screenName&&(u["screen.name"]=t.screenName),t.appState&&(u["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(u.feature_flags=t.activeFeatureFlags);var l=tO({},u),c=e.attributes;if(c){var h=[];try{h=Object.keys(c)}catch(e){h=[]}var d=!0,f=!1,v=void 0;try{for(var p,g=h[Symbol.iterator]();!(d=(p=g.next()).done);d=!0){var _=p.value,y=void 0;try{y=c[_]}catch(e){y=ty}Object.defineProperty(l,_,{value:y,enumerable:!0,writable:!0,configurable:!0})}}catch(e){f=!0,v=e}finally{try{d||null==g.return||g.return()}finally{if(f)throw v}}}var m={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:s,body:{stringValue:function(e){try{return tm(String(e))}catch(e){return ty}}(e.body)},attributes:np(l,n)};return e.trace_id&&(m.traceId=e.trace_id),e.span_id&&(m.spanId=e.span_id),et(e.trace_flags)||(m.flags=e.trace_flags),m}(r,null!=(n=null==t?void 0:t.context)?n:this.cs(),this.$,null==t?void 0:t.occurredAtMs)};this.ds(function(){return i.Ls(s)})}}}}},{key:"Os",value:function(e){var t=this.Mr.beforeSend;if(!t)return e;var n=Y(t)?t:[t],i=e,r=!0,s=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;try{var c=l(i);if(!c)return this.$.info("Log was rejected in beforeSend function"),null;i=c}catch(e){return this.$.error("Error in beforeSend function for log:",e),null}}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return i}},{key:"Ds",value:function(){if(void 0===this.Rs)return!0;var e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn("captureLog dropping logs: exceeded ".concat(this.Rs," logs per ").concat(this.Ps,"ms")),this.$s=!0),!1)}},{key:"flush",value:function(){var e=this;return em(function(){return(0,E._)(this,function(t){return e._instance.isDisabled?[2]:[2,(e.ys||(e.ys=e.Ns().finally(function(){e.ys=null})),e.ys)]})})()}},{key:"Ns",value:function(){var e=this;return em(function(){var t,n,i,r,s,o,a,u,l,c,h;return(0,E._)(this,function(d){switch(d.label){case 0:if(e.ps.clear(),0===(n=null!=(t=e._instance.getPersistedProperty(B.LogsQueue))?t:[]).length)return[2];i=n.length,r=0,d.label=1;case 1:if(!(n.length>0&&i>r))return[3,6];return a=e._s,e.bs=0,u=Math.min(n.length,e.Es),c=nx((l=n.slice(0,u)).map(function(e){return e.record}),e.qs(),null!=(s=e.fs)?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),[4,e._instance.js(c)];case 2:if(h=d.sent(),e._s!==a)return[2];if(!("too-large"===h.kind&&l.length>1))return[3,3];return e.Es=Math.max(1,Math.floor(l.length/2)),e.$.warn("Logs batch of size ".concat(l.length," was too large for the ingestion endpoint, reducing batch size to ").concat(e.Es)),[3,5];case 3:if(e.ws.record(h),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),"retry-later"===h.kind)throw h.error;return"too-large"===h.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"===h.kind&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),[4,e.Bs(l.length)];case 4:if(d.sent(),n=null!=(o=e._instance.getPersistedProperty(B.LogsQueue))?o:[],r+=l.length,"fatal"===h.kind)throw h.error;d.label=5;case 5:return[3,1];case 6:return[2]}})})()}},{key:"Bs",value:function(e){var t=this;return em(function(){var n,i,r;return(0,E._)(this,function(s){switch(s.label){case 0:return i=Math.max(0,e-t.bs),r=null!=(n=t._instance.getPersistedProperty(B.LogsQueue))?n:[],t._instance.setPersistedProperty(B.LogsQueue,r.slice(i)),[4,t.vs()];case 1:return s.sent(),[2]}})})()}},{key:"qs",value:function(){var e;return e=this.Mr,n_(e,this._instance.getLibraryId(),this._instance.getLibraryVersion())}},{key:"Ls",value:function(e){if(!this._instance.optedOut){var t,n=null!=(t=this._instance.getPersistedProperty(B.LogsQueue))?t:[];this.Is>n.length||(n.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(B.LogsQueue,n),this.Ts>n.length||this.ws.isOpen()?this.Fs():this.gs()}}},{key:"Fs",value:function(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}},{key:"Hs",value:function(){return Math.max(n$(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}},{key:"As",value:function(){var e=this._instance.getPersistedProperty(B.LogsQueue);return!!e&&e.length>0}},{key:"shutdown",value:function(e){var t=this;return em(function(){var n;return(0,E._)(this,function(i){switch(i.label){case 0:if(t.ps.clear(),n=t.flush().catch(function(){}),void 0===e)return[3,2];return[4,tP(n,e)];case 1:return i.sent(),[3,4];case 2:return[4,n];case 3:i.sent(),i.label=4;case 4:return[2]}})})()}},{key:"flushWithTimeout",value:function(e){var t=this;return em(function(){var n;return(0,E._)(this,function(i){switch(i.label){case 0:return[4,tP(n=t.flush(),e,function(){n.catch(function(){})})];case 1:return i.sent(),[2]}})})()}},{key:"gs",value:function(){var e=this;this.flush().then(function(){e.ks=0,e.Ss=1},function(t){e.ks++,e.Ss=nS(),e.$.error("PostHog logs flush failed:",t)}).finally(function(){!e._instance.isDisabled&&e.As()&&e.ps.armNoEarlierThan(e.Hs())})}}]),e}(),nM=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function nF(e){return String(e)+"000000"}function nC(e,t,n,i){var r="";return i&&(r=Object.keys(i).sort().map(function(e){return"".concat(JSON.stringify(e),":").concat(JSON.stringify(i[e]))}).join(",")),"".concat(e,"\0").concat(t,"\0").concat(null!=n?n:"","\0").concat(r)}var nO=function(){function e(t,n,i){var r=this;(0,g._)(this,e),this._instance=t,this.Mr=n,this.$=i,this.zs=new Map,this.ps=new nE(function(){return r.flush().catch(function(e){r.$.error("Metrics flush failed:",e)})}),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new nd,this.ks=0,this.Ss=1,this.Gs=0}return(0,_._)(e,[{key:"count",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0;this.Zs({name:e,type:"count",value:t,unit:null==n?void 0:n.unit,attributes:null==n?void 0:n.attributes})}},{key:"gauge",value:function(e,t,n){this.Zs({name:e,type:"gauge",value:t,unit:null==n?void 0:n.unit,attributes:null==n?void 0:n.attributes})}},{key:"histogram",value:function(e,t,n){this.Zs({name:e,type:"histogram",value:t,unit:null==n?void 0:n.unit,attributes:null==n?void 0:n.attributes})}},{key:"flush",value:function(){var e,t=this,n=this,i=this.ys,r=(e=em(function(){return(0,E._)(this,function(e){switch(e.label){case 0:if(!i)return[3,2];return[4,i.catch(function(){})];case 1:e.sent(),e.label=2;case 2:return[4,n.Qs()];case 3:return e.sent(),[2]}})}),function(){return e.apply(this,arguments)})().finally(function(){t.ys===r&&(t.ys=null)});return this.ys=r,r}},{key:"drainWindow",value:function(){if(0===this.zs.size)return null;var e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}},{key:"reset",value:function(){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}},{key:"Zs",value:function(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t,n,i=this.Os(e);if(null!==i){if(!i.name||"string"!=typeof i.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.$.warn("Dropping metric '".concat(i.name,"': value must be a finite number"));if("count"===i.type&&0>i.value)return void this.$.warn("Dropping count '".concat(i.name,"': counters are monotonic, value must be >= 0"));try{t=i.attributes?tO({},i.attributes):void 0,n=nC(i.type,i.name,i.unit,t)}catch(e){return void this.$.warn("Dropping metric '".concat(i.name,"': attributes could not be serialized"),e)}var r=this.zs.get(n);if(!r){if(!this.Ks())return;r={name:i.name,type:i.type,unit:i.unit,attributes:t,windowStartMs:Date.now()},this.zs.set(n,r)}var s=this.Ws.get(i.name);void 0===s?this.Ws.set(i.name,i.type):s===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.$.warn("Metric name '".concat(i.name,"' is already used as a ").concat(s,"; recording it as a ").concat(i.type," too will blend both series in charts. Use a distinct name."))),this.Ys(r,i.value),this.Fs()}}}},{key:"Ks",value:function(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn("Metric series cap reached (".concat(this.Mr.maxSeriesPerFlush," per flush window); dropping new series until the next flush. Reduce attribute cardinality."))),!1)}},{key:"Ys",value:function(e,t){switch(e.type){case"count":var n;e.total=(null!=(n=e.total)?n: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(nM.length+1).fill(0)});var 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(var n=0;t.length>n;n++)if(t[n]>=e)return n;return t.length}
2(t,nM)]+=1}}},{key:"Os",value:function(e){var t=this.Mr.beforeSend;if(!t)return e;var n=Y(t)?t:[t],i=e,r=!0,s=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;try{var c=l(i);if(!c)return this.$.info("Metric was rejected in beforeSend function"),null;i=c}catch(e){return this.$.error("Error in beforeSend function for metric:",e),null}}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return i}},{key:"Fs",value:function(){this.ps.pending||this.ps.arm(this.Hs())}},{key:"Hs",value:function(){return Math.max(n$(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}},{key:"Qs",value:function(){var e=this;return em(function(){var t,n,i;return(0,E._)(this,function(r){switch(r.label){case 0:if(e.ps.clear(),0===e.zs.size)return[2];return t=e.zs,e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set,n=e.Gs,[4,e._instance.Xs(e.Js(t))];case 1:if(i=r.sent(),n===e.Gs)switch(e.ws.record(i),"retry-later"===i.kind?(e.ks++,e.Ss=nS()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":break;case"retry-later":return[2,(e.lo(t),void e.ps.armNoEarlierThan(e.Hs()))];case"too-large":return[2,void e.$.warn("Metrics batch exceeded the server size limit and was dropped")];case"fatal":return[2,void e.$.error("Failed to send metrics batch:",i.error)]}return[2]}})})()}},{key:"Js",value:function(e){var t,n,i,r;return t=this.ao(e),n=n_(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:nm(n)},scopeMetrics:[{scope:{name:i,version:r},metrics:t}]}]}}},{key:"ao",value:function(e){var t=nF(Date.now()),n=new Map,i=!0,r=!1,s=void 0;try{for(var o,a=e.values()[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value,l=nC(u.type,u.name,u.unit,void 0),c=n.get(l);c||(c=tO({name:u.name},u.unit&&{unit:u.unit}),"count"===u.type?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===u.type?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},n.set(l,c));var h=np(null!=(f=u.attributes)?f:{},this.$),d=nF(u.windowStartMs);if("count"===u.type){var f,v,p={attributes:h,startTimeUnixNano:d,timeUnixNano:t,asDouble:null!=(v=u.total)?v:0};c.sum.dataPoints.push(p)}else if("gauge"===u.type){var g,_={attributes:h,timeUnixNano:t,asDouble:null!=(g=u.last)?g:0};c.gauge.dataPoints.push(_)}else u.hist&&c.histogram.dataPoints.push({attributes:h,startTimeUnixNano:d,timeUnixNano:t,count:u.hist.count,sum:u.hist.sum,min:u.hist.min,max:u.hist.max,bucketCounts:u.hist.bucketCounts,explicitBounds:nM})}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return Array.from(n.values())}},{key:"lo",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o,a,u=(0,k._)(r.value,2),l=u[0],c=u[1],h=this.zs.get(l);if(h)switch(h.windowStartMs=Math.min(h.windowStartMs,c.windowStartMs),h.type){case"count":h.total=(null!=(o=h.total)?o:0)+(null!=(a=c.total)?a:0);break;case"gauge":break;case"histogram":if(c.hist)if(h.hist){h.hist.count+=c.hist.count,h.hist.sum+=c.hist.sum,h.hist.min=Math.min(h.hist.min,c.hist.min),h.hist.max=Math.max(h.hist.max,c.hist.max);for(var d=0;h.hist.bucketCounts.length>d;d++)h.hist.bucketCounts[d]+=c.hist.bucketCounts[d]}else h.hist=c.hist}else this.Ks()&&this.zs.set(l,c)}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}}]),e}(),nI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.debugEnabled,i={N:function(t){for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];S&&(j.DEBUG||S.POSTHOG_DEBUG||n)&&!et(S.console)&&S.console&&("__rrweb_original__"in S.console[t]?S.console[t].__rrweb_original__:S.console[t]).apply(this,[e].concat((0,w._)(r)))},debug:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i.N.apply(i,["debug"].concat((0,w._)(t)))},info:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i.N.apply(i,["log"].concat((0,w._)(t)))},warn:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i.N.apply(i,["warn"].concat((0,w._)(t)))},error:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];i.N.apply(i,["error"].concat((0,w._)(t)))},critical:function(){for(var t,n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];(t=console).error.apply(t,[e].concat((0,w._)(i)))},uninitializedWarning:function(e){i.error("You must initialize PostHog before calling ".concat(e))},createLogger:function(t,n){return nI("".concat(e," ").concat(t),n)}};return i},nA=nI("[PostHog.js]"),nR=nA.createLogger,nT=nR("[ExternalScriptsLoader]"),nL=function(e){var t=null==M?void 0:M.querySelectorAll("script");
2if(t){for(var n=0;t.length>n;n++)if(t[n].src===e||t[n].getAttribute("src")===e)return t[n]}},nD=function(e,t,n){if(e.config.disable_external_dependency_loading)return nT.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var i=nL(t);if(i){if(i.__posthog_loading_callback_fired)return n();var r=i.__posthog_loading_error;return r?n(r):(i.addEventListener("load",function(e){i.__posthog_loading_callback_fired=!0,n(void 0,e)}),void i.addEventListener("error",function(e){i.__posthog_loading_error=e,n(e)}))}var s=function(){if(!M)return n("document not found");if(nL(t))return nD(e,t,n);var i=M.createElement("script");if(i.type="text/javascript",i.crossOrigin="anonymous",i.src=t,i.onload=function(e){i.__posthog_loading_callback_fired=!0,n(void 0,e)},i.onerror=function(e){i.__posthog_loading_error=e,n(e)},e.config.prepare_external_dependency_script&&(i=e.config.prepare_external_dependency_script(i)),!i)return n("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)M.head.appendChild(i);else{var r,s=M.querySelectorAll("body > script");s.length>0?null==(r=s[0].parentNode)||r.insertBefore(i,s[0]):M.body.appendChild(i)}};(null==M?void 0:M.body)?s():null==M||M.addEventListener("DOMContentLoaded",s)},nN={},nj=function(e,t){var n="/static/".concat(t,".js?v=").concat(e.version);return"toolbar"===t&&(n="".concat(n,"&t=").concat(3e5*Math.floor(Date.now()/3e5))),e.requestRouter.endpointFor("assets",n)};D.__PosthogExtensions__=D.__PosthogExtensions__||{},D.__PosthogExtensions__.loadExternalDependency=function(e,t,n){if("remote-config"===t){var i=e.requestRouter.endpointFor("assets","/array/".concat(e.config.token,"/config.js"));return void nD(e,i,n)}var r=e.config.strict_script_versioning;if(r){var s=e.requestRouter.endpointFor("assets","/static/".concat(e.version,"/").concat(t,".js")),o=nN[s];if("fallback"===r&&o){if(nL(o))return void nD(e,o,n);delete nN[s]}return void nD(e,s,"fallback"===r?function(i,r){if(i)if("string"==typeof i)n(i);else{var o,a=nj(e,t);nN[s]=a;var u=nL(s);null==u||null==(o=u.parentNode)||o.removeChild(u),nD(e,a,n)}else n(void 0,r)}:n)}nD(e,nj(e,t),n)},D.__PosthogExtensions__.loadSiteApp=function(e,t,n){var i=e.requestRouter.endpointFor("api",t);nD(e,i,n)},j.DEBUG=!1,j.LIB_VERSION="1.430.3",j.LIB_NAME="web";var nB="distinct_id",nH="$device_id",nz="$device_model",nq="__alias",nV="$fbc",nU="$fbc_persistence",nW="__timers",nG="$autocapture_disabled_server_side",nK="$heatmaps_enabled_server_side",nX="$exception_capture_enabled_server_side",nJ="$error_tracking_suppression_rules",nY="$error_tracking_capture_extension_exceptions",nZ="$web_vitals_enabled_server_side",nQ="$dead_clicks_enabled_server_side",n0="$product_tours_enabled_server_side",n1="$logs_capture_enabled_server_side",n2="$web_vitals_allowed_metrics",n3="$session_recording_remote_config",n5="$sesid",n4="$session_is_sampled",n6="$enabled_feature_flags",n8="$active_feature_flags",n9="$early_access_features",n7="$feature_flag_details",ie="$feature_flag_payloads",it="$feature_flag_request_id",ii="$minimal_flag_called_events",ir="$override_feature_flags",is="$override_feature_flag_payloads",io="$stored_person_properties",ia="$stored_group_properties",iu="$groups",il="$surveys",ic="$surveys_loaded_at",ih="$surveys_activated",id="$surveys_activated_session",iv="$surveys_activated_timestamps",ip="ph_product_tours",ig="$flag_call_reported",i_="$flag_call_reported_session_id",iy="$feature_flag_errors",im="$feature_flag_evaluated_at",ib="$user_state",ik="$client_session_props",iw="$initial_campaign_params",ix="$initial_referrer_info",iE="$initial_person_info",iS="$epp",i$="$posthog_cookieless",iP="$cookieless_mode",iM="$sdk_debug_extensions_init_method",iF="$sdk_debug_extensions_init_time_ms",iC="$sdk_debug_recording_script_not_loaded",iO="PostHog loadExternalDependency extension not found.",iI="anonymous",iA="identified",iR="identified_only",iT="visibilitychange",iL="beforeunload",iD="$pageview",iN="$pageleave",ij="$identify",iB="$groupidentify";function iH(e,t){Y(e)&&e.forEach(t)}function iz(e,t){if(!es(e))if(Y(e))e.forEach(t);else if((0,b._)(e,FormData))e.forEach(function(e,n){return t(e,n)});else for(var n in e)X.call(e,n)&&t(e[n],n)}var iq=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r=!0,s=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;for(var c in l)void 0!==l[c]&&(e[c]=l[c])}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return e};function iV(e){for(var t=Object.keys(e),n=t.length,i=Array(n);n--;)i[n]=[t[n],e[t[n]]];return i}var iU=function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];try{return e.apply(this,n)}catch(e){nA.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),nA.critical(e)}}},iW=function(e){var t={};return iz(e,function(e,n){(en(e)&&e.length>0||eo(e))&&(t[n]=e)}),t};function iG(e){for(var t=tO({},e),n=0,i=["name","message","stack","cause","errors"];n<i.length;n++){var r=i[n];try{r in e&&(t[r]=e[r])}catch(e){}}return t}var iK=["herokuapp.com","vercel.app","netlify.app"];function iX(e,t,n,i){var r=null!=i?i:{},s=r.capture,o=r.passive;null==e||e.addEventListener(t,n,{capture:void 0!==s&&s,passive:void 0===o||o})}function iJ(e){return"ph_toolbar_internal"===e.name}var iY=function(e){if(M){try{for(var t=e+"=",n=M.cookie.split(";").filter(function(e){return e.length}),i=0;n.length>i;i++){for(var r=n[i];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.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 eo(e)&&isFinite(e)&&Math.floor(e)===e});var iZ=function(){function e(t){if((0,g._)(this,e),this.bytes=t,16!==t.length)throw TypeError("not 128-bit length")}return(0,_._)(e,[{key:"toString",value:function(){for(var e="",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}},{key:"clone",value:function(){return new e(this.bytes.slice(0))}},{key:"equals",value:function(e){return 0===this.compareTo(e)}},{key:"compareTo",value:function(e){for(var t=0;16>t;t++){var n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}}],[{key:"fromFieldsV7",value:function(t,n,i,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>n||0>i||0>r||t>0xffffffffffff||n>4095||i>0x3fffffff||r>0xffffffff)throw RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/0x10000000000,s[1]=t/0x100000000,s[2]=t/0x1000000,s[3]=t/65536,s[4]=t/256,s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new e(s)}}]),e}(),iQ=function(){function e(){(0,g._)(this,e),this.Ct=0,this.It=0,this.Tt=new i1}return(0,_._)(e,[{key:"generate",value:function(){var e=this.generateOrAbort();if(!et(e))return e;this.Ct=0;var t=this.generateOrAbort();if(et(t))throw Error("Could not generate UUID after timestamp reset");return t}},{key:"generateOrAbort",value:function(){var e,t=eo(e=Date.now())&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0;if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>0x3ffffffffff&&(this.Ct++,this.Mt())}return iZ.fromFieldsV7(this.Ct,Math.trunc(this.It/0x40000000),0x3fffffff&this.It,this.Tt.nextUint32())}},{key:"Mt",value:function(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}}]),e}(),i0=function(e){if("u">
2("u"<typeof UUIDV7_DENY_WEAK_RNG?"undefined":(0,x._)(UUIDV7_DENY_WEAK_RNG))&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};S&&!et(S.crypto)&&crypto.getRandomValues&&(i0=function(e){return crypto.getRandomValues(e)});var i1=function(){function e(){(0,g._)(this,e),this.Rt=new Uint32Array(8),this.$t=1/0}return(0,_._)(e,[{key:"nextUint32",value:function(){return this.Rt.length>this.$t||(i0(this.Rt),this.$t=0),this.Rt[this.$t++]}}]),e}(),i2=function(){return i3().toString()},i3=function(){return(f||(f=new iQ)).generate()},i5="",i4=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,i6=null,i8={Et:function(){if(!er(i6))return i6;if(i6=!1,M)try{var e="__ph_cookie_support_".concat(i2());i8.At(e,"xyz"),i6='"xyz"'===iY(e),i8.Lt(e)}catch(e){i6=!1}return i6},Pt:function(e){nA.error("cookieStore error: "+e)},Ot:iY,Dt:function(e){var t;try{t=JSON.parse(i8.Ot(e))||{}}catch(e){}return t},At:function(e,t,n,i,r){if(!M)return!1;try{var s="",o="",a=function(e,t){if(t){var n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M;if(i5)return i5;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),i=Math.min(n.length,8),r="dmn_chk_"+i2();!i5&&i--;){var s=n.slice(i).join("."),o=r+"=1;domain=."+s+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",i5=s)}return i5}(e);if(!n){var i,r=(i=e.match(i4))?i[0]:"";r!==n&&nA.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}(M.location.hostname,i);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}r&&(o="; secure");var l=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&nA.warn("cookieStore warning: large cookie, len="+l.length),M.cookie=l,!0}catch(e){return!1}},Lt:function(e,t){if(null==M?void 0:M.cookie)try{i8.At(e,"",-1,t)}catch(e){return}}},i9=null,i7={Et:function(){if(!er(i9))return i9;var e=!0;if(et(S))e=!1;else try{var t="__mplssupport__";i7.At(t,"xyz"),'"xyz"'!==i7.Ot(t)&&(e=!1),i7.Lt(t)}catch(t){e=!1}return e||nA.error("localStorage unsupported; falling back to cookie store"),i9=e,e},Pt:function(e){nA.error("localStorage error: "+e)},Ot:function(e){try{return null==S?void 0:S.localStorage.getItem(e)}catch(e){i7.Pt(e)}return null},Dt:function(e){try{return JSON.parse(i7.Ot(e))||{}}catch(e){}return null},At:function(e,t){try{return null==S||S.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){i7.Pt(e)}return!1},Lt:function(e){try{null==S||S.localStorage.removeItem(e)}catch(e){i7.Pt(e)}}},re=[io,n8,n6,n7,ie,it,im,iy,ig],rt=[nH,nB,n5,n4,iS,iE,nU,ib],rn=function(e){return e+"_cpm"},ri=["__proto__","constructor","prototype"],rr=function(e){if(!Q(e))return{};var t={};return Object.keys(e).forEach(function(n){-1===ri.indexOf(n)&&(t[n]=e[n])}),t},rs=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n={};return(0,w._)(rt).concat((0,w._)(t)).forEach(function(t){var i=e[t];et(i)||er(i)||""===i||(n[t]=i)}),n},ro=function(e){for(var t=5381,n=0x811c9dc5,i=0;e.length>i;i++){var r=e.charCodeAt(i);t=33*t^r,n=Math.imul(n^r,0x1000193)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(n>>>0).toString(36)},ra=function(e,t){return{p:t,f:ro(JSON.stringify(e))}},ru=function(e,t){if(!t)return{properties:[],isValid:!1};try{var n=i8.Dt(rn(e)),i=(null==n?void 0:n.f)===ro(t)&&Y(n.p);return{properties:i?n.p:[],isValid:i}}catch(e){return{properties:[],isValid:!1}}},rl=function(e,t){return t+"|"+(i8.Ot(rn(e))||"")},rc={},rh={Et:function(){return!0},Pt:function(e){nA.error("memoryStorage error: "+e)},Ot:function(e){return e in rc?rc[e]:null},Dt:function(e){return e in rc?rc[e]:null},At:function(e,t){return rc[e]=t,!0},Lt:function(e){delete rc[e]}},rd=null,rf={Et:function(){if(!er(rd))return rd;if(rd=!0,et(S))rd=!1;else try{var e="__support__";rf.At(e,"xyz"),'"xyz"'!==rf.Ot(e)&&(rd=!1),rf.Lt(e)}catch(e){rd=!1}return rd},Pt:function(e){nA.error("sessionStorage error: ",e)},Ot:function(e){try{return null==S?void 0:S.sessionStorage.getItem(e)}catch(e){rf.Pt(e)}return null},Dt:function(e){try{return JSON.parse(rf.Ot(e))||null}catch(e){}return null},At:function(e,t){try{return null==S||S.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){rf.Pt(e)}return!1},Lt:function(e){try{null==S||S.sessionStorage.removeItem(e)}catch(e){rf.Pt(e)}}},rv=function(){function e(t){(0,g._)(this,e),this._instance=t}return(0,_._)(e,[{key:"Mr",get:function(){return this._instance.config}},{key:"consent",get:function(){return this.Ro()?0:this.Ao}},{key:"isOptedOut",value:function(){return"always"===this.Mr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Mr.cookieless_mode}},{key:"isOptedIn",value:function(){return!this.isOptedOut()}},{key:"isExplicitlyOptedOut",value:function(){return 0===this.consent}},{key:"isRejected",value:function(){return 0===this.consent||-1===this.consent&&this.Mr.opt_out_capturing_by_default}},{key:"optInOut",value:function(e){this.Fo.At(this.Oo,+!!e,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}},{key:"reset",value:function(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}},{key:"Oo",get:function(){var e=this._instance.config,t=e.token,n=e.opt_out_capturing_cookie_prefix;
2return e.consent_persistence_name||(n?n+t:"__ph_opt_in_out_"+t)}},{key:"Ao",get:function(){var e=this.Fo.Ot(this.Oo);return eg(e)?1:V(e_,e)?0:-1}},{key:"Fo",get:function(){var e=this.Mr.opt_out_capturing_persistence_type,t="localStorage"===e?i7:i8,n=t.Et()?t:rh;if(!this.Do||this.Do!==n){this.Do=n;var i="localStorage"===e?i8:i7;i.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(eg(i.Ot(this.Oo))),i.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}},{key:"Ro",value:function(){return!!this.Mr.respect_dnt&&[null==P?void 0:P.doNotTrack,null==P?void 0:P.msDoNotTrack,D.doNotTrack,null==P?void 0:P.globalPrivacyControl].some(function(e){return eg(e)})}}]),e}();function rp(e,t){var n,i=null==e||null==(n=e.config)?void 0:n.get_current_url;if(!Z(i))return t;try{var r=i(t);return en(r)&&r?r:t}catch(e){return nA.error("Error in get_current_url, falling back to window.location.href",e),t}}function rg(e){var t;return(0,b._)(e,Element)&&("__POSTHOG_TOOLBAR__"===e.id||!!(null==(t=e.closest)?void 0:t.call(e,".toolbar-global-fade-container")))}function r_(e){return!!e&&1===e.nodeType}function ry(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function rm(e){return!!e&&3===e.nodeType}function rb(e){return!!e&&11===e.nodeType&&r_(e.host)}function rk(e){return e?U(e).split(/\s+/):[]}function rw(e,t){var n,i,r=et(i=null==S||null==(n=S.location)?void 0:n.href)?void 0:rp(t,i);return!!(r&&e&&e.some(function(e){return r.match(e)}))}function rx(e){var t="";switch((0,x._)(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 rk(t)}function rE(e){return es(e)?null:U(e).split(/(\s+)/).filter(function(e){return rK(e)}).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rS(e){var t="";return rB(e)&&!rH(e)&&e.childNodes&&e.childNodes.length&&iz(e.childNodes,function(e){var n;rm(e)&&e.textContent&&(t+=null!=(n=rE(e.textContent))?n:"")}),U(t)}function r$(e){var t;return et(e.target)?e.srcElement||null:(null==(t=e.target)?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}var rP=["a","button","form","input","select","textarea","label"];function rM(e,t){var n=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!n&&n.call(e,t)}catch(e){return!1}}function rF(e,t){if(et(t))return!0;var n=!0,i=!1,r=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=function(){var e=s.value;if(t.some(function(t){return rM(e,t)}))return{v:!0}}();if("object"===(0,x._)(a))return a.v}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return!1}function rC(e){var t=e.parentNode;return!(!t||!r_(t))&&t}var rO=[".ph-no-autocapture","[data-ph-no-autocapture]"],rI=["next","previous","prev",">","<"],rA=(0,w._)(rI).concat(["+","-","â","â"]),rR=function(e,t){return/[a-z0-9]/i.test(t)?e.includes(t):e===t},rT=[".ph-no-rageclick",".ph-no-capture"],rL=["","text","search","email","password","url","tel","number"];function rD(e,t){if(!S||rN(e)||(eu(t)?(i=!!t&&rT,r=void 0,s=!1):(i=null!=(o=null==t?void 0:t.css_selector_ignorelist)?o:rT,r=null==t?void 0:t.content_ignorelist,s=null!=(a=null==t?void 0:t.ignore_text_selection)&&a),!1===i)||s&&!(!(n=e)||!r_(n))&&(ry(n,"textarea")||(ry(n,"input")?V(rL,(n.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t,n=null==(t=e.getAttribute)?void 0:t.call(e,"contenteditable");return"true"===n||""===n}(n))))return!1;var n,i,r,s,o,a,u=rj(e,!1).targetElementList;return!function(e,t){var n;if(!1===e||et(e))return!1;if(!0===e)n=rI;else{if(!Y(e))return!1;if(e.length>10)return nA.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;n=e.map(function(e){return e.toLowerCase()})}return t.some(function(e){var t=e.safeText,i=e.ariaLabel;return n.some(function(e){return rR(t,e)||rR(i,e)})})}(r,u.map(function(e){var t;return{safeText:rS(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!rF(u,i)}var rN=function(e){return!e||ry(e,"html")||!r_(e)},rj=function(e,t){if(!S||rN(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],r=e;r.parentNode&&!ry(r,"body");){if(rb(r.parentNode)){i.push(r.parentNode.host),r=r.parentNode.host;continue}var s=rC(r);if(!s)break;if(t||rP.indexOf(s.tagName.toLowerCase())>-1)n=!0;else try{var o=S.getComputedStyle(s);o&&"pointer"===o.getPropertyValue("cursor")&&(n=!0)}catch(e){}i.push(s),r=s}return{parentIsUsefulElement:n,targetElementList:i}};function rB(e){for(var t=new Set,n=0,i=e;i.parentNode&&!ry(i,"body");i=i.parentNode){if(n++>=1e3||t.has(i))return!1;t.add(i);var r=rx(i);if(V(r,"ph-sensitive")||V(r,"ph-no-capture"))return!1}if(V(rx(e),"ph-include"))return!0;var s=e.type||"";if(en(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}
2var o=e.name||e.id||"";return!en(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function rH(e){return!!(ry(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ry(e,"select")||ry(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rz=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}))$"),rq=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,rV=[16,15,14,13],rU=RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),rW=RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),rG=/[0-9A-Za-z_]/;function rK(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return!(es(e)||en(e)&&(e=U(e),(t?rz.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(rq.lastIndex=0;t=rq.exec(e);){var n=t[2];if(n)for(var i=n.replace(/[- ]/g,""),r=!0,s=!1,o=void 0,a=0;i.length>a;a++)try{for(var u,l=rV[Symbol.iterator]();!(r=(u=l.next()).done);r=!0){var c=u.value,h=a+c;if(i.length>=h){var d=i.slice(a,h);if(rz.test(d)&&function(e){for(var t=0,n=!1,i=e.length-1;i>=0;i--){var r=e.charCodeAt(i)-48;n&&(r*=2)>9&&(r-=9),t+=r,n=!n}return t%10==0}(d))return!0}}}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}}return!1}(e))||(t?rU.test(e):function(e){var t;for(rW.lastIndex=0;t=rW.exec(e);){var n=t[1],i=t[3];if(!(n&&i&&rG.test(n)&&rG.test(i)))return!0}return!1}(e))))&&!0}function rX(e){var t=rS(e);return rK(t="".concat(t," ").concat(function e(t){var n="";return t&&t.childNodes&&t.childNodes.length&&iz(t.childNodes,function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=rS(t);n="".concat(n," ").concat(r).trim(),t.childNodes&&t.childNodes.length&&(n="".concat(n," ").concat(e(t)).trim())}catch(e){nA.error("[AutoCapture]",e)}}),n}(e)).trim())?t:""}function rJ(e){return e.replace(/"|\\"/g,'\\"')}var rY=nR("[Dead Clicks]"),rZ=function(){return!0},rQ=function(e){var t,n=!!(null==(t=e.instance.persistence)?void 0:t.get_property(nQ)),i=e.instance.config.capture_dead_clicks;return eu(i)?i:!!Q(i)||n},r0=function(){function e(t,n,i){(0,g._)(this,e),this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}return(0,_._)(e,[{key:"lazyLoadedDeadClicksAutocapture",get:function(){return this.Lo}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register((0,y._)({},nQ,t.captureDeadClicks)),this.startIfEnabledOrStop())}}},{key:"startIfEnabledOrStop",value:function(){var e=this;this.isEnabled(this)?this.No(function(){e.qo()}):this.stop()}},{key:"No",value:function(e){var t,n,i;(null==(t=D.__PosthogExtensions__)?void 0:t.initDeadClicksAutocapture)?e():null==(n=D.__PosthogExtensions__)||null==(i=n.loadExternalDependency)||i.call(n,this.instance,"dead-clicks-autocapture",function(t){t?rY.error("failed to load script",t):e()})}},{key:"qo",value:function(){var e;if(M){if(!this.Lo&&(null==(e=D.__PosthogExtensions__)?void 0:e.initDeadClicksAutocapture)){var t=Q(this.instance.config.capture_dead_clicks)?tO({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Lo=D.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(M),rY.info("starting...")}}else rY.error("`document` not found. Cannot start.")}},{key:"stop",value:function(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,rY.info("stopping..."))}}]),e}(),r1=nR("[SegmentIntegration]");function r2(e,t){var n,i,r,s=!(arguments.length>2)||void 0===arguments[2]||arguments[2],o=e.config.segment;if(!o)return t();var a=Z(o.register)?{analytics:o}:o,u=a.analytics,l=a.filterProperties;n=function(n){u.register(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.filterProperties;"u">typeof Promise&&Promise.resolve||r1.warn("This browser does not have Promise support, and can not use the segment integration");var r=function(n,r){if(!r)return n;var s=!!t&&n.event.anonymousId===t&&!n.event.userId;s||n.event.userId||n.event.anonymousId===e.get_distinct_id()||(r1.info("No userId set, resetting PostHog"),e.reset()),s||(t=void 0),n.event.userId&&n.event.userId!==e.get_distinct_id()&&(r1.info("UserId set, identifying with PostHog"),e.identify(n.event.userId)
2);var o=e.calculateEventProperties(r,n.event.properties);if(!es(i)){var a=n.event.properties||{},u={},l=!0,c=!1,h=void 0;try{for(var d,f=Object.keys(o)[Symbol.iterator]();!(l=(d=f.next()).done);l=!0){var v=d.value;X.call(a,v)||(u[v]=o[v])}}catch(e){c=!0,h=e}finally{try{l||null==f.return||f.return()}finally{if(c)throw h}}var p=function(e,t){var n=Y(e)?e:[e],i=tO({},t),r=!0,s=!1,o=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;try{if(i=l(i),es(i))return null}catch(e){return r1.error("Error in Segment filterProperties:",e),null}}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return i}(i,u);if(es(p))return n;o=p}return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(e){return r(e,e.event.event)},page:function(e){return r(e,iD)},identify:function(e){return r(e,ij)},screen:function(e){return r(e,"$screen")}}}(e,n,{filterProperties:l})).then(function(){t()},function(e){r1.error("Failed to register the Segment integration",e),t()})},i=function(t){var i=function(){return t.anonymousId()||i2()};e.config.get_device_id=i,s&&t.id()&&(e.register({distinct_id:t.id(),$device_id:i()}),e.persistence.set_property(ib,iA)),n(s?void 0:t.anonymousId()||void 0)},"then"in(r=u.user())&&Z(r.then)?r.then(i):i(r)}var r3="posthog-js";function r5(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.organization,i=t.projectId,r=t.prefix,s=t.severityAllowList,o=void 0===s?["error"]:s,a=t.sendExceptionsToPostHog,u=void 0===a||a;return function(t){if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var s,a,l,c,h,d,f=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));t.tags["PostHog Person URL"]=f,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var v=(null==(s=t.exception)?void 0:s.values)||[],p=v.map(function(e){return tO(tO({},e),{},{stacktrace:e.stacktrace?tO(tO({},e.stacktrace),{},{type:"raw",frames:(e.stacktrace.frames||[]).map(function(e){return tO(tO({},e),{},{platform:"web:javascript"})})}):void 0})}),g={$exception_message:(null==(a=v[0])?void 0:a.value)||t.message,$exception_type:null==(l=v[0])?void 0:l.type,$exception_level:t.level,$exception_list:p,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(h=v[0])?void 0:h.type,$sentry_tags:t.tags};return n&&i&&(g.$sentry_url=(r||"https://sentry.io/organizations/")+n+"/issues/?project="+i+"&query="+t.event_id),u&&(null==(d=e.exceptions)||d.sendExceptionEvent(g)),t}}var r4=function e(t,n,i,r,s,o){(0,g._)(this,e),this.name=r3,this.setupOnce=function(e){e(r5(t,{organization:n,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==o||o}))}},r6=function(){function e(t){var n=this;(0,g._)(this,e),this.jo=function(e,t,i){i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(nA.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),n.Bo=void 0,n._instance.scrollManager.resetContext())},this._instance=t,this.Ho()}return(0,_._)(e,[{key:"Ho",value:function(){var e;this.zo=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.jo)}},{key:"destroy",value:function(){var e;null==(e=this.zo)||e.call(this),this.zo=void 0}},{key:"doPageView",value:function(e,t){var n,i=this.Uo(e,t);return this.Bo={pathname:null!=(n=null==S?void 0:S.location.pathname)?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}},{key:"doPageLeave",value:function(e){var t;return this.Uo(e,null==(t=this.Bo)?void 0:t.pageViewId)}},{key:"doEvent",value:function(){var e;return{$pageview_id:null==(e=this.Bo)?void 0:e.pageViewId}}},{key:"Uo",value:function(e,t){var n=this.Bo;if(!n)return{$pageview_id:t};var i={$pageview_id:t,$prev_pageview_id:n.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var s=r.maxScrollHeight,o=r.lastScrollY,a=r.maxScrollY,u=r.maxContentHeight,l=r.lastContentY,c=r.maxContentY;if(!(et(s)||et(o)||et(a)||et(u)||et(l)||et(c))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c);var h=s>1?ew(o/s,0,1,nA):1,d=s>1?ew(a/s,0,1,nA):1,f=u>1?ew(l/u,0,1,nA):1,v=u>1?ew(c/u,0,1,nA):1;
2i=iq(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:f,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:v})}}return n.pathname&&(i.$prev_pageview_pathname=n.pathname),n.timestamp&&(i.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),i}}]),e}(),r8=["flags","surveys"],r9=(v={},(0,y._)(v,"$people_distinct_id",{exposure:"hidden"}),(0,y._)(v,nq,{exposure:"hidden"}),(0,y._)(v,"__cmpns",{exposure:"hidden"}),(0,y._)(v,nW,{exposure:"hidden"}),(0,y._)(v,nU,{exposure:"hidden"}),(0,y._)(v,nG,{exposure:"event"}),(0,y._)(v,nK,{exposure:"hidden"}),(0,y._)(v,n1,{exposure:"hidden"}),(0,y._)(v,nX,{exposure:"event"}),(0,y._)(v,nJ,{exposure:"hidden"}),(0,y._)(v,nY,{exposure:"event"}),(0,y._)(v,nZ,{exposure:"event"}),(0,y._)(v,nQ,{exposure:"event"}),(0,y._)(v,n0,{exposure:"hidden"}),(0,y._)(v,n2,{exposure:"event"}),(0,y._)(v,n3,{exposure:"hidden"}),(0,y._)(v,"$session_recording_enabled_server_side",{exposure:"hidden"}),(0,y._)(v,n5,{exposure:"hidden"}),(0,y._)(v,n4,{exposure:"event"}),(0,y._)(v,"$replay_sample_rate",{exposure:"event",shouldSkipFromEventProperties:function(e){return er(e)}}),(0,y._)(v,"$session_past_minimum_duration",{exposure:"event"}),(0,y._)(v,"$session_recording_url_trigger_activated_session",{exposure:"event"}),(0,y._)(v,"$session_recording_event_trigger_activated_session",{exposure:"event"}),(0,y._)(v,"$debug_first_full_snapshot_timestamp",{exposure:"event"}),(0,y._)(v,"$sess_rec_flush_size",{exposure:"hidden"}),(0,y._)(v,n6,{exposure:"hidden",storageGroup:"flags"}),(0,y._)(v,n8,{exposure:"hidden",storageGroup:"flags"}),(0,y._)(v,n9,{exposure:"hidden"}),(0,y._)(v,n7,{exposure:"hidden",storageGroup:"flags"}),(0,y._)(v,ie,{exposure:"hidden",storageGroup:"flags"}),(0,y._)(v,it,{exposure:"hidden",storageGroup:"flags",volatile:!0}),(0,y._)(v,ii,{exposure:"hidden",storageGroup:"flags"}),(0,y._)(v,ir,{exposure:"hidden"}),(0,y._)(v,is,{exposure:"hidden"}),(0,y._)(v,io,{exposure:"hidden"}),(0,y._)(v,ia,{exposure:"hidden"}),(0,y._)(v,il,{exposure:"hidden",storageGroup:"surveys"}),(0,y._)(v,ic,{exposure:"hidden",storageGroup:"surveys",volatile:!0}),(0,y._)(v,ih,{exposure:"event"}),(0,y._)(v,id,{exposure:"hidden"}),(0,y._)(v,iv,{exposure:"hidden"}),(0,y._)(v,ip,{exposure:"hidden"}),(0,y._)(v,"$product_tours_activated",{exposure:"hidden"}),(0,y._)(v,"$product_tours_activated_session",{exposure:"hidden"}),(0,y._)(v,"$conversations_widget_session_id",{exposure:"event"}),(0,y._)(v,"$conversations_ticket_id",{exposure:"event"}),(0,y._)(v,"$conversations_widget_state",{exposure:"event"}),(0,y._)(v,"$conversations_user_traits",{exposure:"event"}),(0,y._)(v,ig,{exposure:"hidden"}),(0,y._)(v,i_,{exposure:"hidden"}),(0,y._)(v,iu,{exposure:"event"}),(0,y._)(v,iy,{exposure:"hidden"}),(0,y._)(v,im,{exposure:"hidden",storageGroup:"flags",volatile:!0}),(0,y._)(v,ib,{exposure:"hidden"}),(0,y._)(v,ik,{exposure:"hidden"}),(0,y._)(v,"$capture_rate_limit",{exposure:"hidden"}),(0,y._)(v,iw,{exposure:"hidden"}),(0,y._)(v,ix,{exposure:"hidden"}),(0,y._)(v,iE,{exposure:"hidden"}),(0,y._)(v,iS,{exposure:"hidden"}),(0,y._)(v,"$replay_override_sampling",{exposure:"event"}),(0,y._)(v,"$replay_override_linked_flag",{exposure:"event"}),(0,y._)(v,"$replay_override_url_trigger",{exposure:"event"}),(0,y._)(v,"$replay_override_event_trigger",{exposure:"event"}),(0,y._)(v,iM,{exposure:"event"}),(0,y._)(v,iF,{exposure:"event"}),(0,y._)(v,iC,{exposure:"event"}),(0,y._)(v,"$sdk_debug_replay_event_trigger_status",{exposure:"event"}),(0,y._)(v,"$sdk_debug_replay_linked_flag_trigger_status",{exposure:"event"}),(0,y._)(v,"$sdk_debug_replay_matched_recording_trigger_groups",{exposure:"event"}
2),(0,y._)(v,"$sdk_debug_replay_pending_trigger_conditions",{exposure:"event"}),(0,y._)(v,"$sdk_debug_replay_remote_trigger_matching_config",{exposure:"event"}),(0,y._)(v,"$sdk_debug_replay_trigger_groups_count",{exposure:"event"}),(0,y._)(v,"$sdk_debug_replay_url_trigger_status",{exposure:"event"}),(0,y._)(v,"$session_recording_start_reason",{exposure:"event"}),v),r7=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],se=function(e){var t=r9[e];if(t)return t;var n=!0,i=!1,r=void 0;try{for(var s,o=r7[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=(0,k._)(s.value,2),u=a[0],l=a[1];if(0===e.indexOf(u))return l}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}},st=function(e,t){try{var n;return JSON.stringify(e,function(e,t){return ed(t)?(null!=n||(n=new WeakMap),n.has(t)||n.set(t,iG(t)),n.get(t)):"bigint"==(void 0===t?"undefined":(0,x._)(t))?t.toString():t},t)}catch(t){return G(e)}},sn=function(e){var t=null==M?void 0:M.createElement("a");return et(t)?null:(t.href=e,t)},si=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;i.length>r;r++){var s=i[r].split("=");if(s[0]===t){n=s;break}}if(!Y(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch(e){nA.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},sr=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),r=i[1],s=(i[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var h=u[c].split("=");Y(h)&&(t.includes(h[0])?l.push(h[0]+"="+n):l.push(u[c]))}var d=a;return null!=o&&(d+="?"+l.join("&")),null!=r&&(d+="#"+r),d},ss=function(e,t){var n=e.match(RegExp(t+"=([^&]*)"));return n?n[1]:null},so=function(e,t){return e>=t&&T()},sa=function(e,t,n,i){if(0===e){if(T()){var r=t+1;return r===n&&i(),r}return t}return 0},su=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],sl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"].concat((0,w._)(su)),sc="<masked>",sh=["li_fat_id"];function sd(e,t,n){if(!M)return{};var i,r=t?(0,w._)(su).concat((0,w._)(n||[])):[],s=sf(sr(M.URL,r,sc),e);return iq((i={},iz(sh,function(e){var t=iY(e);i[e]=t||null}),i),s)}function sf(e,t){var n=sl.concat(t||[]),i={};return iz(n,function(t){var n=si(e,t);i[t]=n||null}),i}function sv(e){var 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,n={};if(!er(t)){n.$search_engine=t;var i=M?si(M.referrer,"yahoo"!=t?"q":"p"):"";i.length&&(n.ph_keyword=i)}return n}function sp(){return navigator.language||navigator.userLanguage}var sg="$direct";function s_(){return(null==M?void 0:M.referrer)||sg}function sy(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=e?(0,w._)(su).concat((0,w._)(t||[])):[],r=n?tE(null==F?void 0:F.href):null==F?void 0:F.href,s=null==r?void 0:r.substring(0,1e3);return{r:s_().substring(0,1e3),u:s?sr(s,i,sc):void 0}}function sm(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e.r,r=e.u,s=n?tE(r):r,o={$referrer:i,$referring_domain:null==i?void 0:i==sg?sg:null==(t=sn(i))?void 0:t.host};if(s){o.$current_url=s;var a=sn(s);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,iq(o,sf(s))}return i&&iq(o,sv(i)),o}function sb(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var sk={flags:im,surveys:ic},sw=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],sx=function(e){return"".concat(e,"_cookie_identity_change_pending")},sE=function(e){var t="",n=0,i=!0,r=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value,l=encodeURIComponent(JSON.stringify(u).slice(1,-1)).length;if(n+l>1e3)break;t+=u,n+=l}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return t},sS="main",s$=[n6,n8,n7,ie,it,im,ii,io],sP=function(e){return -1!==s$.indexOf(e)},sM=function(e,t){try{return JSON.stringify(e)===JSON.stringify(t)}catch(n){return e===t}},sF=function(e){if(!e)return{};var t=JSON.parse(e);return Q(t)?t:{}},sC=function(e,t){iz(e,function(n,i){var r=se(i);r&&"event"!==r.exposure||({}).hasOwnProperty.call(t,i)||delete e[i]})},sO=function(){function e(t,n){var i,r=this,s=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if((0,g._)(this,e),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=t,this.nl=s,this.props={},this.sl=void 0,this.rl=(i="",t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"),this.Fo=this.ol(t),this.Zo=this.ll(t),this.load(),this.al(),t.debug&&nA.info("Persistence loaded",t.persistence,tO({},this.props)),this.update_config(t,t,n),this.save(),S){var o=function(){return r.flush()};iX(S,"beforeunload",o,{capture:!1}),iX(S,"pagehide",o,{capture:!1}),this.ul=function(e){if(r.Vo&&(!e.storageArea||e.storageArea===(null==S?void 0:S.localStorage))&&e.key)if(e.key!==r.rl){if(r.Zo){var t=r8.find(function(t){return e.key===r.hl(t)});t&&r.cl(e.key,t)}}else r.cl(e.key,sS)},iX(S,"storage",this.ul)}}return(0,_._)(e,[{key:"markCrossTabFeatureFlagChanges",value:function(e){var t=this;Object.entries(e).forEach(function(e){var n=(0,k._)(e,2),i=n[0],r=n[1],s=t.Ko.get(i);if(sP(i)&&!0!==s){if(!0===r)return void t.dl(i,!0);var o=new Set(s||[]);r.forEach(function(e){return o.add(e)}),o.size&&t.dl(i,o)}})}},{key:"onCrossTabFeatureFlagChange",value:function(e){var t=this;return this.il.add(e),function(){return t.il.delete(e)}}},{key:"destroy",value:function(){this.ul&&S&&(S.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}},{key:"cl",value:function(e,t){var n,i,r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(this.pi)return!1;try{if(i=i7.Ot(e),er(i)){var s=this.vl(t);return s.storageValue=null,t!==sS&&(s.persisted=!1),!1}n=sF(i)}catch(e){return!1}var o=t===sS?n:i7.Dt(this.rl);if(o&&this.fl(o))return!1;var a=this.pl(n,t,r);return t===sS&&this.Zo&&!sM(this.gl().main,n)||this.ml(n,t,!0,i),a}},{key:"fl",value:function(e){var t=this.props[nB],n=e[nB];return!et(t)&&!et(n)&&t!==n}},{key:"ml",value:function(e,t,n,i){var r=this.vl(t);r.storageValue=i,t!==sS&&(r.persisted=n);try{r.fingerprint=this.yl(e,t)}catch(e){r.fingerprint=void 0}}},{key:"pl",value:function(e,t,n){var i=this,r=!1;return s$.forEach(function(n){var s,o=null==(s=se(n))?void 0:s.storageGroup;if((t!==sS||!i.Zo||!o)&&(t===sS||o===t)){var a=n in e,u=i.bl(n,a?e[n]:void 0),l=i.Ko.has(n)?n in i.props:a;l===n in i.props&&sM(u,i.props[n])||(l?i._l(n,u,!1):i.wl(n,!1),r=!0)}}),r&&n&&this.il.forEach(function(e){return e()}),r}},{key:"kl",value:function(){var e=this;if(!this.Vo)return!1;try{this.tl=!1;var t,n=i7.Ot(this.rl),i=this.vl(sS),r=!1,s=!1;if(n!==i.storageValue)if(er(n))i.storageValue=null;else{if(t=sF(n),this.tl=!this.Xo&&this.fl(t),this.tl)return!1;s=this.pl(t,sS,!1),!this.Zo||sM(this.gl().main,t)?this.ml(t,sS,!0,n):i.storageValue=n,r=!0}return this.Zo&&r8.forEach(function(n){var i=i7.Ot(e.hl(n)),o=e.vl(n),a=t||{},u=r&&s$.some(function(e){var t;return(null==(t=se(e))?void 0:t.storageGroup)===n&&e in a});if(i!==o.storageValue||u){if(er(i))return o.storageValue=null,o.persisted=!1,void(u&&(s=e.pl(a,n,!1)||s));var l=sF(i);s=e.pl(l,n,!1)||s,e.ml(l,n,!0,i)}}),s}catch(e){return!1}}},{key:"dl",value:function(e,t){this.Ko.set(e,t);var n=se(e);(null==n?void 0:n.volatile)||(this.vl((this.Zo?null==n?void 0:n.storageGroup:void 0)||sS).fingerprint=void 0,this.Sl(e))}},{key:"xl",value:function(){var e=this;s$.forEach(function(t){return e.Ko.set(t,!0)})}},{key:"al",value:function(){var e=this;if(this.Vo)try{var t=i7.Ot(this.rl),n=sF(t);this.vl(sS).storageValue=t,s$.forEach(function(t){var i,r=e.Zo?null==(i=se(t))?void 0:i.storageGroup:void 0,s=r?i7.Ot(e.hl(r)):null;if(r){var o=e.vl(r);o.storageValue=s,o.persisted=!er(s)}var a=r&&!er(s)?sF(s):n;t in e.props?e.Cl(t,a[t],e.props[t]):t in a&&e.dl(t,!0)})}catch(e){}}},{key:"bl",value:function(e,t){var n=this.Ko.get(e);if(!n)return t;if(!0===n)return this.props[e];if("$active_feature_flags"===e){var i=new Set(Y(t)?t:[]),r=new Set(Y(this.props[e])?this.props[e]:[]);
2return n.forEach(function(e){return r.has(e)?i.add(e):i.delete(e)}),Array.from(i)}var s=Q(t)?tO({},t):{},o=Q(this.props[e])?this.props[e]:{};return n.forEach(function(e){e in o?s[e]=o[e]:delete s[e]}),s}},{key:"Cl",value:function(e,t,n){if(sP(e)){var i=this.Ko.get(e);if(!0!==i){var r=t;if(this.Vo)try{var s,o=this.Zo?null==(s=se(e))?void 0:s.storageGroup:void 0,a=o?this.hl(o):this.rl;r=sF(i7.Ot(a))[e]}catch(e){}var u=new Set(i||[]);if("$active_feature_flags"===e){if(!et(t)&&!Y(t)||!et(r)&&!Y(r)||!Y(n))return void this.dl(e,!0);var l=new Set(t||[]),c=new Set(r||[]),h=new Set(n);new Set((0,w._)(l).concat((0,w._)(h))).forEach(function(e){l.has(e)!==h.has(e)&&u.add(e)}),u.forEach(function(e){c.has(e)===h.has(e)&&u.delete(e)})}else{if(!Q(n))return void(sM(r,n)?this.Ko.delete(e):this.dl(e,!0));if(!et(t)&&!Q(t)||et(t)&&ee(n)&&et(r))return void this.dl(e,!0);var d=Q(t)?t:{},f=Q(r)?r:{};new Set((0,w._)(Object.keys(d)).concat((0,w._)(Object.keys(n)))).forEach(function(e){e in d==e in n&&sM(d[e],n[e])||u.add(e)}),u.forEach(function(e){e in f==e in n&&sM(f[e],n[e])&&u.delete(e)})}u.size?this.dl(e,u):this.Ko.delete(e)}}}},{key:"$l",value:function(){var e,t=null==(e=this.Mr)?void 0:e.persistence_save_debounce_ms;return eo(t)&&t>0?t:0}},{key:"Tl",value:function(e){if(this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase())if(e)try{var t=rs(e,this.Mr.cookie_persisted_properties||[]),n=ra(t,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(n),r=i8.Ot(this.rl)||void 0;r&&rl(this.rl,r)===i&&(this.Il=i,this.Ml=r)}catch(e){}else try{var s=i8.Ot(this.rl)||void 0;this.Il=s?rl(this.rl,s):void 0,this.Ml=s}catch(e){}}},{key:"syncCookieProperties",value:function(){return this.El(this.Mr)}},{key:"El",value:function(e){var t,n,i=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.pi&&!r||this.Jo||!e.cookieWinsOnConflict||"localstorage+cookie"!==e.persistence.toLowerCase())return!1;try{t=i8.Ot(this.rl)||void 0}catch(e){}if(!t||t===this.Ml)return!1;var s=rl(this.rl,t);try{n=rr(JSON.parse(t))}catch(e){return!1}if((i8.Ot(this.rl)||void 0)!==t)return!1;this.Il=s,this.Ml=t;var o=ru(this.rl,t),a=(0,w._)(rt).concat((0,w._)(o.properties)),u={};if(Object.keys(n).forEach(function(e){var t=n[e];(et(t)||er(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t)&&(u[e]=!0,delete n[e])}),ee(n))return!1;var l="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,c=this.props,h=c[nB],d=c[ib],f=iq({},c);(0,w._)(rt).concat((0,w._)(e.cookie_persisted_properties||[])).forEach(function(e){if(-1!==a.indexOf(e)&&!(e in n)&&!u[e]&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=f[e];(o.isValid||-1===rt.indexOf(e)||!1!==t&&0!==t)&&delete f[e]}}),this.props=iq(f,n),s$.forEach(function(e){var t=e in i.props;e in c===t&&sM(c[e],i.props[e])||(t?i.Cl(e,c[e],i.props[e]):i.dl(e,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this._l(ib,iI);var v=this.props[nB],p=this.props[ib];return l&&(v!==h||p!==d)&&(this.Xo=!0,this.Qo=!0,rf.At(sx(this.rl),!0),this.wl(io),this.wl(n8),this.wl(n6),this.wl(n7),this.wl(ie),this.wl(it),this.wl(im),this.wl(iy),this.wl(ig),"anonymous"!==p||"identified"!==d&&"anonymous"!==n.$user_state&&(et(h)||v===h)||(sC(this.props,n),this.wl(ia)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.wl(nq)),!0}},{key:"consumeCookieIdentityChange",value:function(){var e=sx(this.rl),t=this.Qo||!!rf.Ot(e);return this.Qo=!1,t&&rf.Lt(e),t}},{key:"Pl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return!(this.Jo||this.pi&&!e||!this.Mr.cookieWinsOnConflict||"localstorage+cookie"!==this.Mr.persistence.toLowerCase()||(this.Jo=!0,0))}},{key:"Rl",value:function(){this.Jo&&(et(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[sS],this.Fl(!0))}},{key:"Ol",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(this.Jo)try{e?this.Rl():et(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}},{key:"isDisabled",value:function(){return!!this.pi}},{key:"ol",value:function(e){-1===sw.indexOf(e.persistence.toLowerCase())&&(nA.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(0,w._)(rt).concat((0,w._)(e));return tO(tO({},i7),{},{Dt:function(e){try{var i,r={};try{r=(i=i8.Ot(e)||void 0)?rr(JSON.parse(i)):{}}catch(e){}var s=JSON.parse(i7.Ot(e)||"{}");if(t){var o=ru(e,i),a=(0,w._)(rt).concat((0,w._)(o.properties)),u={};Object.keys(r).forEach(function(e){var t=r[e];er(t)||""===t||"$user_state"===e&&"anonymous"!==t&&"identified"!==t||(u[e]=t)});var l="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var c,h,d=s[nB],f=null!=(h=s.$user_state)?h:iI;
2n.forEach(function(e){if(-1!==a.indexOf(e)&&!(e in r)&&(l||"distinct_id"!==e&&"$user_state"!==e)){var t=s[e];(o.isValid||-1===rt.indexOf(e)||!1!==t&&0!==t)&&delete s[e]}}),!l||"$user_state"in r||"$user_state"in s||(s[ib]=iI),l&&(("distinct_id"in u?u[nB]:s[nB])!==d||("$user_state"in u?u[ib]:s[ib])!==f)&&(re.forEach(function(e){return delete s[e]}),"identified"===u.$user_state&&"distinct_id"in u?s.$user_id=u[nB]:delete s.$user_id,"identified"!==u.$user_state&&(delete s[iu],delete s[ia]),delete s.__alias)}c=iq(s,u)}else c=iq(r,s);return i7.At(e,c),c}catch(e){}return null},At:function(n,i,r,s,o,a){var u=i7.At(n,i,void 0,void 0,a);try{var l=rs(i,e);if(Object.keys(l).length){if(t){var c=rn(n),h=ra(l,e);if(i8.At(c,h,r,s,o,a),i8.Ot(c)!==JSON.stringify(h)){i8.Lt(c,s);var d=rs(i);return i8.At(n,d,r,s,o,a),u}}i8.At(n,l,r,s,o,a)}}catch(e){i7.Pt(e)}return u},Lt:function(e,t){try{null==S||S.localStorage.removeItem(e),i8.Lt(e,t),i8.Lt(rn(e),t)}catch(e){i7.Pt(e)}}})}(e.cookie_persisted_properties||[],e.cookieWinsOnConflict),i=!1,r=!1,s=e.persistence.toLowerCase();return"localstorage"===s&&i7.Et()?(t=i7,r=!0):"localstorage+cookie"===s&&n.Et()?(t=n,r=!0,i=!0):"sessionstorage"===s&&rf.Et()?t=rf:"memory"===s?t=rh:"cookie"===s&&i8.Et()?(t=i8,i=!0):n.Et()?(t=n,r=!0,i=!0):i8.Et()?(t=i8,i=!0):t=rh,this.Vo=r,this.Go=i,t}},{key:"hl",value:function(e){return"".concat(this.rl,"__").concat(e)}},{key:"ll",value:function(e){return this.Vo&&!!e.split_storage}},{key:"properties",value:function(){var e={};return iz(this.props,function(t,n){var i,r=se(n);if(!r||"event"===r.exposure){if(null==r||null==(i=r.shouldSkipFromEventProperties)?void 0:i.call(r,t))return;e[n]=t}}),e}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.pi||t){var n=this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase(),i=n?i7.Dt(this.rl):null,r={};if(n)try{r=rr(i8.Dt(this.rl)),iz(r,function(e,t){(et(e)||er(e)||""===e)&&delete r[t]})}catch(e){}var s=this.Fo.Dt(this.rl);if(s&&(this.props=iq({},s)),this.Zo&&this.Dl(),n&&s){var o,a,u=null==i?void 0:i[nB],l=null!=(o=null==i?void 0:i.$user_state)?o:iI,c=s[nB],h=null!=(a=s.$user_state)?a:iI;if(c!==u||h!==l){this.Qo=!0,rf.At(sx(this.rl),!0);var d=iq({},this.props);re.forEach(function(e){return delete d[e]}),"anonymous"!==h||"identified"!==l&&"anonymous"!==r.$user_state&&(et(u)||c===u)||(sC(d,r),delete d[ia]),this.props=d;var f=new Set;re.forEach(function(e){var t,n=null==(t=se(e))?void 0:t.storageGroup;n&&f.add(n)}),f.forEach(function(t){var n={};iz(e.props,function(e,i){var r;(null==(r=se(i))?void 0:r.storageGroup)===t&&(n[i]=e)}),ee(n)?(i7.Lt(e.hl(t)),e.Wo[t]={}):i7.At(e.hl(t),n)&&(e.Wo[t]={persisted:!0,fingerprint:e.yl(n,t)})})}}rf.Ot(sx(this.rl))&&(this.Qo=!0)}}},{key:"Dl",value:function(){var e=!0,t=!1,n=void 0;try{for(var i,r=r8[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value,o=i7.Dt(this.hl(s));if(o&&!ee(o)){var a=this.vl(s);a.persisted=!0,this.Ll(s)||(a.fingerprint=this.yl(o,s)),this.Nl(s,o)||iq(this.props,o)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}}},{key:"Ll",value:function(e){return Object.keys(this.props).some(function(t){var n;return(null==(n=se(t))?void 0:n.storageGroup)===e})}},{key:"Nl",value:function(e,t){var n=sk[e];if(!n)return!1;var i=t[n],r=this.props[n];return eo(i)&&eo(r)&&r>i}},{key:"refreshKey",value:function(e){if(!this.pi&&("$fbc_persistence"!==e||!this.el)){var t,n=this.Zo?null==(t=se(e))?void 0:t.storageGroup:void 0,i=n?i7.Dt(this.hl(n)):this.Fo.Dt(this.rl);if(i&&e in i)this._l(e,i[e],!1);else{if(n){var r=this.Fo.Dt(this.rl);if(r&&e in r)return void this._l(e,r[e],!1)}this.wl(e,!1)}}}},{key:"save",value:function(){var e=this;if(!this.pi){var t=this.$l();t>0?et(this.Al)&&(this.Al=setTimeout(function(){e.Al=void 0,e.Fl()},t)):this.Fl()}}},{key:"flush",value:function(){et(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}},{key:"Fl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.pi&&(!this.Jo||e)){e||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&"localstorage+cookie"===this.Mr.persistence.toLowerCase()||this.refreshKey(nU));var t=!e&&!this.Yo;t||(this.tl=!1);var n=!!t&&this.kl();if(this.tl)return void(this.Mr.debug&&nA.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(n&&this.il.forEach(function(e){return e()}));var i=this.jl(this.Fo,this.rl,this.props,sS);"written"===i&&this.Tl(this.props),"failed"!==i&&(this.Ko.clear(),this.Xo=!1,this.el=!1),n&&this.il.forEach(function(e){return e()})}}},{key:"ql",value:function(){var e=this,t=this.gl(),n=t.main,i=t.groups,r=this.jl(this.Fo,this.rl,n,sS);
2"written"===r&&this.Tl(n),"failed"!==r&&(this.Xo=!1,this.el=!1,s$.forEach(function(t){var n;(null==(n=se(t))?void 0:n.storageGroup)||e.Ko.delete(t)}));var s=!0,o=!1,a=void 0;try{for(var u,l,c=r8[Symbol.iterator]();!(s=(l=c.next()).done);s=!0)u=this,function(){var t,n=l.value,r=i[n];if(ee(r)&&!(null==(t=u.Wo[n])?void 0:t.persisted))return s$.forEach(function(t){var i;(null==(i=se(t))?void 0:i.storageGroup)===n&&e.Ko.delete(t)});var s=u.jl(i7,u.hl(n),r,n);"failed"!==s&&s$.forEach(function(t){var i=se(t);(null==i?void 0:i.storageGroup)!==n||"written"!==s&&i.volatile||e.Ko.delete(t)})}()}catch(e){o=!0,a=e}finally{try{s||null==c.return||c.return()}finally{if(o)throw a}}}},{key:"gl",value:function(){var e={},t={flags:{},surveys:{}};return iz(this.props,function(n,i){var r,s=null==(r=se(i))?void 0:r.storageGroup;s?t[s][i]=n:e[i]=n}),{main:e,groups:t}}},{key:"yl",value:function(e,t){if(t===sS)return JSON.stringify(e)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;var n={};return iz(e,function(e,t){var i;n[t]=(null==(i=se(t))?void 0:i.volatile)?"__volatile__":e}),JSON.stringify(n)}},{key:"jl",value:function(e,t,n,i){var r,s=this.vl(i);if(i!==sS&&!s.dirty&&!et(s.fingerprint))return"skipped";try{if((r=this.yl(n,i))===s.fingerprint)return s.dirty=!1,"skipped"}catch(e){r=void 0}return e.At(t,n,this.Bl,this.Hl,this.zl,this.Mr.debug)?(s.dirty=!1,i!==sS&&(s.persisted=!0),et(r)||(s.fingerprint=r),this.Vo&&(s.storageValue=i7.Ot(t)),"written"):(this.Mr.debug&&nA.warn('failed to persist storage entry "'.concat(t,'"; will retry on next save')),"failed")}},{key:"remove",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.keepGroupEntries,n=void 0!==t&&t,i=!0,r=!1,s=void 0;if(this.xl(),et(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!n&&this.nl)try{for(var o,a=r8[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value;i7.Lt(this.hl(u))}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}n?delete this.Wo[sS]:this.Wo={},this.Il=void 0,this.Ml=void 0}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,t,n){var i=this;if(Q(e)){this.syncCookieProperties(),et(t)&&(t="None"),this.Bl=et(n)?this.Ul:n;var r=!1;if(iz(e,function(e,n){i.props.hasOwnProperty(n)&&i.props[n]!==t||(i._l(n,e),r=!0)}),r)return this.save(),!0}return!1}},{key:"register",value:function(e,t){var n=this;if(Q(e)){this.syncCookieProperties(),this.Bl=et(t)?this.Ul:t;var i=!1;if(iz(e,function(t,r){e.hasOwnProperty(r)&&(n.props[r]!==t||Q(t)||Y(t))&&(n._l(r,t),i=!0)}),i)return this.save(),!0}return!1}},{key:"unregister",value:function(e){this.syncCookieProperties();var t=!1,n=!0,i=!1,r=void 0;try{for(var s,o=("string"==typeof e?[e]:e)[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value;a in this.props&&(this.wl(a),t=!0)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}t&&this.save()}},{key:"update_campaign_params",value:function(){var e=null==M?void 0:M.URL;if(e!==this.sl){var t=sd(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),n=!ee(iW(t));return n&&this.register(t),this.sl=e,n?t:void 0}}},{key:"update_search_keyword",value:function(){var e;this.register((e=null==M?void 0:M.referrer)?sv(e):{})}},{key:"update_referrer_info",value:function(){var e;this.register_once({$referrer:s_(),$referring_domain:(null==M?void 0:M.referrer)&&(null==(e=sn(M.referrer))?void 0:e.host)||sg},void 0)}},{key:"set_initial_person_info",value:function(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var e=sy(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once((0,y._)({},iE,this.Go?{r:sE(e.r),u:e.u?sE(e.u):void 0}:e),void 0)}}},{key:"get_initial_props",value:function(){var e=this,t={};iz([ix,iw],function(n){var i=e.props[n];i&&iz(i,function(e,n){t["$initial_"+W(n)]=e})});var n=this.props[iE];return n&&iq(t,function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=sm(e,t),i={};return iz(n,function(e,t){i["$initial_".concat(W(t))]=e}),i}
2(n,this.Mr.disable_capture_url_hashes)),t}},{key:"safe_merge",value:function(e){return iz(this.props,function(t,n){n in e||(e[n]=t)}),e}},{key:"update_config",value:function(e,t,n){var i=e.persistence!==t.persistence,r=!function(e,t){if(e.length!==t.length)return!1;var n=(0,w._)(e).sort(),i=(0,w._)(t).sort();return n.every(function(e,t){return e===i[t]})}(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),s=i||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!n,u=!!this.pi&&!a;a||this.El(t,u),this.Mr=e,!a&&(i||r||o)&&(this.Il=void 0,this.Ml=void 0,this.El(tO(tO({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),u));var l=s||o?this.ol(e):this.Fo;this.Wl();var c=this.ll(e),h=s||c!==this.Zo,d=!a&&(h||e.cross_subdomain_cookie!==this.Hl||e.secure_cookie!==this.zl)&&this.Pl(u);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){var f=this.props;this.clear(),this.Fo=l,this.Zo=c,this.props=f,this.save()}else o&&(this.Fo=l,a||(delete this.Wo[sS],this.Fl()))}finally{this.Yo=!1,d&&this.Ol()}}},{key:"Wl",value:function(){var e=this.props[iE];if(this.Go&&Q(e)&&"string"==typeof e.r){var t=sE(e.r),n="string"==typeof e.u?sE(e.u):e.u;t===e.r&&n===e.u||this._l(iE,tO(tO({},e),{},{r:t,u:n}))}}},{key:"set_disabled",value:function(e){this.pi=e,this.pi?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.Hl&&(this.Hl=e,this.remove({keepGroupEntries:!0}),this.save())}},{key:"set_secure",value:function(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}},{key:"set_event_timer",value:function(e,t){var n=this.props.__timers||{};n[e]=t,this._l(nW,n),this.save()}},{key:"remove_event_timer",value:function(e){var t=this.props.__timers||{},n=t[e];return et(n)||(delete t[e],this._l(nW,t),this.save()),n}},{key:"get_property",value:function(e){return this.props[e]}},{key:"set_property",value:function(e,t){this._l(e,t),this.save()}},{key:"_l",value:function(e,t){var n,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=this.props[e];this.props[e]=t,i&&("distinct_id"!==e&&"$user_state"!==e||r===t||(this.Xo=!0),"$fbc_persistence"!==e||sM(r,t)||(this.el=!0),this.Cl(e,r,t),(null==(n=se(e))?void 0:n.volatile)||this.Sl(e))}},{key:"wl",value:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];delete this.props[e],t&&(sP(e)&&this.dl(e,!0),"$fbc_persistence"===e&&(this.el=!0),this.Sl(e))}},{key:"Sl",value:function(e){var t,n=null==(t=se(e))?void 0:t.storageGroup;n&&(this.vl(n).dirty=!0)}},{key:"vl",value:function(e){return this.Wo[e]||(this.Wo[e]={})}}]),e}(),sI="gzip-js",sA="base64",sR="events",sT="cancelEvents",sL="survey shown",sD="survey dismissed",sN="survey sent",sj="popover";function sB(e){var t=!0;return{dispose:function(){if(t){t=!1;var n=e();n&&Z(n.then)&&n.then(void 0,function(){})}}}}var sH=nR("[RateLimiter]"),sz=function(){function e(t){var n=this;(0,g._)(this,e),this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=function(e){var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(function(e){sH.info("".concat(e||"events"," is quota limited.")),n.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void sH.warn('could not rate limit - continuing. Error: "'.concat(null==e?void 0:e.message,'"'),{text:t})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}return(0,_._)(e,[{key:"captureEventsPerSecond",get:function(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}},{key:"captureEventsBurstLimit",get:function(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}},{key:"clientRateLimitContext",value:function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!=(e=null==(t=this.instance.persistence)?void 0:t.get_property("$capture_rate_limit"))?e:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>r&&(a.tokens=r);var u=1>a.tokens;if(u||i||(a.tokens=Math.max(0,a.tokens-1)),u&&!i){var l=(eo(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.Vl(l)&&(a.dropped=0)}return this.lastEventRateLimited=u,null==(n=this.instance.persistence)||n.set_property("$capture_rate_limit",a),{isRateLimited:u,remainingTokens:a.tokens}}},{key:"Gl",value:function(e){var t=this.instance.config.property_denylist;return!Y(t)||!t.includes(e)}},{key:"Zl",value:function(){var e;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(null==F?void 0:F.pathname))return"".concat(null!=(e=F.origin)?e:"").concat(F.pathname)}},{key:"Vl",value:function(e){var t,n,i=this.captureEventsBurstLimit,r=this.captureEventsPerSecond,s=this.Zl(),o=this.Gl("$session_id")?null==(t=(n=this.instance).get_session_id)?void 0:t.call(n):void 0,a=["".concat(e," event(s) dropped since the last warning"),s?"triggered on ".concat(s):void 0,o?"session ".concat(o):void 0].filter(
2Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: ".concat(a,". Config is set to ").concat(r," events per second and ").concat(i," events burst limit.")},{skip_client_rate_limiting:!0})}},{key:"isServerRateLimited",value:function(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}]),e}(),sq=nR("[RemoteConfig]"),sV=function(){function e(t){(0,g._)(this,e),this._instance=t}return(0,_._)(e,[{key:"remoteConfig",get:function(){var e;return null==(e=D._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}},{key:"Ql",value:function(e){var t,n,i,r=this;(null==(t=D.__PosthogExtensions__)?void 0:t.loadExternalDependency)?null==(n=D.__PosthogExtensions__)||null==(i=n.loadExternalDependency)||i.call(n,this._instance,"remote-config",function(){return e(r.remoteConfig)}):e()}},{key:"Jl",value:function(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/".concat(this._instance.config.token,"/config")),callback:e})}},{key:"load",value:function(){var e=this;try{if(this.remoteConfig)return sq.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Yl())return void sq.warn("Remote config is disabled. Falling back to local config.");this.Ql(function(t){t?e.Kl(t):(sq.info("No config found after loading remote JS config. Falling back to JSON."),e.Jl(function(t){e.Kl(t.json,t)}))})}catch(e){sq.error("Error loading remote config",e),this.Kl()}}},{key:"Kl",value:function(e,t){!e&&t&&(0===t.statusCode?t.error||sq.warn("Failed to fetch remote config from PostHog."):sq.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(e?{ok:!0,config:e}:{ok:!1})}catch(e){sq.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 n;null==(n=this._instance.featureFlags)||n.ensureFlagsLoaded()}catch(e){sq.error("Error loading feature flags",e)}}}]),e}(),sU=Uint8Array,sW=Uint16Array,sG=Uint32Array,sK=new sU([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]),sX=new sU([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]),sJ=new sU([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sY=function(e,t){for(var n=new sW(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var r=new sG(n[30]);for(i=1;30>i;++i)for(var s=n[i];n[i+1]>s;++s)r[s]=s-n[i]<<5|i;return[n,r]},sZ=sY(sK,2),sQ=sZ[1];sZ[0][28]=258,sQ[258]=28;for(var s0=sY(sX,0)[1],s1=new sW(32768),s2=0;32768>s2;++s2){var s3=(43690&s2)>>>1|(21845&s2)<<1;s1[s2]=((65280&(s3=(61680&(s3=(52428&s3)>>>2|(13107&s3)<<2))>>>4|(3855&s3)<<4))>>>8|(255&s3)<<8)>>>1}var s5=function(e,t,n){for(var i=e.length,r=0,s=new sW(t);i>r;++r)++s[e[r]-1];var o,a=new sW(t);for(r=0;t>r;++r)a[r]=a[r-1]+s[r-1]<<1;if(n){o=new sW(1<<t);var u=15-t;for(r=0;i>r;++r)if(e[r])for(var l=r<<4|e[r],c=t-e[r],h=a[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)o[s1[h]>>>u]=l}else for(o=new sW(i),r=0;i>r;++r)o[r]=s1[a[e[r]-1]++]>>>15-e[r];return o},s4=new sU(288);for(s2=0;144>s2;++s2)s4[s2]=8;for(s2=144;256>s2;++s2)s4[s2]=9;for(s2=256;280>s2;++s2)s4[s2]=7;for(s2=280;288>s2;++s2)s4[s2]=8;var s6=new sU(32);for(s2=0;32>s2;++s2)s6[s2]=5;var s8=s5(s4,9,0),s9=s5(s6,5,0),s7=function(e){return(e/8|0)+(7&e&&1)},oe=function(e,t,n){(null==t||0>t)&&(t=0),(null==n||n>e.length)&&(n=e.length);var i=new((0,b._)(e,sW)?sW:(0,b._)(e,sG)?sG:sU)(n-t);return i.set(e.subarray(t,n)),i},ot=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},on=function(e,t,n){var i=t/8|0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},oi=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,s=n.slice();if(!r)return[new sU(0),0];if(1==r){var o=new sU(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var a=n[0],u=n[1],l=0,c=1,h=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=r-1;)a=n[n[h].f>n[l].f?l++:h++],u=n[l!=c&&n[h].f>n[l].f?l++:h++],n[c++]={s:-1,f:a.f+u.f,l:a,r:u};var d=s[0].s;for(i=1;r>i;++i)s[i].s>d&&(d=s[i].s);var f=new sW(d+1),v=or(n[c-1],f,0);if(v>t){i=0;var p=0,g=v-t,_=1<<g;for(s.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});r>i;++i){var y=s[i].s;if(t>=f[y])break;p+=_-(1<<v-f[y]),f[y]=t}for(p>>>=g;p>0;){var m=s[i].s;t>f[m]?p-=1<<t-f[m]++-1:++i}for(;i>=0&&p;--i){var b=s[i].s;f[b]==t&&(--f[b],++p)}v=t}return[new sU(f),v]},or=function(e,t,n){return -1==e.s?Math.max(or(e.l,t,n+1),or(e.r,t,n+1)):t[e.s]=n},os=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new sW(++t),i=0,r=e[0],s=1,o=function(e){n[i++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(r),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(r);s=1,r=e[a]}return[n.subarray(0,i),t]},oo=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},oa=function(e,t,n){var i=n.length,r=s7(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var s=0;i>s;++s)e[r+s+4]=n[s];return 8*(r+4+i)},ou=function(e,t,n,i,r,s,o,a,u,l,c){ot(t,c++,n),++r[256];for(var h=oi(r,15),d=h[0],f=h[1],v=oi(s,15),p=v[0],g=v[1],_=os(d),y=_[0],m=_[1],b=os(p),k=b[0],w=b[1],x=new sW(19),E=0;y.length>E;++E)x[31&y[E]]++;for(E=0;k.length>E;++E)x[31&k[E]]++;for(var S=oi(x,7),$=S[0],P=S[1],M=19;M>4&&!$[sJ[M-1]];--M);var F,C,O,I,A=l+5<<3,R=oo(r,s4)+oo(s,s6)+o,T=oo(r,d)+oo(s,p)+o+14+3*M+oo(x,$)+(2*x[16]+3*x[17]+7*x[18]);if(R>=A&&T>=A)return oa(t,c,e.subarray(u,u+l));if(ot(t,c,1+(R>T)),c+=2,R>T){F=s5(d,f,0),C=d,O=s5(p,g,0),I=p;var L=s5($,P,0);for(ot(t,c,m-257),ot(t,c+5,w-1),ot(t,c+10,M-4),c+=14,E=0;M>E;++E)ot(t,c+3*E,$[sJ[E]]);c+=3*M;for(var D=[y,k],N=0;2>N;++N){var j=D[N];for(E=0;j.length>E;++E)ot(t,c,L[B=31&j[E]]),c+=$[B],B>15&&(ot(t,c,j[E]>>>5&127),c+=j[E]>>>12)}}else F=s8,C=s4,O=s9,I=s6;for(E=0;a>E;++E)if(i[E]>255){on(t,c,F[257+(B=i[E]>>>18&31)]),c+=C[B+257],B>7&&(ot(t,c,i[E]>>>23&31),c+=sK[B]);var B,H=31&i[E];on(t,c,O[H]),c+=I[H],H>3&&(on(t,c,i[E]>>>5&8191),c+=sX[H])}else on(t,c,F[i[E]]),c+=C[i[E]];return on(t,c,F[256]),c+C[256]},ol=new sG([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oc=new sU(0),oh=function(){for(var e=new sG(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&0xedb88320)^n>>>1;e[t]=n}return e}(),od=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},of=!!O||!!C,ov="text/plain",op=!1,og=function(e,t){var n=(0,k._)(e.split("#"),2),i=n[0],r=n[1],s=(0,k._)(i.split("?"),2),o=s[0],a=s[1];if(!a)return e;var u=a.split("&").filter(function(e){return e.split("=")[0]!==t}).join("&");return"".concat(o).concat(u?"?".concat(u):"").concat(r?"#".concat(r):"")},o_=function(e,t){var n,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=(0,k._)(e.split("?"),2),s=r[0],o=r[1],a=tO({},t),u=null!=(n=null==o?void 0:o.split("&").map(function(e){var t,n=(0,k._)(e.split("="),2),r=n[0],s=n[1],o=i&&null!=(t=a[r])?t:s;return delete a[r],"".concat(r,"=").concat(o)}))?n:[],l=function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"&",r=[];return iz(e,function(e,i){et(e)||et(i)||"undefined"===i||(t=encodeURIComponent((0,b._)(e,File)?e.name:e.toString()),n=encodeURIComponent(i),r[r.length]=n+"="+t)}),r.join(i)}(a);return l&&u.push(l),u.length>0?"".concat(s,"?").concat(u.join("&")):s},oy=function(e){if(e.Xl)return e.Xl;var t=e.data,n=e.compression;if(t){if(n===sI){var i,r,s,o,a,u,l,c,h,d=(i=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var n=new sU(e.length+(e.length>>>1)),i=0,r=function(e){n[i++]=e},s=0;t>s;++s){if(i+5>n.length){var o=new sU(i+8+(t-s<<1));o.set(n),n=o}var a=e.charCodeAt(s);128>a?r(a):(2048>a?r(192|a>>>6):(a>55295&&57344>a?(r(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++s))>>>18),r(128|a>>>12&63)):r(224|a>>>12),r(128|a>>>6&63)),r(128|63&a))}return oe(n,0,i)}(st(t)),r={mtime:0},s=0xffffffff,o={p:function(e){for(var t=s,n=0;e.length>n;++n)t=oh[255&t^e[n]]^t>>>8;s=t},d:function(){return 0xffffffff^s}},a=i.length,o.p(i),h=(u=10+(r.filename&&r.filename.length+1||0),c=function(e,t,n,i,r){var s=e.length,o=new sU(i+s+5*(1+Math.floor(s/7e3))+8),a=o.subarray(i,o.length-8),u=0;if(!t||8>s)for(var l=0;s>=l;l+=65535){var c=l+65535;s>c?u=oa(a,u,e.subarray(l,c)):(a[l]=r,u=oa(a,u,e.subarray(l,s)))}else{for(var h=ol[t-1],d=h>>>13,f=8191&h,v=(1<<n)-1,p=new sW(32768),g=new sW(v+1),_=Math.ceil(n/3),y=2*_,m=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<y)&v},b=new sG(25e3),k=new sW(288),w=new sW(32),x=0,E=0,S=(l=0,0),$=0,P=0;s>l;++l){var M=m(l),F=32767&l,C=g[M];if(p[F]=C,g[M]=F,l>=$){var O=s-l;if((x>7e3||S>24576)&&O>423){u=ou(e,a,0,b,k,w,E,S,P,l-P,u),S=x=E=0,P=l;for(var I=0;286>I;++I)k[I]=0;for(I=0;30>I;++I)w[I]=0}var A=2,R=0,T=f,L=F-C&32767;if(O>2&&M==m(l-L))for(var D=Math.min(d,O)-1,N=Math.min(32767,l),j=Math.min(258,O);N>=L&&--T&&F!=C;){if(e[l+A]==e[l+A-L]){for(var B=0;j>B&&e[l+B]==e[l+B-L];++B);if(B>A){if(A=B,R=L,B>D)break;var H=Math.min(L,B-2),z=0;for(I=0;H>I;++I){var q=l-L+I+32768&32767,V=q-p[q]+32768&32767;V>z&&(z=V,C=q)}}}L+=(F=C)-(C=p[F])+32768&32767}if(R){b[S++]=0x10000000|sQ[A]<<18|s0[R];var U=31&sQ[A],W=31&s0[R];E+=sK[U]+sX[W],++k[257+U],++w[W],$=l+A,++x}else b[S++]=e[l],++k[e[l]]}}u=ou(e,a,r,b,k,w,E,S,P,l-P,u),r||(u=oa(a,u,oc))}return oe(o,0,i+s7(u)+8)}(i,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+r.mem,u,!l)).length,function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&od(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;n.length>=i;++i)e[i+10]=n.charCodeAt(i)}}(c,r),od(c,h-8,o.d()),od(c,h-4,a),c);return{contentType:ov,body:d.buffer.slice(d.byteOffset,d.byteOffset+d.byteLength),estimatedSize:d.byteLength}}if(n===sA){var f,v,p="data="+encodeURIComponent("string"==typeof(v=(f=st(t))?btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})):f)?v:st(v));return{contentType:"application/x-www-form-urlencoded",body:p,estimatedSize:new Blob([p]).size}}var g=st(t);return{contentType:"application/json",body:g,estimatedSize:new Blob([g]).size}}},om=function(e){var t,n,i=function(){return"sendBeacon"===e.transport?{url:o_(e.url,{compression:sA}),encodedBody:oy(tO(tO({},e),{},{compression:sA,Xl:void 0}))}:{url:og(e.url,"compression"),encodedBody:oy(tO(tO({},e),{},{compression:void 0,Xl:void 0}))}};try{n=oy(e)}catch(t){if(na(e.compression,si(e.url,"compression")))return nA.error("Failed to gzip request body, sending uncompressed payload",t),i();throw t}return!(n&&na(e.compression,si(e.url,"compression")))||((0,b._)(t=n.body,ArrayBuffer)?no(new Uint8Array(t)):ArrayBuffer.isView(t)&&no(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:n}:(op=!0,i())},ob=function(e){try{return om(e)}catch(n){var t;return nA.error(n),void(null==(t=e.callback)||t.call(e,{statusCode:0,error:n}))}},ok=(i=em(function(e){var t,n;return(0,E._)(this,function(i){switch(i.label){case 0:return[4,function(e){return nh.apply(this,arguments)}(st(e.data),j.DEBUG,{rethrow:!0})];case 1:if(!(t=i.sent()))return[2,e];return[4,t.arrayBuffer()];case 2:return n=i.sent(),[2,tO(tO({},e),{},{Xl:{contentType:ov,body:n,estimatedSize:n.byteLength}})]}})}),function(e){return i.apply(this,arguments)}),ow=/Failed to fetch|NetworkError|Load failed/i,ox=function(e){return"TypeError"===(null==e?void 0:e.name)&&ow.test((null==e?void 0:e.message)||"")},oE=function(e){var t=ob(e);
2if(t){var n=new O,i=t.url,r=t.encodedBody;n.open(e.method||"GET",i,!0);var s=null!=r?r:{},o=s.contentType,a=s.body;iz(e.headers,function(e,t){n.setRequestHeader(t,e)}),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=function(){if(4===n.readyState){var t,i={statusCode:n.status,text:n.responseText};if(200===n.status)try{i.json=JSON.parse(n.responseText)}catch(e){}null==(t=e.callback)||t.call(e,i)}},n.send(a)}},oS=function(e){var t=ob(e);if(t){var n=t.url,i=t.encodedBody,r=null!=i?i:{},s=r.contentType,o=r.body,a=r.estimatedSize,u=new Headers;iz(e.headers,function(e,t){u.append(t,e)}),s&&u.append("Content-Type",s);var l=null,c=!1;if(I){var h=new I;l={signal:h.signal,timeout:setTimeout(function(){var t;c=!0,h.abort(tx("AbortError","PostHog request timed out"+((t=e.timeout)?" after ".concat(t,"ms"):"")))},e.timeout)}}var d=function(t){var n;c&&"AbortError"===(null==t?void 0:t.name)||ox(t)?nA.warn(t):nA.error(t),null==(n=e.callback)||n.call(e,{statusCode:0,error:t})};try{C(n,tO({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e.ta&&52428.8>(a||0),body:o,signal:null==l?void 0:l.signal},e.fetchOptions)).then(function(t){return t.text().then(function(n){var i,r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){nA.error(e)}null==(i=e.callback)||i.call(e,r)})}).catch(d).finally(function(){return l?clearTimeout(l.timeout):null})}catch(e){l&&clearTimeout(l.timeout),d(e)}}},o$=function(e){try{var t,n=om(e),i=n.url,r=n.encodedBody,s=null!=r?r:{},o=s.contentType,a=s.body,u=s.estimatedSize;if(!a)return;var l=(0,b._)(a,Blob)?a:new Blob([a],{type:o});if(P.sendBeacon(i,l))return;var c=Y(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(Y(c)&&c.length>1&&(null!=u?u:0)>16384){var h=Math.ceil(c.length/2),d=function(t){return Y(e.data)?t:tO(tO({},e.data),{},{batch:t})};return o$(tO(tO({},e),{},{data:d(c.slice(0,h))})),void o$(tO(tO({},e),{},{data:d(c.slice(h))}))}nA.warn("Beacon of ~".concat(null!=u?u:0," bytes was rejected by the browser, falling back to ").concat(C?"fetch":"XHR")),C?oS(tO(tO({},e),{},{ta:!0})):oE(e)}catch(e){nA.warn("Beacon send failed",e)}},oP=function(e,t,n,i){var r="query"===i?"POST"===t?"sent_at":"_":void 0;return o_(n===sI?og(e,"compression"):e,tO(tO({},r?(0,y._)({},r,Date.now().toString()):{}),n===sI?{}:{compression:n}))},oM=(r=[],C&&r.push({transport:"fetch",method:oS}),O&&r.push({transport:"XHR",method:oE}),(null==P?void 0:P.sendBeacon)&&r.push({transport:"sendBeacon",method:o$}),r),oF=function(){function e(t,n){(0,g._)(this,e),this.ea=!0,this.ia=[],this.na=ew((null==n?void 0:n.flush_interval_ms)||3e3,250,5e3,nA.createLogger("flush interval"),3e3),this.sa=t}return(0,_._)(e,[{key:"enqueue",value:function(e){this.ia.push(e),this.ra||this.oa()}},{key:"unload",value:function(){var e=this;this.la();var t=Object.values(this.ia.length>0?this.aa():{});(0,w._)(t.filter(function(e){return 0===e.url.indexOf("/e")})).concat((0,w._)(t.filter(function(e){return 0!==e.url.indexOf("/e")}))).map(function(t){e.ua(tO(tO({},t),{},{transport:"sendBeacon"}))})}},{key:"enable",value:function(){this.ea=!1,this.oa()}},{key:"oa",value:function(){var e=this;this.ea||(this.ra=setTimeout(function(){if(e.la(),e.ia.length>0){var t=e.aa();for(var n in t)e.ua(t[n])}},this.na))}},{key:"ua",value:function(e){try{this.sa(e)}catch(e){nA.error(e)}}},{key:"la",value:function(){clearTimeout(this.ra),this.ra=void 0}},{key:"aa",value:function(){var e={};return iz(this.ia,function(t){var n,i=((t?t.batchKey:null)||t.url)+(t.batchGroup?":".concat(t.batchGroup):"");et(e[i])&&(e[i]=tO(tO({},t),{},{data:[]})),null==(n=e[i].data)||n.push(t.data)}),this.ia=[],e}}]),e}(),oC=["retriesPerformedSoFar"],oO=function(){function e(t){(0,g._)(this,e),this._instance=t,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}return(0,_._)(e,[{key:"resume",value:function(){var e=this;if(!et(S)&&"onLine"in S.navigator){if(this.da=S.navigator.onLine,this.va)return;this.va=function(){e.da=!0,e.fa()},this.pa=function(){e.da=!1},iX(S,"online",this.va),iX(S,"offline",this.pa)}}},{key:"length",get:function(){return this.ia.length}}
2,{key:"retriableRequest",value:function(e){var t=this,n=e.retriesPerformedSoFar,i=nf(e,oC);ea(n)&&(i.url=o_(i.url,{retry_count:n})),this._instance._send_request(tO(tO({},i),{},{callback:function(e){var r;if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=n?n:0))return void t.Ls(tO({retriesPerformedSoFar:n},i));0===e.statusCode&&nA.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ".concat(null!=n?n:0," retries."))}null==(r=i.callback)||r.call(i,e)}}))}},{key:"Ls",value:function(e){var t,n,i,r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;var s=(i=(Math.random()-.5)*((n=Math.min(18e5,t=3e3*Math.pow(2,r)))-t/2),Math.ceil(n+i)),o=Date.now()+s;this.ia.push({retryAt:o,requestOptions:e});var a="Enqueued failed request for retry in ".concat(s);navigator.onLine||(a+=" (Browser is offline)"),nA.warn(a),this.ha||(this.ha=!0,this.ga())}},{key:"ga",value:function(){var e=this;(this.ma&&clearTimeout(this.ma),0===this.ia.length)?(this.ha=!1,this.ma=void 0):this.ma=setTimeout(function(){e.da&&e.ia.length>0&&e.fa(),e.ga()},this.ca)}},{key:"fa",value:function(){var e=Date.now(),t=[],n=this.ia.filter(function(n){return e>n.retryAt||(t.push(n),!1)}),i=!0,r=!1,s=void 0;if(this.ia=t,n.length>0)try{for(var o,a=n[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value.requestOptions;this.retriableRequest(u)}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}}},{key:"unload",value:function(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,et(S)||(this.va&&(S.removeEventListener("online",this.va),this.va=void 0),this.pa&&(S.removeEventListener("offline",this.pa),this.pa=void 0));var e=!0,t=!1,n=void 0;try{for(var i,r=this.ia[Symbol.iterator]();!(e=(i=r.next()).done);e=!0){var s=i.value.requestOptions;try{this._instance._send_request(tO(tO({},s),{},{transport:"sendBeacon"}))}catch(e){nA.error(e)}}}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}this.ia=[]}}]),e}(),oI=function(){function e(t){var n=this;(0,g._)(this,e),this._instance=t,this.ya=function(){n.ba||(n.ba={});var e,t,i,r,s=n.scrollElement(),o=n.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,u=o+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;n.ba.lastScrollY=Math.ceil(o),n.ba.maxScrollY=Math.max(o,null!=(e=n.ba.maxScrollY)?e:0),n.ba.maxScrollHeight=Math.max(a,null!=(t=n.ba.maxScrollHeight)?t:0),n.ba.lastContentY=u,n.ba.maxContentY=Math.max(u,null!=(i=n.ba.maxContentY)?i:0),n.ba.maxContentHeight=Math.max(l,null!=(r=n.ba.maxContentHeight)?r:0)}}return(0,_._)(e,[{key:"_a",get:function(){return this._instance.config.scroll_root_selector}},{key:"getContext",value:function(){return this.ba}},{key:"resetContext",value:function(){var e=this.ba;return this.ba=void 0,setTimeout(this.ya,0),e}},{key:"startMeasuringScrollPosition",value:function(){iX(S,"scroll",this.ya,{capture:!0}),iX(S,"scrollend",this.ya,{capture:!0}),iX(S,"resize",this.ya)}},{key:"scrollElement",value:function(){if(this._a){var e,t=Y(this._a)?this._a:[this._a],n=!0,i=!1,r=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a,u=s.value,l=null==S||null==(a=S.document)?void 0:a.querySelector(u);if(l)return l}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return}return null==S||null==(e=S.document)?void 0:e.documentElement}},{key:"wa",value:function(e){var t,n;if(this._a){var i=this.scrollElement();return i&&i["y"===e?"scrollTop":"scrollLeft"]||0}return S?"y"===e?S.scrollY||S.pageYOffset||(null==(t=S.document)||null==(t=t.documentElement)?void 0:t.scrollTop)||0:S.scrollX||S.pageXOffset||(null==(n=S.document)||null==(n=n.documentElement)?void 0:n.scrollLeft)||0:0}},{key:"scrollY",value:function(){return this.wa("y")}},{key:"scrollX",value:function(){return this.wa("x")}}]),e}(),oA=function(e){return sy(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)},oR=function(){function e(t,n,i,r){var s=this;(0,g._)(this,e),this.je=function(e){var t=s.ka();if(!t||t.sessionId!==e){var n={sessionId:e,props:s.Sa(s._instance)};s.xa.register((0,y._)({},ik,n))}},this._instance=t,this.Ca=n,this.xa=i,this.Sa=r||oA,this.Ca.onSessionId(this.je)}return(0,_._)(e,[{key:"ka",value:function(){return this.xa.props[ik]}},{key:"getSetOnceProps",value:function(){var e,t=null==(e=this.ka())?void 0:e.props;return t?"r"in t?sm(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}:{}}},{key:"getSessionProps",value:function(){var e={};return iz(iW(this.getSetOnceProps()),function(t,n){"$current_url"===n&&(n="url"),e["$session_entry_".concat(W(n))]=t}),e}}]),e}(),oT=function(){function e(){(0,g._)(this,e),this.$a={}}return(0,_._)(e,[{key:"on",value:function(e,t){var n=this;return this.$a[e]||(this.$a[e]=[]),this.$a[e].push(t),function(){n.$a[e]=n.$a[e].filter(function(e){return e!==t})}}},{key:"emit",value:function(e,t){var n=!0,i=!1,r=void 0;try{for(var s,o=(this.$a[e]||[])[Symbol.iterator]();!(n=(s=o.next()).done);n=!0)(0,s.value)(t)}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var a=!0,u=!1,l=void 0;try{for(var c,h=(this.$a["*"]||[])[Symbol.iterator]();!(a=(c=h.next()).done);a=!0)(0,c.value)(e,t)}catch(e){u=!0,l=e}finally{try{a||null==h.return||h.return()}finally{if(u)throw l}}}}]),e}(),oL=nR("[SessionId]"),oD=function(){function e(t,n,i){var r,s=this;if((0,g._)(this,e),this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new oT,this.Aa=function(e,t){return!(!ea(e)||!ea(t))&&Math.abs(e-t)>s.sessionTimeoutMs},!t.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=t.config,this.xa=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=n||i2,this.Da=i||i2;var o=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*ew(this.Mr.session_idle_timeout_seconds||1800,60,36e3,oL.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+o+"_window_id",this.qa="ph_"+o+"_primary_window_exists",this.ja()){var a=rf.Dt(this.Na),u=rf.Dt(this.qa);a&&!u?this.Be=a:rf.Lt(this.Na),rf.At(this.qa,!0)}(null==(r=this.Mr.bootstrap)?void 0:r.sessionID)&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}return(0,_._)(e,[{key:"on",value:function(e,t){return this.Ta.on(e,t)}},{key:"sessionTimeoutMs",get:function(){return this._sessionTimeoutMs}},{key:"onSessionId",value:function(e){var t=this;return et(this.Ea)&&(this.Ea=[]),this.Ea.push(e),this.Xt&&e(this.Xt,this.Be),function(){t.Ea=t.Ea.filter(function(t){return t!==e})}}},{key:"ja",value:function(){return"memory"!==this.Mr.persistence&&!this.xa.pi&&rf.Et()}},{key:"Ha",value:function(e){e!==this.Be&&(this.Be=e,this.ja()&&rf.At(this.Na,e))}},{key:"za",value:function(){return this.Be?this.Be:this.ja()?rf.Dt(this.Na):null}},{key:"Ua",value:function(e){var t=this.Ia;return!er(t)&&!er(e)&&5e3>Math.abs(e-t)}},{key:"Wa",value:function(e,t,n){var i=t!==this._sessionActivityTimestamp,r=e===this.Xt&&n===this._sessionStartTimestamp;this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Xt=e,r&&!i||r&&this.Ua(t)||(this.Ia=t,this.xa.register((0,y._)({},n5,[t,e,n])))}},{key:"Va",value:function(){var e,t=null==(e=this.Mr)?void 0:e.persistence_save_debounce_ms;return ea(t)&&t>0}},{key:"Ga",value:function(){this.Va()?this.xa.refreshKey(n5):(this.xa.flush(),this.xa.load())}},{key:"Za",value:function(){if(!er(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ia){this.Ga();var e,t=(0,k._)(this.Qa(),3),n=t[1],i=t[2];n===this.Xt&&i===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register((0,y._)({},n5,[this._sessionActivityTimestamp,null!=(e=this.Xt)?e:null,this._sessionStartTimestamp])),this.xa.flush())}}},{key:"Ja",value:function(){var e=(0,k._)(this.Qa(),1)[0];return Math.max(ea(e)?e:0,ea(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}},{key:"Ka",value:function(e){return this.Ga(),this.Aa(e,this.Ja())}},{key:"Qa",value:function(){var e=this.xa.props[n5];return Y(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Ya),this.Ya=void 0,this.Wa(null,null,null)}},{key:"setBootstrapSessionId",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).getTime();try{var n=function(e){var 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 n>t+6e4?void oL.error("Bootstrap sessionID cannot be in the future"):n}catch(e){return void oL.error("Invalid sessionID in bootstrap",e)}}(e);return!et(n)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:n}:this.Wa(e,(new Date).getTime(),n),!0)}},{key:"destroy",value:function(){this.Ra=!0,this.Za(),clearTimeout(this.Ya),this.Ya=void 0,this.Pa&&S&&(S.removeEventListener(iL,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}},{key:"Ba",value:function(){var e=this;this.Pa=function(){e.Za(),e.ja()&&rf.Lt(e.qa)},iX(S,iL,this.Pa,{capture:!1})}},{key:"checkAndGetSessionAndWindowId",value:function(){var e,t,n,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("always"===this.Mr.cookieless_mode)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var o=r||(new Date).getTime(),a=this.Xt;s?this.Ma=o:(er(this.Ma)||this.Ma>o||o-this.Ma>=1e3)&&(null==(e=(t=this.xa).syncCookieProperties)||e.call(t),this.Ma=o);var u=(0,k._)(this.Qa(),3),l=u[1],c=u[2],h=!et(a)&&l!==a,d=this.Ja(),f=this.za(),v=this.Fa,p=!!v&&(v.sessionStartTimestamp>o+6e4||o-v.sessionStartTimestamp>864e5),g=v?p:ea(c)&&Math.abs(o-c)>864e5,_=!1,y=h,m=!l||!!v,b=l,w=!m&&!i&&this.Aa(o,d);if(w&&((w=this.Ka(o))||oL.info("cross-tab refresh kept the session alive",{sessionId:l}),l=(n=(0,k._)(this.Qa(),3))[1],c=n[2]),m||w||g){y=!1;var x=v&&!p;l=x?v.sessionId:this.Oa(),f=this.Da(),oL.info("new session ID assigned",{sessionId:l,windowId:f,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:w,sessionPastMaximumLength:g}}),c=x?v.sessionStartTimestamp:o,this.Fa=void 0,_=!0}else f||(f=this.Da(),_=!0),(y=y||l!==b)&&(oL.info("adopted cross-tab session id",{sessionId:l,windowId:f}),_=!0);var E=ea(d)&&i&&!g?d:o,S=ea(c)?c:(new Date).getTime();this.Ha(f),this.Wa(l,E,S),i||this.La();var $={noSessionId:m,activityTimeout:w,sessionPastMaximumLength:g,crossTabAdoption:y};
2return _&&this.Ea.forEach(function(e){return e(l,f,$)}),{sessionId:l,windowId:f,sessionStartTimestamp:S,changeReason:_?$:void 0,lastActivityTimestamp:d}}},{key:"La",value:function(){var e=this;this.Ra||(clearTimeout(this.Ya),this.Ya=setTimeout(function(){if(!e.Ra)if(e.Ka((new Date).getTime())){var t=e.Xt;e.resetSessionId(),e.Ta.emit("forcedIdleReset",{idleSessionId:t})}else e.La()},1.1*this.sessionTimeoutMs))}}]),e}(),oN=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&ek(n,t))return!0;try{var i=null==e?void 0:e.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(function(e){return ek(null==e?void 0:e.brand,t)}))return!0}catch(e){}return!!e.webdriver};function oj(){return(oj=em(function(){var e,t,n,i;return(0,E._)(this,function(r){switch(r.label){case 0:if(!(null==(e=null==P?void 0:P.userAgentData)?void 0:e.getHighEntropyValues))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.getHighEntropyValues(["model"])];case 2:return[2,en(n=null==(t=r.sent())?void 0:t.model)&&n.length>0?n:void 0];case 3:return i=r.sent(),[2,void nA.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)];case 4:return[2]}})})).apply(this,arguments)}function oB(e){var t;return!!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)?void 0:t.length)}var oH=function(e,t){if(!function(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}},oz=function(e){return e.toLowerCase()},oq={exact:function(e,t){return t.some(function(t){return e.some(function(e){return t===e})})},is_not:function(e,t){return t.every(function(t){return e.every(function(e){return t!==e})})},regex:function(e,t){return t.some(function(t){return e.some(function(e){return oH(t,e)})})},not_regex:function(e,t){return t.every(function(t){return e.every(function(e){return!oH(t,e)})})},icontains:function(e,t){return t.map(oz).some(function(t){return e.map(oz).some(function(e){return t.includes(e)})})},not_icontains:function(e,t){return t.map(oz).every(function(t){return e.map(oz).every(function(e){return!t.includes(e)})})},gt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n>parseFloat(e)})})},lt:function(e,t){return t.some(function(t){var n=parseFloat(t);return!isNaN(n)&&e.some(function(e){return n<parseFloat(e)})})}};function oV(e,t){return!e||Object.entries(e).every(function(e){var n=(0,k._)(e,2),i=n[0],r=n[1],s=null==t?void 0:t[i];if(null==s)return!1;var o=oq[r.operator];return!!o&&o(r.values,[String(s)])})}function oU(e,t,n){return st({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var oW="custom",oG="i.posthog.com",oK=/^\/static\//,oX=["/s/","/e/","/i/"],oJ=function(){function e(t){(0,g._)(this,e),this.Xa={},this.instance=t}return(0,_._)(e,[{key:"apiHost",get:function(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}},{key:"flagsApiHost",get:function(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}},{key:"uiHost",get:function(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(oG),".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}},{key:"region",get:function(){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":oW),this.Xa[this.apiHost]}},{key:"tu",value:function(e){if(oK.test(e)){var t=this.instance.config.asset_host;return"string"==typeof t&&t.trim().replace(/\/$/,"")||void 0}}},{key:"eu",value:function(e){var t=sn(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}},{key:"iu",value:function(e,t,n){if("ui"===e)return n;var i,r=n,s=this.instance.config.rewriteRequestPath;if(s&&(r=s(new URL((null==(i=sn(n))?void 0:i.href)||n)).toString()),s&&"api"===e&&oX.some(function(e){return 0===t.indexOf(e)})){var o=this.eu(r);if(o){var a=this.apiHost,u=this.nu;(null==u?void 0:u.apiHost)===a&&u.rewriteRequestPath===s||(u={apiHost:a,rewriteRequestPath:s,urls:new Set},this.nu=u),u.urls.add(o)}}return r}},{key:"isIngestionEndpoint",value:function(e){var t=this.nu,n=this.eu(e);return(null==t?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!n&&t.urls.has(n)}},{key:"endpointFor",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t&&(t="/"===t[0]?t:"/".concat(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){var n=this.tu(t);if(n)return this.iu(e,t,"".concat(n).concat(t))}if(this.region===oW)return this.iu(e,t,this.apiHost+t);var i=oG+t;switch(e){case"assets":return this.iu(e,t,"https://".concat(this.region,"-assets.").concat(i));case"api":return this.iu(e,t,"https://".concat(this.region,".").concat(i))}}}]),e}(),oY=nR("[Surveys]"),oZ=function(e){try{var t="seenSurvey_".concat(e.current_iteration&&e.current_iteration>0?"".concat(e.id,"_").concat(e.current_iteration):e.id);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){oY.error("Failed to persist survey seen state",e)}}
2,oQ=["popover","widget","api"],o0={ignoreConditions:!1,ignoreDelay:!1,displayType:sj},o1=nR("[PostHog ExternalIntegrations]"),o2={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},o3=function(){function e(t){(0,g._)(this,e),this._instance=t}return(0,_._)(e,[{key:"No",value:function(e,t){var n,i;null==(n=D.__PosthogExtensions__)||null==(i=n.loadExternalDependency)||i.call(n,this._instance,e,function(e){if(e)return o1.error("failed to load script",e);t()})}},{key:"startIfEnabledOrStop",value:function(){var e=this,t=!0,n=!1,i=void 0;try{for(var r,s,o,a=Object.entries(null!=(r=this._instance.config.integrations)?r:{})[Symbol.iterator]();!(t=(o=a.next()).done);t=!0)s=this,function(){var t,n,i,r=(0,k._)(o.value,2),a=r[0],u=r[1];!u||(null==(t=D.__PosthogExtensions__)||null==(t=t.integrations)?void 0:t[a])||s.No(o2[a],function(){var t;null==(t=D.__PosthogExtensions__)||null==(t=t.integrations)||null==(t=t[a])||t.start(e._instance)}),!u&&(null==(n=D.__PosthogExtensions__)||null==(n=n.integrations)?void 0:n[a])&&(null==(i=D.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[a])||i.stop())}()}catch(e){n=!0,i=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw i}}}}]),e}(),o5=function(){function e(t,n){(0,g._)(this,e),this.$=t,this.po=n,this.su=new Map,this.So=!1}return(0,_._)(e,[{key:"add",value:function(e){var t=this;return em(function(){var n,i,r;return(0,E._)(this,function(s){switch(s.label){case 0:if(t.So)throw Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.su.has(e.name))throw Error('Browser extension "'.concat(e.name,'" is already registered'));t.su.set(e.name,e),s.label=1;case 1:if(s.trys.push([1,4,,5]),!(n=e.setup(t.po)))return[3,3];return[4,n];case 2:s.sent(),s.label=3;case 3:return[3,5];case 4:return i=s.sent(),(r=t.su.get(e.name)===e)&&t.su.delete(e.name),t.$.error('Failed to set up browser extension "'.concat(e.name,'"'),i),r&&t.ru(e),[3,5];case 5:return[2]}})})()}},{key:"getExtension",value:function(e){return this.su.get(e)}},{key:"dispose",value:function(){if(!this.So){this.So=!0;var e=Array.from(this.su.values()).reverse();this.su.clear();var t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;this.ru(o)}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}}},{key:"ru",value:function(e){var t=this;try{var n,i=null==(n=e.dispose)?void 0:n.call(e);i&&Z(i.then)&&i.then(void 0,function(n){t.$.error('Failed to dispose browser extension "'.concat(e.name,'"'),n)})}catch(t){this.$.error('Failed to dispose browser extension "'.concat(e.name,'"'),t)}}}]),e}(),o4=function(){function e(t){(0,g._)(this,e),this._instance=t}return(0,_._)(e,[{key:"initialize",value:function(){}},{key:"get",value:function(e){var t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);var n={},i=!0,r=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value,l=null==t?void 0:t.get_property(u);et(l)||(n[u]=l)}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}},{key:"set",value:function(e,t){var n;null==(n=this._instance.persistence)||n.register("string"==typeof e?(0,y._)({},e,t):e)}},{key:"remove",value:function(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}]),e}(),o6="extensionsRemoteConfig",o8=function(){function e(t){var n=this;(0,g._)(this,e),this.instance=t,this.So=!1,this.$=nA,this.ou=t.lu,this.kv=new o4(t),this.onEvent=function(e){return sB(n.instance.on("eventCaptured",function(t){try{e({event:t.event,properties:t.properties})}catch(e){n.$.error("Browser extension event listener failed",e)}}))},this.onRemoteConfig=function(e){if(n.So)return sB(function(){});var t=function(t){try{e(t)}catch(e){n.$.error("Browser extension remote config listener failed",e)}},i=n.instance.au.on(o6,t);return n.ou&&t(n.ou),sB(i)},this.uu=new o5(nA.createLogger("[BrowserExtensions]"),this)}return(0,_._)(e,[{key:"logger",get:function(){return this.$}},{key:"distinctId",get:function(){return this.instance.get_distinct_id()}},{key:"anonymousId",get:function(){var e;return null!=(e=this.instance.get_property("$device_id"))?e:this.distinctId}},{key:"deviceId",get:function(){var e=this.instance.get_property(nH);return"string"==typeof e?e:void 0}},{key:"library",get:function(){return{name:j.LIB_NAME,version:j.LIB_VERSION}}},{key:"initialPersonProperties",get:function(){var e,t;return null!=(e=null==(t=this.instance.persistence)?void 0:t.get_initial_props())?e:{}}},{key:"groups",get:function(){return this.instance.getGroups()}},{key:"session",get:function(){try{var e,t,n,i,r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!=(t=null==r?void 0:r.sessionId)?t:"",windowId:null!=(n=null==r?void 0:r.windowId)?n:"",sessionStartTimestamp:null!=(i=null==r?void 0:r.sessionStartTimestamp)?i:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}},{key:"canCapture",get:function(){return this.instance.is_capturing()}},{key:"projectToken",get:function(){return this.instance.config.token}},{key:"add",value:function(e){return this.uu.add(e)}},{key:"getExtension",value:function(e){return this.uu.getExtension(e)}},{key:"capture",value:function(e,t,n){var i=this;return em(function(){return(0,E._)(this,function(r){return n?i.instance.capture(e,t,{timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce}):i.instance.capture(e,t),[2]})})()}},{key:"registerDynamicEventProperties",value:function(e){return sB(this.instance.hu(e))}},{key:"handleRemoteConfig",value:function(e){this.So||(this.ou=e,this.instance.au.emit(o6,e))}},{key:"sendRequest",value:function(e){var t=this;return em(function(e){var n,i,r,s,o=arguments;return(0,E._)(this,function(a){return n=o.length>1&&void 0!==o[1]?o[1]:{},r=t.instance.requestRouter.endpointFor(null!=(i=n.target)?i:"api",e),s={method:n.method,url:n.query?o_(r,n.query
2):r,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:"flags"===n.target&&"best-available"===n.compression?H.Base64:void 0,timestampMode:n.sentAt},[2,"sendBeacon"===n.transport?(t.instance._send_request(s),{statusCode:202}):new Promise(function(e){s.callback=e,t.instance._send_request(s)})]})}).apply(this,arguments)}},{key:"dispose",value:function(){this.So||(this.So=!0,this.uu.dispose())}}]),e}(),o9={},o7=0,ae=function(){},at='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',an="Surveys module not available",ai="sanitize_properties is deprecated. Use before_send instead",ar="Invalid value for property_denylist config: ",as=/^[A-Za-z0-9_-]{1,400}$/,ao=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,aa=["token","distinct_id",iP],au="posthog",al=!of&&-1===(null==R?void 0:R.indexOf("MSIE"))&&-1===(null==R?void 0:R.indexOf("Mozilla")),ac=function(e){var 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},ah=function(e){var t;return tO({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){var t=null==e?void 0:e.hostname;if(!en(t))return!1;var n=t.split(".").slice(-2).join("."),i=!0,r=!1,s=void 0;try{for(var o,a=iK[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=o.value;if(n===u)return!1}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return!0}(null==M?void 0:M.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ae,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:F&&en(null==F?void 0:F.search)&&-1!==F.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==S||null==(t=S.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:function(e){nA.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:function(e){return e},capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:iR,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ae},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:rA,ignore_text_selection:!0}
2:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:ac(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)})},ad=[["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"]],af=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=ad[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=(0,k._)(s.value,2),u=a[0],l=a[1];et(e[u])||(t[l]=e[u])}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}var c=iq({},t,e),h=e.__preview_external_dependency_versioned_paths;return et(h)||(et(e.strict_script_versioning)&&(c.strict_script_versioning=!!h),en(h)&&et(e.asset_host)&&(c.asset_host=h)),Y(e.property_blacklist)&&(et(e.property_denylist)?c.property_denylist=e.property_blacklist:Y(e.property_denylist)?c.property_denylist=(0,w._)(e.property_blacklist).concat((0,w._)(e.property_denylist)):nA.error(ar+e.property_denylist)),c},av=function(){function e(){(0,g._)(this,e),this.__forceAllowLocalhost=!1}return(0,_._)(e,[{key:"cu",get:function(){return this.__forceAllowLocalhost},set:function(e){nA.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),e}(),ap=function(){function e(){var t,n=this;(0,g._)(this,e),this.wu=!1,this.ku=!1,this.webPerformance=new av,this.Su=!1,this.version=j.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=ah(),this.SentryIntegration=r4,this.sentryIntegration=function(e){var t;return t=r5(n,e),{name:r3,processEvent:function(e){return t(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 oI(this),this.pageViewManager=new r6(this),this.rateLimiter=new sz(this),this.requestRouter=new oJ(this),this.consent=new rv(this),this.externalIntegrations=new o3(this);var i=null!=(t=e.__defaultExtensionClasses)?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:function(e,t,i){var r=en(e)?(0,y._)({},e,t):e;n.setPersonProperties(r),null==i||i({})},set_once:function(e,t,i){var r=en(e)?(0,y._)({},e,t):e;n.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",function(e){return nA.info('send "'.concat(null==e?void 0:e.event,'"'),e)})}return(0,_._)(e,[{key:"du",value:function(e){if(e){var t=this.su.indexOf(e);-1!==t&&this.su.splice(t,1)}}},{key:"vu",value:function(e,t){var n;return this.du(e),this.su.push(t),null==(n=t.initialize)||n.call(t),t}},{key:"fu",value:function(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}},{key:"pu",value:function(){if(!(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())){var e,t,n,i="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(i||this.config.disable_persistence)&&(this.mu||(i?(e="persistence is set to '".concat(this.config.persistence,"'"),t="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="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",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0,
2console.warn("[PostHog.js]","".concat(e," but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ").concat(t,", so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ").concat(n))))}}},{key:"yu",value:function(){if(!this.fu()&&"$posthog_cookieless"===this.get_distinct_id()){var e=this.persistence;if(e){this.bu()||e.load(!0);var t=this.get_distinct_id();if(!t||"$posthog_cookieless"===t){var n=this.config.get_device_id(i2());this.register({distinct_id:n,$device_id:n}),e.set_property(ib,iI)}this._u()}}}},{key:"decideEndpointWasHit",get:function(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}},{key:"flagsEndpointWasHit",get:function(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}},{key:"init",value:function(t,n,i){if(i&&i!==au){var r,s=null!=(r=o9[i])?r:new e;return s._init(t,n,i),o9[i]=s,o9[au][i]=s,s}return this._init(t,n,i)}},{key:"_init",value:function(e){var t,n,i,r,s=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0,u=en(e)?e.trim():"";if(!u)return nA.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return u!==(null==(r=this.config)?void 0:r.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('".concat(u,"', { ... }, 'project2')")):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=ah(o.defaults),o.debug=this.Pu(o.debug),this.Ru=o,this.Au=[],o.person_profiles?this.Mu=o.person_profiles:o.process_person&&(this.Mu=o.process_person);var l=ah(o.defaults),c=af(o),h=iq({},l,c,{name:a,token:u});Q(l.rageclick)&&Q(c.rageclick)&&(h.rageclick=iq({},l.rageclick,c.rageclick)),Q(l.session_recording)&&Q(c.session_recording)&&(h.session_recording=iq({},l.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&nA.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=o.disable_compression?void 0:sI;var d=this.bu();if(this.persistence=new sO(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new sO(tO(tO({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&rf.Et()){var f=rf.Dt(this.Cu);Y(f)&&f.forEach(function(e){en(e)&&s.xu.add(e)})}else rf.Lt(this.Cu);var v=tO({},this.persistence.props),p=tO({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Fu=new oF(function(e){return s.Ou(e)},this.config.request_queue_config),this.Du=new oO(this),this.__request_queue=[];var g=this.fu();g||(this.sessionManager=new oD(this),this.sessionPropsManager=new oR(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(function(e,t,n){((null==n?void 0:n.activityTimeout)||(null==n?void 0:n.sessionPastMaximumLength)||(null==n?void 0:n.crossTabAdoption))&&s.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(nA.info("Deferring extension initialization to improve startup performance"),setTimeout(function(){s.qu(g)},0)):(nA.info("Initializing extensions synchronously"),this.qu(g)),j.DEBUG=j.DEBUG||this.config.debug,j.DEBUG&&nA.info("Starting in debug mode",{this:this,config:o,thisC:tO({},this.config),p:v,s:p}),!this.config.identity_distinct_id||(null==(t=o.bootstrap)?void 0:t.distinctID)||(o.bootstrap=tO(tO({},o.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var _=null==(n=o.bootstrap)?void 0:n.distinctID;if(this.mu=!!_&&!ei(_),null==(i=o.bootstrap)?void 0:i.distinctID){var m=o.bootstrap.distinctID,b=this.get_distinct_id(),k=this.persistence.get_property(ib);if(o.bootstrap.isIdentifiedID&&null!=b&&b!==m&&"anonymous"===k)this.identify(m);else if(o.bootstrap.isIdentifiedID&&null!=b&&b!==m&&"identified"===k)nA.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");
2else{var w=this.config.get_device_id(i2()),x=o.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(ib,o.bootstrap.isIdentifiedID?iA:iI),this.register({distinct_id:m,$device_id:x})}}if(g)this.register_once({distinct_id:i$,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(i2());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(ib,iI)}return iX(S,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),iX(S,"pageshow",function(){var e;s.wu=!1,s.ku||null==(e=s.Du)||e.resume()}),o.segment?r2(this,function(){return s.ju()}):this.ju(),Z(this.config._onCapture)&&this.config._onCapture!==ae&&(nA.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",function(e){return s.config._onCapture(e.event,e)})),this.config.ip&&nA.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 oj.apply(this,arguments)})().then(function(e){e&&s.register((0,y._)({},nz,e))}).catch(ae),this}},{key:"Bu",value:function(e){return en(e.name)&&Z(e.setup)}},{key:"Hu",value:function(e,t){var n=this;this.Bu(e)?t.push(function(){n.zu().add(e).catch(function(){var t;return null==(t=e.dispose)?void 0:t.call(e)}).catch(function(t){nA.error('Failed to dispose browser extension "'.concat(e.name,'"'),t)})}):this.su.push(e)}},{key:"Nu",value:function(){var t,n,i,r,s,o,a=this,u=null!=(t=null==(n=this.config.__extensionClasses)?void 0:n.featureFlags)?t:null==(i=e.__defaultExtensionClasses)?void 0:i.featureFlags;u&&(this.featureFlags&&(0,b._)(this.featureFlags,u)||(null==(r=this.Uu)||r.call(this),this.Uu=void 0,this.featureFlags=new u(this)),Z(this.featureFlags.onReloading)&&Z(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(function(){a.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):null==(s=(o=this.featureFlags).initialize)||s.call(o))}},{key:"qu",value:function(t){var n,i,r,s,o,a,u,l=this,c=performance.now(),h=tO(tO({},e.__defaultExtensionClasses),this.config.__extensionClasses),d=[];h.exceptions&&this.su.push(this.exceptions=null!=(n=this.exceptions)?n:new h.exceptions(this)),h.historyAutocapture&&this.su.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.su.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.su.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.su.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push(function(){l.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.Hu(this.autocapture=new h.autocapture(this),d),h.surveys&&this.Hu(this.surveys=null!=(i=this.surveys)?i:new h.surveys(this),d),h.logs&&this.Hu(this.logs=null!=(r=this.logs)?r:new h.logs(this),d),h.metrics&&this.su.push(this.metrics=null!=(s=this.metrics)?s:new h.metrics(this)),h.conversations&&this.su.push(this.conversations=null!=(o=this.conversations)?o:new h.conversations(this)),h.productTours&&this.su.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.su.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.su.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,rQ)),h.toolbar&&this.su.push(this.toolbar=null!=(a=this.toolbar)?a:new h.toolbar(this)),h.experiments&&this.su.push(this.experiments=null!=(u=this.experiments)?u:new h.experiments(this)),this.su.forEach(function(e){e.initialize&&d.push(function(){var t;null==(t=e.initialize)||t.call(e)})}),d.push(function(){if(l.Wu){var e=l.Wu;l.Wu=void 0,l.su.forEach(function(t){var n;return null==(n=t.onRemoteConfig)?void 0:n.call(t,e)})}}),this.Vu(d,c)}},{key:"Vu",value:function(e,t){for(var n,i=this;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(function(){i.Vu(e,t)},0);var r=e.shift();if(r)try{r()}catch(e){nA.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session((n={},(0,y._)(n,iM,this.config.__preview_deferred_init_extensions?"deferred":"synchronous"),(0,y._)(n,iF,s),n)),this.config.__preview_deferred_init_extensions&&nA.info("PostHog extensions initialized (".concat(s,"ms)"))}},{key:"Kl",value:function(e){var t=this;if(!M||!M.body)return nA.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){t.Kl(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=e),this.lu=e,this.compression=void 0,e.ok){var n,i,r=e.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=V(r.supp
2ortedCompression,sI)?sI:V(r.supportedCompression,sA)?sA:void 0),(null==(i=r.analytics)?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:iR}),null==(n=this.Gu)||n.handleRemoteConfig(e),this.su.forEach(function(t){var n;return null==(n=t.onRemoteConfig)?void 0:n.call(t,e)})}},{key:"ju",value:function(){var e=this;try{this.config.loaded(this)}catch(e){nA.critical("`loaded` function failed",e)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(null==F?void 0:F.hostname)){var t=F.hostname,n=this.config.internal_or_test_user_hostname;("string"==typeof n?t===n:n.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(function(){(e.consent.isOptedIn()||e.fu())&&e.Qu()},1),this.Ju=new sV(this),this.Ju.load()}},{key:"Zu",value:function(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Fu)||e.enable())}},{key:"_dom_loaded",value:function(){var e=this;this.is_capturing()&&iH(this.__request_queue,function(t){return e.Ou(t)}),this.__request_queue=[],this.Zu()}},{key:"_handle_unload",value:function(){var e,t,n,i,r,s;this.wu=!0,null==(e=this.surveys)||null==(t=e.handlePageUnload)||t.call(e),null==(n=this.metrics)||n.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(iN),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.Fu)||r.unload(),null==(s=this.Du)||s.unload()):this.Ku()&&this.capture(iN,null,{transport:"sendBeacon"})}},{key:"_send_request",value:function(e){var t,n,i,r=this;this.__loaded?al?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==(n=e.callback)||n.call(e,{statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=tO(tO({},this.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!=(t=this.compression)?t:e.compressionFallback:e.compression,(et(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,function(e){var t,n,i,r,s,o,a,u,l=tO({},e);l.timeout=l.timeout||6e4;var c=null!=(o=l.transport)?o:"fetch";"sendBeacon"===c&&et(l.compression)&&l.data&&(l.compression=sA),"POST"===l.method&&l.data&&("capture-body"===l.timestampMode?l.data={api_key:null!=(n=null==(s=(r=(Y(t=l.data)?t:[t]).map(function(e){return tO(tO({},e),(0,b._)(e.timestamp,Date)&&!isNaN(e.timestamp.getTime())?{timestamp:e.timestamp.toISOString()}:{})}))[0])||null==(i=s.properties)?void 0:i.token)?n:null==s?void 0:s.token,batch:r,sent_at:(new Date).toISOString()}:"body"===l.timestampMode&&(l.data=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(new Date).toISOString();return Y(e)?e.map(function(e){return tO(tO({},e),{},{sent_at:t})}):tO(tO({},e),{},{sent_at:t})}(l.data))),l.url=oP(l.url,l.method,l.compression,l.timestampMode);var h=oM.filter(function(e){return!l.disableTransport||!e.transport||!l.disableTransport.includes(e.transport)}),d=null!=(a=null==(u=function(e,t){for(var n=0;e.length>n;n++)if(t(e[n]))return e[n]}(h,function(e){return e.transport===c}))?void 0:u.method)?a:h[0].method;if(!d)throw Error("No available transport method");var f=function(e){try{d(e)}catch(e){var t;ox(e)?nA.warn(e):nA.error(e),null==(t=l.callback)||t.call(l,{statusCode:0,error:e})}};"sendBeacon"!==c&&l.data&&l.compression===sI&&A&&"u">typeof Promise&&!op?ok(l).then(function(e){f(e)}).catch(function(t){nu(t)?(op=!0,f(tO(tO({},l),{},{compression:void 0,url:oP(e.url,e.method,void 0,e.timestampMode)}))):(function(e){if(!e||"object"!=(void 0===e?"undefined":(0,x._)(e)))return!1;var t="name"in e?String(e.name):"";return nu(e)||t===ns}(t)&&(op=!0),f(l))}):d(l)}(tO(tO({},e),{},{callback:function(t){var n,i,s;r.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=r.config).on_request_error)||i.call(s,t),null==(n=e.callback)||n.call(e,t)}}))):e.fireCallbackOnDrop&&(null==(i=e.callback)||i.call(e,{statusCode:0}))}},{key:"Ou",value:function(e){this.Du?this.Du.retriableRequest(e):this._send_request(e)}},{key:"_execute_array",value:function(e){var t=this;o7++;try{var n,i=[],r=[],s=[];iH(e,function(e){if(e)if(n=e[0],Y(n))s.push(e);else if(Z(e))try{e.call(t)}catch(t){nA.error("Error executing queued PostHog call",e,t)}else Y(e)&&"alias"===n?i.push(e):Y(e)&&-1!==n.indexOf("capture")&&Z(t[n])?s.push(e):r.push(e)});var o=function(e,t){iH(e,function(e){try{if(Y(e[0])){var n=t;iz(e,function(e){n=n[e[0]].apply(n,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){nA.error("Error executing queued PostHog call",e,t)}})};o(i,this),o(r,this),o(s,this)}finally{o7--}}},{key:"push",value:function(t){if(o7>0&&Y(t)&&en(t[0])){var n=e.prototype[t[0]];return void(Z(n)&&n.apply(this,t.slice(1)))}this._execute_array([t])}},{key:"Yu",value:function(){var e,t=null==(e=this.persistence)?void 0:e.get_property(nU);return en(t)&&ao.test(t)?{value:t,delivered:!1}:Q(t)&&en(t.value)&&ao.test(t.value)?{value:t.value,delivered:!0===t.delivered}:void 0}},{key:"Xu",value:function(e,t,n,i){if(this.persistence){this.persistence.refreshKey(nU);var r=this.Yu();if(!i){if(n)return en(t)&&ao.test(t)?(t!==(null==r?void 0:r.value)&&this.persistence.register((0,y._)({},nU,{value:t,delivered:!1})),{value:t,pending:t!==(null==r?void 0:r.value)||!r.delivered}):void this.persistence.unregister(nU);if(en(e)&&as.test(e)){if((null==r?void 0:r.value.split(".")[3])===e)return{value:r.value,pending:!r.delivered};var s="fb.1.".concat(Date.now(),".").concat(e);return this.persistence.register((0,y._)({},nU,{value:s,delivered:!1})),{value:s,pending:!0}}return r?{value:r.value,pending:!r.delivered}:void 0}this.persistence.unregister(nU)}}},{key:"th",value:function(e){if(this.persistence){this.persistence.refreshKey(nU);var t=this.Yu();(null==t?void 0:t.value)!==e||t.delivered||this.persistence.register((0,y._)({},nU,{value:e,delivered:!0}))}}},{key:"capture",value:function(e,t,n){var i,r,s,o,a,u,l,c,h,d=this;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void nA.uninitializedWarning("posthog.capture");
2if(this.is_capturing()){if(et(e)||!en(e))return void nA.error("No event name provided to posthog.capture");this.yu();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var v=(null==n?void 0:n.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==v?void 0:v.isRateLimited)return void nA.critical("This capture call is ignored due to client rate limiting.");(null==t?void 0:t.$current_url)&&!en(null==t?void 0:t.$current_url)&&(nA.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==n?void 0:n.eh)||nA.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&&(l=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var p=new Date,g=(null==n?void 0:n.timestamp)||p,_=tw(null==n?void 0:n.uuid,i2),m={uuid:_,event:e,properties:this.calculateEventProperties(e,t||{},g,_)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&f&&(m.event="$bot_pageview",m.properties.$browser_type="bot"),v&&(m.properties.$lib_rate_limit_remaining_tokens=v.remainingTokens);var b="$feature_flag_called"===e&&!1===m.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==n?void 0:n.$set)&&!b&&(m.$set=null==n?void 0:n.$set);var k=Q(null==t?void 0:t.$set)?t.$set:void 0,w=!!(null==n?void 0:n.$set)&&"$fbc"in n.$set,x=w||!!k&&"$fbc"in k,E=w?null==n||null==(i=n.$set)?void 0:i[nV]:null==k?void 0:k[nV],S=Y(null==t?void 0:t.$unset)?t.$unset:[],$=(null==n?void 0:n.$unset)||[],P=-1!==S.indexOf("$fbc")||-1!==$.indexOf("$fbc"),M=this.Xu(null==l?void 0:l.fbclid,E,x,P);M&&!0===m.properties.$process_person_profile&&M.pending&&!x&&!b&&(m.$set=tO((0,y._)({},nV,M.value),m.$set));var F=null==n?void 0:n.$unset;F&&(m.$unset=F);var C=b?void 0:this.ih(null==n?void 0:n.$set_once,e!==iB,e===ij);if(C&&(m.$set_once=C),(null==n?void 0:n._noTruncate)||(c=this.config.properties_string_max_length,O=m,I=function(e){return en(e)?e.slice(0,c):e},A=new Set,m=function e(t,n){if(t!==Object(t))return I(t);if(!A.has(t)){if(A.add(t),Y(t))i=[],iH(t,function(t){i.push(e(t))});else{var i,r={};iz(ed(t)?iG(t):t,function(t,n){A.has(t)||(r[n]=e(t,n))}),i=r}return i}}(O)),m.timestamp=g,et(null==n?void 0:n.timestamp)||(m.properties.$event_time_override_provided=!0,m.properties.$event_time_override_system_time=p),b&&(m.properties=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n={},i=function(t){void 0!==e[t]&&(n[t]=e[t])};return nr.forEach(i),t.forEach(i),n}(m.properties,aa)),e===sD||e===sN){var O,I,A,R,T,L,D=null==t?void 0:t.$survey_id,N=null==t?void 0:t.$survey_iteration;oZ({id:D,current_iteration:N}),m.$set=tO(tO({},m.$set),{},(0,y._)({},(R={id:D,current_iteration:N},T=e===sN?"responded":"dismissed",L="$survey_".concat(T,"/").concat(R.id),R.current_iteration&&R.current_iteration>0&&(L="$survey_".concat(T,"/").concat(R.id,"/").concat(R.current_iteration)),L),!0))}else e===sL&&(m.$set=tO(tO({},m.$set),{},(0,y._)({},"$survey_last_seen_date",(new Date).toISOString())));if("product tour shown"===e){var j=null==t?void 0:t.$product_tour_type;j&&(m.$set=tO(tO({},m.$set),{},(0,y._)({},"".concat("$product_tour_last_seen_date","/").concat(j),(new Date).toISOString())))}var B=tO(tO({},m.properties.$set),m.$set);if(ee(B)||this.setPersonPropertiesForFlags(B),!es(this.config.before_send)){var H=this.Os(m);if(!H)return;(m=H).uuid=tw(m.uuid,i2)}var z=null!=(r=null==(s=m.$set)?void 0:s.$fbc)?r:Q(null==(o=m.properties)?void 0:o.$set)?m.properties.$set[nV]:void 0,q=(null==M?void 0:M.pending)&&z===M.value?M.value:void 0;this.au.emit("eventCaptured",m);var V=null!=(a=null==n?void 0:n._url)?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),U="recordings"===(null==n?void 0:n._batchKey)||/\/s\/(?:\?|$)/.test(V),W=tO(tO(tO({method:"POST",url:V,data:m,compression:"best-available",timestampMode:U?"body":"capture-body",batchKey:null==n?void 0:n._batchKey},U&&(null==(u=m.properties)?void 0:u.$session_id)?{batchGroup:m.properties.$session_id}:{}),(null==n?void 0:n.transport)?{transport:n.transport}:{}),q?{fireCallbackOnDrop:!0,callback:function(e){e.statusCode>=200&&300>e.statusCode&&d.th(q)}}:{});return!this.config.request_batching||n&&!(null==n?void 0:n._batchKey)||(null==n?void 0:n.send_instantly)||q?(!W.transport&&!W.callback&&ee(null!=(h=this.config.request_headers)?h:{})&&this.wu&&(W.transport="sendBeacon"),this.Ou(W)):this.Fu.enqueue(W),m}}}},{key:"_addCaptureHook",value:function(e){return this.on("eventCaptured",function(t){return e(t.event,t)})}},{key:"getExtension",value:function(e){var t;return null==(t=this.Gu)?void 0:t.getExtension(e)}},{key:"zu",value:function(){var e;return null!=(e=this.Gu)?e:this.Gu=new o8(this)}},{key:"hu",value:function(e){var t=this;this.$u.push(e);var n=!0;return function(){if(n){n=!1;var i=t.$u.indexOf(e);-1!==i&&t.$u.splice(i,1)}}}},{key:"nh",value:function(){var e,t,n,i=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return!!(null==(e=this.persistence)?void 0:e.consumeCookieIdentityChange())&&(this.Eu=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(n=this.sessionPersistence)||n.clear(),this.xu.clear(),this.sh()),null==(t=this.featureFlags)||t.reset(),i&&this.reloadFeatureFlags(),!0)}},{key:"calculateEventProperties",value:function(e,t,n,i,r){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;this.persistence.syncCookieProperties(),this.nh();var s=r?void 0:this.persistence.remove_event_timer(e),o=tO({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.fu()&&(o[iP]=!0),"$
2snapshot"===e){var a=tO(tO({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!en(o.distinct_id)&&!eo(o.distinct_id)||ei(o.distinct_id))&&nA.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u=function(e,t,n){var i,r,s,o,a,u,l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!R)return{};var c=e?(0,w._)(su).concat((0,w._)(t||[])):[],h=(0,k._)(td(R),2),d=h[0],f=h[1],v=(0,k._)(function(e){for(var t=0;tg.length>t;t++){var n=(0,k._)(tg[t],3),i=n[0],r=n[1],s=n[2],o=e.match(i);if(o){var a=s&&e.match(s)||o;return[r,(null==a?void 0:a[1])||""]}}return["",""]}(R),2),p=v[0],g=v[1],_=(null==(i="u">("u"<typeof navigator?"undefined":(0,x._)(navigator))?navigator:void 0)?void 0:i.brave)?{brave:!0}:{},y={};et(n)||(y.detectGoogleSearchApp=n);var m={},b=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(o=navigator)?void 0:o.maxTouchPoints,$=null==S||null==(a=S.screen)?void 0:a.width,P=null==S||null==(u=S.screen)?void 0:u.height,M=null==S?void 0:S.devicePixelRatio;et(b)||(m.userAgentDataPlatform=b),et(E)||(m.maxTouchPoints=E),et($)||(m.screenWidth=$),et(P)||(m.screenHeight=P),et(M)||(m.devicePixelRatio=M);var C=iq(iW({$os:d,$os_version:f,$browser:tu(R,navigator.vendor,_,y),$webview_app:p,$webview_app_version:g,$device:tf(R),$device_type:tv(R,m),$timezone:sb(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:sr(l?tE(null==F?void 0:F.href):null==F?void 0:F.href,c,sc),$host:null==F?void 0:F.host,$pathname:null==F?void 0:F.pathname,$raw_user_agent:R.length>1e3?R.substring(0,997)+"...":R,$browser_version:tc(R,navigator.vendor,_,y),$browser_language:sp(),$browser_language_prefix:"string"==typeof(r=sp())?r.split("-")[0]:void 0,$screen_height:null==S?void 0:S.screen.height,$screen_width:null==S?void 0:S.screen.width,$viewport_height:null==S?void 0:S.innerHeight,$viewport_width:null==S?void 0:S.innerWidth,$lib:j.LIB_NAME,$lib_version:j.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return j.SDK_DIST_CHANNEL&&(C.$sdk_dist_channel=j.SDK_DIST_CHANNEL),C}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var l=this.sessionManager.checkAndGetSessionAndWindowId(r,n.getTime(),!0),c=l.sessionId,h=l.windowId;o.$session_id=c,o.$window_id=h}this.sessionPropsManager&&iq(o,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&iq(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=null==(E=this.Du)?void 0:E.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===oW&&(o.$lib_custom_api_host=this.config.api_host),$="$pageview"!==e||r?"$pageleave"!==e||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),o=iq(o,$),"$pageview"===e&&M&&(o.title=M.title),!et(s)){var d=n.getTime()-s;o.$duration=parseFloat((d/1e3).toFixed(3))}R&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser");var f=this.persistence.properties(),v=this.sessionPersistence.properties(),p=o.$groups,g=f.$groups;Q(p)&&!ee(p)&&(o.$groups=tO(tO({},Q(g)?g:{}),p)),iz(["$referrer","$referring_domain"],function(e){e in f&&delete v[e]});var _={},y=!0,m=!1,b=void 0;if(this.$u.length>0)try{for(var E,$,P,C=this.$u.slice()[Symbol.iterator]();!(y=(P=C.next()).done);y=!0){var O=P.value;try{iq(_,O())}catch(e){nA.error("Failed to produce browser extension event properties",e)}}}catch(e){m=!0,b=e}finally{try{y||null==C.return||C.return()}finally{if(m)throw b}}(o=iq({},u,f,v,tO(tO({},_),o))).$is_identified=this._isIdentified(),Y(this.config.property_denylist)?iz(this.config.property_denylist,function(e){delete o[e]}):nA.error(ar+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var I=this.config.sanitize_properties;I&&(nA.error(ai),o=I(o,e));var A=this.rh();return o.$process_person_profile=A,A&&!r&&this.oh("_calculate_event_properties"),o}},{key:"ih",value:function(e){var t,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!this.persistence||!this.rh()||this.Su&&!i)return e;var r=iq({},this.persistence.get_initial_props(),(null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps())||{},e||{}),s=this.config.sanitize_properties;return s&&(nA.error(ai),r=s(r,"$set_once")),n&&(this.Su=!0),ee(r)?void 0:r}},{key:"register",value:function(e,t){var n;null==(n=this.persistence)||n.register(e,t)}},{key:"register_once",value:function(e,t,n){var i;null==(i=this.persistence)||i.register_once(e,t,n)}},{key:"register_for_session",value:function(e){var t,n,i=this;null==(t=this.persistence)||t.syncCookieProperties(),this.nh(),null==(n=this.sessionPersistence)||n.register(e),Object.keys(e).forEach(function(e){return i.xu.add(e)}),this.sh()}},{key:"unregister",value:function(e){var t;null==(t=this.persistence)||t.unregister(e)}},{key:"unregister_for_session",value:function(e){var t;null==(t=this.sessionPersistence)||t.unregister(e),this.xu.delete(e),this.sh()}},{key:"ah",value:function(e,t){this.register((0,y._)({},e,t))}},{key:"Lu",value:function(){var e=this;this.xu.forEach(function(t){var n;null==(n=e.sessionPersistence)||n.unregister(t)}),this.xu.clear(),this.sh()}},{key:"sh",value:function(){if(this.Cu){if("memory"===this.config.persistence||(null==(e=this.sessionPersistence)?void 0:e.pi)||!rf.Et())return void rf.Lt(this.Cu);var e,t=[];this.xu.forEach(function(e){return t.push(e)}),t.length>0?rf.At(this.Cu,t):rf.Lt(this.Cu)}}},{key:"getFeatureFlag",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlag(e,t)}},{key:"getFeatureFlagPayload",value:function(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}},{key:"getFeatureFlagResult",value:function(e,t){var n;return null==(n=this.featureFlags)?void 0:n.getFeatureFlagResult(e,t)}},{key:"getAllFeatureFlags",value:function(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())?e:[]}},{key:"isFeatureEnabled",value:function(e,t){var n,i;return null!=(n=null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t))?n:null==t?void 0:t.defaultValue}},{key:"reloadFeatureFlags",value:function(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}},{key:"updateFlags",value:function(e,t,n){var i;
2null==(i=this.featureFlags)||i.updateFlags(e,t,n)}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i;null==(i=this.featureFlags)||i.updateEarlyAccessFeatureEnrollment(e,t,n)}},{key:"getEarlyAccessFeatures",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;return null==(t=this.featureFlags)?void 0:t.getEarlyAccessFeatures(e,n,i)}},{key:"on",value:function(e,t){return this.au.on(e,t)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),function(){})}},{key:"onSurveysLoaded",value:function(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:an}),function(){})}},{key:"onSessionId",value:function(e){var t,n;return null!=(t=null==(n=this.sessionManager)?void 0:n.onSessionId(e))?t:function(){}}},{key:"getSurveys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:an})}},{key:"getActiveMatchingSurveys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:an})}},{key:"renderSurvey",value:function(e,t){var n;null==(n=this.surveys)||n.renderSurvey(e,t)}},{key:"displaySurvey",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o0;null==(t=this.surveys)||t.displaySurvey(e,n)}},{key:"cancelPendingSurvey",value:function(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}},{key:"canRenderSurvey",value:function(e){var t,n;return null!=(t=null==(n=this.surveys)?void 0:n.canRenderSurvey(e))?t:{visible:!1,disabledReason:an}}},{key:"canRenderSurveyAsync",value:function(e){var t,n,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return null!=(t=null==(n=this.surveys)?void 0:n.canRenderSurveyAsync(e,i))?t:Promise.resolve({visible:!1,disabledReason:an})}},{key:"uh",value:function(e){return!e||ei(e)?(nA.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===e?(nA.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.')),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(nA.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.')),!1)}},{key:"identify",value:function(e,t,n){if(!this.__loaded||!this.persistence)return nA.uninitializedWarning("posthog.identify");if((eo(e)&&(e=e.toString(),nA.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")){this.yu();var i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.nh(!1),o=this.persistence.Pl(),a=!1;try{var u=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),e!==u&&e!==this.get_property("__alias")&&(this.unregister(nq),this.register({distinct_id:e}));var l=(this.persistence.get_property("$user_state")||"anonymous")===iI,c=e!==u,h=!c&&l;if(c&&l){var d,f=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:u};this.persistence.set_property(ib,iA),this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture(ij,f,{$set:t||{},$set_once:n||{}}),this.Eu=oU(e,t,n),null==(d=this.featureFlags)||d.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(h){this.persistence.set_property(ib,iA);var v=t||{},p=n||{};this.setPersonPropertiesForFlags({$set:v,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:v,$set_once:p}),this.Eu=oU(e,t,n)}else(t||n)&&this.setPersonProperties(t,n);c||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ig)):h&&(t||n)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Ol(a)}}}},{key:"setPersonProperties",value:function(e,t){if((e||t)&&this.oh("posthog.setPersonProperties")){var n=oU(this.get_distinct_id(),e,t);this.Eu!==n?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Eu=n):nA.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}},{key:"unsetPersonProperties",value:function(e){var t,n=(Y(e)?e:[e]).filter(function(e){return en(e)&&e.length>0});0!==n.length&&this.oh("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(n,!0),this.capture("$set",{$unset:n}),this.Eu=null)}},{key:"group",value:function(e,t,n){if(!e||!t)return void nA.error("posthog.group requires a group type and group key");null==(i=this.persistence)||i.syncCookieProperties(),this.nh();var i,r=this.getGroups(),s=r[e]!==t;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:tO(tO({},r),{},(0,y._)({},e,t))}),(s||n)&&this.rh()){var o={$group_type:e,$group_key:t};n&&(o.$group_set=n),this.capture(iB,o)}n&&this.setGroupPropertiesForFlags((0,y._)({},e,n)),s&&!n&&this.reloadFeatureFlags()}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var t,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];null==(t=this.featureFlags)||t.setPersonPropertiesForFlags(e,n)}},{key:"resetPersonPropertiesForFlags",value:function(){var e,t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}},{key:"setGroupPropertiesForFlags",value:function(e){var t,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];this.oh("posthog.setGroupPropertiesForFlags")&&(null==(t=this.featureFlags)||t.setGroupPropertiesForFlags(e,n))}},{key:"resetGroupPropertiesForFlags",value:function(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var t=eu(e)?e:null==e?void 0:e.resetDeviceID,n=eu(e)||null==e?void 0:e.bootstrap;this.hh(t,!1,n)}},{key:"hh",value:function(e){var t,n,i,r,s,o,a,u,l,c,h,d,f,v,p,g,_,m,b,k,w,x=arguments.length>1&&void 0!==arguments[1]&&arguments[1],E=arguments.length>2?arguments[2]:void 0;if(nA.info("reset"),!this.__loaded)return nA.uninitializedWarning("posthog.reset");var S=null==E?void 0:E.sessionID;this.config.bootstrap=E||(null==(t=this.Ru)?void 0:t.bootstrap)||{},null==(n=this.featureFlags)||null==(i=n.updateConfig)||i.call(n,this.config,this.Yl());var $=this.get_property(nH),P=this.get_property(nz),M=this.get_property(n3);null==(r=this.sessionRecording)||r.flushBeforeIdentityReset();var F=this.is_capturing();this.consent.reset(),x||!F||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var C=null==(s=this.persistence)||null==(o=s.Pl)?void 0:o.call(s),O=!1;try{if(null==(a=this.persistence)||a.clear(),null==(u=this.sessionPersistence)||u.clear(),this.xu.clear(),this.sh(),et(M)||null==(g=this.persistence)||g.register({$session_recording_remote_config:M}),null==(l=this.surveys)||l.reset(),null==(c=this.featureFlags)||c.reset(),null==(h=this.conversations)||h.reset(),null==(d=this.logs)||d.reset(),null==(f=this.metrics)||f.reset(),null==(v=this.persistence)||v.set_property("$user_state","anonymous"),null==(p=this.sessionManager)||p.resetSessionId(),this.Eu=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:i$,$device_id:null},"");
2else{var I=this.config.get_device_id(i2());this.register_once({distinct_id:I,$device_id:e?I:$},""),e||et(P)||this.register((0,y._)({},nz,P))}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),E&&(E.distinctID&&!this.fu()&&(null==(b=this.persistence)||b.set_property("$user_state",E.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:E.distinctID})),null==(_=this.featureFlags)||_.initialize(),!es(S)&&!(null==(m=this.sessionManager)?void 0:m.setBootstrapSessionId(S,!0)))){var A=tO({},E);delete A.sessionID,this.config.bootstrap=A}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,O=!0}finally{C&&(null==(k=this.persistence)||null==(w=k.Ol)||w.call(k,O))}this.reloadFeatureFlags()}},{key:"shutdown",value:function(e){var t=this;return em(function(){var e,n,i,r,s,o,a,u;return(0,E._)(this,function(l){if(t.__loaded){t.ku=!0,t.zu().dispose(),null==(e=t.sessionRecording)||e.dispose(),null==(n=t.logs)||n.flushLogs("sendBeacon"),null==(i=t.metrics)||i.flush("sendBeacon"),null==(r=t.Fu)||r.unload(),null==(s=t.Du)||s.unload();try{null==(u=t.featureFlags)||u.destroy()}catch(e){nA.error("Error while destroying feature flags",e)}null==(o=t.persistence)||o.destroy(),null==(a=t.sessionPersistence)||a.destroy()}else nA.uninitializedWarning("posthog.shutdown");return[2]})})()}},{key:"setIdentity",value:function(e,t){var n;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(n=this.conversations)||n.dh()}},{key:"clearIdentity",value:function(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(e=this.conversations)||e.fh()}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=t.sessionId,i=t.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if((null==e?void 0:e.withTimestamp)&&i){var s,o=null!=(s=e.timestampLookBack)?s:10;if(!i)return r;r+="?t=".concat(Math.max(Math.floor(((new Date).getTime()-i)/1e3)-o,0))}return r}},{key:"alias",value:function(e,t){return e===this.get_property("$people_distinct_id")?(nA.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(et(t)&&(t=this.get_distinct_id()),e!==t?(this.ah(nq,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(nA.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}},{key:"set_config",value:function(e){var t=tO({},this.config);if(Q(e)){iq(this.config,af(e));var n,i,r,s,o,a,u,l,c,h,d,f,v,p,g=this.bu();null==(n=this.persistence)||n.update_config(this.config,t,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new sO(tO(tO({},this.config),{},{persistence:"sessionStorage"}),g,!1);var _=this.Pu(this.config.debug);eu(_)&&(this.config.debug=_),eu(this.config.debug)&&(this.config.debug?(j.DEBUG=!0,i7.Et()&&i7.At("ph_debug",!0),nA.info("set_config",{config:e,oldConfig:t,newConfig:tO({},this.config)})):(j.DEBUG=!1,i7.Et()&&i7.Lt("ph_debug"))),null==(i=this.featureFlags)||null==(r=i.updateConfig)||r.call(i,this.config,this.Yl()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(u=this.tracingHeaders)||u.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(c=this.heatmaps)||c.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&(null==(p=this.historyAutocapture)||p.startIfEnabledOrStop()),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this._u(),null==(v=this.externalIntegrations)||v.startIfEnabledOrStop(),!t.segment&&this.config.segment&&this.persistence&&r2(this,ae,!1)}}},{key:"_overrideSDKInfo",value:function(e,t){j.LIB_NAME=e,j.LIB_VERSION=t}},{key:"startSessionRecording",value:function(e){var t,n,i,r,s,o=!0===e,a={sampling:o||!!(null==e?void 0:e.sampling),linked_flag:o||!!(null==e?void 0:e.linked_flag),url_trigger:o||!!(null==e?void 0:e.url_trigger),event_trigger:o||!!(null==e?void 0:e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(n=this.sessionRecording)||n.overrideSampling()),a.linked_flag&&(null==(i=this.sessionRecording)||i.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.event_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!!(null==(e=this.sessionRecording)?void 0:e.started)}},{key:"captureException",value:function(e,t){try{if(!this.exceptions)return;var n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(tO(tO({},n),t))}catch(e){return}}},{key:"addExceptionStep",value:function(e,t){var n;null==(n=this.exceptions)||n.addExceptionStep(e,t)}},{key:"captureLog",value:function(e){var t;null==(t=this.logs)||t.captureLog(e)}},{key:"logger",get:function(){var t,n;return null!=(t=null==(n=this.logs)?void 0:n.logger)?t:e.ph}},{key:"startExceptionAutocapture",value:function(e){this.set_config({capture_exceptions:null==e||e})}},{key:"stopExceptionAutocapture",value:function(){this.set_config({capture_exceptions:!1})}},{key:"loadToolbar",value:function(e){var t,n;return null!=(t=null==(n=this.toolbar)?void 0:n.loadToolbar(e))&&t}},{key:"get_property",value:function(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}},{key:"getSessionProperty",value:function(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}},{key:"toString",value:function(){var e,t=null!=(e=this.config.name)?e:au;return t!==au&&(t="posthog."+t),t}},{key:"_isIdentified",value:function(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property("$user_state"))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property("$user_state"))}},{key:"rh",value:function(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&
2!this._isIdentified()&&ee(this.getGroups())&&!(null==(e=this.persistence)||null==(e=e.props)?void 0:e.__alias)&&!(null==(t=this.persistence)||null==(t=t.props)?void 0:t.$epp))}},{key:"Ku",value:function(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}},{key:"createPersonProfile",value:function(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}},{key:"setInternalOrTestUser",value:function(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}},{key:"oh",value:function(e){return"never"===this.config.person_profiles?(nA.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(iS,!0),!0)}},{key:"bu",value:function(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}},{key:"_u",value:function(){var e,t,n,i,r,s=this.bu();return this.is_capturing()||null==(n=this.logs)||n.gh(),(null==(e=this.persistence)?void 0:e.pi)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t.pi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.xu.clear(),this.sh()),s}},{key:"opt_in_capturing",value:function(t){var n;if("always"!==this.config.cookieless_mode){if(this.fu()){null==(s=this.sessionRecording)||s.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new oD(this),this.pageViewManager=new r6(this),this.persistence&&(this.sessionPropsManager=new oR(this,this.sessionManager,this.persistence));var i,r,s,o,a,u,l,c,h,d,f=null!=(u=null==(l=this.config.__extensionClasses)?void 0:l.sessionRecording)?u:null==(c=e.__defaultExtensionClasses)?void 0:c.sessionRecording;f&&(this.sessionRecording=this.vu(this.sessionRecording,new f(this)),this.lu&&(null==(h=this.sessionRecording)||null==(d=h.onRemoteConfig)||d.call(h,this.lu)))}this.consent.optInOut(!0),this._u(),this.Zu(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(i=this.surveys)||i.loadIfEnabled()),(et(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!=(r=null==t?void 0:t.captureEventName)?r:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else nA.warn(at)}},{key:"opt_out_capturing",value:function(){if("always"===this.config.cookieless_mode)return void nA.warn(at);var e,t,n="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==n||n.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:i$,$device_id:null}),this.du(n),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}},{key:"has_opted_in_capturing",value:function(){return this.consent.isOptedIn()}},{key:"has_opted_out_capturing",value:function(){return this.consent.isOptedOut()}},{key:"get_explicit_consent_status",value:function(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}},{key:"is_capturing",value:function(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}},{key:"clear_opt_in_out_capturing",value:function(){this.consent.reset(),this._u()}},{key:"_is_bot",value:function(){return P?oN(P,this.config.custom_blocked_useragents):void 0}},{key:"Qu",value:function(){M&&("visible"===M.visibilityState?this.Tu||(this.Tu=!0,this.capture(iD,{title:M.title},{send_instantly:!0}),this.Iu&&(M.removeEventListener(iT,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),iX(M,iT,this.Iu)))}}
2,{key:"debug",value:function(e){!1===e?(null==S||S.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==S||S.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}))}},{key:"Yl",value:function(){var e,t,n,i,r=this.Ru||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(nA.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):(t="advanced_disable_decide",n=(e="advanced_disable_flags")in r&&!es(r[e]),i=t in r&&!es(r[t]),n?r[e]:!!i&&(nA&&nA.warn("Config field '".concat(t,"' is deprecated. Please use '").concat(e,"' instead. The old field will be removed in a future major version.")),r[t]))}},{key:"Os",value:function(e){if(es(this.config.before_send))return e;var t=Object.keys(null!=(a=e.properties)?a:{}).filter(el),n=Y(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e,r=!0,s=!1,o=void 0;try{for(var a,u,l=n[Symbol.iterator]();!(r=(u=l.next()).done);r=!0){var c=u.value;try{if(i=c(i),es(i)){var h,d="Event '".concat(e.event,"' was rejected in beforeSend function");return(h=e.event,V(z,h))?nA.warn("".concat(d,". This can cause unexpected behavior.")):nA.info(d),null}i.properties&&!ee(i.properties)||nA.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}catch(t){return nA.error("Error in beforeSend function for event '".concat(e.event,"':"),t),null}}}catch(e){s=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(s)throw o}}var f=!0,v=!1,p=void 0;try{for(var g,_=t[Symbol.iterator]();!(f=(g=_.next()).done);f=!0){var y=g.value;if(i.properties&&es(i.properties[y]))return nA.warn("Event '".concat(e.event,"' had its '").concat(y,"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.")),null}}catch(e){v=!0,p=e}finally{try{f||null==_.return||_.return()}finally{if(v)throw p}}return i}},{key:"getPageViewId",value:function(){var e;return null==(e=this.pageViewManager.Bo)?void 0:e.pageViewId}},{key:"captureTraceFeedback",value:function(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}},{key:"captureTraceMetric",value:function(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}},{key:"Pu",value:function(e){var t=eu(e)&&!e,n=i7.Et()&&"true"===i7.Ot("ph_debug");return!t&&(!!n||e)}}]),e}();ap.__defaultExtensionClasses={},ap.ph={trace:s=function(){},debug:s,info:s,warn:s,error:s,fatal:s},function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=iU(e.prototype[t[n]])}(ap,["identify"]);var ag=function(){function e(t){(0,g._)(this,e),this.disabled=!1===t;var n=Q(t)?t:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}return(0,_._)(e,[{key:"isRageClick",value:function(e,t,n){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>n-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}]),e}(),a_="$copy_autocapture",ay=nR("[AutoCapture]");function am(e,t){return t.length>e?t.slice(0,e)+"...":t}var ab=function(){function e(t){(0,g._)(this,e),this.yo=t,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 ag(this.Mr.rageclick),this.xo=null}return(0,_._)(e,[{key:"uo",value:function(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}},{key:"do",value:function(e){if(!rB(e))return!0;for(var t,n=null!=(t=this.vo().css_selector_ignorelist)?t:rO,i=new Set,r=e;r;){var s=function(){if(i.size>=1e3||i.has(r))return{v:!0};i.add(r);var e=r,t=rx(e);if(V(t,"ph-no-capture")||V(t,"ph-sensitive")||rH(e)||n.some(function(t){return rM(e,t)}))return{v:!0};var s=r.parentNode;r=rb(s)?s.host:s&&r_(s)?s:null}();if("object"===(0,x._)(s))return s.v}return!1}},{key:"fo",value:function(e){var t=this;if(!this.isEnabled||"pointercancel"===e.type)return void this.uo();if("pointerdown"===e.type){this.uo();var n,i=r$(e);return void(e.isPrimary&&0===e.button&&!e.ctrlKey&&i&&r_(i)&&(this.ho={target:i,excluded:this.do(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:null==(n=this.po)?void 0:n.distinctId}))}var r=this.ho;r&&(e.pointerId!==r.id||Math.abs(e.clientX-r.x)>5||Math.abs(e.clientY-r.y)>5?this.uo():"pointerup"===e.type&&(r.released=!0,this.co=setTimeout(function(){return t.uo()},0)))}},{key:"mo",value:function(e){var t=this.ho;this.uo();var n=r$(e);if((null==t?void 0:t.released)&&t.target.isConnected&&t.distinctId===(null==(i=this.po)?void 0:i.distinctId)&&e.pointerId===t.id&&(e.detail>0||"touch"===e.pointerType||"pen"===e.pointerType)&&0===e.button&&5>=Math.abs(e.clientX-t.x)&&5>=Math.abs(e.clientY-t.y)&&n&&(ry(n,"html")||ry(n,"body"))){if(t.excluded)return null;var i,r,s=null!=(r=this.vo().css_selector_ignorelist)?r:rO;return[n,null==M?void 0:M.documentElement,null==M?void 0:M.body].some(function(e){if(!e)return!1;var t=rx(e);return V(t,"ph-no-capture")||V(t,"ph-sensitive")||!rB(e)||rH(e)||s.some(function(t){return rM(e,t)})})?null:t.target}}},{key:"setup",value:function(e){this.Co(),this.po=e;var t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?t.dispose():(this.$o=t,this.startIfEnabled())}},{key:"dispose",value:function(){var e;this.So||(this.So=!0,this.po=void 0,null==(e=this.$o)||e.dispose(),this.$o=void 0,this.To())}},{key:"vo",value:function(){return this.yo.refresh(this.Mr),this.Mr}},{key:"Co",value:function(){var e,t;return this.vo(),this.Mr.url_allowlist=null==(e=this.Mr.url_allowlist)?void 0:e.map(function(e){return new RegExp(e)}),this.Mr.url_ignorelist=null==(t=this.Mr.url_ignorelist)?void 0:t.map(function(e){return new RegExp(e)}),this.Mr}},{key:"Io",value:function(){var e=this;if(!this.isBrowserSupported())return void ay.info("Disabling Automatic Event Collection because this browser is not supported");if(S&&M){var t=this.Mo=function(t){t=t||(null==S?void 0:S.event);try{if("blur"===t.type)return void e.uo();if(0===t.type.indexOf("pointer"))return void e.fo(t);var n="click"===t.type?e.mo(t):void 0;if(er(n))return;e.Eo(t,"$autocapture",n)}catch(e){ay.error("Failed to capture event",e)}};if(iX(S,"blur",t),iX(M,"submit",t,{capture:!0}),iX(M,"change",t,{capture:!0}),iX(M,"click",t,{capture:!0}),iz(["pointerdown","pointermove","pointerup","pointercancel"],function(e){iX(M,e,t,{capture:!0})}),this.vo().capture_copied_text){var n=this.Po=function(t){t=t||(null==S?void 0:S.event);try{e.Eo(t,a_)}catch(e){ay.error("Failed to capture clipboard event",e)}};iX(M,"copy",n,{capture:!0}),iX(M,"cut",n,{capture:!0}
2),iX(M,"paste",n,{capture:!0})}}}},{key:"To",value:function(){var e=this;this.uo(),this.Mo&&(null==S||S.removeEventListener("blur",this.Mo),iz(["pointerdown","pointermove","pointerup","pointercancel"],function(t){null==M||M.removeEventListener(t,e.Mo,!0)}),null==M||M.removeEventListener("submit",this.Mo,!0),null==M||M.removeEventListener("change",this.Mo,!0),null==M||M.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(null==M||M.removeEventListener("copy",this.Po,!0),null==M||M.removeEventListener("cut",this.Po,!0),null==M||M.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}},{key:"startIfEnabled",value:function(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}},{key:"onRemoteConfig",value:function(e){if(!this.So){if(this.wo=!0,!e.ok)return void this.startIfEnabled();var t,n=e.config;n.elementsChainAsString&&(this.ko=n.elementsChainAsString);var i=n.autocapture_opt_out;eu(i)&&(null==(t=this.po)||t.kv.set("$autocapture_disabled_server_side",i),this._o=i),this.startIfEnabled()}}},{key:"setElementSelectors",value:function(e){this.xo=e}},{key:"getElementSelectors",value:function(e,t){var n,i=[];return null==(n=this.xo)||n.forEach(function(n){var r=null==M?void 0:M.querySelectorAll(n);null==r||r.forEach(function(r){e!==r&&t!==r||V(i,n)||i.push(n)})}),i}},{key:"isEnabled",get:function(){if(this.So)return!1;var e,t,n=null==(e=this.po)?void 0:e.kv.get(nG),i=this._o,r=this.vo();if(!r.remoteRequestsDisabled&&!this.wo)return!1;var s=r.remoteRequestsDisabled&&!this.wo;if(er(i)&&!eu(n)&&!s)return!1;var o=null!=(t=this._o)?t:!!n;return!!r.enabled&&!o}},{key:"Eo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"$autocapture",n=arguments.length>2?arguments[2]:void 0;if(!this.isEnabled)return void this.uo();var i=n||r$(e);rm(i)&&(i=i.parentNode||null);var r=this.Co();"$autocapture"===t&&"click"===e.type&&(0,b._)(e,MouseEvent)&&r.rageclick&&(null==(f=this.rageclicks)?void 0:f.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&rD(i,r.rageclick)&&this.Eo(e,"$rageclick",n);var s=t===a_,o=s?tO(tO({},r),{},{dom_event_allowlist:void 0}):r;if(i&&function(e,t,n,i,r,s){if(!S||rN(e)||(null==n?void 0:n.url_allowlist)&&!rw(n.url_allowlist,s)||(null==n?void 0:n.url_ignorelist)&&rw(n.url_ignorelist,s))return!1;if(null==n?void 0:n.dom_event_allowlist){var o,a=n.dom_event_allowlist;if(a&&!a.some(function(e){return t.type===e}))return!1}var u=rj(e,i),l=u.parentIsUsefulElement,c=u.targetElementList;if(!function(e,t){var n=null==t?void 0:t.element_allowlist;if(et(n))return!0;var i=!0,r=!1,s=void 0;try{for(var o,a=e[Symbol.iterator]();!(i=(o=a.next()).done);i=!0){var u=function(){var e=o.value;if(n.some(function(t){return e.tagName.toLowerCase()===t}))return{v:!0}}();if("object"===(0,x._)(u))return u.v}}catch(e){r=!0,s=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return!1}(c,n)||!rF(c,null==n?void 0:n.css_selector_allowlist)||rF(c,null!=(o=null==n?void 0:n.css_selector_ignorelist)?o:rO))return!1;try{var h=S.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var 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 l?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(rP.indexOf(d)>-1||"true"===e.getAttribute("contenteditable"))}}(i,e,o,s,s?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var a=function(e,t){var n=t.e,i=t.maskAllElementAttributes,r=t.maskAllText,s=t.elementAttributeIgnoreList,o=t.elementsChainAsString,a=t.disableCaptureUrlHashes;if(!r_(e))return{props:{}};for(var u=[e],l=new Set([e]),c=e;c.parentNode&&!ry(c,"body")&&1e3>u.length;){if(rb(c.parentNode)){var h=c.parentNode.host;if(l.has(h))break;l.add(h),u.push(h),c=h;continue}if(!r_(c.parentNode)||l.has(c.parentNode))break;l.add(c.parentNode),u.push(c.parentNode),c=c.parentNode}var d="click"===n.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?u.findIndex(function(e){return ry(e,"button")||ry(e,"a")}):-1;d>0&&(r=r||u.slice(0,d+1).some(function(e){return!rB(e)||rH(e)}));var f,v,p,g=[],_={},y=!1,m=!1;if(iz(u,function(e){var t=rB(e);if(ry(e,"a")){var n=e.getAttribute("href");y=!!(t&&n&&rK(n))&&(a?tE(n):n)}V(rx(e),"ph-no-capture")&&(m=!0),g.push(function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=e.tagName.toLowerCase(),o={tag_name:s};rP.indexOf(s)>-1&&!n&&(o.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?am(1024,rX(e)):am(1024,rS(e)));var a=rx(e);a.length>0&&(o.classes=a.filter(function(e){return""!==e})),iz(e.attributes,function(n){var s;if((!rH(e)||-1!==["name","id","class","aria-label"].indexOf(n.name))&&
2!(null==i?void 0:i.includes(n.name))&&!t&&rK(n.value)&&(!en(s=n.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var a=n.value;"class"===n.name&&(a=rk(a).join(" ")),o["attr__"+n.name]=am(1024,"href"===n.name&&r?tE(a):a)}});for(var u=1,l=1,c=e;c=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!r_(t))return t}(c);)u++,c.tagName===e.tagName&&l++;return o.nth_child=u,o.nth_of_type=l,o}(e,i,r,s,a)),iz(function(e){if(!rB(e))return{};var t={};return iz(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var n=e.name.replace("data-ph-capture-attribute-",""),i=e.value;n&&i&&rK(i)&&(t[n]=i)}}),t}(e),function(e,t){({}).hasOwnProperty.call(_,t)||(_[t]=e)})}),m)return{props:{},explicitNoCapture:m};if(d>0&&(e=u[d],g.splice(0,d)),r||(g[0].$el_text=ry(e,"a")||ry(e,"button")?rX(e):rS(e)),y){g[0].attr__href=y;var b,w,x=null==(b=sn(y))?void 0:b.host,E=null==S||null==(w=S.location)?void 0:w.host;x&&E&&x!==E&&(p=y)}return{props:iq({$event_type:n.type,$ce_version:1},o?{}:{$elements:g},{$elements_chain:Y(g)?g.map(function(e){var t,n,i={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(n=e.attr__href)?void 0:n.slice(0,2048),attr_class:function(e){var t=e.attr__class;if(t)return Y(t)?t:rk(t)}(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return iV(e).filter(function(e){return 0===(0,k._)(e,1)[0].indexOf("attr__")}).forEach(function(e){var t=(0,k._)(e,2),n=t[0],r=t[1];return i.attributes[n]=r}),i}).map(function(e){var t="";if(e.tag_name&&(t+=e.tag_name),e.attr_class){e.attr_class.sort();var n=!0,i=!1,r=void 0;try{for(var s,o,a,u=e.attr_class[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var l=a.value;t+=".".concat(l.replace(/"/g,""))}}catch(e){i=!0,r=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw r}}}var c=tO(tO(tO(tO({},e.text?{text:e.text}:{}),{},{"nth-child":null!=(s=e.nth_child)?s:0,"nth-of-type":null!=(o=e.nth_of_type)?o:0},e.href?{href:e.href}:{}),e.attr_id?{attr_id:e.attr_id}:{}),e.attributes),h={};return iV(c).sort(function(e,t){var n=(0,k._)(e,1)[0],i=(0,k._)(t,1)[0];return i>n?-1:+(n>i)}).forEach(function(e){var t=(0,k._)(e,2),n=t[0],i=t[1];return h[rJ(n.toString())]=rJ(i.toString())}),t+=":",t+=iV(h).map(function(e){var t=(0,k._)(e,2),n=t[0],i=t[1];return"".concat(n,'="').concat(i,'"')}).join("")}).join(";"):""},(null==(f=g[0])?void 0:f.$el_text)?{$el_text:null==(v=g[0])?void 0:v.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},_),target:e}}(i,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:r.disableCaptureUrlHashes}),u=a.props,l=a.explicitNoCapture,c=a.target;if(l)return!1;var h=this.getElementSelectors(i,c);if(h&&h.length>0&&(u.$element_selectors=h),t===a_){var d=e.type||"clipboard";if("paste"!==d){var f,v,p,g,_=null==S||null==(p=S.getSelection())?void 0:p.toString(),y=rE(_);if(!y)return!1;u.$selected_content=y,u.$clipboard_text_length=null!=(g=null==_?void 0:_.length)?g:0}u.$copy_type=d}return null==(v=this.po)||v.capture(t,u).catch(function(e){return ay.error("Failed to capture event",e)}),!0}}},{key:"isBrowserSupported",value:function(){return Z(null==M?void 0:M.querySelectorAll)}}]),e}(),ak=function(){function e(t){(0,g._)(this,e),this._instance=t}return(0,_._)(e,[{key:"refresh",value:function(e){var t=this._instance.config,n=Q(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==n?void 0:n.url_allowlist,e.url_ignorelist=null==n?void 0:n.url_ignorelist,e.dom_event_allowlist=null==n?void 0:n.dom_event_allowlist,e.element_allowlist=null==n?void 0:n.element_allowlist,e.css_selector_allowlist=null==n?void 0:n.css_selector_allowlist,e.css_selector_ignorelist=null==n?void 0:n.css_selector_ignorelist,e.element_attribute_ignorelist=null==n?void 0:n.element_attribute_ignorelist,e.capture_copied_text=null==n?void 0:n.capture_copied_text}}]),e}(),aw=nR("[ExceptionAutocapture]"),ax=function(){},aE=function(e){var t;if(Z(e))return null!=(t=e.__posthog_layer__)?t:e.__rrweb_layer__};function aS(e,t,n){try{if(!(t in e))return ax;var i={next:e[t]},r=n(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.next.apply(this,t)});return Z(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}}
2)),e[t]=r,function(){if(e[t]===r)return void(e[t]=i.next);for(var n=e[t],s=aE(n);s;){if(s.next===r)return void(s.next=i.next);n=s.next,s=aE(n)}}}catch(e){return ax}}var a$=nR("[TracingHeaders]"),aP=nR("[Web Vitals]"),aM=["CLS","FCP","INP","LCP"],aF=["INP","LCP"],aC=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],aO="disabled",aI="lazy_loading",aA=nR("[SessionRecording]"),aR=nR("[Heatmaps]");function aT(e){return Q(e)&&"clientX"in e&&"clientY"in e&&eo(e.clientX)&&eo(e.clientY)}var aL=nR("[Product Tours]"),aD=function(e){var t;return!e.config.disable_product_tours&&!!(null==(t=e.persistence)?void 0:t.get_property(n0))},aN=["$set_once","$set"],aj=nR("[SiteApps]"),aB="Error while initializing PostHog app with config id ",aH=function(e,t){return(null==e?void 0:e.then)?e.then(t):t(e)},az="SDK is not enabled or survey functionality is not yet loaded",aq="Disabled. Not loading surveys.",aV=function(){function e(t,n){var i=this;(0,g._)(this,e),this.yo=t,this.mh=n,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=function(e){if(!i.So&&!i.Mr.disableSurveys){if(!e.ok)return oY.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(es(t))return oY.warn("Flags not loaded yet. Not loading surveys.");i.Sh=eu(t)?t:t.length>0,oY.info("flags response received, isSurveysEnabled: ".concat(i.Sh)),i.loadIfEnabled()}}}return(0,_._)(e,[{key:"setup",value:function(e){var t=this;if(!this.So)return this.xh=e,aH(e.kv.initialize(),function(){if(t.xh===e&&!t.So){t.xh=void 0,t.po=e;var n=e.onRemoteConfig(t.onRemoteConfig);t.So?n.dispose():(t.$o=n,t.loadIfEnabled())}})}},{key:"dispose",value:function(){var e,t,n,i;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,null==(e=this.$o)||e.dispose(),this.$o=void 0,null==(t=this._surveyEventReceiver)||t.dispose(),this._surveyEventReceiver=null,null==(n=this._surveyManager)||null==(i=n.dispose)||i.call(n),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(function(e){return clearTimeout(e)}),this.kh.clear())}},{key:"Mr",get:function(){return this.yo.get()}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"reset",value:function(){try{null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e,t=[],n=0;n<localStorage.length;n++){var i=localStorage.key(n);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(function(e){return localStorage.removeItem(e)})}catch(e){}}},{key:"loadIfEnabled",value:function(){var e=this;if(!this.So&&this.po){var t=this.Mr;if(!this._surveyManager){if(this.yh)return void oY.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void oY.info(aq);if(t.cookielessMode&&this.yo.isOptedOut())return void oY.info("Not loading surveys in cookieless mode without consent.");var n=this.yo.getExtensions();if(!n)return void oY.error("PostHog Extensions not found.");if(!et(this.Sh)||t.advancedEnableSurveys){var i=this.Sh||t.advancedEnableSurveys;this.yh=!0;try{var r=n.generateSurveys;if(r)return this.Ch(r,i),void(this.yh=!1);var s=n.loadExternalDependency;if(!s)return this.$h(iO),void(this.yh=!1);s(function(t){try{if(e.So)return;var n=e.yo.getExtensions();!t&&(null==n?void 0:n.generateSurveys)?e.Ch(n.generateSurveys,i):e.$h("Could not load surveys script",t)}finally{e.yh=!1}})}catch(e){throw this.yh=!1,this.$h("Error initializing surveys",e),e}}}}}},{key:"Ch",value:function(e,t){this.So||(this._surveyManager=e(t),this._surveyEventReceiver=this.yo.createEventReceiver(),oY.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}},{key:"$h",value:function(e,t){oY.error(e,t),this.Th({isLoaded:!1,error:e})}},{key:"onSurveysLoaded",value:function(e){var t=this;return this.bh.push(e),this._surveyManager&&this.Th({isLoaded:!0}),function(){t.bh=t.bh.filter(function(t){return t!==e})}}},{key:"getSurveys",value:function(e){var t,n=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=null!=(t=this.po)?t:this.mh;if(r&&!this.So){if(this.Mr.disableSurveys)return oY.info(aq),e([]);var s=r.kv.get(il);if(s&&!i)return e(s,{isLoaded:!0}
2),void(this.Ih()&&this.getSurveys(function(){},!0));if(this._h)return void this._h.then(function(t){var i=t.surveys,r=t.context;n.So||e(i,r)}).catch(function(e){return oY.error("Error in survey callback",e)});var o=this.Mh("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(function(e){try{return n.Eh(r,e)}catch(e){return oY.error("Error processing surveys response",e),n.Eh(r,{statusCode:0,error:e})}},function(e){return n.Eh(r,{statusCode:0,error:e})});this._h=o;var a=function(){n._h===o&&(n._h=null)};o.then(function(t){a(),n.So||e(t.surveys,t.context)},a).catch(function(e){return oY.error("Error in survey callback",e)})}}},{key:"Mh",value:function(e,t){var n=this.po;return n?n.sendRequest(e,t):new Promise(function(e){return e({statusCode:0,error:Error(az)})})}},{key:"Eh",value:function(e,t){if(this.So)return{surveys:[],context:{isLoaded:!1,error:az}};var n,i,r=t.statusCode;if(200!==r||!t.json){var s="Surveys API could not be loaded, status: ".concat(r);return 0!==r?oY.error(s):t.error||oY.warn(s),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.wh=null;var o=t.json.surveys||[],a=o.filter(function(e){var t;return!(!e.start_date||e.end_date)&&(oB(e)||!!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length))});return a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a)),e.kv.set((i={},(0,y._)(i,il,o),(0,y._)(i,ic,Date.now()),i)),{surveys:o,context:{isLoaded:!0}}}},{key:"Ih",value:function(){return this.Ph()&&!this._h&&!this.Rh()}},{key:"Ph",value:function(){var e,t,n=null==(e=null!=(t=this.po)?t:this.mh)?void 0:e.kv.get(ic);return eo(n)&&Date.now()-n>3e5}},{key:"Rh",value:function(){return eo(this.wh)&&3e5>Date.now()-this.wh}},{key:"markSurveyAsSeen",value:function(e,t){var n;oZ({id:e,current_iteration:null!=(n=null==t?void 0:t.iteration)?n:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}},{key:"Th",value:function(e){var t=!0,n=!1,i=void 0;try{for(var r,s=this.bh[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;try{if(!e.isLoaded)return o([],e);this.getSurveys(o)}catch(e){oY.error("Error in survey callback",e)}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}}},{key:"getActiveMatchingSurveys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!es(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);oY.warn("init was not called")}},{key:"Ah",value:function(e){var t=null;return this.getSurveys(function(n){var i;t=null!=(i=n.find(function(t){return t.id===e}))?i:null}),t}},{key:"Fh",value:function(e){if(es(this._surveyManager))return{eligible:!1,reason:az};var t="string"==typeof e?this.Ah(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}},{key:"Oh",value:function(e){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(es(this._surveyManager))return{eligible:!1,reason:az};var t="string"==typeof e?this.Ah(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}},{key:"canRenderSurvey",value:function(e){if(es(this._surveyManager))return oY.warn("init was not called"),{visible:!1,disabledReason:az};var t=this.Oh(e);return{visible:t.eligible,disabledReason:t.reason}}},{key:"canRenderSurveyAsync",value:function(e,t){var n=this;
2return es(this._surveyManager)?(oY.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:az})):new Promise(function(i){n.getSurveys(function(t){var r,s=null!=(r=t.find(function(t){return t.id===e}))?r:null;if(s){var o=n.Oh(s);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}},{key:"renderSurvey",value:function(e,t,n){var i,r=this;if(this.yo.isCapturing()){if(es(this._surveyManager))return void oY.warn("init was not called");var s="string"==typeof e?this.Ah(e):e;if(!(null==s?void 0:s.id))return void oY.warn("Survey not found");if(!oQ.includes(s.type))return void oY.warn("Surveys of type ".concat(s.type," cannot be rendered in the app"));var o=null==M?void 0:M.querySelector(t);if(o){if(null==(i=s.appearance)?void 0:i.surveyPopupDelaySeconds){oY.info("Rendering survey ".concat(s.id," with delay of ").concat(s.appearance.surveyPopupDelaySeconds," seconds"));var a=setTimeout(function(){var e,t;r.kh.delete(a),!r.So&&r.yo.isCapturing()&&(oY.info("Rendering survey ".concat(s.id," with delay of ").concat(null==(e=s.appearance)?void 0:e.surveyPopupDelaySeconds," seconds")),null==(t=r._surveyManager)||t.renderSurvey(s,o,n),oY.info("Survey ".concat(s.id," rendered")))},1e3*s.appearance.surveyPopupDelaySeconds);return void this.kh.add(a)}this._surveyManager.renderSurvey(s,o,n)}else oY.warn("Survey element not found")}}},{key:"displaySurvey",value:function(e,t){if(this.yo.isCapturing()){if(es(this._surveyManager))return void oY.warn("init was not called");var n,i=this.Ah(e);if(!i)return void oY.warn("Survey not found");var r=i;if((null==(n=i.appearance)?void 0:n.surveyPopupDelaySeconds)&&t.ignoreDelay&&(r=tO(tO({},i),{},{appearance:tO(tO({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==sj&&t.initialResponses&&oY.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this.Fh(i);if(!s.eligible)return void oY.warn("Survey is not eligible to be displayed: ",s.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}}},{key:"cancelPendingSurvey",value:function(e){es(this._surveyManager)?oY.warn("init was not called"):this._surveyManager.cancelSurvey(e)}},{key:"handlePageUnload",value:function(){var e,t;null==(e=this._surveyManager)||null==(t=e.handlePageUnload)||t.call(e)}}]),e}();function aU(e,t,n){if(es(e))return!1;switch(n){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 aW=function(){function e(t){var n=this;(0,g._)(this,e),this._instance=t,this.Dh=new Set,this.Lh=new Set,this.Nh=new oT,this.qh=function(e,t){return n.jh(e,t)&&n.Bh(e,t)&&n.Hh(e,t)&&n.zh(e,t)},this.jh=function(e,t){return!(null==t?void 0:t.event)||(null==e?void 0:e.event)===(null==t?void 0:t.event)}}return(0,_._)(e,[{key:"init",value:function(){var e,t,n=this;et(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Uh=null==(t=this._instance)?void 0:t._addCaptureHook(function(e,t){n.on(e,t)}))}},{key:"dispose",value:function(){var e;null==(e=this.Uh)||e.call(this),this.Uh=void 0,this.Nh=new oT}},{key:"register",value:function(e){var t,n,i=this;if(!et(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(function(e){var t;i.Dh.add(e),null==(t=e.steps)||t.forEach(function(e){i.Lh.add((null==e?void 0:e.event)||"")})}),null==(n=this._instance)?void 0:n.autocapture)){var r=new Set;this.Dh.forEach(function(e){var t;null==(t=e.steps)||t.forEach(function(e){(null==e?void 0:e.selector)&&r.add(e.selector)})}),this._instance.autocapture.setElementSelectors(r)}}},{key:"replace",value:function(e){this.Dh.clear(),this.Lh.clear(),this.register(e)}},{key:"on",value:function(e,t){var n=this;null!=t&&0!=e.length&&(this.Lh.has(e)||this.Lh.has(t.event))&&this.Dh.forEach(function(e){n.Wh(t,e)&&n.Nh.emit("actionCaptured",e.name)})}},{key:"Vh",value:function(e){this.onAction("actionCaptured",function(t){return e(t)})}},{key:"Wh",value:function(e,t){if(null==(null==t?void 0:t.steps))return!1;var n=!0,i=!1,r=void 0;try{for(var s,o=t.steps[Symbol.iterator]();!(n=(s=o.next()).done);
2n=!0){var a=s.value;if(this.qh(e,a))return!0}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return!1}},{key:"onAction",value:function(e,t){return this.Nh.on(e,t)}},{key:"Bh",value:function(e,t){if(null==t?void 0:t.url){var n,i=null==e||null==(n=e.properties)?void 0:n.$current_url;if(!i||"string"!=typeof i||!aU(i,t.url,t.url_matching||"contains"))return!1}return!0}},{key:"Hh",value:function(e,t){return!!this.Gh(e,t)&&!!this.Zh(e,t)&&!!this.Qh(e,t)}},{key:"Gh",value:function(e,t){if(!(null==t?void 0:t.href))return!0;var n,i,r=this.Jh(e);if(r.length>0)return r.some(function(e){return aU(e.href,t.href,t.href_matching||"exact")});var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!s&&aU((n=s.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}},{key:"Zh",value:function(e,t){if(!(null==t?void 0:t.text))return!0;var n,i,r,s,o=this.Jh(e);if(o.length>0)return o.some(function(e){return aU(e.text,t.text,t.text_matching||"exact")||aU(e.$el_text,t.text,t.text_matching||"exact")});var a=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!a&&(n=function(e){for(var t,n=[],i=/(?::|")text="(.*?)"/g;!es(t=i.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(a),i=t.text,r=t.text_matching||"exact",n.some(function(e){return aU(e,i,r)}))}},{key:"Qh",value:function(e,t){if(!(null==t?void 0:t.selector))return!0;var n,i,r=null==e||null==(n=e.properties)?void 0:n.$element_selectors;if(null==r?void 0:r.includes(t.selector))return!0;var s=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){}return!1}},{key:"Jh",value:function(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}},{key:"zh",value:function(e,t){return!(null==t?void 0:t.properties)||0===t.properties.length||oV(t.properties.reduce(function(e,t){var n=Y(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:n,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}]),e}(),aG=function(e){function t(e){return(0,g._)(this,t),(0,p._)(this,t,[e])}return(0,m._)(t,e),(0,_._)(t,[{key:"Ac",value:function(){return ih}},{key:"Fc",value:function(){return id}},{key:"rc",value:function(){return iv}},{key:"oc",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated_timestamps:e})}},{key:"lc",value:function(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister("$surveys_activated_timestamps")}},{key:"sc",value:function(e){this.cc(function(t){n=t.find(function(t){return t.id===e})});var t,n,i=null==n||null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds;return eo(i)&&i>0}},{key:"qc",value:function(){return sL}},{key:"cc",value:function(e){var t;null==(t=this._instance)||t.getSurveys(e)}},{key:"Sc",value:function(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}},{key:"yc",value:function(){return oY}},{key:"Tc",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated:e})}},{key:"Oc",value:function(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({$surveys_activated_session:e})}},{key:"Dc",value:function(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister("$surveys_activated_session")}},{key:"Lc",value:function(){return!1}},{key:"bc",value:function(e,t){var n,i,r;return this.cc(function(e){n=e.find(function(e){return e.id===t})}),!n||oB(i=n)&&(null==(r=i.conditions)||null==(r=r.events)?void 0:r.repeatedActivation)||"always"===i.schedule?e===sL?"consume":"ignore":e===sL?"persist":e===sD||e===sN?"consume":"ignore"}},{key:"getSurveys",value:function(){return this.getActivatedIds()}},{key:"getEventToSurveys",value:function(){return this.getEventToItemsMap()}}]),t}(function(){function e(t){var n,i,r=this;(0,g._)(this,e),this.Kh=[],this._instance=t,this.Yh=new Map,this.Xh=new Map,this.tc=new Map,this.ec=null==(n=this._instance)||null==(i=n.onSessionId)?void 0:i.call(n,function(e){return r.nc(e)})}return(0,_._)(e,[{key:"sc",value:function(e){return!1}},{key:"rc",value:function(){return null}},{key:"oc",value:function(e){}},{key:"lc",value:function(){}},{key:"ac",value:function(e,t){return!!e&&oV(e.propertyFilters,null==t?void 0:t.properties)}},{key:"uc",value:function(e,t){var n=new Map;return e.forEach(function(e){var i;null==(i=e.conditions)||null==(i=i[t])||null==(i=i.values)||i.forEac
2h(function(t){if(null==t?void 0:t.name){var i=n.get(t.name)||[];i.push(e.id),n.set(t.name,i)}})}),n}},{key:"hc",value:function(e,t,n){var i=this,r=(n===sR?this.Yh:this.Xh).get(e),s=[];return this.cc(function(e){s=e.filter(function(e){return null==r?void 0:r.includes(e.id)})}),s.filter(function(r){var s,o=null==(s=r.conditions)||null==(s=s[n])||null==(s=s.values)?void 0:s.find(function(t){return t.name===e});return i.ac(o,t)})}},{key:"register",value:function(e){this.dc(e,!1)}},{key:"replace",value:function(e){this.dc(e,!0)}},{key:"dc",value:function(e,t){var n;et(null==(n=this._instance)?void 0:n._addCaptureHook)||(this.vc(e,t),this.fc(e,t))}},{key:"fc",value:function(e,t){var n,i=this,r=e.filter(function(e){var t;return null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)?void 0:t.length});if(t&&this.tc.clear(),0===r.length)return void(t&&(null==(n=this.gc)||n.replace([])));this.gc||(this.gc=new aW(this._instance),this.gc.init(),this.gc.Vh(function(e){return i.onAction(e)}));var s=[];r.forEach(function(e){var t;null==(t=e.conditions)||null==(t=t.actions)||t.values.forEach(function(t){if(s.push(t),t.name){var n,r=null!=(n=i.tc.get(t.name))?n:[];r.includes(e.id)||r.push(e.id),i.tc.set(t.name,r)}})}),t?this.gc.replace(s):this.gc.register(s)}},{key:"mc",value:function(e,t){t.forEach(function(t,n){var i,r=null!=(i=e.get(n))?i:[];t.forEach(function(e){r.includes(e)||r.push(e)}),e.set(n,r)})}},{key:"vc",value:function(e,t){var n,i=this,r=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.events)&&(null==(n=e.conditions)||null==(n=n.events)||null==(n=n.values)?void 0:n.length)>0}),s=e.filter(function(e){var t,n;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(n=e.conditions)||null==(n=n.cancelEvents)||null==(n=n.values)?void 0:n.length)>0}),o=this.uc(e,sR),a=this.uc(e,sT);t?(this.Yh=o,this.Xh=a):(this.mc(this.Yh,o),this.mc(this.Xh,a)),(0!==r.length||0!==s.length)&&(null!=this.Uh||(this.Uh=null==(n=this._instance)?void 0:n._addCaptureHook(function(e,t){i.onEvent(e,t)})))}},{key:"onEvent",value:function(e,t){var n,i,r=this,s=this.yc(),o=(null==t||null==(n=t.properties)?void 0:n.$survey_id)||(null==t||null==(i=t.properties)?void 0:i.$product_tour_id);if(o&&this.getActivatedIds().includes(o)){var a=this.bc(e,o);if("consume"===a)return s.info("event consumed activated item, removing it",{event:e,itemId:o}),void this._c([o]);if("persist"===a)return s.info("shown item promoted to persisted activation",{event:e,itemId:o}),this.wc(o),void this.kc([o])}if(this.Xh.has(e)){var u=this.hc(e,t,sT);u.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:u.map(function(e){return e.id})}),this._c(u.map(function(e){return e.id})),u.forEach(function(e){return r.Sc(e.id)}))}if(this.Yh.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.Yh.get(e)});var l=this.hc(e,t,sR);this.xc(l.map(function(e){return e.id}))}}},{key:"onAction",value:function(e){this.tc.has(e)&&this.xc(this.tc.get(e)||[])}},{key:"xc",value:function(e){if(0!==e.length){var t=!!(null==(o=this._instance)||null==(a=o.get_session_id)?void 0:a.call(o)),n=[],i=!0,r=!1,s=void 0;try{for(var o,a,u,l=e[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var c=u.value;t&&this.sc(c)?this.wc(c)&&this.Cc(c):n.push(c)}}catch(e){r=!0,s=e}finally{try{i||null==l.return||l.return()}finally{if(r)throw s}}n.length>0&&(this.Kh=(0,w._)(new Set((0,w._)(this.Kh).concat((0,w._)(n))))),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}}},{key:"wc",value:function(e){this.Kh=this.Kh.filter(function(t){return t!==e});var t=this.$c();return!t.includes(e)&&(this.Tc((0,w._)(t).concat([e])),this.Ic(),!0)}},{key:"_c",value:function(e){var t=new Set(e);this.Kh=this.Kh.filter(function(e){return!t.has(e)});var n=this.Mc(),i=n.filter(function(e){return!t.has(e)});i.length!==n.length&&(this.Tc(i),0===i.length&&this.Ec()),this.kc(e)}},{key:"Pc",value:function(){var e,t=this.rc();if(!t)return{};var n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t];return n&&"object"==(void 0===n?"undefined":(0,x._)(n))?n:{}}},{key:"Cc",value:function(e){if(this.rc()){var t=this.Pc();this.oc(tO(tO({},t),{},(0,y._)({},e,Date.now())))}}},{key:"kc",value:function(e){if(this.rc()){var t=this.Pc(),n={},i=!1,r=!0,s=!1,o=void 0;try{for(var a,u=Object.entries(t)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=(0,k._)(a.value,2),c=l[0],h=l[1];e.includes(c)?i=!0:n[c]=h}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}i&&(ee(n)?this.lc():this.oc(n))}}},{key:"Rc",value:function(){this.rc()&&this.lc()}},{key:"getActivationTimestamp",value:function(e){if(this.$c().includes(e)){var t=this.Pc()[e];return eo(t)?t:void 0}}},{key:"Mc",value:function(){var e,t=this.Ac();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}},{key:"$c",value:function(){var e,t,n,i=this.Mc();if(0===i.length)return[];var r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Fc()],s=null==(t=this._instance)||null==(n=t.get_session_id)?void 0:n.call(t);return s&&r===s?i:[]}},{key:"Ic",value:function(){var e,t,n=null==(e=this._instance)||null==(t=e.get_session_id)?void 0:t.call(e);n&&this.Oc(n)}},{key:"Ec",value:function(){this.Dc()}},{key:"nc",value:function(e){var t,n=this,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Fc()];if(i&&i!==e){var r=this.Mc(),s=this.Pc();r.length>0&&(this.Tc([]),r.filter(function(e){return eo(s[e])}
2).forEach(function(e){return n.Sc(e)})),this.Ec(),this.Rc()}}},{key:"getActivatedIds",value:function(){var e=this;return(0,w._)(new Set((0,w._)(this.$c()).concat((0,w._)(this.Kh)))).filter(function(t){return!e.Lc(t)})}},{key:"dispose",value:function(){var e,t,n;null==(e=this.ec)||e.call(this),this.ec=void 0,null==(t=this.Uh)||t.call(this),this.Uh=void 0,null==(n=this.gc)||n.dispose(),this.gc=void 0}},{key:"reset",value:function(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}},{key:"getEventToItemsMap",value:function(){return this.Yh}},{key:"Nc",value:function(){return this.gc}}]),e}()),aK=function(){function e(t){(0,g._)(this,e),this._instance=t}return(0,_._)(e,[{key:"initialize",value:function(){}},{key:"get",value:function(e){if("string"==typeof e)return this._instance.get_property(e);var t={},n=!0,i=!1,r=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done);n=!0){var a=s.value,u=this._instance.get_property(a);et(u)||(t[a]=u)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return t}},{key:"set",value:function(e,t){this._instance.register("string"==typeof e?(0,y._)({},e,t):e)}},{key:"remove",value:function(e){var t=this;"string"!=typeof e?e.forEach(function(e){return t._instance.unregister(e)}):this._instance.unregister(e)}}]),e}(),aX=function(){function e(t){(0,g._)(this,e),this._instance=t}return(0,_._)(e,[{key:"get",value:function(){var e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}},{key:"isOptedOut",value:function(){return this._instance.consent.isOptedOut()}},{key:"isCapturing",value:function(){return this._instance.is_capturing()}},{key:"getExtensions",value:function(){var e=this,t=null==D?void 0:D.__PosthogExtensions__;if(t){var n=t.generateSurveys,i=t.loadExternalDependency;return{generateSurveys:n?function(t){return n(e._instance,t)}:void 0,loadExternalDependency:i?function(t){return i(e._instance,"surveys",t)}:void 0}}}},{key:"createEventReceiver",value:function(){return new aG(this._instance)}}]),e}(),aJ=(null==S?void 0:S.location)?ss(S.location.hash,"__posthog")||ss(location.hash,"state"):null,aY="_postHogToolbarParams",aZ=nR("[Toolbar]"),aQ=nR("[FeatureFlags]"),a0=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(0,g._)(this,e),this.jc=!1,this.update(t,n)}return(0,_._)(e,[{key:"update",value:function(e,t){var n,i,r,s,o,a,u;this.Bc={bootstrap:{featureFlags:null!=(n=null==(i=e.bootstrap)?void 0:i.featureFlags)?n:void 0,featureFlagPayloads:null!=(r=null==(s=e.bootstrap)?void 0:s.featureFlagPayloads)?r:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:null!=(o=e.remote_config_refresh_interval_ms)?o:3e5,idleRefreshBackoff:et(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!=(u=e.evaluation_contexts)?u:e.evaluation_environments)?a:[],flagKeys:Y(e.flag_keys)?e.flag_keys:void 0},!e.evaluation_environments||e.evaluation_contexts||this.jc||(aQ.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),et(e.flag_keys)||Y(e.flag_keys)||aQ.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}},{key:"get",value:function(){return this.Bc}}]),e}(),a1=nR("[FeatureFlags]"),a2=nR("[FeatureFlags]",{debugEnabled:!0}),a3="\" failed. Feature flags didn't load in time.",a5=["click","keydown","wheel","touchstart","pointerdown"],a4="connection_error",a6=function(e){for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},a8=function(e){var t={},n=!0,i=!1,r=void 0;try{for(var s,o=iV(e||{})[Symbol.iterator]();!(n=(s=o.next()).done);
2n=!0){var a=(0,k._)(s.value,2),u=a[0],l=a[1];l&&(t[u]=l)}}catch(e){i=!0,r=e}finally{try{n||null==o.return||o.return()}finally{if(i)throw r}}return t},a9=function(e){return ed(e)&&("RangeError"===e.name&&0===e.message.indexOf("Maximum call stack size exceeded")||"InternalError"===e.name&&"too much recursion"===e.message)},a7=nR("[Error tracking]"),ue="webkit-masked-url:",ut=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],un=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",ue],ui=["__firefox__","__gCrWeb"],ur="Refusing to render web experiment since the viewer is a likely bot",us={icontains:function(e,t){return t.toLowerCase().indexOf(e.toLowerCase())>-1},not_icontains:function(e,t){return -1===t.toLowerCase().indexOf(e.toLowerCase())},regex:function(e,t){return oH(t,e)},not_regex:function(e,t){return!oH(t,e)},exact:function(e,t){return t===e},is_not:function(e,t){return t!==e}},uo=nR("[Conversations]"),ua="Conversations not available yet.";function uu(e,t){var n,i,r,s,o,a,u,l=null!=(n=null==e?void 0:e.flushIntervalMs)?n:3e3,c=null!=(i=null==e?void 0:e.maxBufferSize)?i:100,h=(null==t?void 0:t.consoleCapture)?void 0:null!=(r=null==e?void 0:e.maxLogsPerInterval)?r:1e3,d=et(h)?Math.max(c,2048):Math.max(c,h),f=tO(tO({},function(){var e,t,n,i="",r="";try{var s,o=null==P?void 0:P.userAgent;o&&(i=(s=(0,k._)(td(o),2))[0],r=s[1])}catch(e){}return e=i,t=r,tO(tO({},(n=function(e){if(e)return({}).hasOwnProperty.call(nb,e)?nb[e]:e}(e))?{"os.name":n}:{}),t?{"os.version":t}:{})}()),null==e?void 0:e.resourceAttributes);return{serviceName:null!=(s=null!=(o=null==f?void 0:f["service.name"])?o:null==e?void 0:e.serviceName)?s:null==t?void 0:t.serviceNameDefault,serviceVersion:null!=(a=null==f?void 0:f["service.version"])?a:null==e?void 0:e.serviceVersion,environment:null!=(u=null==f?void 0:f["deployment.environment"])?u:null==e?void 0:e.environment,resourceAttributes:f,beforeSend:null==e?void 0:e.beforeSend,flushIntervalMs:l,maxBufferSize:c,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:l,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var ul=["debug","log","warn","error","info"],uc=function(e){for(;null==e?void 0:e.__rrweb_original__;)e=e.__rrweb_original__;return e},uh="console",ud="__posthogHandledLogsRequestError",uf=function(e,t){var n=(0,b._)(e,Error)?e:Error(t);return n[ud]=!0,n},uv=function(e){return!!e&&"object"==(void 0===e?"undefined":(0,x._)(e))&&!0===e[ud]},up={featureFlags:function(){function e(t){var n=this;(0,g._)(this,e),this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=a1,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=function(){var e=n.ed();n.Xc=0,e&&n.reloadFeatureFlags()},this.nd=function(){var e,t,i=n.sd,r=null!=(e=n.rd)?e:i;et(i)||et(r)||n.Mr.remoteRequestsDisabled||!M||"hidden"===M.visibilityState||Date.now()-(null!=(t=n.od)?t:0)<r||(n.rd=n.td||!n.Mr.idleRefreshBackoff?i:Math.min(2*r,36e5),n.td=!1,n.reloadFeatureFlags(),n.ld())},this.ad=function(){n.td&&n.rd===n.sd||n.ud()},this.an=function(){"visible"===(null==M?void 0:M.visibilityState)&&n.ud()},"get"in t?this.yo=t:(this._instance=t,this.hd=new a0(t.config,t.Yl()),this.yo=this.hd)}return(0,_._)(e,[{key:"updateConfig",value:function(e,t){var n;null==(n=this.hd)||n.update(e,t),this.po&&this.dd()}},{key:"setup",value:function(e){var t=this;return this.xh=e,this.$=e.logger.createLogger("[FeatureFlags]"),aH(e.kv.initialize(),function(){t.xh===e&&(t.xh=void 0,t.po=e,t.vd(e))})}},{key:"vd",value:function(e){var t,n=this;if(this.po===e)return S&&iX(S,"online",this.sn),this.dd(),this.fd=e.registerDynamicEventProperties(function(){return n.pd()?n.zc:n.Uc}),this.gd=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.onCrossTabFeatureFlagChange(function(){n.md(),n.yd(),n.bd()}),this.yd(),this.initialize()}},{key:"ud",value:function(){this.td=!0,this.rd=this.sd,this.nd()}},{key:"dd",value:function(){var e=this,t=this.Mr.refreshIntervalMs,n=!this.Mr.remoteRequestsDisabled&&M&&!et(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.rd=n),n!==this.sd&&(this._d(),et(n)||(this.sd=n,this.rd=n,this.ld(),(null==M?void 0:M.addEventListener)&&(iX(M,iT,this.an),iH(a5,function(t){iX(M,t,e.ad,{capture:!0})}
2))))}},{key:"ld",value:function(){et(this.sd)||(et(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}},{key:"_d",value:function(){var e,t=this;et(this.wd)||(clearInterval(this.wd),this.wd=void 0,null==M||null==(e=M.removeEventListener)||e.call(M,"visibilitychange",this.an),iH(a5,function(e){var n;null==M||null==(n=M.removeEventListener)||n.call(M,e,t.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}},{key:"destroy",value:function(){this.kd()}},{key:"dispose",value:function(){this.kd()}},{key:"kd",value:function(){var e,t;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),null==(e=this.fd)||e.dispose(),this.fd=void 0,null==(t=this.gd)||t.call(this),this.gd=void 0,this.Wc=[],null==S||S.removeEventListener("online",this.sn),this.po=void 0)}},{key:"Mr",get:function(){return this.yo.get()}},{key:"xd",value:function(e){var t;return this.Cd&&e in this.Cd?this.Cd[e]:null==(t=this.po)?void 0:t.kv.get(e)}},{key:"md",value:function(){return!!this.Cd&&(this.Cd=void 0,!0)}},{key:"$d",value:function(){var e;return!et(null==(e=this.po)?void 0:e.kv.get("$enabled_feature_flags"))&&this.md()}},{key:"At",value:function(e){var t=this;this.Td(function(){var n;return null==(n=t.po)?void 0:n.kv.set(e)})}},{key:"Id",value:function(e,t,n){if((null==(i=this._instance)?void 0:i.persistence)&&e.$enabled_feature_flags){var i,r,s=this.xd("$enabled_feature_flags")||{},o=e.$enabled_feature_flags||{},a=t.flags||t.featureFlags,u=t.flags?Object.entries(t.flags).filter(function(e){var t=(0,k._)(e,2)[1];return!(null==t?void 0:t.failed)}).map(function(e){return(0,k._)(e,1)[0]}):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,c=l?u:n&&!Y(a)?Object.keys(a||{}):Array.from(new Set((0,w._)(Object.keys(s)).concat((0,w._)(Object.keys(o))))),h=this.xd("$feature_flag_payloads")||{},d=e.$feature_flag_payloads||{},f=l||n?c:Array.from(new Set((0,w._)(Object.keys(h)).concat((0,w._)(Object.keys(d))))),v=!l&&!n,p=!!v||c,g=(r={},(0,y._)(r,n8,p),(0,y._)(r,n6,p),(0,y._)(r,ie,!!v||f),r);e.$feature_flag_details&&(g[n7]=p);for(var _=0,m=[it,im,ii];_<m.length;_++){var b=m[_];et(e[b])||(g[b]=!0)}this._instance.persistence.markCrossTabFeatureFlagChanges(g)}}},{key:"Lt",value:function(e){var t=this;this.Td(function(){var n;return null==(n=t.po)?void 0:n.kv.remove(e)})}},{key:"Td",value:function(e){try{e()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}},{key:"yd",value:function(){for(var e={},t=0,n=[n8,ie,it,ir];t<n.length;t++){var i=n[t],r=this.xd(i);et(r)||(e[i]=r)}this.zc=e;var s=tO({},e),o=this.xd(n6),a=!0,u=!1,l=void 0;if(o)try{for(var c,h=Object.entries(o)[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=(0,k._)(c.value,2),f=d[0],v=d[1];s["$feature/".concat(f)]=v}}catch(e){u=!0,l=e}finally{try{a||null==h.return||h.return()}finally{if(u)throw l}}this.Uc=s}},{key:"pd",value:function(){var e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;var t=this.xd(im);return"number"!=typeof t||Date.now()-t>e}},{key:"Md",value:function(){return!!this.pd()&&(this.Yc||this.Gc||(this.Yc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}},{key:"Ed",value:function(){var e=this,t=this.Mr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(function(t){var n=t&&"string"==typeof t&&t.trim().length>0;return n||e.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),n}):[]}},{key:"Pd",value:function(){var e=this,t=this.Mr.flagKeys;if(!et(t))return t.filter(function(t){var n=t&&"string"==typeof t&&t.trim().length>0;return n||e.$.error("Invalid flag key found:",t,"Expected non-empty string"),n})}},{key:"initialize",value:function(){var e=this.Mr,t=null!=(n=null==(i=e.bootstrap)?void 0:i.featureFlags)?n:{};if(Object.keys(t).length){var n,i,r,s,o=null!=(r=null==(s=e.bootstrap)?void 0:s.featureFlagPayloads)?r:{},a=Object.keys(t).filter(function(e){return!et(t[e])}).reduce(function(e,n){return e[n]=t[n],e},{}),u=Object.keys(o).filter(function(e){return a[e]}).reduce(function(e,t){return e[t]=o[t],e},{});return this.Rd({featureFlags:a,featureFlagPayloads:u},void 0,{persist:!1})}}},{key:"updateFlags",value:function(e,t,n){var i=(null==n?void 0:n.merge)&&null!=(h=this.xd("$enabled_feature_flags"))?h:{},r=(null==n?void 0:n.merge)&&null!=(d=this.xd("$feature_flag_payloads"))?d:{},s=tO(tO({},i),e),o=tO(tO({},r),t),a={},u=!0,l=!1,c=void 0;try{for(var h,d,f,v=Object.entries(s)[Symbol.iterator]();!(u=(f=v.next()).done);u=!0){var p=(0,k._)(f.value,2),g=p[0],_=p[1];a[g]={key:g,enabled:nn(_),variant:ni(_),reason:void 0,metadata:et(null==o?void 0:o[g])?void 0:{id:0,version:void 0,description:void 0,payload:o[g]}}}}catch(e){l=!0,c=e}finally{try{u||null==v.return||v.return()}finally{if(l)throw c}}this.Rd({flags:a})}},{key:"hasLoadedFlags",get:function(){return this.Vc}},{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagsWithDetails",value:function(){var e=this.xd(n7),t=this.xd(ir),n=this.xd(is);if(!n&&!t)return e||{};var i=iq({},e||{}),r=(0,w._)(new Set((0,w._)(Object.keys(n||{})).concat((0,w._)(Object.keys(t||{}))))),s=!0,o=!1,a=void 0;try{for(var u,l=r[Symbol.iterator]();!(s=(u=l.next()).done);s=!0){var c,h,d=u.value,f=i[d],v=null==t?void 0:t[d],p=et(v)?null!=(c=null==f?void 0:f.enabled)&&c:!!v,g=et(v)?null==f?void 0:f.variant:"string"==typeof v?v:void 0,_=null==n?void 0:n[d],y=tO(tO({},f),{},{enabled:p,variant:p?null!=g?g:null==f?void 0:f.variant:void 0});p!==(null==f?void 0:f.enabled)&&(y.original_enabled=null==f?void 0:f.enabled),g!==(null==f?void 0:f.variant)&&(y.original_variant=null==f?void 0:f.variant),_&&(y.metadata=tO(tO({},null==f?void 0:f.metadata),{},{payload:_,original_payload:null==f||null==(h=f.metadata)?void 0:h.payload})),i[d]=y}}catch(e){o=!0,a=e}finally{try{s||null==l.return||l.return()}finally{if(o)throw a}}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}
2),this.Hc=!0),i}},{key:"getAllFeatureFlags",value:function(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(function(n){var i=e[n];return{key:n,enabled:nn(i),variant:ni(i),payload:nt(t[n])}})}},{key:"getFlagVariants",value:function(){var e=this.xd(n6),t=this.xd(ir);if(!t)return e||{};for(var n=iq({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Hc=!0),n}},{key:"getFlagPayloads",value:function(){var e=this.xd(ie),t=this.xd(is);if(!t)return e||{};for(var n=iq({},e||{}),i=Object.keys(t),r=0;i.length>r;r++)n[i[r]]=t[i[r]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Hc=!0),n}},{key:"reloadFeatureFlags",value:function(){var e=this;this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(function(t){try{t()}catch(t){e.$.error("Error while running feature flags reloading callback",t)}}),this.Ad=setTimeout(function(){e.Fd()},5)))}},{key:"Sd",value:function(){clearTimeout(this.Ad),this.Ad=void 0}},{key:"onReloading",value:function(e){var t=this;return this.Wc.push(e),function(){t.Wc=t.Wc.filter(function(t){return t!==e})}}},{key:"ensureFlagsLoaded",value:function(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.Qc=e}},{key:"resetFlagCallReported",value:function(){this.Lt(ig)}},{key:"Fd",value:function(e){var t=this;this.Sd();var n=this.po;if(!(!n||this.Mr.remoteRequestsDisabled||this.ed())){if(this.Gc)return void(this.Jc=!0);var i={token:n.projectToken,distinct_id:n.distinctId,groups:n.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:tO(tO(tO({},n.initialPersonProperties),this.xd("$stored_person_properties")||{}),{},{$lib:n.library.name,$lib_version:n.library.version}),group_properties:this.xd(ia),timezone:sb()};et(n.deviceId)||(i.$device_id=n.deviceId),((null==e?void 0:e.disableFlags)||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);var r=this.Ed();r.length&&(i.evaluation_contexts=r);var s=this.Pd();et(s)||(i.flag_keys=s);var o=this.Mr.onlyEvaluateSurveyFeatureFlags,a=this.Zc;this.Gc=!0;var u=function(){t.Jc&&(t.Jc=!1,t.Fd())},l=function(e){t.Gc=!1,a===t.Zc&&(t.At((0,y._)({},iy,[a4])),t.$.error("Feature flag request failed",e),t.$d()&&t.bd(!0)),u()};try{n.sendRequest("/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(function(e){var n,r,s=null!=(n=e.json)?n:{},l=200!==e.statusCode;if(t.Gc=!1,a!==t.Zc)return void u();if(t.Od(e.statusCode),l||t.Jc||(t.$anon_distinct_id=void 0),!i.disable_flags||t.Jc){t.Kc=!l;var c=[];e.error?c.push((0,b._)(e.error,Error)&&"AbortError"===e.error.name?"timeout":(0,b._)(e.error,Error)?a4:"unknown_error"):200!==e.statusCode&&c.push("api_error_".concat(e.statusCode)),s.errorsWhileComputingFlags&&c.push("errors_while_computing_flags");var h=!!(null==(r=s.quotaLimited)?void 0:r.includes("feature_flags"));h&&c.push("quota_limited"),t.At((0,y._)({},iy,c)),h?t.$.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||t.Rd(s,l,{partialResponse:o}),u()}}).catch(l)}catch(e){l(e)}}}},{key:"ed",value:function(){return so(this.Xc,3)}},{key:"Od",value:function(e){var t=this;this.Xc=sa(e,this.Xc,3,function(){return t.$.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.")})}},{key:"getFeatureFlag",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n.fresh||this.Kc){if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+a3);if(!this.Md()){var i=this.getFeatureFlagResult(e,n);return null!=(t=null==i?void 0:i.variant)?t:null==i?void 0:i.enabled}}}},{key:"getFeatureFlagDetails",value:function(e){return this.getFlagsWithDetails()[e]}},{key:"getFeatureFlagPayload",value:function(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}},{key:"getFeatureFlagResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t.fresh||this.Kc){if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+a3);if(!this.Md()){var n,i=this.getFlagVariants(),r=e in i,s=i[e],o=this.getFlagPayloads()[e],a=String(s),u=this.xd("$feature_flag_request_id")||void 0,l=this.xd("$feature_flag_evaluated_at")||void 0,c=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var h,d=null==(h=this.po)?void 0:h.session.sessionId,f=this.xd(i_);d&&d!==f&&(c={},n=d)}if(!t.send_event&&"send_event"in t)n&&this.At((p={},(0,y._)(p,ig,c),(0,y._)(p,i_,n),p));else if(e in c&&c[e].includes(a))n&&this.At((v={},(0,y._)(v,ig,c),(0,y._)(v,i_,n),v));else{Y(c[e])?c[e].push(a):c[e]=[a],this.At(tO((0,y._)({},ig,c),n?(0,y._)({},i_,n):{}));var v,p,g,_,m,b,k,x,E,S,$,P,M,F,C,O=this.getFeatureFlagDetails(e),I=(0,w._)(null!=(g=this.xd("$feature_flag_errors"))?g:[]);et(s)&&I.push("flag_missing");var A={$feature_flag:e,$feature_flag_response:s,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:u,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!=(_=null==(m=this.Mr.bootstrap)||null==(m
2=m.featureFlags)?void 0:m[e])?_:null,$feature_flag_bootstrapped_payload:null!=(b=null==(k=this.Mr.bootstrap)||null==(k=k.featureFlagPayloads)?void 0:k[e])?b:null,$used_bootstrap_value:!this.Kc};et(null==O||null==(x=O.metadata)?void 0:x.has_experiment)||(A.$feature_flag_has_experiment=O.metadata.has_experiment),et(null==O||null==(E=O.metadata)?void 0:E.version)||(A.$feature_flag_version=O.metadata.version);var R=null!=(S=null==O||null==($=O.reason)?void 0:$.description)?S:null==O||null==(P=O.reason)?void 0:P.code;R&&(A.$feature_flag_reason=R),(null==O||null==(M=O.metadata)?void 0:M.id)&&(A.$feature_flag_id=O.metadata.id),et(null==O?void 0:O.original_variant)&&et(null==O?void 0:O.original_enabled)||(A.$feature_flag_original_response=et(O.original_variant)?O.original_enabled:O.original_variant),(null==O||null==(F=O.metadata)?void 0:F.original_payload)&&(A.$feature_flag_original_payload=null==O||null==(C=O.metadata)?void 0:C.original_payload),I.length&&(A.$feature_flag_error=I.join(",")),this.Dd(A)}return r?{key:e,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:nt(o)}:void 0}}}},{key:"Dd",value:function(e){var t,n=this;try{null==(t=this.po)||t.capture("$feature_flag_called",e).catch(function(e){n.$.error("Failed to capture feature flag call",e)})}catch(e){this.$.error("Failed to capture feature flag call",e)}}},{key:"getRemoteConfigPayload",value:function(e,t){this.Ld(e,t)}},{key:"Ld",value:function(e,t){var n=this;return em(function(){var i,r,s,o,a,u,l,c,h;return(0,E._)(this,function(d){switch(d.label){case 0:if(!(i=n.po))return[2];r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},(s=n.Ed()).length&&(r.evaluation_contexts=s),et(o=n.Pd())||(r.flag_keys=o),d.label=1;case 1:return d.trys.push([1,3,,4]),c=null,[4,i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:n.Mr.compression,sentAt:"body",timeoutMs:n.Mr.requestTimeoutMs})];case 2:return a=(null==(l=c===(u=d.sent().json)||void 0===u?void 0:u.featureFlagPayloads)?void 0:l[e])||void 0,[3,4];case 3:return h=d.sent(),[2,void n.$.error("Remote config feature flag request failed",h)];case 4:try{t(a)}catch(e){n.$.error("Remote config feature flag callback failed",e)}return[2]}})})()}},{key:"isFeatureEnabled",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.fresh&&!this.Kc)return t.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+a3),t.defaultValue;var n=this.getFeatureFlag(e,t);return et(n)?t.defaultValue:!!n}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(t){return t!==e})}},{key:"receivedFeatureFlags",value:function(e,t,n){this.Rd(e,t,n)}},{key:"Rd",value:function(e,t,n){if(this.po){this.Vc=!0;var i=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:a1,a=function(e,t){var n=e.flags;if(n){var i=Object.fromEntries(Object.keys(n).map(function(e){var t;return[e,null!=(t=n[e].variant)?t:n[e].enabled]})),r=Object.fromEntries(Object.keys(n).filter(function(e){return n[e].enabled}).filter(function(e){var t;return!et(null==(t=n[e].metadata)?void 0:t.payload)}).map(function(e){var t;return[e,null==(t=n[e].metadata)?void 0:t.payload]}));return tO(tO({},e),{},{featureFlags:i,featureFlagPayloads:r})}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,o),u=a.flags,l=a.featureFlags,c=a.featureFlagPayloads;if(l){var h=e.requestId,d=e.evaluatedAt;if(Y(l)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var f,v={};if(l)for(var p=0;l.length>p;p++)v[l[p]]=!0;return f={},(0,y._)(f,n8,l),(0,y._)(f,n6,v),(0,y._)(f,ii,!1),f}var g=l,_=c,m=u;if(null==s?void 0:s.partialResponse){var b=Object.keys(g),w=_||{};g=tO(tO({},n),g),_=tO(tO({}
2,i),w),b.forEach(function(e){e in w||null==_||delete _[e]}),m=tO(tO({},r),m)}else if(e.errorsWhileComputingFlags)if(u){var x=new Set(Object.keys(u).filter(function(e){var t;return!(null==(t=u[e])?void 0:t.failed)}));g=tO(tO({},n),Object.fromEntries(Object.entries(g).filter(function(e){var t=(0,k._)(e,1)[0];return x.has(t)})));var E=Object.fromEntries(Object.entries(_||{}).filter(function(e){var t=(0,k._)(e,1)[0];return x.has(t)}));_=tO(tO({},i),E),x.forEach(function(e){e in E||null==_||delete _[e]}),m=tO(tO({},r),Object.fromEntries(Object.entries(m||{}).filter(function(e){var t=(0,k._)(e,1)[0];return x.has(t)})))}else g=tO(tO({},n),g),_=tO(tO({},i),_),m=tO(tO({},r),m);return tO(tO((t={},(0,y._)(t,n8,Object.keys(a8(g))),(0,y._)(t,n6,g||{}),(0,y._)(t,ie,_||{}),(0,y._)(t,n7,m||{}),(0,y._)(t,ii,!0===e.minimalFlagCalledEvents),t),h?(0,y._)({},it,h):{}),d?(0,y._)({},im,d):{})}}(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(i)if(!1===(null==n?void 0:n.persist)){var r=!et(this.po.kv.get(n6));this.Cd=i,r||this.At(i)}else this.md(),this.Id(i,e,!!(null==n?void 0:n.partialResponse)),this.At(i);else t&&this.$d();t||(this.Yc=!1),this.bd(t)}}},{key:"override",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}},{key:"overrideFeatureFlags",value:function(e){this.Nd(e)}},{key:"Nd",value:function(e){if(this.po){if(!1===e)return this.Lt([ir,is]),this.bd(),void a2.info("All overrides cleared");if(Y(e))return this.At((0,y._)({},ir,a6(e))),this.bd(),void a2.info("Flag overrides set",{flags:e});if(e&&"object"==(void 0===e?"undefined":(0,x._)(e))&&("flags"in e||"payloads"in e)){this.Hc=!!(null!=(t=e.suppressWarning)&&t);var t,n={},i=e.flags,r=e.payloads;return i&&(n[ir]=Y(i)?a6(i):i),r&&(n[is]=r),Object.keys(n).length&&this.At(n),!1===i&&!1===r?this.Lt([ir,is]):!1===i?this.Lt(ir):!1===r&&this.Lt(is),this.bd(),!1===i?a2.info("Flag overrides cleared"):i&&a2.info("Flag overrides set",{flags:i}),void(!1===r?a2.info("Payload overrides cleared"):r&&a2.info("Payload overrides set",{payloads:r}))}if(e&&"object"==(void 0===e?"undefined":(0,x._)(e)))return this.At((0,y._)({},ir,e)),this.bd(),void a2.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")}},{key:"onFeatureFlags",value:function(e){var t=this;if(this.addFeatureFlagsHandler(e),this.Vc){var n=this.qd(),i=n.flags,r=n.flagVariants;try{e(i,r)}catch(e){this.$.error("Error while running feature flags callback",e)}}return function(){return t.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,t,n){var i,r,s,o=this,a=(this.xd("$early_access_features")||[]).find(function(t){return t.flagKey===e}),u=(0,y._)({},"$feature_enrollment/".concat(e),t),l={$feature_flag:e,$feature_enrollment:t,$set:u};a&&(l.$early_access_feature_name=a.name),n&&(l.$feature_enrollment_stage=n);var c=tO(tO({},this.getFlagVariants()),{},(0,y._)({},e,t));null==(i=this._instance)||null==(i=i.persistence)||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(u)}),this.At((r={},(0,y._)(r,n8,Object.keys(a8(c))),(0,y._)(r,n6,c),(0,y._)(r,io,tO(tO({},this.xd("$stored_person_properties")||{}),u)),r)),this.bd();try{null==(s=this.po)||s.capture("$feature_enrollment_update",l).catch(function(e){o.$.error("Failed to capture early access feature enrollment",e)})}catch(e){this.$.error("Failed to capture early access feature enrollment",e)}}},{key:"getEarlyAccessFeatures",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,i=this.xd(n9);!i||t?this.jd(e,n):e(i)}},{key:"jd",value:function(e,t){var n=this;return em(function(){var i,r,s,o,a;return(0,E._)(this,function(u){switch(u.label){case 0:if(!(i=n.po))return[2];r=t?"&".concat(t.map(function(e){return"stage=".concat(e)}).join("&")):"",u.label=1;case 1:return u.trys.push([1,3,,4]),[4,i.sendRequest("/api/early_access_features/?token=".concat(i.projectToken).concat(r),{target:"api",method:"GET",sentAt:"query"})];case 2:if(!(o=u.sent()).json)return[2];return s=o.json.earlyAccessFeatures,n.At((0,y._)({},n9,s)),[3,4];case 3:return a=u.sent(),[2,void n.$.error("Early access feature request failed",a)];case 4:try{e(s)}catch(e){n.$.error("Early access feature callback failed",e)}return[2]}})})()}},{key:"qd",value:function(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(function(e){return t[e]}),flagVariants:Object.keys(t).filter(function(e){return t[e]}).reduce(function(e,n){return e[n]=t[n],e},{})}}},{key:"bd",value:function(e){var t=this;this.yd();var n=this.qd(),i=n.flags,r=n.flagVariants;
2this.featureFlagEventHandlers.forEach(function(n){try{n(i,r,{errorsLoading:e})}catch(e){t.$.error("Error while running feature flags callback",e)}})}},{key:"setPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];this.Bd(e,t)}},{key:"Bd",value:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.xd("$stored_person_properties")||{},i=(null==e?void 0:e.$set)||((null==e?void 0:e.$set_once)?{}:e),r=null==e?void 0:e.$set_once,s={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in n||(s[o]=r[o]));this.At((0,y._)({},io,tO(tO(tO({},n),s),i))),t&&this.reloadFeatureFlags()}},{key:"unsetPersonPropertiesForFlags",value:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=tO({},this.xd("$stored_person_properties")||{});e.forEach(function(e){delete n[e]}),this.At((0,y._)({},io,n)),t&&this.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.Lt(io),e&&this.reloadFeatureFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.xd("$stored_group_properties")||{},i=tO({},n),r=!0,s=!1,o=void 0;try{for(var a,u=Object.keys(e)[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;i[l]=tO(tO({},n[l]),e[l])}}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}this.At((0,y._)({},ia,i)),t&&this.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var t=this.xd("$stored_group_properties")||{};this.At((0,y._)({},ia,tO(tO({},t),{},(0,y._)({},e,{}))))}else this.Lt(ia)}},{key:"reset",value:function(){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}}]),e}()},ug={sessionRecording:function(){function e(t){var n=this;if((0,g._)(this,e),this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.zd=aO,this.Ud=void 0,this.Wd=!1,this.Ke=function(){if(!(null==M?void 0:M.visibilityState)||"visible"===M.visibilityState)return!0;var e,t,n=null==S||null==(e=S.performance)||null==(t=e.getEntriesByType)?void 0:t.call(e,"visibility-state");return!(null==n?void 0:n.length)||n.some(function(e){return"visible"===e.name})}(),this.an=function(){var e,t;"visible"===(null==M?void 0:M.visibilityState)&&(n.Ke=!0,null==(e=n.Hd)||null==(t=e.setDocumentWasEverVisible)||t.call(e,!0))},!this._instance.sessionManager)throw aA.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==M?void 0:M.addEventListener)&&iX(M,"visibilitychange",this.an)}return(0,_._)(e,[{key:"Mr",get:function(){return this._instance.config}},{key:"xa",get:function(){return this._instance.persistence}},{key:"started",get:function(){var e;return!!(null==(e=this.Hd)?void 0:e.isStarted)}},{key:"status",get:function(){var e,t;return"awaiting_config"===this.zd||"missing_config"===this.zd?this.zd:null!=(e=null==(t=this.Hd)?void 0:t.status)?e:this.zd}},{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"dispose",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.discardBufferedEvents;this.Wd=!0,null==M||null==(e=M.removeEventListener)||e.call(M,"visibilitychange",this.an),void 0!==n&&n?this.Vd(!0):this.stopRecording()}},{key:"Gd",get:function(){var e,t=!!(null==(e=this._instance.get_property("$session_recording_remote_config"))?void 0:e.enabled),n=!this.Mr.disable_session_recording,i=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return S&&t&&n&&!i}},{key:"startIfEnabledOrStop",value:function(e){if(!this.Wd&&(!this.Gd||null==(t=this.Hd)||!t.isStarted)){var t,n=!et(Object.assign)&&!et(Array.from);this.Gd&&n?(this.Zd(e),aA.info("starting")):(this.zd=aO,this.stopRecording())}}},{key:"Zd",value:function(e){var t=this;if(this.Gd)if("awaiting_config"!==this.zd&&"missing_config"!==this.zd&&(this.zd=aI),(null==D||null==(n=D.__PosthogExtensions__)||null==(n=n.rrweb)?void 0:n.record)&&(null==(i=D.__PosthogExtensions__)?void 0:i.initSessionRecording))this.Qd(e);else{var n,i,r,s,o=this._instance.sessionManager;null==(r=D.__PosthogExtensions__)||null==(s=r.loadExternalDependency)||s.call(r,this._instance,this.Jd,function(n){if(!t.Wd&&t.Gd&&t._instance.sessionManager===o)return n?(t._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),aA.error("could not load recorder",n)):void t.Qd(e);t.zd="disabled"})}}},{key:"stopRecording",value:function(){var e,t;null==(e=this.Ud)||e.call(this),this.Ud=void 0,null==(t=this.Hd)||t.stop()}},{key:"Vd",value:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null==(e=this.Ud)||e.call(this),this.Ud=void 0,null==(t=this.Hd)||t.discard({discardProducerEvents:n})}},{key:"Kd",value:function(){var e,t;null==(e=this.xa)||e.unregister("$session_is_sampled"),null==(t=this.xa)||t.unregister("$replay_sample_rate")}},{key:"Yd",value:function(e,t){if(es(e))return null;var n=eo(e)?e:parseFloat(e);return"number"!=typeof n||!Number.isFinite(n)||0>n||n>1?(aA.warn("".concat(t," must be between 0 and 1. Ignoring invalid value:"),e),null):n}},{key:"Xd",value:function(e){var t=this;if(this.xa){var n,i,r=this.xa,s=function(){var n,i=!1===e.sessionRecording?void 0:e.sessionRecording,s=t.Yd(null==(n=t.Mr.session_recording)?void 0:n.sampleRate,"session_recording.sampleRate"),o=t.Yd(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=s?s:o;es(a)&&t.Kd();var u=null==i?void 0:i.minimumDurationMilliseconds;r.register((0,y._)({},n3,tO(tO({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:tO({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:a,minimumDurationMilliseconds:et(u)?null:u,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})))};s(),null==(n=this.Ud)||n.call(this),this.Ud=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}},{key:"onRemoteConfig",value:function(e){var 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",aA.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}},{key:"log",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";(null==(t=this.Hd)?void 0:t.log)?this.Hd.log(e,n):aA.warn("log called before recorder was ready")}},{key:"Jd",get:function(){var e,t,n=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(n3);return(null==n||null==(t=n.scriptConfig)?void 0:t.script)||"lazy-recorder"}},{key:"tv",value:function(){var e,t=this._instance.get_property(n3);if(!t)return!1;try{e="object"==(void 0===t?"undefined":(0,x._)(t))?t:JSON.parse(t)}catch(e){return aA.warn("persisted remote config for session recording is invali
2d and will be ignored",e),!1}return!es(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}},{key:"Qd",value:function(e){var t,n,i,r;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(null==(t=D.__PosthogExtensions__)?void 0:t.initSessionRecording))return aA.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session((0,y._)({},iC,!0));if(this.Hd||(this.Hd=null==(r=D.__PosthogExtensions__)?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",aA.info("persisted remote config is stale, requesting fresh config before starting"),void new sV(this._instance).load()}this.zd=aI,null==(n=(i=this.Hd).setDocumentWasEverVisible)||n.call(i,this.Ke),this.Hd.start(e)}else this.zd=aO}},{key:"onRRwebEmit",value:function(e){var t,n;null==(t=this.Hd)||null==(n=t.onRRwebEmit)||n.call(t,e)}},{key:"overrideLinkedFlag",value:function(){var e,t;this.Hd||null==(t=this.xa)||t.register({$replay_override_linked_flag:!0}),null==(e=this.Hd)||e.overrideLinkedFlag()}},{key:"overrideSampling",value:function(){var e,t;this.Hd||null==(t=this.xa)||t.register({$replay_override_sampling:!0}),null==(e=this.Hd)||e.overrideSampling()}},{key:"overrideTrigger",value:function(e){var t,n;this.Hd||null==(n=this.xa)||n.register((0,y._)({},"url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger",!0)),null==(t=this.Hd)||t.overrideTrigger(e)}},{key:"sdkDebugProperties",get:function(){var e;return(null==(e=this.Hd)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}},{key:"tryAddCustomEvent",value:function(e,t){var n;return!!(null==(n=this.Hd)?void 0:n.tryAddCustomEvent(e,t))}},{key:"flushBeforeIdentityReset",value:function(){var e,t;null==(e=this.Hd)||null==(t=e.flushBeforeIdentityReset)||t.call(e)}}]),e}()},u_={autocapture:function(e){function t(e){var n;return(0,g._)(this,t),(n=(0,p._)(this,t,[new ak(e)])).instance=e,n}return(0,m._)(t,e),t}(ab),historyAutocapture:function(){function e(t){(0,g._)(this,e),this._instance=t,this.ev=this.iv()}return(0,_._)(e,[{key:"initialize",value:function(){this.startIfEnabled()}},{key:"isEnabled",get:function(){var e=this.nv();return!!(e.path||e.search||this.sv(e))}},{key:"startIfEnabled",value:function(){this.isEnabled&&(nA.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}},{key:"startIfEnabledOrStop",value:function(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}},{key:"stop",value:function(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,nA.info("History API monitoring stopped")}},{key:"monitorHistoryChanges",value:function(){S&&S.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}},{key:"lv",value:function(e){if(S&&(null==(t=S.history[e])||!t.__posthog_wrapped__)){var t,n=this;aS(S.history,e,function(t){return function(i,r,s){t.call(this,i,r,s),n.hv(e)}})}}},{key:"iv",value:function(){var e=null==S?void 0:S.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}},{key:"nv",value:function(){var e=this._instance.config.capture_pageview;return"history_change"===e?{path:!0}:Q(e)?e:{}}},{key:"sv",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.nv();return!!e.hash&&!this._instance.config.disable_capture_url_hashes}},{key:"dv",value:function(e){var t=this.nv(),n=this.ev;return!(!n||!(t.path&&e.pathname!==n.pathname||t.search&&e.search!==n.search||this.sv(t)&&e.hash!==n.hash))}},{key:"hv",value:function(e){try{var t=this.iv();if(!t)return;this.dv(t)&&this._instance.capture(iD,{navigation_type:e}),this.ev=t}catch(t){nA.error("Error capturing ".concat(e," pageview"),t)}}},{key:"av",value:function(){var e=this;if(!this.rv){var t=function(){e.hv("popstate")};iX(S,"popstate",t),this.rv=function(){S&&S.removeEventListener("popstate",t)}}}},{key:"uv",value:function(){var e=this;if(!this.ov){var t=function(){e.hv("hashchange")};iX(S,"hashchange",t),this.ov=function(){S&&S.removeEventListener("hashchange",t)}}}}]),e}(),heatmaps:function(){function e(t){var n;(0,g._)(this,e),this.vv=!1,this.bo=!1,this.fv=null,this.instance=t,this.vv=!!(null==(n=this.instance.persistence)?void 0:n.props[nK]),this.rageclicks=new ag(t.config.rageclick)}return(0,_._)(e,[{key:"Mr",get:function(){return this.instance.config}},{key:"initialize",value:function(){this.startIfEnabled()}},{key:"flushIntervalMilliseconds",get:function(){var e=5e3;return Q(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}},{key:"isEnabled",get:function(){return es(this.Mr.capture_heatmaps)?es(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:!1!==this.Mr.capture_heatmaps}},{key:"startIfEnabled",value:function(){if(this.isEnabled)this.bo||(aR.info("starting..."),this.pv(),this.an());else{var e;clearInterval(null!=(e=this.fv)?e:void 0),this.gv(),this.getAndClearBuffer()}}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register((0,y._)({},nK,n)),this.vv=n,this.startIfEnabled()}}}},{key:"getAndClearBuffer",value:function(){var e=this.Rt;return this.Rt=void 0,e}},{key:"mv",value:function(e){aT(e.originalEvent)&&this.Cr(e.originalEvent,"deadclick")}},{key:"an",value:function(){this.fv&&clearInterval(this.fv),this.fv="visible"===(null==M?void 0:M.visibilityState)?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}},{key:"pv",value:function(){var e=this;S&&M&&(this.yv=this.fa.bind(this),iX(S,iL,this.yv),this.bv=function(t){return e.Cr(t||(null==S?void 0:S.event))},iX(M,"click",this.bv,{capture:!0}),this._v=function(t){return e.wv(t||(null==S?void 0:S.event))},iX(M,"mousemove",this._v,{capture:!0}),this.Sv=new r0(this.instance,rZ,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),iX(M,iT,this.xv),this.bo=!0)}},{key:"gv",value:function(){var e;S&&M&&(this.yv&&S.removeEventListener(iL,this.yv),this.bv&&M.removeEventListener("click",this.bv,{capture:!0}),this._v&&M.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&M.removeEventListener(iT,this.xv),clearTimeout(this.Cv),null==(e=this.Sv)||e.stop(),this.bo=!1)}},{key:"$v",value:function(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),s=function(e,t,n){for(var i=e;i&&r_(i)&&!ry(i,"body")&&i!==n;){var r,s,o,a=void 0;try{a=null==(r=null!=(s=null==(o=i.ownerDocument)?void 0:o.defaultView)?s:S)?void 0:r.getComputedStyle(i).position}catch(e){break}if(V(t,a))return!0;
2i=rC(i)}return!1}(r$(e),["fixed","sticky"],r);return{x:e.clientX+(s?0:i),y:e.clientY+(s?0:n),target_fixed:s,type:t}}},{key:"Cr",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"click";if(!rg(e.target)&&aT(e)){var i=this.$v(e,n);(null==(t=this.rageclicks)?void 0:t.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&rD(r$(e),this.instance.config.rageclick)&&this.Zs(tO(tO({},i),{},{type:"rageclick"})),this.Zs(i)}}},{key:"wv",value:function(e){var t=this;!rg(e.target)&&aT(e)&&(clearTimeout(this.Cv),this.Cv=setTimeout(function(){t.Zs(t.$v(e,"mousemove"))},500))}},{key:"Zs",value:function(e){if(S){var t=this.Mr.disable_capture_url_hashes?tE(S.location.href):S.location.href,n=this.Mr.custom_personal_data_properties,i=sr(t,this.Mr.mask_personal_data_properties?(0,w._)(su).concat((0,w._)(n||[])):[],sc);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(e)}}},{key:"fa",value:function(){this.Rt&&!ee(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}]),e}(),deadClicksAutocapture:r0,webVitalsAutocapture:function(){function e(t){var n,i=this;(0,g._)(this,e),this._instance=t,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=function(){clearTimeout(i.Iv),i.Iv=void 0,0!==i.Rt.metrics.length&&(i._instance.capture("$web_vitals",tO({$current_url:i.Rt.url},i.Rt.metrics.reduce(function(e,t){var n;return tO(tO({},e),{},(n={},(0,y._)(n,"$web_vitals_".concat(t.name,"_event"),tO({},t)),(0,y._)(n,"$web_vitals_".concat(t.name,"_value"),t.value),n))},{}))),i.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mv=function(e){if(i.Rt=i.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},es(null==e?void 0:e.name)||es(null==e?void 0:e.value))return void aP.error("Invalid metric received",e);var t="string"==typeof e.navigationURL?e.navigationURL:void 0,n=i.Ev(t);if(!et(n)){var r=eo(e.navigationId)||"string"==typeof e.navigationId?"navigation:".concat(e.navigationId):"url:".concat(n);if(i.Pv&&e.value>=i.Pv)return void aP.error("Ignoring metric with value >= "+i.Pv,e);i.Rt.navigationKey!==r&&(i.Tv(),i.Iv=setTimeout(i.Tv,i.flushToCaptureTimeoutMs)),et(i.Rt.navigationKey)&&(i.Rt.navigationKey=r,i.Rt.url=n),i.Rt.firstMetricTimestamp=et(i.Rt.firstMetricTimestamp)?Date.now():i.Rt.firstMetricTimestamp;var s=null==(h=i._instance.sessionManager)?void 0:h.checkAndGetSessionAndWindowId(!0),o=tO(tO(tO({},e),t?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,Q(e.attribution)&&i.attributionMetrics.indexOf(e.name)>-1){var a={},u=!0,l=!1,c=void 0;try{for(var h,d,f=aC[Symbol.iterator]();!(u=(d=f.next()).done);u=!0){var v=d.value,p="url"===v&&"string"==typeof e.attribution[v]?i.Ev(e.attribution[v]):e.attribution[v];et(p)||(a[v]=p)}}catch(e){l=!0,c=e}finally{try{u||null==f.return||f.return()}finally{if(l)throw c}}o.attribution=a}else delete o.attribution;et(s)||(o.$session_id=s.sessionId,o.$window_id=s.windowId),i.Rt.metrics.push(o),i.Rt.metrics.length===i.allowedMetrics.length&&i.Tv()}},this.Rv=function(){if(!i.bo){var e,t,n,r,s=!1,o=D.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,u=(null==a?void 0:a[i.Av])||("web-vitals"===i.Av&&et(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!et(u)){var l=u.withoutAttribution,c=i.attributionMetrics;s=!et(l),e=c.indexOf("LCP")>-1?u.onLCP:(null==l?void 0:l.onLCP)||u.onLCP,t=c.indexOf("CLS")>-1?u.onCLS:(null==l?void 0:l.onCLS)||u.onCLS,n=c.indexOf("FCP")>-1?u.onFCP:(null==l?void 0:l.onFCP)||u.onFCP,r=c.indexOf("INP")>-1?u.onINP:(null==l?void 0:l.onINP)||u.onINP}if(!(e&&t&&n&&r))return void aP.error("web vitals callbacks not loaded - not starting");var h={reportSoftNavs:i.useSoftNavs},d=s&&i.attributionMetrics.indexOf("INP")>-1?tO(tO({},h),{},{includeProcessedEventEntries:!1}):h;i.allowedMetrics.indexOf("LCP")>-1&&e(i.Mv.bind(i),h),i.allowedMetrics.indexOf("CLS")>-1&&t(i.Mv.bind(i),h),i.allowedMetrics.indexOf("FCP")>-1&&n(i.Mv.bind(i),h),i.allowedMetrics.indexOf("INP")>-1&&r(i.Mv.bind(i),d),i.bo=!0}},this.vv=!!(null==(n=this._instance.persistence)?void 0:n.props[nZ]),this.startIfEnabled()}return(0,_._)(e,[{key:"Fv",get:function(){return this._instance.config.capture_performance}},{key:"allowedMetrics",get:function(){var e,t,n=Q(this.Fv)?null==(e=this.Fv)?void 0:e.web_vitals_allowed_metrics:void 0;return es(n)?(null==(t=this._instance.persistence)?void 0:t.props.$web_vitals_allowed_metrics)||aM:n}},{key:"flushToCaptureTimeoutMs",get:function(){return(Q(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}},{key:"attributionMetrics",get:function(){var e=Q(this.Fv)?this.Fv.web_vitals_attribution:void 0;return eu(e)?e?aM:[]:Y(e)?e:aF}},{key:"useAttribution",get:function(){return this.attributionMetrics.length>0}}
2,{key:"useSoftNavs",get:function(){var e=Q(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return null!=e&&e}},{key:"Pv",get:function(){var e=Q(this.Fv)&&eo(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}},{key:"isEnabled",get:function(){var e=null==F?void 0:F.protocol;if("http:"!==e&&"https:"!==e)return aP.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=Q(this.Fv)?this.Fv.web_vitals:eu(this.Fv)?this.Fv:void 0;return eu(t)?t:this.vv}},{key:"startIfEnabled",value:function(){this.isEnabled&&!this.bo&&(aP.info("enabled, starting..."),this.No(this.Rv))}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=Q(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Q(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register((0,y._)({},nZ,n)),this._instance.persistence.register((0,y._)({},n2,i))),this.vv=n,this.startIfEnabled()}}}},{key:"Av",get:function(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}},{key:"No",value:function(e){var t,n=D.__PosthogExtensions__,i=this.Av,r=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor;(null==r?void 0:r[i])||"web-vitals"===i&&et(r)&&(null==n?void 0:n.postHogWebVitalsCallbacks)?e():null==n||null==(t=n.loadExternalDependency)||t.call(n,this._instance,i,function(t){t?aP.error("failed to load script",t):e()})}},{key:"Ev",value:function(e){var t=e||(null==S?void 0:S.location.href);if(!t)return void aP.error("Could not determine current URL");var n=this._instance.config.disable_capture_url_hashes?tE(t):t,i=this._instance.config.custom_personal_data_properties;return sr(n,this._instance.config.mask_personal_data_properties?(0,w._)(su).concat((0,w._)(i||[])):[],sc)}}]),e}()},uy={exceptionObserver:function(){function e(t){var n,i=this;(0,g._)(this,e),this.Rv=function(){if(S&&i.isEnabled&&(null==(e=D.__PosthogExtensions__)?void 0:e.errorWrappingFunctions)){var e,t=D.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=D.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=D.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!i.Ov&&i.Mr.capture_unhandled_errors&&(i.Ov=t(i.captureException.bind(i))),!i.Dv&&i.Mr.capture_unhandled_rejections&&(i.Dv=n(i.captureException.bind(i))),!i.Lv&&i.Mr.capture_console_errors&&(i.Lv=r(i.captureException.bind(i)))}catch(e){aw.error("failed to start",e),i.Nv()}}},this._instance=t,this.qv=!!(null==(n=this._instance.persistence)?void 0:n.props[nX]),this.wt=new ex(tO(tO({},function(){var e,t,n,i,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{refillRate:null!=(e=null!=(t=r.exceptionRateLimiterRefillRate)?t:r.__exceptionRateLimiterRefillRate)?e:1,bucketSize:null!=(n=null!=(i=r.exceptionRateLimiterBucketSize)?i:r.__exceptionRateLimiterBucketSize)?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:aw})),this.Mr=this.jv(),this.startIfEnabledOrStop()}return(0,_._)(e,[{key:"jv",value:function(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Q(e)?t=tO(tO({},t),e):(et(e)?this.qv:e)&&(t=tO(tO({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}},{key:"isEnabled",get:function(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}},{key:"startIfEnabledOrStop",value:function(){this.isEnabled?(aw.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}},{key:"No",value:function(e){var t,n,i;(null==(t=D.__PosthogExtensions__)?void 0:t.errorWrappingFunctions)?e():null==(n=D.__PosthogExtensions__)||null==(i=n.loadExternalDependency)||i.call(n,this._instance,"exception-autocapture",function(t){if(t)return aw.error("failed to load script",t);e()})}},{key:"Nv",value:function(){var e,t,n;null==(e=this.Ov)||e.call(this),this.Ov=void 0,null==(t=this.Dv)||t.call(this),this.Dv=void 0,null==(n=this.Lv)||n.call(this),this.Lv=void 0}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.qv=!!t.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register((0,y._)({},nX,this.qv)),this.Mr=this.jv(),this.startIfEnabledOrStop())}}},{key:"onConfigChange",value:function(){this.Mr=this.jv()}},{key:"captureException",value:function(e){try{var t,n,i,r=null!=(t=null==e||null==(n=e.$exception_list)||null==(n=n[0])?void 0:n.type)?t:"Exception";if(this.wt.consumeRateLimit(r))return void aw.info("Skipping exception capture because of client rate limiting.",{exception:r});null==(i=this._instance.exceptions)||i.sendExceptionEvent(e)}catch(e){}}}]),e}(),exceptions:function(){function e(t){var n,i;(0,g._)(this,e),this.Bv=[],this.Hv=new tI([new tK,new t5,new tJ,new tX,new t2,new t1,new tZ,new t3],function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return function(t){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],s=t.split("\n"),o=Math.min(s.length,i+1e3),a=[],u=i;o>u;u++){var l=s[u];if(!(l.length>1024)){var c=tV.test(l)?l.replace(tV,"$1"):l;if(!c.match(/\S*Error: /)){var h=!0,d=!1,f=void 0;try{for(var v,p=n[Symbol.iterator]();!(h=(v=p.next()).done);h=!0){var g=(0,v.value)(c,e);if(g){r.push(g);var _=function(e){for(var t=1;10>=t;t++){var n=e.length-2*t;if(0>n)break;for(var i=!0,r=0;t>r;r++)if(!tU(e[n+r],e[n+t+r])){i=!1;break}if(i){for(var s=0;t>s;s++)e[n+s]=e[n+t+s];return e.length=n+t,{start:n,length:t}}}}(r);if(_){for(var y=a.length-1;y>=0;y--){var m=a[y];if(_.start>=m.start+m.length)break;a.pop()}a.push(_)}break}}}catch(e){d=!0,f=e}finally{try{h||null==p.return||p.return()}finally{if(d)throw f}}if(function(e,t){var n=t[0],i=e.length-(n?tW(e,n):0),r=!0,s=!1,o=void 0;try{for(var a,u=t[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var l=a.value;i-=tG(e,l)}
2}catch(e){s=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(s)throw o}}return i}(r,a)>=50)break}}}var b=(0,w._)(a).sort(function(e,t){return t.start-e.start}),k=b[b.length-1];if(k){var x=tW(r,k);r.splice(k.start-x,x);var E=!0,S=!1,$=void 0;try{for(var P,M=b[Symbol.iterator]();!(E=(P=M.next()).done);E=!0){var F=P.value;F.start-=x}}catch(e){S=!0,$=e}finally{try{E||null==M.return||M.return()}finally{if(S)throw $}}}var C=!0,O=!1,I=void 0;try{for(var A,R=b[Symbol.iterator]();!(C=(A=R.next()).done);C=!0){var T=A.value;!function(e,t){var n=t.start+t.length,i=tG(e,t);i&&e.splice(n+i===e.length?n:t.start,i)}(r,T)}}catch(e){O=!0,I=e}finally{try{C||null==R.return||R.return()}finally{if(O)throw I}}return a.some(function(e){return 0===e.start&&r.length===e.length})&&function(e){for(var t=e.map(function(e){return"".concat(e.function,"|").concat(e.filename,"|").concat(e.lineno,"|").concat(e.colno,"|").concat(e.module)}),n=0,i=1;t.length>i;i++)(function(e,t,n){for(var i=0;e.length>i;i++){var r=e[(t+i)%e.length],s=e[(n+i)%e.length];if(r!==s)return s>r}return!1})(t,i,n)&&(n=i);e.push.apply(e,(0,w._)(e.splice(0,n)))}(r),function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(function(e){return tO(tO({},e),{},{filename:e.filename||(t[t.length-1]||{}).filename,function:e.function||"?"})})}(r)}}("web:javascript",tB,tq)),this._instance=t,this.Bv=null!=(n=null==(i=this._instance.persistence)?void 0:i.get_property("$error_tracking_suppression_rules"))?n:[],this.zv=t7(this.Uv()),this.Wv=new ne(this.zv)}return(0,_._)(e,[{key:"onConfigChange",value:function(){this.zv=t7(this.Uv()),this.Wv.setConfig(this.zv)}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t,n,i,r,s=e.config;if("errorTracking"in s){var o=null!=(t=null==(n=s.errorTracking)?void 0:n.suppressionRules)?t:[],a=null==(i=s.errorTracking)?void 0:i.captureExtensionExceptions;this.Bv=o,this._instance.persistence&&this._instance.persistence.register((r={},(0,y._)(r,nJ,this.Bv),(0,y._)(r,nY,a),r))}}}},{key:"Vv",get:function(){var e,t=!!this._instance.get_property(nY),n=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=n?n:t)&&e}},{key:"buildProperties",value:function(e,t){return this.Hv.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}},{key:"addExceptionStep",value:function(e,t){if(this.zv.enabled)try{if(!en(e)||0===e.trim().length)return void a7.warn("Ignoring exception step because message must be a non-empty string");var n,i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce(function(n,i){return t8.has(i)?t.push(i):n[i]=e[i],n},{}),droppedKeys:t}}(this.Gv(t)),r=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&a7.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Wv.add(tO((n={},(0,y._)(n,t4,e),(0,y._)(n,t6,(new Date).toISOString()),n),r))}catch(e){a7.error("Failed to add exception step. Ignoring breadcrumb.",e)}}},{key:"sendExceptionEvent",value:function(e){try{var t,n=e.$exception_list;if(this.Zv(n)){if(this.Qv(n))return this.Jv("Exception dropped: matched a suppression rule"),void a7.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(n))return this.Jv("Exception dropped: thrown by a browser extension"),void a7.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Yv(n))return this.Jv("Exception dropped: thrown by an injected browser script"),void a7.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Xv(n))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void a7.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.zv.enabled&&es(e.$exception_steps)?this.tf(e):e,r=(t=globalThis._posthogReleaseId,"string"==typeof t&&t.length>0?t:void 0);r&&(i.$release_id=r);try{var s=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",eh:!0});return s&&this.Wv.clear(),s}catch(e){return a9(e)||a7.error("Failed to capture exception event. Dropping this exception.",e),void this.Wv.clear()}}catch(e){return void(a9(e)||a7.error("Failed to process exception event. Ignoring this exception.",e))}}},{key:"tf",value:function(e){try{var t=this.Wv.getAttachable();return 0===t.length?e:tO(tO({},e),{},{$exception_steps:t})}catch(t){return a7.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}},{key:"Jv",value:function(e){var t;this.zv.enabled&&this.Wv.add((t={},(0,y._)(t,t4,e),(0,y._)(t,t6,(new Date).toISOString()),t))}},{key:"Gv",value:function(e){return Q(e)?tO({},e):{}}},{key:"Uv",value:function(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}},{key:"Qv",value:function(e){if(0===e.length)return!1;try{var t=e.reduce(function(e,t){var n=t.type,i=t.value;return en(n)&&n.length>0&&e.$exception_types.push(n),en(i)&&i.length>0&&e.$exception_values.push(i),e},{$exception_types:[],$exception_values:[]});return this.Bv.some(function(e){var n=e.values.map(function(e){var n=oq[e.operator],i=t[e.key];if(!n||!i)return!1;var r=Y(e.value)?e.value:[e.value];return r.length>0&&n(r,i)});return"OR"===e.type?n.some(Boolean):n.every(Boolean)})}catch(e){return a7.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}},{key:"Kv",value:function(e){var t=e.flatMap(function(e){var t,n;return null!=(t=null==(n=e.stacktrace)?void 0:n.frames)?t:[]}),n=t.filter(function(e){var t=e.filename;return!!t&&un.some(function(e){return t.startsWith(e)})});return 0!==n.length&&(!n.every(function(e){var t=e.filename;return!!t&&t.startsWith(ue)})||e.some(function(e){var t=e.type,n=e.value;return"NoResponse"===t||en(n)&&ut.some(function(e){var t=e.value;return e.exact?n===t:n.includes(t)})})&&!t.some(function(e){var t=e.in_app,n=e.filename;return t&&!(null==n?void 0:n.startsWith(ue))}))}},{key:"Yv",value:function(e){return e.some(function(e){var t=e.value;return en(t)&&ui.some(function(e){return t.includes(e)})})}},{key:"Xv",value:function(e){if(e.length>0){var t,n,i,r,s=null!=(t=null==(n=e[0].stacktrace)?void 0:n.frames)?t:[],o=s[s.length-1];return null!=(i=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&i}return!1}},{key:"Zv",value:function(e){return!es(e)&&Y(e)}}]),e}()},um=tO({productTours:function(){function e(t){(0,g._)(this,e),this.ef=null,this.if=null,this._instance=t}return(0,_._)(e,[{key:"xa",get:function(){return this._instance.persistence}},{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(e.ok){var t,n,i=e.config;if("productTours"in i){if(this.xa&&this.xa.register((0,y._)({},n0,!!i.productTours)),!aD(this._instance))return!this.ef&&es(null==(t=this.xa)?void 0:t.props.ph_product_tours)||aL.info("product tours disabled; stopping and clearing cached tours"),null==(n=this.ef)||n.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}}},{key:"loadIfEnabled",value:function(){var e=this;!this.ef&&aD(this._instance)&&this.No(function(){return e.nf()})}},{key:"No",value:function(e){var t,n,i;(null==(t=D.__PosthogExtensions__)?void 0:t.generateProductTours)?e():null==(n=D.__PosthogExtensions__)||null==(i=n.loadExternalDependency)||i.call(n,this._instance,"product-tours",function(t){t?aL.error("Could not load product tours script",t):e()})}},{key:"nf",value:function(){var e;!this.ef&&(null==(e=D.__PosthogExtensions__)?void 0:e.generateProductTours)&&(this.ef=D.__PosthogExtensions__.generateProductTours(this._instance,!0))}},{key:"getProductTours",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(Y(this.if)&&!n)return void e(this.if,{isLoaded:!0});var i=this.xa;if(i){var r=i.props[ip];if(Y(r)&&!n)return this.if=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token=".concat(this._instance.config.token)),method:"GET",timestampMode:"query",callback:function(n){if(!aD(t._instance))return void e([],{isLoaded:!0});var r=n.statusCode;if(200!==r||!n.json){var s="Product Tours API could not be loaded, status: ".concat(r);return 0===r?n.error||aL.warn(s):aL.error(s),void e([],{isLoaded:!1,error:s})}var o=Y(n.json.product_tours)?n.json.product_tours:[];t.if=o,i&&i.register((0,y._)({},ip,o)),e(o,{isLoaded:!0})}})}},{key:"getActiveProductTours",value:function(e){es(this.ef)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(e)}},{key:"showProductTour",value:function(e){var t;null==(t=this.ef)||t.showTourById(e)}},{key:"previewTour",value:function(e){var t=this;this.ef?this.ef.previewTour(e):this.No(function(){var n;t.nf(),null==(n=t.ef)||n.previewTour(e)})}},{key:"dismissProductTour",value:function(){var e;null==(e=this.ef)||e.dismissTour("user_clicked_skip")}},{key:"nextStep",value:function(){var e;null==(e=this.ef)||e.nextStep()}},{key:"previousStep",value:function(){var e;null==(e=this.ef)||e.previousStep()}},{key:"clearCache",value:function(){var e;this.if=null,null==(e=this.xa)||e.unregister("ph_product_tours")}},{key:"resetTour",value:function(e){var t;null==(t=this.ef)||t.resetTour(e)}},{key:"resetAllTours",value:function(){var e;null==(e=this.ef)||e.resetAllTours()}},{key:"cancelPendingTour",value:function(e){var t;null==(t=this.ef)||t.cancelPendingTour(e)}}]),e}()},up),ub={siteApps:function(){function e(t){(0,g._)(this,e),this._instance=t,this.sf=0,this.rf=[],this.apps={}}return(0,_._)(e,[{key:"isEnabled",get:function(){return!!this._instance.config.opt_in_site_apps}},{key:"lf",value:function(e,t){if(t){var n=this.globalsForEvent(t);this.rf.push(n),this.rf.length>1e3&&(this.rf=this.rf.slice(10))}}},{key:"siteAppLoaders",get:function(){var e;return null==(e=D._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}},{key:"initialize",value:function(){var e=this;if(this.isEnabled){var t=this._instance._addCaptureHook(this.lf.bind(this));this.af=function(){t(),e.rf=[],e.af=void 0}}}},{key:"globalsForEvent",value:function(e){if(!e)throw Error("Event payload is required");var t={},n=this._instance.get_property("$groups")||[],i=this._instance.get_property("$stored_group_properties")||{},r=!0,s=!1,o=void 0;try{for(var a,u,l,c,h,d,f,v,p=Object.entries(i)[Symbol.iterator]();!(r=(v=p.next()).done);r=!0){var g=(0,k._)(v.value,2),_=g[0],y=g[1];t[_]={id:n[_],type:_,properties:y}}}catch(e){s=!0,o=e}finally{try{r||null==p.return||p.return()}finally{if(s)throw o}}var m=e.$set_once,b=e.$set;return{event:tO(tO({},nf(e,aN)),{},{properties:tO(tO(tO({},e.properties),b?{$set:tO(tO({},null!=(a=null==(u=e.properties)?void 0:u.$set)?a:{}),b)}:{}),m?{$set_once:tO(tO({},null!=(l=null==(c=e.properties)?void 0:c.$set_once)?l:{}),m)}:{}),elements_chain:null!=(h=null==(d=e.properties)?void 0:d.$elements_chain)?h:"",distinct_id:null==(f=e.properties)?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:t}}},{key:"uf",value:function(e){var t,n=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===n&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(aj.error("prepare_external_dependency_stylesheet returned null"),null):"script"===n&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(aj.error("prepare_external_dependency_script returned null"),null):e}},{key:"hf",value:function(){var e,t,n,i,r,s,o,a,u=this;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return function(){};var l=null==M?void 0:M.defaultView,c=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!c)return function(){};if(this.sf++,this.cf)return this.df();var h=[],d=this,f=new WeakSet,v=function(e,t,n){if(null==e?void 0:e[t]){var i=e[t];e[t]=n(i),h.push(function(){e[t]=i})}},p=function(e){if(f.has(e))return e;var t=d.uf(e);return t&&f.add(t),t},g=function(e){return e.map(function(e){return"string"==typeof e?e:p(e)}).filter(function(e){return!er(e)})};return v(c,"appendChild",function(e){return function(t){var n=p(t);return n?e.call(this,n):t}}
2),v(c,"insertBefore",function(e){return function(t,n){var i=p(t);return i?e.call(this,i,n):t}}),v(c,"replaceChild",function(e){return function(t,n){var i=p(t);return i?e.call(this,i,n):n}}),[null==(t=l.Element)?void 0:t.prototype,null==(n=l.Document)?void 0:n.prototype,null==(i=l.DocumentFragment)?void 0:i.prototype].forEach(function(e){v(e,"append",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(this,g(n))}}),v(e,"prepend",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(this,g(n))}})}),[null==(r=l.Element)?void 0:r.prototype,null==(s=l.CharacterData)?void 0:s.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(function(e){v(e,"before",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(this,g(n))}}),v(e,"after",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(this,g(n))}}),v(e,"replaceWith",function(e){return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=g(n);return n.length&&!r.length?void 0:e.apply(this,r)}})}),v(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",function(e){return function(t,n){var i=p(n);return i?e.call(this,t,i):null}}),this.cf=function(){h.forEach(function(e){return e()}),u.cf=void 0},this.df()}},{key:"df",value:function(){var e=this,t=!1;return function(){var n;t||(t=!0,e.sf--,0===e.sf&&(null==(n=e.cf)||n.call(e)))}}},{key:"vf",value:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.hf();try{var i=e(n);return t&&n(),i}catch(e){throw n(),e}}},{key:"setupSiteApp",value:function(e){var t=this,n=this.apps[e.id],i=function(){var i;!n.errored&&t.rf.length&&(aj.info("Processing ".concat(t.rf.length," events for site app with id ").concat(e.id)),t.rf.forEach(function(e){return t.vf(function(){var t;return null==(t=n.processEvent)?void 0:t.call(n,e)})}),n.processedBuffer=!0),Object.values(t.apps).every(function(e){return e.processedBuffer||e.errored})&&(null==(i=t.af)||i.call(t))},r=!1,s=function(t){n.errored=!t,n.loaded=!0,aj.info("Site app with id ".concat(e.id," ").concat(t?"loaded":"errored")),r&&i()};try{var o=this.vf(function(n){return e.init({posthog:t._instance,callback:function(e){n(),s(e)}})},!1).processEvent;o&&(n.processEvent=o),r=!0}catch(t){aj.error(aB+e.id,t),s(!1)}if(r&&n.loaded)try{i()}catch(t){aj.error("Error while processing buffered events PostHog app with config id ".concat(e.id),t),n.errored=!0}}},{key:"ff",value:function(){var e=this.siteAppLoaders||[],t=!0,n=!1,i=void 0;try{for(var r,s=e[Symbol.iterator]();!(t=(r=s.next()).done);t=!0){var o=r.value;this.apps[o.id]={id:o.id,loaded:!1,errored:!1,processedBuffer:!1}}}catch(e){n=!0,i=e}finally{try{t||null==s.return||s.return()}finally{if(n)throw i}}var a=!0,u=!1,l=void 0;try{for(var c,h=e[Symbol.iterator]();!(a=(c=h.next()).done);a=!0){var d=c.value;this.setupSiteApp(d)}}catch(e){u=!0,l=e}finally{try{a||null==h.return||h.return()}finally{if(u)throw l}}}},{key:"pf",value:function(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e),n=!0,i=!1,r=void 0;try{for(var s,o,a=Object.values(this.apps)[Symbol.iterator]();!(n=(o=a.next()).done);n=!0)s=this,function(){var n=o.value;try{s.vf(function(){var e;return null==(e=n.processEvent)?void 0:e.call(n,t)})}catch(t){aj.error("Error while processing event ".concat(e.event," for site app ").concat(n.id),t)}}()}catch(e){i=!0,r=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw r}}}}},{key:"onRemoteConfig",value:function(e){var t=this;if(null==(o=this.siteAppLoaders)?void 0:o.length)return this.isEnabled?(this.ff(),void this._instance.on("eventCaptured",function(e){return t.pf(e)})):void aj.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(a=this.af)||a.call(this),e.ok){var n=e.config,i=!0,r=!1,s=void 0;if(null==(u=n.siteApps)?void 0:u.length)if(this.isEnabled)try{for(var o,a,u,l,c,h=n.siteApps[Symbol.iterator]();!(i=(c=h.next()).done);i=!0)l=this,function(){var e,t,n=c.value,i=n.id,r=n.url;D["__$$ph_site_app_".concat(i)]=l._instance,null==(e=D.__PosthogExtensions__)||null==(t=e.loadSiteApp)||t.call(e,l._instance,r,function(e){if(e)return aj.error(aB+i,e)})}()}catch(e){r=!0,s=e}finally{try{i||null==h.return||h.return()}finally{if(r)throw s}}else aj.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}]),e}()},uk={tracingHeaders:function(){function e(t){var n=this;(0,g._)(this,e),this._instance=t,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=function(){var e,t,i=n.bf();i?(et(n.gf)&&(n.gf=null==(e=D.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,function(){return n._instance.get_distinct_id()},n._instance.sessionManager)),et(n.mf)&&(n.mf=null==(t=D.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,function(){return n._instance.get_distinct_id()},n._instance.sessionManager))):n.Nv()}}return(0,_._)(e,[{key:"initialize",value:function(){this.startIfEnabledOrStop()}},{key:"No",value:function(e){var t,n,i;(null==(t=D.__PosthogExtensions__)?void 0:t.tracingHeadersPatchFns)?e():null==(n=D.__PosthogExtensions__)||null==(i=n.loadExternalDependency)||i.call(n,this._instance,"tracing-headers",function(t){if(t)return a$.error("failed to load script",t);e()})}},{key:"_f",value:function(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}},{key:"bf",value:function(){var e,t=this._f();return Y(t)?(Y(this.yf)?(e=this.yf).splice.apply(e,[0,this.yf.length].concat((0,w._)(t))):this.yf=(0,w._)(t),t.length>0?this.yf:void 0):(Y(this.yf)&&this.yf.splice(0),this.yf=t||void 0,this.yf)}},{key:"Nv",value:function(){var e,t;null==(e=this.gf)||e.call(this),null==(t=this.mf)||t.call(this),this.gf=void 0,this.mf=void 0}},{key:"startIfEnabledOrStop",value:function(){this.bf()?this.No(this.Rv):this.Nv()}}]),e}()},uw=tO({surveys:function(e){function t(e){var n;return(0,g._)(this,t),(n=(0,p._)(this,t,[new aX(e),{get projectToken(){return e.config.token},kv:new aK(e)}]))._instance=e,n}return(0,m._)(t,e),(0,_._)(t,[{key:"Mh",value:function(e,t){var n=this,i=t.query?o_(e,t.query):e;return new Promise(function(e){var r;n._instance._send_request({method:t.method,url:n._instance.requestRouter.endpointFor(null!=(r=t.target)?r:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:e})})}}]),t}(aV)},up),ux={toolbar:function(){function e(t){(0,g._)(this,e),this.instance=t}return(0,_._)(e,[{key:"wf",value:function(e){D.ph_toolbar_state=e}},{key:"kf",value:function(){var e;return null!=(e=D.ph_toolbar_state)?e:0}},{key:"initialize",value:function(){return this.maybeLoadToolbar()}},{key:"maybeLoadToolbar",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(iJ(this.instance.config)||!S||!M)return!1;e=null!=(i=e)?i:S.location,n=null!=(r=n)?r:S.history;try{if(!t){try{S.localStorage.setItem("test","test"),S.localStorage.removeItem("test")}catch(e){return!1}t=null==S?void 0:S.localStorage}var i,r,s,o=aJ||ss(e.hash,"__posthog")||ss(e.hash,"state"),a=o?tS(function(){return JSON.parse(atob(decodeURIComponent(o)))})||tS(function(){return JSON.parse(decodeURIComponent(o))}):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(aY)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}},{key:"Sf",value:function(e){var t=D.ph_load_toolbar||D.ph_load_editor;!es(t)&&Z(t)?t(e,this.instance):aZ.warn("No toolbar load function found")}},{key:"loadToolbar",value:function(e){var t,n,i=this,r=!!(null==M?void 0:M.getElementById("__POSTHOG_TOOLBAR__"));if(!S||r)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,o=tO(tO({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});return(S.localStorage.setItem(aY,JSON.stringify(tO(tO({},o),{},{source:void 0}))),2===this.kf())?this.Sf(o):0===this.kf()&&(this.wf(1),null==(t=D.__PosthogExtensions__)||null==(n=t.loadExternalDependency)||n.call(t,this.instance,"toolbar",function(e){e?(aZ.error("[Toolbar] Failed to load",e),i.wf(0)):(i.wf(2),i.Sf(o))}),iX(S,"turbolinks:load",function(){i.wf(0),i.loadToolbar(o)})),!0}},{key:"xf",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,n)}}]),e}()},uE=tO({experiments:function(){function e(t){var n=this,i=this;(0,g._)(this,e),this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i.getWebExperiments(function(t){e.Cf("retrieved web experiments from the server"),i.$f=new Map,t.forEach(function(t){if(t.feature_flag_
2key){i.$f&&(e.Cf("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(n=i.$f)||n.set(t.feature_flag_key,t));var n,r=i._instance.getFeatureFlag(t.feature_flag_key);en(r)&&t.variants[r]&&i.Tf(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var o=t.variants[s];e.If(o,i._instance)&&i.Tf(t.name,s,o.transforms)}})},t)},this._instance.onFeatureFlags(function(e){n.onFeatureFlags(e)})}return(0,_._)(e,[{key:"Mr",get:function(){return this._instance.config}},{key:"initialize",value:function(){}},{key:"onFeatureFlags",value:function(t){var n=this;if(this._is_bot())e.Cf(ur);else if(!this.Mr.disable_web_experiments){if(es(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Cf("applying feature flags",t),t.forEach(function(e){var t;if(n.$f&&(null==(t=n.$f)?void 0:t.has(e))){var i,r=n._instance.getFeatureFlag(e),s=null==(i=n.$f)?void 0:i.get(e);r&&(null==s?void 0:s.variants[r])&&n.Tf(s.name,r,s.variants[r].transforms)}})}}},{key:"previewWebExperiment",value:function(){var t=this,n=e.getWindowLocation();if(null==n?void 0:n.search){var i=si(null==n?void 0:n.search,"__experiment_id"),r=si(null==n?void 0:n.search,"__experiment_variant");i&&r&&(e.Cf("previewing web experiments ".concat(i," && ").concat(r)),this.getWebExperiments(function(e){t.Mf(parseInt(i),r,e)},!1,!0))}}},{key:"loadIfEnabled",value:function(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}},{key:"getWebExperiments",value:function(e,t,n){if(this.Mr.disable_web_experiments&&!n)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.Mr.token)),method:"GET",timestampMode:"query",callback:function(t){return e(200===t.statusCode&&t.json&&t.json.experiments||[])}})}},{key:"Mf",value:function(t,n,i){var r=i.filter(function(e){return e.id===t});r&&r.length>0&&(e.Cf("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(n,"]")),this.Tf(r[0].name,n,r[0].variants[n].transforms))}},{key:"Tf",value:function(t,n,i){this._is_bot()?e.Cf(ur):"control"!==n?i.forEach(function(i){if(i.selector){e.Cf("applying transform of variant ".concat(n," for experiment ").concat(t," "),i);var r,s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(function(e){i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):e.Cf("Control variants leave the page unmodified.")}},{key:"_is_bot",value:function(){return P&&this._instance?oN(P,this.Mr.custom_blocked_useragents):void 0}}],[{key:"If",value:function(t,n){return!es(t.conditions)&&e.Ef(t,n)&&e.Pf(t)}},{key:"Ef",value:function(t,n){if(es(t.conditions)||es(null==(r=t.conditions)?void 0:r.url))return!0;var i=e.getWindowLocation();if(i){var r,s,o,a,u=rp(n,i.href);return!(null==(s=t.conditions)?void 0:s.url)||us[null!=(o=null==(a=t.conditions)?void 0:a.urlMatchType)?o:"icontains"](t.conditions.url,u)}return!1}},{key:"getWindowLocation",value:function(){return null==S?void 0:S.location}},{key:"Pf",value:function(e){if(es(e.conditions)||es(null==(n=e.conditions)?void 0:n.utm))return!0;var t=sd();if(t.utm_source){var n,i,r,s,o,a,u,l,c,h=!(null==(i=e.conditions)||null==(i=i.utm)?void 0:i.utm_campaign)||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,d=!(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_source)||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==t.utm_source,f=!(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_medium)||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_medium)==t.utm_medium,v=!(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_term)||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return h&&f&&v&&d}return!1}},{key:"Cf",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];nA.info("[WebExperiments] ".concat(e),n)}}]),e}()},up),uS={conversations:function(){function e(t){(0,g._)(this,e),this._instance=t,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}return(0,_._)(e,[{key:"initialize",value:function(){this.loadIfEnabled()}},{key:"onRemoteConfig",value:function(e){if(!this._instance.config.disable_conversations&&(this.Of=e.ok,e.ok)){var t=e.config.conversations;es(t)||(eu(t)?this.Rf=t:(this.Rf=t.enabled,this.ne=t),this.loadIfEnabled())}}},{key:"reset",value:function(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}},{key:"loadIfEnabled",value:function(){var e=this;if(!(this._conversationsManager||this.Af||this._instance.config.disable_conversations||iJ(this._instance.config))&&
2!(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==D?void 0:D.__PosthogExtensions__;if(t&&!et(this.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{var n=t.initConversations;if(n)return this.Df(n),void(this.Af=!1);var i=t.loadExternalDependency;if(!i)return void this.Lf(iO);i(this._instance,"conversations",function(n){n||!t.initConversations?e.Lf("Could not load conversations script",n):e.Df(t.initConversations),e.Af=!1})}catch(e){this.Lf("Error initializing conversations",e),this.Af=!1}}else uo.error("Conversations enabled but missing token in remote config.")}}},{key:"Df",value:function(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Ff=!1,uo.info("Conversations loaded successfully")}catch(e){this.Lf("Error completing conversations initialization",e)}else uo.error("Cannot complete initialization: remote config is null")}},{key:"Lf",value:function(e,t){uo.error(e,t),this._conversationsManager=null,this.Af=!1,this.Ff=!0}},{key:"show",value:function(){this._conversationsManager?this._conversationsManager.show():uo.warn("Conversations not loaded yet.")}},{key:"hide",value:function(){this._conversationsManager&&this._conversationsManager.hide()}},{key:"isAvailable",value:function(){return!0===this.Rf&&!er(this._conversationsManager)}},{key:"getUnavailableReason",value:function(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":iJ(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Of?"remote_config_failed":et(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?es(this.ne)||!this.ne.token?"missing_token":(null==D?void 0:D.__PosthogExtensions__)?this.Af?"initializing":this.Ff?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}},{key:"isVisible",value:function(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}},{key:"sendMessage",value:function(e,t,n){var i=this;return em(function(){return(0,E._)(this,function(r){return[2,i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(uo.warn(ua),null)]})})()}},{key:"getMessages",value:function(e,t){var n=this;return em(function(){return(0,E._)(this,function(i){return[2,n._conversationsManager?n._conversationsManager.getMessages(e,t):(uo.warn(ua),null)]})})()}},{key:"markAsRead",value:function(e){var t=this;return em(function(){return(0,E._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.markAsRead(e):(uo.warn(ua),null)]})})()}},{key:"getTickets",value:function(e){var t=this;return em(function(){return(0,E._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.getTickets(e):(uo.warn(ua),null)]})})()}},{key:"requestRestoreLink",value:function(e){var t=this;return em(function(){return(0,E._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(uo.warn(ua),null)]})})()}},{key:"restoreFromToken",value:function(e){var t=this;return em(function(){return(0,E._)(this,function(n){return[2,t._conversationsManager?t._conversationsManager.restoreFromToken(e):(uo.warn(ua),null)]})})()}},{key:"restoreFromUrlToken",value:function(){var e=this;return em(function(){return(0,E._)(this,function(t){return[2,e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(uo.warn(ua),null)]})})()}},{key:"getCurrentTicketId",value:function(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}},{key:"getWidgetSessionId",value:function(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}},{key:"dh",value:function(){var e;null==(e=this._conversationsManager)||e.setIdentity()}},{key:"fh",value:function(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}]),e}()},u$={logs:function(){function e(t){var n,i=this,r=this;(0,g._)(this,e),this._instance=t,this.name="logs",this.Nf=!1,this.qf=!1,this.jf=!1,this.$=nR("[logs]"),this.Bf=tO(tO({},this.$),{},{error:function(){for(var e,t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];n.some(uv)||(e=r.$).error.apply(e,(0,w._)(n))}}),this.ia=[],this.Hf=[],this.Xc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=function(){var e,t;i.So||(i.Xc=0,null==(e=i.Zf)||e.onReconnect(),null==(t=i.Qf)||t.onReconnect())},this._instance&&(null==(n=this._instance.config.logs)?void 0:n.captureConsoleLogs)&&(this.Nf=!0),S&&iX(S,"online",this.Gf)}return(0,_._)(e,[{key:"Jf",value:function(e,t,n,i){var r,s=this,o=uu(null==(r=this._instance)||null==(r=r.config)?void 0:r.logs,n);return[new nP(this.Kf(e,t),o,this.Bf,function(){return s.Yf()},function(e){return e()},void 0,i),o]}},{key:"Xf",value:function(){var e,t,n,i=this,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.Zf&&this.tp===r||(null==(t=this.Zf)||t.reset(),this.tp=r,n=(0,k._)(this.Jf(function(){return i.ia},function(e){i.ia=e}),2),this.Zf=n[0],this.ep=n[1]),this.Zf}},{key:"np",value:function(){var e,t,n,i=this,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.Qf&&this.sp===r||(null==(t=this.Qf)||t.reset(),this.sp=r,n=(0,k._)(this.Jf(function(){return i.Hf},function(e){i.Hf=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},uh),2),this.Qf=n[0],this.rp=n[1]),this.Qf}},{key:"setup",value:function(e){var t,n=this;if(!this.So){this.po=e,(null==(t=this._instance)||null==(t=t.config)||null==(t=t.logs)?void 0:t.captureConsoleLogs)&&(this.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();var i=!1,r=e.onRemoteConfig(function(e){var t;i=e.ok&&!0===(null==(t=e.config.logs)?void 0:t.captureConsoleLogs),n.onRemoteConfig(e)});this.So?r.dispose():(this.$o=r,i||this.loadIfEnabled())}}},{key:"dispose",value:function(){var e,t,n,i;this.So||(this.So=!0,this.up(),null==(e=this.$o)||e.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,null==S||S.removeEventListener("online",this.Gf),null==(t=this.hp)||t.call(this),this.hp=void 0,null==(n=this.Zf)||n.reset(),null==(i=this.Qf)||i.reset())}},{key:"onRemoteConfig",value:function(e){if(!this.So){var t,n,i=e.ok?null==(t=e.config.logs)?void 0:t.captureConsoleLogs:void 0;es(i)?this.cp():(null==(n=this._instance)||null==(n=n.persistence)||n.register({$logs_capture_enabled_server_side:!!i}),i?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}}},{key:"reset",value:function(){var e,t,n,i;this.up(),null==(e=this.Zf)||e.clearQueue(),this.ia=[],null==(t=this.Zf)||t.reset(),null==(n=this.Qf)||n.clearQueue(),this.Hf=[],null==(i=this.Qf)||i.reset(),this.Xc=0}},{key:"captureLog",value:function(e){this.So||this.Xf().captureLog(e)}},{key:"captureConsoleLog",value:function(e){this.So||this.np().captureLog(e)}},{key:"captureBufferedConsoleLog",value:function(e,t,n){this.So||this.np().captureLog(e,{context:t,occurredAtMs:n})}},{key:"lp",value:function(){var e;return!!(null==(e=this._instance)||null==(e=e.persistence)||null==(e=e.props)?void 0:e[n1])}},{key:"op",value:function(){var e,t,n;return!(null==(e=this._instance)||null==(t=e.Yl)?void 0:t.call(e))||!!(null==(n=D._POSTHOG_REMOTE_CONFIG)||null==(n=n[this._instance.config.token])?void 0:n.config)}},{key:"gh",value:function(){var e;this.up(),null==(e=this.Qf)||e.clearQueue(),this.Hf=[]}},{key:"cp",value:function(){this.Nf||this.up()}},{key:"ap",value:function(){var e=this;if(!this.Wf&&(null==D?void 0:D.console)){var t=uu(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs).maxBufferSize,n=!0,i=!1,r=void 0;try{for(var s,o,a,u=ul[Symbol.iterator]();!(n=(a=u.next()).done);
2n=!0)o=this,function(){var n=a.value,i=void 0;try{i=uc(D.console[n])}catch(e){return"continue"}i&&o.Uf.push(aS(D.console,n,function(r){var s=function(){for(var i=arguments.length,s=Array(i),o=0;o<i;o++)s[o]=arguments[o];try{e.dp(n,s,t)}catch(e){}return r.apply(D.console,s)};return s.__rrweb_original__=i,s}))}()}catch(e){i=!0,r=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw r}}this.Wf=!0,this.vp=setTimeout(function(){e.up()},3e4)}}},{key:"dp",value:function(e,t,n){var i;if(this.Wf&&!this.Vf&&0!==t.length)if(null==(i=this._instance)?void 0:i.is_capturing()){if(n>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()}},{key:"up",value:function(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);var e=!0,t=!1,n=void 0;try{for(var i,r=this.Uf[Symbol.iterator]();!(e=(i=r.next()).done);e=!0)(0,i.value)()}catch(e){t=!0,n=e}finally{try{e||null==r.return||r.return()}finally{if(t)throw n}}this.Uf=[]}}},{key:"fp",value:function(){var e=this.zf;return this.up(),e}},{key:"logger",get:function(){var e=this;return this.pp||(this.pp={trace:function(t,n){return e.captureLog({body:t,level:"trace",attributes:n})},debug:function(t,n){return e.captureLog({body:t,level:"debug",attributes:n})},info:function(t,n){return e.captureLog({body:t,level:"info",attributes:n})},warn:function(t,n){return e.captureLog({body:t,level:"warn",attributes:n})},error:function(t,n){return e.captureLog({body:t,level:"error",attributes:n})},fatal:function(t,n){return e.captureLog({body:t,level:"fatal",attributes:n})}}),this.pp}},{key:"flushLogs",value:function(e){var t=this;e?this.gp(e):(this.Zf&&this.Zf.flush().catch(function(e){return t.mp(e)}),this.Qf&&this.Qf.flush().catch(function(e){return t.mp(e)}))}},{key:"mp",value:function(e){uv(e)||this.$.error("PostHog logs flush failed:",e)}},{key:"loadIfEnabled",value:function(){var e=this;if(!this.So&&this.Nf&&!this.qf&&!this.jf){var t=null==D?void 0:D.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.up();var n=t.loadExternalDependency;if(!n)return this.$.error(iO),void this.up();this.jf=!0;try{n(this._instance,"logs",function(n){if(e.jf=!1,!e.So&&e.Nf){var i=t.logs;if(!n&&(null==i?void 0:i.initializeLogs)){var r,s,o,a=e.fp();e.hp=i.initializeLogs(null!=(r=e.po)?r:e._instance),e.qf=!0,a.length>0&&(null==(s=i.replayConsoleBuffer)||s.call(i,null!=(o=e.po)?o:e._instance,a))}else e.$.error("Could not load logs script",n),e.up()}})}catch(e){throw this.jf=!1,e}}}},{key:"Kf",value:function(e,t){var n=this,i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:function(t){return t===B.LogsQueue?e():void 0},setPersistedProperty:function(e,n){e===B.LogsQueue&&t(null!=n?n:[])},js:function(e){return n.js(e)},getLibraryId:function(){return j.LIB_NAME},getLibraryVersion:function(){return j.LIB_VERSION}}}},{key:"js",value:function(e){var t=this;return new Promise(function(n){if(so(t.Xc,3))return void n({kind:"fatal",error:uf(void 0,"logs endpoint is unreachable, dropping batch")});var i=!1,r=function(e){i||(i=!0,clearTimeout(s),n(e))},s=setTimeout(function(){t.$.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:uf(void 0,"logs request timed out")})},9e4);t._instance._send_request({method:"POST",url:t.yp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:function(e){var n,i=e.statusCode;(t.bp(i),i>=200&&300>i)?r({kind:"ok"}):413===i?r({kind:"too-large"}):0!==i&&408!==i&&429!==i&&500>i?r({kind:"fatal",error:Error("logs request failed with status ".concat(i))}):0===i?(e.error||t.$.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:uf(e.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!=(n=e.error)?n:Error("logs request failed with status ".concat(i))})}})})}},{key:"bp",value:function(e){var t=this;(0!==e||this._instance.__loaded)&&(this.Xc=sa(e,this.Xc,3,function(){return t.$.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.")}))}},{key:"gp",value:function(e){var t=this;this.ia.length>
20&&this._p(e,this.ia,this.ep,j.LIB_NAME,function(e){t.ia=e}),this.Hf.length>0&&this._p(e,this.Hf,this.rp,uh,function(e){t.Hf=e})}},{key:"_p",value:function(e,t,n,i,r){if(0!==t.length){var s=t.map(function(e){return e.record});r([]);var o=nx(s,n_(n,j.LIB_NAME,j.LIB_VERSION),i,j.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}}},{key:"yp",value:function(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}},{key:"Yf",value:function(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.sessionId,r=n.windowId,s=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=i,t.windowId=r,es(s)||(t.sessionStartTimestamp=s),es(o)||(t.lastActivityTimestamp=o)}if((null==D||null==(e=D.location)?void 0:e.href)&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tE(D.location.href):D.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(t.activeFeatureFlags=a)}return t}}]),e}()},uP={metrics:function(){function e(t){(0,g._)(this,e),this._instance=t,this.$=nR("[metrics]")}return(0,_._)(e,[{key:"initialize",value:function(){}},{key:"Xf",value:function(){var e,t,n,i,r,s,o,a,u=null==(o=this._instance)||null==(o=o.config)?void 0:o.metrics;return this.Zf&&this.tp===u||(null==(a=this.Zf)||a.reset(),this.tp=u,this.Zf=new nO(this.Kf(),{serviceName:null!=(e=null==(s=null==u?void 0:u.resourceAttributes)?void 0:s["service.name"])?e:null==u?void 0:u.serviceName,serviceVersion:null!=(t=null==s?void 0:s["service.version"])?t:null==u?void 0:u.serviceVersion,environment:null!=(n=null==s?void 0:s["deployment.environment"])?n:null==u?void 0:u.environment,resourceAttributes:s,beforeSend:null==u?void 0:u.beforeSend,flushIntervalMs:null!=(i=null==u?void 0:u.flushIntervalMs)?i:1e4,maxSeriesPerFlush:null!=(r=null==u?void 0:u.maxSeriesPerFlush)?r:1e3},this.$)),this.Zf}},{key:"count",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2?arguments[2]:void 0;this.Xf().count(e,t,n)}},{key:"gauge",value:function(e,t,n){this.Xf().gauge(e,t,n)}},{key:"histogram",value:function(e,t,n){this.Xf().histogram(e,t,n)}},{key:"flush",value:function(e){var t=this;if(!this.Zf)return Promise.resolve();if(e){var n=this.Zf.drainWindow();return n&&this.Xs(n,e),Promise.resolve()}return this.Zf.flush().catch(function(e){return t.$.error("PostHog metrics flush failed:",e)})}},{key:"reset",value:function(){var e;null==(e=this.Zf)||e.reset()}},{key:"Kf",value:function(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Xs:function(e){return t.Xs(e)},getLibraryId:function(){return j.LIB_NAME},getLibraryVersion:function(){return j.LIB_VERSION}}}},{key:"Xs",value:function(e,t){var n=this;return new Promise(function(i){var r=!1,s=function(e){r||(r=!0,clearTimeout(o),i(e))},o=setTimeout(function(){return s({kind:"retry-later",error:Error("metrics request timed out")})},9e4);n._instance._send_request(tO(tO({method:"POST",url:n.wp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback:function(e){var t,n=e.statusCode;n>=200&&300>n?s({kind:"ok"}):413===n?s({kind:"too-large"}):0!==n&&408!==n&&429!==n&&500>n?s({kind:"fatal",error:Error("metrics request failed with status ".concat(n))}):s({kind:"retry-later",error:null!=(t=e.error)?t:Error("metrics request failed with status ".concat(n))})}}))})}},{key:"wp",value:function(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}]),e}()};ap.__defaultExtensionClasses=tO({},tO(tO(tO(tO(tO(tO(tO(tO(tO(tO(tO(tO(tO({},up),ug),u_),uy),um),ub),uw),uk),ux),uE),uS),u$),uP));var uM=(j.SDK_DIST_CHANNEL="npm",o=o9[au]=new ap,function(){function e(){e.done||(e.done=!0,al=!1,iz(o9,function(e){e._dom_loaded()}))}(null==M?void 0:M.addEventListener)?"complete"===M.readyState?e():iX(M,"DOMContentLoaded",e,{capture:!1}):S&&nA.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),o);e.s(["default",0,uM])}]); 3 4//# debugId=3e34e231-84f8-4b6b-c3ed-bc0f657839d5
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.