posthog-js 1.427.3 → 1.428.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js +1 -1
- package/dist/conversations.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.full.js.map +1 -1
- package/dist/customizations.js +1 -1
- package/dist/customizations.js.map +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/dead-clicks-autocapture.js.map +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/replay/external/json-ld.js +1 -6
- package/lib/src/extensions/replay/external/json-ld.js.map +1 -1
- package/package.json +5 -5
package/dist/array.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){var t=["retriesPerformedSoFar"],i=["$set_once","$set"];function e(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function r(){return r=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},r.apply(null,arguments)}function s(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function n(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var o=t.apply(i,e);function a(t){s(o,r,n,a,l,"next",t)}function l(t){s(o,r,n,a,l,"throw",t)}a(void 0)})}}!function(s){var o="u">typeof window?window:void 0,a="u">typeof globalThis?globalThis:o,l=null==a?void 0:a.navigator,h=null==a?void 0:a.document,u=null==a?void 0:a.location,d=null==a?void 0:a.fetch,v=null!=a&&a.XMLHttpRequest&&"withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:void 0,c=null==a?void 0:a.AbortController,f=null==a?void 0:a.CompressionStream,p=null==l?void 0:l.userAgent;function g(){return!(!o||!1===o.navigator.onLine)}var _="undefined"!=typeof globalThis?globalThis:o;_&&"undefined"==typeof self&&(_.self=_),_&&"undefined"==typeof File&&(_.File=function(){});var m=null!=o?o:{},y="0.7.3",b={DEBUG:!1,LIB_VERSION:y,LIB_NAME:"browser-common",JS_SDK_VERSION:y},w=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],x=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return w.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function S(t,i){return-1!==t.indexOf(i)}var k=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")};function P(t){var i,e=[];return null!==(i=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}}))&&void 0!==i?i:"null"}var C=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),T=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),F=["$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"],I=["token"],R=Object.prototype,O=R.hasOwnProperty,A=R.toString,M=Array.isArray||function(t){return"[object Array]"===A.call(t)},D=t=>"function"==typeof t,j=t=>t===Object(t)&&!M(t),L=t=>{if(j(t)){for(var i in t)if(O.call(t,i))return!1;return!0}return!1},B=t=>void 0===t,N=t=>"[object String]"==A.call(t),z=t=>N(t)&&0===t.trim().length,U=t=>null===t,H=t=>B(t)||U(t),q=t=>"[object Number]"==A.call(t)&&t==t,V=t=>q(t)&&t>0,W=t=>"[object Boolean]"===A.call(t),G=t=>S(F,t),J=t=>S(I,t);function K(t){return null===t||"object"!=typeof t}function Y(t,i){return{}.toString.call(t)==="[object "+i+"]"}function X(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Q(t,Error)}}function Z(t){return"u">typeof Event&&Q(t,Event)}function Q(t,i){try{return t instanceof i}catch(t){return!1}}var tt=[!0,"true",1,"1","yes"],it=t=>S(tt,t),et=[!1,"false",0,"0","no"];function rt(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),q(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),rt(null!=s?s:e,i,e,r))}var st=class{constructor(t){this.C={},this.I=t.I,this.R=rt(t.bucketSize,0,100,t.A),this.O=rt(t.refillRate,0,this.R,t.A),this.F=rt(t.refillInterval,0,864e5,t.A)}N(t,i){var e=Math.floor((i-t.lastAccess)/this.F);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.F)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.N(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}},nt="Mobile",ot="Android",at="Tablet",lt="Android Tablet",ht="iPad",ut="Apple Watch",dt="Safari",vt="BlackBerry",ct="Samsung Internet",ft="Chrome",pt="Chrome iOS",gt="Internet Explorer",_t="Internet Explorer Mobile",mt="Opera",yt="Microsoft Edge",bt="Firefox",wt="Firefox iOS",xt="Nintendo",St="PlayStation",kt="Xbox",Et="Android Mobile",$t="Mobile Safari",Pt="Windows",Ct="Windows Phone",Tt="Nokia",Ft="Ouya",It="Generic "+nt.toLowerCase(),Rt="Generic "+at.toLowerCase(),Ot="Konqueror",At="Oculus Browser",Mt="Vivaldi",Dt="Yandex",jt="Whale",Lt="DuckDuckGo",Bt="Pale Moon",Nt="Waterfox",zt="Brave",Ut="Claude",Ht="Codex",qt="ChatGPT",Vt="Google Search App",Wt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Gt=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Jt=new RegExp(kt,"i"),Kt=new RegExp("PlayStation \\w+","i"),Yt=new RegExp("Nintendo \\w+","i"),Xt=new RegExp("BlackBerry|PlayBook|BB10","i"),Zt={"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"},Qt=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?zt:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&S(t,"GSA/")?Vt:S(t," OPR/")&&S(t,"Mini")?"Opera Mini":S(t," OPR/")?mt:Xt.test(t)?vt:S(t,"IEMobile")||S(t,"WPDesktop")?_t:S(t,"OculusBrowser")?At:S(t,"SamsungBrowser")?ct:S(t,"Edge")||S(t,"Edg/")?yt:S(t,"Vivaldi/")?Mt:S(t,"YaBrowser/")?Dt:S(t,"Whale/")?jt:S(t,"DuckDuckGo/")||S(t,"Ddg/")?Lt:S(t,"Claude/")?Ut:S(t,"Codex/")?Ht:S(t,"ChatGPT/")?qt:S(t,"FBIOS")?"Facebook Mobile":S(t,"UCWEB")||S(t,"UCBrowser")?"UC Browser":S(t,"CriOS")?pt:S(t,"CrMo")||S(t,ft)?ft:S(t,ot)&&S(t,dt)?Et:S(t,"FxiOS")?wt:S(t.toLowerCase(),Ot.toLowerCase())?Ot:S(t,"Brave/")?zt:((t,i)=>i&&S(i,"Apple")||function(t){return S(t,dt)&&!S(t,ft)&&!S(t,ot)}(t))(t,i)?S(t,nt)?$t:dt:S(t,"PaleMoon/")?Bt:S(t,"Waterfox/")?Nt:S(t,bt)?bt:S(t,"MSIE")||S(t,"Trident/")?gt:S(t,"Gecko")?bt:"")},ti={[_t]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[yt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ft]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[pt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[dt]:[Wt],[$t]:[Wt],[mt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[bt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[wt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[vt]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Wt],[Et]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ct]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[At]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Mt]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[jt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ut]:[Gt],[Ht]:[Gt],[qt]:[Gt],[Lt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Bt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Nt]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Vt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[gt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},ii=function(t,i,e,r){var s=ti[Qt(t,i,e,r)];if(B(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},ei=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[kt,t&&t[1]||""]],[new RegExp(xt,"i"),[xt,""]],[new RegExp(St,"i"),[St,""]],[Xt,[vt,""]],[new RegExp(Pt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Ct,""];if(new RegExp(nt).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Zt[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Pt,r]}return[Pt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=B(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[ot,[t[2],t[3],t[4]||"0"].join(".")]:[ot,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],ri=function(t){for(var i=0;ei.length>i;i++){var e=ei[i],r=e[1],s=e[0].exec(t),n=s&&(D(r)?r(s,t):r);if(n)return n}return["",""]},si=function(t){return Yt.test(t)?xt:Kt.test(t)?St:Jt.test(t)?kt:new RegExp(Ft,"i").test(t)?Ft:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Ct:/iPad/.test(t)?ht:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ut:Xt.test(t)?vt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Tt,"i").test(t)?Tt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(nt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?ot:lt:new RegExp("(pda|Mobile)","i").test(t)?It:new RegExp(at,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Rt:""},ni="[Truncated]",oi="[Unserializable]";function ai(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}Date,Date;var li,hi,ui,di=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function vi(t,i){return"string"==typeof(e=t)&&di.test(e)?t:i();var e}function ci(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function fi(t){return t?t.split("#")[0]:t}function pi(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function gi(t,i,e){return _i.apply(this,arguments)}function _i(){return(_i=n(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=pi(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function mi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return ui&&e.length===hi?ui:(hi=e.length,ui=e.reduce((e,r)=>{li||(li={});var s=li[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a,l=null==(a=n[o])?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,li[r]=[l,h];break}}return e},{}))}}var yi=class{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return n(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&M(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,s;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),r({},t,{cause:e,stack:s})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return n(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,r({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:mi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return r({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,e),next:t=>s(t,e+1)})}};function bi(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:!!i&&!i.startsWith("webkit-masked-url://")&&"<anonymous>"!==i};return B(r)||(n.lineno=r),B(s)||(n.colno=s),n}var wi=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},xi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Si=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ki=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ei=(t,i)=>{var e=xi.exec(t);if(e)return bi(i,e[1],"?",+e[2],+e[3]);var r=Si.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ki.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=wi(r[1]||"?",r[2]);return bi(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},$i=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Pi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ci=(t,i)=>{var e=$i.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Pi.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||"?",o=wi(n,s);return bi(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Ti=/\(error: (.*)\)/;var Fi=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=N(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return Y(t,"DOMException")}isDOMError(t){return Y(t,"DOMError")}},Ii=class{match(t){return X(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}},Ri=class{match(t){return!!Y(t,"ErrorEvent")&&(null!=t.error||this.Ki(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return r({},s,{stack:null!==(e=this.Xi(t))&&void 0!==e?e:s.stack,synthetic:!0})}Ki(t){return N(t.message)&&t.message.length>0}Xi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(N(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}},Oi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ai=class{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(Oi);return r&&(i=r[1],e=r[2]),[i,e]}},Mi=["fatal","error","warning","log","info","debug"];function Di(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}var ji=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Z(t))return t.constructor.name;var i="name"in t?t.name:void 0;return N(i)&&!z(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+Di(t)}isSeverityLevel(t){return N(t)&&!z(t)&&Mi.indexOf(t)>=0}getStack(t){try{return N(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:N(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(X(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Li=class{match(t){return Z(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Di(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Bi=class{match(t){return K(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Ni=class{match(t){return Y(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Z(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return K(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}},zi="$message",Ui="$timestamp",Hi=new Set([zi,Ui]),qi={enabled:!0,max_bytes:32768};function Vi(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:qi.enabled,max_bytes:Gi(t.max_bytes,qi.max_bytes)}:r({},qi)}var Wi=class{constructor(t){this.$n=[],this.Bn=0,this._n=Vi(t)}setConfig(t){this._n=Vi(t),this.Hn()}add(t){var i=function(t){var i;try{i=P(t)}catch(t){return}try{var e=JSON.parse(i);if(!j(e))return;var r=e,s=r[zi],n=r[Ui];if(!N(s)||0===s.trim().length)return;if(!N(n)&&!q(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this._n.max_bytes||(this.$n.push({step:i.step,bytes:e}),this.Bn+=e,this.Hn())}}getAttachable(){return this.$n.map(t=>t.step)}clear(){this.$n=[],this.Bn=0}size(){return this.$n.length}Hn(){for(;this.Bn>this._n.max_bytes&&this.$n.length>0;){var t=this.$n.shift();t&&(this.Bn-=t.bytes)}}};function Gi(t,i){if(!q(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Ji=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Ki(t){return"string"==typeof t||t}function Yi(t){return"string"==typeof t?t:void 0}var Xi,Zi=["$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"],Qi="NativeGzipValidationError",te=t=>t.length>=2&&31===t[0]&&139===t[1],ie=(t,i)=>t===T.GZipJS||i===T.GZipJS||"gzip"===i,ee=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),re=t=>{throw ci(Qi,"Native gzip produced invalid output: "+t)},se=function(){var t=n(function*(t,i){18>t.size&&re("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());te(e)&&8===e[2]||re("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(Xi)return Xi;Xi=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;Xi[t]=i>>>0}return Xi})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&re("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&re("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function ne(){return ne=n(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=n(function*(t){try{yield o.abort(t)}catch(t){}throw t});return function(i){return t.apply(this,arguments)}}()),l=new Response(s.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield se(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),ne.apply(this,arguments)}var oe={}.propertyIsEnumerable;function ae(t,i){try{return ue(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function le(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:ni};if(e.remainingNodes--,W(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt("9223372036854775808");return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var s=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:ai(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:ni};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?ai(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return le(a.call(t),i,e,r+1)}catch(t){}return M(t)?{arrayValue:{values:he(t,i,e,r+1)}}:{kvlistValue:{values:ue(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:ai(String(t))}}function he(t,i,e,r){for(var s=[],n=Math.min(t.length,1e3),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(H(a))continue;s.push(le(a,i,e,r))}catch(t){s.push({stringValue:oi})}return t.length>o&&s.push({stringValue:ni}),s}function ue(t,i,e,r){var s=[];for(var n in t)if(oe.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(U(o)||B(o))continue;s.push({key:ai(n),value:le(o,i,e,r)})}catch(t){s.push({key:ai(n),value:{stringValue:oi}})}}return s}function de(t,i,e){return r({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}var ve={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var ce={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},fe=ce.info;function pe(t){try{return ai(String(t))}catch(t){return oi}}function ge(t,i,e,s){var n,o=ce[t.level||"info"]||fe,a=o.text,l=o.number,h=(void 0===(n=q(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),H(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),H(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=r({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=oi}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var g={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:pe(t.body)},attributes:ae(d,e)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),B(t.trace_flags)||(g.flags=t.trace_flags),g}function _e(t,i,e){return de(t,i,e)}function me(t,i,e,r){return{resourceLogs:[{resource:{attributes:ae(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var ye=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this._n=i,this.A=e,this.zn=r,this.Un=s,this.Wn=n,this.Vn=o,this.Gn=null,this.Zn=0,this.Jn=0,this.Qn=0,this.Kn=0,this.Xn=0,this.Yn=!1,this.ts=i.maxBufferSize,this.es=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.rs=i.flushIntervalMs,this.ns=i.maxBatchRecordsPerPost,this.ss=i.rateCapWindowMs,this.ls=i.maxLogsPerInterval}clearQueue(){this.Jn++,this._instance.setPersistedProperty(C.LogsQueue,[])}reset(){this.us(),this.Kn=0,this.Xn=0,this.Yn=!1,this.Qn=0,this.ns=this._n.maxBatchRecordsPerPost}onReconnect(){this.Qn=0,this.hs()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.ds(t);if(null!==r)if(r.body){if(this.vs()){var s={record:ge(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.zn(),this.A,null==i?void 0:i.occurredAtMs)};this.Un(()=>this.cs(s))}}else this.A.info("Log was rejected in beforeSend function")}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=M(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}vs(){if(void 0===this.ls)return!0;var t=Date.now(),i=t-this.Kn;return this.ss>i&&i>=0||(this.Kn=t,this.Xn=0,this.Yn=!1),this.ls>this.Xn?(this.Xn++,!0):(this.Yn||(this.A.warn("captureLog dropping logs: exceeded "+this.ls+" logs per "+this.ss+"ms"),this.Yn=!0),!1)}flush(){var t=this;return n(function*(){if(!t._instance.isDisabled)return t.Gn||(t.Gn=t.fs().finally(()=>{t.Gn=null})),t.Gn})()}fs(){var t=this;return n(function*(){var i;t.us();var e=null!==(i=t._instance.getPersistedProperty(C.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.Jn;t.Zn=0;var l=Math.min(e.length,t.ns),h=e.slice(0,l),u=me(h.map(t=>t.record),t.ps(),null!==(n=t.Vn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.gs(u);if(t.Jn!==a)return;if("too-large"===d.kind&&h.length>1)t.ns=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.ns);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t._n.maxBatchRecordsPerPost>t.ns&&(t.ns=Math.min(t._n.maxBatchRecordsPerPost,t.ns+1)),yield t.ys(h.length),e=null!==(o=t._instance.getPersistedProperty(C.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}ys(t){var i=this;return n(function*(){var e,r=Math.max(0,t-i.Zn),s=null!==(e=i._instance.getPersistedProperty(C.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(C.LogsQueue,s.slice(r)),yield i.Wn()})()}ps(){return _e(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion())}cs(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(C.LogsQueue))&&void 0!==i?i:[];this.es>e.length||(e.shift(),this.Zn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(C.LogsQueue,e),this.ts>e.length?this.bs():this.hs()}}bs(t){void 0===t&&(t=this.rs),this._s||(this._s=pi(()=>{this._s=void 0,this.hs()},t))}ws(){var t=Math.min(Math.max(0,this.Qn-1),6);return this.rs*Math.pow(2,t)}ks(){var t=this._instance.getPersistedProperty(C.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return n(function*(){i.us();var e=i.flush().catch(()=>{});void 0!==t?yield gi(e,t):yield e})()}flushWithTimeout(t){var i=this;return n(function*(){var e=i.flush();yield gi(e,t,()=>{e.catch(()=>{})})})()}hs(){this.flush().then(()=>{this.Qn=0},t=>{this.Qn++,this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.ks()&&this.bs(this.ws())})}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}},be=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function we(t){return String(t)+"000000"}function xe(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map(t=>JSON.stringify(t)+":"+JSON.stringify(r[t])).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}var Se=class{constructor(t,i,e){this._instance=t,this._n=i,this.A=e,this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Ms=0}count(t,i,e){void 0===i&&(i=1),this.Is({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Is({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Is({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.Gn,e=function(){var e=n(function*(){i&&(yield i.catch(()=>{})),yield t.Es()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.Gn===e&&(this.Gn=null)});return this.Gn=e,e}drainWindow(){if(0===this.Ss.size)return null;var t=this.Ss;return this.Ss=new Map,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Rs(t)}reset(){this.Ms++,this.us(),this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set}Is(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.ds(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,s;try{e=i.attributes?r({},i.attributes):void 0,s=xe(i.type,i.name,i.unit,e)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.Ss.get(s);if(!n){if(!this.Ps())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Ss.set(s,n)}var o=this.Cs.get(i.name);void 0===o?this.Cs.set(i.name,i.type):o===i.type||this.Ts.has(i.name)||(this.Ts.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.As(n,i.value),this.bs()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}Ps(){return this._n.maxSeriesPerFlush>this.Ss.size||(this.xs||(this.xs=!0,this.A.warn("Metric series cap reached ("+this._n.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}As(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(be.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,be)]+=1}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=M(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}bs(){this._s||(this._s=pi(()=>{this._s=void 0,this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})},this._n.flushIntervalMs))}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}Es(){var t=this;return n(function*(){if(0!==t.Ss.size){var i=t.Ss;t.Ss=new Map,t.xs=!1,t.Cs=new Map,t.Ts=new Set;var e=t.Ms,r=yield t._instance.Fs(t.Rs(i));if(e===t.Ms)switch(r.kind){case"ok":return;case"retry-later":return t.Os(i),void t.bs();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}})()}Rs(t){return i=this.$s(t),e=function(t,i,e){return de(t,i,e)}(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ae(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}$s(t){var i=we(Date.now()),e=new Map;for(var s of t.values()){var n,o=xe(s.type,s.name,s.unit,void 0),a=e.get(o);a||(a=r({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=ae(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=we(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:be})}return Array.from(e.values())}Os(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Ss.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.Ps()&&this.Ss.set(s,n)}}},ke=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;r>n;n++)s[n-1]=arguments[n];o&&(b.DEBUG||o.POSTHOG_DEBUG||e)&&!B(o.console)&&o.console&&("__rrweb_original__"in o.console[i]?o.console[i].__rrweb_original__:o.console[i])(t,...s)},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>ke(t+" "+i,e)};return r},Ee=ke("[PostHog.js]"),$e=Ee.createLogger,Pe=$e("[ExternalScriptsLoader]"),Ce=t=>{var i=null==h?void 0:h.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Te=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Pe.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=Ce(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,e(t)}))}var n=()=>{if(!h)return e("document not found");if(Ce(i))return Te(t,i,e);var r=h.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)h.head.appendChild(r);else{var s,n=h.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):h.body.appendChild(r)}};null!=h&&h.body?n():null==h||h.addEventListener("DOMContentLoaded",n)},Fe={},Ie=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};m.__PosthogExtensions__=m.__PosthogExtensions__||{},m.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=Fe[s];if("fallback"===r&&n){if(Ce(n))return void Te(t,n,e);delete Fe[s]}Te(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=Ie(t,i);Fe[s]=a;var l=Ce(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Te(t,a,e)}else e(void 0,n)}:e)}else Te(t,Ie(t,i),e)}else Te(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),e)},m.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{Te(t,t.requestRouter.endpointFor("api",i),e)},b.DEBUG=!1,b.LIB_VERSION="1.427.3",b.LIB_NAME="web";var Re=b,Oe="$people_distinct_id",Ae="distinct_id",Me="$device_id",De="$device_model",je="__alias",Le="__cmpns",Be="$fbc",Ne="$fbc_persistence",ze="__timers",Ue="$autocapture_disabled_server_side",He="$heatmaps_enabled_server_side",qe="$exception_capture_enabled_server_side",Ve="$error_tracking_suppression_rules",We="$error_tracking_capture_extension_exceptions",Ge="$web_vitals_enabled_server_side",Je="$dead_clicks_enabled_server_side",Ke="$product_tours_enabled_server_side",Ye="$logs_capture_enabled_server_side",Xe="$web_vitals_allowed_metrics",Ze="$session_recording_remote_config",Qe="$session_recording_enabled_server_side",tr="$replay_sample_rate",ir="$replay_override_sampling",er="$replay_override_linked_flag",rr="$replay_override_url_trigger",sr="$replay_override_event_trigger",nr="$sesid",or="$session_is_sampled",ar="$session_past_minimum_duration",lr="$session_recording_url_trigger_activated_session",hr="$session_recording_event_trigger_activated_session",ur="$debug_first_full_snapshot_timestamp",dr="$sess_rec_flush_size",vr="$enabled_feature_flags",cr="$active_feature_flags",fr="$early_access_features",pr="$feature_flag_details",gr="$feature_flag_payloads",_r="$feature_flag_request_id",mr="$minimal_flag_called_events",yr="$override_feature_flags",br="$override_feature_flag_payloads",wr="$stored_person_properties",xr="$stored_group_properties",Sr="$groups",kr="$surveys",Er="$surveys_loaded_at",$r="$surveys_activated",Pr="$surveys_activated_session",Cr="$surveys_activated_timestamps",Tr="ph_product_tours",Fr="$product_tours_activated",Ir="$product_tours_activated_session",Rr="$conversations_widget_session_id",Or="$conversations_ticket_id",Ar="$conversations_widget_state",Mr="$conversations_user_traits",Dr="$flag_call_reported",jr="$flag_call_reported_session_id",Lr="$feature_flag_errors",Br="$feature_flag_evaluated_at",Nr="$user_state",zr="$client_session_props",Ur="$capture_rate_limit",Hr="$initial_campaign_params",qr="$initial_referrer_info",Vr="$initial_person_info",Wr="$epp",Gr="$posthog_cookieless",Jr="$cookieless_mode",Kr="$sdk_debug_extensions_init_method",Yr="$sdk_debug_extensions_init_time_ms",Xr="$sdk_debug_recording_script_not_loaded",Zr="$sdk_debug_replay_event_trigger_status",Qr="$sdk_debug_replay_linked_flag_trigger_status",ts="$sdk_debug_replay_matched_recording_trigger_groups",is="$sdk_debug_replay_pending_trigger_conditions",es="$sdk_debug_replay_remote_trigger_matching_config",rs="$sdk_debug_replay_trigger_groups_count",ss="$sdk_debug_replay_url_trigger_status",ns="$session_recording_start_reason",os="PostHog loadExternalDependency extension not found.",as="anonymous",ls="identified",hs="identified_only",us="visibilitychange",ds="beforeunload",vs="$pageview",cs="$pageleave",fs="$identify",ps="$groupidentify";function gs(t,i){M(t)&&t.forEach(i)}function _s(t,i){if(!H(t))if(M(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)O.call(t,e)&&i(t[e],e)}var ms=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function ys(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var bs=function(t){try{return t()}catch(t){return}},ws=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Ee.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ee.critical(t)}}},xs=function(t){var i={};return _s(t,function(t,e){(N(t)&&t.length>0||q(t))&&(i[e]=t)}),i};var Ss=["herokuapp.com","vercel.app","netlify.app"];function ks(t){var i=null==t?void 0:t.hostname;if(!N(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Ss)if(e===r)return!1;return!0}function Es(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function $s(t){return"ph_toolbar_internal"===t.name}var Ps=t=>{if(h){try{for(var i=t+"=",e=h.cookie.split(";").filter(t=>t.length),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return q(t)&&isFinite(t)&&Math.floor(t)===t});var Cs=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,r,s){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(s)||0>i||0>e||0>r||0>s||i>0xffffffffffff||e>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=i/Math.pow(2,40),n[1]=i/Math.pow(2,32),n[2]=i/Math.pow(2,24),n[3]=i/Math.pow(2,16),n[4]=i/256,n[5]=i,n[6]=112|e>>>8,n[7]=e,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},Ts=class{generate(){var t=this.generateOrAbort();if(!B(t))return t;this.ri=0;var i=this.generateOrAbort();if(B(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),q(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(i>this.ri)this.ri=i,this.ii();else{if(this.ri>=i+1e4)return;this.ni++,this.ni>4398046511103&&(this.ri++,this.ii())}return Cs.fromFieldsV7(this.ri,Math.trunc(this.ni/Math.pow(2,30)),this.ni&Math.pow(2,30)-1,this.oi.nextUint32())}ii(){this.ni=1024*this.oi.nextUint32()+(1023&this.oi.nextUint32())}constructor(){this.ri=0,this.ni=0,this.oi=new Rs}},Fs=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};o&&!B(o.crypto)&&crypto.getRandomValues&&(Fs=t=>crypto.getRandomValues(t));var Is,Rs=class{nextUint32(){return this.De.length>this.ai||(Fs(this.De),this.ai=0),this.De[this.ai++]}constructor(){this.De=new Uint32Array(8),this.ai=1/0}},Os=()=>As().toString(),As=()=>(Is||(Is=new Ts)).generate(),Ms="",Ds=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var js=null,Ls={si(){if(!U(js))return js;if(js=!1,h)try{var t="__ph_cookie_support_"+Os();Ls.ui(t,"xyz"),js='"xyz"'===Ps(t),Ls.hi(t)}catch(t){js=!1}return js},ci(t){Ee.error("cookieStore error: "+t)},li:Ps,di(t){var i;try{i=JSON.parse(Ls.li(t))||{}}catch(t){}return i},ui(t,i,e,r,s){if(!h)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=h),Ms)return Ms;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Os();!Ms&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",Ms=n)}return Ms}(t);if(!e){var r=(t=>{var i=t.match(Ds);return i?i[0]:""})(t);r!==e&&Ee.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(h.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Ee.warn("cookieStore warning: large cookie, len="+u.length),h.cookie=u,!0}catch(t){return!1}},hi(t,i){if(null!=h&&h.cookie)try{Ls.ui(t,"",-1,i)}catch(t){return}}},Bs=null,Ns={si(){if(!U(Bs))return Bs;var t=!0;if(B(o))t=!1;else try{var i="__mplssupport__";Ns.ui(i,"xyz"),'"xyz"'!==Ns.li(i)&&(t=!1),Ns.hi(i)}catch(i){t=!1}return t||Ee.error("localStorage unsupported; falling back to cookie store"),Bs=t,t},ci(t){Ee.error("localStorage error: "+t)},li(t){try{return null==o?void 0:o.localStorage.getItem(t)}catch(t){Ns.ci(t)}return null},di(t){try{return JSON.parse(Ns.li(t))||{}}catch(t){}return null},ui(t,i){try{return null==o||o.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Ns.ci(t)}return!1},hi(t){try{null==o||o.localStorage.removeItem(t)}catch(t){Ns.ci(t)}}},zs=[wr,cr,vr,pr,gr,_r,Br,Lr,Dr],Us=[Me,Ae,nr,or,Wr,Vr,Ne,Nr],Hs=t=>t+"_cpm",qs=["__proto__","constructor","prototype"],Vs=t=>{if(!j(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===qs.indexOf(e)&&(i[e]=t[e])}),i},Ws=function(t,i){void 0===i&&(i=[]);var e={};return[...Us,...i].forEach(i=>{var r=t[i];B(r)||U(r)||""===r||(e[i]=r)}),e},Gs=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Js=(t,i)=>({p:i,f:Gs(JSON.stringify(t))}),Ks=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ls.di(Hs(t)),r=(null==e?void 0:e.f)===Gs(i)&&M(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ys=(t,i)=>i+"|"+(Ls.li(Hs(t))||""),Xs={},Zs={si:()=>!0,ci(t){Ee.error("memoryStorage error: "+t)},li:t=>t in Xs?Xs[t]:null,di:t=>t in Xs?Xs[t]:null,ui:(t,i)=>(Xs[t]=i,!0),hi(t){delete Xs[t]}},Qs=null,tn={si(){if(!U(Qs))return Qs;if(Qs=!0,B(o))Qs=!1;else try{var t="__support__";tn.ui(t,"xyz"),'"xyz"'!==tn.li(t)&&(Qs=!1),tn.hi(t)}catch(t){Qs=!1}return Qs},ci(t){Ee.error("sessionStorage error: ",t)},li(t){try{return null==o?void 0:o.sessionStorage.getItem(t)}catch(t){tn.ci(t)}return null},di(t){try{return JSON.parse(tn.li(t))||null}catch(t){}return null},ui(t,i){try{return null==o||o.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){tn.ci(t)}return!1},hi(t){try{null==o||o.sessionStorage.removeItem(t)}catch(t){tn.ci(t)}}},en=class{constructor(t){this._instance=t}get _n(){return this._instance.config}get consent(){return this.Xs()?0:this.Ys}isOptedOut(){return"always"===this._n.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._n.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._n.opt_out_capturing_by_default}optInOut(t){this.eo.ui(this.io,t?1:0,this._n.cookie_expiration,this._n.cross_subdomain_cookie,this._n.secure_cookie)}reset(){this.eo.hi(this.io,this._n.cross_subdomain_cookie)}get io(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get Ys(){var t=this.eo.li(this.io);return it(t)?1:S(et,t)?0:-1}get eo(){var t=this._n.opt_out_capturing_persistence_type,i="localStorage"===t?Ns:Ls,e=i.si()?i:Zs;if(!this.ro||this.ro!==e){this.ro=e;var r="localStorage"===t?Ls:Ns;r.li(this.io)&&(this.ro.li(this.io)||this.optInOut(it(r.li(this.io))),r.hi(this.io,this._n.cross_subdomain_cookie))}return this.ro}Xs(){return!!this._n.respect_dnt&&[null==l?void 0:l.doNotTrack,null==l?void 0:l.msDoNotTrack,m.doNotTrack,null==l?void 0:l.globalPrivacyControl].some(t=>it(t))}};function rn(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!D(r))return i;try{var s=r(i);return N(s)&&s?s:i}catch(t){return Ee.error("Error in get_current_url, falling back to window.location.href",t),i}}function sn(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function nn(t){return!!t&&1===t.nodeType}function on(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function an(t){return!!t&&3===t.nodeType}function ln(t){return!!t&&11===t.nodeType&&nn(t.host)}function hn(t){return t?k(t).split(/\s+/):[]}function un(t,i){var e=function(t){var i,e=null==o||null==(i=o.location)?void 0:i.href;return B(e)?void 0:rn(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function dn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return hn(i)}function vn(t){return H(t)?null:k(t).split(/(\s+)/).filter(t=>Dn(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function cn(t){var i="";return Pn(t)&&!Cn(t)&&t.childNodes&&t.childNodes.length&&_s(t.childNodes,function(t){var e;an(t)&&t.textContent&&(i+=null!==(e=vn(t.textContent))&&void 0!==e?e:"")}),k(i)}function fn(t){var i;return B(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var pn=["a","button","form","input","select","textarea","label"];function gn(t,i){if(B(i))return!0;var e,r=function(t){if(i.some(i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function _n(t){var i=t.parentNode;return!(!i||!nn(i))&&i}var mn=[".ph-no-autocapture","[data-ph-no-autocapture]"],yn=["next","previous","prev",">","<"],bn=[...yn,"+","-","−","–"],wn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,xn=[".ph-no-rageclick",".ph-no-capture"],Sn=["","text","search","email","password","url","tel","number"];function kn(t,i){if(!o||En(t))return!1;var e,r,s,n,a;if(W(i)?(e=!!i&&xn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:xn,r=null==i?void 0:i.content_ignorelist,s=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===e)return!1;if(s&&function(t){return!(!t||!nn(t))&&(!!on(t,"textarea")||(on(t,"input")?S(Sn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var l=$n(t,!1).targetElementList;return!function(t,i){if(!1===t||B(t))return!1;var e;if(!0===t)e=yn;else{if(!M(t))return!1;if(t.length>10)return Ee.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(t=>{var i=t.safeText,r=t.ariaLabel;return e.some(t=>wn(i,t)||wn(r,t))})}(r,l.map(t=>{var i;return{safeText:cn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!gn(l,e)}var En=t=>!t||on(t,"html")||!nn(t),$n=(t,i)=>{if(!o||En(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!on(s,"body");)if(ln(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=_n(s);if(!n)break;if(i||pn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var a=o.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function Pn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!on(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=dn(r);if(S(s,"ph-sensitive")||S(s,"ph-no-capture"))return!1}if(S(dn(t),"ph-include"))return!0;var n=t.type||"";if(N(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!N(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 Cn(t){return!!(on(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||on(t,"select")||on(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Tn=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Fn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,In=[16,15,14,13],Rn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),On=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),An=/[0-9A-Za-z_]/;function Mn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Dn(t,i){if(void 0===i&&(i=!0),H(t))return!1;if(N(t)){if(t=k(t),i?Tn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Fn.lastIndex=0;i=Fn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of In){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(Tn.test(a)&&Mn(a))return!0}}}return!1}(t))return!1;if(i?Rn.test(t):function(t){var i;for(On.lastIndex=0;i=On.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&An.test(e)&&An.test(r)))return!0}return!1}(t))return!1}return!0}function jn(t){var i=cn(t);return Dn(i=(i+" "+Ln(t)).trim())?i:""}function Ln(t){var i="";return t&&t.childNodes&&t.childNodes.length&&_s(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=cn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Ln(t)).trim())}catch(t){Ee.error("[AutoCapture]",t)}}),i}function Bn(t){return t.replace(/"|\\"/g,'\\"')}function Nn(t){var i=t.attr__class;if(i)return M(i)?i:hn(i)}var zn=$e("[Dead Clicks]"),Un=()=>!0,Hn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Je)),r=t.instance.config.capture_dead_clicks;return W(r)?r:!!j(r)||e},qn=class{get lazyLoadedDeadClicksAutocapture(){return this.no}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Je]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.so(()=>{this.oo()}):this.stop()}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?zn.error("failed to load script",i):t()})}oo(){var t;if(h){if(!this.no&&null!=(t=m.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=j(this.instance.config.capture_dead_clicks)?r({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.no=m.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.no.start(h),zn.info("starting...")}}else zn.error("`document` not found. Cannot start.")}stop(){this.no&&(this.no.stop(),this.no=void 0,zn.info("stopping..."))}},Vn=$e("[SegmentIntegration]");function Wn(t,i,e){void 0===e&&(e=!0);var r=t.config.segment;if(!r)return i();!function(t,i,e){var r=t.config.segment;if(!r)return i();var s=r=>{var s=()=>r.anonymousId()||Os();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(Nr,ls)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&D(n.then)?n.then(s):s(n)}(t,e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||Vn.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,r)=>{if(!r)return e;var s=!!i&&e.event.anonymousId===i&&!e.event.userId;s||e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Vn.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Vn.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var n=t.calculateEventProperties(r,e.event.properties);return e.event.properties=Object.assign({},n,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return e(t,t.event.event)},page(t){return e(t,vs)},identify(t){return e(t,fs)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{Vn.error("Failed to register the Segment integration",t),i()})},e)}var Gn="posthog-js";function Jn(t,i){var e=void 0===i?{}:i,s=e.organization,n=e.projectId,o=e.prefix,a=e.severityAllowList,l=void 0===a?["error"]:a,h=e.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var e,a,h,d,v,c;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(e=i.exception)?void 0:e.values)||[],g=p.map(t=>r({},t,{stacktrace:t.stacktrace?r({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>r({},t,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return s&&n&&(_.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}var Kn=class{constructor(t,i,e,r,s,n){this.name=Gn,this.setupOnce=function(o){o(Jn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Yn=class{constructor(t){this.ao=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Ee.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.lo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.uo()}uo(){var t;this.ho=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ao)}destroy(){var t;null==(t=this.ho)||t.call(this),this.ho=void 0}doPageView(t,i){var e,r=this.do(t,i);return this.lo={pathname:null!==(e=null==o?void 0:o.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.do(t,null==(i=this.lo)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.lo)?void 0:t.pageViewId}}do(t,i){var e=this.lo;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(B(n)||B(o)||B(a)||B(l)||B(h)||B(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?rt(o/n,0,1,Ee):1,v=n>1?rt(a/n,0,1,Ee):1,c=l>1?rt(h/l,0,1,Ee):1,f=l>1?rt(u/l,0,1,Ee):1;r=ms(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}},Xn=["flags","surveys"],Zn={[Oe]:{exposure:"hidden"},[je]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[ze]:{exposure:"hidden"},[Ne]:{exposure:"hidden"},[Ue]:{exposure:"event"},[He]:{exposure:"hidden"},[Ye]:{exposure:"hidden"},[qe]:{exposure:"event"},[Ve]:{exposure:"hidden"},[We]:{exposure:"event"},[Ge]:{exposure:"event"},[Je]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Xe]:{exposure:"event"},[Ze]:{exposure:"hidden"},[Qe]:{exposure:"hidden"},[nr]:{exposure:"hidden"},[or]:{exposure:"event"},[tr]:{exposure:"event",shouldSkipFromEventProperties:t=>U(t)},[ar]:{exposure:"event"},[lr]:{exposure:"event"},[hr]:{exposure:"event"},[ur]:{exposure:"event"},[dr]:{exposure:"hidden"},[vr]:{exposure:"hidden",storageGroup:"flags"},[cr]:{exposure:"hidden",storageGroup:"flags"},[fr]:{exposure:"hidden"},[pr]:{exposure:"hidden",storageGroup:"flags"},[gr]:{exposure:"hidden",storageGroup:"flags"},[_r]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[mr]:{exposure:"hidden",storageGroup:"flags"},[yr]:{exposure:"hidden"},[br]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[kr]:{exposure:"hidden",storageGroup:"surveys"},[Er]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[$r]:{exposure:"event"},[Pr]:{exposure:"hidden"},[Cr]:{exposure:"hidden"},[Tr]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Rr]:{exposure:"event"},[Or]:{exposure:"event"},[Ar]:{exposure:"event"},[Mr]:{exposure:"event"},[Dr]:{exposure:"hidden"},[jr]:{exposure:"hidden"},[Sr]:{exposure:"event"},[Lr]:{exposure:"hidden"},[Br]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Nr]:{exposure:"hidden"},[zr]:{exposure:"hidden"},[Ur]:{exposure:"hidden"},[Hr]:{exposure:"hidden"},[qr]:{exposure:"hidden"},[Vr]:{exposure:"hidden"},[Wr]:{exposure:"hidden"},[ir]:{exposure:"event"},[er]:{exposure:"event"},[rr]:{exposure:"event"},[sr]:{exposure:"event"},[Kr]:{exposure:"event"},[Yr]:{exposure:"event"},[Xr]:{exposure:"event"},[Zr]:{exposure:"event"},[Qr]:{exposure:"event"},[ts]:{exposure:"event"},[is]:{exposure:"event"},[es]:{exposure:"event"},[rs]:{exposure:"event"},[ss]:{exposure:"event"},[ns]:{exposure:"event"}},Qn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],to=t=>{var i=Zn[t];if(i)return i;for(var e of Qn){var r=e[1];if(0===t.indexOf(e[0]))return r}},io=(t,i)=>{try{return JSON.stringify(t,(t,i)=>"bigint"==typeof i?i.toString():i,i)}catch(i){return P(t)}},eo=t=>{var i=null==h?void 0:h.createElement("a");return B(i)?null:(i.href=t,i)},ro=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!M(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Ee.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},so=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");M(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},no=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},oo=(t,i)=>t>=i&&g(),ao=(t,i,e,r)=>{if(0===t){if(g()){var s=i+1;return s===e&&r(),s}return i}return 0},lo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ho=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...lo],uo="<masked>",vo=["li_fat_id"];function co(t,i,e){if(!h)return{};var r,s=i?[...lo,...e||[]]:[],n=fo(so(h.URL,s,uo),t);return ms((r={},_s(vo,function(t){var i=Ps(t);r[t]=i||null}),r),n)}function fo(t,i){var e=ho.concat(i||[]),r={};return _s(e,function(i){var e=ro(t,i);r[i]=e||null}),r}function po(t){var i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!U(i)){r.$search_engine=i;var s=h?ro(h.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function go(){return navigator.language||navigator.userLanguage}var _o="$direct";function mo(){return(null==h?void 0:h.referrer)||_o}function yo(t,i,e){var r;void 0===e&&(e=!1);var s=t?[...lo,...i||[]]:[],n=null==(r=e?fi(null==u?void 0:u.href):null==u?void 0:u.href)?void 0:r.substring(0,1e3);return{r:mo().substring(0,1e3),u:n?so(n,s,uo):void 0}}function bo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?fi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==_o?_o:null==(e=eo(r))?void 0:e.host};if(n){o.$current_url=n;var a=eo(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ms(o,fo(n))}return r&&ms(o,po(r)),o}function wo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function xo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var So={flags:Br,surveys:Er},ko=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Eo=t=>t+"_cookie_identity_change_pending",$o=t=>{var i="",e=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(e+s>1e3)break;i+=r,e+=s}return i},Po="main",Co=[vr,cr,pr,gr,_r,Br,mr,wr],To=t=>-1!==Co.indexOf(t),Fo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Io=t=>{if(!t)return{};var i=JSON.parse(t);return j(i)?i:{}},Ro=(t,i)=>{_s(t,(e,r)=>{var s=to(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]})},Oo=class{constructor(t,i,e){if(void 0===e&&(e=!0),this.vo={},this.co=!1,this.fo=!1,this.po=!1,this.mo=!1,this.yo=!1,this.bo=new Map,this._o=!1,this.wo=!1,this.ko=!1,this.So=!1,this.xo=new Set,this._n=t,this.Co=e,this.props={},this.To=void 0,this.Mo=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.eo=this.Io(t),this.po=this.Eo(t),this.load(),this.Ro(),t.debug&&Ee.info("Persistence loaded",t.persistence,r({},this.props)),this.update_config(t,t,i),this.save(),o){var s=()=>this.flush();Es(o,"beforeunload",s,{capture:!1}),Es(o,"pagehide",s,{capture:!1}),this.Po=t=>{if(this.co&&(!t.storageArea||t.storageArea===(null==o?void 0:o.localStorage))&&t.key)if(t.key!==this.Mo){if(this.po){var i=Xn.find(i=>t.key===this.Ao(i));i&&this.Fo(t.key,i)}}else this.Fo(t.key,Po)},Es(o,"storage",this.Po)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.bo.get(i);if(To(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach(t=>s.add(t)),s.size&&this.Oo(i,s)}else this.Oo(i,!0)})}onCrossTabFeatureFlagChange(t){return this.xo.add(t),()=>this.xo.delete(t)}destroy(){this.Po&&o&&(o.removeEventListener("storage",this.Po),this.Po=void 0),this.xo.clear()}Fo(t,i,e){if(void 0===e&&(e=!0),this.$o)return!1;var r,s;try{if(s=Ns.li(t),U(s)){var n=this.Do(i);return n.storageValue=null,i!==Po&&(n.persisted=!1),!1}r=Io(s)}catch(t){return!1}var o=i===Po?r:Ns.di(this.Mo);if(o&&this.Lo(o))return!1;var a=this.No(r,i,e);return i===Po&&this.po&&!Fo(this.qo().main,r)||this.jo(r,i,!0,s),a}Lo(t){var i=this.props[Ae],e=t[Ae];return!B(i)&&!B(e)&&i!==e}jo(t,i,e,r){var s=this.Do(i);s.storageValue=r,i!==Po&&(s.persisted=e);try{s.fingerprint=this.Bo(t,i)}catch(t){s.fingerprint=void 0}}No(t,i,e){var r=!1;return Co.forEach(e=>{var s,n=null==(s=to(e))?void 0:s.storageGroup;if(!(i===Po&&this.po&&n||i!==Po&&n!==i)){var o=e in t,a=this.Ho(e,o?t[e]:void 0),l=this.bo.has(e)?e in this.props:o;l===e in this.props&&Fo(a,this.props[e])||(l?this.zo(e,a,!1):this.Uo(e,!1),r=!0)}}),r&&e&&this.xo.forEach(t=>t()),r}Wo(){if(!this.co)return!1;try{this.ko=!1;var t,i=Ns.li(this.Mo),e=this.Do(Po),r=!1,s=!1;if(i!==e.storageValue)if(U(i))e.storageValue=null;else{if(t=Io(i),this.ko=!this.wo&&this.Lo(t),this.ko)return!1;s=this.No(t,Po,!1),!this.po||Fo(this.qo().main,t)?this.jo(t,Po,!0,i):e.storageValue=i,r=!0}return this.po&&Xn.forEach(i=>{var e=Ns.li(this.Ao(i)),n=this.Do(i),o=t||{},a=r&&Co.some(t=>{var e;return(null==(e=to(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if(U(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.No(o,i,!1)||s));var l=Io(e);s=this.No(l,i,!1)||s,this.jo(l,i,!0,e)}}),s}catch(t){return!1}}Oo(t,i){this.bo.set(t,i);var e=to(t);null!=e&&e.volatile||(this.Do((this.po?null==e?void 0:e.storageGroup:void 0)||Po).fingerprint=void 0,this.Vo(t))}Go(){Co.forEach(t=>this.bo.set(t,!0))}Ro(){if(this.co)try{var t=Ns.li(this.Mo),i=Io(t);this.Do(Po).storageValue=t,Co.forEach(t=>{var e,r=this.po?null==(e=to(t))?void 0:e.storageGroup:void 0,s=r?Ns.li(this.Ao(r)):null;if(r){var n=this.Do(r);n.storageValue=s,n.persisted=!U(s)}var o=r&&!U(s)?Io(s):i;t in this.props?this.Zo(t,o[t],this.props[t]):t in o&&this.Oo(t,!0)})}catch(t){}}Ho(t,i){var e=this.bo.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){var s=new Set(M(i)?i:[]),n=new Set(M(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=j(i)?r({},i):{},a=j(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}Zo(t,i,e){if(To(t)){var r=this.bo.get(t);if(!0!==r){var s=i;if(this.co)try{var n,o=this.po?null==(n=to(t))?void 0:n.storageGroup:void 0,a=o?this.Ao(o):this.Mo;s=Io(Ns.li(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!B(i)&&!M(i)||!B(s)&&!M(s)||!M(e))return void this.Oo(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach(t=>{h.has(t)!==d.has(t)&&l.add(t)}),l.forEach(t=>{u.has(t)===d.has(t)&&l.delete(t)})}else{if(!j(e))return void(Fo(s,e)?this.bo.delete(t):this.Oo(t,!0));if(!B(i)&&!j(i)||B(i)&&L(e)&&B(s))return void this.Oo(t,!0);var v=j(i)?i:{},c=j(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach(t=>{t in v==t in e&&Fo(v[t],e[t])||l.add(t)}),l.forEach(t=>{t in c==t in e&&Fo(c[t],e[t])&&l.delete(t)})}l.size?this.Oo(t,l):this.bo.delete(t)}}}Jo(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return q(i)&&i>0?i:0}Qo(t){if(this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase())if(t)try{var i=Ws(t,this._n.cookie_persisted_properties||[]),e=Js(i,this._n.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ls.li(this.Mo)||void 0;s&&Ys(this.Mo,s)===r&&(this.Ko=r,this.Xo=s)}catch(t){}else try{var n=Ls.li(this.Mo)||void 0;this.Ko=n?Ys(this.Mo,n):void 0,this.Xo=n}catch(t){}}syncCookieProperties(){return this.Yo(this._n)}Yo(t,i){if(void 0===i&&(i=!1),this.$o&&!i||this.yo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=Ls.li(this.Mo)||void 0}catch(t){}if(!e||e===this.Xo)return!1;var r,s=Ys(this.Mo,e);try{r=Vs(JSON.parse(e))}catch(t){return!1}if((Ls.li(this.Mo)||void 0)!==e)return!1;this.Ko=s,this.Xo=e;var n=Ks(this.Mo,e),o=[...Us,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(B(i)||U(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(a[t]=!0,delete r[t])}),L(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,u=h[Ae],d=h[Nr],v=ms({},h);[...Us,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){var i=v[t];(n.isValid||-1===Us.indexOf(t)||!1!==i&&0!==i)&&delete v[t]}}),this.props=ms(v,r),Co.forEach(t=>{var i=t in this.props;t in h===i&&Fo(h[t],this.props[t])||(i?this.Zo(t,h[t],this.props[t]):this.Oo(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.zo(Nr,as);var c=this.props[Ae],f=this.props[Nr];return!l||c===u&&f===d||(this.wo=!0,this.mo=!0,tn.ui(Eo(this.Mo),!0),this.Uo(wr),this.Uo(cr),this.Uo(vr),this.Uo(pr),this.Uo(gr),this.Uo(_r),this.Uo(Br),this.Uo(Lr),this.Uo(Dr),"anonymous"!==f||"identified"!==d&&"anonymous"!==r.$user_state&&(B(u)||c===u)||(Ro(this.props,r),this.Uo(xr)),"identified"===f?this.props.$user_id=c:delete this.props.$user_id,this.Uo(je)),!0}consumeCookieIdentityChange(){var t=Eo(this.Mo),i=this.mo||!!tn.li(t);return this.mo=!1,i&&tn.hi(t),i}ta(t){return void 0===t&&(t=!1),!(this.yo||this.$o&&!t||!this._n.cookieWinsOnConflict||"localstorage+cookie"!==this._n.persistence.toLowerCase()||(this.yo=!0,0))}ea(){this.yo&&(B(this.ia)||(clearTimeout(this.ia),this.ia=void 0),delete this.vo[Po],this.ra(!0))}na(t){if(void 0===t&&(t=!0),this.yo)try{t?this.ea():B(this.ia)||(clearTimeout(this.ia),this.ia=void 0)}finally{this.yo=!1}}isDisabled(){return!!this.$o}Io(t){-1===ko.indexOf(t.persistence.toLowerCase())&&(Ee.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,e=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var e=[...Us,...t];return r({},Ns,{di(t){try{var r,s={};try{r=Ls.li(t)||void 0,s=r?Vs(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(Ns.li(t)||"{}");if(i){var a=Ks(t,r),l=[...Us,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];U(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var d,v=o[Ae],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===Us.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Nr]=as),!u||("distinct_id"in h?h[Ae]:o[Ae])===v&&("$user_state"in h?h[Nr]:o[Nr])===c||(zs.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[Ae]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[Sr],delete o[xr]),delete o.__alias)}n=ms(o,h)}else n=ms(s,o);return Ns.ui(t,n),n}catch(t){}return null},ui(e,r,s,n,o,a){var l=Ns.ui(e,r,void 0,void 0,a);try{var h=Ws(r,t);if(Object.keys(h).length){if(i){var u=Hs(e),d=Js(h,t);if(Ls.ui(u,d,s,n,o,a),Ls.li(u)!==JSON.stringify(d)){Ls.hi(u,n);var v=Ws(r);return Ls.ui(e,v,s,n,o,a),l}}Ls.ui(e,h,s,n,o,a)}}catch(t){Ns.ci(t)}return l},hi(t,i){try{null==o||o.localStorage.removeItem(t),Ls.hi(t,i),Ls.hi(Hs(t),i)}catch(t){Ns.ci(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&Ns.si()?(i=Ns,n=!0):"localstorage+cookie"===a&&e.si()?(i=e,n=!0,s=!0):"sessionstorage"===a&&tn.si()?i=tn:"memory"===a?i=Zs:"cookie"===a&&Ls.si()?(i=Ls,s=!0):e.si()?(i=e,n=!0,s=!0):Ls.si()?(i=Ls,s=!0):i=Zs,this.co=n,this.fo=s,i}Ao(t){return this.Mo+"__"+t}Eo(t){return this.co&&!!t.split_storage}properties(){var t={};return _s(this.props,(i,e)=>{var r=to(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}}),t}load(t){if(void 0===t&&(t=!1),!this.$o||t){var i=this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase(),e=i?Ns.di(this.Mo):null,r={};if(i)try{_s(r=Vs(Ls.di(this.Mo)),(t,i)=>{(B(t)||U(t)||""===t)&&delete r[i]})}catch(t){}var s=this.eo.di(this.Mo);if(s&&(this.props=ms({},s)),this.po&&this.sa(),i&&s){var n,o,a=null==e?void 0:e[Ae],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[Ae],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.mo=!0,tn.ui(Eo(this.Mo),!0);var d=ms({},this.props);zs.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(B(a)||h===a)||(Ro(d,r),delete d[xr]),this.props=d;var v=new Set;zs.forEach(t=>{var i,e=null==(i=to(t))?void 0:i.storageGroup;e&&v.add(e)}),v.forEach(t=>{var i={};_s(this.props,(e,r)=>{var s;(null==(s=to(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),L(i)?(Ns.hi(this.Ao(t)),this.vo[t]={}):Ns.ui(this.Ao(t),i)&&(this.vo[t]={persisted:!0,fingerprint:this.Bo(i,t)})})}}tn.li(Eo(this.Mo))&&(this.mo=!0)}}sa(){for(var t of Xn){var i=Ns.di(this.Ao(t));if(i&&!L(i)){var e=this.Do(t);e.persisted=!0,this.oa(t)||(e.fingerprint=this.Bo(i,t)),this.aa(t,i)||ms(this.props,i)}}}oa(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=to(i))?void 0:e.storageGroup)===t})}aa(t,i){var e=So[t];if(!e)return!1;var r=i[e],s=this.props[e];return q(r)&&q(s)&&s>r}refreshKey(t){var i;if(!(this.$o||"$fbc_persistence"===t&&this.So)){var e=this.po?null==(i=to(t))?void 0:i.storageGroup:void 0,r=e?Ns.di(this.Ao(e)):this.eo.di(this.Mo);if(r&&t in r)this.zo(t,r[t],!1);else{if(e){var s=this.eo.di(this.Mo);if(s&&t in s)return void this.zo(t,s[t],!1)}this.Uo(t,!1)}}}save(){if(!this.$o){var t=this.Jo();t>0?B(this.ia)&&(this.ia=setTimeout(()=>{this.ia=void 0,this.ra()},t)):this.ra()}}flush(){B(this.ia)||(clearTimeout(this.ia),this.ia=void 0,this.ra())}ra(t){if(void 0===t&&(t=!1),!(this.$o||this.yo&&!t)){t||(this.syncCookieProperties(),this.So||this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase()||this.refreshKey(Ne));var i=!t&&!this._o;i||(this.ko=!1);var e=!!i&&this.Wo();if(this.ko)this._n.debug&&Ee.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.po)return this.la(),void(e&&this.xo.forEach(t=>t()));var r=this.ua(this.eo,this.Mo,this.props,Po);"written"===r&&this.Qo(this.props),"failed"!==r&&(this.bo.clear(),this.wo=!1,this.So=!1),e&&this.xo.forEach(t=>t())}}}la(){var t=this,i=this.qo(),e=i.main,r=i.groups,s=this.ua(this.eo,this.Mo,e,Po);"written"===s&&this.Qo(e),"failed"!==s&&(this.wo=!1,this.So=!1,Co.forEach(t=>{var i;null!=(i=to(t))&&i.storageGroup||this.bo.delete(t)}));var n=function(i){var e,s=r[i];if(L(s)&&(null==(e=t.vo[i])||!e.persisted))return Co.forEach(e=>{var r;(null==(r=to(e))?void 0:r.storageGroup)===i&&t.bo.delete(e)}),1;var n=t.ua(Ns,t.Ao(i),s,i);"failed"!==n&&Co.forEach(e=>{var r=to(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.bo.delete(e)})};for(var o of Xn)if(n(o))continue}qo(){var t={},i={flags:{},surveys:{}};return _s(this.props,(e,r)=>{var s,n=null==(s=to(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Bo(t,i){if(i===Po)return JSON.stringify(t)+"|"+this.ha+"|"+this.da+"|"+this.va;var e={};return _s(t,(t,i)=>{var r;e[i]=null!=(r=to(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}ua(t,i,e,r){var s,n=this.Do(r);if(r!==Po&&!n.dirty&&!B(n.fingerprint))return"skipped";try{if((s=this.Bo(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ui(i,e,this.ha,this.da,this.va,this._n.debug)?(n.dirty=!1,r!==Po&&(n.persisted=!0),B(s)||(n.fingerprint=s),this.co&&(n.storageValue=Ns.li(i)),"written"):(this._n.debug&&Ee.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.Go(),B(this.ia)||(clearTimeout(this.ia),this.ia=void 0),this.eo.hi(this.Mo,!1),this.eo.hi(this.Mo,!0),!e&&this.Co)for(var r of Xn)Ns.hi(this.Ao(r));e?delete this.vo[Po]:this.vo={},this.Ko=void 0,this.Xo=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(j(t)){this.syncCookieProperties(),B(i)&&(i="None"),this.ha=B(e)?this.ca:e;var r=!1;if(_s(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.zo(e,t),r=!0)}),r)return this.save(),!0}return!1}register(t,i){if(j(t)){this.syncCookieProperties(),this.ha=B(i)?this.ca:i;var e=!1;if(_s(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||j(i)||M(i))&&(this.zo(r,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.Uo(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==h?void 0:h.URL;if(t!==this.To){var i=co(this._n.custom_campaign_params,this._n.mask_personal_data_properties,this._n.custom_personal_data_properties),e=!L(xs(i));return e&&this.register(i),this.To=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==h?void 0:h.referrer)?po(t):{})}update_referrer_info(){var t;this.register_once({$referrer:mo(),$referring_domain:null!=h&&h.referrer&&(null==(t=eo(h.referrer))?void 0:t.host)||_o},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=yo(this._n.mask_personal_data_properties,this._n.custom_personal_data_properties,this._n.disable_capture_url_hashes);this.register_once({[Vr]:this.fo?{r:$o(t.r),u:t.u?$o(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};_s([qr,Hr],i=>{var e=this.props[i];e&&_s(e,function(i,e){t["$initial_"+E(e)]=i})});var i=this.props[Vr];return i&&ms(t,function(t,i){void 0===i&&(i=!1);var e=bo(t,i),r={};return _s(e,function(t,i){r["$initial_"+E(i)]=t}),r}(i,this._n.disable_capture_url_hashes)),t}safe_merge(t){return _s(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every((t,i)=>t===r[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.$o&&!l;l||this.Yo(i,h),this._n=t,!l&&(s||n||a)&&(this.Ko=void 0,this.Xo=void 0,this.Yo(r({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Io(t):this.eo;this.fa();var d=this.Eo(t),v=o||d!==this.po,c=!l&&(v||t.cross_subdomain_cookie!==this.da||t.secure_cookie!==this.va)&&this.ta(h);this._o=v;try{if(this.ca=this.ha=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.eo=u,this.po=d,this.props=f,this.save()}else a&&(this.eo=u,l||(delete this.vo[Po],this.ra()))}finally{this._o=!1,c&&this.na()}}fa(){var t=this.props[Vr];if(this.fo&&j(t)&&"string"==typeof t.r){var i=$o(t.r),e="string"==typeof t.u?$o(t.u):t.u;i===t.r&&e===t.u||this.zo(Vr,r({},t,{r:i,u:e}))}}set_disabled(t){this.$o=t,this.$o?this.remove():this.save()}set_cross_subdomain(t){t!==this.da&&(this.da=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.va&&(this.va=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props.__timers||{};e[t]=i,this.zo(ze,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return B(e)||(delete i[t],this.zo(ze,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.zo(t,i),this.save()}zo(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||s===i||(this.wo=!0),"$fbc_persistence"!==t||Fo(s,i)||(this.So=!0),this.Zo(t,s,i),null!=(r=to(t))&&r.volatile||this.Vo(t))}Uo(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(To(t)&&this.Oo(t,!0),"$fbc_persistence"===t&&(this.So=!0),this.Vo(t))}Vo(t){var i,e=null==(i=to(t))?void 0:i.storageGroup;e&&(this.Do(e).dirty=!0)}Do(t){return this.vo[t]||(this.vo[t]={})}},Ao="gzip-js",Mo="base64",Do="events",jo="cancelEvents",Lo="survey shown",Bo="survey dismissed",No="survey sent",zo="$survey_last_seen_date",Uo="popover";function Ho(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&D(e.then)&&e.then(void 0,()=>{})}}}}var qo=$e("[RateLimiter]"),Vo=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{qo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void qo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(q(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.pa(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Ur,a),{isRateLimited:l,remainingTokens:a.tokens}}ga(t){var i=this.instance.config.property_denylist;return!M(i)||!i.includes(t)}ma(){var t;if(this.ga("$current_url")&&this.ga("$pathname")&&null!=u&&u.pathname)return""+(null!==(t=u.origin)&&void 0!==t?t:"")+u.pathname}pa(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ma(),o=this.ga("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}},Wo=$e("[RemoteConfig]"),Go=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=m._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ya(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}ba(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Wo.info("Using preloaded remote config",this.remoteConfig),void this._a(this.remoteConfig);if(this._instance.wa())return void Wo.warn("Remote config is disabled. Falling back to local config.");this.ya(t=>{if(!t)return Wo.info("No config found after loading remote JS config. Falling back to JSON."),void this.ba(t=>{this._a(t.json,t)});this._a(t)})}catch(t){Wo.error("Error loading remote config",t),this._a()}}_a(t,i){!t&&i&&(0===i.statusCode?i.error||Wo.warn("Failed to fetch remote config from PostHog."):Wo.error("Failed to fetch remote config from PostHog."));try{this._instance._a(t?{ok:!0,config:t}:{ok:!1})}catch(t){Wo.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){Wo.error("Error loading feature flags",t)}}},Jo=Uint8Array,Ko=Uint16Array,Yo=Uint32Array,Xo=new Jo([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]),Zo=new Jo([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]),Qo=new Jo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ta=function(t,i){for(var e=new Ko(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Yo(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},ia=ta(Xo,2),ea=ia[1];ia[0][28]=258,ea[258]=28;for(var ra=ta(Zo,0)[1],sa=new Ko(32768),na=0;32768>na;++na){var oa=(43690&na)>>>1|(21845&na)<<1;sa[na]=((65280&(oa=(61680&(oa=(52428&oa)>>>2|(13107&oa)<<2))>>>4|(3855&oa)<<4))>>>8|(255&oa)<<8)>>>1}var aa=function(t,i,e){for(var r=t.length,s=0,n=new Ko(i);r>s;++s)++n[t[s]-1];var o,a=new Ko(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Ko(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[sa[d]>>>l]=h}else for(o=new Ko(r),s=0;r>s;++s)o[s]=sa[a[t[s]-1]++]>>>15-t[s];return o},la=new Jo(288);for(na=0;144>na;++na)la[na]=8;for(na=144;256>na;++na)la[na]=9;for(na=256;280>na;++na)la[na]=7;for(na=280;288>na;++na)la[na]=8;var ha=new Jo(32);for(na=0;32>na;++na)ha[na]=5;var ua=aa(la,9,0),da=aa(ha,5,0),va=function(t){return(t/8|0)+(7&t&&1)},ca=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Ko?Ko:t instanceof Yo?Yo:Jo)(e-i);return r.set(t.subarray(i,e)),r},fa=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},pa=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},ga=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Jo(0),0];if(1==s){var o=new Jo(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Ko(v+1),f=_a(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;i>c[y]?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Jo(c),f]},_a=function(t,i,e){return-1==t.s?Math.max(_a(t.l,i,e+1),_a(t.r,i,e+1)):i[t.s]=e},ma=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ko(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},ya=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ba=function(t,i,e){var r=e.length,s=va(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},wa=function(t,i,e,r,s,n,o,a,l,h,u){fa(i,u++,e),++s[256];for(var d=ga(s,15),v=d[0],c=d[1],f=ga(n,15),p=f[0],g=f[1],_=ma(v),m=_[0],y=_[1],b=ma(p),w=b[0],x=b[1],S=new Ko(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=ga(S,7),P=E[0],C=E[1],T=19;T>4&&!P[Qo[T-1]];--T);var F,I,R,O,A=h+5<<3,M=ya(s,la)+ya(n,ha)+o,D=ya(s,v)+ya(n,p)+o+14+3*T+ya(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(M>=A&&D>=A)return ba(i,u,t.subarray(l,l+h));if(fa(i,u,1+(M>D)),u+=2,M>D){F=aa(v,c,0),I=v,R=aa(p,g,0),O=p;var j=aa(P,C,0);for(fa(i,u,y-257),fa(i,u+5,x-1),fa(i,u+10,T-4),u+=14,k=0;T>k;++k)fa(i,u+3*k,P[Qo[k]]);u+=3*T;for(var L=[m,w],B=0;2>B;++B){var N=L[B];for(k=0;N.length>k;++k)fa(i,u,j[z=31&N[k]]),u+=P[z],z>15&&(fa(i,u,N[k]>>>5&127),u+=N[k]>>>12)}}else F=ua,I=la,R=da,O=ha;for(k=0;a>k;++k)if(r[k]>255){var z;pa(i,u,F[257+(z=r[k]>>>18&31)]),u+=I[z+257],z>7&&(fa(i,u,r[k]>>>23&31),u+=Xo[z]);var U=31&r[k];pa(i,u,R[U]),u+=O[U],U>3&&(pa(i,u,r[k]>>>5&8191),u+=Zo[U])}else pa(i,u,F[r[k]]),u+=I[r[k]];return pa(i,u,F[256]),u+I[256]},xa=new Yo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Sa=new Jo(0),ka=function(){for(var t=new Yo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Ea=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function $a(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=ka[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h,u=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Jo(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ba(l,h,t.subarray(u,d)):(l[u]=n,h=ba(l,h,t.subarray(u,o)))}else{for(var v=xa[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Ko(32768),_=new Ko(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Yo(25e3),x=new Ko(288),S=new Ko(32),k=0,E=0,P=(u=0,0),C=0,T=0;o>u;++u){var F=b(u),I=32767&u,R=_[F];if(g[I]=R,_[F]=I,u>=C){var O=o-u;if((k>7e3||P>24576)&&O>423){h=wa(t,l,0,w,x,S,E,P,T,u-T,h),P=k=E=0,T=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)S[A]=0}var M=2,D=0,j=f,L=I-R&32767;if(O>2&&F==b(u-L))for(var B=Math.min(c,O)-1,N=Math.min(32767,u),z=Math.min(258,O);N>=L&&--j&&I!=R;){if(t[u+M]==t[u+M-L]){for(var U=0;z>U&&t[u+U]==t[u+U-L];++U);if(U>M){if(M=U,D=L,U>B)break;var H=Math.min(L,U-2),q=0;for(A=0;H>A;++A){var V=u-L+A+32768&32767,W=V-g[V]+32768&32767;W>q&&(q=W,R=V)}}}L+=(I=R)-(R=g[I])+32768&32767}if(D){w[P++]=268435456|ea[M]<<18|ra[D];var G=31&ea[M],J=31&ra[D];E+=Xo[G]+Zo[J],++x[257+G],++S[J],C=u+M,++k}else w[P++]=t[u],++x[t[u]]}}h=wa(t,l,n,w,x,S,E,P,T,u-T,h),n||(h=ba(l,h,Sa))}return ca(a,0,r+va(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!h)),d=u.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Ea(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(u,i),Ea(u,d-8,e.d()),Ea(u,d-4,r),u}var Pa=!!v||!!d,Ca="text/plain",Ta=!1,Fa=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter(t=>t.split("=")[0]!==i).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Ia=function(t,i,e){var s;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=r({},i),h=null!==(s=null==a?void 0:a.split("&").map(t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=l[s])&&void 0!==i?i:r[1];return delete l[s],s+"="+n}))&&void 0!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return _s(t,function(t,i){B(t)||B(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)}),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},Ra=t=>{if(t.ka)return t.ka;var i=t.data,e=t.compression;if(i){if(e===Ao){var r=$a(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new Jo(t.length+(t.length>>>1)),r=0,s=function(t){e[r++]=t},n=0;i>n;++n){if(r+5>e.length){var o=new Jo(r+8+(i-n<<1));o.set(e),e=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return ca(e,0,r)}(io(i)),{mtime:0});return{contentType:Ca,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Mo){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:io(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(io(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=io(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Oa=t=>{var i,e,s=()=>"sendBeacon"===t.transport?{url:Ia(t.url,{compression:Mo}),encodedBody:Ra(r({},t,{compression:Mo,ka:void 0}))}:{url:Fa(t.url,"compression"),encodedBody:Ra(r({},t,{compression:void 0,ka:void 0}))};try{i=Ra(t)}catch(i){if(ie(t.compression,ro(t.url,"compression")))return Ee.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&ie(t.compression,ro(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?te(new Uint8Array(e)):ArrayBuffer.isView(e)&&te(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Ta=!0,s()):{url:t.url,encodedBody:i}},Aa=t=>{try{return Oa(t)}catch(i){return Ee.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Ma=function(){var t=n(function*(t){var i=yield function(t,i,e){return ne.apply(this,arguments)}(io(t.data),Re.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return r({},t,{ka:{contentType:Ca,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),Da=/Failed to fetch|NetworkError|Load failed/i,ja=t=>"TypeError"===(null==t?void 0:t.name)&&Da.test((null==t?void 0:t.message)||""),La=t=>{var i=Aa(t);if(i){var e=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;_s(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,v=!1;if(c){var f=new c;u={signal:f.signal,timeout:setTimeout(()=>{var i;v=!0,f.abort(ci("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))},t.timeout)}}var p=i=>{v&&"AbortError"===(null==i?void 0:i.name)||ja(i)?Ee.warn(i):Ee.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var g;d(e,r({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Sa&&52428.8>(l||0),body:a,signal:null==(g=u)?void 0:g.signal},t.fetchOptions)).then(i=>i.text().then(e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Ee.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),p(t)}}},Ba=t=>{try{var i,e=Oa(t),s=e.url,n=e.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(l.sendBeacon(s,u))return;var d=M(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(M(d)&&d.length>1&&(null!=h?h:0)>16384){var v=Math.ceil(d.length/2),c=i=>M(t.data)?i:r({},t.data,{batch:i});return Ba(r({},t,{data:c(d.slice(0,v))})),void Ba(r({},t,{data:c(d.slice(v))}))}Ee.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),La(r({},t,{Sa:!0}))}catch(t){Ee.warn("Beacon send failed",t)}},Na=(t,i,e,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return Ia(e===Ao?Fa(t,"compression"):t,r({},n?{[n]:Date.now().toString()}:{},e===Ao?{}:{compression:e}))},za=[];d&&za.push({transport:"fetch",method:La}),v&&za.push({transport:"XHR",method(t){var i=Aa(t);if(i){var e=new v,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;_s(t.headers,function(t,i){e.setRequestHeader(i,t)}),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=l&&l.sendBeacon&&za.push({transport:"sendBeacon",method:Ba});var Ua=class{constructor(t,i){this.xa=!0,this.Ca=[],this.Ta=rt((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Ee.createLogger("flush interval"),3e3),this.Ma=t}enqueue(t){this.Ca.push(t),this.Ia||this.Ea()}unload(){this.Ra();var t=this.Ca.length>0?this.Pa():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Aa(r({},t,{transport:"sendBeacon"}))})}enable(){this.xa=!1,this.Ea()}Ea(){var t=this;this.xa||(this.Ia=setTimeout(()=>{if(this.Ra(),this.Ca.length>0){var i=this.Pa(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&M(e.data)&&_s(e.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.Aa(e)};for(var r in i)e()}},this.Ta))}Aa(t){try{this.Ma(t)}catch(t){Ee.error(t)}}Ra(){clearTimeout(this.Ia),this.Ia=void 0}Pa(){var t={};return _s(this.Ca,i=>{var e,s=i,n=(s?s.batchKey:null)||s.url;B(t[n])&&(t[n]=r({},s,{data:[]})),null==(e=t[n].data)||e.push(s.data)}),this.Ca=[],t}},Ha=class{constructor(t){this._instance=t,this.Fa=!1,this.Oa=3e3,this.Ca=[],this.Ca=[],this.$a=!0,!B(o)&&"onLine"in o.navigator&&(this.$a=o.navigator.onLine,this.Da=()=>{this.$a=!0,this.La()},this.Na=()=>{this.$a=!1},Es(o,"online",this.Da),Es(o,"offline",this.Na))}get length(){return this.Ca.length}retriableRequest(i){var s=i.retriesPerformedSoFar,n=e(i,t);V(s)&&(n.url=Ia(n.url,{retry_count:s})),this._instance._send_request(r({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=s?s:0))return void this.cs(r({retriesPerformedSoFar:s},n));0===t.statusCode&&Ee.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=s?s:0)+" retries.")}null==n.callback||n.callback(t)}}))}cs(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.Ca.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Ee.warn(s),this.Fa||(this.Fa=!0,this.qa())}qa(){if(this.ja&&clearTimeout(this.ja),0===this.Ca.length)return this.Fa=!1,void(this.ja=void 0);this.ja=setTimeout(()=>{this.$a&&this.Ca.length>0&&this.La(),this.qa()},this.Oa)}La(){var t=Date.now(),i=[],e=this.Ca.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.Ca=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ja&&(clearTimeout(this.ja),this.ja=void 0),this.Fa=!1,B(o)||(this.Da&&(o.removeEventListener("online",this.Da),this.Da=void 0),this.Na&&(o.removeEventListener("offline",this.Na),this.Na=void 0)),this.Ca)){var i=t.requestOptions;try{this._instance._send_request(r({},i,{transport:"sendBeacon"}))}catch(t){Ee.error(t)}}this.Ca=[]}},qa=class{constructor(t){this._instance=t,this.Ba=()=>{var t,i,e,r;this.Ha||(this.Ha={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Ha.lastScrollY=Math.ceil(n),this.Ha.maxScrollY=Math.max(n,null!==(t=this.Ha.maxScrollY)&&void 0!==t?t:0),this.Ha.maxScrollHeight=Math.max(o,null!==(i=this.Ha.maxScrollHeight)&&void 0!==i?i:0),this.Ha.lastContentY=a,this.Ha.maxContentY=Math.max(a,null!==(e=this.Ha.maxContentY)&&void 0!==e?e:0),this.Ha.maxContentHeight=Math.max(l,null!==(r=this.Ha.maxContentHeight)&&void 0!==r?r:0)}}get za(){return this._instance.config.scroll_root_selector}getContext(){return this.Ha}resetContext(){var t=this.Ha;return setTimeout(this.Ba,0),t}startMeasuringScrollPosition(){Es(o,"scroll",this.Ba,{capture:!0}),Es(o,"scrollend",this.Ba,{capture:!0}),Es(o,"resize",this.Ba)}scrollElement(){var t;if(!this.za)return null==o||null==(t=o.document)?void 0:t.documentElement;for(var i of M(this.za)?this.za:[this.za]){var e,r=null==o||null==(e=o.document)?void 0:e.querySelector(i);if(r)return r}}Ua(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.za){var s=this.scrollElement();return s&&s[r]||0}return o?"y"===t?o.scrollY||o.pageYOffset||(null==(i=o.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:o.scrollX||o.pageXOffset||(null==(e=o.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.Ua("y")}scrollX(){return this.Ua("x")}},Va=t=>yo(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes),Wa=class{constructor(t,i,e,r){this.Te=t=>{var i=this.Wa();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Va(this._instance)};this.Ga.register({[zr]:e})}},this._instance=t,this.Za=i,this.Ga=e,this.Va=r||Va,this.Za.onSessionId(this.Te)}Wa(){return this.Ga.props[zr]}getSetOnceProps(){var t,i=null==(t=this.Wa())?void 0:t.props;return i?"r"in i?bo(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return _s(xs(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i}),t}},Ga=class{on(t,i){return this.Ja[t]||(this.Ja[t]=[]),this.Ja[t].push(i),()=>{this.Ja[t]=this.Ja[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.Ja[t]||[])e(i);for(var r of this.Ja["*"]||[])r(t,i)}constructor(){this.Ja={}}},Ja=$e("[SessionId]"),Ka=864e5,Ya=class{on(t,i){return this.Qa.on(t,i)}constructor(t,i,e){var r;if(this.Ka=null,this.Xa=null,this.Ya=[],this.tl=void 0,this.el=!1,this.Qa=new Ga,this.il=(t,i)=>!(!V(t)||!V(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._n=t.config,this.Ga=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.rl=void 0,this._sessionActivityTimestamp=null,this.nl=i||Os,this.sl=e||Os;var s=this._n.persistence_name||this._n.token;if(this._sessionTimeoutMs=1e3*rt(this._n.session_idle_timeout_seconds||1800,60,36e3,Ja.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ol(),this.al="ph_"+s+"_window_id",this.ll="ph_"+s+"_primary_window_exists",this.ul()){var n=tn.di(this.al),o=tn.di(this.ll);n&&!o?this.Ie=n:tn.hi(this.al),tn.ui(this.ll,!0)}null!=(r=this._n.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this._n.bootstrap.sessionID),this.hl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return B(this.Ya)&&(this.Ya=[]),this.Ya.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.Ya=this.Ya.filter(i=>i!==t)}}ul(){return"memory"!==this._n.persistence&&!this.Ga.$o&&tn.si()}dl(t){t!==this.Ie&&(this.Ie=t,this.ul()&&tn.ui(this.al,t))}vl(){return this.Ie?this.Ie:this.ul()?tn.di(this.al):null}cl(t){var i=this.Ka;return!U(i)&&!U(t)&&5e3>Math.abs(t-i)}fl(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Bt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Bt=t,s&&!r||s&&this.cl(i)||(this.Ka=i,this.Ga.register({[nr]:[i,t,e]}))}pl(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return V(i)&&i>0}gl(){this.pl()?this.Ga.refreshKey(nr):(this.Ga.flush(),this.Ga.load())}ml(){var t;if(!U(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ka){this.gl();var i=this.yl();i[1]===this.Bt&&i[2]===this._sessionStartTimestamp&&(this.Ka=this._sessionActivityTimestamp,this.Ga.register({[nr]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ga.flush())}}bl(){var t=this.yl()[0],i=V(t)?t:0,e=V(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}_l(t){return this.gl(),this.il(t,this.bl())}yl(){var t=this.Ga.props[nr];return M(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ka=null,this.rl=void 0,clearTimeout(this.wl),this.wl=void 0,this.fl(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Ja.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ja.error("Invalid sessionID in bootstrap",t)}}(t);return!B(e)&&(i?this.rl={sessionId:t,sessionStartTimestamp:e}:this.fl(t,(new Date).getTime(),e),!0)}destroy(){this.el=!0,this.ml(),clearTimeout(this.wl),this.wl=void 0,this.tl&&o&&(o.removeEventListener(ds,this.tl,{capture:!1}),this.tl=void 0),this.Ya=[]}hl(){this.tl=()=>{this.ml(),this.ul()&&tn.hi(this.ll)},Es(o,ds,this.tl,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),"always"===this._n.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Bt;if(e)this.Xa=r;else if(U(this.Xa)||this.Xa>r||r-this.Xa>=1e3){var n,o;null==(n=(o=this.Ga).syncCookieProperties)||n.call(o),this.Xa=r}var a=this.yl(),l=a[1],h=a[2],u=!B(s)&&l!==s,d=this.bl(),v=this.vl(),c=this.rl,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ka),p=c?f:V(h)&&Math.abs(r-h)>Ka,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.il(r,d);if(b){(b=this._l(r))||Ja.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.yl();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.nl(),v=this.sl(),Ja.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.rl=void 0,g=!0}else v||(v=this.sl(),g=!0),(_=_||l!==y)&&(Ja.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=V(d)&&t&&!p?d:r,k=V(h)?h:(new Date).getTime();this.dl(v),this.fl(l,S,k),t||this.ol();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.Ya.forEach(t=>t(l,v,E)),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}ol(){this.el||(clearTimeout(this.wl),this.wl=setTimeout(()=>{if(!this.el)if(this._l((new Date).getTime())){var t=this.Bt;this.resetSessionId(),this.Qa.emit("forcedIdleReset",{idleSessionId:t})}else this.ol()},1.1*this.sessionTimeoutMs))}},Xa=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&x(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>x(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Za(){return(Za=n(function*(){var t=null==l?void 0:l.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i,e=null==(i=yield t.getHighEntropyValues(["model"]))?void 0:i.model;return N(e)&&e.length>0?e:void 0}catch(t){return void Ee.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Qa(t,i){var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e}function tl(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var il=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},el=t=>t.toLowerCase(),rl={exact:(t,i)=>i.some(i=>t.some(t=>i===t)),is_not:(t,i)=>i.every(i=>t.every(t=>i!==t)),regex:(t,i)=>i.some(i=>t.some(t=>il(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!il(i,t))),icontains:(t,i)=>i.map(el).some(i=>t.map(el).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(el).every(i=>t.map(el).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function sl(t,i){return!t||Object.entries(t).every(t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=rl[e.operator];return!!s&&s(e.values,[String(r)])})}function nl(t,i,e){return io({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var ol="custom",al="i.posthog.com",ll=/^\/static\//,hl=["/s/","/e/","/i/"],ul=class{constructor(t){this.kl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+al,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.kl[this.apiHost]||(this.kl[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":ol),this.kl[this.apiHost]}Sl(t){if(ll.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}xl(t){var i=eo(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Cl(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=eo(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&hl.some(t=>0===i.indexOf(t))){var a=this.xl(r);if(a){var l,h=this.apiHost,u=this.Tl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.Tl=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Tl,e=this.xl(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.Cl(t,i,this.uiHost+i);if("flags"===t)return this.Cl(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.Sl(i);if(e)return this.Cl(t,i,""+e+i)}if(this.region===ol)return this.Cl(t,i,this.apiHost+i);var r=al+i;switch(t){case"assets":return this.Cl(t,i,"https://"+this.region+"-assets."+r);case"api":return this.Cl(t,i,"https://"+this.region+"."+r)}}},dl=$e("[Surveys]"),vl=t=>{try{var i=(t=>((t,i)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){dl.error("Failed to persist survey seen state",t)}},cl=["popover","widget","api"],fl={ignoreConditions:!1,ignoreDelay:!1,displayType:Uo},pl=$e("[PostHog ExternalIntegrations]"),gl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},_l=class{constructor(t){this._instance=t}so(t,i){var e;null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return pl.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=m.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.so(gl[n],()=>{var i;null==(i=m.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=m.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=m.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}},ml=class{constructor(t,i){this.A=t,this.Us=i,this.Ml=new Map,this.Bs=!1}add(t){var i=this;return n(function*(){if(i.Bs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Ml.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Ml.set(t.name,t);try{var e=t.setup(i.Us);e&&(yield e)}catch(e){var r=i.Ml.get(t.name)===t;r&&i.Ml.delete(t.name),i.A.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Il(t)}})()}getExtension(t){return this.Ml.get(t)}dispose(){if(!this.Bs){this.Bs=!0;var t=Array.from(this.Ml.values()).reverse();for(var i of(this.Ml.clear(),t))this.Il(i)}}Il(t){try{var i=null==t.dispose?void 0:t.dispose();i&&D(i.then)&&i.then(void 0,i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)})}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}},yl=class{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);B(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}},bl="extensionsRemoteConfig",wl=class{constructor(t){this.instance=t,this.Bs=!1,this.A=Ee,this.El=t.Rl,this.kv=new yl(t),this.onEvent=t=>Ho(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.Bs)return Ho(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Pl.on(bl,i);return this.El&&i(this.El),Ho(e)},this.Al=new ml(Ee.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Me);return"string"==typeof t?t:void 0}get library(){return{name:Re.LIB_NAME,version:Re.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Al.add(t)}getExtension(t){return this.Al.getExtension(t)}capture(t,i,e){var r=this;return n(function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)})()}registerDynamicEventProperties(t){return Ho(this.instance.Fl(t))}handleRemoteConfig(t){this.Bs||(this.El=t,this.instance.Pl.emit(bl,t))}sendRequest(t,i){var e=this;return n(function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?Ia(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?T.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(n),{statusCode:202}):new Promise(t=>{n.callback=t,e.instance._send_request(n)})})()}dispose(){this.Bs||(this.Bs=!0,this.Al.dispose())}},xl={},Sl=0,kl=()=>{},El='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$l="Surveys module not available",Pl="sanitize_properties is deprecated. Use before_send instead",Cl="Invalid value for property_denylist config: ",Tl=/^[A-Za-z0-9_-]{1,400}$/,Fl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Il=["token","distinct_id",Jr],Rl="posthog",Ol=!Pa&&-1===(null==p?void 0:p.indexOf("MSIE"))&&-1===(null==p?void 0:p.indexOf("Mozilla")),Al=t=>{var i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},Ml=t=>{var i;return r({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ks(null==h?void 0:h.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:kl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:u&&N(null==u?void 0:u.search)&&-1!==u.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==o||null==(i=o.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Ee.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:hs,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:kl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:bn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Al(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},Dl=[["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"]],jl=t=>{var i={};for(var e of Dl){var r=e[0],s=e[1];B(t[r])||(i[s]=t[r])}var n=ms({},i,t),o=t.__preview_external_dependency_versioned_paths;return B(o)||(B(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),N(o)&&B(t.asset_host)&&(n.asset_host=o)),M(t.property_blacklist)&&(B(t.property_denylist)?n.property_denylist=t.property_blacklist:M(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ee.error(Cl+t.property_denylist)),n},Ll=class{constructor(){this.__forceAllowLocalhost=!1}get Ol(){return this.__forceAllowLocalhost}set Ol(t){Ee.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Bl=(s=class t{$l(t){if(t){var i=this.Ml.indexOf(t);-1!==i&&this.Ml.splice(i,1)}}Dl(t,i){return this.$l(t),this.Ml.push(i),null==i.initialize||i.initialize(),i}Ll(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Nl(){if(!(this.ql||this.config.reuseAnonymousId||this.config.segment||this.Ll())){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.jl||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.ql=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", 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. "+e)))}}Bl(){if(!this.Ll()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.Hl()||t.load(!0);var i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){var e=this.config.get_device_id(Os());this.register({distinct_id:e,$device_id:e}),t.set_property(Nr,as)}this.zl()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this.webPerformance=new Ll,this.Ul=!1,this.version=Re.LIB_VERSION,this.Wl=new Set,this.Vl="",this.Pl=new Ga,this.Ml=[],this.Gl=[],this.jl=!1,this.ql=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ml(),this.SentryIntegration=Kn,this.sentryIntegration=t=>function(t,i){var e=Jn(t,i);return{name:Gn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Zl=!1,this.Jl=null,this.Ql=null,this.Kl=null,this.scrollManager=new qa(this),this.pageViewManager=new Yn(this),this.rateLimiter=new Vo(this),this.requestRouter=new ul(this),this.consent=new en(this),this.externalIntegrations=new _l(this);var e=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,i,e)=>{var r=N(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=N(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",t=>Ee.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==Rl){var s,n=null!==(s=xl[r])&&void 0!==s?s:new t;return n._init(i,e,r),xl[r]=n,xl[Rl][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var s,n,a;void 0===i&&(i={});var l,h=N(t)?t.trim():"";if(!h)return Ee.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 h!==(null==(l=this.config)?void 0:l.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('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ml(i.defaults),i.debug=this.Xl(i.debug),this.Yl=i,this.tu=[],i.person_profiles?this.Ql=i.person_profiles:i.process_person&&(this.Ql=i.process_person);var u=Ml(i.defaults),d=jl(i),v=ms({},u,d,{name:e,token:h});j(u.rageclick)&&j(d.rageclick)&&(v.rageclick=ms({},u.rageclick,d.rageclick)),j(u.session_recording)&&j(d.session_recording)&&(v.session_recording=ms({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Ee.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Ao;var c=this.Hl();if(this.persistence=new Oo(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Oo(r({},this.config,{persistence:"sessionStorage"}),c,!1),this.Vl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&tn.si()){var f=tn.di(this.Vl);M(f)&&f.forEach(t=>{N(t)&&this.Wl.add(t)})}else tn.hi(this.Vl);var p=r({},this.persistence.props),g=r({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.eu=new Ua(t=>this.iu(t),this.config.request_queue_config),this.ru=new Ha(this),this.__request_queue=[];var _=this.Ll();_||(this.sessionManager=new Ya(this),this.sessionPropsManager=new Wa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.nu()})),this.su(),this.config.__preview_deferred_init_extensions?(Ee.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.ou(_)},0)):(Ee.info("Initializing extensions synchronously"),this.ou(_)),Re.DEBUG=Re.DEBUG||this.config.debug,Re.DEBUG&&Ee.info("Starting in debug mode",{this:this,config:i,thisC:r({},this.config),p:p,s:g}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=r({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.jl=!!m&&!z(m),void 0!==(null==(a=i.bootstrap)?void 0:a.distinctID)){var y=i.bootstrap.distinctID,b=this.get_distinct_id(),w=this.persistence.get_property(Nr);if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&"anonymous"===w)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=b&&b!==y&&"identified"===w)Ee.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var x=this.config.get_device_id(Os()),S=i.bootstrap.isIdentifiedID?x:y;this.persistence.set_property(Nr,i.bootstrap.isIdentifiedID?ls:as),this.register({distinct_id:y,$device_id:S})}}if(_)this.register_once({distinct_id:Gr,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(Os());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(Nr,as)}return Es(o,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?Wn(this,()=>this.au()):this.au(),D(this.config._onCapture)&&this.config._onCapture!==kl&&(Ee.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Ee.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||function(){return Za.apply(this,arguments)}().then(t=>{t&&this.register({[De]:t})}).catch(kl),this}lu(t){var i=t;return N(i.name)&&D(i.setup)}uu(t,i){this.lu(t)?i.push(()=>{this.hu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{Ee.error('Failed to dispose browser extension "'+t.name+'"',i)})}):this.Ml.push(t)}su(){var i,e,r,s,n,o,a=null!==(i=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==i?i:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.du)||o.call(this),this.du=void 0,this.featureFlags=new a(this)),D(this.featureFlags.onReloading)&&D(this.featureFlags.setup)?this.du||(this.du=this.featureFlags.onReloading(()=>{this.Pl.emit("featureFlagsReloading",!0)}),this.hu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}ou(i){var e,s,n,o,a,l,h,u=performance.now(),d=r({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.Ml.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new d.exceptions(this)),d.historyAutocapture&&this.Ml.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ml.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ml.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!i&&this.Ml.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.uu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.uu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.uu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.Ml.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Ml.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Ml.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ml.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ml.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ml.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ml.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Hn)),d.toolbar&&this.Ml.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.Ml.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.Ml.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.vu){var t=this.vu;this.vu=void 0,this.Ml.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}}),this.cu(v,u)}cu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.cu(t,i)},0);var e=t.shift();if(e)try{e()}catch(t){Ee.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Kr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Yr]:r}),this.config.__preview_deferred_init_extensions&&Ee.info("PostHog extensions initialized ("+r+"ms)")}_a(t){var i;if(!h||!h.body)return Ee.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._a(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.vu=t),this.Rl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=S(r.supportedCompression,Ao)?Ao:S(r.supportedCompression,Mo)?Mo:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Ql?this.Ql:hs}),null==(i=this.fu)||i.handleRemoteConfig(t),this.Ml.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}au(){try{this.config.loaded(this)}catch(t){Ee.critical("`loaded` function failed",t)}if(this.pu(),this.config.internal_or_test_user_hostname&&null!=u&&u.hostname){var t=u.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ll())&&this.gu()},1),this.mu=new Go(this),this.mu.load()}pu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.eu)||t.enable())}_dom_loaded(){this.is_capturing()&&gs(this.__request_queue,t=>this.iu(t)),this.__request_queue=[],this.pu()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.yu()&&this.capture(cs),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.eu)||r.unload(),null==(s=this.ru)||s.unload()):this.yu()&&this.capture(cs,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Ol?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=r({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(B(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,s,n=r({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&B(n.compression)&&n.data&&(n.compression=Mo),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(M(o=n.data)?o:[o]).map(t=>r({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),M(t)?t.map(t=>r({},t,{sent_at:i})):r({},t,{sent_at:i})}(n.data))),n.url=Na(n.url,n.method,n.compression,n.timestampMode);var v=za.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(i(t[e]))return t[e]}(v,t=>t.transport===d))?void 0:s.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var p=t=>{try{c(t)}catch(t){ja(t)?Ee.warn(t):Ee.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ao&&f&&"undefined"!=typeof Promise&&!Ta?Ma(n).then(t=>{p(t)}).catch(i=>{if(ee(i))return Ta=!0,void p(r({},n,{compression:void 0,url:Na(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return ee(t)||i===Qi})(i)&&(Ta=!0),p(n)}):c(n)})(r({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}iu(t){this.ru?this.ru.retriableRequest(t):this._send_request(t)}_execute_array(t){Sl++;try{var i,e=[],r=[],s=[];gs(t,t=>{if(t)if(M(i=t[0]))s.push(t);else if(D(t))try{t.call(this)}catch(i){Ee.error("Error executing queued PostHog call",t,i)}else M(t)&&"alias"===i?e.push(t):M(t)&&-1!==i.indexOf("capture")&&D(this[i])?s.push(t):r.push(t)});var n=function(t,i){gs(t,function(t){try{if(M(t[0])){var e=i;_s(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Ee.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{Sl--}}push(i){if(Sl>0&&M(i)&&N(i[0])){var e=t.prototype[i[0]];D(e)&&e.apply(this,i.slice(1))}else this._execute_array([i])}bu(){var t,i=null==(t=this.persistence)?void 0:t.get_property(Ne);return N(i)&&Fl.test(i)?{value:i,delivered:!1}:j(i)&&N(i.value)&&Fl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_u(t,i,e,r){if(this.persistence){this.persistence.refreshKey(Ne);var s=this.bu();if(!r){if(e)return N(i)&&Fl.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[Ne]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(Ne);if(N(t)&&Tl.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[Ne]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(Ne)}}wu(t){if(this.persistence){this.persistence.refreshKey(Ne);var i=this.bu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[Ne]:{value:t,delivered:!0}})}}capture(t,i,e){var s,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.eu){if(this.is_capturing())if(!B(t)&&N(t)){this.Bl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var p=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var g;null!=i&&i.$current_url&&!N(null==i?void 0:i.$current_url)&&(Ee.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.ku||Ee.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&&(g=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 _=new Date,m=(null==e?void 0:e.timestamp)||_,y=vi(null==e?void 0:e.uuid,Os),b={uuid:y,event:t,properties:this.calculateEventProperties(t,i||{},m,y)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&f&&(b.event="$bot_pageview",b.properties.$browser_type="bot"),p&&(b.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var w="$feature_flag_called"===t&&!1===b.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!w&&(b.$set=null==e?void 0:e.$set);var x=j(null==i?void 0:i.$set)?i.$set:void 0,S=!(null==e||!e.$set)&&"$fbc"in e.$set,k=S||!!x&&"$fbc"in x,E=S?null==e||null==(s=e.$set)?void 0:s[Be]:null==x?void 0:x[Be],P=M(null==i?void 0:i.$unset)?i.$unset:[],C=(null==e?void 0:e.$unset)||[],T=-1!==P.indexOf("$fbc")||-1!==C.indexOf("$fbc"),F=this._u(null==(n=g)?void 0:n.fbclid,E,k,T);F&&!0===b.properties.$process_person_profile&&F.pending&&!k&&!w&&(b.$set=r({[Be]:F.value},b.$set));var I=null==e?void 0:e.$unset;I&&(b.$unset=I);var R=w?void 0:this.Su(null==e?void 0:e.$set_once,t!==ps,t===fs);if(R&&(b.$set_once=R),null!=e&&e._noTruncate||(u=this.config.properties_string_max_length,d=b,v=t=>N(t)?t.slice(0,u):t,c=new Set,b=function t(i,e){if(i!==Object(i))return v?v(i):i;if(!c.has(i)){var r;if(c.add(i),M(i))r=[],gs(i,i=>{r.push(t(i))});else{var s={};_s(i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),b.timestamp=m,B(null==e?void 0:e.timestamp)||(b.properties.$event_time_override_provided=!0,b.properties.$event_time_override_system_time=_),w&&(b.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Zi.forEach(r),i.forEach(r),e}(b.properties,Il)),t===Bo||t===No){var O=null==i?void 0:i.$survey_id,A=null==i?void 0:i.$survey_iteration;vl({id:O,current_iteration:A}),b.$set=r({},b.$set,{[Qa({id:O,current_iteration:A},t===No?"responded":"dismissed")]:!0})}else t===Lo&&(b.$set=r({},b.$set,{[zo]:(new Date).toISOString()}));if("product tour shown"===t){var D=null==i?void 0:i.$product_tour_type;D&&(b.$set=r({},b.$set,{["$product_tour_last_seen_date/"+D]:(new Date).toISOString()}))}var z=r({},b.properties.$set,b.$set);if(L(z)||this.setPersonPropertiesForFlags(z),!H(this.config.before_send)){var U=this.ds(b);if(!U)return;(b=U).uuid=vi(b.uuid,Os)}var q=null!==(o=null==(a=b.$set)?void 0:a.$fbc)&&void 0!==o?o:j(null==(l=b.properties)?void 0:l.$set)?b.properties.$set.$fbc:void 0,V=null!=F&&F.pending&&q===F.value?F.value:void 0;this.Pl.emit("eventCaptured",b);var W=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=r({method:"POST",url:W,data:b,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(W)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},null!=e&&e.transport?{transport:e.transport}:{},V?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.wu(V)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||V?this.iu(G):this.eu.enqueue(G),b}Ee.critical("This capture call is ignored due to client rate limiting.")}}else Ee.error("No event name provided to posthog.capture")}else Ee.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null==(i=this.fu)?void 0:i.getExtension(t)}hu(){var t;return null!==(t=this.fu)&&void 0!==t?t:this.fu=new wl(this)}Fl(t){this.Gl.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Gl.indexOf(t);-1!==e&&this.Gl.splice(e,1)}}}xu(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Kl=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.Wl.clear(),this.Cu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,e,s,n){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.xu();var a=n?void 0:this.persistence.remove_event_timer(t),l=r({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ll()&&(l[Jr]=!0),"$snapshot"===t){var d=r({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=d.distinct_id,(!N(l.distinct_id)&&!q(l.distinct_id)||z(l.distinct_id))&&Ee.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var v,c=function(t,i,e,r){var s,n,a,l;if(void 0===r&&(r=!1),!p)return{};var h,d=t?[...lo,...i||[]]:[],v=ri(p),c=v[0],f=v[1],g=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},_={};B(e)||(_.detectGoogleSearchApp=e);var m={},y=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,w=null==(n=navigator)?void 0:n.maxTouchPoints,x=null==o||null==(a=o.screen)?void 0:a.width,S=null==o||null==(l=o.screen)?void 0:l.height,k=null==o?void 0:o.devicePixelRatio;B(y)||(m.userAgentDataPlatform=y),B(w)||(m.maxTouchPoints=w),B(x)||(m.screenWidth=x),B(S)||(m.screenHeight=S),B(k)||(m.devicePixelRatio=k);var E,P,C,T,F,I,R,O,A=ms(xs({$os:c,$os_version:f,$browser:Qt(p,navigator.vendor,g,_),$device:si(p),$device_type:(P=p,C=m,O=si(P),O===ht||O===lt||"Kobo"===O||"Kindle Fire"===O||O===Rt?at:O===xt||O===kt||O===St||O===Ft?"Console":O===ut?"Wearable":O?nt:"Android"===(null==C?void 0:C.userAgentDataPlatform)&&(null!==(T=null==C?void 0:C.maxTouchPoints)&&void 0!==T?T:0)>0?600>Math.min(null!==(F=null==C?void 0:C.screenWidth)&&void 0!==F?F:0,null!==(I=null==C?void 0:C.screenHeight)&&void 0!==I?I:0)/(null!==(R=null==C?void 0:C.devicePixelRatio)&&void 0!==R?R:1)?nt:at:"Desktop"),$timezone:wo(),$timezone_offset:xo()}),{$current_url:so(r?fi(null==u?void 0:u.href):null==u?void 0:u.href,d,uo),$host:null==u?void 0:u.host,$pathname:null==u?void 0:u.pathname,$raw_user_agent:p.length>1e3?p.substring(0,997)+"...":p,$browser_version:ii(p,navigator.vendor,g,_),$browser_language:go(),$browser_language_prefix:(E=go(),"string"==typeof E?E.split("-")[0]:void 0),$screen_height:null==o?void 0:o.screen.height,$screen_width:null==o?void 0:o.screen.width,$viewport_height:null==o?void 0:o.innerHeight,$viewport_width:null==o?void 0:o.innerWidth,$lib:b.LIB_NAME,$lib_version:b.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return b.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=b.SDK_DIST_CHANNEL),A}(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 f=this.sessionManager.checkAndGetSessionAndWindowId(n,e.getTime(),!0),g=f.windowId;l.$session_id=f.sessionId,l.$window_id=g}this.sessionPropsManager&&ms(l,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&ms(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(_=this.ru)?void 0:_.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ol&&(l.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||n?"$pageleave"!==t||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,s),l=ms(l,v),"$pageview"===t&&h&&(l.title=h.title),!B(a)){var m=e.getTime()-a;l.$duration=parseFloat((m/1e3).toFixed(3))}p&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var y=this.persistence.properties(),w=this.sessionPersistence.properties(),x=l.$groups,S=y.$groups;j(x)&&!L(x)&&(l.$groups=r({},j(S)?S:{},x)),_s(["$referrer","$referring_domain"],t=>{t in y&&delete w[t]});var k={};if(this.Gl.length>0)for(var E of this.Gl.slice())try{ms(k,E())}catch(t){Ee.error("Failed to produce browser extension event properties",t)}(l=ms({},c,y,w,r({},k,l))).$is_identified=this._isIdentified(),M(this.config.property_denylist)?_s(this.config.property_denylist,function(t){delete l[t]}):Ee.error(Cl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var P=this.config.sanitize_properties;P&&(Ee.error(Pl),l=P(l,t));var C=this.Tu();return l.$process_person_profile=C,C&&!n&&this.Mu("_calculate_event_properties"),l}Su(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Tu())return t;if(this.Ul&&!e)return t;var s=ms({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(Ee.error(Pl),s=n(s,"$set_once")),i&&(this.Ul=!0),L(s)?void 0:s}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.xu(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach(t=>this.Wl.add(t)),this.Cu()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.Wl.delete(t),this.Cu()}Iu(t,i){this.register({[t]:i})}nu(){this.Wl.forEach(t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)}),this.Wl.clear(),this.Cu()}Cu(){var t;if(this.Vl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.$o||!tn.si())tn.hi(this.Vl);else{var i=[];this.Wl.forEach(t=>i.push(t)),i.length>0?tn.ui(this.Vl,i):tn.hi(this.Vl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Pl.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:$l}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:$l})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:$l})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=fl),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:$l}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:$l})}Eu(t){return!t||z(t)?(Ee.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Ee.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Ee.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Ee.uninitializedWarning("posthog.identify");if(q(t)&&(t=t.toString(),Ee.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Eu(t)&&this.Mu("posthog.identify")){this.Bl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.xu(!1),o=this.persistence.ta(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property("__alias")&&(this.unregister(je),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===as,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(Nr,ls),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.ea(),this.capture(fs,c,{$set:i||{},$set_once:e||{}}),this.Kl=nl(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(Nr,ls);var f=i||{},p=e||{};this.setPersonPropertiesForFlags({$set:f,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.ea(),this.capture("$set",{$set:f,$set_once:p}),this.Kl=nl(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Dr)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.na(a)}}}setPersonProperties(t,i){if((t||i)&&this.Mu("posthog.setPersonProperties")){var e=nl(this.get_distinct_id(),t,i);this.Kl!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Kl=e):Ee.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(M(t)?t:[t]).filter(t=>N(t)&&t.length>0);0!==e.length&&this.Mu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Kl=null)}group(t,i,e){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.xu();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:r({},n,{[t]:i})}),(o||e)&&this.Tu()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(ps,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else Ee.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Mu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=W(t)?t:null==t?void 0:t.resetDeviceID,e=W(t)||null==t?void 0:t.bootstrap;this.Ru(i,!1,e)}Ru(t,i,e){var s,n,o,a;if(void 0===i&&(i=!1),Ee.info("reset"),!this.__loaded)return Ee.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(s=this.Yl)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.wa());var h=this.get_property(Me),u=this.get_property(De),d=this.get_property(Ze);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();this.consent.reset(),i||!v||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==(a=this.persistence)||null==a.ta?void 0:a.ta(),f=!1;try{var p,g,_,m,y,b,w,x,S,k,E,P,C;if(null==(p=this.persistence)||p.clear(),null==(g=this.sessionPersistence)||g.clear(),this.Wl.clear(),this.Cu(),B(d)||null==(_=this.persistence)||_.register({[Ze]:d}),null==(m=this.surveys)||m.reset(),null==(y=this.featureFlags)||y.reset(),null==(b=this.conversations)||b.reset(),null==(w=this.logs)||w.reset(),null==(x=this.metrics)||x.reset(),null==(S=this.persistence)||S.set_property(Nr,as),null==(k=this.sessionManager)||k.resetSessionId(),this.Kl=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Gr,$device_id:null},"");else{var T=this.config.get_device_id(Os());this.register_once({distinct_id:T,$device_id:t?T:h},""),t||B(u)||this.register({[De]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.Ll()||(null==(C=this.persistence)||C.set_property(Nr,e.isIdentifiedID?ls:as),this.register({distinct_id:e.distinctID})),null==(E=this.featureFlags)||E.initialize(),!(B(l)||null!=(P=this.sessionManager)&&P.setBootstrapSessionId(l,!0))){var F=r({},e);delete F.sessionID,this.config.bootstrap=F}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var I;c&&(null==(I=this.persistence)||null==I.na||I.na(f))}this.reloadFeatureFlags()}shutdown(t){var i=this;return n(function*(){var t,e,r,s,n,o,a;if(i.__loaded){i.hu().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.eu)||s.unload(),null==(n=i.ru)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(t){Ee.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else Ee.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Pu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.Au()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property("$people_distinct_id")?(Ee.critical("Attempting to create alias for existing People user - aborting."),-2):this.Mu("posthog.alias")?(B(i)&&(i=this.get_distinct_id()),t!==i?(this.Iu(je,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Ee.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=r({},this.config);if(j(t)){var e,s,n,o,a,l,h,u,d,v,c,f,p;ms(this.config,jl(t));var g=this.Hl();null==(e=this.persistence)||e.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Oo(r({},this.config,{persistence:"sessionStorage"}),g,!1);var _=this.Xl(this.config.debug);W(_)&&(this.config.debug=_),W(this.config.debug)&&(this.config.debug?(Re.DEBUG=!0,Ns.si()&&Ns.ui("ph_debug",!0),Ee.info("set_config",{config:t,oldConfig:i,newConfig:r({},this.config)})):(Re.DEBUG=!1,Ns.si()&&Ns.hi("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.wa()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(d=this.historyAutocapture)||d.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.zl(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Wn(this,kl,!1)}}_overrideSDKInfo(t,i){Re.LIB_NAME=t,Re.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){try{if(!this.exceptions)return;var e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(r({},e,i))}catch(t){return}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var i,e;return null!==(i=null==(e=this.logs)?void 0:e.logger)&&void 0!==i?i:t.Fu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Rl;return i!==Rl&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property("$user_state"))}Tu(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&L(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(i=this.persistence)||null==(i=i.props)||!i.$epp))}yu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Tu()||this.Mu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Mu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Mu(t){return"never"===this.config.person_profiles?(Ee.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Nl(),this.Iu(Wr,!0),!0)}Hl(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}zl(){var t,i,e,r,s,n=this.Hl();return this.is_capturing()||null==(t=this.logs)||t.Ou(),(null==(i=this.persistence)?void 0:i.$o)!==n&&(null==(e=this.persistence)||e.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.$o)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Wl.clear(),this.Cu()),n}opt_in_capturing(i){var e,r,s;if("always"!==this.config.cookieless_mode){if(this.Ll()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.Ru(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Ya(this),this.pageViewManager=new Yn(this),this.persistence&&(this.sessionPropsManager=new Wa(this,this.sessionManager,this.persistence));var d,v=null!==(l=null==(h=this.config.__extensionClasses)?void 0:h.sessionRecording)&&void 0!==l?l:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.Dl(this.sessionRecording,new v(this)),this.Rl&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.Rl)))}this.consent.optInOut(!0),this.zl(),this.pu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(B(null==i?void 0:i.captureEventName)||null!=i&&i.captureEventName)&&this.capture(null!==(s=null==i?void 0:i.captureEventName)&&void 0!==s?s:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.gu()}else Ee.warn(El)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,i,e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.Ru(!0,!0),this.consent.optInOut(!1),this.zl(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Gr,$device_id:null}),this.$l(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.gu(),this.pu())}else Ee.warn(El)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.zl()}_is_bot(){return l?Xa(l,this.config.custom_blocked_useragents):void 0}gu(){h&&("visible"===h.visibilityState?this.Zl||(this.Zl=!0,this.capture(vs,{title:h.title},{send_instantly:!0}),this.Jl&&(h.removeEventListener(us,this.Jl),this.Jl=null)):this.Jl||(this.Jl=this.gu.bind(this),Es(h,us,this.Jl)))}debug(t){!1===t?(null==o||o.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==o||o.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}))}wa(){var t=this.Yl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ee.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,i,e,r,s){var n=i in t&&!H(t[i]),o=e in t&&!H(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Ee)}ds(t){var i;if(H(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(J),r=M(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),H(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return G(t.event)?Ee.warn(o+". This can cause unexpected behavior."):Ee.info(o),null}s.properties&&!L(s.properties)||Ee.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Ee.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&H(s.properties[a]))return Ee.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.lo)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Xl(t){var i=W(t)&&!t,e=Ns.si()&&"true"===Ns.li("ph_debug");return!i&&(!!e||t)}},s.__defaultExtensionClasses={},s.Fu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),s);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=ws(t.prototype[i[e]])}(Bl,["identify"]);var Nl=class{constructor(t){this.disabled=!1===t;var i=j(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}},zl="$copy_autocapture",Ul=$e("[AutoCapture]");function Hl(t,i){return i.length>t?i.slice(0,t)+"...":i}function ql(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!nn(i));return i}function Vl(t,i){var e,s,n=i.e,a=i.maskAllElementAttributes,l=i.maskAllText,h=i.elementAttributeIgnoreList,u=i.elementsChainAsString,d=i.disableCaptureUrlHashes;if(!nn(t))return{props:{}};for(var v=[t],c=new Set([t]),f=t;f.parentNode&&!on(f,"body")&&1e3>v.length;)if(ln(f.parentNode)){var p=f.parentNode.host;if(c.has(p))break;c.add(p),v.push(p),f=p}else{if(!nn(f.parentNode))break;if(c.has(f.parentNode))break;c.add(f.parentNode),v.push(f.parentNode),f=f.parentNode}var g,_,m,y=[],b={},w=!1,x=!1;if(_s(v,t=>{var i=Pn(t);if(on(t,"a")){var e=t.getAttribute("href");w=!!(i&&e&&Dn(e))&&(d?fi(e):e)}S(dn(t),"ph-no-capture")&&(x=!0),y.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};pn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Hl(1024,jn(t)):Hl(1024,cn(t)));var a=dn(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),_s(t.attributes,function(e){var n;if((!Cn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Dn(e.value)&&(!N(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=hn(a).join(" ")),o["attr__"+e.name]=Hl(1024,"href"===e.name&&s?fi(a):a)}});for(var l=1,h=1,u=t;u=ql(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,a,l,h,d)),_s(function(t){if(!Pn(t))return{};var i={};return _s(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Dn(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(b,i)||(b[i]=t)})}),x)return{props:{},explicitNoCapture:x};if(l||(y[0].$el_text=on(t,"a")||on(t,"button")?jn(t):cn(t)),w){var k,E;y[0].attr__href=w;var P=null==(k=eo(w))?void 0:k.host,C=null==o||null==(E=o.location)?void 0:E.host;P&&C&&P!==C&&(g=w)}return{props:ms((_=n.type,{$event_type:_,$ce_version:1}),u?{}:{$elements:y},{$elements_chain:(m=y,M(m)?function(t){return t.map(t=>{var i,e,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=r({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return ys(o).sort((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r}).forEach(t=>{var i=t[1];return a[Bn(t[0].toString())]=Bn(i.toString())}),(s+=":")+ys(a).map(t=>t[0]+'="'+t[1]+'"').join("")}).join(";")}(function(t){return t.map(t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Nn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return ys(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(m)):"")},null!=(e=y[0])&&e.$el_text?{$el_text:null==(s=y[0])?void 0:s.$el_text}:{},g&&"click"===n.type?{$external_click_url:g}:{},b)}}var Wl=class{constructor(t){this.Ds=t,this.name="autocapture",this.Ls=!1,this.Ns=null,this.qs=!1,this.js=!1,this._n={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Bs=!1,this.Ds.refresh(this._n),this.rageclicks=new Nl(this._n.rageclick),this.Hs=null}setup(t){this.zs(),this.Us=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Bs?i.dispose():(this.Ws=i,this.startIfEnabled())}dispose(){var t;this.Bs||(this.Bs=!0,this.Us=void 0,null==(t=this.Ws)||t.dispose(),this.Ws=void 0,this.Vs())}Gs(){return this.Ds.refresh(this._n),this._n}zs(){var t,i;return this.Gs(),this._n.url_allowlist=null==(t=this._n.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this._n.url_ignorelist=null==(i=this._n.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this._n}Zs(){if(this.isBrowserSupported()){if(o&&h){var t=this.Js=t=>{t=t||(null==o?void 0:o.event);try{this.Qs(t)}catch(t){Ul.error("Failed to capture event",t)}};if(Es(h,"submit",t,{capture:!0}),Es(h,"change",t,{capture:!0}),Es(h,"click",t,{capture:!0}),this.Gs().capture_copied_text){var i=this.Ks=t=>{t=t||(null==o?void 0:o.event);try{this.Qs(t,zl)}catch(t){Ul.error("Failed to capture clipboard event",t)}};Es(h,"copy",i,{capture:!0}),Es(h,"cut",i,{capture:!0}),Es(h,"paste",i,{capture:!0})}}}else Ul.info("Disabling Automatic Event Collection because this browser is not supported")}Vs(){this.Js&&(null==h||h.removeEventListener("submit",this.Js,!0),null==h||h.removeEventListener("change",this.Js,!0),null==h||h.removeEventListener("click",this.Js,!0),this.Js=void 0),this.Ks&&(null==h||h.removeEventListener("copy",this.Ks,!0),null==h||h.removeEventListener("cut",this.Ks,!0),null==h||h.removeEventListener("paste",this.Ks,!0),this.Ks=void 0),this.Ls=!1}startIfEnabled(){!this.Bs&&this.Us&&this.isEnabled&&!this.Ls&&(this.Zs(),this.Ls=!0)}onRemoteConfig(t){if(!this.Bs)if(this.qs=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.js=i.elementsChainAsString);var e,r=i.autocapture_opt_out;W(r)&&(null==(e=this.Us)||e.kv.set(Ue,r),this.Ns=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Hs=t}getElementSelectors(t){var i,e=[];return null==(i=this.Hs)||i.forEach(i=>{var r;null==h||null==(r=h.querySelectorAll(i))||r.forEach(r=>{t===r&&e.push(i)})}),e}get isEnabled(){var t,i;if(this.Bs)return!1;var e=null==(t=this.Us)?void 0:t.kv.get(Ue),r=this.Ns,s=this.Gs(),n=s.remoteRequestsDisabled&&!this.qs;if(U(r)&&!W(e)&&!n)return!1;var o=null!==(i=this.Ns)&&void 0!==i?i:!!e;return!!s.enabled&&!o}Qs(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var e=fn(t);an(e)&&(e=e.parentNode||null);var s,n=this.zs();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&kn(e,n.rageclick)&&this.Qs(t,"$rageclick");var a=i===zl,l=a?r({},n,{dom_event_allowlist:void 0}):n;if(e&&function(t,i,e,r,s,n){var a;if(!o||En(t))return!1;if(null!=e&&e.url_allowlist&&!un(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&un(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var l=e.dom_event_allowlist;if(l&&!l.some(t=>i.type===t))return!1}var h=$n(t,r),u=h.parentIsUsefulElement,d=h.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(B(e))return!0;var r,s=function(t){if(e.some(i=>t.tagName.toLowerCase()===i))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,e))return!1;if(!gn(d,null==e?void 0:e.css_selector_allowlist))return!1;if(gn(d,null!==(a=null==e?void 0:e.css_selector_ignorelist)&&void 0!==a?a:mn))return!1;try{var v=o.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(pn.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(e,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var h,u=Vl(e,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.js,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),d=u.props;if(u.explicitNoCapture)return!1;var v=this.getElementSelectors(e);if(v&&v.length>0&&(d.$element_selectors=v),i===zl){var c=t.type||"clipboard";if("paste"!==c){var f,p,g=null==o||null==(f=o.getSelection())?void 0:f.toString(),_=vn(g);if(!_)return!1;d.$selected_content=_,d.$clipboard_text_length=null!==(p=null==g?void 0:g.length)&&void 0!==p?p:0}d.$copy_type=c}return null==(h=this.Us)||h.capture(i,d).catch(t=>Ul.error("Failed to capture event",t)),!0}}}isBrowserSupported(){return D(null==h?void 0:h.querySelectorAll)}},Gl=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=j(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.wa(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}},Jl=$e("[ExceptionAutocapture]"),Kl=()=>{},Yl=t=>{var i;if(D(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Xl(t,i,e){try{if(!(i in t))return Kl;var r={next:t[i]},s=e(function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)});return D(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=Yl(e);n;){if(n.next===s)return void(n.next=r.next);n=Yl(e=n.next)}else t[i]=r.next}}catch(t){return Kl}}var Zl=$e("[TracingHeaders]"),Ql=$e("[Web Vitals]"),th=9e5,ih=["CLS","FCP","INP","LCP"],eh=["INP","LCP"],rh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],sh="disabled",nh="lazy_loading",oh=$e("[SessionRecording]"),ah=$e("[Heatmaps]");function lh(t){return j(t)&&"clientX"in t&&"clientY"in t&&q(t.clientX)&&q(t.clientY)}var hh=$e("[Product Tours]"),uh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Ke))},dh=$e("[SiteApps]"),vh="Error while initializing PostHog app with config id ",ch=(t,i)=>null!=t&&t.then?t.then(i):i(t),fh="SDK is not enabled or survey functionality is not yet loaded",ph="Disabled. Not loading surveys.",gh=class{constructor(t,i){this.Ds=t,this.$u=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Du=!1,this.Lu=[],this.Nu=null,this.qu=null,this.Bs=!1,this.ju=new Set,this.onRemoteConfig=t=>{if(!this.Bs&&!this._n.disableSurveys){if(!t.ok)return dl.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(H(i))return dl.warn("Flags not loaded yet. Not loading surveys.");this.Bu=W(i)?i:i.length>0,dl.info("flags response received, isSurveysEnabled: "+this.Bu),this.loadIfEnabled()}}}setup(t){if(!this.Bs)return this.Hu=t,ch(t.kv.initialize(),()=>{if(this.Hu===t&&!this.Bs){this.Hu=void 0,this.Us=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Bs?i.dispose():(this.Ws=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.Bs||(this.Bs=!0,this.Hu=void 0,this.Us=void 0,null==(t=this.Ws)||t.dispose(),this.Ws=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Lu=[],this.Nu=null,this.ju.forEach(t=>clearTimeout(t)),this.ju.clear())}get _n(){return this.Ds.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith("seenSurvey_")||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(!this.Bs&&this.Us){var t=this._n;if(!this._surveyManager)if(this.Du)dl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)dl.info(ph);else if(t.cookielessMode&&this.Ds.isOptedOut())dl.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ds.getExtensions();if(i){if(!B(this.Bu)||t.advancedEnableSurveys){var e=this.Bu||t.advancedEnableSurveys;this.Du=!0;try{var r=i.generateSurveys;if(r)return this.zu(r,e),void(this.Du=!1);var s=i.loadExternalDependency;if(!s)return this.Uu(os),void(this.Du=!1);s(t=>{try{if(this.Bs)return;var i=this.Ds.getExtensions();t||null==i||!i.generateSurveys?this.Uu("Could not load surveys script",t):this.zu(i.generateSurveys,e)}finally{this.Du=!1}})}catch(t){throw this.Du=!1,this.Uu("Error initializing surveys",t),t}}}else dl.error("PostHog Extensions not found.")}}}zu(t,i){this.Bs||(this._surveyManager=t(i),this._surveyEventReceiver=this.Ds.createEventReceiver(),dl.info("Surveys loaded successfully"),this.Wu({isLoaded:!0}))}Uu(t,i){dl.error(t,i),this.Wu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Lu.push(t),this._surveyManager&&this.Wu({isLoaded:!0}),()=>{this.Lu=this.Lu.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Us)&&void 0!==e?e:this.$u;if(r&&!this.Bs){if(this._n.disableSurveys)return dl.info(ph),t([]);var s=r.kv.get(kr);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Vu()&&this.getSurveys(()=>{},!0));if(this.Nu)this.Nu.then(i=>{this.Bs||t(i.surveys,i.context)}).catch(t=>dl.error("Error in survey callback",t));else{var n=this.Gu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this._n.requestTimeoutMs}).then(t=>{try{return this.Zu(r,t)}catch(t){return dl.error("Error processing surveys response",t),this.Zu(r,{statusCode:0,error:t})}},t=>this.Zu(r,{statusCode:0,error:t}));this.Nu=n;var o=()=>{this.Nu===n&&(this.Nu=null)};n.then(i=>{o(),this.Bs||t(i.surveys,i.context)},o).catch(t=>dl.error("Error in survey callback",t))}}}Gu(t,i){var e=this.Us;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(fh)}))}Zu(t,i){var e;if(this.Bs)return{surveys:[],context:{isLoaded:!1,error:fh}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?dl.error(s):i.error||dl.warn(s),this.qu=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.qu=null;var n=i.json.surveys||[],o=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(tl(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t)));return o.length>0&&(null==(e=this._surveyEventReceiver)||e.register(o)),t.kv.set({[kr]:n,[Er]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Vu(){return this.Ju()&&!this.Nu&&!this.Qu()}Ju(){var t,i,e=null==(t=null!==(i=this.Us)&&void 0!==i?i:this.$u)?void 0:t.kv.get(Er);return q(e)&&Date.now()-e>3e5}Qu(){return q(this.qu)&&3e5>Date.now()-this.qu}markSurveyAsSeen(t,i){var e;vl({id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Wu(t){for(var i of this.Lu)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){dl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!H(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);dl.warn("init was not called")}Ku(t){var i=null;return this.getSurveys(e=>{var r;i=null!==(r=e.find(i=>i.id===t))&&void 0!==r?r:null}),i}Xu(t){if(H(this._surveyManager))return{eligible:!1,reason:fh};var i="string"==typeof t?this.Ku(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Yu(t){if(H(this._surveyManager))return{eligible:!1,reason:fh};var i="string"==typeof t?this.Ku(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(H(this._surveyManager))return dl.warn("init was not called"),{visible:!1,disabledReason:fh};var i=this.Yu(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return H(this._surveyManager)?(dl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:fh})):new Promise(e=>{this.getSurveys(i=>{var r,s=null!==(r=i.find(i=>i.id===t))&&void 0!==r?r:null;if(s){var n=this.Yu(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var r;if(H(this._surveyManager))dl.warn("init was not called");else{var s="string"==typeof t?this.Ku(t):t;if(null!=s&&s.id)if(cl.includes(s.type)){var n=null==h?void 0:h.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){dl.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.ju.delete(o),this.Bs||(dl.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),dl.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.ju.add(o)}else this._surveyManager.renderSurvey(s,n,e);else dl.warn("Survey element not found")}else dl.warn("Surveys of type "+s.type+" cannot be rendered in the app");else dl.warn("Survey not found")}}displaySurvey(t,i){var e;if(H(this._surveyManager))dl.warn("init was not called");else{var s=this.Ku(t);if(s){var n=s;if(null!=(e=s.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=r({},s,{appearance:r({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Uo&&i.initialResponses&&dl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.Xu(s);if(!o.eligible)return void dl.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else dl.warn("Survey not found")}}cancelPendingSurvey(t){H(this._surveyManager)?dl.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};function _h(t,i,e){if(H(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var mh=class{constructor(t){this._instance=t,this.th=new Set,this.eh=new Set,this.ih=new Ga,this.rh=(t,i)=>this.nh(t,i)&&this.sh(t,i)&&this.oh(t,i)&&this.ah(t,i),this.nh=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;B(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.uh=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.uh)||t.call(this),this.uh=void 0,this.ih=new Ga}register(t){var i,e;if(!B(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.th.add(t),null==(i=t.steps)||i.forEach(t=>{this.eh.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.th.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{null!=t&&t.selector&&r.add(t.selector)})}),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.th.clear(),this.eh.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.eh.has(t)||this.eh.has(i.event))&&this.th.forEach(t=>{this.hh(i,t)&&this.ih.emit("actionCaptured",t.name)})}dh(t){this.onAction("actionCaptured",i=>t(i))}hh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.rh(t,e))return!0;return!1}onAction(t,i){return this.ih.on(t,i)}sh(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!_h(r,i.url,i.url_matching||"contains"))return!1}return!0}oh(t,i){return!!this.fh(t,i)&&!!this.ph(t,i)&&!!this.gh(t,i)}fh(t,i){var e;if(null==i||!i.href)return!0;var r=this.mh(t);if(r.length>0)return r.some(t=>_h(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&_h((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}ph(t,i){var e;if(null==i||!i.text)return!0;var r=this.mh(t);if(r.length>0)return r.some(t=>_h(t.text,i.text,i.text_matching||"exact")||_h(t.$el_text,i.text,i.text_matching||"exact"));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!H(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some(t=>_h(t,n,o)))}gh(t,i){var e,r;if(null==i||!i.selector)return!0;if(null!=t&&null!=(e=t.properties)&&null!=(e=e.$element_selectors)&&e.includes(i.selector))return!0;var s=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&s)try{return new RegExp(i.selector_regex).test(s)}catch(t){return!1}return!1}mh(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}ah(t,i){return null==i||!i.properties||0===i.properties.length||sl(i.properties.reduce((t,i)=>{var e=M(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t},{}),null==t?void 0:t.properties)}},yh=class{constructor(t){var i;this.yh=[],this._instance=t,this.bh=new Map,this._h=new Map,this.wh=new Map,this.kh=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Sh(t))}xh(t){return!1}Ch(){return null}Th(t){}Mh(){}Ih(t,i){return!!t&&sl(t.propertyFilters,null==i?void 0:i.properties)}Eh(t,i){var e=new Map;return t.forEach(t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach(i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}})}),e}Rh(t,i,e){var r=(e===Do?this.bh:this._h).get(t),s=[];return this.Ph(t=>{s=t.filter(t=>null==r?void 0:r.includes(t.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find(i=>i.name===t);return this.Ih(n,i)})}register(t){this.Ah(t,!1)}replace(t){this.Ah(t,!0)}Ah(t,i){var e;B(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Fh(t,i),this.Oh(t,i))}Oh(t,i){var e=t.filter(t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length});if(i&&this.wh.clear(),0!==e.length){this.$h||(this.$h=new mh(this._instance),this.$h.init(),this.$h.dh(t=>this.onAction(t)));var r=[];e.forEach(t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach(i=>{if(r.push(i),i.name){var e,s=null!==(e=this.wh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.wh.set(i.name,s)}})}),i?this.$h.replace(r):this.$h.register(r)}else{var s;i&&(null==(s=this.$h)||s.replace([]))}}Dh(t,i){i.forEach((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach(t=>{s.includes(t)||s.push(t)}),t.set(e,s)})}Fh(t,i){var e,r,s=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0}),n=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}),o=this.Eh(t,Do),a=this.Eh(t,jo);i?(this.bh=o,this._h=a):(this.Dh(this.bh,o),this.Dh(this._h,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.uh)&&void 0!==e||(this.uh=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.Lh(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Nh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.qh([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.jh(n),void this.Bh([n])}if(this._h.has(t)){var a=this.Rh(t,i,jo);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map(t=>t.id)}),this.qh(a.map(t=>t.id)),a.forEach(t=>this.Hh(t.id)))}if(this.bh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.bh.get(t)});var l=this.Rh(t,i,Do);this.zh(l.map(t=>t.id))}}onAction(t){this.wh.has(t)&&this.zh(this.wh.get(t)||[])}zh(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.xh(s)?this.jh(s)&&this.Uh(s):r.push(s);r.length>0&&(this.yh=[...new Set([...this.yh,...r])]),this.Lh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}jh(t){this.yh=this.yh.filter(i=>i!==t);var i=this.Wh();return!i.includes(t)&&(this.Vh([...i,t]),this.Gh(),!0)}qh(t){var i=new Set(t);this.yh=this.yh.filter(t=>!i.has(t));var e=this.Zh(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.Vh(r),0===r.length&&this.Jh()),this.Bh(t)}Qh(){var t,i=this.Ch();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Uh(t){if(this.Ch()){var i=this.Qh();this.Th(r({},i,{[t]:Date.now()}))}}Bh(t){if(this.Ch()){var i=this.Qh(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(L(e)?this.Mh():this.Th(e))}}Kh(){this.Ch()&&this.Mh()}getActivationTimestamp(t){if(this.Wh().includes(t)){var i=this.Qh()[t];return q(i)?i:void 0}}Zh(){var t,i=this.Xh();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Wh(){var t,i,e=this.Zh();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Yh()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Gh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.td(i)}Jh(){this.ed()}Sh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Yh()];if(e&&e!==t){var r=this.Zh(),s=this.Qh();r.length>0&&(this.Vh([]),r.filter(t=>q(s[t])).forEach(t=>this.Hh(t))),this.Jh(),this.Kh()}}getActivatedIds(){return[...new Set([...this.Wh(),...this.yh])].filter(t=>!this.rd(t))}dispose(){var t,i,e;null==(t=this.kh)||t.call(this),this.kh=void 0,null==(i=this.uh)||i.call(this),this.uh=void 0,null==(e=this.$h)||e.dispose(),this.$h=void 0}reset(){this.yh=[],this.Zh().length>0&&this.Vh([]),this.Jh(),this.Kh()}getEventToItemsMap(){return this.bh}nd(){return this.$h}},bh=class extends yh{constructor(t){super(t)}Xh(){return $r}Yh(){return Pr}Ch(){return Cr}Th(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Cr]:t})}Mh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Cr)}xh(t){var i,e;this.Ph(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return q(r)&&r>0}sd(){return Lo}Ph(t){var i;null==(i=this._instance)||i.getSurveys(t)}Hh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Lh(){return dl}Vh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[$r]:t})}td(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Pr]:t})}ed(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Pr)}rd(){return!1}Nh(t,i){var e;return this.Ph(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return tl(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===Lo?"consume":"ignore":t===Lo?"persist":t===Bo||t===No?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},wh=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);B(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},xh=class{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==m?void 0:m.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new bh(this._instance)}},Sh=null!=o&&o.location?no(o.location.hash,"__posthog")||no(location.hash,"state"):null,kh="_postHogToolbarParams",Eh=$e("[Toolbar]"),$h=$e("[FeatureFlags]"),Ph=class{constructor(t,i){void 0===i&&(i=!1),this.od=!1,this.update(t,i)}update(t,i){this.ad=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:M(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.od||($h.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),B(t.flag_keys)||M(t.flag_keys)||$h.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}},Ch=$e("[FeatureFlags]"),Th=$e("[FeatureFlags]",{debugEnabled:!0}),Fh="\" failed. Feature flags didn't load in time.",Ih="connection_error",Rh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Oh=t=>{var i={};for(var e of ys(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Ah=t=>X(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Mh=$e("[Error tracking]"),Dh="webkit-masked-url:",jh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Dh],Lh=["__firefox__","__gCrWeb"],Bh="Refusing to render web experiment since the viewer is a likely bot",Nh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>il(i,t),not_regex:(t,i)=>!il(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},zh=$e("[Conversations]"),Uh="Conversations not available yet.";function Hh(t,i){var e,s,n,o,a,h,u,d=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,v=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,f=B(c)?Math.max(v,2048):Math.max(v,c),p=r({},function(){var t="",i="";try{var e=null==l?void 0:l.userAgent;if(e){var s=ri(e);t=s[0],i=s[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(ve,t)?ve[t]:t}(t);return r({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==p?void 0:p["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(h=null==p?void 0:p["service.version"])&&void 0!==h?h:null==t?void 0:t.serviceVersion,environment:null!==(u=null==p?void 0:p["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:p,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:d,maxBufferSize:v,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var qh=["debug","log","warn","error","info"],Vh="console",Wh="__posthogHandledLogsRequestError",Gh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Wh]=!0,e},Jh=t=>!!t&&"object"==typeof t&&!0===t[Wh],Kh={featureFlags:class{constructor(t){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=Ch,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.Ve=()=>{var t=this.wd();this._d=0,t&&this.reloadFeatureFlags()},this.kd=()=>{var t,i=this.Sd;B(i)||this._n.remoteRequestsDisabled||!h||"hidden"===h.visibilityState||Date.now()-(null!==(t=this.xd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Cd())},this.Ze=()=>{"visible"===(null==h?void 0:h.visibilityState)&&this.kd()},"get"in t?this.Ds=t:(this._instance=t,this.Td=new Ph(t.config,t.wa()),this.Ds=this.Td)}updateConfig(t,i){var e;null==(e=this.Td)||e.update(t,i),this.Us&&this.Md()}setup(t){return this.Hu=t,this.A=t.logger.createLogger("[FeatureFlags]"),ch(t.kv.initialize(),()=>{this.Hu===t&&(this.Hu=void 0,this.Us=t,this.Id(t))})}Id(t){var i;if(this.Us===t)return o&&Es(o,"online",this.Ve),this.Md(),this.Ed=t.registerDynamicEventProperties(()=>this.Rd()?this.ud:this.hd),this.Pd=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Ad(),this.Fd(),this.Od()}),this.Fd(),this.initialize()}Md(){var t=this._n.refreshIntervalMs,i=!this._n.remoteRequestsDisabled&&h&&!B(t)&&t>0?t:void 0;i!==this.Sd&&(this.$d(),B(i)||(this.Sd=i,this.Cd(),null!=h&&h.addEventListener&&Es(h,us,this.Ze)))}Cd(){B(this.Sd)||(B(this.Dd)||clearInterval(this.Dd),this.xd=Date.now(),this.Dd=setInterval(this.kd,this.Sd))}$d(){B(this.Dd)||(clearInterval(this.Dd),this.Dd=void 0,null==h||null==h.removeEventListener||h.removeEventListener(us,this.Ze)),this.Sd=void 0,this.xd=void 0}destroy(){this.Ld()}dispose(){this.Ld()}Ld(){var t,i;this.$d(),this.pd++,this.md=!1,this.Hu=void 0,this.Us&&(this.Nd(),null==(t=this.Ed)||t.dispose(),this.Ed=void 0,null==(i=this.Pd)||i.call(this),this.Pd=void 0,this.dd=[],null==o||o.removeEventListener("online",this.Ve),this.Us=void 0)}get _n(){return this.Ds.get()}qd(t){var i;return this.jd&&t in this.jd?this.jd[t]:null==(i=this.Us)?void 0:i.kv.get(t)}Ad(){return!!this.jd&&(this.jd=void 0,!0)}Bd(){var t;return!B(null==(t=this.Us)?void 0:t.kv.get("$enabled_feature_flags"))&&this.Ad()}ui(t){this.Hd(()=>{var i;return null==(i=this.Us)?void 0:i.kv.set(t)})}zd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t.$enabled_feature_flags){var s=this.qd("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter(t=>{var i=t[1];return!(null!=i&&i.failed)}).map(t=>t[0]):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!M(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.qd("$feature_flag_payloads")||{},d=t.$feature_flag_payloads||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p=!!c||v,g={[cr]:f,[vr]:f,[gr]:p};for(var _ of(t.$feature_flag_details&&(g[pr]=f),[_r,Br,mr]))B(t[_])||(g[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}}hi(t){this.Hd(()=>{var i;return null==(i=this.Us)?void 0:i.kv.remove(t)})}Hd(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Fd(){var t={};for(var i of[cr,gr,_r,yr]){var e=this.qd(i);B(e)||(t[i]=e)}this.ud=t;var s=r({},t),n=this.qd(vr);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.hd=s}Rd(){var t=this._n.cacheTtlMs;if(!t||0>=t)return!1;var i=this.qd(Br);return"number"!=typeof i||Date.now()-i>t}Ud(){return!!this.Rd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Wd(){var t=this._n.evaluationContexts;return null!=t&&t.length?t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Vd(){var t=this._n.flagKeys;if(!B(t))return t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i,e=this._n,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter(t=>!B(r[t])).reduce((t,i)=>(t[i]=r[i],t),{}),l=Object.keys(o).filter(t=>a[t]).reduce((t,i)=>(t[i]=o[i],t),{});return this.Gd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n,o=null!=e&&e.merge&&null!==(s=this.qd("$enabled_feature_flags"))&&void 0!==s?s:{},a=null!=e&&e.merge&&null!==(n=this.qd("$feature_flag_payloads"))&&void 0!==n?n:{},l=r({},o,t),h=r({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Ki(c),variant:Yi(c),reason:void 0,metadata:B(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Gd({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.qd(pr),i=this.qd(yr),e=this.qd(br);if(!e&&!i)return t||{};var s=ms({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=s[n],h=null==i?void 0:i[n],u=B(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=B(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=r({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=r({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),s[n]=c}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Ki(r),variant:Yi(r),payload:Ji(i[e])}})}getFlagVariants(){var t=this.qd(vr),i=this.qd(yr);if(!i)return t||{};for(var e=ms({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ld=!0),e}getFlagPayloads(){var t=this.qd(gr),i=this.qd(br);if(!i)return t||{};for(var e=ms({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ld=!0),e}reloadFeatureFlags(){this.gd||this._n.featureFlagsDisabled||this.wd()||(this.fd&&(this.md=!0),this.Zd||(this.dd.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.Zd=setTimeout(()=>{this.Jd()},5)))}Nd(){clearTimeout(this.Zd),this.Zd=void 0}onReloading(t){return this.dd.push(t),()=>{this.dd=this.dd.filter(i=>i!==t)}}ensureFlagsLoaded(){this.vd||this.fd||this.Zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.gd=t}resetFlagCallReported(){this.hi(Dr)}Jd(t){this.Nd();var i=this.Us;if(i&&!this._n.remoteRequestsDisabled&&!this.wd())if(this.fd)this.md=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:r({},i.initialPersonProperties,this.qd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.qd(xr),timezone:wo()};B(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this._n.featureFlagsDisabled)&&(e.disable_flags=!0);var s=this.Wd();s.length&&(e.evaluation_contexts=s);var n=this.Vd();B(n)||(e.flag_keys=n);var o=this._n.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.pd;this.fd=!0;var h=()=>{this.md&&(this.md=!1,this.Jd())},u=t=>{this.fd=!1,l===this.pd?(this.ui({[Lr]:[Ih]}),this.A.error("Feature flag request failed",t),this.Bd()&&this.Od(!0),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:e,compression:this._n.compression,sentAt:"body",timeoutMs:this._n.requestTimeoutMs}).then(t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.fd=!1,l===this.pd){if(this.Qd(t.statusCode),n||this.md||(this.$anon_distinct_id=void 0),!e.disable_flags||this.md){this.yd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Ih:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));u&&a.push("quota_limited"),this.ui({[Lr]:a}),u?this.A.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."):e.disable_flags||this.Gd(s,n,{partialResponse:o}),h()}}else h()}).catch(u)}catch(t){u(t)}}}wd(){return oo(this._d,3)}Qd(t){this._d=ao(t,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+Fh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i;return null==(i=this.getFeatureFlagResult(t,{send_event:!1}))?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var e,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.qd("$feature_flag_request_id")||void 0,u=this.qd("$feature_flag_evaluated_at")||void 0,d=this.qd("$flag_call_reported")||{};if(this._n.deduplicateCallsPerSession){var v,c=null==(v=this.Us)?void 0:v.session.sessionId,f=this.qd(jr);c&&c!==f&&(d={},e=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))e&&this.ui({[Dr]:d,[jr]:e});else{var p,g,_,m,y,b,w,x,S,k,E,P,C;M(d[t])?d[t].push(l):d[t]=[l],this.ui(r({[Dr]:d},e?{[jr]:e}:{}));var T=this.getFeatureFlagDetails(t),F=[...null!==(p=this.qd("$feature_flag_errors"))&&void 0!==p?p:[]];B(o)&&F.push("flag_missing");var I={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(g=null==(_=this._n.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g:null,$feature_flag_bootstrapped_payload:null!==(m=null==(y=this._n.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.yd};B(null==T||null==(b=T.metadata)?void 0:b.has_experiment)||(I.$feature_flag_has_experiment=T.metadata.has_experiment),B(null==T||null==(w=T.metadata)?void 0:w.version)||(I.$feature_flag_version=T.metadata.version);var R=null!==(x=null==T||null==(S=T.reason)?void 0:S.description)&&void 0!==x?x:null==T||null==(k=T.reason)?void 0:k.code;R&&(I.$feature_flag_reason=R),null!=T&&null!=(E=T.metadata)&&E.id&&(I.$feature_flag_id=T.metadata.id),B(null==T?void 0:T.original_variant)&&B(null==T?void 0:T.original_enabled)||(I.$feature_flag_original_response=B(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(P=T.metadata)&&P.original_payload&&(I.$feature_flag_original_payload=null==T||null==(C=T.metadata)?void 0:C.original_payload),F.length&&(I.$feature_flag_error=F.join(",")),this.Kd(I)}else e&&this.ui({[Dr]:d,[jr]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Ji(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Fh)}Kd(t){try{var i;null==(i=this.Us)||i.capture("$feature_flag_called",t).catch(t=>{this.A.error("Failed to capture feature flag call",t)})}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Xd(t,i)}Xd(t,i){var e=this;return n(function*(){var r=e.Us;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.Wd();n.length&&(s.evaluation_contexts=n);var o,a=e.Vd();B(a)||(s.flag_keys=a);try{var l;o=(null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:e._n.compression,sentAt:"body",timeoutMs:e._n.requestTimeoutMs})).json)||null==(l=l.featureFlagPayloads)?void 0:l[t])||void 0}catch(t){return void e.A.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){e.A.error("Remote config feature flag callback failed",t)}}})()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.yd)return i.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+Fh),i.defaultValue;var e=this.getFeatureFlag(t,i);return B(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(i=>i!==t)}receivedFeatureFlags(t,i,e){this.Gd(t,i,e)}Gd(t,i,e){if(this.Us){this.vd=!0;var s=function(t,i,e,s,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===s&&(s={}),void 0===o&&(o=Ch);var a=((t,i)=>{var e=t.flags;return e?r({},t,{featureFlags:Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!B(null==(i=e[t].metadata)?void 0:i.payload)}).map(t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]}))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(M(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[cr]:h,[vr]:c,[mr]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),y=g||{};p=r({},i,p),g=r({},e,y),m.forEach(t=>{var i;t in y||null==(i=g)||delete i[t]}),_=r({},s,_)}else if(t.errorsWhileComputingFlags)if(l){var b=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));p=r({},i,Object.fromEntries(Object.entries(p).filter(t=>b.has(t[0]))));var w=Object.fromEntries(Object.entries(g||{}).filter(t=>b.has(t[0])));g=r({},e,w),b.forEach(t=>{var i;t in w||null==(i=g)||delete i[t]}),_=r({},s,Object.fromEntries(Object.entries(_||{}).filter(t=>b.has(t[0]))))}else p=r({},i,p),g=r({},e,g),_=r({},s,_);return r({[cr]:Object.keys(Oh(p)),[vr]:p||{},[gr]:g||{},[pr]:_||{},[mr]:!0===t.minimalFlagCalledEvents},d?{[_r]:d}:{},v?{[Br]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(s)if(!1===(null==e?void 0:e.persist)){var n=!B(this.Us.kv.get(vr));this.jd=s,n||this.ui(s)}else this.Ad(),this.zd(s,t,!(null==e||!e.partialResponse)),this.ui(s);else i&&this.Bd();i||(this.bd=!1),this.Od(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Yd(t)}Yd(t){if(this.Us){if(!1===t)return this.hi([yr,br]),this.Od(),void Th.info("All overrides cleared");if(M(t))return this.ui({[yr]:Rh(t)}),this.Od(),void Th.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ld=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[yr]=M(s)?Rh(s):s),n&&(r[br]=n),Object.keys(r).length&&this.ui(r),!1===s&&!1===n?this.hi([yr,br]):!1===s?this.hi(yr):!1===n&&this.hi(br),this.Od(),!1===s?Th.info("Flag overrides cleared"):s&&Th.info("Flag overrides set",{flags:s}),void(!1===n?Th.info("Payload overrides cleared"):n&&Th.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ui({[yr]:t}),this.Od(),void Th.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.vd){var i=this.tv(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s,n=(this.qd("$early_access_features")||[]).find(i=>i.flagKey===t),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),e&&(a.$feature_enrollment_stage=e);var l=r({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[cr]:[t],[vr]:[t],[wr]:Object.keys(o)}),this.ui({[cr]:Object.keys(Oh(l)),[vr]:l,[wr]:r({},this.qd("$stored_person_properties")||{},o)}),this.Od();try{var h;null==(h=this.Us)||h.capture("$feature_enrollment_update",a).catch(t=>{this.A.error("Failed to capture early access feature enrollment",t)})}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.qd(fr);!r||i?this.ev(t,e):t(r)}ev(t,i){var e=this;return n(function*(){var r=e.Us;if(r){var s,n=i?"&"+i.map(t=>"stage="+t).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;s=o.json.earlyAccessFeatures,e.ui({[fr]:s})}catch(t){return void e.A.error("Early access feature request failed",t)}try{t(s)}catch(t){e.A.error("Early access feature callback failed",t)}}})()}tv(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}Od(t){this.Fd();var i=this.tv(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.iv(t,i)}iv(t,i){void 0===i&&(i=!0);var e=this.qd("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in e||(o[a]=n[a]));this.ui({[wr]:r({},e,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=r({},this.qd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.ui({[wr]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.hi(wr),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.qd("$stored_group_properties")||{},s=r({},e);for(var n of Object.keys(t))s[n]=r({},e[n],t[n]);this.ui({[xr]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.qd("$stored_group_properties")||{};this.ui({[xr]:r({},i,{[t]:{}})})}else this.hi(xr)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.jd=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Nd(),this.ld=!1,this._d=0}}},Yh={sessionRecording:class{get _n(){return this._instance.config}get Ga(){return this._instance.persistence}get started(){var t;return!(null==(t=this.rv)||!t.isStarted)}get status(){var t,i;return"awaiting_config"===this.nv||"missing_config"===this.nv?this.nv:null!==(t=null==(i=this.rv)?void 0:i.status)&&void 0!==t?t:this.nv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.nv=sh,this.sv=void 0,this.ov=!1,this.je=(()=>{var t;if(null==h||!h.visibilityState||"visible"===h.visibilityState)return!0;var i=null==o||null==(t=o.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.Ze=()=>{var t;"visible"===(null==h?void 0:h.visibilityState)&&(this.je=!0,null==(t=this.rv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw oh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._n.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=h&&h.addEventListener&&Es(h,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.ov=!0,null==h||null==h.removeEventListener||h.removeEventListener("visibilitychange",this.Ze),e?this.av(!0):this.stopRecording()}get lv(){var t,i=!(null==(t=this._instance.get_property(Ze))||!t.enabled),e=!this._n.disable_session_recording,r=this._n.disable_session_recording||this._instance.consent.isOptedOut();return o&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.ov||this.lv&&null!=(i=this.rv)&&i.isStarted)){var e=!B(Object.assign)&&!B(Array.from);this.lv&&e?(this.uv(t),oh.info("starting")):(this.nv=sh,this.stopRecording())}}uv(t){var i,e;if(this.lv)if("awaiting_config"!==this.nv&&"missing_config"!==this.nv&&(this.nv=nh),null!=m&&null!=(i=m.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=m.__PosthogExtensions__)&&e.initSessionRecording)this.hv(t);else{var r,s=this._instance.sessionManager;null==(r=m.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.dv,i=>{if(!this.ov&&this.lv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[Xr]:!0}),oh.error("could not load recorder",i)):void this.hv(t);this.nv=sh})}}stopRecording(){var t,i;null==(t=this.sv)||t.call(this),this.sv=void 0,null==(i=this.rv)||i.stop()}av(t){var i,e;void 0===t&&(t=!1),null==(i=this.sv)||i.call(this),this.sv=void 0,null==(e=this.rv)||e.discard({discardProducerEvents:t})}vv(){var t,i;null==(t=this.Ga)||t.unregister(or),null==(i=this.Ga)||i.unregister(tr)}fv(t,i){if(H(t))return null;var e,r=q(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(oh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}pv(t){if(this.Ga){var i,e,s=this.Ga,n=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.fv(null==(i=this._n.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.fv(null==e?void 0:e.sampleRate,"remote config sampleRate"),a=null!=n?n:o;H(a)&&this.vv();var l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[Ze]:r({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:r({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:a,minimumDurationMilliseconds:B(l)?null:l,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};n(),null==(i=this.sv)||i.call(this),this.sv=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.pv(i),void this.av()):(this.pv(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.nv&&(this.nv="missing_config",oh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.rv)&&e.log?this.rv.log(t,i):oh.warn("log called before recorder was ready")}get dv(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property("$session_recording_remote_config"))||null==(t=t.scriptConfig)?void 0:t.script)||"lazy-recorder"}gv(){var t,i=this._instance.get_property(Ze);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return oh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!H(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}hv(t){var i,e,r;if(!this.ov&&this.lv&&this._instance.sessionManager){if(null==(i=m.__PosthogExtensions__)||!i.initSessionRecording)return oh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Xr]:!0});var s;if(this.rv||(this.rv=null==(s=m.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.je),this.rv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.gv()){if("missing_config"===this.nv||"awaiting_config"===this.nv)return;return this.nv="awaiting_config",oh.info("persisted remote config is stale, requesting fresh config before starting"),void new Go(this._instance).load()}this.nv=nh,null==(e=(r=this.rv).setDocumentWasEverVisible)||e.call(r,this.je),this.rv.start(t)}else this.nv=sh}onRRwebEmit(t){var i;null==(i=this.rv)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.rv||null==(t=this.Ga)||t.register({[er]:!0}),null==(i=this.rv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.rv||null==(t=this.Ga)||t.register({[ir]:!0}),null==(i=this.rv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.rv||null==(i=this.Ga)||i.register({["url"===t?rr:sr]:!0}),null==(e=this.rv)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.rv)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.rv)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.rv)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},Xh={autocapture:class extends Wl{constructor(t){super(new Gl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.mv=this.yv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.bv();return!!(t.path||t.search||this._v(t))}startIfEnabled(){this.isEnabled&&(Ee.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.mv=this.yv(),this.startIfEnabled()}stop(){this.wv&&this.wv(),this.wv=void 0,this.Sv&&this.Sv(),this.Sv=void 0,Ee.info("History API monitoring stopped")}monitorHistoryChanges(){o&&o.history&&(this.xv("pushState"),this.xv("replaceState"),this.Cv(),this._v()&&this.Tv())}xv(t){var i;if(o&&(null==(i=o.history[t])||!i.__posthog_wrapped__)){var e=this;Xl(o.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Mv(t)})}}yv(){var t=null==o?void 0:o.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}bv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:j(t)?t:{}}_v(t){return void 0===t&&(t=this.bv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Iv(t){var i=this.bv(),e=this.mv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this._v(i)&&t.hash!==e.hash))}Mv(t){try{var i=this.yv();if(!i)return;this.Iv(i)&&this._instance.capture(vs,{navigation_type:t}),this.mv=i}catch(i){Ee.error("Error capturing "+t+" pageview",i)}}Cv(){if(!this.wv){var t=()=>{this.Mv("popstate")};Es(o,"popstate",t),this.wv=()=>{o&&o.removeEventListener("popstate",t)}}}Tv(){if(!this.Sv){var t=()=>{this.Mv("hashchange")};Es(o,"hashchange",t),this.Sv=()=>{o&&o.removeEventListener("hashchange",t)}}}},heatmaps:class{get _n(){return this.instance.config}constructor(t){var i;this.Ev=!1,this.Ls=!1,this.Rv=null,this.instance=t,this.Ev=!(null==(i=this.instance.persistence)||!i.props[He]),this.rageclicks=new Nl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return j(this._n.capture_heatmaps)&&this._n.capture_heatmaps.flush_interval_milliseconds&&(t=this._n.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return H(this._n.capture_heatmaps)?H(this._n.enable_heatmaps)?this.Ev:this._n.enable_heatmaps:!1!==this._n.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ls)return;ah.info("starting..."),this.Pv(),this.Ze()}else{var t;clearInterval(null!==(t=this.Rv)&&void 0!==t?t:void 0),this.Av(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[He]:e}),this.Ev=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.De;return this.De=void 0,t}Fv(t){lh(t.originalEvent)&&this.an(t.originalEvent,"deadclick")}Ze(){this.Rv&&clearInterval(this.Rv),this.Rv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(h)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}Pv(){o&&h&&(this.Ov=this.La.bind(this),Es(o,ds,this.Ov),this.$v=t=>this.an(t||(null==o?void 0:o.event)),Es(h,"click",this.$v,{capture:!0}),this.Dv=t=>this.Lv(t||(null==o?void 0:o.event)),Es(h,"mousemove",this.Dv,{capture:!0}),this.Nv=new qn(this.instance,Un,this.Fv.bind(this)),this.Nv.startIfEnabledOrStop(),this.qv=this.Ze.bind(this),Es(h,us,this.qv),this.Ls=!0)}Av(){var t;o&&h&&(this.Ov&&o.removeEventListener(ds,this.Ov),this.$v&&h.removeEventListener("click",this.$v,{capture:!0}),this.Dv&&h.removeEventListener("mousemove",this.Dv,{capture:!0}),this.qv&&h.removeEventListener(us,this.qv),clearTimeout(this.jv),null==(t=this.Nv)||t.stop(),this.Ls=!1)}Bv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&nn(r)&&!on(r,"body");){if(r===e)return!1;var s=void 0;try{var n,a,l;s=null==(n=null!==(a=null==(l=r.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:o)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(S(i,s))return!0;r=_n(r)}return!1}(fn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}an(t,i){var e;if(void 0===i&&(i="click"),!sn(t.target)&&lh(t)){var s=this.Bv(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&kn(fn(t),this.instance.config.rageclick)&&this.Is(r({},s,{type:"rageclick"})),this.Is(s)}}Lv(t){!sn(t.target)&&lh(t)&&(clearTimeout(this.jv),this.jv=setTimeout(()=>{this.Is(this.Bv(t,"mousemove"))},500))}Is(t){if(o){var i=this._n.disable_capture_url_hashes?fi(o.location.href):o.location.href,e=this._n.custom_personal_data_properties,r=so(i,this._n.mask_personal_data_properties?[...lo,...e||[]]:[],uo);this.De=this.De||{},this.De[r]||(this.De[r]=[]),this.De[r].push(t)}}La(){this.De&&!L(this.De)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:qn,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.Ev=!1,this.Ls=!1,this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hv=()=>{clearTimeout(this.zv),this.zv=void 0,0!==this.De.metrics.length&&(this._instance.capture("$web_vitals",r({$current_url:this.De.url},this.De.metrics.reduce((t,i)=>r({},t,{["$web_vitals_"+i.name+"_event"]:r({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.De={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uv=t=>{var i;if(this.De=this.De||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},H(null==t?void 0:t.name)||H(null==t?void 0:t.value))Ql.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Wv(e);if(!B(s)){var n=q(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Vv||this.Vv>t.value){this.De.navigationKey!==n&&(this.Hv(),this.zv=setTimeout(this.Hv,this.flushToCaptureTimeoutMs)),B(this.De.navigationKey)&&(this.De.navigationKey=n,this.De.url=s),this.De.firstMetricTimestamp=B(this.De.firstMetricTimestamp)?Date.now():this.De.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=r({},t,e?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,j(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of rh){var u="url"===h&&"string"==typeof t.attribution[h]?this.Wv(t.attribution[h]):t.attribution[h];B(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;B(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.De.metrics.push(a),this.De.metrics.length===this.allowedMetrics.length&&this.Hv()}else Ql.error("Ignoring metric with value >= "+this.Vv,t)}}},this.Gv=()=>{if(!this.Ls){var t,i,e,s,n=!1,o=m.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Zv])||("web-vitals"===this.Zv&&B(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!B(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!B(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,e=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?r({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Uv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Uv.bind(this),v),this.Ls=!0}else Ql.error("web vitals callbacks not loaded - not starting")}},this.Ev=!(null==(i=this._instance.persistence)||!i.props[Ge]),this.startIfEnabled()}get Jv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=j(this.Jv)?null==(t=this.Jv)?void 0:t.web_vitals_allowed_metrics:void 0;return H(e)?(null==(i=this._instance.persistence)?void 0:i.props.$web_vitals_allowed_metrics)||ih:e}get flushToCaptureTimeoutMs(){return(j(this.Jv)?this.Jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=j(this.Jv)?this.Jv.web_vitals_attribution:void 0;return W(t)?t?ih:[]:M(t)?t:eh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=j(this.Jv)?this.Jv.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get Vv(){var t=j(this.Jv)&&q(this.Jv.__web_vitals_max_value)?this.Jv.__web_vitals_max_value:th;return t>0&&6e4>=t?th:t}get isEnabled(){var t=null==u?void 0:u.protocol;if("http:"!==t&&"https:"!==t)return Ql.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=j(this.Jv)?this.Jv.web_vitals:W(this.Jv)?this.Jv:void 0;return W(i)?i:this.Ev}startIfEnabled(){this.isEnabled&&!this.Ls&&(Ql.info("enabled, starting..."),this.so(this.Gv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=j(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=j(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ge]:e}),this._instance.persistence.register({[Xe]:r})),this.Ev=e,this.startIfEnabled()}}}get Zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}so(t){var i=m.__PosthogExtensions__,e=this.Zv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&B(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?Ql.error("failed to load script",i):t()})}Wv(t){var i=t||(null==o?void 0:o.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?fi(i):i,r=this._instance.config.custom_personal_data_properties;return so(e,this._instance.config.mask_personal_data_properties?[...lo,...r||[]]:[],uo)}Ql.error("Could not determine current URL")}}},Zh={exceptionObserver:class{constructor(t){var i;this.Gv=()=>{var t;if(o&&this.isEnabled&&null!=(t=m.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=m.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=m.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=m.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this._n.capture_unhandled_errors&&(this.Qv=i(this.captureException.bind(this))),!this.Kv&&this._n.capture_unhandled_rejections&&(this.Kv=e(this.captureException.bind(this))),!this.Xv&&this._n.capture_console_errors&&(this.Xv=r(this.captureException.bind(this)))}catch(t){Jl.error("failed to start",t),this.Yv()}}},this._instance=t,this.tc=!(null==(i=this._instance.persistence)||!i.props[qe]),this.wt=new st(r({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:Jl})),this._n=this.ec(),this.startIfEnabledOrStop()}ec(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return j(t)?i=r({},i,t):(B(t)?this.tc:t)&&(i=r({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this._n.capture_console_errors||this._n.capture_unhandled_errors||this._n.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Jl.info("enabled"),this.Yv(),this.so(this.Gv)):this.Yv()}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return Jl.error("failed to load script",i);t()})}Yv(){var t,i,e;null==(t=this.Qv)||t.call(this),this.Qv=void 0,null==(i=this.Kv)||i.call(this),this.Kv=void 0,null==(e=this.Xv)||e.call(this),this.Xv=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.tc=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[qe]:this.tc}),this._n=this.ec(),this.startIfEnabledOrStop())}}onConfigChange(){this._n=this.ec()}captureException(t){try{var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";if(this.wt.consumeRateLimit(s))return void Jl.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.rc=[],this.nc=new yi([new Fi,new Ni,new Ri,new Ii,new Li,new ji,new Ai,new Bi],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Ti.test(l)?l.replace(Ti,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of e){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return r({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Ei,Ci)),this._instance=t,this.rc=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.sc=Vi(this.oc()),this.ac=new Wi(this.sc)}onConfigChange(){this.sc=Vi(this.oc()),this.ac.setConfig(this.sc)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.rc=n,this._instance.persistence&&this._instance.persistence.register({[Ve]:this.rc,[We]:o})}}}get lc(){var t,i,e=!!this._instance.get_property(We);return null!==(t=null!==(i=this._instance.config.error_tracking.captureExtensionExceptions)&&void 0!==i?i:e)&&void 0!==t&&t}buildProperties(t,i){return this.nc.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.sc.enabled)try{if(!N(t)||0===t.trim().length)return void Mh.warn("Ignoring exception step because message must be a non-empty string");var e=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce((e,r)=>Hi.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.uc(i)),s=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&Mh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ac.add(r({[zi]:t,[Ui]:(new Date).toISOString()},s))}catch(t){Mh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.hc(i)){if(this.dc(i))return this.vc("Exception dropped: matched a suppression rule"),void Mh.info("Skipping exception capture because a suppression rule matched");if(!this.lc&&this.cc(i))return this.vc("Exception dropped: thrown by a browser extension"),void Mh.info("Skipping exception capture because it was thrown by an extension");if(!this.lc&&this.fc(i))return this.vc("Exception dropped: thrown by an injected browser script"),void Mh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.gc(i))return this.vc("Exception dropped: thrown by the PostHog SDK"),void Mh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.sc.enabled&&H(t.$exception_steps)?this.mc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",ku:!0});return s&&this.ac.clear(),s}catch(t){return Ah(t)||Mh.error("Failed to capture exception event. Dropping this exception.",t),void this.ac.clear()}}catch(t){return void(Ah(t)||Mh.error("Failed to process exception event. Ignoring this exception.",t))}var n}mc(t){try{var i=this.ac.getAttachable();return 0===i.length?t:r({},t,{$exception_steps:i})}catch(i){return Mh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}vc(t){this.sc.enabled&&this.ac.add({[zi]:t,[Ui]:(new Date).toISOString()})}uc(t){return j(t)?r({},t):{}}oc(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}dc(t){if(0===t.length)return!1;try{var i=t.reduce((t,i)=>{var e=i.type,r=i.value;return N(e)&&e.length>0&&t.$exception_types.push(e),N(r)&&r.length>0&&t.$exception_values.push(r),t},{$exception_types:[],$exception_values:[]});return this.rc.some(t=>{var e=t.values.map(t=>{var e=rl[t.operator],r=i[t.key];if(!e||!r)return!1;var s=M(t.value)?t.value:[t.value];return s.length>0&&e(s,r)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return Mh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}cc(t){var i=t.flatMap(t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(t=>{var i=t.filename;return!!i&&jh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Dh)})||t.some(t=>{var i=t.value;return N(i)&&i.includes("isolatedAPI.contexts.topHostname")})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Dh))}))}fc(t){return t.some(t=>{var i=t.value;return N(i)&&Lh.some(t=>i.includes(t))})}gc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[];return null!==(r=null==(s=n[n.length-1])||null==(s=s.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}hc(t){return!H(t)&&M(t)}}},Qh=r({productTours:class{get Ga(){return this._instance.persistence}constructor(t){this.yc=null,this.bc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.Ga&&this.Ga.register({[Ke]:!!i.productTours}),!uh(this._instance))return!this.yc&&H(null==(e=this.Ga)?void 0:e.props.ph_product_tours)||hh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.yc)||r.stop(),this.yc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.yc&&uh(this._instance)&&this.so(()=>this._c())}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?hh.error("Could not load product tours script",i):t()})}_c(){var t;!this.yc&&null!=(t=m.__PosthogExtensions__)&&t.generateProductTours&&(this.yc=m.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!M(this.bc)||i){var e=this.Ga;if(e){var r=e.props[Tr];if(M(r)&&!i)return this.bc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(uh(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||hh.warn(s):hh.error(s),void t([],{isLoaded:!1,error:s})}var n=M(i.json.product_tours)?i.json.product_tours:[];this.bc=n,e&&e.register({[Tr]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.bc,{isLoaded:!0})}getActiveProductTours(t){H(this.yc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.yc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.yc)||i.showTourById(t)}previewTour(t){this.yc?this.yc.previewTour(t):this.so(()=>{var i;this._c(),null==(i=this.yc)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.yc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.yc)||t.nextStep()}previousStep(){var t;null==(t=this.yc)||t.previousStep()}clearCache(){var t;this.bc=null,null==(t=this.Ga)||t.unregister(Tr)}resetTour(t){var i;null==(i=this.yc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.yc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.yc)||i.cancelPendingTour(t)}}},Kh),tu={siteApps:class{constructor(t){this._instance=t,this.wc=0,this.kc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Sc(t,i){if(i){var e=this.globalsForEvent(i);this.kc.push(e),this.kc.length>1e3&&(this.kc=this.kc.slice(10))}}get siteAppLoaders(){var t;return null==(t=m._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Sc.bind(this));this.xc=()=>{t(),this.kc=[],this.xc=void 0}}}globalsForEvent(t){var s,n,o,a,l,h,u;if(!t)throw new Error("Event payload is required");var d={},v=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(c)){var p=f[0];d[p]={id:v[p],type:p,properties:f[1]}}var g=t.$set_once,_=t.$set;return{event:r({},e(t,i),{properties:r({},t.properties,_?{$set:r({},null!==(s=null==(n=t.properties)?void 0:n.$set)&&void 0!==s?s:{},_)}:{},g?{$set_once:r({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},g)}:{}),elements_chain:null!==(l=null==(h=t.properties)?void 0:h.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:d}}Cc(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(dh.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(dh.error("prepare_external_dependency_script returned null"),null):t}Tc(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==h?void 0:h.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.wc++,this.Mc)return this.Ic();var d=[],v=this,c=new WeakSet,f=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),d.push(()=>{t[i]=r})}},p=t=>{if(c.has(t))return t;var i=v.Cc(t);return i&&c.add(i),i},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!U(t));return f(u,"appendChild",t=>function(i){var e=p(i);return e?t.call(this,e):i}),f(u,"insertBefore",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):i}),f(u,"replaceChild",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):e}),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach(t=>{f(t,"append",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}),f(t,"prepend",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(t=>{f(t,"before",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}),f(t,"after",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=g(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),f(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){var r=p(e);return r?t.call(this,i,r):null}),this.Mc=()=>{d.forEach(t=>t()),this.Mc=void 0},this.Ic()}Ic(){var t=!1;return()=>{var i;t||(t=!0,this.wc--,0===this.wc&&(null==(i=this.Mc)||i.call(this)))}}Ec(t,i){void 0===i&&(i=!0);var e=this.Tc();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.kc.length&&(dh.info("Processing "+this.kc.length+" events for site app with id "+t.id),this.kc.forEach(t=>this.Ec(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.xc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,dh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.Ec(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){dh.error(vh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){dh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Rc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}Pc(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.Ec(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){dh.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.Rc(),void this._instance.on("eventCaptured",t=>this.Pc(t))):void dh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.xc)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;m["__$$ph_site_app_"+i]=s._instance,null==(t=m.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return dh.error(vh+i,t)})};for(var a of n.siteApps)o()}else dh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},iu={tracingHeaders:class{constructor(t){this._instance=t,this.Ac=void 0,this.Fc=void 0,this.Oc=void 0,this.Gv=()=>{var t,i,e=this.$c();e?(B(this.Ac)&&(this.Ac=null==(t=m.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),B(this.Fc)&&(this.Fc=null==(i=m.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Yv()}}initialize(){this.startIfEnabledOrStop()}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return Zl.error("failed to load script",i);t()})}Dc(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}$c(){var t=this.Dc();return M(t)?(M(this.Oc)?this.Oc.splice(0,this.Oc.length,...t):this.Oc=[...t],t.length>0?this.Oc:void 0):(M(this.Oc)&&this.Oc.splice(0),this.Oc=t||void 0,this.Oc)}Yv(){var t,i;null==(t=this.Ac)||t.call(this),null==(i=this.Fc)||i.call(this),this.Ac=void 0,this.Fc=void 0}startIfEnabledOrStop(){this.$c()?this.so(this.Gv):this.Yv()}}},eu=r({surveys:class extends gh{constructor(t){var i;super(new xh(t),(i=t,{get projectToken(){return i.config.token},kv:new wh(i)})),this._instance=t}Gu(t,i){var e=i.query?Ia(t,i.query):t;return new Promise(t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},Kh),ru={toolbar:class{constructor(t){this.instance=t}Lc(t){m.ph_toolbar_state=t}Nc(){var t;return null!==(t=m.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),$s(this.instance.config))return!1;if(!o||!h)return!1;t=null!=t?t:o.location,e=null!=e?e:o.history;try{if(!i){try{o.localStorage.setItem("test","test"),o.localStorage.removeItem("test")}catch(t){return!1}i=null==o?void 0:o.localStorage}var r,s=Sh||no(t.hash,"__posthog")||no(t.hash,"state"),n=s?bs(()=>JSON.parse(atob(decodeURIComponent(s))))||bs(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(kh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}qc(t){var i=m.ph_load_toolbar||m.ph_load_editor;!H(i)&&D(i)?i(t,this.instance):Eh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==h||!h.getElementById("__POSTHOG_TOOLBAR__"));if(!o||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=r({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(o.localStorage.setItem(kh,JSON.stringify(r({},s,{source:void 0}))),2===this.Nc())this.qc(s);else if(0===this.Nc()){var n;this.Lc(1),null==(n=m.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return Eh.error("[Toolbar] Failed to load",t),void this.Lc(0);this.Lc(2),this.qc(s)}),Es(o,"turbolinks:load",()=>{this.Lc(0),this.loadToolbar(s)})}return!0}jc(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},su=r({experiments:class t{get _n(){return this._instance.config}constructor(i){var e=this;this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=function(i){void 0===i&&(i=!1),e.getWebExperiments(i=>{t.Bc("retrieved web experiments from the server"),e.Hc=new Map,i.forEach(i=>{if(i.feature_flag_key){var r;e.Hc&&(t.Bc("setting flag key ",i.feature_flag_key," to web experiment ",i),null==(r=e.Hc)||r.set(i.feature_flag_key,i));var s=e._instance.getFeatureFlag(i.feature_flag_key);N(s)&&i.variants[s]&&e.zc(i.name,s,i.variants[s].transforms)}else if(i.variants)for(var n in i.variants){var o=i.variants[n];t.Uc(o,e._instance)&&e.zc(i.name,n,o.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.Bc(Bh);else if(!this._n.disable_web_experiments){if(H(this.Hc))return this.Hc=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Bc("applying feature flags",i),i.forEach(t=>{var i;if(this.Hc&&null!=(i=this.Hc)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Hc)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.zc(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var i=t.getWindowLocation();if(null!=i&&i.search){var e=ro(null==i?void 0:i.search,"__experiment_id"),r=ro(null==i?void 0:i.search,"__experiment_variant");e&&r&&(t.Bc("previewing web experiments "+e+" && "+r),this.getWebExperiments(t=>{this.Wc(parseInt(e),r,t)},!1,!0))}}loadIfEnabled(){this._n.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._n.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._n.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Wc(i,e,r){var s=r.filter(t=>t.id===i);s&&s.length>0&&(t.Bc("Previewing web experiment ["+s[0].name+"] with variant ["+e+"]"),this.zc(s[0].name,e,s[0].variants[e].transforms))}static Uc(i,e){return!H(i.conditions)&&t.Vc(i,e)&&t.Gc(i)}static Vc(i,e){var r;if(H(i.conditions)||H(null==(r=i.conditions)?void 0:r.url))return!0;var s=t.getWindowLocation();if(s){var n,o,a,l=rn(e,s.href);return null==(n=i.conditions)||!n.url||Nh[null!==(o=null==(a=i.conditions)?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,l)}return!1}static getWindowLocation(){return null==o?void 0:o.location}static Gc(t){var i;if(H(t.conditions)||H(null==(i=t.conditions)?void 0:i.utm))return!0;var e=co();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Bc(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Ee.info("[WebExperiments] "+t,e)}zc(i,e,r){this._is_bot()?t.Bc(Bh):"control"!==e?r.forEach(r=>{var s;r.selector&&(t.Bc("applying transform of variant "+e+" for experiment "+i+" ",r),null==(s=document)||null==(s=s.querySelectorAll(r.selector))||s.forEach(t=>{var i=t;r.html&&(i.innerHTML=r.html),r.css&&i.setAttribute("style",r.css)}))}):t.Bc("Control variants leave the page unmodified.")}_is_bot(){return l&&this._instance?Xa(l,this._n.custom_blocked_useragents):void 0}}},Kh),nu=r({},Kh,Yh,Xh,Zh,Qh,tu,eu,iu,ru,su,{conversations:class{constructor(t){this._instance=t,this.Zc=void 0,this._conversationsManager=null,this.Jc=!1,this.zt=null,this.Qc=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Kc=t.ok,t.ok)){var i=t.config.conversations;H(i)||(W(i)?this.Zc=i:(this.Zc=i.enabled,this.zt=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Zc=void 0,this.zt=null,this.Kc=void 0,this.Qc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Jc||this._instance.config.disable_conversations||$s(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==m?void 0:m.__PosthogExtensions__;if(t&&!B(this.Zc)&&this.Zc)if(this.zt&&this.zt.token){this.Jc=!0;try{var i=t.initConversations;if(i)return this.Xc(i),void(this.Jc=!1);var e=t.loadExternalDependency;if(!e)return void this.Yc(os);e(this._instance,"conversations",i=>{i||!t.initConversations?this.Yc("Could not load conversations script",i):this.Xc(t.initConversations),this.Jc=!1})}catch(t){this.Yc("Error initializing conversations",t),this.Jc=!1}}else zh.error("Conversations enabled but missing token in remote config.")}}Xc(t){if(this.zt)try{this._conversationsManager=t(this.zt,this._instance),this.Qc=!1,zh.info("Conversations loaded successfully")}catch(t){this.Yc("Error completing conversations initialization",t)}else zh.error("Cannot complete initialization: remote config is null")}Yc(t,i){zh.error(t,i),this._conversationsManager=null,this.Jc=!1,this.Qc=!0}show(){this._conversationsManager?this._conversationsManager.show():zh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Zc&&!U(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":$s(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Kc?"remote_config_failed":B(this.Zc)?this.Kc?"disabled_in_project":"remote_config_pending":this.Zc?H(this.zt)||!this.zt.token?"missing_token":null!=m&&m.__PosthogExtensions__?this.Jc?"initializing":this.Qc?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return n(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(zh.warn(Uh),null)})()}getMessages(t,i){var e=this;return n(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(zh.warn(Uh),null)})()}markAsRead(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(zh.warn(Uh),null)})()}getTickets(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(zh.warn(Uh),null)})()}requestRestoreLink(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(zh.warn(Uh),null)})()}restoreFromToken(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(zh.warn(Uh),null)})()}restoreFromUrlToken(){var t=this;return n(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(zh.warn(Uh),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Pu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Au(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var i,e=this;this._instance=t,this.name="logs",this.tf=!1,this.ef=!1,this.if=!1,this.A=$e("[logs]"),this.rf=r({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(Jh)||e.A.error(...i)}}),this.Ca=[],this.nf=[],this._d=0,this.Bs=!1,this.sf=[],this.af=[],this.lf=!1,this.uf=!1,this.hf=()=>{var t,i;this.Bs||(this._d=0,null==(t=this.df)||t.onReconnect(),null==(i=this.vf)||i.onReconnect())},this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.tf=!0),o&&Es(o,"online",this.hf)}cf(t,i,e,r){var s,n=Hh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new ye(this.ff(t,i),n,this.rf,()=>this.pf(),t=>t(),void 0,r),n]}gf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.df||this.mf!==i){var e;null==(e=this.df)||e.reset(),this.mf=i;var r=this.cf(()=>this.Ca,t=>{this.Ca=t});this.df=r[0],this.yf=r[1]}return this.df}bf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.vf||this._f!==i){var e;null==(e=this.vf)||e.reset(),this._f=i;var r=this.cf(()=>this.nf,t=>{this.nf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Vh);this.vf=r[0],this.wf=r[1]}return this.vf}setup(t){var i;if(!this.Bs){this.Us=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.tf=!0),(this.tf||this.kf()&&this.Sf())&&this.xf();var e=!1,r=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Bs?r.dispose():(this.Ws=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Bs||(this.Bs=!0,this.Cf(),null==(t=this.Ws)||t.dispose(),this.Ws=void 0,this.Us=void 0,this.if=!1,null==o||o.removeEventListener("online",this.hf),null==(i=this.Tf)||i.call(this),this.Tf=void 0,null==(e=this.df)||e.reset(),null==(r=this.vf)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Bs){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;H(r)?this.Mf():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[Ye]:!!r}),r?(this.tf=!0,this.ef||this.xf(),this.loadIfEnabled()):this.Mf())}}reset(){var t,i,e,r;this.Cf(),null==(t=this.df)||t.clearQueue(),this.Ca=[],null==(i=this.df)||i.reset(),null==(e=this.vf)||e.clearQueue(),this.nf=[],null==(r=this.vf)||r.reset(),this._d=0}captureLog(t){this.Bs||this.gf().captureLog(t)}captureConsoleLog(t){this.Bs||this.bf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Bs||this.bf().captureLog(t,{context:i,occurredAtMs:e})}Sf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[Ye])}kf(){var t,i;return null==(t=this._instance)||null==t.wa||!t.wa()||!(null==(i=m._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}Ou(){var t;this.Cf(),null==(t=this.vf)||t.clearQueue(),this.nf=[]}Mf(){this.tf||this.Cf()}xf(){var t,i=this;if(!this.lf&&null!=m&&m.console){var e=Hh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(m.console[t])}catch(t){return 0}if(!r)return 0;i.af.push(Xl(m.console,t,s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.If(t,n,e)}catch(t){}return s.apply(m.console,n)};return n.__rrweb_original__=r,n}))};for(var s of qh)r(s);this.lf=!0,this.Ef=setTimeout(()=>{this.Cf()},3e4)}}If(t,i,e){var r;if(this.lf&&!this.uf&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.sf.length){this.uf=!0;try{this.sf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.pf()})}finally{this.uf=!1}}}else this.Cf()}Cf(){if(this.sf=[],this.lf){for(var t of(this.lf=!1,this.Ef&&(clearTimeout(this.Ef),this.Ef=void 0),this.af))t();this.af=[]}}Rf(){var t=this.sf;return this.Cf(),t}get logger(){return this.Pf||(this.Pf={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.Pf}flushLogs(t){t?this.Af(t):(this.df&&this.df.flush().catch(t=>this.Ff(t)),this.vf&&this.vf.flush().catch(t=>this.Ff(t)))}Ff(t){Jh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Bs&&this.tf&&!this.ef&&!this.if){var t=null==m?void 0:m.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Cf();var i=t.loadExternalDependency;if(!i)return this.A.error(os),void this.Cf();this.if=!0;try{i(this._instance,"logs",i=>{if(this.if=!1,!this.Bs&&this.tf){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.Cf();else{var r,s,n=this.Rf();this.Tf=e.initializeLogs(null!==(r=this.Us)&&void 0!==r?r:this._instance),this.ef=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Us)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.if=!1,t}}}ff(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===C.LogsQueue?t():void 0,setPersistedProperty(t,e){t===C.LogsQueue&&i(null!=e?e:[])},gs:t=>this.gs(t),getLibraryId:()=>Re.LIB_NAME,getLibraryVersion:()=>Re.LIB_VERSION}}gs(t){return new Promise(i=>{if(oo(this._d,3))i({kind:"fatal",error:Gh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Gh(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Of(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.$f(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Gh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}})}$f(t){(0!==t||this._instance.__loaded)&&(this._d=ao(t,this._d,3,()=>this.A.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.")))}Af(t){this.Ca.length>0&&this.Df(t,this.Ca,this.yf,Re.LIB_NAME,t=>{this.Ca=t}),this.nf.length>0&&this.Df(t,this.nf,this.wf,Vh,t=>{this.nf=t})}Df(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=me(n,_e(e,Re.LIB_NAME,Re.LIB_VERSION),r,Re.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Of(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Of(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}pf(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,H(s)||(i.sessionStartTimestamp=s),H(n)||(i.lastActivityTimestamp=n)}if(null!=m&&null!=(t=m.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?fi(m.location.href):m.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},{metrics:class{constructor(t){this._instance=t,this.A=$e("[metrics]")}initialize(){}gf(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.df&&this.mf===e||(null==(i=this.df)||i.reset(),this.mf=e,this.df=new Se(this.ff(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.df}count(t,i,e){void 0===i&&(i=1),this.gf().count(t,i,e)}gauge(t,i,e){this.gf().gauge(t,i,e)}histogram(t,i,e){this.gf().histogram(t,i,e)}flush(t){if(!this.df)return Promise.resolve();if(t){var i=this.df.drainWindow();return i&&this.Fs(i,t),Promise.resolve()}return this.df.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.df)||t.reset()}ff(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Fs:t=>i.Fs(t),getLibraryId:()=>Re.LIB_NAME,getLibraryVersion:()=>Re.LIB_VERSION}}Fs(t,i){return new Promise(e=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(r({method:"POST",url:this.Lf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i,e=t.statusCode;n(e>=200&&300>e?{kind:"ok"}:413===e?{kind:"too-large"}:0!==e&&408!==e&&429!==e&&500>e?{kind:"fatal",error:new Error("metrics request failed with status "+e)}:{kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}))})}Lf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});Bl.__defaultExtensionClasses=r({},nu),function(){Re.SDK_DIST_CHANNEL="cdn";var t=m.posthog;if(!t||M(t._i)){var i=xl[Rl]=new Bl;if(t){var e=[];_s(t._i,function(r){if(r&&M(r)){var s=i.init(r[0],r[1],r[2]),n=t[r[2]]||t;s.__loaded&&-1===e.indexOf(n)&&(e.push(n),s._execute_array.call(s.people,n.people),s._execute_array(n))}})}i.__SV=1,m.posthog=i,function(){function t(){t.done||(t.done=!0,Ol=!1,_s(xl,function(t){t._dom_loaded()}))}null!=h&&h.addEventListener?"complete"===h.readyState?t():Es(h,"DOMContentLoaded",t,{capture:!1}):o&&Ee.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}()}();
|
|
1
|
+
!function(){var t=["retriesPerformedSoFar"],i=["$set_once","$set"];function e(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function r(){return r=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},r.apply(null,arguments)}function s(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function n(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var o=t.apply(i,e);function a(t){s(o,r,n,a,l,"next",t)}function l(t){s(o,r,n,a,l,"throw",t)}a(void 0)})}}!function(s){var o="u">typeof window?window:void 0,a="u">typeof globalThis?globalThis:o,l=null==a?void 0:a.navigator,h=null==a?void 0:a.document,u=null==a?void 0:a.location,d=null==a?void 0:a.fetch,v=null!=a&&a.XMLHttpRequest&&"withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:void 0,c=null==a?void 0:a.AbortController,f=null==a?void 0:a.CompressionStream,p=null==l?void 0:l.userAgent;function g(){return!(!o||!1===o.navigator.onLine)}var _="undefined"!=typeof globalThis?globalThis:o;_&&"undefined"==typeof self&&(_.self=_),_&&"undefined"==typeof File&&(_.File=function(){});var m=null!=o?o:{},b="0.8.0",y={DEBUG:!1,LIB_VERSION:b,LIB_NAME:"browser-common",JS_SDK_VERSION:b},w=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],x=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return w.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function S(t,i){return-1!==t.indexOf(i)}var k=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")};function P(t){var i,e=[];return null!==(i=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}}))&&void 0!==i?i:"null"}var C=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),T=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),F=["$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"],A=["token"],I=Object.prototype,R=I.hasOwnProperty,O=I.toString,M=Array.isArray||function(t){return"[object Array]"===O.call(t)},D=t=>"function"==typeof t,j=t=>t===Object(t)&&!M(t),B=t=>{if(j(t)){for(var i in t)if(R.call(t,i))return!1;return!0}return!1},L=t=>void 0===t,N=t=>"[object String]"==O.call(t),z=t=>N(t)&&0===t.trim().length,U=t=>null===t,H=t=>L(t)||U(t),q=t=>"[object Number]"==O.call(t)&&t==t,V=t=>q(t)&&t>0,W=t=>"[object Boolean]"===O.call(t),G=t=>S(F,t),K=t=>S(A,t);function J(t){return null===t||"object"!=typeof t}function Y(t,i){return{}.toString.call(t)==="[object "+i+"]"}function X(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Q(t,Error)}}function Z(t){return"u">typeof Event&&Q(t,Event)}function Q(t,i){try{return t instanceof i}catch(t){return!1}}var tt=[!0,"true",1,"1","yes"],it=t=>S(tt,t),et=[!1,"false",0,"0","no"];function rt(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),q(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),rt(null!=s?s:e,i,e,r))}var st=class{constructor(t){this.C={},this.I=t.I,this.R=rt(t.bucketSize,0,100,t.A),this.O=rt(t.refillRate,0,this.R,t.A),this.F=rt(t.refillInterval,0,864e5,t.A)}N(t,i){var e=Math.floor((i-t.lastAccess)/this.F);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.F)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.N(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}},nt="Mobile",ot="Android",at="Tablet",lt="Android Tablet",ht="iPad",ut="Apple Watch",dt="Safari",vt="BlackBerry",ct="Samsung Internet",ft="Chrome",pt="Chrome iOS",gt="Internet Explorer",_t="Internet Explorer Mobile",mt="Opera",bt="Microsoft Edge",yt="Firefox",wt="Firefox iOS",xt="Nintendo",St="PlayStation",kt="Xbox",Et="Android Mobile",$t="Mobile Safari",Pt="Windows",Ct="Windows Phone",Tt="Nokia",Ft="Ouya",At="Generic "+nt.toLowerCase(),It="Generic "+at.toLowerCase(),Rt="Konqueror",Ot="Oculus Browser",Mt="Vivaldi",Dt="Yandex",jt="Whale",Bt="DuckDuckGo",Lt="Pale Moon",Nt="Waterfox",zt="Brave",Ut="Claude",Ht="Codex",qt="ChatGPT",Vt="Google Search App",Wt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Gt=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Kt=new RegExp(kt,"i"),Jt=new RegExp("PlayStation \\w+","i"),Yt=new RegExp("Nintendo \\w+","i"),Xt=new RegExp("BlackBerry|PlayBook|BB10","i"),Zt={"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"},Qt=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?zt:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&S(t,"GSA/")?Vt:S(t," OPR/")&&S(t,"Mini")?"Opera Mini":S(t," OPR/")?mt:Xt.test(t)?vt:S(t,"IEMobile")||S(t,"WPDesktop")?_t:S(t,"OculusBrowser")?Ot:S(t,"SamsungBrowser")?ct:S(t,"Edge")||S(t,"Edg/")?bt:S(t,"Vivaldi/")?Mt:S(t,"YaBrowser/")?Dt:S(t,"Whale/")?jt:S(t,"DuckDuckGo/")||S(t,"Ddg/")?Bt:S(t,"Claude/")?Ut:S(t,"Codex/")?Ht:S(t,"ChatGPT/")?qt:S(t,"FBIOS")?"Facebook Mobile":S(t,"UCWEB")||S(t,"UCBrowser")?"UC Browser":S(t,"CriOS")?pt:S(t,"CrMo")||S(t,ft)?ft:S(t,ot)&&S(t,dt)?Et:S(t,"FxiOS")?wt:S(t.toLowerCase(),Rt.toLowerCase())?Rt:S(t,"Brave/")?zt:((t,i)=>i&&S(i,"Apple")||function(t){return S(t,dt)&&!S(t,ft)&&!S(t,ot)}(t))(t,i)?S(t,nt)?$t:dt:S(t,"PaleMoon/")?Lt:S(t,"Waterfox/")?Nt:S(t,yt)?yt:S(t,"MSIE")||S(t,"Trident/")?gt:S(t,"Gecko")?yt:"")},ti={[_t]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[bt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ft]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[pt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[dt]:[Wt],[$t]:[Wt],[mt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[yt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[wt]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[vt]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Wt],[Et]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ct]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Mt]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[jt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ut]:[Gt],[Ht]:[Gt],[qt]:[Gt],[Bt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Lt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Nt]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Vt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[gt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},ii=function(t,i,e,r){var s=ti[Qt(t,i,e,r)];if(L(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},ei=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[kt,t&&t[1]||""]],[new RegExp(xt,"i"),[xt,""]],[new RegExp(St,"i"),[St,""]],[Xt,[vt,""]],[new RegExp(Pt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Ct,""];if(new RegExp(nt).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Zt[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Pt,r]}return[Pt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=L(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[ot,[t[2],t[3],t[4]||"0"].join(".")]:[ot,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],ri=function(t){for(var i=0;ei.length>i;i++){var e=ei[i],r=e[1],s=e[0].exec(t),n=s&&(D(r)?r(s,t):r);if(n)return n}return["",""]},si=function(t){return Yt.test(t)?xt:Jt.test(t)?St:Kt.test(t)?kt:new RegExp(Ft,"i").test(t)?Ft:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Ct:/iPad/.test(t)?ht:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ut:Xt.test(t)?vt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Tt,"i").test(t)?Tt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(nt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?ot:lt:new RegExp("(pda|Mobile)","i").test(t)?At:new RegExp(at,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?It:""},ni=/\bFBAV\/(\d+(?:\.\d+)*)/i,oi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ni],[/\bFBAN\/EMA\b/i,"Facebook Lite",ni],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ni],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\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"]],ai="[Truncated]",li="[Unserializable]";function hi(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}Date,Date;var ui,di,vi,ci=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function fi(t,i){return"string"==typeof(e=t)&&ci.test(e)?t:i();var e}function pi(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function gi(t){return t?t.split("#")[0]:t}function _i(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function mi(t,i,e){return bi.apply(this,arguments)}function bi(){return(bi=n(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=_i(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function yi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return vi&&e.length===di?vi:(di=e.length,vi=e.reduce((e,r)=>{ui||(ui={});var s=ui[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a,l=null==(a=n[o])?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,ui[r]=[l,h];break}}return e},{}))}}var wi=class{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return n(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&M(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,s;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),r({},t,{cause:e,stack:s})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return n(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,r({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:yi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return r({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,e),next:t=>s(t,e+1)})}};function xi(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:!!i&&!i.startsWith("webkit-masked-url://")&&"<anonymous>"!==i};return L(r)||(n.lineno=r),L(s)||(n.colno=s),n}var Si=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ki=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ei=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,$i=/\((\S*)(?::(\d+))(?::(\d+))\)/,Pi=(t,i)=>{var e=ki.exec(t);if(e)return xi(i,e[1],"?",+e[2],+e[3]);var r=Ei.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=$i.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Si(r[1]||"?",r[2]);return xi(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Ci=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ti=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Fi=(t,i)=>{var e=Ci.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Ti.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||"?",o=Si(n,s);return xi(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Ai=/\(error: (.*)\)/;var Ii=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=N(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return Y(t,"DOMException")}isDOMError(t){return Y(t,"DOMError")}},Ri=class{match(t){return X(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}},Oi=class{match(t){return!!Y(t,"ErrorEvent")&&(null!=t.error||this.Ki(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return r({},s,{stack:null!==(e=this.Xi(t))&&void 0!==e?e:s.stack,synthetic:!0})}Ki(t){return N(t.message)&&t.message.length>0}Xi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(N(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}},Mi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Di=class{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(Mi);return r&&(i=r[1],e=r[2]),[i,e]}},ji=["fatal","error","warning","log","info","debug"];function Bi(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}var Li=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Z(t))return t.constructor.name;var i="name"in t?t.name:void 0;return N(i)&&!z(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+Bi(t)}isSeverityLevel(t){return N(t)&&!z(t)&&ji.indexOf(t)>=0}getStack(t){try{return N(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:N(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(X(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Ni=class{match(t){return Z(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Bi(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},zi=class{match(t){return J(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Ui=class{match(t){return Y(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Z(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return J(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}},Hi="$message",qi="$timestamp",Vi=new Set([Hi,qi]),Wi={enabled:!0,max_bytes:32768};function Gi(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Wi.enabled,max_bytes:Ji(t.max_bytes,Wi.max_bytes)}:r({},Wi)}var Ki=class{constructor(t){this.$n=[],this.Bn=0,this._n=Gi(t)}setConfig(t){this._n=Gi(t),this.Hn()}add(t){var i=function(t){var i;try{i=P(t)}catch(t){return}try{var e=JSON.parse(i);if(!j(e))return;var r=e,s=r[Hi],n=r[qi];if(!N(s)||0===s.trim().length)return;if(!N(n)&&!q(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this._n.max_bytes||(this.$n.push({step:i.step,bytes:e}),this.Bn+=e,this.Hn())}}getAttachable(){return this.$n.map(t=>t.step)}clear(){this.$n=[],this.Bn=0}size(){return this.$n.length}Hn(){for(;this.Bn>this._n.max_bytes&&this.$n.length>0;){var t=this.$n.shift();t&&(this.Bn-=t.bytes)}}};function Ji(t,i){if(!q(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Yi=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Xi(t){return"string"==typeof t||t}function Zi(t){return"string"==typeof t?t:void 0}var Qi,te=["$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"],ie="NativeGzipValidationError",ee=t=>t.length>=2&&31===t[0]&&139===t[1],re=(t,i)=>t===T.GZipJS||i===T.GZipJS||"gzip"===i,se=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ne=t=>{throw pi(ie,"Native gzip produced invalid output: "+t)},oe=function(){var t=n(function*(t,i){18>t.size&&ne("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());ee(e)&&8===e[2]||ne("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(Qi)return Qi;Qi=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;Qi[t]=i>>>0}return Qi})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&ne("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&ne("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function ae(){return ae=n(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=n(function*(t){try{yield o.abort(t)}catch(t){}throw t});return function(i){return t.apply(this,arguments)}}()),l=new Response(s.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield oe(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),ae.apply(this,arguments)}var le={}.propertyIsEnumerable;function he(t,i){try{return ve(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function ue(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:ai};if(e.remainingNodes--,W(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt("9223372036854775808");return t>=r||-r>t?(null==i||i.debug("Attribute "+e+" is outside the int64 range; encoding it as a string"),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};var s=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:hi(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(r>=20)return{stringValue:ai};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?hi(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return ue(a.call(t),i,e,r+1)}catch(t){}return M(t)?{arrayValue:{values:de(t,i,e,r+1)}}:{kvlistValue:{values:ve(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:hi(String(t))}}function de(t,i,e,r){for(var s=[],n=Math.min(t.length,1e3),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(H(a))continue;s.push(ue(a,i,e,r))}catch(t){s.push({stringValue:li})}return t.length>o&&s.push({stringValue:ai}),s}function ve(t,i,e,r){var s=[];for(var n in t)if(le.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(U(o)||L(o))continue;s.push({key:hi(n),value:ue(o,i,e,r)})}catch(t){s.push({key:hi(n),value:{stringValue:li}})}}return s}function ce(t,i,e){return r({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}var fe={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var pe={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}},ge=pe.info;function _e(t){try{return hi(String(t))}catch(t){return li}}function me(t,i,e,s){var n,o=pe[t.level||"info"]||ge,a=o.text,l=o.number,h=(void 0===(n=q(s)?s:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),H(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),H(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=r({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=li}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var g={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:_e(t.body)},attributes:he(d,e)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),L(t.trace_flags)||(g.flags=t.trace_flags),g}function be(t,i,e){return ce(t,i,e)}function ye(t,i,e,r){return{resourceLogs:[{resource:{attributes:he(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var we=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this._n=i,this.A=e,this.zn=r,this.Un=s,this.Wn=n,this.Vn=o,this.Gn=null,this.Zn=0,this.Jn=0,this.Qn=0,this.Kn=0,this.Xn=0,this.Yn=!1,this.ts=i.maxBufferSize,this.es=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.rs=i.flushIntervalMs,this.ns=i.maxBatchRecordsPerPost,this.ss=i.rateCapWindowMs,this.ls=i.maxLogsPerInterval}clearQueue(){this.Jn++,this._instance.setPersistedProperty(C.LogsQueue,[])}reset(){this.us(),this.Kn=0,this.Xn=0,this.Yn=!1,this.Qn=0,this.ns=this._n.maxBatchRecordsPerPost}onReconnect(){this.Qn=0,this.hs()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.ds(t);if(null!==r)if(r.body){if(this.vs()){var s={record:me(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.zn(),this.A,null==i?void 0:i.occurredAtMs)};this.Un(()=>this.cs(s))}}else this.A.info("Log was rejected in beforeSend function")}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=M(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}vs(){if(void 0===this.ls)return!0;var t=Date.now(),i=t-this.Kn;return this.ss>i&&i>=0||(this.Kn=t,this.Xn=0,this.Yn=!1),this.ls>this.Xn?(this.Xn++,!0):(this.Yn||(this.A.warn("captureLog dropping logs: exceeded "+this.ls+" logs per "+this.ss+"ms"),this.Yn=!0),!1)}flush(){var t=this;return n(function*(){if(!t._instance.isDisabled)return t.Gn||(t.Gn=t.fs().finally(()=>{t.Gn=null})),t.Gn})()}fs(){var t=this;return n(function*(){var i;t.us();var e=null!==(i=t._instance.getPersistedProperty(C.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.Jn;t.Zn=0;var l=Math.min(e.length,t.ns),h=e.slice(0,l),u=ye(h.map(t=>t.record),t.ps(),null!==(n=t.Vn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.gs(u);if(t.Jn!==a)return;if("too-large"===d.kind&&h.length>1)t.ns=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.ns);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t._n.maxBatchRecordsPerPost>t.ns&&(t.ns=Math.min(t._n.maxBatchRecordsPerPost,t.ns+1)),yield t.ys(h.length),e=null!==(o=t._instance.getPersistedProperty(C.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}ys(t){var i=this;return n(function*(){var e,r=Math.max(0,t-i.Zn),s=null!==(e=i._instance.getPersistedProperty(C.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(C.LogsQueue,s.slice(r)),yield i.Wn()})()}ps(){return be(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion())}cs(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(C.LogsQueue))&&void 0!==i?i:[];this.es>e.length||(e.shift(),this.Zn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(C.LogsQueue,e),this.ts>e.length?this.bs():this.hs()}}bs(t){void 0===t&&(t=this.rs),this._s||(this._s=_i(()=>{this._s=void 0,this.hs()},t))}ws(){var t=Math.min(Math.max(0,this.Qn-1),6);return this.rs*Math.pow(2,t)}ks(){var t=this._instance.getPersistedProperty(C.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return n(function*(){i.us();var e=i.flush().catch(()=>{});void 0!==t?yield mi(e,t):yield e})()}flushWithTimeout(t){var i=this;return n(function*(){var e=i.flush();yield mi(e,t,()=>{e.catch(()=>{})})})()}hs(){this.flush().then(()=>{this.Qn=0},t=>{this.Qn++,this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.ks()&&this.bs(this.ws())})}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}},xe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Se(t){return String(t)+"000000"}function ke(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map(t=>JSON.stringify(t)+":"+JSON.stringify(r[t])).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}var Ee=class{constructor(t,i,e){this._instance=t,this._n=i,this.A=e,this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Ms=0}count(t,i,e){void 0===i&&(i=1),this.Is({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Is({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Is({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.Gn,e=function(){var e=n(function*(){i&&(yield i.catch(()=>{})),yield t.Es()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.Gn===e&&(this.Gn=null)});return this.Gn=e,e}drainWindow(){if(0===this.Ss.size)return null;var t=this.Ss;return this.Ss=new Map,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Rs(t)}reset(){this.Ms++,this.us(),this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set}Is(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.ds(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,s;try{e=i.attributes?r({},i.attributes):void 0,s=ke(i.type,i.name,i.unit,e)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.Ss.get(s);if(!n){if(!this.As())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Ss.set(s,n)}var o=this.Cs.get(i.name);void 0===o?this.Cs.set(i.name,i.type):o===i.type||this.Ts.has(i.name)||(this.Ts.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.Ps(n,i.value),this.bs()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}As(){return this._n.maxSeriesPerFlush>this.Ss.size||(this.xs||(this.xs=!0,this.A.warn("Metric series cap reached ("+this._n.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ps(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(xe.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,xe)]+=1}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=M(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}bs(){this._s||(this._s=_i(()=>{this._s=void 0,this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})},this._n.flushIntervalMs))}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}Es(){var t=this;return n(function*(){if(0!==t.Ss.size){var i=t.Ss;t.Ss=new Map,t.xs=!1,t.Cs=new Map,t.Ts=new Set;var e=t.Ms,r=yield t._instance.Fs(t.Rs(i));if(e===t.Ms)switch(r.kind){case"ok":return;case"retry-later":return t.Os(i),void t.bs();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}})()}Rs(t){return i=this.$s(t),e=function(t,i,e){return ce(t,i,e)}(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:he(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}$s(t){var i=Se(Date.now()),e=new Map;for(var s of t.values()){var n,o=ke(s.type,s.name,s.unit,void 0),a=e.get(o);a||(a=r({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=he(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=Se(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:xe})}return Array.from(e.values())}Os(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Ss.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.As()&&this.Ss.set(s,n)}}},$e=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;r>n;n++)s[n-1]=arguments[n];o&&(y.DEBUG||o.POSTHOG_DEBUG||e)&&!L(o.console)&&o.console&&("__rrweb_original__"in o.console[i]?o.console[i].__rrweb_original__:o.console[i])(t,...s)},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>$e(t+" "+i,e)};return r},Pe=$e("[PostHog.js]"),Ce=Pe.createLogger,Te=Ce("[ExternalScriptsLoader]"),Fe=t=>{var i=null==h?void 0:h.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Ae=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Te.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=Fe(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,e(t)}))}var n=()=>{if(!h)return e("document not found");if(Fe(i))return Ae(t,i,e);var r=h.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)h.head.appendChild(r);else{var s,n=h.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):h.body.appendChild(r)}};null!=h&&h.body?n():null==h||h.addEventListener("DOMContentLoaded",n)},Ie={},Re=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};m.__PosthogExtensions__=m.__PosthogExtensions__||{},m.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=Ie[s];if("fallback"===r&&n){if(Fe(n))return void Ae(t,n,e);delete Ie[s]}Ae(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=Re(t,i);Ie[s]=a;var l=Fe(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Ae(t,a,e)}else e(void 0,n)}:e)}else Ae(t,Re(t,i),e)}else Ae(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),e)},m.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{Ae(t,t.requestRouter.endpointFor("api",i),e)},y.DEBUG=!1,y.LIB_VERSION="1.428.0",y.LIB_NAME="web";var Oe=y,Me="$people_distinct_id",De="distinct_id",je="$device_id",Be="$device_model",Le="__alias",Ne="__cmpns",ze="$fbc",Ue="$fbc_persistence",He="__timers",qe="$autocapture_disabled_server_side",Ve="$heatmaps_enabled_server_side",We="$exception_capture_enabled_server_side",Ge="$error_tracking_suppression_rules",Ke="$error_tracking_capture_extension_exceptions",Je="$web_vitals_enabled_server_side",Ye="$dead_clicks_enabled_server_side",Xe="$product_tours_enabled_server_side",Ze="$logs_capture_enabled_server_side",Qe="$web_vitals_allowed_metrics",tr="$session_recording_remote_config",ir="$session_recording_enabled_server_side",er="$replay_sample_rate",rr="$replay_override_sampling",sr="$replay_override_linked_flag",nr="$replay_override_url_trigger",or="$replay_override_event_trigger",ar="$sesid",lr="$session_is_sampled",hr="$session_past_minimum_duration",ur="$session_recording_url_trigger_activated_session",dr="$session_recording_event_trigger_activated_session",vr="$debug_first_full_snapshot_timestamp",cr="$sess_rec_flush_size",fr="$enabled_feature_flags",pr="$active_feature_flags",gr="$early_access_features",_r="$feature_flag_details",mr="$feature_flag_payloads",br="$feature_flag_request_id",yr="$minimal_flag_called_events",wr="$override_feature_flags",xr="$override_feature_flag_payloads",Sr="$stored_person_properties",kr="$stored_group_properties",Er="$groups",$r="$surveys",Pr="$surveys_loaded_at",Cr="$surveys_activated",Tr="$surveys_activated_session",Fr="$surveys_activated_timestamps",Ar="ph_product_tours",Ir="$product_tours_activated",Rr="$product_tours_activated_session",Or="$conversations_widget_session_id",Mr="$conversations_ticket_id",Dr="$conversations_widget_state",jr="$conversations_user_traits",Br="$flag_call_reported",Lr="$flag_call_reported_session_id",Nr="$feature_flag_errors",zr="$feature_flag_evaluated_at",Ur="$user_state",Hr="$client_session_props",qr="$capture_rate_limit",Vr="$initial_campaign_params",Wr="$initial_referrer_info",Gr="$initial_person_info",Kr="$epp",Jr="$posthog_cookieless",Yr="$cookieless_mode",Xr="$sdk_debug_extensions_init_method",Zr="$sdk_debug_extensions_init_time_ms",Qr="$sdk_debug_recording_script_not_loaded",ts="$sdk_debug_replay_event_trigger_status",is="$sdk_debug_replay_linked_flag_trigger_status",es="$sdk_debug_replay_matched_recording_trigger_groups",rs="$sdk_debug_replay_pending_trigger_conditions",ss="$sdk_debug_replay_remote_trigger_matching_config",ns="$sdk_debug_replay_trigger_groups_count",os="$sdk_debug_replay_url_trigger_status",as="$session_recording_start_reason",ls="PostHog loadExternalDependency extension not found.",hs="anonymous",us="identified",ds="identified_only",vs="visibilitychange",cs="beforeunload",fs="$pageview",ps="$pageleave",gs="$identify",_s="$groupidentify";function ms(t,i){M(t)&&t.forEach(i)}function bs(t,i){if(!H(t))if(M(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)R.call(t,e)&&i(t[e],e)}var ys=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function ws(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var xs=function(t){try{return t()}catch(t){return}},Ss=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Pe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Pe.critical(t)}}},ks=function(t){var i={};return bs(t,function(t,e){(N(t)&&t.length>0||q(t))&&(i[e]=t)}),i};var Es=["herokuapp.com","vercel.app","netlify.app"];function $s(t){var i=null==t?void 0:t.hostname;if(!N(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Es)if(e===r)return!1;return!0}function Ps(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function Cs(t){return"ph_toolbar_internal"===t.name}var Ts=t=>{if(h){try{for(var i=t+"=",e=h.cookie.split(";").filter(t=>t.length),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return q(t)&&isFinite(t)&&Math.floor(t)===t});var Fs=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,r,s){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(s)||0>i||0>e||0>r||0>s||i>0xffffffffffff||e>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=i/Math.pow(2,40),n[1]=i/Math.pow(2,32),n[2]=i/Math.pow(2,24),n[3]=i/Math.pow(2,16),n[4]=i/256,n[5]=i,n[6]=112|e>>>8,n[7]=e,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},As=class{generate(){var t=this.generateOrAbort();if(!L(t))return t;this.ri=0;var i=this.generateOrAbort();if(L(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),q(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(i>this.ri)this.ri=i,this.ii();else{if(this.ri>=i+1e4)return;this.ni++,this.ni>4398046511103&&(this.ri++,this.ii())}return Fs.fromFieldsV7(this.ri,Math.trunc(this.ni/Math.pow(2,30)),this.ni&Math.pow(2,30)-1,this.oi.nextUint32())}ii(){this.ni=1024*this.oi.nextUint32()+(1023&this.oi.nextUint32())}constructor(){this.ri=0,this.ni=0,this.oi=new Os}},Is=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};o&&!L(o.crypto)&&crypto.getRandomValues&&(Is=t=>crypto.getRandomValues(t));var Rs,Os=class{nextUint32(){return this.Pe.length>this.ai||(Is(this.Pe),this.ai=0),this.Pe[this.ai++]}constructor(){this.Pe=new Uint32Array(8),this.ai=1/0}},Ms=()=>Ds().toString(),Ds=()=>(Rs||(Rs=new As)).generate(),js="",Bs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ls=null,Ns={si(){if(!U(Ls))return Ls;if(Ls=!1,h)try{var t="__ph_cookie_support_"+Ms();Ns.ui(t,"xyz"),Ls='"xyz"'===Ts(t),Ns.hi(t)}catch(t){Ls=!1}return Ls},ci(t){Pe.error("cookieStore error: "+t)},li:Ts,di(t){var i;try{i=JSON.parse(Ns.li(t))||{}}catch(t){}return i},ui(t,i,e,r,s){if(!h)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=h),js)return js;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ms();!js&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",js=n)}return js}(t);if(!e){var r=(t=>{var i=t.match(Bs);return i?i[0]:""})(t);r!==e&&Pe.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(h.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Pe.warn("cookieStore warning: large cookie, len="+u.length),h.cookie=u,!0}catch(t){return!1}},hi(t,i){if(null!=h&&h.cookie)try{Ns.ui(t,"",-1,i)}catch(t){return}}},zs=null,Us={si(){if(!U(zs))return zs;var t=!0;if(L(o))t=!1;else try{var i="__mplssupport__";Us.ui(i,"xyz"),'"xyz"'!==Us.li(i)&&(t=!1),Us.hi(i)}catch(i){t=!1}return t||Pe.error("localStorage unsupported; falling back to cookie store"),zs=t,t},ci(t){Pe.error("localStorage error: "+t)},li(t){try{return null==o?void 0:o.localStorage.getItem(t)}catch(t){Us.ci(t)}return null},di(t){try{return JSON.parse(Us.li(t))||{}}catch(t){}return null},ui(t,i){try{return null==o||o.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Us.ci(t)}return!1},hi(t){try{null==o||o.localStorage.removeItem(t)}catch(t){Us.ci(t)}}},Hs=[Sr,pr,fr,_r,mr,br,zr,Nr,Br],qs=[je,De,ar,lr,Kr,Gr,Ue,Ur],Vs=t=>t+"_cpm",Ws=["__proto__","constructor","prototype"],Gs=t=>{if(!j(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===Ws.indexOf(e)&&(i[e]=t[e])}),i},Ks=function(t,i){void 0===i&&(i=[]);var e={};return[...qs,...i].forEach(i=>{var r=t[i];L(r)||U(r)||""===r||(e[i]=r)}),e},Js=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Ys=(t,i)=>({p:i,f:Js(JSON.stringify(t))}),Xs=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ns.di(Vs(t)),r=(null==e?void 0:e.f)===Js(i)&&M(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Zs=(t,i)=>i+"|"+(Ns.li(Vs(t))||""),Qs={},tn={si:()=>!0,ci(t){Pe.error("memoryStorage error: "+t)},li:t=>t in Qs?Qs[t]:null,di:t=>t in Qs?Qs[t]:null,ui:(t,i)=>(Qs[t]=i,!0),hi(t){delete Qs[t]}},en=null,rn={si(){if(!U(en))return en;if(en=!0,L(o))en=!1;else try{var t="__support__";rn.ui(t,"xyz"),'"xyz"'!==rn.li(t)&&(en=!1),rn.hi(t)}catch(t){en=!1}return en},ci(t){Pe.error("sessionStorage error: ",t)},li(t){try{return null==o?void 0:o.sessionStorage.getItem(t)}catch(t){rn.ci(t)}return null},di(t){try{return JSON.parse(rn.li(t))||null}catch(t){}return null},ui(t,i){try{return null==o||o.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){rn.ci(t)}return!1},hi(t){try{null==o||o.sessionStorage.removeItem(t)}catch(t){rn.ci(t)}}},sn=class{constructor(t){this._instance=t}get _n(){return this._instance.config}get consent(){return this.Xs()?0:this.Ys}isOptedOut(){return"always"===this._n.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._n.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._n.opt_out_capturing_by_default}optInOut(t){this.eo.ui(this.io,t?1:0,this._n.cookie_expiration,this._n.cross_subdomain_cookie,this._n.secure_cookie)}reset(){this.eo.hi(this.io,this._n.cross_subdomain_cookie)}get io(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get Ys(){var t=this.eo.li(this.io);return it(t)?1:S(et,t)?0:-1}get eo(){var t=this._n.opt_out_capturing_persistence_type,i="localStorage"===t?Us:Ns,e=i.si()?i:tn;if(!this.ro||this.ro!==e){this.ro=e;var r="localStorage"===t?Ns:Us;r.li(this.io)&&(this.ro.li(this.io)||this.optInOut(it(r.li(this.io))),r.hi(this.io,this._n.cross_subdomain_cookie))}return this.ro}Xs(){return!!this._n.respect_dnt&&[null==l?void 0:l.doNotTrack,null==l?void 0:l.msDoNotTrack,m.doNotTrack,null==l?void 0:l.globalPrivacyControl].some(t=>it(t))}};function nn(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!D(r))return i;try{var s=r(i);return N(s)&&s?s:i}catch(t){return Pe.error("Error in get_current_url, falling back to window.location.href",t),i}}function on(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function an(t){return!!t&&1===t.nodeType}function ln(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function hn(t){return!!t&&3===t.nodeType}function un(t){return!!t&&11===t.nodeType&&an(t.host)}function dn(t){return t?k(t).split(/\s+/):[]}function vn(t,i){var e=function(t){var i,e=null==o||null==(i=o.location)?void 0:i.href;return L(e)?void 0:nn(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function cn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return dn(i)}function fn(t){return H(t)?null:k(t).split(/(\s+)/).filter(t=>Bn(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function pn(t){var i="";return Tn(t)&&!Fn(t)&&t.childNodes&&t.childNodes.length&&bs(t.childNodes,function(t){var e;hn(t)&&t.textContent&&(i+=null!==(e=fn(t.textContent))&&void 0!==e?e:"")}),k(i)}function gn(t){var i;return L(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var _n=["a","button","form","input","select","textarea","label"];function mn(t,i){if(L(i))return!0;var e,r=function(t){if(i.some(i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function bn(t){var i=t.parentNode;return!(!i||!an(i))&&i}var yn=[".ph-no-autocapture","[data-ph-no-autocapture]"],wn=["next","previous","prev",">","<"],xn=[...wn,"+","-","−","–"],Sn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,kn=[".ph-no-rageclick",".ph-no-capture"],En=["","text","search","email","password","url","tel","number"];function $n(t,i){if(!o||Pn(t))return!1;var e,r,s,n,a;if(W(i)?(e=!!i&&kn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:kn,r=null==i?void 0:i.content_ignorelist,s=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===e)return!1;if(s&&function(t){return!(!t||!an(t))&&(!!ln(t,"textarea")||(ln(t,"input")?S(En,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var l=Cn(t,!1).targetElementList;return!function(t,i){if(!1===t||L(t))return!1;var e;if(!0===t)e=wn;else{if(!M(t))return!1;if(t.length>10)return Pe.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(t=>{var i=t.safeText,r=t.ariaLabel;return e.some(t=>Sn(i,t)||Sn(r,t))})}(r,l.map(t=>{var i;return{safeText:pn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!mn(l,e)}var Pn=t=>!t||ln(t,"html")||!an(t),Cn=(t,i)=>{if(!o||Pn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!ln(s,"body");)if(un(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=bn(s);if(!n)break;if(i||_n.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var a=o.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function Tn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!ln(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=cn(r);if(S(s,"ph-sensitive")||S(s,"ph-no-capture"))return!1}if(S(cn(t),"ph-include"))return!0;var n=t.type||"";if(N(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!N(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 Fn(t){return!!(ln(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ln(t,"select")||ln(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var An=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),In=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Rn=[16,15,14,13],On=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Mn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Dn=/[0-9A-Za-z_]/;function jn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Bn(t,i){if(void 0===i&&(i=!0),H(t))return!1;if(N(t)){if(t=k(t),i?An.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(In.lastIndex=0;i=In.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Rn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(An.test(a)&&jn(a))return!0}}}return!1}(t))return!1;if(i?On.test(t):function(t){var i;for(Mn.lastIndex=0;i=Mn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Dn.test(e)&&Dn.test(r)))return!0}return!1}(t))return!1}return!0}function Ln(t){var i=pn(t);return Bn(i=(i+" "+Nn(t)).trim())?i:""}function Nn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&bs(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=pn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Nn(t)).trim())}catch(t){Pe.error("[AutoCapture]",t)}}),i}function zn(t){return t.replace(/"|\\"/g,'\\"')}function Un(t){var i=t.attr__class;if(i)return M(i)?i:dn(i)}var Hn=Ce("[Dead Clicks]"),qn=()=>!0,Vn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Ye)),r=t.instance.config.capture_dead_clicks;return W(r)?r:!!j(r)||e},Wn=class{get lazyLoadedDeadClicksAutocapture(){return this.no}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Ye]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.so(()=>{this.oo()}):this.stop()}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Hn.error("failed to load script",i):t()})}oo(){var t;if(h){if(!this.no&&null!=(t=m.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=j(this.instance.config.capture_dead_clicks)?r({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.no=m.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.no.start(h),Hn.info("starting...")}}else Hn.error("`document` not found. Cannot start.")}stop(){this.no&&(this.no.stop(),this.no=void 0,Hn.info("stopping..."))}},Gn=Ce("[SegmentIntegration]");function Kn(t,i,e){void 0===e&&(e=!0);var r=t.config.segment;if(!r)return i();!function(t,i,e){var r=t.config.segment;if(!r)return i();var s=r=>{var s=()=>r.anonymousId()||Ms();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(Ur,us)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&D(n.then)?n.then(s):s(n)}(t,e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||Gn.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,r)=>{if(!r)return e;var s=!!i&&e.event.anonymousId===i&&!e.event.userId;s||e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Gn.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Gn.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var n=t.calculateEventProperties(r,e.event.properties);return e.event.properties=Object.assign({},n,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return e(t,t.event.event)},page(t){return e(t,fs)},identify(t){return e(t,gs)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{Gn.error("Failed to register the Segment integration",t),i()})},e)}var Jn="posthog-js";function Yn(t,i){var e=void 0===i?{}:i,s=e.organization,n=e.projectId,o=e.prefix,a=e.severityAllowList,l=void 0===a?["error"]:a,h=e.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var e,a,h,d,v,c;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(e=i.exception)?void 0:e.values)||[],g=p.map(t=>r({},t,{stacktrace:t.stacktrace?r({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>r({},t,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return s&&n&&(_.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}var Xn=class{constructor(t,i,e,r,s,n){this.name=Jn,this.setupOnce=function(o){o(Yn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Zn=class{constructor(t){this.ao=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Pe.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.lo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.uo()}uo(){var t;this.ho=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ao)}destroy(){var t;null==(t=this.ho)||t.call(this),this.ho=void 0}doPageView(t,i){var e,r=this.do(t,i);return this.lo={pathname:null!==(e=null==o?void 0:o.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.do(t,null==(i=this.lo)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.lo)?void 0:t.pageViewId}}do(t,i){var e=this.lo;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(L(n)||L(o)||L(a)||L(l)||L(h)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?rt(o/n,0,1,Pe):1,v=n>1?rt(a/n,0,1,Pe):1,c=l>1?rt(h/l,0,1,Pe):1,f=l>1?rt(u/l,0,1,Pe):1;r=ys(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}},Qn=["flags","surveys"],to={[Me]:{exposure:"hidden"},[Le]:{exposure:"hidden"},[Ne]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[qe]:{exposure:"event"},[Ve]:{exposure:"hidden"},[Ze]:{exposure:"hidden"},[We]:{exposure:"event"},[Ge]:{exposure:"hidden"},[Ke]:{exposure:"event"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Xe]:{exposure:"hidden"},[Qe]:{exposure:"event"},[tr]:{exposure:"hidden"},[ir]:{exposure:"hidden"},[ar]:{exposure:"hidden"},[lr]:{exposure:"event"},[er]:{exposure:"event",shouldSkipFromEventProperties:t=>U(t)},[hr]:{exposure:"event"},[ur]:{exposure:"event"},[dr]:{exposure:"event"},[vr]:{exposure:"event"},[cr]:{exposure:"hidden"},[fr]:{exposure:"hidden",storageGroup:"flags"},[pr]:{exposure:"hidden",storageGroup:"flags"},[gr]:{exposure:"hidden"},[_r]:{exposure:"hidden",storageGroup:"flags"},[mr]:{exposure:"hidden",storageGroup:"flags"},[br]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[yr]:{exposure:"hidden",storageGroup:"flags"},[wr]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},[kr]:{exposure:"hidden"},[$r]:{exposure:"hidden",storageGroup:"surveys"},[Pr]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Cr]:{exposure:"event"},[Tr]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Rr]:{exposure:"hidden"},[Or]:{exposure:"event"},[Mr]:{exposure:"event"},[Dr]:{exposure:"event"},[jr]:{exposure:"event"},[Br]:{exposure:"hidden"},[Lr]:{exposure:"hidden"},[Er]:{exposure:"event"},[Nr]:{exposure:"hidden"},[zr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ur]:{exposure:"hidden"},[Hr]:{exposure:"hidden"},[qr]:{exposure:"hidden"},[Vr]:{exposure:"hidden"},[Wr]:{exposure:"hidden"},[Gr]:{exposure:"hidden"},[Kr]:{exposure:"hidden"},[rr]:{exposure:"event"},[sr]:{exposure:"event"},[nr]:{exposure:"event"},[or]:{exposure:"event"},[Xr]:{exposure:"event"},[Zr]:{exposure:"event"},[Qr]:{exposure:"event"},[ts]:{exposure:"event"},[is]:{exposure:"event"},[es]:{exposure:"event"},[rs]:{exposure:"event"},[ss]:{exposure:"event"},[ns]:{exposure:"event"},[os]:{exposure:"event"},[as]:{exposure:"event"}},io=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],eo=t=>{var i=to[t];if(i)return i;for(var e of io){var r=e[1];if(0===t.indexOf(e[0]))return r}},ro=(t,i)=>{try{return JSON.stringify(t,(t,i)=>"bigint"==typeof i?i.toString():i,i)}catch(i){return P(t)}},so=t=>{var i=null==h?void 0:h.createElement("a");return L(i)?null:(i.href=t,i)},no=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!M(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Pe.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},oo=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");M(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},ao=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},lo=(t,i)=>t>=i&&g(),ho=(t,i,e,r)=>{if(0===t){if(g()){var s=i+1;return s===e&&r(),s}return i}return 0},uo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],vo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...uo],co="<masked>",fo=["li_fat_id"];function po(t,i,e){if(!h)return{};var r,s=i?[...uo,...e||[]]:[],n=go(oo(h.URL,s,co),t);return ys((r={},bs(fo,function(t){var i=Ts(t);r[t]=i||null}),r),n)}function go(t,i){var e=vo.concat(i||[]),r={};return bs(e,function(i){var e=no(t,i);r[i]=e||null}),r}function _o(t){var i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!U(i)){r.$search_engine=i;var s=h?no(h.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function mo(){return navigator.language||navigator.userLanguage}var bo="$direct";function yo(){return(null==h?void 0:h.referrer)||bo}function wo(t,i,e){var r;void 0===e&&(e=!1);var s=t?[...uo,...i||[]]:[],n=null==(r=e?gi(null==u?void 0:u.href):null==u?void 0:u.href)?void 0:r.substring(0,1e3);return{r:yo().substring(0,1e3),u:n?oo(n,s,co):void 0}}function xo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?gi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==bo?bo:null==(e=so(r))?void 0:e.host};if(n){o.$current_url=n;var a=so(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ys(o,go(n))}return r&&ys(o,_o(r)),o}function So(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ko(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Eo={flags:zr,surveys:Pr},$o=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Po=t=>t+"_cookie_identity_change_pending",Co=t=>{var i="",e=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(e+s>1e3)break;i+=r,e+=s}return i},To="main",Fo=[fr,pr,_r,mr,br,zr,yr,Sr],Ao=t=>-1!==Fo.indexOf(t),Io=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Ro=t=>{if(!t)return{};var i=JSON.parse(t);return j(i)?i:{}},Oo=(t,i)=>{bs(t,(e,r)=>{var s=eo(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]})},Mo=class{constructor(t,i,e){if(void 0===e&&(e=!0),this.vo={},this.co=!1,this.fo=!1,this.po=!1,this.mo=!1,this.yo=!1,this.bo=new Map,this._o=!1,this.wo=!1,this.ko=!1,this.So=!1,this.xo=new Set,this._n=t,this.Co=e,this.props={},this.To=void 0,this.Mo=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.eo=this.Io(t),this.po=this.Eo(t),this.load(),this.Ro(),t.debug&&Pe.info("Persistence loaded",t.persistence,r({},this.props)),this.update_config(t,t,i),this.save(),o){var s=()=>this.flush();Ps(o,"beforeunload",s,{capture:!1}),Ps(o,"pagehide",s,{capture:!1}),this.Ao=t=>{if(this.co&&(!t.storageArea||t.storageArea===(null==o?void 0:o.localStorage))&&t.key)if(t.key!==this.Mo){if(this.po){var i=Qn.find(i=>t.key===this.Po(i));i&&this.Fo(t.key,i)}}else this.Fo(t.key,To)},Ps(o,"storage",this.Ao)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.bo.get(i);if(Ao(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach(t=>s.add(t)),s.size&&this.Oo(i,s)}else this.Oo(i,!0)})}onCrossTabFeatureFlagChange(t){return this.xo.add(t),()=>this.xo.delete(t)}destroy(){this.Ao&&o&&(o.removeEventListener("storage",this.Ao),this.Ao=void 0),this.xo.clear()}Fo(t,i,e){if(void 0===e&&(e=!0),this.$o)return!1;var r,s;try{if(s=Us.li(t),U(s)){var n=this.Do(i);return n.storageValue=null,i!==To&&(n.persisted=!1),!1}r=Ro(s)}catch(t){return!1}var o=i===To?r:Us.di(this.Mo);if(o&&this.Lo(o))return!1;var a=this.No(r,i,e);return i===To&&this.po&&!Io(this.qo().main,r)||this.jo(r,i,!0,s),a}Lo(t){var i=this.props[De],e=t[De];return!L(i)&&!L(e)&&i!==e}jo(t,i,e,r){var s=this.Do(i);s.storageValue=r,i!==To&&(s.persisted=e);try{s.fingerprint=this.Bo(t,i)}catch(t){s.fingerprint=void 0}}No(t,i,e){var r=!1;return Fo.forEach(e=>{var s,n=null==(s=eo(e))?void 0:s.storageGroup;if(!(i===To&&this.po&&n||i!==To&&n!==i)){var o=e in t,a=this.Ho(e,o?t[e]:void 0),l=this.bo.has(e)?e in this.props:o;l===e in this.props&&Io(a,this.props[e])||(l?this.zo(e,a,!1):this.Uo(e,!1),r=!0)}}),r&&e&&this.xo.forEach(t=>t()),r}Wo(){if(!this.co)return!1;try{this.ko=!1;var t,i=Us.li(this.Mo),e=this.Do(To),r=!1,s=!1;if(i!==e.storageValue)if(U(i))e.storageValue=null;else{if(t=Ro(i),this.ko=!this.wo&&this.Lo(t),this.ko)return!1;s=this.No(t,To,!1),!this.po||Io(this.qo().main,t)?this.jo(t,To,!0,i):e.storageValue=i,r=!0}return this.po&&Qn.forEach(i=>{var e=Us.li(this.Po(i)),n=this.Do(i),o=t||{},a=r&&Fo.some(t=>{var e;return(null==(e=eo(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if(U(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.No(o,i,!1)||s));var l=Ro(e);s=this.No(l,i,!1)||s,this.jo(l,i,!0,e)}}),s}catch(t){return!1}}Oo(t,i){this.bo.set(t,i);var e=eo(t);null!=e&&e.volatile||(this.Do((this.po?null==e?void 0:e.storageGroup:void 0)||To).fingerprint=void 0,this.Vo(t))}Go(){Fo.forEach(t=>this.bo.set(t,!0))}Ro(){if(this.co)try{var t=Us.li(this.Mo),i=Ro(t);this.Do(To).storageValue=t,Fo.forEach(t=>{var e,r=this.po?null==(e=eo(t))?void 0:e.storageGroup:void 0,s=r?Us.li(this.Po(r)):null;if(r){var n=this.Do(r);n.storageValue=s,n.persisted=!U(s)}var o=r&&!U(s)?Ro(s):i;t in this.props?this.Zo(t,o[t],this.props[t]):t in o&&this.Oo(t,!0)})}catch(t){}}Ho(t,i){var e=this.bo.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){var s=new Set(M(i)?i:[]),n=new Set(M(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=j(i)?r({},i):{},a=j(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}Zo(t,i,e){if(Ao(t)){var r=this.bo.get(t);if(!0!==r){var s=i;if(this.co)try{var n,o=this.po?null==(n=eo(t))?void 0:n.storageGroup:void 0,a=o?this.Po(o):this.Mo;s=Ro(Us.li(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!L(i)&&!M(i)||!L(s)&&!M(s)||!M(e))return void this.Oo(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach(t=>{h.has(t)!==d.has(t)&&l.add(t)}),l.forEach(t=>{u.has(t)===d.has(t)&&l.delete(t)})}else{if(!j(e))return void(Io(s,e)?this.bo.delete(t):this.Oo(t,!0));if(!L(i)&&!j(i)||L(i)&&B(e)&&L(s))return void this.Oo(t,!0);var v=j(i)?i:{},c=j(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach(t=>{t in v==t in e&&Io(v[t],e[t])||l.add(t)}),l.forEach(t=>{t in c==t in e&&Io(c[t],e[t])&&l.delete(t)})}l.size?this.Oo(t,l):this.bo.delete(t)}}}Jo(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return q(i)&&i>0?i:0}Qo(t){if(this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase())if(t)try{var i=Ks(t,this._n.cookie_persisted_properties||[]),e=Ys(i,this._n.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ns.li(this.Mo)||void 0;s&&Zs(this.Mo,s)===r&&(this.Ko=r,this.Xo=s)}catch(t){}else try{var n=Ns.li(this.Mo)||void 0;this.Ko=n?Zs(this.Mo,n):void 0,this.Xo=n}catch(t){}}syncCookieProperties(){return this.Yo(this._n)}Yo(t,i){if(void 0===i&&(i=!1),this.$o&&!i||this.yo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=Ns.li(this.Mo)||void 0}catch(t){}if(!e||e===this.Xo)return!1;var r,s=Zs(this.Mo,e);try{r=Gs(JSON.parse(e))}catch(t){return!1}if((Ns.li(this.Mo)||void 0)!==e)return!1;this.Ko=s,this.Xo=e;var n=Xs(this.Mo,e),o=[...qs,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(L(i)||U(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(a[t]=!0,delete r[t])}),B(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,u=h[De],d=h[Ur],v=ys({},h);[...qs,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){var i=v[t];(n.isValid||-1===qs.indexOf(t)||!1!==i&&0!==i)&&delete v[t]}}),this.props=ys(v,r),Fo.forEach(t=>{var i=t in this.props;t in h===i&&Io(h[t],this.props[t])||(i?this.Zo(t,h[t],this.props[t]):this.Oo(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.zo(Ur,hs);var c=this.props[De],f=this.props[Ur];return!l||c===u&&f===d||(this.wo=!0,this.mo=!0,rn.ui(Po(this.Mo),!0),this.Uo(Sr),this.Uo(pr),this.Uo(fr),this.Uo(_r),this.Uo(mr),this.Uo(br),this.Uo(zr),this.Uo(Nr),this.Uo(Br),"anonymous"!==f||"identified"!==d&&"anonymous"!==r.$user_state&&(L(u)||c===u)||(Oo(this.props,r),this.Uo(kr)),"identified"===f?this.props.$user_id=c:delete this.props.$user_id,this.Uo(Le)),!0}consumeCookieIdentityChange(){var t=Po(this.Mo),i=this.mo||!!rn.li(t);return this.mo=!1,i&&rn.hi(t),i}ta(t){return void 0===t&&(t=!1),!(this.yo||this.$o&&!t||!this._n.cookieWinsOnConflict||"localstorage+cookie"!==this._n.persistence.toLowerCase()||(this.yo=!0,0))}ea(){this.yo&&(L(this.ia)||(clearTimeout(this.ia),this.ia=void 0),delete this.vo[To],this.ra(!0))}na(t){if(void 0===t&&(t=!0),this.yo)try{t?this.ea():L(this.ia)||(clearTimeout(this.ia),this.ia=void 0)}finally{this.yo=!1}}isDisabled(){return!!this.$o}Io(t){-1===$o.indexOf(t.persistence.toLowerCase())&&(Pe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,e=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var e=[...qs,...t];return r({},Us,{di(t){try{var r,s={};try{r=Ns.li(t)||void 0,s=r?Gs(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(Us.li(t)||"{}");if(i){var a=Xs(t,r),l=[...qs,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];U(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var d,v=o[De],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===qs.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Ur]=hs),!u||("distinct_id"in h?h[De]:o[De])===v&&("$user_state"in h?h[Ur]:o[Ur])===c||(Hs.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[De]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[Er],delete o[kr]),delete o.__alias)}n=ys(o,h)}else n=ys(s,o);return Us.ui(t,n),n}catch(t){}return null},ui(e,r,s,n,o,a){var l=Us.ui(e,r,void 0,void 0,a);try{var h=Ks(r,t);if(Object.keys(h).length){if(i){var u=Vs(e),d=Ys(h,t);if(Ns.ui(u,d,s,n,o,a),Ns.li(u)!==JSON.stringify(d)){Ns.hi(u,n);var v=Ks(r);return Ns.ui(e,v,s,n,o,a),l}}Ns.ui(e,h,s,n,o,a)}}catch(t){Us.ci(t)}return l},hi(t,i){try{null==o||o.localStorage.removeItem(t),Ns.hi(t,i),Ns.hi(Vs(t),i)}catch(t){Us.ci(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=!1,a=t.persistence.toLowerCase();return"localstorage"===a&&Us.si()?(i=Us,n=!0):"localstorage+cookie"===a&&e.si()?(i=e,n=!0,s=!0):"sessionstorage"===a&&rn.si()?i=rn:"memory"===a?i=tn:"cookie"===a&&Ns.si()?(i=Ns,s=!0):e.si()?(i=e,n=!0,s=!0):Ns.si()?(i=Ns,s=!0):i=tn,this.co=n,this.fo=s,i}Po(t){return this.Mo+"__"+t}Eo(t){return this.co&&!!t.split_storage}properties(){var t={};return bs(this.props,(i,e)=>{var r=eo(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}}),t}load(t){if(void 0===t&&(t=!1),!this.$o||t){var i=this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase(),e=i?Us.di(this.Mo):null,r={};if(i)try{bs(r=Gs(Ns.di(this.Mo)),(t,i)=>{(L(t)||U(t)||""===t)&&delete r[i]})}catch(t){}var s=this.eo.di(this.Mo);if(s&&(this.props=ys({},s)),this.po&&this.sa(),i&&s){var n,o,a=null==e?void 0:e[De],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[De],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.mo=!0,rn.ui(Po(this.Mo),!0);var d=ys({},this.props);Hs.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(L(a)||h===a)||(Oo(d,r),delete d[kr]),this.props=d;var v=new Set;Hs.forEach(t=>{var i,e=null==(i=eo(t))?void 0:i.storageGroup;e&&v.add(e)}),v.forEach(t=>{var i={};bs(this.props,(e,r)=>{var s;(null==(s=eo(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),B(i)?(Us.hi(this.Po(t)),this.vo[t]={}):Us.ui(this.Po(t),i)&&(this.vo[t]={persisted:!0,fingerprint:this.Bo(i,t)})})}}rn.li(Po(this.Mo))&&(this.mo=!0)}}sa(){for(var t of Qn){var i=Us.di(this.Po(t));if(i&&!B(i)){var e=this.Do(t);e.persisted=!0,this.oa(t)||(e.fingerprint=this.Bo(i,t)),this.aa(t,i)||ys(this.props,i)}}}oa(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=eo(i))?void 0:e.storageGroup)===t})}aa(t,i){var e=Eo[t];if(!e)return!1;var r=i[e],s=this.props[e];return q(r)&&q(s)&&s>r}refreshKey(t){var i;if(!(this.$o||"$fbc_persistence"===t&&this.So)){var e=this.po?null==(i=eo(t))?void 0:i.storageGroup:void 0,r=e?Us.di(this.Po(e)):this.eo.di(this.Mo);if(r&&t in r)this.zo(t,r[t],!1);else{if(e){var s=this.eo.di(this.Mo);if(s&&t in s)return void this.zo(t,s[t],!1)}this.Uo(t,!1)}}}save(){if(!this.$o){var t=this.Jo();t>0?L(this.ia)&&(this.ia=setTimeout(()=>{this.ia=void 0,this.ra()},t)):this.ra()}}flush(){L(this.ia)||(clearTimeout(this.ia),this.ia=void 0,this.ra())}ra(t){if(void 0===t&&(t=!1),!(this.$o||this.yo&&!t)){t||(this.syncCookieProperties(),this.So||this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase()||this.refreshKey(Ue));var i=!t&&!this._o;i||(this.ko=!1);var e=!!i&&this.Wo();if(this.ko)this._n.debug&&Pe.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.po)return this.la(),void(e&&this.xo.forEach(t=>t()));var r=this.ua(this.eo,this.Mo,this.props,To);"written"===r&&this.Qo(this.props),"failed"!==r&&(this.bo.clear(),this.wo=!1,this.So=!1),e&&this.xo.forEach(t=>t())}}}la(){var t=this,i=this.qo(),e=i.main,r=i.groups,s=this.ua(this.eo,this.Mo,e,To);"written"===s&&this.Qo(e),"failed"!==s&&(this.wo=!1,this.So=!1,Fo.forEach(t=>{var i;null!=(i=eo(t))&&i.storageGroup||this.bo.delete(t)}));var n=function(i){var e,s=r[i];if(B(s)&&(null==(e=t.vo[i])||!e.persisted))return Fo.forEach(e=>{var r;(null==(r=eo(e))?void 0:r.storageGroup)===i&&t.bo.delete(e)}),1;var n=t.ua(Us,t.Po(i),s,i);"failed"!==n&&Fo.forEach(e=>{var r=eo(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.bo.delete(e)})};for(var o of Qn)if(n(o))continue}qo(){var t={},i={flags:{},surveys:{}};return bs(this.props,(e,r)=>{var s,n=null==(s=eo(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Bo(t,i){if(i===To)return JSON.stringify(t)+"|"+this.ha+"|"+this.da+"|"+this.va;var e={};return bs(t,(t,i)=>{var r;e[i]=null!=(r=eo(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}ua(t,i,e,r){var s,n=this.Do(r);if(r!==To&&!n.dirty&&!L(n.fingerprint))return"skipped";try{if((s=this.Bo(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ui(i,e,this.ha,this.da,this.va,this._n.debug)?(n.dirty=!1,r!==To&&(n.persisted=!0),L(s)||(n.fingerprint=s),this.co&&(n.storageValue=Us.li(i)),"written"):(this._n.debug&&Pe.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.Go(),L(this.ia)||(clearTimeout(this.ia),this.ia=void 0),this.eo.hi(this.Mo,!1),this.eo.hi(this.Mo,!0),!e&&this.Co)for(var r of Qn)Us.hi(this.Po(r));e?delete this.vo[To]:this.vo={},this.Ko=void 0,this.Xo=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(j(t)){this.syncCookieProperties(),L(i)&&(i="None"),this.ha=L(e)?this.ca:e;var r=!1;if(bs(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.zo(e,t),r=!0)}),r)return this.save(),!0}return!1}register(t,i){if(j(t)){this.syncCookieProperties(),this.ha=L(i)?this.ca:i;var e=!1;if(bs(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||j(i)||M(i))&&(this.zo(r,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.Uo(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==h?void 0:h.URL;if(t!==this.To){var i=po(this._n.custom_campaign_params,this._n.mask_personal_data_properties,this._n.custom_personal_data_properties),e=!B(ks(i));return e&&this.register(i),this.To=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==h?void 0:h.referrer)?_o(t):{})}update_referrer_info(){var t;this.register_once({$referrer:yo(),$referring_domain:null!=h&&h.referrer&&(null==(t=so(h.referrer))?void 0:t.host)||bo},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=wo(this._n.mask_personal_data_properties,this._n.custom_personal_data_properties,this._n.disable_capture_url_hashes);this.register_once({[Gr]:this.fo?{r:Co(t.r),u:t.u?Co(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};bs([Wr,Vr],i=>{var e=this.props[i];e&&bs(e,function(i,e){t["$initial_"+E(e)]=i})});var i=this.props[Gr];return i&&ys(t,function(t,i){void 0===i&&(i=!1);var e=xo(t,i),r={};return bs(e,function(t,i){r["$initial_"+E(i)]=t}),r}(i,this._n.disable_capture_url_hashes)),t}safe_merge(t){return bs(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every((t,i)=>t===r[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.$o&&!l;l||this.Yo(i,h),this._n=t,!l&&(s||n||a)&&(this.Ko=void 0,this.Xo=void 0,this.Yo(r({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Io(t):this.eo;this.fa();var d=this.Eo(t),v=o||d!==this.po,c=!l&&(v||t.cross_subdomain_cookie!==this.da||t.secure_cookie!==this.va)&&this.ta(h);this._o=v;try{if(this.ca=this.ha=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.eo=u,this.po=d,this.props=f,this.save()}else a&&(this.eo=u,l||(delete this.vo[To],this.ra()))}finally{this._o=!1,c&&this.na()}}fa(){var t=this.props[Gr];if(this.fo&&j(t)&&"string"==typeof t.r){var i=Co(t.r),e="string"==typeof t.u?Co(t.u):t.u;i===t.r&&e===t.u||this.zo(Gr,r({},t,{r:i,u:e}))}}set_disabled(t){this.$o=t,this.$o?this.remove():this.save()}set_cross_subdomain(t){t!==this.da&&(this.da=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.va&&(this.va=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props.__timers||{};e[t]=i,this.zo(He,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return L(e)||(delete i[t],this.zo(He,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.zo(t,i),this.save()}zo(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||s===i||(this.wo=!0),"$fbc_persistence"!==t||Io(s,i)||(this.So=!0),this.Zo(t,s,i),null!=(r=eo(t))&&r.volatile||this.Vo(t))}Uo(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(Ao(t)&&this.Oo(t,!0),"$fbc_persistence"===t&&(this.So=!0),this.Vo(t))}Vo(t){var i,e=null==(i=eo(t))?void 0:i.storageGroup;e&&(this.Do(e).dirty=!0)}Do(t){return this.vo[t]||(this.vo[t]={})}},Do="gzip-js",jo="base64",Bo="events",Lo="cancelEvents",No="survey shown",zo="survey dismissed",Uo="survey sent",Ho="$survey_last_seen_date",qo="popover";function Vo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&D(e.then)&&e.then(void 0,()=>{})}}}}var Wo=Ce("[RateLimiter]"),Go=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{Wo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Wo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(q(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.pa(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(qr,a),{isRateLimited:l,remainingTokens:a.tokens}}ga(t){var i=this.instance.config.property_denylist;return!M(i)||!i.includes(t)}ma(){var t;if(this.ga("$current_url")&&this.ga("$pathname")&&null!=u&&u.pathname)return""+(null!==(t=u.origin)&&void 0!==t?t:"")+u.pathname}pa(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.ma(),o=this.ga("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}},Ko=Ce("[RemoteConfig]"),Jo=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=m._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ya(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}ba(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Ko.info("Using preloaded remote config",this.remoteConfig),void this._a(this.remoteConfig);if(this._instance.wa())return void Ko.warn("Remote config is disabled. Falling back to local config.");this.ya(t=>{if(!t)return Ko.info("No config found after loading remote JS config. Falling back to JSON."),void this.ba(t=>{this._a(t.json,t)});this._a(t)})}catch(t){Ko.error("Error loading remote config",t),this._a()}}_a(t,i){!t&&i&&(0===i.statusCode?i.error||Ko.warn("Failed to fetch remote config from PostHog."):Ko.error("Failed to fetch remote config from PostHog."));try{this._instance._a(t?{ok:!0,config:t}:{ok:!1})}catch(t){Ko.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){Ko.error("Error loading feature flags",t)}}},Yo=Uint8Array,Xo=Uint16Array,Zo=Uint32Array,Qo=new Yo([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]),ta=new Yo([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]),ia=new Yo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ea=function(t,i){for(var e=new Xo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Zo(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},ra=ea(Qo,2),sa=ra[1];ra[0][28]=258,sa[258]=28;for(var na=ea(ta,0)[1],oa=new Xo(32768),aa=0;32768>aa;++aa){var la=(43690&aa)>>>1|(21845&aa)<<1;oa[aa]=((65280&(la=(61680&(la=(52428&la)>>>2|(13107&la)<<2))>>>4|(3855&la)<<4))>>>8|(255&la)<<8)>>>1}var ha=function(t,i,e){for(var r=t.length,s=0,n=new Xo(i);r>s;++s)++n[t[s]-1];var o,a=new Xo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Xo(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[oa[d]>>>l]=h}else for(o=new Xo(r),s=0;r>s;++s)o[s]=oa[a[t[s]-1]++]>>>15-t[s];return o},ua=new Yo(288);for(aa=0;144>aa;++aa)ua[aa]=8;for(aa=144;256>aa;++aa)ua[aa]=9;for(aa=256;280>aa;++aa)ua[aa]=7;for(aa=280;288>aa;++aa)ua[aa]=8;var da=new Yo(32);for(aa=0;32>aa;++aa)da[aa]=5;var va=ha(ua,9,0),ca=ha(da,5,0),fa=function(t){return(t/8|0)+(7&t&&1)},pa=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Xo?Xo:t instanceof Zo?Zo:Yo)(e-i);return r.set(t.subarray(i,e)),r},ga=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},_a=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},ma=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Yo(0),0];if(1==s){var o=new Yo(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Xo(v+1),f=ba(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Yo(c),f]},ba=function(t,i,e){return-1==t.s?Math.max(ba(t.l,i,e+1),ba(t.r,i,e+1)):i[t.s]=e},ya=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Xo(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},wa=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},xa=function(t,i,e){var r=e.length,s=fa(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Sa=function(t,i,e,r,s,n,o,a,l,h,u){ga(i,u++,e),++s[256];for(var d=ma(s,15),v=d[0],c=d[1],f=ma(n,15),p=f[0],g=f[1],_=ya(v),m=_[0],b=_[1],y=ya(p),w=y[0],x=y[1],S=new Xo(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=ma(S,7),P=E[0],C=E[1],T=19;T>4&&!P[ia[T-1]];--T);var F,A,I,R,O=h+5<<3,M=wa(s,ua)+wa(n,da)+o,D=wa(s,v)+wa(n,p)+o+14+3*T+wa(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(M>=O&&D>=O)return xa(i,u,t.subarray(l,l+h));if(ga(i,u,1+(M>D)),u+=2,M>D){F=ha(v,c,0),A=v,I=ha(p,g,0),R=p;var j=ha(P,C,0);for(ga(i,u,b-257),ga(i,u+5,x-1),ga(i,u+10,T-4),u+=14,k=0;T>k;++k)ga(i,u+3*k,P[ia[k]]);u+=3*T;for(var B=[m,w],L=0;2>L;++L){var N=B[L];for(k=0;N.length>k;++k)ga(i,u,j[z=31&N[k]]),u+=P[z],z>15&&(ga(i,u,N[k]>>>5&127),u+=N[k]>>>12)}}else F=va,A=ua,I=ca,R=da;for(k=0;a>k;++k)if(r[k]>255){var z;_a(i,u,F[257+(z=r[k]>>>18&31)]),u+=A[z+257],z>7&&(ga(i,u,r[k]>>>23&31),u+=Qo[z]);var U=31&r[k];_a(i,u,I[U]),u+=R[U],U>3&&(_a(i,u,r[k]>>>5&8191),u+=ta[U])}else _a(i,u,F[r[k]]),u+=A[r[k]];return _a(i,u,F[256]),u+A[256]},ka=new Zo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ea=new Yo(0),$a=function(){for(var t=new Zo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Pa=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Ca(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=$a[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h,u=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Yo(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=xa(l,h,t.subarray(u,d)):(l[u]=n,h=xa(l,h,t.subarray(u,o)))}else{for(var v=ka[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Xo(32768),_=new Xo(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new Zo(25e3),x=new Xo(288),S=new Xo(32),k=0,E=0,P=(u=0,0),C=0,T=0;o>u;++u){var F=y(u),A=32767&u,I=_[F];if(g[A]=I,_[F]=A,u>=C){var R=o-u;if((k>7e3||P>24576)&&R>423){h=Sa(t,l,0,w,x,S,E,P,T,u-T,h),P=k=E=0,T=u;for(var O=0;286>O;++O)x[O]=0;for(O=0;30>O;++O)S[O]=0}var M=2,D=0,j=f,B=A-I&32767;if(R>2&&F==y(u-B))for(var L=Math.min(c,R)-1,N=Math.min(32767,u),z=Math.min(258,R);N>=B&&--j&&A!=I;){if(t[u+M]==t[u+M-B]){for(var U=0;z>U&&t[u+U]==t[u+U-B];++U);if(U>M){if(M=U,D=B,U>L)break;var H=Math.min(B,U-2),q=0;for(O=0;H>O;++O){var V=u-B+O+32768&32767,W=V-g[V]+32768&32767;W>q&&(q=W,I=V)}}}B+=(A=I)-(I=g[A])+32768&32767}if(D){w[P++]=268435456|sa[M]<<18|na[D];var G=31&sa[M],K=31&na[D];E+=Qo[G]+ta[K],++x[257+G],++S[K],C=u+M,++k}else w[P++]=t[u],++x[t[u]]}}h=Sa(t,l,n,w,x,S,E,P,T,u-T,h),n||(h=xa(l,h,Ea))}return pa(a,0,r+fa(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!h)),d=u.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Pa(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(u,i),Pa(u,d-8,e.d()),Pa(u,d-4,r),u}var Ta=!!v||!!d,Fa="text/plain",Aa=!1,Ia=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter(t=>t.split("=")[0]!==i).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Ra=function(t,i,e){var s;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=r({},i),h=null!==(s=null==a?void 0:a.split("&").map(t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=l[s])&&void 0!==i?i:r[1];return delete l[s],s+"="+n}))&&void 0!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return bs(t,function(t,i){L(t)||L(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)}),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},Oa=t=>{if(t.ka)return t.ka;var i=t.data,e=t.compression;if(i){if(e===Do){var r=Ca(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new Yo(t.length+(t.length>>>1)),r=0,s=function(t){e[r++]=t},n=0;i>n;++n){if(r+5>e.length){var o=new Yo(r+8+(i-n<<1));o.set(e),e=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return pa(e,0,r)}(ro(i)),{mtime:0});return{contentType:Fa,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===jo){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:ro(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(ro(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=ro(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Ma=t=>{var i,e,s=()=>"sendBeacon"===t.transport?{url:Ra(t.url,{compression:jo}),encodedBody:Oa(r({},t,{compression:jo,ka:void 0}))}:{url:Ia(t.url,"compression"),encodedBody:Oa(r({},t,{compression:void 0,ka:void 0}))};try{i=Oa(t)}catch(i){if(re(t.compression,no(t.url,"compression")))return Pe.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&re(t.compression,no(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?ee(new Uint8Array(e)):ArrayBuffer.isView(e)&&ee(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Aa=!0,s()):{url:t.url,encodedBody:i}},Da=t=>{try{return Ma(t)}catch(i){return Pe.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},ja=function(){var t=n(function*(t){var i=yield function(t,i,e){return ae.apply(this,arguments)}(ro(t.data),Oe.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return r({},t,{ka:{contentType:Fa,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),Ba=/Failed to fetch|NetworkError|Load failed/i,La=t=>"TypeError"===(null==t?void 0:t.name)&&Ba.test((null==t?void 0:t.message)||""),Na=t=>{var i=Da(t);if(i){var e=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;bs(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,v=!1;if(c){var f=new c;u={signal:f.signal,timeout:setTimeout(()=>{var i;v=!0,f.abort(pi("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))},t.timeout)}}var p=i=>{v&&"AbortError"===(null==i?void 0:i.name)||La(i)?Pe.warn(i):Pe.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var g;d(e,r({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Sa&&52428.8>(l||0),body:a,signal:null==(g=u)?void 0:g.signal},t.fetchOptions)).then(i=>i.text().then(e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Pe.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),p(t)}}},za=t=>{try{var i,e=Ma(t),s=e.url,n=e.encodedBody,o=null!=n?n:{},a=o.body,h=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(l.sendBeacon(s,u))return;var d=M(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(M(d)&&d.length>1&&(null!=h?h:0)>16384){var v=Math.ceil(d.length/2),c=i=>M(t.data)?i:r({},t.data,{batch:i});return za(r({},t,{data:c(d.slice(0,v))})),void za(r({},t,{data:c(d.slice(v))}))}Pe.warn("Beacon of ~"+(null!=h?h:0)+" bytes was rejected by the browser, falling back to fetch"),Na(r({},t,{Sa:!0}))}catch(t){Pe.warn("Beacon send failed",t)}},Ua=(t,i,e,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return Ra(e===Do?Ia(t,"compression"):t,r({},n?{[n]:Date.now().toString()}:{},e===Do?{}:{compression:e}))},Ha=[];d&&Ha.push({transport:"fetch",method:Na}),v&&Ha.push({transport:"XHR",method(t){var i=Da(t);if(i){var e=new v,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;bs(t.headers,function(t,i){e.setRequestHeader(i,t)}),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=l&&l.sendBeacon&&Ha.push({transport:"sendBeacon",method:za});var qa=class{constructor(t,i){this.xa=!0,this.Ca=[],this.Ta=rt((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Pe.createLogger("flush interval"),3e3),this.Ma=t}enqueue(t){this.Ca.push(t),this.Ia||this.Ea()}unload(){this.Ra();var t=this.Ca.length>0?this.Aa():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Pa(r({},t,{transport:"sendBeacon"}))})}enable(){this.xa=!1,this.Ea()}Ea(){var t=this;this.xa||(this.Ia=setTimeout(()=>{if(this.Ra(),this.Ca.length>0){var i=this.Aa(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&M(e.data)&&bs(e.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.Pa(e)};for(var r in i)e()}},this.Ta))}Pa(t){try{this.Ma(t)}catch(t){Pe.error(t)}}Ra(){clearTimeout(this.Ia),this.Ia=void 0}Aa(){var t={};return bs(this.Ca,i=>{var e,s=i,n=(s?s.batchKey:null)||s.url;L(t[n])&&(t[n]=r({},s,{data:[]})),null==(e=t[n].data)||e.push(s.data)}),this.Ca=[],t}},Va=class{constructor(t){this._instance=t,this.Fa=!1,this.Oa=3e3,this.Ca=[],this.Ca=[],this.$a=!0,!L(o)&&"onLine"in o.navigator&&(this.$a=o.navigator.onLine,this.Da=()=>{this.$a=!0,this.La()},this.Na=()=>{this.$a=!1},Ps(o,"online",this.Da),Ps(o,"offline",this.Na))}get length(){return this.Ca.length}retriableRequest(i){var s=i.retriesPerformedSoFar,n=e(i,t);V(s)&&(n.url=Ra(n.url,{retry_count:s})),this._instance._send_request(r({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=s?s:0))return void this.cs(r({retriesPerformedSoFar:s},n));0===t.statusCode&&Pe.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=s?s:0)+" retries.")}null==n.callback||n.callback(t)}}))}cs(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.Ca.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Pe.warn(s),this.Fa||(this.Fa=!0,this.qa())}qa(){if(this.ja&&clearTimeout(this.ja),0===this.Ca.length)return this.Fa=!1,void(this.ja=void 0);this.ja=setTimeout(()=>{this.$a&&this.Ca.length>0&&this.La(),this.qa()},this.Oa)}La(){var t=Date.now(),i=[],e=this.Ca.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.Ca=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.ja&&(clearTimeout(this.ja),this.ja=void 0),this.Fa=!1,L(o)||(this.Da&&(o.removeEventListener("online",this.Da),this.Da=void 0),this.Na&&(o.removeEventListener("offline",this.Na),this.Na=void 0)),this.Ca)){var i=t.requestOptions;try{this._instance._send_request(r({},i,{transport:"sendBeacon"}))}catch(t){Pe.error(t)}}this.Ca=[]}},Wa=class{constructor(t){this._instance=t,this.Ba=()=>{var t,i,e,r;this.Ha||(this.Ha={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Ha.lastScrollY=Math.ceil(n),this.Ha.maxScrollY=Math.max(n,null!==(t=this.Ha.maxScrollY)&&void 0!==t?t:0),this.Ha.maxScrollHeight=Math.max(o,null!==(i=this.Ha.maxScrollHeight)&&void 0!==i?i:0),this.Ha.lastContentY=a,this.Ha.maxContentY=Math.max(a,null!==(e=this.Ha.maxContentY)&&void 0!==e?e:0),this.Ha.maxContentHeight=Math.max(l,null!==(r=this.Ha.maxContentHeight)&&void 0!==r?r:0)}}get za(){return this._instance.config.scroll_root_selector}getContext(){return this.Ha}resetContext(){var t=this.Ha;return setTimeout(this.Ba,0),t}startMeasuringScrollPosition(){Ps(o,"scroll",this.Ba,{capture:!0}),Ps(o,"scrollend",this.Ba,{capture:!0}),Ps(o,"resize",this.Ba)}scrollElement(){var t;if(!this.za)return null==o||null==(t=o.document)?void 0:t.documentElement;for(var i of M(this.za)?this.za:[this.za]){var e,r=null==o||null==(e=o.document)?void 0:e.querySelector(i);if(r)return r}}Ua(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.za){var s=this.scrollElement();return s&&s[r]||0}return o?"y"===t?o.scrollY||o.pageYOffset||(null==(i=o.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:o.scrollX||o.pageXOffset||(null==(e=o.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.Ua("y")}scrollX(){return this.Ua("x")}},Ga=t=>wo(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes),Ka=class{constructor(t,i,e,r){this.Te=t=>{var i=this.Wa();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Va(this._instance)};this.Ga.register({[Hr]:e})}},this._instance=t,this.Za=i,this.Ga=e,this.Va=r||Ga,this.Za.onSessionId(this.Te)}Wa(){return this.Ga.props[Hr]}getSetOnceProps(){var t,i=null==(t=this.Wa())?void 0:t.props;return i?"r"in i?xo(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return bs(ks(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i}),t}},Ja=class{on(t,i){return this.Ja[t]||(this.Ja[t]=[]),this.Ja[t].push(i),()=>{this.Ja[t]=this.Ja[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.Ja[t]||[])e(i);for(var r of this.Ja["*"]||[])r(t,i)}constructor(){this.Ja={}}},Ya=Ce("[SessionId]"),Xa=864e5,Za=class{on(t,i){return this.Qa.on(t,i)}constructor(t,i,e){var r;if(this.Ka=null,this.Xa=null,this.Ya=[],this.tl=void 0,this.el=!1,this.Qa=new Ja,this.il=(t,i)=>!(!V(t)||!V(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._n=t.config,this.Ga=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.rl=void 0,this._sessionActivityTimestamp=null,this.nl=i||Ms,this.sl=e||Ms;var s=this._n.persistence_name||this._n.token;if(this._sessionTimeoutMs=1e3*rt(this._n.session_idle_timeout_seconds||1800,60,36e3,Ya.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ol(),this.al="ph_"+s+"_window_id",this.ll="ph_"+s+"_primary_window_exists",this.ul()){var n=rn.di(this.al),o=rn.di(this.ll);n&&!o?this.Ie=n:rn.hi(this.al),rn.ui(this.ll,!0)}null!=(r=this._n.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this._n.bootstrap.sessionID),this.hl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return L(this.Ya)&&(this.Ya=[]),this.Ya.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.Ya=this.Ya.filter(i=>i!==t)}}ul(){return"memory"!==this._n.persistence&&!this.Ga.$o&&rn.si()}dl(t){t!==this.Ie&&(this.Ie=t,this.ul()&&rn.ui(this.al,t))}vl(){return this.Ie?this.Ie:this.ul()?rn.di(this.al):null}cl(t){var i=this.Ka;return!U(i)&&!U(t)&&5e3>Math.abs(t-i)}fl(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Bt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Bt=t,s&&!r||s&&this.cl(i)||(this.Ka=i,this.Ga.register({[ar]:[i,t,e]}))}pl(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return V(i)&&i>0}gl(){this.pl()?this.Ga.refreshKey(ar):(this.Ga.flush(),this.Ga.load())}ml(){var t;if(!U(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ka){this.gl();var i=this.yl();i[1]===this.Bt&&i[2]===this._sessionStartTimestamp&&(this.Ka=this._sessionActivityTimestamp,this.Ga.register({[ar]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ga.flush())}}bl(){var t=this.yl()[0],i=V(t)?t:0,e=V(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}_l(t){return this.gl(),this.il(t,this.bl())}yl(){var t=this.Ga.props[ar];return M(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ka=null,this.rl=void 0,clearTimeout(this.wl),this.wl=void 0,this.fl(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Ya.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ya.error("Invalid sessionID in bootstrap",t)}}(t);return!L(e)&&(i?this.rl={sessionId:t,sessionStartTimestamp:e}:this.fl(t,(new Date).getTime(),e),!0)}destroy(){this.el=!0,this.ml(),clearTimeout(this.wl),this.wl=void 0,this.tl&&o&&(o.removeEventListener(cs,this.tl,{capture:!1}),this.tl=void 0),this.Ya=[]}hl(){this.tl=()=>{this.ml(),this.ul()&&rn.hi(this.ll)},Ps(o,cs,this.tl,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),"always"===this._n.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Bt;if(e)this.Xa=r;else if(U(this.Xa)||this.Xa>r||r-this.Xa>=1e3){var n,o;null==(n=(o=this.Ga).syncCookieProperties)||n.call(o),this.Xa=r}var a=this.yl(),l=a[1],h=a[2],u=!L(s)&&l!==s,d=this.bl(),v=this.vl(),c=this.rl,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Xa),p=c?f:V(h)&&Math.abs(r-h)>Xa,g=!1,_=u,m=!l||!!c,b=l,y=!m&&!t&&this.il(r,d);if(y){(y=this._l(r))||Ya.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.yl();l=w[1],h=w[2]}if(m||y||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.nl(),v=this.sl(),Ya.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.rl=void 0,g=!0}else v||(v=this.sl(),g=!0),(_=_||l!==b)&&(Ya.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=V(d)&&t&&!p?d:r,k=V(h)?h:(new Date).getTime();this.dl(v),this.fl(l,S,k),t||this.ol();var E={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.Ya.forEach(t=>t(l,v,E)),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}ol(){this.el||(clearTimeout(this.wl),this.wl=setTimeout(()=>{if(!this.el)if(this._l((new Date).getTime())){var t=this.Bt;this.resetSessionId(),this.Qa.emit("forcedIdleReset",{idleSessionId:t})}else this.ol()},1.1*this.sessionTimeoutMs))}},Qa=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&x(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>x(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function tl(){return(tl=n(function*(){var t=null==l?void 0:l.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i,e=null==(i=yield t.getHighEntropyValues(["model"]))?void 0:i.model;return N(e)&&e.length>0?e:void 0}catch(t){return void Pe.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function il(t,i){var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e}function el(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var rl=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},sl=t=>t.toLowerCase(),nl={exact:(t,i)=>i.some(i=>t.some(t=>i===t)),is_not:(t,i)=>i.every(i=>t.every(t=>i!==t)),regex:(t,i)=>i.some(i=>t.some(t=>rl(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!rl(i,t))),icontains:(t,i)=>i.map(sl).some(i=>t.map(sl).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(sl).every(i=>t.map(sl).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function ol(t,i){return!t||Object.entries(t).every(t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=nl[e.operator];return!!s&&s(e.values,[String(r)])})}function al(t,i,e){return ro({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var ll="custom",hl="i.posthog.com",ul=/^\/static\//,dl=["/s/","/e/","/i/"],vl=class{constructor(t){this.kl={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+hl,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.kl[this.apiHost]||(this.kl[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":ll),this.kl[this.apiHost]}Sl(t){if(ul.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}xl(t){var i=so(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Cl(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=so(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&dl.some(t=>0===i.indexOf(t))){var a=this.xl(r);if(a){var l,h=this.apiHost,u=this.Tl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.Tl=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Tl,e=this.xl(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.Cl(t,i,this.uiHost+i);if("flags"===t)return this.Cl(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.Sl(i);if(e)return this.Cl(t,i,""+e+i)}if(this.region===ll)return this.Cl(t,i,this.apiHost+i);var r=hl+i;switch(t){case"assets":return this.Cl(t,i,"https://"+this.region+"-assets."+r);case"api":return this.Cl(t,i,"https://"+this.region+"."+r)}}},cl=Ce("[Surveys]"),fl=t=>{try{var i=(t=>((t,i)=>"seenSurvey_"+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){cl.error("Failed to persist survey seen state",t)}},pl=["popover","widget","api"],gl={ignoreConditions:!1,ignoreDelay:!1,displayType:qo},_l=Ce("[PostHog ExternalIntegrations]"),ml={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},bl=class{constructor(t){this._instance=t}so(t,i){var e;null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return _l.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=m.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.so(ml[n],()=>{var i;null==(i=m.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=m.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=m.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}},yl=class{constructor(t,i){this.A=t,this.Us=i,this.Ml=new Map,this.Bs=!1}add(t){var i=this;return n(function*(){if(i.Bs)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Ml.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Ml.set(t.name,t);try{var e=t.setup(i.Us);e&&(yield e)}catch(e){var r=i.Ml.get(t.name)===t;r&&i.Ml.delete(t.name),i.A.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Il(t)}})()}getExtension(t){return this.Ml.get(t)}dispose(){if(!this.Bs){this.Bs=!0;var t=Array.from(this.Ml.values()).reverse();for(var i of(this.Ml.clear(),t))this.Il(i)}}Il(t){try{var i=null==t.dispose?void 0:t.dispose();i&&D(i.then)&&i.then(void 0,i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)})}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}},wl=class{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);L(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}},xl="extensionsRemoteConfig",Sl=class{constructor(t){this.instance=t,this.Bs=!1,this.A=Pe,this.El=t.Rl,this.kv=new wl(t),this.onEvent=t=>Vo(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.Bs)return Vo(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Al.on(xl,i);return this.El&&i(this.El),Vo(e)},this.Pl=new yl(Pe.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(je);return"string"==typeof t?t:void 0}get library(){return{name:Oe.LIB_NAME,version:Oe.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Pl.add(t)}getExtension(t){return this.Pl.getExtension(t)}capture(t,i,e){var r=this;return n(function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)})()}registerDynamicEventProperties(t){return Vo(this.instance.Fl(t))}handleRemoteConfig(t){this.Bs||(this.El=t,this.instance.Al.emit(xl,t))}sendRequest(t,i){var e=this;return n(function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?Ra(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?T.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(n),{statusCode:202}):new Promise(t=>{n.callback=t,e.instance._send_request(n)})})()}dispose(){this.Bs||(this.Bs=!0,this.Pl.dispose())}},kl={},El=0,$l=()=>{},Pl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Cl="Surveys module not available",Tl="sanitize_properties is deprecated. Use before_send instead",Fl="Invalid value for property_denylist config: ",Al=/^[A-Za-z0-9_-]{1,400}$/,Il=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Rl=["token","distinct_id",Yr],Ol="posthog",Ml=!Ta&&-1===(null==p?void 0:p.indexOf("MSIE"))&&-1===(null==p?void 0:p.indexOf("Mozilla")),Dl=t=>{var i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},jl=t=>{var i;return r({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:$s(null==h?void 0:h.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:$l,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:u&&N(null==u?void 0:u.search)&&-1!==u.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==o||null==(i=o.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Pe.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ds,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:$l},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:xn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Dl(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(t))},Bl=[["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"]],Ll=t=>{var i={};for(var e of Bl){var r=e[0],s=e[1];L(t[r])||(i[s]=t[r])}var n=ys({},i,t),o=t.__preview_external_dependency_versioned_paths;return L(o)||(L(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),N(o)&&L(t.asset_host)&&(n.asset_host=o)),M(t.property_blacklist)&&(L(t.property_denylist)?n.property_denylist=t.property_blacklist:M(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Pe.error(Fl+t.property_denylist)),n},Nl=class{constructor(){this.__forceAllowLocalhost=!1}get Ol(){return this.__forceAllowLocalhost}set Ol(t){Pe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},zl=(s=class t{$l(t){if(t){var i=this.Ml.indexOf(t);-1!==i&&this.Ml.splice(i,1)}}Dl(t,i){return this.$l(t),this.Ml.push(i),null==i.initialize||i.initialize(),i}Ll(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Nl(){if(!(this.ql||this.config.reuseAnonymousId||this.config.segment||this.Ll())){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.jl||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.ql=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", 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. "+e)))}}Bl(){if(!this.Ll()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.Hl()||t.load(!0);var i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){var e=this.config.get_device_id(Ms());this.register({distinct_id:e,$device_id:e}),t.set_property(Ur,hs)}this.zl()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this.webPerformance=new Nl,this.Ul=!1,this.version=Oe.LIB_VERSION,this.Wl=new Set,this.Vl="",this.Al=new Ja,this.Ml=[],this.Gl=[],this.jl=!1,this.ql=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jl(),this.SentryIntegration=Xn,this.sentryIntegration=t=>function(t,i){var e=Yn(t,i);return{name:Jn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Zl=!1,this.Jl=null,this.Ql=null,this.Kl=null,this.scrollManager=new Wa(this),this.pageViewManager=new Zn(this),this.rateLimiter=new Go(this),this.requestRouter=new vl(this),this.consent=new sn(this),this.externalIntegrations=new bl(this);var e=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,i,e)=>{var r=N(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=N(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",t=>Pe.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==Ol){var s,n=null!==(s=kl[r])&&void 0!==s?s:new t;return n._init(i,e,r),kl[r]=n,kl[Ol][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var s,n,a;void 0===i&&(i={});var l,h=N(t)?t.trim():"";if(!h)return Pe.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 h!==(null==(l=this.config)?void 0:l.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('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=jl(i.defaults),i.debug=this.Xl(i.debug),this.Yl=i,this.tu=[],i.person_profiles?this.Ql=i.person_profiles:i.process_person&&(this.Ql=i.process_person);var u=jl(i.defaults),d=Ll(i),v=ys({},u,d,{name:e,token:h});j(u.rageclick)&&j(d.rageclick)&&(v.rageclick=ys({},u.rageclick,d.rageclick)),j(u.session_recording)&&j(d.session_recording)&&(v.session_recording=ys({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Pe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Do;var c=this.Hl();if(this.persistence=new Mo(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mo(r({},this.config,{persistence:"sessionStorage"}),c,!1),this.Vl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&rn.si()){var f=rn.di(this.Vl);M(f)&&f.forEach(t=>{N(t)&&this.Wl.add(t)})}else rn.hi(this.Vl);var p=r({},this.persistence.props),g=r({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.eu=new qa(t=>this.iu(t),this.config.request_queue_config),this.ru=new Va(this),this.__request_queue=[];var _=this.Ll();_||(this.sessionManager=new Za(this),this.sessionPropsManager=new Ka(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.nu()})),this.su(),this.config.__preview_deferred_init_extensions?(Pe.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.ou(_)},0)):(Pe.info("Initializing extensions synchronously"),this.ou(_)),Oe.DEBUG=Oe.DEBUG||this.config.debug,Oe.DEBUG&&Pe.info("Starting in debug mode",{this:this,config:i,thisC:r({},this.config),p:p,s:g}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=r({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.jl=!!m&&!z(m),void 0!==(null==(a=i.bootstrap)?void 0:a.distinctID)){var b=i.bootstrap.distinctID,y=this.get_distinct_id(),w=this.persistence.get_property(Ur);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"anonymous"===w)this.identify(b);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"identified"===w)Pe.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var x=this.config.get_device_id(Ms()),S=i.bootstrap.isIdentifiedID?x:b;this.persistence.set_property(Ur,i.bootstrap.isIdentifiedID?us:hs),this.register({distinct_id:b,$device_id:S})}}if(_)this.register_once({distinct_id:Jr,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(Ms());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(Ur,hs)}return Ps(o,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?Kn(this,()=>this.au()):this.au(),D(this.config._onCapture)&&this.config._onCapture!==$l&&(Pe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Pe.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 tl.apply(this,arguments)}().then(t=>{t&&this.register({[Be]:t})}).catch($l),this}lu(t){var i=t;return N(i.name)&&D(i.setup)}uu(t,i){this.lu(t)?i.push(()=>{this.hu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{Pe.error('Failed to dispose browser extension "'+t.name+'"',i)})}):this.Ml.push(t)}su(){var i,e,r,s,n,o,a=null!==(i=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==i?i:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.du)||o.call(this),this.du=void 0,this.featureFlags=new a(this)),D(this.featureFlags.onReloading)&&D(this.featureFlags.setup)?this.du||(this.du=this.featureFlags.onReloading(()=>{this.Al.emit("featureFlagsReloading",!0)}),this.hu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}ou(i){var e,s,n,o,a,l,h,u=performance.now(),d=r({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.Ml.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new d.exceptions(this)),d.historyAutocapture&&this.Ml.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Ml.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Ml.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!i&&this.Ml.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.uu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.uu(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new d.surveys(this),v),d.logs&&this.uu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.Ml.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Ml.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Ml.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Ml.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Ml.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Ml.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Ml.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Vn)),d.toolbar&&this.Ml.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.Ml.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.Ml.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.vu){var t=this.vu;this.vu=void 0,this.Ml.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}}),this.cu(v,u)}cu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.cu(t,i)},0);var e=t.shift();if(e)try{e()}catch(t){Pe.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Xr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Zr]:r}),this.config.__preview_deferred_init_extensions&&Pe.info("PostHog extensions initialized ("+r+"ms)")}_a(t){var i;if(!h||!h.body)return Pe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._a(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.vu=t),this.Rl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=S(r.supportedCompression,Do)?Do:S(r.supportedCompression,jo)?jo:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Ql?this.Ql:ds}),null==(i=this.fu)||i.handleRemoteConfig(t),this.Ml.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}au(){try{this.config.loaded(this)}catch(t){Pe.critical("`loaded` function failed",t)}if(this.pu(),this.config.internal_or_test_user_hostname&&null!=u&&u.hostname){var t=u.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ll())&&this.gu()},1),this.mu=new Jo(this),this.mu.load()}pu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.eu)||t.enable())}_dom_loaded(){this.is_capturing()&&ms(this.__request_queue,t=>this.iu(t)),this.__request_queue=[],this.pu()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.yu()&&this.capture(ps),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.eu)||r.unload(),null==(s=this.ru)||s.unload()):this.yu()&&this.capture(ps,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Ml?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=r({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(L(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,s,n=r({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&L(n.compression)&&n.data&&(n.compression=jo),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(M(o=n.data)?o:[o]).map(t=>r({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),M(t)?t.map(t=>r({},t,{sent_at:i})):r({},t,{sent_at:i})}(n.data))),n.url=Ua(n.url,n.method,n.compression,n.timestampMode);var v=Ha.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(i(t[e]))return t[e]}(v,t=>t.transport===d))?void 0:s.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var p=t=>{try{c(t)}catch(t){La(t)?Pe.warn(t):Pe.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Do&&f&&"undefined"!=typeof Promise&&!Aa?ja(n).then(t=>{p(t)}).catch(i=>{if(se(i))return Aa=!0,void p(r({},n,{compression:void 0,url:Ua(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return se(t)||i===ie})(i)&&(Aa=!0),p(n)}):c(n)})(r({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}iu(t){this.ru?this.ru.retriableRequest(t):this._send_request(t)}_execute_array(t){El++;try{var i,e=[],r=[],s=[];ms(t,t=>{if(t)if(M(i=t[0]))s.push(t);else if(D(t))try{t.call(this)}catch(i){Pe.error("Error executing queued PostHog call",t,i)}else M(t)&&"alias"===i?e.push(t):M(t)&&-1!==i.indexOf("capture")&&D(this[i])?s.push(t):r.push(t)});var n=function(t,i){ms(t,function(t){try{if(M(t[0])){var e=i;bs(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Pe.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{El--}}push(i){if(El>0&&M(i)&&N(i[0])){var e=t.prototype[i[0]];D(e)&&e.apply(this,i.slice(1))}else this._execute_array([i])}bu(){var t,i=null==(t=this.persistence)?void 0:t.get_property(Ue);return N(i)&&Il.test(i)?{value:i,delivered:!1}:j(i)&&N(i.value)&&Il.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}_u(t,i,e,r){if(this.persistence){this.persistence.refreshKey(Ue);var s=this.bu();if(!r){if(e)return N(i)&&Il.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[Ue]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(Ue);if(N(t)&&Al.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[Ue]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(Ue)}}wu(t){if(this.persistence){this.persistence.refreshKey(Ue);var i=this.bu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[Ue]:{value:t,delivered:!0}})}}capture(t,i,e){var s,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.eu){if(this.is_capturing())if(!L(t)&&N(t)){this.Bl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var p=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var g;null!=i&&i.$current_url&&!N(null==i?void 0:i.$current_url)&&(Pe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.ku||Pe.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&&(g=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 _=new Date,m=(null==e?void 0:e.timestamp)||_,b=fi(null==e?void 0:e.uuid,Ms),y={uuid:b,event:t,properties:this.calculateEventProperties(t,i||{},m,b)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&f&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),p&&(y.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var w="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!w&&(y.$set=null==e?void 0:e.$set);var x=j(null==i?void 0:i.$set)?i.$set:void 0,S=!(null==e||!e.$set)&&"$fbc"in e.$set,k=S||!!x&&"$fbc"in x,E=S?null==e||null==(s=e.$set)?void 0:s[ze]:null==x?void 0:x[ze],P=M(null==i?void 0:i.$unset)?i.$unset:[],C=(null==e?void 0:e.$unset)||[],T=-1!==P.indexOf("$fbc")||-1!==C.indexOf("$fbc"),F=this._u(null==(n=g)?void 0:n.fbclid,E,k,T);F&&!0===y.properties.$process_person_profile&&F.pending&&!k&&!w&&(y.$set=r({[ze]:F.value},y.$set));var A=null==e?void 0:e.$unset;A&&(y.$unset=A);var I=w?void 0:this.Su(null==e?void 0:e.$set_once,t!==_s,t===gs);if(I&&(y.$set_once=I),null!=e&&e._noTruncate||(u=this.config.properties_string_max_length,d=y,v=t=>N(t)?t.slice(0,u):t,c=new Set,y=function t(i,e){if(i!==Object(i))return v?v(i):i;if(!c.has(i)){var r;if(c.add(i),M(i))r=[],ms(i,i=>{r.push(t(i))});else{var s={};bs(i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),y.timestamp=m,L(null==e?void 0:e.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=_),w&&(y.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return te.forEach(r),i.forEach(r),e}(y.properties,Rl)),t===zo||t===Uo){var R=null==i?void 0:i.$survey_id,O=null==i?void 0:i.$survey_iteration;fl({id:R,current_iteration:O}),y.$set=r({},y.$set,{[il({id:R,current_iteration:O},t===Uo?"responded":"dismissed")]:!0})}else t===No&&(y.$set=r({},y.$set,{[Ho]:(new Date).toISOString()}));if("product tour shown"===t){var D=null==i?void 0:i.$product_tour_type;D&&(y.$set=r({},y.$set,{["$product_tour_last_seen_date/"+D]:(new Date).toISOString()}))}var z=r({},y.properties.$set,y.$set);if(B(z)||this.setPersonPropertiesForFlags(z),!H(this.config.before_send)){var U=this.ds(y);if(!U)return;(y=U).uuid=fi(y.uuid,Ms)}var q=null!==(o=null==(a=y.$set)?void 0:a.$fbc)&&void 0!==o?o:j(null==(l=y.properties)?void 0:l.$set)?y.properties.$set.$fbc:void 0,V=null!=F&&F.pending&&q===F.value?F.value:void 0;this.Al.emit("eventCaptured",y);var W=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=r({method:"POST",url:W,data:y,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(W)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},null!=e&&e.transport?{transport:e.transport}:{},V?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.wu(V)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||V?this.iu(G):this.eu.enqueue(G),y}Pe.critical("This capture call is ignored due to client rate limiting.")}}else Pe.error("No event name provided to posthog.capture")}else Pe.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null==(i=this.fu)?void 0:i.getExtension(t)}hu(){var t;return null!==(t=this.fu)&&void 0!==t?t:this.fu=new Sl(this)}Fl(t){this.Gl.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Gl.indexOf(t);-1!==e&&this.Gl.splice(e,1)}}}xu(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Kl=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.Wl.clear(),this.Cu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,e,s,n){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.xu();var a=n?void 0:this.persistence.remove_event_timer(t),l=r({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ll()&&(l[Yr]=!0),"$snapshot"===t){var d=r({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=d.distinct_id,(!N(l.distinct_id)&&!q(l.distinct_id)||z(l.distinct_id))&&Pe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var v,c=function(t,i,e,r){var s,n,a,l;if(void 0===r&&(r=!1),!p)return{};var h,d=t?[...uo,...i||[]]:[],v=ri(p),c=v[0],f=v[1],g=function(t){for(var i=0;oi.length>i;i++){var e,r=oi[i],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(e=n&&t.match(n)||o)?void 0:e[1])||""]}return["",""]}(p),_=g[0],m=g[1],b=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},w={};L(e)||(w.detectGoogleSearchApp=e);var x={},S=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,k=null==(n=navigator)?void 0:n.maxTouchPoints,E=null==o||null==(a=o.screen)?void 0:a.width,P=null==o||null==(l=o.screen)?void 0:l.height,C=null==o?void 0:o.devicePixelRatio;L(S)||(x.userAgentDataPlatform=S),L(k)||(x.maxTouchPoints=k),L(E)||(x.screenWidth=E),L(P)||(x.screenHeight=P),L(C)||(x.devicePixelRatio=C);var T,F,A,I,R,O,M,D,j=ys(ks({$os:c,$os_version:f,$browser:Qt(p,navigator.vendor,b,w),$webview_app:_,$webview_app_version:m,$device:si(p),$device_type:(F=p,A=x,D=si(F),D===ht||D===lt||"Kobo"===D||"Kindle Fire"===D||D===It?at:D===xt||D===kt||D===St||D===Ft?"Console":D===ut?"Wearable":D?nt:"Android"===(null==A?void 0:A.userAgentDataPlatform)&&(null!==(I=null==A?void 0:A.maxTouchPoints)&&void 0!==I?I:0)>0?600>Math.min(null!==(R=null==A?void 0:A.screenWidth)&&void 0!==R?R:0,null!==(O=null==A?void 0:A.screenHeight)&&void 0!==O?O:0)/(null!==(M=null==A?void 0:A.devicePixelRatio)&&void 0!==M?M:1)?nt:at:"Desktop"),$timezone:So(),$timezone_offset:ko()}),{$current_url:oo(r?gi(null==u?void 0:u.href):null==u?void 0:u.href,d,co),$host:null==u?void 0:u.host,$pathname:null==u?void 0:u.pathname,$raw_user_agent:p.length>1e3?p.substring(0,997)+"...":p,$browser_version:ii(p,navigator.vendor,b,w),$browser_language:mo(),$browser_language_prefix:(T=mo(),"string"==typeof T?T.split("-")[0]:void 0),$screen_height:null==o?void 0:o.screen.height,$screen_width:null==o?void 0:o.screen.width,$viewport_height:null==o?void 0:o.innerHeight,$viewport_width:null==o?void 0:o.innerWidth,$lib:y.LIB_NAME,$lib_version:y.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return y.SDK_DIST_CHANNEL&&(j.$sdk_dist_channel=y.SDK_DIST_CHANNEL),j}(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 f=this.sessionManager.checkAndGetSessionAndWindowId(n,e.getTime(),!0),g=f.windowId;l.$session_id=f.sessionId,l.$window_id=g}this.sessionPropsManager&&ys(l,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&ys(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(_=this.ru)?void 0:_.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ll&&(l.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||n?"$pageleave"!==t||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,s),l=ys(l,v),"$pageview"===t&&h&&(l.title=h.title),!L(a)){var m=e.getTime()-a;l.$duration=parseFloat((m/1e3).toFixed(3))}p&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties(),x=l.$groups,S=b.$groups;j(x)&&!B(x)&&(l.$groups=r({},j(S)?S:{},x)),bs(["$referrer","$referring_domain"],t=>{t in b&&delete w[t]});var k={};if(this.Gl.length>0)for(var E of this.Gl.slice())try{ys(k,E())}catch(t){Pe.error("Failed to produce browser extension event properties",t)}(l=ys({},c,b,w,r({},k,l))).$is_identified=this._isIdentified(),M(this.config.property_denylist)?bs(this.config.property_denylist,function(t){delete l[t]}):Pe.error(Fl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var P=this.config.sanitize_properties;P&&(Pe.error(Tl),l=P(l,t));var C=this.Tu();return l.$process_person_profile=C,C&&!n&&this.Mu("_calculate_event_properties"),l}Su(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Tu())return t;if(this.Ul&&!e)return t;var s=ys({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(Pe.error(Tl),s=n(s,"$set_once")),i&&(this.Ul=!0),B(s)?void 0:s}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.xu(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach(t=>this.Wl.add(t)),this.Cu()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.Wl.delete(t),this.Cu()}Iu(t,i){this.register({[t]:i})}nu(){this.Wl.forEach(t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)}),this.Wl.clear(),this.Cu()}Cu(){var t;if(this.Vl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.$o||!rn.si())rn.hi(this.Vl);else{var i=[];this.Wl.forEach(t=>i.push(t)),i.length>0?rn.ui(this.Vl,i):rn.hi(this.Vl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Al.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Cl}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Cl})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Cl})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=gl),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Cl}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Cl})}Eu(t){return!t||z(t)?(Pe.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Pe.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Pe.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Pe.uninitializedWarning("posthog.identify");if(q(t)&&(t=t.toString(),Pe.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Eu(t)&&this.Mu("posthog.identify")){this.Bl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.xu(!1),o=this.persistence.ta(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property("__alias")&&(this.unregister(Le),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===hs,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(Ur,us),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.ea(),this.capture(gs,c,{$set:i||{},$set_once:e||{}}),this.Kl=al(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(Ur,us);var f=i||{},p=e||{};this.setPersonPropertiesForFlags({$set:f,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.ea(),this.capture("$set",{$set:f,$set_once:p}),this.Kl=al(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Br)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.na(a)}}}setPersonProperties(t,i){if((t||i)&&this.Mu("posthog.setPersonProperties")){var e=al(this.get_distinct_id(),t,i);this.Kl!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Kl=e):Pe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(M(t)?t:[t]).filter(t=>N(t)&&t.length>0);0!==e.length&&this.Mu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Kl=null)}group(t,i,e){var s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.xu();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:r({},n,{[t]:i})}),(o||e)&&this.Tu()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(_s,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else Pe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Mu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=W(t)?t:null==t?void 0:t.resetDeviceID,e=W(t)||null==t?void 0:t.bootstrap;this.Ru(i,!1,e)}Ru(t,i,e){var s,n,o,a;if(void 0===i&&(i=!1),Pe.info("reset"),!this.__loaded)return Pe.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(s=this.Yl)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.wa());var h=this.get_property(je),u=this.get_property(Be),d=this.get_property(tr);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();this.consent.reset(),i||!v||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==(a=this.persistence)||null==a.ta?void 0:a.ta(),f=!1;try{var p,g,_,m,b,y,w,x,S,k,E,P,C;if(null==(p=this.persistence)||p.clear(),null==(g=this.sessionPersistence)||g.clear(),this.Wl.clear(),this.Cu(),L(d)||null==(_=this.persistence)||_.register({[tr]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(y=this.conversations)||y.reset(),null==(w=this.logs)||w.reset(),null==(x=this.metrics)||x.reset(),null==(S=this.persistence)||S.set_property(Ur,hs),null==(k=this.sessionManager)||k.resetSessionId(),this.Kl=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Jr,$device_id:null},"");else{var T=this.config.get_device_id(Ms());this.register_once({distinct_id:T,$device_id:t?T:h},""),t||L(u)||this.register({[Be]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.Ll()||(null==(C=this.persistence)||C.set_property(Ur,e.isIdentifiedID?us:hs),this.register({distinct_id:e.distinctID})),null==(E=this.featureFlags)||E.initialize(),!(L(l)||null!=(P=this.sessionManager)&&P.setBootstrapSessionId(l,!0))){var F=r({},e);delete F.sessionID,this.config.bootstrap=F}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var A;c&&(null==(A=this.persistence)||null==A.na||A.na(f))}this.reloadFeatureFlags()}shutdown(t){var i=this;return n(function*(){var t,e,r,s,n,o,a;if(i.__loaded){i.hu().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.eu)||s.unload(),null==(n=i.ru)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(t){Pe.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else Pe.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Au()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.Pu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property("$people_distinct_id")?(Pe.critical("Attempting to create alias for existing People user - aborting."),-2):this.Mu("posthog.alias")?(L(i)&&(i=this.get_distinct_id()),t!==i?(this.Iu(Le,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Pe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=r({},this.config);if(j(t)){var e,s,n,o,a,l,h,u,d,v,c,f,p;ys(this.config,Ll(t));var g=this.Hl();null==(e=this.persistence)||e.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mo(r({},this.config,{persistence:"sessionStorage"}),g,!1);var _=this.Xl(this.config.debug);W(_)&&(this.config.debug=_),W(this.config.debug)&&(this.config.debug?(Oe.DEBUG=!0,Us.si()&&Us.ui("ph_debug",!0),Pe.info("set_config",{config:t,oldConfig:i,newConfig:r({},this.config)})):(Oe.DEBUG=!1,Us.si()&&Us.hi("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.wa()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(d=this.historyAutocapture)||d.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.zl(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Kn(this,$l,!1)}}_overrideSDKInfo(t,i){Oe.LIB_NAME=t,Oe.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){try{if(!this.exceptions)return;var e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(r({},e,i))}catch(t){return}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var i,e;return null!==(i=null==(e=this.logs)?void 0:e.logger)&&void 0!==i?i:t.Fu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Ol;return i!==Ol&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property("$user_state"))}Tu(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&B(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(i=this.persistence)||null==(i=i.props)||!i.$epp))}yu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Tu()||this.Mu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Mu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Mu(t){return"never"===this.config.person_profiles?(Pe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Nl(),this.Iu(Kr,!0),!0)}Hl(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}zl(){var t,i,e,r,s,n=this.Hl();return this.is_capturing()||null==(t=this.logs)||t.Ou(),(null==(i=this.persistence)?void 0:i.$o)!==n&&(null==(e=this.persistence)||e.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.$o)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Wl.clear(),this.Cu()),n}opt_in_capturing(i){var e,r,s;if("always"!==this.config.cookieless_mode){if(this.Ll()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.Ru(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Za(this),this.pageViewManager=new Zn(this),this.persistence&&(this.sessionPropsManager=new Ka(this,this.sessionManager,this.persistence));var d,v=null!==(l=null==(h=this.config.__extensionClasses)?void 0:h.sessionRecording)&&void 0!==l?l:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.Dl(this.sessionRecording,new v(this)),this.Rl&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.Rl)))}this.consent.optInOut(!0),this.zl(),this.pu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(L(null==i?void 0:i.captureEventName)||null!=i&&i.captureEventName)&&this.capture(null!==(s=null==i?void 0:i.captureEventName)&&void 0!==s?s:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.gu()}else Pe.warn(Pl)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,i,e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.Ru(!0,!0),this.consent.optInOut(!1),this.zl(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Jr,$device_id:null}),this.$l(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.gu(),this.pu())}else Pe.warn(Pl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.zl()}_is_bot(){return l?Qa(l,this.config.custom_blocked_useragents):void 0}gu(){h&&("visible"===h.visibilityState?this.Zl||(this.Zl=!0,this.capture(fs,{title:h.title},{send_instantly:!0}),this.Jl&&(h.removeEventListener(vs,this.Jl),this.Jl=null)):this.Jl||(this.Jl=this.gu.bind(this),Ps(h,vs,this.Jl)))}debug(t){!1===t?(null==o||o.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==o||o.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}))}wa(){var t=this.Yl||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Pe.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,i,e,r,s){var n=i in t&&!H(t[i]),o=e in t&&!H(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Pe)}ds(t){var i;if(H(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(K),r=M(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),H(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return G(t.event)?Pe.warn(o+". This can cause unexpected behavior."):Pe.info(o),null}s.properties&&!B(s.properties)||Pe.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Pe.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&H(s.properties[a]))return Pe.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.lo)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Xl(t){var i=W(t)&&!t,e=Us.si()&&"true"===Us.li("ph_debug");return!i&&(!!e||t)}},s.__defaultExtensionClasses={},s.Fu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),s);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=Ss(t.prototype[i[e]])}(zl,["identify"]);var Ul=class{constructor(t){this.disabled=!1===t;var i=j(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}},Hl="$copy_autocapture",ql=Ce("[AutoCapture]");function Vl(t,i){return i.length>t?i.slice(0,t)+"...":i}function Wl(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!an(i));return i}function Gl(t,i){var e,s,n=i.e,a=i.maskAllElementAttributes,l=i.maskAllText,h=i.elementAttributeIgnoreList,u=i.elementsChainAsString,d=i.disableCaptureUrlHashes;if(!an(t))return{props:{}};for(var v=[t],c=new Set([t]),f=t;f.parentNode&&!ln(f,"body")&&1e3>v.length;)if(un(f.parentNode)){var p=f.parentNode.host;if(c.has(p))break;c.add(p),v.push(p),f=p}else{if(!an(f.parentNode))break;if(c.has(f.parentNode))break;c.add(f.parentNode),v.push(f.parentNode),f=f.parentNode}var g,_,m,b=[],y={},w=!1,x=!1;if(bs(v,t=>{var i=Tn(t);if(ln(t,"a")){var e=t.getAttribute("href");w=!!(i&&e&&Bn(e))&&(d?gi(e):e)}S(cn(t),"ph-no-capture")&&(x=!0),b.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};_n.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Vl(1024,Ln(t)):Vl(1024,pn(t)));var a=cn(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),bs(t.attributes,function(e){var n;if((!Fn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Bn(e.value)&&(!N(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=dn(a).join(" ")),o["attr__"+e.name]=Vl(1024,"href"===e.name&&s?gi(a):a)}});for(var l=1,h=1,u=t;u=Wl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,a,l,h,d)),bs(function(t){if(!Tn(t))return{};var i={};return bs(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Bn(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(y,i)||(y[i]=t)})}),x)return{props:{},explicitNoCapture:x};if(l||(b[0].$el_text=ln(t,"a")||ln(t,"button")?Ln(t):pn(t)),w){var k,E;b[0].attr__href=w;var P=null==(k=so(w))?void 0:k.host,C=null==o||null==(E=o.location)?void 0:E.host;P&&C&&P!==C&&(g=w)}return{props:ys((_=n.type,{$event_type:_,$ce_version:1}),u?{}:{$elements:b},{$elements_chain:(m=b,M(m)?function(t){return t.map(t=>{var i,e,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=r({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return ws(o).sort((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r}).forEach(t=>{var i=t[1];return a[zn(t[0].toString())]=zn(i.toString())}),(s+=":")+ws(a).map(t=>t[0]+'="'+t[1]+'"').join("")}).join(";")}(function(t){return t.map(t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Un(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return ws(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(m)):"")},null!=(e=b[0])&&e.$el_text?{$el_text:null==(s=b[0])?void 0:s.$el_text}:{},g&&"click"===n.type?{$external_click_url:g}:{},y)}}var Kl=class{constructor(t){this.Ds=t,this.name="autocapture",this.Ls=!1,this.Ns=null,this.qs=!1,this.js=!1,this._n={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Bs=!1,this.Ds.refresh(this._n),this.rageclicks=new Ul(this._n.rageclick),this.Hs=null}setup(t){this.zs(),this.Us=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Bs?i.dispose():(this.Ws=i,this.startIfEnabled())}dispose(){var t;this.Bs||(this.Bs=!0,this.Us=void 0,null==(t=this.Ws)||t.dispose(),this.Ws=void 0,this.Vs())}Gs(){return this.Ds.refresh(this._n),this._n}zs(){var t,i;return this.Gs(),this._n.url_allowlist=null==(t=this._n.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this._n.url_ignorelist=null==(i=this._n.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this._n}Zs(){if(this.isBrowserSupported()){if(o&&h){var t=this.Js=t=>{t=t||(null==o?void 0:o.event);try{this.Qs(t)}catch(t){ql.error("Failed to capture event",t)}};if(Ps(h,"submit",t,{capture:!0}),Ps(h,"change",t,{capture:!0}),Ps(h,"click",t,{capture:!0}),this.Gs().capture_copied_text){var i=this.Ks=t=>{t=t||(null==o?void 0:o.event);try{this.Qs(t,Hl)}catch(t){ql.error("Failed to capture clipboard event",t)}};Ps(h,"copy",i,{capture:!0}),Ps(h,"cut",i,{capture:!0}),Ps(h,"paste",i,{capture:!0})}}}else ql.info("Disabling Automatic Event Collection because this browser is not supported")}Vs(){this.Js&&(null==h||h.removeEventListener("submit",this.Js,!0),null==h||h.removeEventListener("change",this.Js,!0),null==h||h.removeEventListener("click",this.Js,!0),this.Js=void 0),this.Ks&&(null==h||h.removeEventListener("copy",this.Ks,!0),null==h||h.removeEventListener("cut",this.Ks,!0),null==h||h.removeEventListener("paste",this.Ks,!0),this.Ks=void 0),this.Ls=!1}startIfEnabled(){!this.Bs&&this.Us&&this.isEnabled&&!this.Ls&&(this.Zs(),this.Ls=!0)}onRemoteConfig(t){if(!this.Bs)if(this.qs=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.js=i.elementsChainAsString);var e,r=i.autocapture_opt_out;W(r)&&(null==(e=this.Us)||e.kv.set(qe,r),this.Ns=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Hs=t}getElementSelectors(t){var i,e=[];return null==(i=this.Hs)||i.forEach(i=>{var r;null==h||null==(r=h.querySelectorAll(i))||r.forEach(r=>{t===r&&e.push(i)})}),e}get isEnabled(){var t,i;if(this.Bs)return!1;var e=null==(t=this.Us)?void 0:t.kv.get(qe),r=this.Ns,s=this.Gs(),n=s.remoteRequestsDisabled&&!this.qs;if(U(r)&&!W(e)&&!n)return!1;var o=null!==(i=this.Ns)&&void 0!==i?i:!!e;return!!s.enabled&&!o}Qs(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var e=gn(t);hn(e)&&(e=e.parentNode||null);var s,n=this.zs();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&$n(e,n.rageclick)&&this.Qs(t,"$rageclick");var a=i===Hl,l=a?r({},n,{dom_event_allowlist:void 0}):n;if(e&&function(t,i,e,r,s,n){var a;if(!o||Pn(t))return!1;if(null!=e&&e.url_allowlist&&!vn(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&vn(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var l=e.dom_event_allowlist;if(l&&!l.some(t=>i.type===t))return!1}var h=Cn(t,r),u=h.parentIsUsefulElement,d=h.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(L(e))return!0;var r,s=function(t){if(e.some(i=>t.tagName.toLowerCase()===i))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,e))return!1;if(!mn(d,null==e?void 0:e.css_selector_allowlist))return!1;if(mn(d,null!==(a=null==e?void 0:e.css_selector_ignorelist)&&void 0!==a?a:yn))return!1;try{var v=o.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(_n.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(e,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var h,u=Gl(e,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.js,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),d=u.props;if(u.explicitNoCapture)return!1;var v=this.getElementSelectors(e);if(v&&v.length>0&&(d.$element_selectors=v),i===Hl){var c=t.type||"clipboard";if("paste"!==c){var f,p,g=null==o||null==(f=o.getSelection())?void 0:f.toString(),_=fn(g);if(!_)return!1;d.$selected_content=_,d.$clipboard_text_length=null!==(p=null==g?void 0:g.length)&&void 0!==p?p:0}d.$copy_type=c}return null==(h=this.Us)||h.capture(i,d).catch(t=>ql.error("Failed to capture event",t)),!0}}}isBrowserSupported(){return D(null==h?void 0:h.querySelectorAll)}},Jl=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=j(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.wa(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}},Yl=Ce("[ExceptionAutocapture]"),Xl=()=>{},Zl=t=>{var i;if(D(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Ql(t,i,e){try{if(!(i in t))return Xl;var r={next:t[i]},s=e(function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)});return D(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=Zl(e);n;){if(n.next===s)return void(n.next=r.next);n=Zl(e=n.next)}else t[i]=r.next}}catch(t){return Xl}}var th=Ce("[TracingHeaders]"),ih=Ce("[Web Vitals]"),eh=9e5,rh=["CLS","FCP","INP","LCP"],sh=["INP","LCP"],nh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],oh="disabled",ah="lazy_loading",lh=Ce("[SessionRecording]"),hh=Ce("[Heatmaps]");function uh(t){return j(t)&&"clientX"in t&&"clientY"in t&&q(t.clientX)&&q(t.clientY)}var dh=Ce("[Product Tours]"),vh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Xe))},ch=Ce("[SiteApps]"),fh="Error while initializing PostHog app with config id ",ph=(t,i)=>null!=t&&t.then?t.then(i):i(t),gh="SDK is not enabled or survey functionality is not yet loaded",_h="Disabled. Not loading surveys.",mh=class{constructor(t,i){this.Ds=t,this.$u=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Du=!1,this.Lu=[],this.Nu=null,this.qu=null,this.Bs=!1,this.ju=new Set,this.onRemoteConfig=t=>{if(!this.Bs&&!this._n.disableSurveys){if(!t.ok)return cl.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(H(i))return cl.warn("Flags not loaded yet. Not loading surveys.");this.Bu=W(i)?i:i.length>0,cl.info("flags response received, isSurveysEnabled: "+this.Bu),this.loadIfEnabled()}}}setup(t){if(!this.Bs)return this.Hu=t,ph(t.kv.initialize(),()=>{if(this.Hu===t&&!this.Bs){this.Hu=void 0,this.Us=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Bs?i.dispose():(this.Ws=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.Bs||(this.Bs=!0,this.Hu=void 0,this.Us=void 0,null==(t=this.Ws)||t.dispose(),this.Ws=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Lu=[],this.Nu=null,this.ju.forEach(t=>clearTimeout(t)),this.ju.clear())}get _n(){return this.Ds.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith("seenSurvey_")||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(!this.Bs&&this.Us){var t=this._n;if(!this._surveyManager)if(this.Du)cl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)cl.info(_h);else if(t.cookielessMode&&this.Ds.isOptedOut())cl.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ds.getExtensions();if(i){if(!L(this.Bu)||t.advancedEnableSurveys){var e=this.Bu||t.advancedEnableSurveys;this.Du=!0;try{var r=i.generateSurveys;if(r)return this.zu(r,e),void(this.Du=!1);var s=i.loadExternalDependency;if(!s)return this.Uu(ls),void(this.Du=!1);s(t=>{try{if(this.Bs)return;var i=this.Ds.getExtensions();t||null==i||!i.generateSurveys?this.Uu("Could not load surveys script",t):this.zu(i.generateSurveys,e)}finally{this.Du=!1}})}catch(t){throw this.Du=!1,this.Uu("Error initializing surveys",t),t}}}else cl.error("PostHog Extensions not found.")}}}zu(t,i){this.Bs||(this._surveyManager=t(i),this._surveyEventReceiver=this.Ds.createEventReceiver(),cl.info("Surveys loaded successfully"),this.Wu({isLoaded:!0}))}Uu(t,i){cl.error(t,i),this.Wu({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Lu.push(t),this._surveyManager&&this.Wu({isLoaded:!0}),()=>{this.Lu=this.Lu.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Us)&&void 0!==e?e:this.$u;if(r&&!this.Bs){if(this._n.disableSurveys)return cl.info(_h),t([]);var s=r.kv.get($r);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Vu()&&this.getSurveys(()=>{},!0));if(this.Nu)this.Nu.then(i=>{this.Bs||t(i.surveys,i.context)}).catch(t=>cl.error("Error in survey callback",t));else{var n=this.Gu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this._n.requestTimeoutMs}).then(t=>{try{return this.Zu(r,t)}catch(t){return cl.error("Error processing surveys response",t),this.Zu(r,{statusCode:0,error:t})}},t=>this.Zu(r,{statusCode:0,error:t}));this.Nu=n;var o=()=>{this.Nu===n&&(this.Nu=null)};n.then(i=>{o(),this.Bs||t(i.surveys,i.context)},o).catch(t=>cl.error("Error in survey callback",t))}}}Gu(t,i){var e=this.Us;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(gh)}))}Zu(t,i){var e;if(this.Bs)return{surveys:[],context:{isLoaded:!1,error:gh}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?cl.error(s):i.error||cl.warn(s),this.qu=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.qu=null;var n=i.json.surveys||[],o=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(el(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t)));return o.length>0&&(null==(e=this._surveyEventReceiver)||e.register(o)),t.kv.set({[$r]:n,[Pr]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Vu(){return this.Ju()&&!this.Nu&&!this.Qu()}Ju(){var t,i,e=null==(t=null!==(i=this.Us)&&void 0!==i?i:this.$u)?void 0:t.kv.get(Pr);return q(e)&&Date.now()-e>3e5}Qu(){return q(this.qu)&&3e5>Date.now()-this.qu}markSurveyAsSeen(t,i){var e;fl({id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Wu(t){for(var i of this.Lu)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){cl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!H(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);cl.warn("init was not called")}Ku(t){var i=null;return this.getSurveys(e=>{var r;i=null!==(r=e.find(i=>i.id===t))&&void 0!==r?r:null}),i}Xu(t){if(H(this._surveyManager))return{eligible:!1,reason:gh};var i="string"==typeof t?this.Ku(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}Yu(t){if(H(this._surveyManager))return{eligible:!1,reason:gh};var i="string"==typeof t?this.Ku(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(H(this._surveyManager))return cl.warn("init was not called"),{visible:!1,disabledReason:gh};var i=this.Yu(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return H(this._surveyManager)?(cl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:gh})):new Promise(e=>{this.getSurveys(i=>{var r,s=null!==(r=i.find(i=>i.id===t))&&void 0!==r?r:null;if(s){var n=this.Yu(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var r;if(H(this._surveyManager))cl.warn("init was not called");else{var s="string"==typeof t?this.Ku(t):t;if(null!=s&&s.id)if(pl.includes(s.type)){var n=null==h?void 0:h.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){cl.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.ju.delete(o),this.Bs||(cl.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),cl.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.ju.add(o)}else this._surveyManager.renderSurvey(s,n,e);else cl.warn("Survey element not found")}else cl.warn("Surveys of type "+s.type+" cannot be rendered in the app");else cl.warn("Survey not found")}}displaySurvey(t,i){var e;if(H(this._surveyManager))cl.warn("init was not called");else{var s=this.Ku(t);if(s){var n=s;if(null!=(e=s.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=r({},s,{appearance:r({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==qo&&i.initialResponses&&cl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.Xu(s);if(!o.eligible)return void cl.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else cl.warn("Survey not found")}}cancelPendingSurvey(t){H(this._surveyManager)?cl.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};function bh(t,i,e){if(H(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var yh=class{constructor(t){this._instance=t,this.th=new Set,this.eh=new Set,this.ih=new Ja,this.rh=(t,i)=>this.nh(t,i)&&this.sh(t,i)&&this.oh(t,i)&&this.ah(t,i),this.nh=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;L(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.uh=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.uh)||t.call(this),this.uh=void 0,this.ih=new Ja}register(t){var i,e;if(!L(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.th.add(t),null==(i=t.steps)||i.forEach(t=>{this.eh.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.th.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{null!=t&&t.selector&&r.add(t.selector)})}),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.th.clear(),this.eh.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.eh.has(t)||this.eh.has(i.event))&&this.th.forEach(t=>{this.hh(i,t)&&this.ih.emit("actionCaptured",t.name)})}dh(t){this.onAction("actionCaptured",i=>t(i))}hh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.rh(t,e))return!0;return!1}onAction(t,i){return this.ih.on(t,i)}sh(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!bh(r,i.url,i.url_matching||"contains"))return!1}return!0}oh(t,i){return!!this.fh(t,i)&&!!this.ph(t,i)&&!!this.gh(t,i)}fh(t,i){var e;if(null==i||!i.href)return!0;var r=this.mh(t);if(r.length>0)return r.some(t=>bh(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&bh((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}ph(t,i){var e;if(null==i||!i.text)return!0;var r=this.mh(t);if(r.length>0)return r.some(t=>bh(t.text,i.text,i.text_matching||"exact")||bh(t.$el_text,i.text,i.text_matching||"exact"));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!H(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some(t=>bh(t,n,o)))}gh(t,i){var e,r;if(null==i||!i.selector)return!0;if(null!=t&&null!=(e=t.properties)&&null!=(e=e.$element_selectors)&&e.includes(i.selector))return!0;var s=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&s)try{return new RegExp(i.selector_regex).test(s)}catch(t){return!1}return!1}mh(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}ah(t,i){return null==i||!i.properties||0===i.properties.length||ol(i.properties.reduce((t,i)=>{var e=M(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t},{}),null==t?void 0:t.properties)}},wh=class{constructor(t){var i;this.yh=[],this._instance=t,this.bh=new Map,this._h=new Map,this.wh=new Map,this.kh=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Sh(t))}xh(t){return!1}Ch(){return null}Th(t){}Mh(){}Ih(t,i){return!!t&&ol(t.propertyFilters,null==i?void 0:i.properties)}Eh(t,i){var e=new Map;return t.forEach(t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach(i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}})}),e}Rh(t,i,e){var r=(e===Bo?this.bh:this._h).get(t),s=[];return this.Ah(t=>{s=t.filter(t=>null==r?void 0:r.includes(t.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find(i=>i.name===t);return this.Ih(n,i)})}register(t){this.Ph(t,!1)}replace(t){this.Ph(t,!0)}Ph(t,i){var e;L(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Fh(t,i),this.Oh(t,i))}Oh(t,i){var e=t.filter(t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length});if(i&&this.wh.clear(),0!==e.length){this.$h||(this.$h=new yh(this._instance),this.$h.init(),this.$h.dh(t=>this.onAction(t)));var r=[];e.forEach(t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach(i=>{if(r.push(i),i.name){var e,s=null!==(e=this.wh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.wh.set(i.name,s)}})}),i?this.$h.replace(r):this.$h.register(r)}else{var s;i&&(null==(s=this.$h)||s.replace([]))}}Dh(t,i){i.forEach((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach(t=>{s.includes(t)||s.push(t)}),t.set(e,s)})}Fh(t,i){var e,r,s=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0}),n=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}),o=this.Eh(t,Bo),a=this.Eh(t,Lo);i?(this.bh=o,this._h=a):(this.Dh(this.bh,o),this.Dh(this._h,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.uh)&&void 0!==e||(this.uh=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.Lh(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Nh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.qh([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.jh(n),void this.Bh([n])}if(this._h.has(t)){var a=this.Rh(t,i,Lo);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map(t=>t.id)}),this.qh(a.map(t=>t.id)),a.forEach(t=>this.Hh(t.id)))}if(this.bh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.bh.get(t)});var l=this.Rh(t,i,Bo);this.zh(l.map(t=>t.id))}}onAction(t){this.wh.has(t)&&this.zh(this.wh.get(t)||[])}zh(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.xh(s)?this.jh(s)&&this.Uh(s):r.push(s);r.length>0&&(this.yh=[...new Set([...this.yh,...r])]),this.Lh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}jh(t){this.yh=this.yh.filter(i=>i!==t);var i=this.Wh();return!i.includes(t)&&(this.Vh([...i,t]),this.Gh(),!0)}qh(t){var i=new Set(t);this.yh=this.yh.filter(t=>!i.has(t));var e=this.Zh(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.Vh(r),0===r.length&&this.Jh()),this.Bh(t)}Qh(){var t,i=this.Ch();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Uh(t){if(this.Ch()){var i=this.Qh();this.Th(r({},i,{[t]:Date.now()}))}}Bh(t){if(this.Ch()){var i=this.Qh(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(B(e)?this.Mh():this.Th(e))}}Kh(){this.Ch()&&this.Mh()}getActivationTimestamp(t){if(this.Wh().includes(t)){var i=this.Qh()[t];return q(i)?i:void 0}}Zh(){var t,i=this.Xh();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Wh(){var t,i,e=this.Zh();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Yh()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Gh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.td(i)}Jh(){this.ed()}Sh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Yh()];if(e&&e!==t){var r=this.Zh(),s=this.Qh();r.length>0&&(this.Vh([]),r.filter(t=>q(s[t])).forEach(t=>this.Hh(t))),this.Jh(),this.Kh()}}getActivatedIds(){return[...new Set([...this.Wh(),...this.yh])].filter(t=>!this.rd(t))}dispose(){var t,i,e;null==(t=this.kh)||t.call(this),this.kh=void 0,null==(i=this.uh)||i.call(this),this.uh=void 0,null==(e=this.$h)||e.dispose(),this.$h=void 0}reset(){this.yh=[],this.Zh().length>0&&this.Vh([]),this.Jh(),this.Kh()}getEventToItemsMap(){return this.bh}nd(){return this.$h}},xh=class extends wh{constructor(t){super(t)}Xh(){return Cr}Yh(){return Tr}Ch(){return Fr}Th(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Fr]:t})}Mh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Fr)}xh(t){var i,e;this.Ah(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return q(r)&&r>0}sd(){return No}Ah(t){var i;null==(i=this._instance)||i.getSurveys(t)}Hh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Lh(){return cl}Vh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Cr]:t})}td(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Tr]:t})}ed(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Tr)}rd(){return!1}Nh(t,i){var e;return this.Ah(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return el(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===No?"consume":"ignore":t===No?"persist":t===zo||t===Uo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Sh=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);L(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},kh=class{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==m?void 0:m.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new xh(this._instance)}},Eh=null!=o&&o.location?ao(o.location.hash,"__posthog")||ao(location.hash,"state"):null,$h="_postHogToolbarParams",Ph=Ce("[Toolbar]"),Ch=Ce("[FeatureFlags]"),Th=class{constructor(t,i){void 0===i&&(i=!1),this.od=!1,this.update(t,i)}update(t,i){this.ad=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:M(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.od||(Ch.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),L(t.flag_keys)||M(t.flag_keys)||Ch.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}},Fh=Ce("[FeatureFlags]"),Ah=Ce("[FeatureFlags]",{debugEnabled:!0}),Ih="\" failed. Feature flags didn't load in time.",Rh="connection_error",Oh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Mh=t=>{var i={};for(var e of ws(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Dh=t=>X(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),jh=Ce("[Error tracking]"),Bh="webkit-masked-url:",Lh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Bh],Nh=["__firefox__","__gCrWeb"],zh="Refusing to render web experiment since the viewer is a likely bot",Uh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>rl(i,t),not_regex:(t,i)=>!rl(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Hh=Ce("[Conversations]"),qh="Conversations not available yet.";function Vh(t,i){var e,s,n,o,a,h,u,d=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,v=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,f=L(c)?Math.max(v,2048):Math.max(v,c),p=r({},function(){var t="",i="";try{var e=null==l?void 0:l.userAgent;if(e){var s=ri(e);t=s[0],i=s[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(fe,t)?fe[t]:t}(t);return r({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==p?void 0:p["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(h=null==p?void 0:p["service.version"])&&void 0!==h?h:null==t?void 0:t.serviceVersion,environment:null!==(u=null==p?void 0:p["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:p,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:d,maxBufferSize:v,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Wh=["debug","log","warn","error","info"],Gh="console",Kh="__posthogHandledLogsRequestError",Jh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Kh]=!0,e},Yh=t=>!!t&&"object"==typeof t&&!0===t[Kh],Xh={featureFlags:class{constructor(t){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=Fh,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.Ve=()=>{var t=this.wd();this._d=0,t&&this.reloadFeatureFlags()},this.kd=()=>{var t,i=this.Sd;L(i)||this._n.remoteRequestsDisabled||!h||"hidden"===h.visibilityState||Date.now()-(null!==(t=this.xd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Cd())},this.Ze=()=>{"visible"===(null==h?void 0:h.visibilityState)&&this.kd()},"get"in t?this.Ds=t:(this._instance=t,this.Td=new Th(t.config,t.wa()),this.Ds=this.Td)}updateConfig(t,i){var e;null==(e=this.Td)||e.update(t,i),this.Us&&this.Md()}setup(t){return this.Hu=t,this.A=t.logger.createLogger("[FeatureFlags]"),ph(t.kv.initialize(),()=>{this.Hu===t&&(this.Hu=void 0,this.Us=t,this.Id(t))})}Id(t){var i;if(this.Us===t)return o&&Ps(o,"online",this.Ve),this.Md(),this.Ed=t.registerDynamicEventProperties(()=>this.Rd()?this.ud:this.hd),this.Ad=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Pd(),this.Fd(),this.Od()}),this.Fd(),this.initialize()}Md(){var t=this._n.refreshIntervalMs,i=!this._n.remoteRequestsDisabled&&h&&!L(t)&&t>0?t:void 0;i!==this.Sd&&(this.$d(),L(i)||(this.Sd=i,this.Cd(),null!=h&&h.addEventListener&&Ps(h,vs,this.Ze)))}Cd(){L(this.Sd)||(L(this.Dd)||clearInterval(this.Dd),this.xd=Date.now(),this.Dd=setInterval(this.kd,this.Sd))}$d(){L(this.Dd)||(clearInterval(this.Dd),this.Dd=void 0,null==h||null==h.removeEventListener||h.removeEventListener(vs,this.Ze)),this.Sd=void 0,this.xd=void 0}destroy(){this.Ld()}dispose(){this.Ld()}Ld(){var t,i;this.$d(),this.pd++,this.md=!1,this.Hu=void 0,this.Us&&(this.Nd(),null==(t=this.Ed)||t.dispose(),this.Ed=void 0,null==(i=this.Ad)||i.call(this),this.Ad=void 0,this.dd=[],null==o||o.removeEventListener("online",this.Ve),this.Us=void 0)}get _n(){return this.Ds.get()}qd(t){var i;return this.jd&&t in this.jd?this.jd[t]:null==(i=this.Us)?void 0:i.kv.get(t)}Pd(){return!!this.jd&&(this.jd=void 0,!0)}Bd(){var t;return!L(null==(t=this.Us)?void 0:t.kv.get("$enabled_feature_flags"))&&this.Pd()}ui(t){this.Hd(()=>{var i;return null==(i=this.Us)?void 0:i.kv.set(t)})}zd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t.$enabled_feature_flags){var s=this.qd("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter(t=>{var i=t[1];return!(null!=i&&i.failed)}).map(t=>t[0]):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!M(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.qd("$feature_flag_payloads")||{},d=t.$feature_flag_payloads||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p=!!c||v,g={[pr]:f,[fr]:f,[mr]:p};for(var _ of(t.$feature_flag_details&&(g[_r]=f),[br,zr,yr]))L(t[_])||(g[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}}hi(t){this.Hd(()=>{var i;return null==(i=this.Us)?void 0:i.kv.remove(t)})}Hd(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Fd(){var t={};for(var i of[pr,mr,br,wr]){var e=this.qd(i);L(e)||(t[i]=e)}this.ud=t;var s=r({},t),n=this.qd(fr);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.hd=s}Rd(){var t=this._n.cacheTtlMs;if(!t||0>=t)return!1;var i=this.qd(zr);return"number"!=typeof i||Date.now()-i>t}Ud(){return!!this.Rd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Wd(){var t=this._n.evaluationContexts;return null!=t&&t.length?t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Vd(){var t=this._n.flagKeys;if(!L(t))return t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i,e=this._n,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter(t=>!L(r[t])).reduce((t,i)=>(t[i]=r[i],t),{}),l=Object.keys(o).filter(t=>a[t]).reduce((t,i)=>(t[i]=o[i],t),{});return this.Gd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n,o=null!=e&&e.merge&&null!==(s=this.qd("$enabled_feature_flags"))&&void 0!==s?s:{},a=null!=e&&e.merge&&null!==(n=this.qd("$feature_flag_payloads"))&&void 0!==n?n:{},l=r({},o,t),h=r({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Xi(c),variant:Zi(c),reason:void 0,metadata:L(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Gd({flags:u})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.qd(_r),i=this.qd(wr),e=this.qd(xr);if(!e&&!i)return t||{};var s=ys({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=s[n],h=null==i?void 0:i[n],u=L(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=L(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=r({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=r({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),s[n]=c}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Xi(r),variant:Zi(r),payload:Yi(i[e])}})}getFlagVariants(){var t=this.qd(fr),i=this.qd(wr);if(!i)return t||{};for(var e=ys({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ld=!0),e}getFlagPayloads(){var t=this.qd(mr),i=this.qd(xr);if(!i)return t||{};for(var e=ys({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ld=!0),e}reloadFeatureFlags(){this.gd||this._n.featureFlagsDisabled||this.wd()||(this.fd&&(this.md=!0),this.Zd||(this.dd.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.Zd=setTimeout(()=>{this.Jd()},5)))}Nd(){clearTimeout(this.Zd),this.Zd=void 0}onReloading(t){return this.dd.push(t),()=>{this.dd=this.dd.filter(i=>i!==t)}}ensureFlagsLoaded(){this.vd||this.fd||this.Zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.gd=t}resetFlagCallReported(){this.hi(Br)}Jd(t){this.Nd();var i=this.Us;if(i&&!this._n.remoteRequestsDisabled&&!this.wd())if(this.fd)this.md=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:r({},i.initialPersonProperties,this.qd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.qd(kr),timezone:So()};L(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this._n.featureFlagsDisabled)&&(e.disable_flags=!0);var s=this.Wd();s.length&&(e.evaluation_contexts=s);var n=this.Vd();L(n)||(e.flag_keys=n);var o=this._n.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.pd;this.fd=!0;var h=()=>{this.md&&(this.md=!1,this.Jd())},u=t=>{this.fd=!1,l===this.pd?(this.ui({[Nr]:[Rh]}),this.A.error("Feature flag request failed",t),this.Bd()&&this.Od(!0),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:e,compression:this._n.compression,sentAt:"body",timeoutMs:this._n.requestTimeoutMs}).then(t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.fd=!1,l===this.pd){if(this.Qd(t.statusCode),n||this.md||(this.$anon_distinct_id=void 0),!e.disable_flags||this.md){this.yd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Rh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));u&&a.push("quota_limited"),this.ui({[Nr]:a}),u?this.A.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."):e.disable_flags||this.Gd(s,n,{partialResponse:o}),h()}}else h()}).catch(u)}catch(t){u(t)}}}wd(){return lo(this._d,3)}Qd(t){this._d=ho(t,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+Ih)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i;return null==(i=this.getFeatureFlagResult(t,{send_event:!1}))?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.yd)if(this.vd||this.getFlags()&&this.getFlags().length>0){if(!this.Ud()){var e,s=this.getFlagVariants(),n=t in s,o=s[t],a=this.getFlagPayloads()[t],l=String(o),h=this.qd("$feature_flag_request_id")||void 0,u=this.qd("$feature_flag_evaluated_at")||void 0,d=this.qd("$flag_call_reported")||{};if(this._n.deduplicateCallsPerSession){var v,c=null==(v=this.Us)?void 0:v.session.sessionId,f=this.qd(Lr);c&&c!==f&&(d={},e=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))e&&this.ui({[Br]:d,[Lr]:e});else{var p,g,_,m,b,y,w,x,S,k,E,P,C;M(d[t])?d[t].push(l):d[t]=[l],this.ui(r({[Br]:d},e?{[Lr]:e}:{}));var T=this.getFeatureFlagDetails(t),F=[...null!==(p=this.qd("$feature_flag_errors"))&&void 0!==p?p:[]];L(o)&&F.push("flag_missing");var A={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(g=null==(_=this._n.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this._n.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.yd};L(null==T||null==(y=T.metadata)?void 0:y.has_experiment)||(A.$feature_flag_has_experiment=T.metadata.has_experiment),L(null==T||null==(w=T.metadata)?void 0:w.version)||(A.$feature_flag_version=T.metadata.version);var I=null!==(x=null==T||null==(S=T.reason)?void 0:S.description)&&void 0!==x?x:null==T||null==(k=T.reason)?void 0:k.code;I&&(A.$feature_flag_reason=I),null!=T&&null!=(E=T.metadata)&&E.id&&(A.$feature_flag_id=T.metadata.id),L(null==T?void 0:T.original_variant)&&L(null==T?void 0:T.original_enabled)||(A.$feature_flag_original_response=L(T.original_variant)?T.original_enabled:T.original_variant),null!=T&&null!=(P=T.metadata)&&P.original_payload&&(A.$feature_flag_original_payload=null==T||null==(C=T.metadata)?void 0:C.original_payload),F.length&&(A.$feature_flag_error=F.join(",")),this.Kd(A)}else e&&this.ui({[Br]:d,[Lr]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Yi(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Ih)}Kd(t){try{var i;null==(i=this.Us)||i.capture("$feature_flag_called",t).catch(t=>{this.A.error("Failed to capture feature flag call",t)})}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Xd(t,i)}Xd(t,i){var e=this;return n(function*(){var r=e.Us;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.Wd();n.length&&(s.evaluation_contexts=n);var o,a=e.Vd();L(a)||(s.flag_keys=a);try{var l;o=(null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:e._n.compression,sentAt:"body",timeoutMs:e._n.requestTimeoutMs})).json)||null==(l=l.featureFlagPayloads)?void 0:l[t])||void 0}catch(t){return void e.A.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){e.A.error("Remote config feature flag callback failed",t)}}})()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.yd)return i.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+Ih),i.defaultValue;var e=this.getFeatureFlag(t,i);return L(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(i=>i!==t)}receivedFeatureFlags(t,i,e){this.Gd(t,i,e)}Gd(t,i,e){if(this.Us){this.vd=!0;var s=function(t,i,e,s,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===s&&(s={}),void 0===o&&(o=Fh);var a=((t,i)=>{var e=t.flags;return e?r({},t,{featureFlags:Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!L(null==(i=e[t].metadata)?void 0:i.payload)}).map(t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]}))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(M(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[pr]:h,[fr]:c,[yr]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=g||{};p=r({},i,p),g=r({},e,b),m.forEach(t=>{var i;t in b||null==(i=g)||delete i[t]}),_=r({},s,_)}else if(t.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));p=r({},i,Object.fromEntries(Object.entries(p).filter(t=>y.has(t[0]))));var w=Object.fromEntries(Object.entries(g||{}).filter(t=>y.has(t[0])));g=r({},e,w),y.forEach(t=>{var i;t in w||null==(i=g)||delete i[t]}),_=r({},s,Object.fromEntries(Object.entries(_||{}).filter(t=>y.has(t[0]))))}else p=r({},i,p),g=r({},e,g),_=r({},s,_);return r({[pr]:Object.keys(Mh(p)),[fr]:p||{},[mr]:g||{},[_r]:_||{},[yr]:!0===t.minimalFlagCalledEvents},d?{[br]:d}:{},v?{[zr]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(s)if(!1===(null==e?void 0:e.persist)){var n=!L(this.Us.kv.get(fr));this.jd=s,n||this.ui(s)}else this.Pd(),this.zd(s,t,!(null==e||!e.partialResponse)),this.ui(s);else i&&this.Bd();i||(this.bd=!1),this.Od(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Yd(t)}Yd(t){if(this.Us){if(!1===t)return this.hi([wr,xr]),this.Od(),void Ah.info("All overrides cleared");if(M(t))return this.ui({[wr]:Oh(t)}),this.Od(),void Ah.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ld=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[wr]=M(s)?Oh(s):s),n&&(r[xr]=n),Object.keys(r).length&&this.ui(r),!1===s&&!1===n?this.hi([wr,xr]):!1===s?this.hi(wr):!1===n&&this.hi(xr),this.Od(),!1===s?Ah.info("Flag overrides cleared"):s&&Ah.info("Flag overrides set",{flags:s}),void(!1===n?Ah.info("Payload overrides cleared"):n&&Ah.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ui({[wr]:t}),this.Od(),void Ah.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.vd){var i=this.tv(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s,n=(this.qd("$early_access_features")||[]).find(i=>i.flagKey===t),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),e&&(a.$feature_enrollment_stage=e);var l=r({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[pr]:[t],[fr]:[t],[Sr]:Object.keys(o)}),this.ui({[pr]:Object.keys(Mh(l)),[fr]:l,[Sr]:r({},this.qd("$stored_person_properties")||{},o)}),this.Od();try{var h;null==(h=this.Us)||h.capture("$feature_enrollment_update",a).catch(t=>{this.A.error("Failed to capture early access feature enrollment",t)})}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.qd(gr);!r||i?this.ev(t,e):t(r)}ev(t,i){var e=this;return n(function*(){var r=e.Us;if(r){var s,n=i?"&"+i.map(t=>"stage="+t).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;s=o.json.earlyAccessFeatures,e.ui({[gr]:s})}catch(t){return void e.A.error("Early access feature request failed",t)}try{t(s)}catch(t){e.A.error("Early access feature callback failed",t)}}})()}tv(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}Od(t){this.Fd();var i=this.tv(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.iv(t,i)}iv(t,i){void 0===i&&(i=!0);var e=this.qd("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in e||(o[a]=n[a]));this.ui({[Sr]:r({},e,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=r({},this.qd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.ui({[Sr]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.hi(Sr),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.qd("$stored_group_properties")||{},s=r({},e);for(var n of Object.keys(t))s[n]=r({},e[n],t[n]);this.ui({[kr]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.qd("$stored_group_properties")||{};this.ui({[kr]:r({},i,{[t]:{}})})}else this.hi(kr)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.jd=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Nd(),this.ld=!1,this._d=0}}},Zh={sessionRecording:class{get _n(){return this._instance.config}get Ga(){return this._instance.persistence}get started(){var t;return!(null==(t=this.rv)||!t.isStarted)}get status(){var t,i;return"awaiting_config"===this.nv||"missing_config"===this.nv?this.nv:null!==(t=null==(i=this.rv)?void 0:i.status)&&void 0!==t?t:this.nv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.nv=oh,this.sv=void 0,this.ov=!1,this.je=(()=>{var t;if(null==h||!h.visibilityState||"visible"===h.visibilityState)return!0;var i=null==o||null==(t=o.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.Ze=()=>{var t;"visible"===(null==h?void 0:h.visibilityState)&&(this.je=!0,null==(t=this.rv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw lh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._n.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=h&&h.addEventListener&&Ps(h,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.ov=!0,null==h||null==h.removeEventListener||h.removeEventListener("visibilitychange",this.Ze),e?this.av(!0):this.stopRecording()}get lv(){var t,i=!(null==(t=this._instance.get_property(tr))||!t.enabled),e=!this._n.disable_session_recording,r=this._n.disable_session_recording||this._instance.consent.isOptedOut();return o&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.ov||this.lv&&null!=(i=this.rv)&&i.isStarted)){var e=!L(Object.assign)&&!L(Array.from);this.lv&&e?(this.uv(t),lh.info("starting")):(this.nv=oh,this.stopRecording())}}uv(t){var i,e;if(this.lv)if("awaiting_config"!==this.nv&&"missing_config"!==this.nv&&(this.nv=ah),null!=m&&null!=(i=m.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=m.__PosthogExtensions__)&&e.initSessionRecording)this.hv(t);else{var r,s=this._instance.sessionManager;null==(r=m.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.dv,i=>{if(!this.ov&&this.lv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[Qr]:!0}),lh.error("could not load recorder",i)):void this.hv(t);this.nv=oh})}}stopRecording(){var t,i;null==(t=this.sv)||t.call(this),this.sv=void 0,null==(i=this.rv)||i.stop()}av(t){var i,e;void 0===t&&(t=!1),null==(i=this.sv)||i.call(this),this.sv=void 0,null==(e=this.rv)||e.discard({discardProducerEvents:t})}vv(){var t,i;null==(t=this.Ga)||t.unregister(lr),null==(i=this.Ga)||i.unregister(er)}fv(t,i){if(H(t))return null;var e,r=q(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(lh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}pv(t){if(this.Ga){var i,e,s=this.Ga,n=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.fv(null==(i=this._n.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.fv(null==e?void 0:e.sampleRate,"remote config sampleRate"),a=null!=n?n:o;H(a)&&this.vv();var l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[tr]:r({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:r({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:a,minimumDurationMilliseconds:L(l)?null:l,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};n(),null==(i=this.sv)||i.call(this),this.sv=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.pv(i),void this.av()):(this.pv(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.nv&&(this.nv="missing_config",lh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.rv)&&e.log?this.rv.log(t,i):lh.warn("log called before recorder was ready")}get dv(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property("$session_recording_remote_config"))||null==(t=t.scriptConfig)?void 0:t.script)||"lazy-recorder"}gv(){var t,i=this._instance.get_property(tr);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return lh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!H(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}hv(t){var i,e,r;if(!this.ov&&this.lv&&this._instance.sessionManager){if(null==(i=m.__PosthogExtensions__)||!i.initSessionRecording)return lh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Qr]:!0});var s;if(this.rv||(this.rv=null==(s=m.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.je),this.rv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.gv()){if("missing_config"===this.nv||"awaiting_config"===this.nv)return;return this.nv="awaiting_config",lh.info("persisted remote config is stale, requesting fresh config before starting"),void new Jo(this._instance).load()}this.nv=ah,null==(e=(r=this.rv).setDocumentWasEverVisible)||e.call(r,this.je),this.rv.start(t)}else this.nv=oh}onRRwebEmit(t){var i;null==(i=this.rv)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.rv||null==(t=this.Ga)||t.register({[sr]:!0}),null==(i=this.rv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.rv||null==(t=this.Ga)||t.register({[rr]:!0}),null==(i=this.rv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.rv||null==(i=this.Ga)||i.register({["url"===t?nr:or]:!0}),null==(e=this.rv)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.rv)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.rv)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.rv)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},Qh={autocapture:class extends Kl{constructor(t){super(new Jl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.mv=this.yv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.bv();return!!(t.path||t.search||this._v(t))}startIfEnabled(){this.isEnabled&&(Pe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.mv=this.yv(),this.startIfEnabled()}stop(){this.wv&&this.wv(),this.wv=void 0,this.Sv&&this.Sv(),this.Sv=void 0,Pe.info("History API monitoring stopped")}monitorHistoryChanges(){o&&o.history&&(this.xv("pushState"),this.xv("replaceState"),this.Cv(),this._v()&&this.Tv())}xv(t){var i;if(o&&(null==(i=o.history[t])||!i.__posthog_wrapped__)){var e=this;Ql(o.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Mv(t)})}}yv(){var t=null==o?void 0:o.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}bv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:j(t)?t:{}}_v(t){return void 0===t&&(t=this.bv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Iv(t){var i=this.bv(),e=this.mv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this._v(i)&&t.hash!==e.hash))}Mv(t){try{var i=this.yv();if(!i)return;this.Iv(i)&&this._instance.capture(fs,{navigation_type:t}),this.mv=i}catch(i){Pe.error("Error capturing "+t+" pageview",i)}}Cv(){if(!this.wv){var t=()=>{this.Mv("popstate")};Ps(o,"popstate",t),this.wv=()=>{o&&o.removeEventListener("popstate",t)}}}Tv(){if(!this.Sv){var t=()=>{this.Mv("hashchange")};Ps(o,"hashchange",t),this.Sv=()=>{o&&o.removeEventListener("hashchange",t)}}}},heatmaps:class{get _n(){return this.instance.config}constructor(t){var i;this.Ev=!1,this.Ls=!1,this.Rv=null,this.instance=t,this.Ev=!(null==(i=this.instance.persistence)||!i.props[Ve]),this.rageclicks=new Ul(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return j(this._n.capture_heatmaps)&&this._n.capture_heatmaps.flush_interval_milliseconds&&(t=this._n.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return H(this._n.capture_heatmaps)?H(this._n.enable_heatmaps)?this.Ev:this._n.enable_heatmaps:!1!==this._n.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ls)return;hh.info("starting..."),this.Av(),this.Ze()}else{var t;clearInterval(null!==(t=this.Rv)&&void 0!==t?t:void 0),this.Pv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ve]:e}),this.Ev=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Pe;return this.Pe=void 0,t}Fv(t){uh(t.originalEvent)&&this.an(t.originalEvent,"deadclick")}Ze(){this.Rv&&clearInterval(this.Rv),this.Rv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(h)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}Av(){o&&h&&(this.Ov=this.La.bind(this),Ps(o,cs,this.Ov),this.$v=t=>this.an(t||(null==o?void 0:o.event)),Ps(h,"click",this.$v,{capture:!0}),this.Dv=t=>this.Lv(t||(null==o?void 0:o.event)),Ps(h,"mousemove",this.Dv,{capture:!0}),this.Nv=new Wn(this.instance,qn,this.Fv.bind(this)),this.Nv.startIfEnabledOrStop(),this.qv=this.Ze.bind(this),Ps(h,vs,this.qv),this.Ls=!0)}Pv(){var t;o&&h&&(this.Ov&&o.removeEventListener(cs,this.Ov),this.$v&&h.removeEventListener("click",this.$v,{capture:!0}),this.Dv&&h.removeEventListener("mousemove",this.Dv,{capture:!0}),this.qv&&h.removeEventListener(vs,this.qv),clearTimeout(this.jv),null==(t=this.Nv)||t.stop(),this.Ls=!1)}Bv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&an(r)&&!ln(r,"body");){if(r===e)return!1;var s=void 0;try{var n,a,l;s=null==(n=null!==(a=null==(l=r.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:o)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(S(i,s))return!0;r=bn(r)}return!1}(gn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}an(t,i){var e;if(void 0===i&&(i="click"),!on(t.target)&&uh(t)){var s=this.Bv(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&$n(gn(t),this.instance.config.rageclick)&&this.Is(r({},s,{type:"rageclick"})),this.Is(s)}}Lv(t){!on(t.target)&&uh(t)&&(clearTimeout(this.jv),this.jv=setTimeout(()=>{this.Is(this.Bv(t,"mousemove"))},500))}Is(t){if(o){var i=this._n.disable_capture_url_hashes?gi(o.location.href):o.location.href,e=this._n.custom_personal_data_properties,r=oo(i,this._n.mask_personal_data_properties?[...uo,...e||[]]:[],co);this.Pe=this.Pe||{},this.Pe[r]||(this.Pe[r]=[]),this.Pe[r].push(t)}}La(){this.Pe&&!B(this.Pe)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Wn,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.Ev=!1,this.Ls=!1,this.Pe={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hv=()=>{clearTimeout(this.zv),this.zv=void 0,0!==this.Pe.metrics.length&&(this._instance.capture("$web_vitals",r({$current_url:this.Pe.url},this.Pe.metrics.reduce((t,i)=>r({},t,{["$web_vitals_"+i.name+"_event"]:r({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.Pe={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uv=t=>{var i;if(this.Pe=this.Pe||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},H(null==t?void 0:t.name)||H(null==t?void 0:t.value))ih.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Wv(e);if(!L(s)){var n=q(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Vv||this.Vv>t.value){this.Pe.navigationKey!==n&&(this.Hv(),this.zv=setTimeout(this.Hv,this.flushToCaptureTimeoutMs)),L(this.Pe.navigationKey)&&(this.Pe.navigationKey=n,this.Pe.url=s),this.Pe.firstMetricTimestamp=L(this.Pe.firstMetricTimestamp)?Date.now():this.Pe.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=r({},t,e?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,j(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of nh){var u="url"===h&&"string"==typeof t.attribution[h]?this.Wv(t.attribution[h]):t.attribution[h];L(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;L(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Pe.metrics.push(a),this.Pe.metrics.length===this.allowedMetrics.length&&this.Hv()}else ih.error("Ignoring metric with value >= "+this.Vv,t)}}},this.Gv=()=>{if(!this.Ls){var t,i,e,s,n=!1,o=m.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.Zv])||("web-vitals"===this.Zv&&L(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!L(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!L(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,e=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?r({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Uv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&s(this.Uv.bind(this),v),this.Ls=!0}else ih.error("web vitals callbacks not loaded - not starting")}},this.Ev=!(null==(i=this._instance.persistence)||!i.props[Je]),this.startIfEnabled()}get Jv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=j(this.Jv)?null==(t=this.Jv)?void 0:t.web_vitals_allowed_metrics:void 0;return H(e)?(null==(i=this._instance.persistence)?void 0:i.props.$web_vitals_allowed_metrics)||rh:e}get flushToCaptureTimeoutMs(){return(j(this.Jv)?this.Jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=j(this.Jv)?this.Jv.web_vitals_attribution:void 0;return W(t)?t?rh:[]:M(t)?t:sh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=j(this.Jv)?this.Jv.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get Vv(){var t=j(this.Jv)&&q(this.Jv.__web_vitals_max_value)?this.Jv.__web_vitals_max_value:eh;return t>0&&6e4>=t?eh:t}get isEnabled(){var t=null==u?void 0:u.protocol;if("http:"!==t&&"https:"!==t)return ih.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=j(this.Jv)?this.Jv.web_vitals:W(this.Jv)?this.Jv:void 0;return W(i)?i:this.Ev}startIfEnabled(){this.isEnabled&&!this.Ls&&(ih.info("enabled, starting..."),this.so(this.Gv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=j(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=j(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Je]:e}),this._instance.persistence.register({[Qe]:r})),this.Ev=e,this.startIfEnabled()}}}get Zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}so(t){var i=m.__PosthogExtensions__,e=this.Zv,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&L(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?ih.error("failed to load script",i):t()})}Wv(t){var i=t||(null==o?void 0:o.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?gi(i):i,r=this._instance.config.custom_personal_data_properties;return oo(e,this._instance.config.mask_personal_data_properties?[...uo,...r||[]]:[],co)}ih.error("Could not determine current URL")}}},tu={exceptionObserver:class{constructor(t){var i;this.Gv=()=>{var t;if(o&&this.isEnabled&&null!=(t=m.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=m.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=m.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=m.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this._n.capture_unhandled_errors&&(this.Qv=i(this.captureException.bind(this))),!this.Kv&&this._n.capture_unhandled_rejections&&(this.Kv=e(this.captureException.bind(this))),!this.Xv&&this._n.capture_console_errors&&(this.Xv=r(this.captureException.bind(this)))}catch(t){Yl.error("failed to start",t),this.Yv()}}},this._instance=t,this.tc=!(null==(i=this._instance.persistence)||!i.props[We]),this.wt=new st(r({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:Yl})),this._n=this.ec(),this.startIfEnabledOrStop()}ec(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return j(t)?i=r({},i,t):(L(t)?this.tc:t)&&(i=r({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this._n.capture_console_errors||this._n.capture_unhandled_errors||this._n.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Yl.info("enabled"),this.Yv(),this.so(this.Gv)):this.Yv()}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return Yl.error("failed to load script",i);t()})}Yv(){var t,i,e;null==(t=this.Qv)||t.call(this),this.Qv=void 0,null==(i=this.Kv)||i.call(this),this.Kv=void 0,null==(e=this.Xv)||e.call(this),this.Xv=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.tc=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[We]:this.tc}),this._n=this.ec(),this.startIfEnabledOrStop())}}onConfigChange(){this._n=this.ec()}captureException(t){try{var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";if(this.wt.consumeRateLimit(s))return void Yl.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.rc=[],this.nc=new wi([new Ii,new Ui,new Oi,new Ri,new Ni,new Li,new Di,new zi],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Ai.test(l)?l.replace(Ai,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of e){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return r({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Pi,Fi)),this._instance=t,this.rc=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.sc=Gi(this.oc()),this.ac=new Ki(this.sc)}onConfigChange(){this.sc=Gi(this.oc()),this.ac.setConfig(this.sc)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.rc=n,this._instance.persistence&&this._instance.persistence.register({[Ge]:this.rc,[Ke]:o})}}}get lc(){var t,i,e=!!this._instance.get_property(Ke);return null!==(t=null!==(i=this._instance.config.error_tracking.captureExtensionExceptions)&&void 0!==i?i:e)&&void 0!==t&&t}buildProperties(t,i){return this.nc.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.sc.enabled)try{if(!N(t)||0===t.trim().length)return void jh.warn("Ignoring exception step because message must be a non-empty string");var e=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce((e,r)=>Vi.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.uc(i)),s=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&jh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ac.add(r({[Hi]:t,[qi]:(new Date).toISOString()},s))}catch(t){jh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.hc(i)){if(this.dc(i))return this.vc("Exception dropped: matched a suppression rule"),void jh.info("Skipping exception capture because a suppression rule matched");if(!this.lc&&this.cc(i))return this.vc("Exception dropped: thrown by a browser extension"),void jh.info("Skipping exception capture because it was thrown by an extension");if(!this.lc&&this.fc(i))return this.vc("Exception dropped: thrown by an injected browser script"),void jh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.gc(i))return this.vc("Exception dropped: thrown by the PostHog SDK"),void jh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.sc.enabled&&H(t.$exception_steps)?this.mc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",ku:!0});return s&&this.ac.clear(),s}catch(t){return Dh(t)||jh.error("Failed to capture exception event. Dropping this exception.",t),void this.ac.clear()}}catch(t){return void(Dh(t)||jh.error("Failed to process exception event. Ignoring this exception.",t))}var n}mc(t){try{var i=this.ac.getAttachable();return 0===i.length?t:r({},t,{$exception_steps:i})}catch(i){return jh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}vc(t){this.sc.enabled&&this.ac.add({[Hi]:t,[qi]:(new Date).toISOString()})}uc(t){return j(t)?r({},t):{}}oc(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}dc(t){if(0===t.length)return!1;try{var i=t.reduce((t,i)=>{var e=i.type,r=i.value;return N(e)&&e.length>0&&t.$exception_types.push(e),N(r)&&r.length>0&&t.$exception_values.push(r),t},{$exception_types:[],$exception_values:[]});return this.rc.some(t=>{var e=t.values.map(t=>{var e=nl[t.operator],r=i[t.key];if(!e||!r)return!1;var s=M(t.value)?t.value:[t.value];return s.length>0&&e(s,r)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return jh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}cc(t){var i=t.flatMap(t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(t=>{var i=t.filename;return!!i&&Lh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Bh)})||t.some(t=>{var i=t.value;return N(i)&&i.includes("isolatedAPI.contexts.topHostname")})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Bh))}))}fc(t){return t.some(t=>{var i=t.value;return N(i)&&Nh.some(t=>i.includes(t))})}gc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[];return null!==(r=null==(s=n[n.length-1])||null==(s=s.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}hc(t){return!H(t)&&M(t)}}},iu=r({productTours:class{get Ga(){return this._instance.persistence}constructor(t){this.yc=null,this.bc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.Ga&&this.Ga.register({[Xe]:!!i.productTours}),!vh(this._instance))return!this.yc&&H(null==(e=this.Ga)?void 0:e.props.ph_product_tours)||dh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.yc)||r.stop(),this.yc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.yc&&vh(this._instance)&&this.so(()=>this._c())}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?dh.error("Could not load product tours script",i):t()})}_c(){var t;!this.yc&&null!=(t=m.__PosthogExtensions__)&&t.generateProductTours&&(this.yc=m.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!M(this.bc)||i){var e=this.Ga;if(e){var r=e.props[Ar];if(M(r)&&!i)return this.bc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(vh(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||dh.warn(s):dh.error(s),void t([],{isLoaded:!1,error:s})}var n=M(i.json.product_tours)?i.json.product_tours:[];this.bc=n,e&&e.register({[Ar]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.bc,{isLoaded:!0})}getActiveProductTours(t){H(this.yc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.yc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.yc)||i.showTourById(t)}previewTour(t){this.yc?this.yc.previewTour(t):this.so(()=>{var i;this._c(),null==(i=this.yc)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.yc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.yc)||t.nextStep()}previousStep(){var t;null==(t=this.yc)||t.previousStep()}clearCache(){var t;this.bc=null,null==(t=this.Ga)||t.unregister(Ar)}resetTour(t){var i;null==(i=this.yc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.yc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.yc)||i.cancelPendingTour(t)}}},Xh),eu={siteApps:class{constructor(t){this._instance=t,this.wc=0,this.kc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Sc(t,i){if(i){var e=this.globalsForEvent(i);this.kc.push(e),this.kc.length>1e3&&(this.kc=this.kc.slice(10))}}get siteAppLoaders(){var t;return null==(t=m._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Sc.bind(this));this.xc=()=>{t(),this.kc=[],this.xc=void 0}}}globalsForEvent(t){var s,n,o,a,l,h,u;if(!t)throw new Error("Event payload is required");var d={},v=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(c)){var p=f[0];d[p]={id:v[p],type:p,properties:f[1]}}var g=t.$set_once,_=t.$set;return{event:r({},e(t,i),{properties:r({},t.properties,_?{$set:r({},null!==(s=null==(n=t.properties)?void 0:n.$set)&&void 0!==s?s:{},_)}:{},g?{$set_once:r({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},g)}:{}),elements_chain:null!==(l=null==(h=t.properties)?void 0:h.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:d}}Cc(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(ch.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(ch.error("prepare_external_dependency_script returned null"),null):t}Tc(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==h?void 0:h.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.wc++,this.Mc)return this.Ic();var d=[],v=this,c=new WeakSet,f=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),d.push(()=>{t[i]=r})}},p=t=>{if(c.has(t))return t;var i=v.Cc(t);return i&&c.add(i),i},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!U(t));return f(u,"appendChild",t=>function(i){var e=p(i);return e?t.call(this,e):i}),f(u,"insertBefore",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):i}),f(u,"replaceChild",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):e}),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach(t=>{f(t,"append",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}),f(t,"prepend",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(t=>{f(t,"before",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}),f(t,"after",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=g(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),f(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){var r=p(e);return r?t.call(this,i,r):null}),this.Mc=()=>{d.forEach(t=>t()),this.Mc=void 0},this.Ic()}Ic(){var t=!1;return()=>{var i;t||(t=!0,this.wc--,0===this.wc&&(null==(i=this.Mc)||i.call(this)))}}Ec(t,i){void 0===i&&(i=!0);var e=this.Tc();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.kc.length&&(ch.info("Processing "+this.kc.length+" events for site app with id "+t.id),this.kc.forEach(t=>this.Ec(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.xc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,ch.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.Ec(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){ch.error(fh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){ch.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Rc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}Ac(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.Ec(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){ch.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.Rc(),void this._instance.on("eventCaptured",t=>this.Ac(t))):void ch.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.xc)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;m["__$$ph_site_app_"+i]=s._instance,null==(t=m.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return ch.error(fh+i,t)})};for(var a of n.siteApps)o()}else ch.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},ru={tracingHeaders:class{constructor(t){this._instance=t,this.Pc=void 0,this.Fc=void 0,this.Oc=void 0,this.Gv=()=>{var t,i,e=this.$c();e?(L(this.Pc)&&(this.Pc=null==(t=m.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),L(this.Fc)&&(this.Fc=null==(i=m.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Yv()}}initialize(){this.startIfEnabledOrStop()}so(t){var i,e;null!=(i=m.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=m.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return th.error("failed to load script",i);t()})}Dc(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}$c(){var t=this.Dc();return M(t)?(M(this.Oc)?this.Oc.splice(0,this.Oc.length,...t):this.Oc=[...t],t.length>0?this.Oc:void 0):(M(this.Oc)&&this.Oc.splice(0),this.Oc=t||void 0,this.Oc)}Yv(){var t,i;null==(t=this.Pc)||t.call(this),null==(i=this.Fc)||i.call(this),this.Pc=void 0,this.Fc=void 0}startIfEnabledOrStop(){this.$c()?this.so(this.Gv):this.Yv()}}},su=r({surveys:class extends mh{constructor(t){var i;super(new kh(t),(i=t,{get projectToken(){return i.config.token},kv:new Sh(i)})),this._instance=t}Gu(t,i){var e=i.query?Ra(t,i.query):t;return new Promise(t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},Xh),nu={toolbar:class{constructor(t){this.instance=t}Lc(t){m.ph_toolbar_state=t}Nc(){var t;return null!==(t=m.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),Cs(this.instance.config))return!1;if(!o||!h)return!1;t=null!=t?t:o.location,e=null!=e?e:o.history;try{if(!i){try{o.localStorage.setItem("test","test"),o.localStorage.removeItem("test")}catch(t){return!1}i=null==o?void 0:o.localStorage}var r,s=Eh||ao(t.hash,"__posthog")||ao(t.hash,"state"),n=s?xs(()=>JSON.parse(atob(decodeURIComponent(s))))||xs(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem($h)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}qc(t){var i=m.ph_load_toolbar||m.ph_load_editor;!H(i)&&D(i)?i(t,this.instance):Ph.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==h||!h.getElementById("__POSTHOG_TOOLBAR__"));if(!o||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=r({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(o.localStorage.setItem($h,JSON.stringify(r({},s,{source:void 0}))),2===this.Nc())this.qc(s);else if(0===this.Nc()){var n;this.Lc(1),null==(n=m.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return Ph.error("[Toolbar] Failed to load",t),void this.Lc(0);this.Lc(2),this.qc(s)}),Ps(o,"turbolinks:load",()=>{this.Lc(0),this.loadToolbar(s)})}return!0}jc(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},ou=r({experiments:class t{get _n(){return this._instance.config}constructor(i){var e=this;this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=function(i){void 0===i&&(i=!1),e.getWebExperiments(i=>{t.Bc("retrieved web experiments from the server"),e.Hc=new Map,i.forEach(i=>{if(i.feature_flag_key){var r;e.Hc&&(t.Bc("setting flag key ",i.feature_flag_key," to web experiment ",i),null==(r=e.Hc)||r.set(i.feature_flag_key,i));var s=e._instance.getFeatureFlag(i.feature_flag_key);N(s)&&i.variants[s]&&e.zc(i.name,s,i.variants[s].transforms)}else if(i.variants)for(var n in i.variants){var o=i.variants[n];t.Uc(o,e._instance)&&e.zc(i.name,n,o.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.Bc(zh);else if(!this._n.disable_web_experiments){if(H(this.Hc))return this.Hc=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Bc("applying feature flags",i),i.forEach(t=>{var i;if(this.Hc&&null!=(i=this.Hc)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Hc)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.zc(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var i=t.getWindowLocation();if(null!=i&&i.search){var e=no(null==i?void 0:i.search,"__experiment_id"),r=no(null==i?void 0:i.search,"__experiment_variant");e&&r&&(t.Bc("previewing web experiments "+e+" && "+r),this.getWebExperiments(t=>{this.Wc(parseInt(e),r,t)},!1,!0))}}loadIfEnabled(){this._n.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._n.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._n.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Wc(i,e,r){var s=r.filter(t=>t.id===i);s&&s.length>0&&(t.Bc("Previewing web experiment ["+s[0].name+"] with variant ["+e+"]"),this.zc(s[0].name,e,s[0].variants[e].transforms))}static Uc(i,e){return!H(i.conditions)&&t.Vc(i,e)&&t.Gc(i)}static Vc(i,e){var r;if(H(i.conditions)||H(null==(r=i.conditions)?void 0:r.url))return!0;var s=t.getWindowLocation();if(s){var n,o,a,l=nn(e,s.href);return null==(n=i.conditions)||!n.url||Uh[null!==(o=null==(a=i.conditions)?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,l)}return!1}static getWindowLocation(){return null==o?void 0:o.location}static Gc(t){var i;if(H(t.conditions)||H(null==(i=t.conditions)?void 0:i.utm))return!0;var e=po();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Bc(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Pe.info("[WebExperiments] "+t,e)}zc(i,e,r){this._is_bot()?t.Bc(zh):"control"!==e?r.forEach(r=>{var s;r.selector&&(t.Bc("applying transform of variant "+e+" for experiment "+i+" ",r),null==(s=document)||null==(s=s.querySelectorAll(r.selector))||s.forEach(t=>{var i=t;r.html&&(i.innerHTML=r.html),r.css&&i.setAttribute("style",r.css)}))}):t.Bc("Control variants leave the page unmodified.")}_is_bot(){return l&&this._instance?Qa(l,this._n.custom_blocked_useragents):void 0}}},Xh),au=r({},Xh,Zh,Qh,tu,iu,eu,su,ru,nu,ou,{conversations:class{constructor(t){this._instance=t,this.Zc=void 0,this._conversationsManager=null,this.Jc=!1,this.zt=null,this.Qc=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Kc=t.ok,t.ok)){var i=t.config.conversations;H(i)||(W(i)?this.Zc=i:(this.Zc=i.enabled,this.zt=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Zc=void 0,this.zt=null,this.Kc=void 0,this.Qc=!1}loadIfEnabled(){if(!(this._conversationsManager||this.Jc||this._instance.config.disable_conversations||Cs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==m?void 0:m.__PosthogExtensions__;if(t&&!L(this.Zc)&&this.Zc)if(this.zt&&this.zt.token){this.Jc=!0;try{var i=t.initConversations;if(i)return this.Xc(i),void(this.Jc=!1);var e=t.loadExternalDependency;if(!e)return void this.Yc(ls);e(this._instance,"conversations",i=>{i||!t.initConversations?this.Yc("Could not load conversations script",i):this.Xc(t.initConversations),this.Jc=!1})}catch(t){this.Yc("Error initializing conversations",t),this.Jc=!1}}else Hh.error("Conversations enabled but missing token in remote config.")}}Xc(t){if(this.zt)try{this._conversationsManager=t(this.zt,this._instance),this.Qc=!1,Hh.info("Conversations loaded successfully")}catch(t){this.Yc("Error completing conversations initialization",t)}else Hh.error("Cannot complete initialization: remote config is null")}Yc(t,i){Hh.error(t,i),this._conversationsManager=null,this.Jc=!1,this.Qc=!0}show(){this._conversationsManager?this._conversationsManager.show():Hh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Zc&&!U(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Cs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Kc?"remote_config_failed":L(this.Zc)?this.Kc?"disabled_in_project":"remote_config_pending":this.Zc?H(this.zt)||!this.zt.token?"missing_token":null!=m&&m.__PosthogExtensions__?this.Jc?"initializing":this.Qc?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return n(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Hh.warn(qh),null)})()}getMessages(t,i){var e=this;return n(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Hh.warn(qh),null)})()}markAsRead(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Hh.warn(qh),null)})()}getTickets(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Hh.warn(qh),null)})()}requestRestoreLink(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Hh.warn(qh),null)})()}restoreFromToken(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Hh.warn(qh),null)})()}restoreFromUrlToken(){var t=this;return n(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Hh.warn(qh),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Au(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Pu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var i,e=this;this._instance=t,this.name="logs",this.tf=!1,this.ef=!1,this.if=!1,this.A=Ce("[logs]"),this.rf=r({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(Yh)||e.A.error(...i)}}),this.Ca=[],this.nf=[],this._d=0,this.Bs=!1,this.sf=[],this.af=[],this.lf=!1,this.uf=!1,this.hf=()=>{var t,i;this.Bs||(this._d=0,null==(t=this.df)||t.onReconnect(),null==(i=this.vf)||i.onReconnect())},this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.tf=!0),o&&Ps(o,"online",this.hf)}cf(t,i,e,r){var s,n=Vh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new we(this.ff(t,i),n,this.rf,()=>this.pf(),t=>t(),void 0,r),n]}gf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.df||this.mf!==i){var e;null==(e=this.df)||e.reset(),this.mf=i;var r=this.cf(()=>this.Ca,t=>{this.Ca=t});this.df=r[0],this.yf=r[1]}return this.df}bf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.vf||this._f!==i){var e;null==(e=this.vf)||e.reset(),this._f=i;var r=this.cf(()=>this.nf,t=>{this.nf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Gh);this.vf=r[0],this.wf=r[1]}return this.vf}setup(t){var i;if(!this.Bs){this.Us=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.tf=!0),(this.tf||this.kf()&&this.Sf())&&this.xf();var e=!1,r=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Bs?r.dispose():(this.Ws=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Bs||(this.Bs=!0,this.Cf(),null==(t=this.Ws)||t.dispose(),this.Ws=void 0,this.Us=void 0,this.if=!1,null==o||o.removeEventListener("online",this.hf),null==(i=this.Tf)||i.call(this),this.Tf=void 0,null==(e=this.df)||e.reset(),null==(r=this.vf)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Bs){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;H(r)?this.Mf():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[Ze]:!!r}),r?(this.tf=!0,this.ef||this.xf(),this.loadIfEnabled()):this.Mf())}}reset(){var t,i,e,r;this.Cf(),null==(t=this.df)||t.clearQueue(),this.Ca=[],null==(i=this.df)||i.reset(),null==(e=this.vf)||e.clearQueue(),this.nf=[],null==(r=this.vf)||r.reset(),this._d=0}captureLog(t){this.Bs||this.gf().captureLog(t)}captureConsoleLog(t){this.Bs||this.bf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Bs||this.bf().captureLog(t,{context:i,occurredAtMs:e})}Sf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[Ze])}kf(){var t,i;return null==(t=this._instance)||null==t.wa||!t.wa()||!(null==(i=m._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}Ou(){var t;this.Cf(),null==(t=this.vf)||t.clearQueue(),this.nf=[]}Mf(){this.tf||this.Cf()}xf(){var t,i=this;if(!this.lf&&null!=m&&m.console){var e=Vh(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(m.console[t])}catch(t){return 0}if(!r)return 0;i.af.push(Ql(m.console,t,s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.If(t,n,e)}catch(t){}return s.apply(m.console,n)};return n.__rrweb_original__=r,n}))};for(var s of Wh)r(s);this.lf=!0,this.Ef=setTimeout(()=>{this.Cf()},3e4)}}If(t,i,e){var r;if(this.lf&&!this.uf&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.sf.length){this.uf=!0;try{this.sf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.pf()})}finally{this.uf=!1}}}else this.Cf()}Cf(){if(this.sf=[],this.lf){for(var t of(this.lf=!1,this.Ef&&(clearTimeout(this.Ef),this.Ef=void 0),this.af))t();this.af=[]}}Rf(){var t=this.sf;return this.Cf(),t}get logger(){return this.Af||(this.Af={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.Af}flushLogs(t){t?this.Pf(t):(this.df&&this.df.flush().catch(t=>this.Ff(t)),this.vf&&this.vf.flush().catch(t=>this.Ff(t)))}Ff(t){Yh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Bs&&this.tf&&!this.ef&&!this.if){var t=null==m?void 0:m.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Cf();var i=t.loadExternalDependency;if(!i)return this.A.error(ls),void this.Cf();this.if=!0;try{i(this._instance,"logs",i=>{if(this.if=!1,!this.Bs&&this.tf){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.Cf();else{var r,s,n=this.Rf();this.Tf=e.initializeLogs(null!==(r=this.Us)&&void 0!==r?r:this._instance),this.ef=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Us)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.if=!1,t}}}ff(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===C.LogsQueue?t():void 0,setPersistedProperty(t,e){t===C.LogsQueue&&i(null!=e?e:[])},gs:t=>this.gs(t),getLibraryId:()=>Oe.LIB_NAME,getLibraryVersion:()=>Oe.LIB_VERSION}}gs(t){return new Promise(i=>{if(lo(this._d,3))i({kind:"fatal",error:Jh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Jh(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Of(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.$f(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Jh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}})}$f(t){(0!==t||this._instance.__loaded)&&(this._d=ho(t,this._d,3,()=>this.A.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.")))}Pf(t){this.Ca.length>0&&this.Df(t,this.Ca,this.yf,Oe.LIB_NAME,t=>{this.Ca=t}),this.nf.length>0&&this.Df(t,this.nf,this.wf,Gh,t=>{this.nf=t})}Df(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=ye(n,be(e,Oe.LIB_NAME,Oe.LIB_VERSION),r,Oe.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Of(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Of(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}pf(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,H(s)||(i.sessionStartTimestamp=s),H(n)||(i.lastActivityTimestamp=n)}if(null!=m&&null!=(t=m.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?gi(m.location.href):m.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},{metrics:class{constructor(t){this._instance=t,this.A=Ce("[metrics]")}initialize(){}gf(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.df&&this.mf===e||(null==(i=this.df)||i.reset(),this.mf=e,this.df=new Ee(this.ff(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.df}count(t,i,e){void 0===i&&(i=1),this.gf().count(t,i,e)}gauge(t,i,e){this.gf().gauge(t,i,e)}histogram(t,i,e){this.gf().histogram(t,i,e)}flush(t){if(!this.df)return Promise.resolve();if(t){var i=this.df.drainWindow();return i&&this.Fs(i,t),Promise.resolve()}return this.df.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.df)||t.reset()}ff(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Fs:t=>i.Fs(t),getLibraryId:()=>Oe.LIB_NAME,getLibraryVersion:()=>Oe.LIB_VERSION}}Fs(t,i){return new Promise(e=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(r({method:"POST",url:this.Lf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i,e=t.statusCode;n(e>=200&&300>e?{kind:"ok"}:413===e?{kind:"too-large"}:0!==e&&408!==e&&429!==e&&500>e?{kind:"fatal",error:new Error("metrics request failed with status "+e)}:{kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}))})}Lf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});zl.__defaultExtensionClasses=r({},au),function(){Oe.SDK_DIST_CHANNEL="cdn";var t=m.posthog;if(!t||M(t._i)){var i=kl[Ol]=new zl;if(t){var e=[];bs(t._i,function(r){if(r&&M(r)){var s=i.init(r[0],r[1],r[2]),n=t[r[2]]||t;s.__loaded&&-1===e.indexOf(n)&&(e.push(n),s._execute_array.call(s.people,n.people),s._execute_array(n))}})}i.__SV=1,m.posthog=i,function(){function t(){t.done||(t.done=!0,Ml=!1,bs(kl,function(t){t._dom_loaded()}))}null!=h&&h.addEventListener?"complete"===h.readyState?t():Ps(h,"DOMContentLoaded",t,{capture:!1}):o&&Pe.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}()}();
|
|
2
2
|
//# sourceMappingURL=array.js.map
|