@bcrumbs.net/inbox 0.0.72 → 0.0.74
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/index.cjs.js +164 -106
- package/index.esm.js +164 -106
- package/package.json +1 -1
- package/src/app/generic/components/NewVersionBanner.d.ts +4 -0
- package/src/app/generic/hooks/useNewerBuild.d.ts +13 -0
- package/src/app/generic/utils/versionCheck.d.ts +28 -0
- package/src/assets/locales/translations.d.ts +6 -0
package/index.cjs.js
CHANGED
|
@@ -12023,137 +12023,195 @@ const environment = {
|
|
|
12023
12023
|
production: false,
|
|
12024
12024
|
enablePaidPlans: true};
|
|
12025
12025
|
|
|
12026
|
-
var t="undefined"!=typeof window?window:void 0,e$1="undefined"!=typeof globalThis?globalThis:t,i$1=null==e$1?void 0:e$1.navigator,r=null==e$1?void 0:e$1.document,s$1=null==e$1?void 0:e$1.location,n=null==e$1?void 0:e$1.fetch,o$1=null!=e$1&&e$1.XMLHttpRequest&&"withCredentials"in new e$1.XMLHttpRequest?e$1.XMLHttpRequest:void 0,a=null==e$1?void 0:e$1.AbortController,l=null==e$1?void 0:e$1.CompressionStream,u=null==i$1?void 0:i$1.userAgent;function h$2(){return !(!t||false===t.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:t;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var v$1=null!=t?t:{},c="0.2.0",f={DEBUG:false,LIB_VERSION:c,LIB_NAME:"browser-common",JS_SDK_VERSION:c};function p(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value;}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s);}function _$3(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){p(n,r,s,o,a,"next",t);}function a(t){p(n,r,s,o,a,"throw",t);}o(void 0);}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r]);}return t},g.apply(null,arguments)}function m(t,e){if(null==t)return {};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r];}return i}var y$1=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function b(t){return "string"==typeof t||t}function w$1(t){return "string"==typeof t?t:void 0}var E$1,x$1=["$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","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],S$1=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.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.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}({}),k$1=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),T$1=["$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"],R$1=["token"],P$1="NativeGzipValidationError",O$1=t=>t.length>=2&&31===t[0]&&139===t[1],I$1=(t,e)=>t===k$1.GZipJS||e===k$1.GZipJS||"gzip"===e,C=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),M$1=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=P$1,e},A$1=function(){var t=_$3((function*(t,e){18>t.size&&M$1("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());O$1(i)&&8===i[2]||M$1("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,true)!==(t=>{for(var e=(()=>{if(E$1)return E$1;E$1=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;E$1[t]=e>>>0;}return E$1})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return (4294967295^i)>>>0})(e)&&M$1("invalid-crc");var s=e.length>>>0;r.getUint32(4,true)!==s&&M$1("invalid-size");}));return function(e,i){return t.apply(this,arguments)}}();function F$1(){return F$1=_$3((function*(t,e,i){ void 0===e&&(e=true);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=_$3((function*(t){try{yield n.abort(t);}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield A$1(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),F$1.apply(this,arguments)}var D$1=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],N$1=function(t,e){if(void 0===e&&(e=[]),!t)return false;var i=t.toLowerCase();return D$1.concat(e).some((t=>{var e=t.toLowerCase();return -1!==i.indexOf(e)}))};function U$1(t,e){return -1!==t.indexOf(e)}var L$1=function(t){return t.trim()},j$1=function(t){return t.replace(/^\$/,"")};function B$1(t){var e,i=[];return null!==(e=JSON.stringify(t,(function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return {name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return "[Circular]";i.push(e);}return e}})))&&void 0!==e?e:"null"}var z$1=Object.prototype,H$1=z$1.hasOwnProperty,q$1=z$1.toString,V$1=Array.isArray||function(t){return "[object Array]"===q$1.call(t)},G$1=t=>"function"==typeof t,W$1=t=>t===Object(t)&&!V$1(t),J$1=t=>{if(W$1(t)){for(var e in t)if(H$1.call(t,e))return false;return true}return false},K$1=t=>void 0===t,Y$1=t=>"[object String]"==q$1.call(t),Q$1=t=>Y$1(t)&&0===t.trim().length,X$1=t=>null===t,Z$1=t=>K$1(t)||X$1(t),tt$1=t=>"[object Number]"==q$1.call(t)&&t==t,et$1=t=>tt$1(t)&&t>0,it$1=t=>"[object Boolean]"===q$1.call(t),rt$1=t=>t instanceof FormData,st$1=t=>U$1(T$1,t),nt$1=t=>U$1(R$1,t);function ot$1(t){return null===t||"object"!=typeof t}function at$1(t,e){return {}.toString.call(t)==="[object "+e+"]"}function lt$1(t){return "undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return false}}(t,Event)}var ut$1=[true,"true",1,"1","yes"],ht$1=t=>U$1(ut$1,t),dt$1=[false,"false",0,"0","no"];function vt$1(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),tt$1(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),vt$1(s||i,e,i,r))}let ct$1 = class ct{constructor(t){this.tt={},this.et=t.et,this.rt=vt$1(t.bucketSize,0,100,t.it),this.nt=vt$1(t.refillRate,0,this.rt,t.it),this.st=vt$1(t.refillInterval,0,864e5,t.it);}ot(t,e){var i=Math.floor((e-t.lastAccess)/this.st);i>0&&(t.tokens=Math.min(t.tokens+i*this.nt,this.rt),t.lastAccess=t.lastAccess+i*this.st);}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.tt[r];return s?this.ot(s,i):this.tt[r]=s={tokens:this.rt,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.et)||e.call(this,t)),0===s.tokens)}stop(){this.tt={};}};var ft$1="Mobile",pt$1="iOS",_t$2="Android",gt$1="Tablet",mt$1=_t$2+" "+gt$1,yt$1="iPad",bt$1="Apple",wt$1=bt$1+" Watch",Et$1="Safari",xt$1="BlackBerry",St$1="Samsung",kt$1=St$1+"Browser",$t$1=St$1+" Internet",Tt$1="Chrome",Rt$1=Tt$1+" OS",Pt$1=Tt$1+" "+pt$1,Ot$1="Internet Explorer",It$1=Ot$1+" "+ft$1,Ct$1="Opera",Mt$1=Ct$1+" Mini",At$1="Edge",Ft$1="Microsoft "+At$1,Dt$1="Firefox",Nt$1=Dt$1+" "+pt$1,Ut$1="Nintendo",Lt$1="PlayStation",jt$1="Xbox",Bt$1=_t$2+" "+ft$1,zt$1=ft$1+" "+Et$1,Ht$1="Windows",qt$1=Ht$1+" Phone",Vt$1="Nokia",Gt$1="Ouya",Wt$1="Generic",Jt$1=Wt$1+" "+ft$1.toLowerCase(),Kt$1=Wt$1+" "+gt$1.toLowerCase(),Yt$1="Konqueror",Qt$1="Oculus Browser",Xt$1="Vivaldi",Zt$1="Yandex",te$2="Whale",ee$2="DuckDuckGo",ie$2="Pale Moon",re$3="Waterfox",se$2="Brave",ne$2="Google Search App",oe$1="(\\d+(\\.\\d+)?)",ae$2=new RegExp("Version/"+oe$1),le$1=new RegExp(jt$1,"i"),ue$1=new RegExp(Lt$1+" \\w+","i"),he$1=new RegExp(Ut$1+" \\w+","i"),de$2=new RegExp(xt$1+"|PlayBook|BB10","i"),ve$1={"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"},ce$2=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?se$2:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&U$1(t,"GSA/")?ne$2:U$1(t," OPR/")&&U$1(t,"Mini")?Mt$1:U$1(t," OPR/")?Ct$1:de$2.test(t)?xt$1:U$1(t,"IE"+ft$1)||U$1(t,"WPDesktop")?It$1:U$1(t,"OculusBrowser")?Qt$1:U$1(t,kt$1)?$t$1:U$1(t,At$1)||U$1(t,"Edg/")?Ft$1:U$1(t,Xt$1+"/")?Xt$1:U$1(t,"YaBrowser/")?Zt$1:U$1(t,te$2+"/")?te$2:U$1(t,ee$2+"/")||U$1(t,"Ddg/")?ee$2:U$1(t,"FBIOS")?"Facebook "+ft$1:U$1(t,"UCWEB")||U$1(t,"UCBrowser")?"UC Browser":U$1(t,"CriOS")?Pt$1:U$1(t,"CrMo")||U$1(t,Tt$1)?Tt$1:U$1(t,_t$2)&&U$1(t,Et$1)?Bt$1:U$1(t,"FxiOS")?Nt$1:U$1(t.toLowerCase(),Yt$1.toLowerCase())?Yt$1:U$1(t,se$2+"/")?se$2:((t,e)=>e&&U$1(e,bt$1)||function(t){return U$1(t,Et$1)&&!U$1(t,Tt$1)&&!U$1(t,_t$2)}(t))(t,e)?U$1(t,ft$1)?zt$1:Et$1:U$1(t,"PaleMoon/")?ie$2:U$1(t,re$3+"/")?re$3:U$1(t,Dt$1)?Dt$1:U$1(t,"MSIE")||U$1(t,"Trident/")?Ot$1:U$1(t,"Gecko")?Dt$1:"")},fe$1={[It$1]:[new RegExp("rv:"+oe$1)],[Ft$1]:[new RegExp(At$1+"?\\/"+oe$1)],[Tt$1]:[new RegExp("("+Tt$1+"|CrMo)\\/"+oe$1)],[Pt$1]:[new RegExp("CriOS\\/"+oe$1)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+oe$1)],[Et$1]:[ae$2],[zt$1]:[ae$2],[Ct$1]:[new RegExp("(Opera|OPR)\\/"+oe$1)],[Dt$1]:[new RegExp(Dt$1+"\\/"+oe$1)],[Nt$1]:[new RegExp("FxiOS\\/"+oe$1)],[Yt$1]:[new RegExp("Konqueror[:/]?"+oe$1,"i")],[xt$1]:[new RegExp(xt$1+" "+oe$1),ae$2],[Bt$1]:[new RegExp("android\\s"+oe$1,"i")],[$t$1]:[new RegExp(kt$1+"\\/"+oe$1)],[Qt$1]:[new RegExp("OculusBrowser\\/"+oe$1)],[Xt$1]:[new RegExp(Xt$1+"\\/"+oe$1)],[Zt$1]:[new RegExp("YaBrowser\\/"+oe$1)],[te$2]:[new RegExp(te$2+"\\/"+oe$1)],[se$2]:[new RegExp(se$2+"\\/"+oe$1)],[ee$2]:[new RegExp("(DuckDuckGo|Ddg)\\/"+oe$1)],[ie$2]:[new RegExp("PaleMoon\\/"+oe$1)],[re$3]:[new RegExp(re$3+"\\/"+oe$1)],[ne$2]:[new RegExp("GSA\\/"+oe$1)],[Ot$1]:[new RegExp("(rv:|MSIE )"+oe$1)],Mozilla:[new RegExp("rv:"+oe$1)]},pe$2=function(t,e,i,r){var s=ce$2(t,e,i,r),n=fe$1[s];if(K$1(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},_e$2=[[new RegExp(jt$1+"; "+jt$1+" (.*?)[);]","i"),t=>[jt$1,t&&t[1]||""]],[new RegExp(Ut$1,"i"),[Ut$1,""]],[new RegExp(Lt$1,"i"),[Lt$1,""]],[de$2,[xt$1,""]],[new RegExp(Ht$1,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return [qt$1,""];if(new RegExp(ft$1).test(e)&&!/IEMobile\b/.test(e))return [Ht$1+" "+ft$1,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=ve$1[i[1]]||"";return /arm/i.test(e)&&(r="RT"),[Ht$1,r]}return [Ht$1,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[pt$1,[t[3],t[4],t[5]||"0"].join(".")]:[pt$1,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=K$1(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+_t$2+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+_t$2+")","i"),t=>t&&t[2]?[_t$2,[t[2],t[3],t[4]||"0"].join(".")]:[_t$2,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Rt$1,""]],[/Linux|debian/i,["Linux",""]]],ge$2=function(t){return he$1.test(t)?Ut$1:ue$1.test(t)?Lt$1:le$1.test(t)?jt$1:new RegExp(Gt$1,"i").test(t)?Gt$1:new RegExp("("+qt$1+"|WPDesktop)","i").test(t)?qt$1:/iPad/.test(t)?yt$1:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?wt$1:de$2.test(t)?xt$1:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Vt$1,"i").test(t)?Vt$1:/(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(ft$1).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)?_t$2:mt$1:new RegExp("(pda|"+ft$1+")","i").test(t)?Jt$1:new RegExp(gt$1,"i").test(t)&&!new RegExp(gt$1+" pc","i").test(t)?Kt$1:""},me$1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ye$2(t,e){return "string"==typeof(i=t)&&me$1.test(i)?t:e();var i;}function be$1(t){return t?t.split("#")[0]:t}function we$2(t,e){var i=setTimeout(t,e);return (null==i?void 0:i.unref)&&(null==i||i.unref()),i}var Ee$2=t=>t instanceof Error,xe$2={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}},Se$2=xe$2.info;function ke$1(t){if(it$1(t))return {boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return {stringValue:t};if(V$1(t))return {arrayValue:{values:t.map((t=>ke$1(t)))}};try{return {stringValue:JSON.stringify(t)}}catch(e){return {stringValue:String(t)}}}function $e$2(t){var e=[];for(var i in t){var r=t[i];X$1(r)||K$1(r)||e.push({key:i,value:ke$1(r)});}return e}function Te$2(t,e){var i=xe$2[t.level||"info"]||Se$2,r=i.text,s=i.number,n=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),Z$1(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),Z$1(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=g({},o,t.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:$e$2(a)};return t.trace_id&&(l.traceId=t.trace_id),t.span_id&&(l.spanId=t.span_id),K$1(t.trace_flags)||(l.flags=t.trace_flags),l}function Re$2(t,e,i){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}function Pe$2(t,e,i,r){return {resourceLogs:[{resource:{attributes:$e$2(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Oe$2=class Oe{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Te=e,this.it=i,this.ut=r,this.ht=s,this.dt=n,this.ct=o,this.vt=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=false,this.xt=e.maxBufferSize,this.kt=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.St=e.flushIntervalMs,this.Ct=e.maxBatchRecordsPerPost,this.It=e.rateCapWindowMs,this.Tt=e.maxLogsPerInterval;}reset(){this.Mt(),this.vt=null,this.bt=0,this._t=0,this.wt=false,this.ft=0,this.yt=0,this.Ct=this.Te.maxBatchRecordsPerPost;}onReconnect(){this.yt=0,this.Et();}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.Rt(t);if(null!==e)if(e.body){if(this.Pt()){var i={record:Te$2(e,this.ut())};this.ht((()=>this.Ot(i)));}}else this.it.info("Log was rejected in beforeSend function");}}Rt(t){var e=this.Te.beforeSend;if(!e)return t;var i=V$1(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.it.info("Log was rejected in beforeSend function"),null;r=n;}catch(t){return this.it.error("Error in beforeSend function for log:",t),null}return r}Pt(){if(void 0===this.Tt)return true;var t=Date.now(),e=t-this.bt;return this.It>e&&e>=0||(this.bt=t,this._t=0,this.wt=false),this.Tt>this._t?(this._t++,true):(this.wt||(this.it.warn("captureLog dropping logs: exceeded "+this.Tt+" logs per "+this.It+"ms"),this.wt=true),false)}flush(){var t=this;return _$3((function*(){if(!t._instance.isDisabled)return t.vt||(t.vt=t.Ft().finally((()=>{t.vt=null;}))),t.vt}))()}Ft(){var t=this;return _$3((function*(){var e;t.Mt();var i=null!==(e=t._instance.getPersistedProperty(S$1.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.ft=0;var a=Math.min(i.length,t.Ct),l=i.slice(0,a),u=Pe$2(l.map((t=>t.record)),t.Lt(),null!==(n=t.ct)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.$t(u);if("too-large"===h.kind&&l.length>1)t.Ct=Math.max(1,Math.floor(l.length/2)),t.it.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Ct);else {if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.it.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===h.kind&&t.Te.maxBatchRecordsPerPost>t.Ct&&(t.Ct=Math.min(t.Te.maxBatchRecordsPerPost,t.Ct+1)),yield t.At(l.length),i=null!==(o=t._instance.getPersistedProperty(S$1.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}At(t){var e=this;return _$3((function*(){var i,r=Math.max(0,t-e.ft),s=null!==(i=e._instance.getPersistedProperty(S$1.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(S$1.LogsQueue,s.slice(r)),yield e.dt();}))()}Lt(){return Re$2(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(S$1.LogsQueue))&&void 0!==e?e:[];this.kt>i.length||(i.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(S$1.LogsQueue,i),this.xt>i.length?this.Nt():this.Et();}}Nt(t){ void 0===t&&(t=this.St),this.Dt||(this.Dt=we$2((()=>{this.Dt=void 0,this.Et();}),t));}qt(){var t=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,t)}jt(){var t=this._instance.getPersistedProperty(S$1.LogsQueue);return !!t&&t.length>0}shutdown(t){var e=this;return _$3((function*(){e.Mt();var i=e.flush().catch((()=>{}));void 0!==t?yield Promise.race([i,new Promise((e=>we$2(e,t)))]):yield i;}))()}flushWithTimeout(t){var e=this;return _$3((function*(){var i=false,r=e.flush(),s=new Promise((e=>we$2((()=>{i=true,e();}),t)));try{yield Promise.race([r,s]);}finally{i&&r.catch((()=>{}));}}))()}Et(){this.flush().then((()=>{this.yt=0;}),(t=>{this.yt++,this.it.error("PostHog logs flush failed:",t);})).finally((()=>{!this._instance.isDisabled&&this.jt()&&this.Nt(this.qt());}));}Mt(){this.Dt&&(clearTimeout(this.Dt),this.Dt=void 0);}};var Ie$2=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ce$1(t){return String(t)+"000000"}function Me$2(t,e,i,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+e+"\0"+(null!=i?i:"")+"\0"+s}let Ae$2=class Ae{constructor(t,e,i){this._instance=t,this.Te=e,this.it=i,this.Ht=new Map,this.vt=null,this.Bt=false,this.Ut=new Map,this.zt=new Set,this.Vt=0;}count(t,e,i){ void 0===e&&(e=1),this.Wt({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes});}gauge(t,e,i){this.Wt({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes});}histogram(t,e,i){this.Wt({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes});}flush(){var t=this,e=this.vt,i=function(){var i=_$3((function*(){e&&(yield e.catch((()=>{}))),yield t.Zt();}));return function(){return i.apply(this,arguments)}}(),r=i().finally((()=>{this.vt===r&&(this.vt=null);}));return this.vt=r,r}drainWindow(){if(0===this.Ht.size)return null;var t=this.Ht;return this.Ht=new Map,this.Bt=false,this.Ut=new Map,this.zt=new Set,this.Gt(t)}reset(){this.Vt++,this.Mt(),this.Ht=new Map,this.vt=null,this.Bt=false,this.Ut=new Map,this.zt=new Set;}Wt(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var e=this.Rt(t);if(null!==e)if(e.name&&"string"==typeof e.name)if("number"==typeof e.value&&Number.isFinite(e.value))if("count"===e.type&&0>e.value)this.it.warn("Dropping count '"+e.name+"': counters are monotonic, value must be >= 0");else {var i,r;try{i=e.attributes?g({},e.attributes):void 0,r=Me$2(e.type,e.name,e.unit,i);}catch(t){return void this.it.warn("Dropping metric '"+e.name+"': attributes could not be serialized",t)}var s=this.Ht.get(r);if(!s){if(!this.Qt())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.Ht.set(r,s);}var n=this.Ut.get(e.name);void 0===n?this.Ut.set(e.name,e.type):n===e.type||this.zt.has(e.name)||(this.zt.add(e.name),this.it.warn("Metric name '"+e.name+"' is already used as a "+n+"; recording it as a "+e.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(s,e.value),this.Nt();}else this.it.warn("Dropping metric '"+e.name+"': value must be a finite number");else this.it.warn("Dropping metric with empty name");}}Qt(){return this.Te.maxSeriesPerFlush>this.Ht.size||(this.Bt||(this.Bt=true,this.it.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),false)}Jt(t,e){var i;switch(t.type){case "count":t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case "gauge":t.last=e;break;case "histogram":t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(Ie$2.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=e,r.min=Math.min(r.min,e),r.max=Math.max(r.max,e),r.bucketCounts[function(t,e){for(var i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,Ie$2)]+=1;}}Rt(t){var e=this.Te.beforeSend;if(!e)return t;var i=V$1(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.it.info("Metric was rejected in beforeSend function"),null;r=n;}catch(t){return this.it.error("Error in beforeSend function for metric:",t),null}return r}Nt(){this.Dt||(this.Dt=we$2((()=>{this.Dt=void 0,this.flush().catch((t=>{this.it.error("Metrics flush failed:",t);}));}),this.Te.flushIntervalMs));}Mt(){this.Dt&&(clearTimeout(this.Dt),this.Dt=void 0);}Zt(){var t=this;return _$3((function*(){if(0!==t.Ht.size){var e=t.Ht;t.Ht=new Map,t.Bt=false,t.Ut=new Map,t.zt=new Set;var i=t.Vt,r=yield t._instance.Kt(t.Gt(e));if(i===t.Vt)switch(r.kind){case "ok":return;case "retry-later":return t.Yt(e),void t.Nt();case "too-large":return void t.it.warn("Metrics batch exceeded the server size limit and was dropped");case "fatal":return void t.it.error("Failed to send metrics batch:",r.error)}}}))()}Gt(t){return e=this.Xt(t),i=function(t,e,i){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$e$2(i)},scopeMetrics:[{scope:{name:r,version:s},metrics:e}]}]};var e,i,r,s;}Xt(t){var e=Ce$1(Date.now()),i=new Map;for(var r of t.values()){var s,n=Me$2(r.type,r.name,r.unit,void 0),o=i.get(n);o||(o=g({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?o.sum={aggregationTemporality:1,isMonotonic:true,dataPoints:[]}:"gauge"===r.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},i.set(n,o));var a=$e$2(null!==(s=r.attributes)&&void 0!==s?s:{}),l=Ce$1(r.windowStartMs);if("count"===r.type){var u,h={attributes:a,startTimeUnixNano:l,timeUnixNano:e,asDouble:null!==(u=r.total)&&void 0!==u?u:0};o.sum.dataPoints.push(h);}else if("gauge"===r.type){var d,v={attributes:a,timeUnixNano:e,asDouble:null!==(d=r.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(v);}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:e,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Ie$2});}return Array.from(i.values())}Yt(t){var e,i;for(var r of t){var s=r[0],n=r[1],o=this.Ht.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case "count":o.total=(null!==(e=o.total)&&void 0!==e?e:0)+(null!==(i=n.total)&&void 0!==i?i:0);break;case "gauge":break;case "histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a];}else o.hist=n.hist;}else this.Qt()&&this.Ht.set(s,n);}}};var Fe$1,De$2,Ne$2;function Ue$2(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Ne$2&&i.length===De$2||(De$2=i.length,Ne$2=i.reduce(((i,r)=>{Fe$1||(Fe$1={});var s=Fe$1[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,Fe$1[r]=[l,u];break}}return i}),{})),Ne$2}}let Le$2 = class Le{constructor(t,e,i){ void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i;}buildFromUnknown(t,e){ void 0===e&&(e={});var i=e&&e.mechanism||{handled:true,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return {$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var e=this;return _$3((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&V$1(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var e;return {type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:true}}parseStacktrace(t,e){var i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),g({},t,{cause:i,stack:r})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return _$3((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},e,{handled:true}))),o}buildParsingContext(t){var e;return {chunkIdMap:Ue$2(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){ void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return g({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}};var je$2="?";function Be$2(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?je$2:i,in_app:true};return K$1(r)||(n.lineno=r),K$1(s)||(n.colno=s),n}var ze$2=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:je$2,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},He$2=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,qe$1=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ve$2=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ge$2=(t,e)=>{var i=He$2.exec(t);if(i)return Be$2(e,i[1],je$2,+i[2],+i[3]);var r=qe$1.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=Ve$2.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3]);}var n=ze$2(r[1]||je$2,r[2]);return Be$2(e,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},We$2=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Je$2=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ke$2=(t,e)=>{var i=We$2.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Je$2.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="");}var s=i[3],n=i[1]||je$2,o=ze$2(n,s);return Be$2(e,s=o[1],n=o[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ye$1=/\(error: (.*)\)/;let Qe$2 = class Qe{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=Y$1(t.stack);return {type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:false}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return at$1(t,"DOMException")}isDOMError(t){return at$1(t,"DOMError")}};let Xe$1 = class Xe{match(t){return (t=>t instanceof Error)(t)}coerce(t,e){return {type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:false}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}};let Ze$2 = class Ze{constructor(){}match(t){return at$1(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:true}}};var ti=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class ei{match(t){return "string"==typeof t}coerce(t,e){var i,r=this.getInfos(t),s=r[0],n=r[1];return {type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:true}}getInfos(t){var e="Error",i=t,r=t.match(ti);return r&&(e=r[1],i=r[2]),[e,i]}}var ii=["fatal","error","warning","log","info","debug"];function ri(t,e){ void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return "[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return ""}class si{match(t){return "object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:true}}getType(t){return lt$1(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return "message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return (i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+ri(t)}isSeverityLevel(t){return Y$1(t)&&!Q$1(t)&&ii.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Ee$2(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class ni{match(t){return lt$1(t)}coerce(t,e){var i,r=t.constructor.name;return {type:r,value:r+" captured as exception with keys: "+ri(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:true}}}class oi{match(t){return ot$1(t)}coerce(t,e){var i;return {type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:true}}}class ai{match(t){return at$1(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!lt$1(t))return false;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return false}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return ot$1(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:true}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var li="$message",ui="$timestamp",hi=new Set([li,ui]),di={enabled:true,max_bytes:32768};function vi(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:di.enabled,max_bytes:fi(t.max_bytes,di.max_bytes)}:g({},di)}class ci{constructor(t){this.$e=[],this.ze=0,this.Te=vi(t);}setConfig(t){this.Te=vi(t),this.Ze();}add(t){var e=function(t){var e;try{e=B$1(t);}catch(t){return}try{var i=JSON.parse(e);if(!W$1(i))return;var r=i,s=r[li],n=r[ui];if(!Y$1(s)||0===s.trim().length)return;if(!Y$1(n)&&!tt$1(n))return;return {step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return (new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Te.max_bytes||(this.$e.push({step:e.step,bytes:i}),this.ze+=i,this.Ze());}}getAttachable(){return this.$e.map((t=>t.step))}clear(){this.$e=[],this.ze=0;}size(){return this.$e.length}Ze(){for(;this.ze>this.Te.max_bytes&&this.$e.length>0;){var t=this.$e.shift();t&&(this.ze-=t.bytes);}}}function fi(t,e){if(!tt$1(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var pi=function(e,i){var r=(void 0===i?{}:i).debugEnabled,s={k(i){if(t&&(f.DEBUG||t.POSTHOG_DEBUG||r)&&!K$1(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o);}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("debug",...e);},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("log",...e);},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("warn",...e);},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("error",...e);},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i);},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t);},createLogger:(t,i)=>pi(e+" "+t,i)};return s},_i=pi("[PostHog.js]"),gi=_i.createLogger,mi=gi("[ExternalScriptsLoader]"),yi=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return mi.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=true,i(void 0,e);})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=true,i(void 0,t);},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else {var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s);}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l);};v$1.__PosthogExtensions__=v$1.__PosthogExtensions__||{},v$1.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else {var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n;}r=t.requestRouter.endpointFor("assets",s);}yi(t,r,i);}else {var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");yi(t,o,i);}},v$1.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);yi(t,r,i);};var bi="1.407.2";f.DEBUG=false,f.LIB_VERSION=bi,f.LIB_NAME="web",f.JS_SDK_VERSION=bi;var wi="$people_distinct_id",Ei="$device_id",xi="$device_model",Si="__alias",ki="__timers",$i="$autocapture_disabled_server_side",Ti="$heatmaps_enabled_server_side",Ri="$exception_capture_enabled_server_side",Pi="$error_tracking_suppression_rules",Oi="$error_tracking_capture_extension_exceptions",Ii="$web_vitals_enabled_server_side",Ci="$dead_clicks_enabled_server_side",Mi="$product_tours_enabled_server_side",Ai="$web_vitals_allowed_metrics",Fi="$session_recording_remote_config",Di="$replay_sample_rate",Ni="$replay_override_sampling",Ui="$replay_override_linked_flag",Li="$replay_override_url_trigger",ji="$replay_override_event_trigger",Bi="$sesid",zi="$session_is_sampled",Hi="$enabled_feature_flags",qi="$active_feature_flags",Vi="$early_access_features",Gi="$feature_flag_details",Wi="$feature_flag_payloads",Ji="$feature_flag_request_id",Ki="$minimal_flag_called_events",Yi="$override_feature_flags",Qi="$override_feature_flag_payloads",Xi="$stored_person_properties",Zi="$stored_group_properties",tr$1="$surveys",er$1="$surveys_loaded_at",ir$1="$surveys_activated",rr$1="$surveys_activated_session",sr$1="ph_product_tours",nr$1="$flag_call_reported",or$1="$flag_call_reported_session_id",ar$1="$feature_flag_errors",lr$1="$feature_flag_evaluated_at",ur$1="$user_state",hr$1="$client_session_props",dr="$capture_rate_limit",vr$1="$initial_campaign_params",cr$1="$initial_referrer_info",fr$1="$initial_person_info",pr="$epp",_r$1="$posthog_cookieless",gr="$cookieless_mode",mr$1="$sdk_debug_extensions_init_method",yr="$sdk_debug_extensions_init_time_ms",br$1="$sdk_debug_recording_script_not_loaded",wr="PostHog loadExternalDependency extension not found.",Er="on_reject",xr="always",Sr$1="anonymous",kr="identified",$r="identified_only",Tr="visibilitychange",Rr="beforeunload",Pr="$pageview",Or="$pageleave",Ir="$identify",Cr="$groupidentify";function Mr(t,e){V$1(t)&&t.forEach(e);}function Ar(t,e){if(!Z$1(t))if(V$1(t))t.forEach(e);else if(rt$1(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)H$1.call(t,i)&&e(t[i],i);}var Fr=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s) void 0!==s[n]&&(t[n]=s[n]);return t};function Dr(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Nr=function(t){try{return t()}catch(t){return}},Ur=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){_i.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_i.critical(t);}}},Lr=function(t){var e={};return Ar(t,(function(t,i){(Y$1(t)&&t.length>0||tt$1(t))&&(e[i]=t);})),e};var jr=["herokuapp.com","vercel.app","netlify.app"];function Br(t){var e=null==t?void 0:t.hostname;if(!Y$1(e))return false;var i=e.split(".").slice(-2).join(".");for(var r of jr)if(i===r)return false;return true}function zr(t,e,i,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(e,i,{capture:void 0!==n&&n,passive:void 0===o||o});}function Hr(t){return "ph_toolbar_internal"===t.name}var qr=t=>{if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return tt$1(t)&&isFinite(t)&&Math.floor(t)===t});class Vr{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Vr(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Vr(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Gr{generate(){var t=this.generateOrAbort();if(!K$1(t))return t;this.S=0;var e=this.generateOrAbort();if(K$1(e))throw new Error("Could not generate UUID after timestamp reset");return e}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else {if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C());}return Vr.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32());}constructor(){this.S=0,this.I=0,this.M=new Kr;}}var Wr,Jr=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!K$1(t.crypto)&&crypto.getRandomValues&&(Jr=t=>crypto.getRandomValues(t));class Kr{nextUint32(){return this.R.length>this.O||(Jr(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0;}}var Yr=()=>Qr().toString(),Qr=()=>(Wr||(Wr=new Gr)).generate(),Xr="",Zr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var ts={N:()=>!!r,D(t){_i.error("cookieStore error: "+t);},A:qr,F(t){var e;try{e=JSON.parse(ts.A(t))||{};}catch(t){}return e},q(t,e,i,s,n){if(!r)return false;try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),Xr)return Xr;if(!e)return "";if(["localhost","127.0.0.1"].includes(t))return "";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Yr();!Xr&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",Xr=o);}return Xr}(t);if(!i){var s=(t=>{var e=t.match(Zr);return e?e[0]:""})(t);s!==i&&_i.info("Warning: cookie subdomain discovery mismatch",s,i),i=s;}return i?"; domain=."+i:""}return ""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString();}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&_i.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,!0}catch(t){return false}},P(t,e){if(null!=r&&r.cookie)try{ts.q(t,"",-1,e);}catch(t){return}}},es=null,is={N(){if(!X$1(es))return es;var e=true;if(K$1(t))e=false;else try{var i="__mplssupport__";is.q(i,"xyz"),'"xyz"'!==is.A(i)&&(e=!1),is.P(i);}catch(t){e=false;}return e||_i.error("localStorage unsupported; falling back to cookie store"),es=e,e},D(t){_i.error("localStorage error: "+t);},A(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){is.D(t);}return null},F(t){try{return JSON.parse(is.A(t))||{}}catch(t){}return null},q(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){is.D(t);}return false},P(e){try{null==t||t.localStorage.removeItem(e);}catch(t){is.D(t);}}},rs=[Ei,"distinct_id",Bi,zi,pr,fr$1,ur$1],ss={},ns={N:()=>true,D(t){_i.error("memoryStorage error: "+t);},A:t=>ss[t]||null,F:t=>ss[t]||null,q:(t,e)=>(ss[t]=e,true),P(t){delete ss[t];}},os=null,as={N(){if(!X$1(os))return os;if(os=true,K$1(t))os=false;else try{var e="__support__";as.q(e,"xyz"),'"xyz"'!==as.A(e)&&(os=!1),as.P(e);}catch(t){os=false;}return os},D(t){_i.error("sessionStorage error: ",t);},A(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){as.D(t);}return null},F(t){try{return JSON.parse(as.A(t))||null}catch(t){}return null},q(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){as.D(t);}return false},P(e){try{null==t||t.sessionStorage.removeItem(e);}catch(t){as.D(t);}}};class ls{constructor(t){this._instance=t;}get Te(){return this._instance.config}get consent(){return this.Ge()?0:this.Qe}isOptedOut(){return this.Te.cookieless_mode===xr||this.isRejected()||-1===this.consent&&this.Te.cookieless_mode===Er}isOptedIn(){return !this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Je.q(this.Ke,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie);}reset(){this.Je.P(this.Ke,this.Te.cross_subdomain_cookie);}get Ke(){var t=this._instance.config,e=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+e:"__ph_opt_in_out_"+e)}get Qe(){var t=this.Je.A(this.Ke);return ht$1(t)?1:U$1(dt$1,t)?0:-1}get Je(){var t=this.Te.opt_out_capturing_persistence_type,e="localStorage"===t?is:ts;if(!this.Ye||this.Ye!==e){this.Ye=e;var i="localStorage"===t?ts:is;i.A(this.Ke)&&(this.Ye.A(this.Ke)||this.optInOut(ht$1(i.A(this.Ke))),i.P(this.Ke,this.Te.cross_subdomain_cookie));}return this.Ye}Ge(){return !!this.Te.respect_dnt&&[null==i$1?void 0:i$1.doNotTrack,null==i$1?void 0:i$1.msDoNotTrack,v$1.doNotTrack].some((t=>ht$1(t)))}}function us(t,e){var i,r=null==t||null==(i=t.config)?void 0:i.get_current_url;if(!G$1(r))return e;try{var s=r(e);return Y$1(s)&&s?s:e}catch(t){return _i.error("Error in get_current_url, falling back to window.location.href",t),e}}var hs="__POSTHOG_TOOLBAR__",ds=1,vs=3,cs=11;function fs(t){return t instanceof Element&&(t.id===hs||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function ps(t){return !!t&&t.nodeType===ds}function _s(t,e){return !!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function gs(t){return !!t&&t.nodeType===vs}function ms(t){return !!t&&t.nodeType===cs&&ps(t.host)}var ys=1e3;function bs(t){return t?L$1(t).split(/\s+/):[]}function ws(e,i){var r=function(e){var i,r=null==t||null==(i=t.location)?void 0:i.href;return K$1(r)?void 0:us(e,r)}(i);return !!(r&&e&&e.some((t=>r.match(t))))}function Es(t){var e="";switch(typeof t.className){case "string":e=t.className;break;case "object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e="";}return bs(e)}function xs(t){return Z$1(t)?null:L$1(t).split(/(\s+)/).filter((t=>Gs(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ss(t){var e="";return Us(t)&&!Ls(t)&&t.childNodes&&t.childNodes.length&&Ar(t.childNodes,(function(t){var i;gs(t)&&t.textContent&&(e+=null!==(i=xs(t.textContent))&&void 0!==i?i:"");})),L$1(e)}function ks(t){var e;return K$1(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}var $s=["a","button","form","input","select","textarea","label"];function Ts(t,e){if(K$1(e))return true;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return !!i&&i.call(t,e)}catch(t){return false}}(t,e))))return {v:true}};for(var s of t)if(i=r(s))return i.v;return false}function Rs(t){var e=t.parentNode;return !(!e||!ps(e))&&e}var Ps=[".ph-no-autocapture","[data-ph-no-autocapture]"],Os=["next","previous","prev",">","<"],Is=[...Os,"+","-","−","–"],Cs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Ms=[".ph-no-rageclick",".ph-no-capture"],As=["","text","search","email","password","url","tel","number"];function Fs(e,i){if(!t||Ds(e))return false;var r,s,n,o,a;if(it$1(i)?(r=!!i&&Ms,s=void 0,n=false):(r=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Ms,s=null==i?void 0:i.content_ignorelist,n=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),false===r)return false;if(n&&function(t){return !(!t||!ps(t))&&(!!_s(t,"textarea")||(_s(t,"input")?U$1(As,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return true;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return "true"===e||""===e}(t)))}(e))return false;var l=Ns(e,false).targetElementList;return !function(t,e){if(false===t||K$1(t))return false;var i;if(true===t)i=Os;else {if(!V$1(t))return false;if(t.length>10)return _i.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),false;i=t.map((t=>t.toLowerCase()));}return e.some((t=>{var e=t.safeText,r=t.ariaLabel;return i.some((t=>Cs(e,t)||Cs(r,t)))}))}(s,l.map((t=>{var e;return {safeText:Ss(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Ts(l,r)}var Ds=t=>!t||_s(t,"html")||!ps(t),Ns=(e,i)=>{if(!t||Ds(e))return {parentIsUsefulElement:false,targetElementList:[]};for(var r=false,s=[e],n=e;n.parentNode&&!_s(n,"body");)if(ms(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else {var o=Rs(n);if(!o)break;if(i||$s.indexOf(o.tagName.toLowerCase())>-1)r=true;else try{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0);}catch(t){}s.push(o),n=o;}return {parentIsUsefulElement:r,targetElementList:s}};function Us(t){for(var e=new Set,i=0,r=t;r.parentNode&&!_s(r,"body");r=r.parentNode){if(i++>=ys||e.has(r))return false;e.add(r);var s=Es(r);if(U$1(s,"ph-sensitive")||U$1(s,"ph-no-capture"))return false}if(U$1(Es(t),"ph-include"))return true;var n=t.type||"";if(Y$1(n))switch(n.toLowerCase()){case "hidden":case "password":return false}var o=t.name||t.id||"";return !Y$1(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 Ls(t){return !!(_s(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||_s(t,"select")||_s(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var js$1="(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})",Bs=new RegExp("^(?:"+js$1+")$"),zs=new RegExp(js$1),Hs="\\d{3}-?\\d{2}-?\\d{4}",qs=new RegExp("^("+Hs+")$"),Vs=new RegExp("("+Hs+")");function Gs(t,e){if(void 0===e&&(e=true),Z$1(t))return false;if(Y$1(t)){if(t=L$1(t),(e?Bs:zs).test((t||"").replace(/[- ]/g,"")))return false;if((e?qs:Vs).test(t))return false}return true}function Ws(t){var e=Ss(t);return Gs(e=(e+" "+Js(t)).trim())?e:""}function Js(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Ar(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=Ss(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Js(t)).trim());}catch(t){_i.error("[AutoCapture]",t);}})),e}function Ks(t){return t.replace(/"|\\"/g,'\\"')}function Ys(t){var e=t.attr__class;if(e)return V$1(e)?e:bs(e)}var Qs=gi("[Dead Clicks]"),Xs=()=>true,Zs=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ci)),r=t.instance.config.capture_dead_clicks;return it$1(r)?r:!!W$1(r)||i};let tn$1 = class tn{get lazyLoadedDeadClicksAutocapture(){return this.Xe}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop();}onRemoteConfig(t){if(t.ok){var e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Ci]:e.captureDeadClicks}),this.startIfEnabledOrStop());}}startIfEnabledOrStop(){this.isEnabled(this)?this.tr((()=>{this.er();})):this.stop();}tr(t){var e,i;null!=(e=v$1.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=v$1.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Qs.error("failed to load script",e):t();}));}er(){var t;if(r){if(!this.Xe&&null!=(t=v$1.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=W$1(this.instance.config.capture_dead_clicks)?g({},this.instance.config.capture_dead_clicks):{};e.__onCapture=this.onCapture,this.onCapture&&(e.capture_dead_swipes=false),this.Xe=v$1.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Xe.start(r),Qs.info("starting...");}}else Qs.error("`document` not found. Cannot start.");}stop(){this.Xe&&(this.Xe.stop(),this.Xe=void 0,Qs.info("stopping..."));}};var en$1=gi("[SegmentIntegration]");var rn$1="posthog-js";function sn$1(t,e){var i=void 0===e?{}:e,r=i.organization,s=i.projectId,n=i.prefix,o=i.severityAllowList,a=void 0===o?["error"]:o,l=i.sendExceptionsToPostHog,u=void 0===l||l;return e=>{var i,o,l,h,d;if("*"!==a&&!a.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:true}));var c,f=(null==(i=e.exception)?void 0:i.values)||[],p=f.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(o=f[0])?void 0:o.value)||e.message,$exception_type:null==(l=f[0])?void 0:l.type,$exception_level:e.level,$exception_list:p,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:e.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),e}}let nn$1 = class nn{constructor(t,e,i,r,s,n){this.name=rn$1,this.setupOnce=function(o){o(sn$1(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}));};}};let on$2 = class on{constructor(t){this.rr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(_i.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.ir=void 0,this._instance.scrollManager.resetContext());},this._instance=t,this.nr();}nr(){var t;this.sr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.rr);}destroy(){var t;null==(t=this.sr)||t.call(this),this.sr=void 0;}doPageView(e,i){var r,s=this.ar(e,i);return this.ir={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.ar(t,null==(e=this.ir)?void 0:e.pageViewId)}doEvent(){var t;return {$pageview_id:null==(t=this.ir)?void 0:t.pageViewId}}ar(t,e){var i=this.ir;if(!i)return {$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,u=s.lastContentY,h=s.maxContentY;if(!(K$1(n)||K$1(o)||K$1(a)||K$1(l)||K$1(u)||K$1(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?vt$1(o/n,0,1,_i):1,v=n>1?vt$1(a/n,0,1,_i):1,c=l>1?vt$1(u/l,0,1,_i):1,f=l>1?vt$1(h/l,0,1,_i):1;r=Fr(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f});}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}};var an$1=["flags","surveys"],ln$1={[wi]:{exposure:"hidden"},[Si]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ki]:{exposure:"hidden"},[$i]:{exposure:"event"},[Ti]:{exposure:"hidden"},[Ri]:{exposure:"event"},[Pi]:{exposure:"hidden"},[Oi]:{exposure:"event"},[Ii]:{exposure:"event"},[Ci]:{exposure:"event"},[Mi]:{exposure:"hidden"},[Ai]:{exposure:"event"},[Fi]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Bi]:{exposure:"hidden"},[zi]:{exposure:"event"},[Di]:{exposure:"event",shouldSkipFromEventProperties:t=>X$1(t)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[Hi]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!W$1(t))return {};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[qi]:{exposure:"event",storageGroup:"flags"},[Vi]:{exposure:"hidden"},[Gi]:{exposure:"hidden",storageGroup:"flags"},[Wi]:{exposure:"event",storageGroup:"flags"},[Ji]:{exposure:"event",storageGroup:"flags",volatile:true},[Ki]:{exposure:"hidden",storageGroup:"flags"},[Yi]:{exposure:"event"},[Qi]:{exposure:"hidden"},[Xi]:{exposure:"hidden"},[Zi]:{exposure:"hidden"},[tr$1]:{exposure:"hidden",storageGroup:"surveys"},[er$1]:{exposure:"hidden",storageGroup:"surveys",volatile:true},[ir$1]:{exposure:"event"},[rr$1]:{exposure:"hidden"},[sr$1]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[nr$1]:{exposure:"hidden"},[or$1]:{exposure:"hidden"},[ar$1]:{exposure:"hidden"},[lr$1]:{exposure:"hidden",storageGroup:"flags",volatile:true},[ur$1]:{exposure:"hidden"},[hr$1]:{exposure:"hidden"},[dr]:{exposure:"hidden"},[vr$1]:{exposure:"hidden"},[cr$1]:{exposure:"hidden"},[fr$1]:{exposure:"hidden"},[pr]:{exposure:"hidden"},[Ni]:{exposure:"event"},[Ui]:{exposure:"event"},[Li]:{exposure:"event"},[ji]:{exposure:"event"},[mr$1]:{exposure:"event"},[yr]:{exposure:"event"},[br$1]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},un$1=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],hn$1=t=>{var e=ln$1[t];if(e)return e;for(var i of un$1){var r=i[1];if(0===t.indexOf(i[0]))return r}},dn$1=(t,e)=>{try{return JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e)}catch(e){return B$1(t)}},vn$1=t=>{var e=null==r?void 0:r.createElement("a");return K$1(e)?null:(e.href=t,e)},cn$1=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!V$1(i)||2>i.length)return "";var o=i[1];try{o=decodeURIComponent(o);}catch(t){_i.error("Skipping decoding for malformed query param: "+o);}return o.replace(/\+/g," ")},fn$1=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");V$1(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]));}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},pn$1=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},_n=(t,e)=>t>=e&&h$2(),gn$1=(t,e,i,r)=>{if(0===t){if(h$2()){var s=e+1;return s===i&&r(),s}return e}return 0},mn$1="https?://(.*)",yn$1=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],bn$1=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...yn$1],wn$1="<masked>",En$1=["li_fat_id"];function xn$1(t,e,i){if(!r)return {};var s,n=e?[...yn$1,...i||[]]:[],o=Sn$1(fn$1(r.URL,n,wn$1),t),a=(s={},Ar(En$1,(function(t){var e=qr(t);s[t]=e||null;})),s);return Fr(a,o)}function Sn$1(t,e){var i=bn$1.concat(e||[]),r={};return Ar(i,(function(e){var i=cn$1(t,e);r[e]=i||null;})),r}function kn$1(t){var e=function(t){return t?0===t.search(mn$1+"google.([^/?]*)")?"google":0===t.search(mn$1+"bing.com")?"bing":0===t.search(mn$1+"yahoo.com")?"yahoo":0===t.search(mn$1+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!X$1(e)){s.$search_engine=e;var n=r?cn$1(r.referrer,i):"";n.length&&(s.ph_keyword=n);}return s}function $n(){return navigator.language||navigator.userLanguage}var Tn="$direct";function Rn$1(){return (null==r?void 0:r.referrer)||Tn}function Pn(t,e,i){ void 0===i&&(i=false);var r=t?[...yn$1,...e||[]]:[],n=i?be$1(null==s$1?void 0:s$1.href):null==s$1?void 0:s$1.href,o=null==n?void 0:n.substring(0,1e3);return {r:Rn$1().substring(0,1e3),u:o?fn$1(o,r,wn$1):void 0}}function On(t,e){var i;void 0===e&&(e=false);var r=t.r,s=t.u,n=e?be$1(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==Tn?Tn:null==(i=vn$1(r))?void 0:i.host};if(n){o.$current_url=n;var a=vn$1(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=Sn$1(n);Fr(o,l);}if(r){var u=kn$1(r);Fr(o,u);}return o}function In$1(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Cn$1(){try{return (new Date).getTimezoneOffset()}catch(t){return}}var Mn$1={flags:lr$1,surveys:er$1},An$1=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Fn$1="main";let Dn$1 = class Dn{constructor(e,i,r){if(void 0===r&&(r=true),this.lr={},this.ur=false,this.hr=false,this.Te=e,this.dr=r,this.props={},this.cr=false,this.vr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.Je=this.pr(e),this.hr=this.gr(e),this.load(),e.debug&&_i.info("Persistence loaded",e.persistence,g({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();zr(t,"beforeunload",s,{capture:false}),zr(t,"pagehide",s,{capture:false});}}mr(){var t,e=null==(t=this.Te)?void 0:t.persistence_save_debounce_ms;return tt$1(e)&&e>0?e:0}isDisabled(){return !!this.yr}pr(e){ -1===An$1.indexOf(e.persistence.toLowerCase())&&(_i.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){ void 0===e&&(e=[]),void 0===i&&(i=false);var r=[...rs,...e];return g({},is,{F(t){try{var e={};try{e=ts.F(t)||{};}catch(t){}var r,s=JSON.parse(is.A(t)||"{}");if(i){var n={};for(var o in e){var a=e[o];X$1(a)||""===a||(n[o]=a);}r=Fr(s,n);}else r=Fr(e,s);return is.q(t,r),r}catch(t){}return null},q(t,e,i,s,n,o){var a=is.q(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t]);})),Object.keys(l).length&&ts.q(t,l,i,s,n,o);}catch(t){is.D(t);}return a},P(e,i){try{null==t||t.localStorage.removeItem(e),ts.P(e,i);}catch(t){is.D(t);}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||false),s=false,n=e.persistence.toLowerCase();return "localstorage"===n&&is.N()?(i=is,s=true):"localstorage+cookie"===n&&r.N()?(i=r,s=true):"sessionstorage"===n&&as.N()?i=as:"memory"===n?i=ns:"cookie"===n?i=ts:r.N()?(i=r,s=true):i=ts,this.ur=s,i}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var e=null!=t?t:this.Te.feature_flag_cache_ttl_ms;if(!e||0>=e)return false;var i=this.props[lr$1];return !i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Ar(this.props,((e,i)=>{var r=hn$1(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===Hi?()=>this._r():()=>false))return;r.transformToEventProperties&&Fr(t,r.transformToEventProperties(e));}else if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,(()=>false)))return;t[i]=e;}})),t}load(){if(!this.yr){var t=this.Je.F(this.vr);t&&(this.props=Fr({},t)),this.hr&&this.wr();}}wr(){for(var t of an$1){var e=is.F(this.br(t));if(e&&!J$1(e)){var i=this.kr(t);i.persisted=true,this.Sr(t)||(i.fingerprint=this.Cr(e,t)),this.Ir(t,e)||Fr(this.props,e);}}}Sr(t){return Object.keys(this.props).some((e=>{var i;return (null==(i=hn$1(e))?void 0:i.storageGroup)===t}))}Ir(t,e){var i=Mn$1[t];if(!i)return false;var r=e[i],s=this.props[i];return tt$1(r)&&tt$1(s)&&s>r}refreshKey(t){var e;if(!this.yr){var i=this.hr?null==(e=hn$1(t))?void 0:e.storageGroup:void 0,r=i?is.F(this.br(i)):this.Je.F(this.vr);if(r&&t in r)this.Tr(t,r[t]);else {if(i){var s=this.Je.F(this.vr);if(s&&t in s)return void this.Tr(t,s[t])}this.Mr(t);}}}save(){if(!this.yr){var t=this.mr();t>0?K$1(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr();}),t)):this.Rr();}}flush(){K$1(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr());}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Je,this.vr,this.props,Fn$1));}Pr(){var t=this.Fr(),e=t.main,i=t.groups;for(var r of(this.Or(this.Je,this.vr,e,Fn$1),an$1)){var s,n=i[r];(!J$1(n)||null!=(s=this.lr[r])&&s.persisted)&&this.Or(is,this.br(r),n,r);}}Fr(){var t={},e={flags:{},surveys:{}};return Ar(this.props,((i,r)=>{var s,n=null==(s=hn$1(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i;})),{main:t,groups:e}}Cr(t,e){if(e===Fn$1)return JSON.stringify(t)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return Ar(t,((t,e)=>{var r;i[e]=null!=(r=hn$1(e))&&r.volatile?"__volatile__":t;})),JSON.stringify(i)}Or(t,e,i,r){var s=this.kr(r);if(r===Fn$1||s.dirty||K$1(s.fingerprint)){var n;try{if((n=this.Cr(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0;}t.q(e,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(s.dirty=false,r!==Fn$1&&(s.persisted=true),K$1(n)||(s.fingerprint=n)):this.Te.debug&&_i.warn('failed to persist storage entry "'+e+'"; will retry on next save');}}remove(t){var e=(void 0===t?{}:t).keepGroupEntries,i=void 0!==e&&e;if(K$1(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Je.P(this.vr,false),this.Je.P(this.vr,true),!i&&this.dr)for(var r of an$1)is.P(this.br(r));i?delete this.lr[Fn$1]:this.lr={};}clear(){this.remove(),this.props={};}register_once(t,e,i){if(W$1(t)){K$1(e)&&(e="None"),this.Lr=K$1(i)?this.Nr:i;var r=false;if(Ar(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Tr(i,t),r=true);})),r)return this.save(),true}return false}register(t,e){if(W$1(t)){this.Lr=K$1(e)?this.Nr:e;var i=false;if(Ar(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Tr(r,e),i=true);})),i)return this.save(),true}return false}unregister(t){t in this.props&&(this.Mr(t),this.save());}update_campaign_params(){if(!this.cr){var t=xn$1(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);J$1(Lr(t))||this.register(t),this.cr=true;}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?kn$1(t):{});}update_referrer_info(){var t;this.register_once({$referrer:Rn$1(),$referring_domain:null!=r&&r.referrer&&(null==(t=vn$1(r.referrer))?void 0:t.host)||Tn},void 0);}set_initial_person_info(){this.props[vr$1]||this.props[cr$1]||this.register_once({[fr$1]:Pn(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0);}get_initial_props(){var t={};Ar([cr$1,vr$1],(e=>{var i=this.props[e];i&&Ar(i,(function(e,i){t["$initial_"+j$1(i)]=e;}));}));var e=this.props[fr$1];if(e){var i=function(t,e){ void 0===e&&(e=false);var i=On(t,e),r={};return Ar(i,(function(t,e){r["$initial_"+j$1(e)]=t;})),r}(e,this.Te.disable_capture_url_hashes);Fr(t,i);}return t}safe_merge(t){return Ar(this.props,(function(e,i){i in t||(t[i]=e);})),t}update_config(t,e,i){this.Nr=this.Lr=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var r=t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return false;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),s=r?this.pr(t):this.Je,n=this.gr(t);if(r||n!==this.hr){var o=this.props;this.clear(),this.Je=s,this.hr=n,this.props=o,this.save();}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save();}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:true}),this.save());}set_secure(t){t!==this.Ar&&(this.Ar=t,this.remove({keepGroupEntries:true}),this.save());}set_event_timer(t,e){var i=this.props[ki]||{};i[t]=e,this.Tr(ki,i),this.save();}remove_event_timer(t){var e=this.props[ki]||{},i=e[t];return K$1(i)||(delete e[t],this.Tr(ki,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Tr(t,e),this.save();}Tr(t,e){var i;this.props[t]=e,null!=(i=hn$1(t))&&i.volatile||this.Dr(t);}Mr(t){delete this.props[t],this.Dr(t);}Dr(t){var e,i=null==(e=hn$1(t))?void 0:e.storageGroup;i&&(this.kr(i).dirty=true);}kr(t){return this.lr[t]||(this.lr[t]={})}};var Nn={Activation:"events",Cancellation:"cancelEvents"},Bn$1={Popover:"popover",API:"api",Widget:"widget"},Vn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Gn={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Wn={Popover:"popover",Inline:"inline"},Kn={SHOWN:"product tour shown"},Yn={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Qn=gi("[RateLimiter]");class Xn{constructor(t){this.serverLimits={},this.lastEventRateLimited=false,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{Qn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4;}));}catch(t){return void Qn.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(true).isRateLimited;}get captureEventsPerSecond(){var t;return (null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=false);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(dr))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:true}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(dr,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||false;return false!==e&&(new Date).getTime()<e}}var Zn=gi("[RemoteConfig]");class to{constructor(t){this._instance=t;}get remoteConfig(){var t;return null==(t=v$1._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}qr(t){var e,i;null!=(e=v$1.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=v$1.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t();}jr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json);}});}load(){try{if(this.remoteConfig)return Zn.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void Zn.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return Zn.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((t=>{this.Hr(t),this.Br();}));this.Hr(t),this.Br();}));}catch(t){Zn.error("Error loading remote config",t);}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0);}refresh(){!this._instance.Ur()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags();}Br(){var t;if(!this.zr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.zr=setInterval((()=>{this.refresh();}),e));}}Hr(t){var e;t||Zn.error("Failed to fetch remote config from PostHog."),this._instance.Hr(t?{ok:true,config:t}:{ok:false}),false!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded());}}var io={GZipJS:"gzip-js",Base64:"base64"},ro=Uint8Array,so=Uint16Array,no=Uint32Array,oo=new ro([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]),ao=new ro([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]),lo=new ro([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),uo=function(t,e){for(var i=new so(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new no(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return [i,s]},ho=uo(oo,2),vo=ho[1];ho[0][28]=258,vo[258]=28;for(var co=uo(ao,0)[1],fo=new so(32768),po=0;32768>po;++po){var _o=(43690&po)>>>1|(21845&po)<<1;fo[po]=((65280&(_o=(61680&(_o=(52428&_o)>>>2|(13107&_o)<<2))>>>4|(3855&_o)<<4))>>>8|(255&_o)<<8)>>>1;}var go=function(t,e,i){for(var r=t.length,s=0,n=new so(e);r>s;++s)++n[t[s]-1];var o,a=new so(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;for(o=new so(r),s=0;r>s;++s)o[s]=fo[a[t[s]-1]++]>>>15-t[s];return o},mo=new ro(288);for(po=0;144>po;++po)mo[po]=8;for(po=144;256>po;++po)mo[po]=9;for(po=256;280>po;++po)mo[po]=7;for(po=280;288>po;++po)mo[po]=8;var yo=new ro(32);for(po=0;32>po;++po)yo[po]=5;var bo=go(mo,9),wo=go(yo,5),Eo=function(t){return (t/8>>0)+(7&t&&1)},xo=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof so?so:t instanceof no?no:ro)(i-e);return r.set(t.subarray(e,i)),r},So=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8;},ko=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16;},$o=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return [new ro(0),0];if(1==s){var o=new ro(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new so(v+1),f=To(i[h-1],c,0);if(f>e){r=0;var p=0,_=f-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;p+=g-(1<<f-c[m]),c[m]=e;}for(p>>>=_;p>0;){var y=n[r].s;e>c[y]?p-=1<<e-c[y]++-1:++r;}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p);}f=e;}return [new ro(c),f]},To=function(t,e,i){return -1==t.s?Math.max(To(t.l,e,i+1),To(t.r,e,i+1)):e[t.s]=i},Ro=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new so(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t;},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else {if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0);}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0);}for(;n--;)o(s);n=1,s=t[a];}return [i.subarray(0,r),e]},Po=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Oo=function(t,e,i){var r=i.length,s=Eo(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Io=function(t,e,i,r,s,n,o,a,l,u,h){So(e,h++,i),++s[256];for(var d=$o(s,15),v=d[0],c=d[1],f=$o(n,15),p=f[0],_=f[1],g=Ro(v),m=g[0],y=g[1],b=Ro(p),w=b[0],E=b[1],x=new so(19),S=0;m.length>S;++S)x[31&m[S]]++;for(S=0;w.length>S;++S)x[31&w[S]]++;for(var k=$o(x,7),T=k[0],R=k[1],P=19;P>4&&!T[lo[P-1]];--P);var O,I,C,M,A=u+5<<3,F=Po(s,mo)+Po(n,yo)+o,D=Po(s,v)+Po(n,p)+o+14+3*P+Po(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(F>=A&&D>=A)return Oo(e,h,t.subarray(l,l+u));if(So(e,h,1+(F>D)),h+=2,F>D){O=go(v,c),I=v,C=go(p,_),M=p;var N=go(T,R);for(So(e,h,y-257),So(e,h+5,E-1),So(e,h+10,P-4),h+=14,S=0;P>S;++S)So(e,h+3*S,T[lo[S]]);h+=3*P;for(var U=[m,w],L=0;2>L;++L){var j=U[L];for(S=0;j.length>S;++S)So(e,h,N[B=31&j[S]]),h+=T[B],B>15&&(So(e,h,j[S]>>>5&127),h+=j[S]>>>12);}}else O=bo,I=mo,C=wo,M=yo;for(S=0;a>S;++S)if(r[S]>255){var B;ko(e,h,O[257+(B=r[S]>>>18&31)]),h+=I[B+257],B>7&&(So(e,h,r[S]>>>23&31),h+=oo[B]);var z=31&r[S];ko(e,h,C[z]),h+=M[z],z>3&&(ko(e,h,r[S]>>>5&8191),h+=ao[z]);}else ko(e,h,O[r[S]]),h+=I[r[S]];return ko(e,h,O[256]),h+I[256]},Co=new no([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Mo=function(){for(var t=new no(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i;}return t}(),Ao=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8;};function Fo(t,e){ void 0===e&&(e={});var i=function(){var t=4294967295;return {p(e){for(var i=t,r=0;e.length>r;++r)i=Mo[255&i^e[r]]^i>>>8;t=i;},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new ro(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Oo(l,u,t.subarray(h,d)):(l[h]=true,u=Oo(l,u,t.subarray(h,o)));}else {for(var v=Co[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,_=new so(32768),g=new so(p+1),m=Math.ceil(i/3),y=2*m,b=function(e){return (t[e]^t[e+1]<<m^t[e+2]<<y)&p},w=new no(25e3),E=new so(288),x=new so(32),S=0,k=0,T=(h=0,0),R=0,P=0;o>h;++h){var O=b(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var M=o-h;if((S>7e3||T>24576)&&M>423){u=Io(t,l,0,w,E,x,k,T,P,h-P,u),T=S=k=0,P=h;for(var A=0;286>A;++A)E[A]=0;for(A=0;30>A;++A)x[A]=0;}var F=2,D=0,N=f,U=I-C&32767;if(M>2&&O==b(h-U))for(var L=Math.min(c,M)-1,j=Math.min(32767,h),B=Math.min(258,M);j>=U&&--N&&I!=C;){if(t[h+F]==t[h+F-U]){for(var z=0;B>z&&t[h+z]==t[h+z-U];++z);if(z>F){if(F=z,D=U,z>L)break;var H=Math.min(U,z-2),q=0;for(A=0;H>A;++A){var V=h-U+A+32768&32767,G=V-_[V]+32768&32767;G>q&&(q=G,C=V);}}}U+=(I=C)-(C=_[I])+32768&32767;}if(D){w[T++]=268435456|vo[F]<<18|co[D];var W=31&vo[F],J=31&co[D];k+=oo[W]+ao[J],++E[257+W],++x[J],R=h+F,++S;}else w[T++]=t[h],++E[t[h]];}}u=Io(t,l,true,w,E,x,k,T,P,h-P,u);}return xo(a,0,r+Eo(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Ao(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r);}}(u,e),Ao(u,h-8,i.d()),Ao(u,h-4,r),u}var Do=!!o$1||!!n,No="text/plain",Uo=false,Lo=(t,e)=>{var i=t.split("#"),r=i[1],s=i[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},jo=function(t,e,i){var r;void 0===i&&(i=true);var s=t.split("?"),n=s[0],o=s[1],a=g({},e),l=null!==(r=null==o?void 0:o.split("&").map((t=>{var e,r=t.split("="),s=r[0],n=i&&null!==(e=a[s])&&void 0!==e?e:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Ar(t,(function(t,e){K$1(t)||K$1(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i);})),s.join(e)}(a);return u&&l.push(u),l.length>0?n+"?"+l.join("&"):n},Bo=t=>{if(t.Vr)return t.Vr;var e=t.data,i=t.compression;if(e){if(i===io.GZipJS){var r=Fo(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return (new TextEncoder).encode(t);for(var r=new ro(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t;},o=0;i>o;++o){if(s+5>r.length){var a=new ro(s+8+(i-o<<1));a.set(r),r=a;}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l));}return xo(r,0,s)}(dn$1(e)),{mtime:0});return {contentType:No,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===io.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(dn$1(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:dn$1(t)))(s);return {contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=dn$1(e);return {contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},zo=t=>{var e,i,r=()=>"sendBeacon"===t.transport?{url:jo(t.url,{compression:io.Base64}),encodedBody:Bo(g({},t,{compression:io.Base64,Vr:void 0}))}:{url:Lo(t.url,"compression"),encodedBody:Bo(g({},t,{compression:void 0,Vr:void 0}))};try{e=Bo(t);}catch(e){if(I$1(t.compression,cn$1(t.url,"compression")))return _i.error("Failed to gzip request body, sending uncompressed payload",e),r();throw e}return e&&I$1(t.compression,cn$1(t.url,"compression"))&&!((i=e.body)instanceof ArrayBuffer?O$1(new Uint8Array(i)):ArrayBuffer.isView(i)&&O$1(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Uo=true,r()):{url:t.url,encodedBody:e}},Ho=t=>{try{return zo(t)}catch(e){return _i.error(e),void(null==t.callback||t.callback({statusCode:0,error:e}))}},qo=function(){var t=_$3((function*(t){var e=dn$1(t.data),i=yield function(t,e,i){return F$1.apply(this,arguments)}(e,f.DEBUG,{rethrow:true});if(!i)return t;var r=yield i.arrayBuffer();return g({},t,{Vr:{contentType:No,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),Vo=/Failed to fetch|NetworkError|Load failed/i,Go=t=>{var e=Ho(t);if(e){var i=e.url,r=e.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,u=s.estimatedSize,h=new Headers;Ar(t.headers,(function(t,e){h.append(e,t);})),o&&h.append("Content-Type",o);var d=null,v=false;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var e,i;v=true,c.abort((e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",i));}),t.timeout)};}var f=e=>{v&&"AbortError"===(null==e?void 0:e.name)||(t=>"TypeError"===(null==t?void 0:t.name)&&Vo.test((null==t?void 0:t.message)||""))(e)?_i.warn(e):_i.error(e),null==t.callback||t.callback({statusCode:0,error:e});};try{var p;n(i,g({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Wr&&52428.8>(u||0),body:l,signal:null==(p=d)?void 0:p.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i);}catch(t){_i.error(t);}null==t.callback||t.callback(r);})))).catch(f).finally((()=>d?clearTimeout(d.timeout):null));}catch(t){d&&clearTimeout(d.timeout),f(t);}}},Wo=t=>{try{var e=zo(t),r=e.url,s=e.encodedBody,n=null!=s?s:{},o=n.body,a=n.estimatedSize;if(!o)return;var l=o instanceof Blob?o:new Blob([o],{type:n.contentType});if(i$1.sendBeacon(r,l))return;if(V$1(t.data)&&t.data.length>1&&(null!=a?a:0)>16384){var u=Math.ceil(t.data.length/2);return Wo(g({},t,{data:t.data.slice(0,u)})),void Wo(g({},t,{data:t.data.slice(u)}))}_i.warn("Beacon of ~"+(null!=a?a:0)+" bytes was rejected by the browser, falling back to fetch"),Go(g({},t,{Wr:!0}));}catch(t){_i.warn("Beacon send failed",t);}},Jo=["/e/","/s/"],Ko=(t,e,i,r)=>{var s=(t=>{var e=(t=>{var e=vn$1(t),i=(null==e?void 0:e.pathname)||t.split(/[?#]/)[0];return i?"/"===i[0]?i:"/"+i:"/"})(t);return Jo.some((t=>((t,e)=>t.slice(t.length-e.length)===e)(e,t)))})(t),n=s?Lo(t,"ver"):t,o="query"===r?"POST"===e?"sent_at":"_":void 0;return jo(i===io.GZipJS?Lo(n,"compression"):n,g({},o?{[o]:Date.now().toString()}:{},s?{}:{ver:f.JS_SDK_VERSION},i===io.GZipJS?{}:{compression:i}))},Yo=[];n&&Yo.push({transport:"fetch",method:Go}),o$1&&Yo.push({transport:"XHR",method(t){var e=Ho(t);if(e){var i=new o$1,r=e.encodedBody;i.open(t.method||"GET",e.url,true);var s=null!=r?r:{},n=s.contentType,a=s.body;Ar(t.headers,(function(t,e){i.setRequestHeader(e,t);})),n&&i.setRequestHeader("Content-Type",n),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText);}catch(t){}null==t.callback||t.callback(e);}},i.send(a);}}}),null!=i$1&&i$1.sendBeacon&&Yo.push({transport:"sendBeacon",method:Wo});var Qo=3e3;class Xo{constructor(t,e){this.Zr=true,this.Gr=[],this.Qr=vt$1((null==e?void 0:e.flush_interval_ms)||Qo,250,5e3,_i.createLogger("flush interval"),Qo),this.Jr=t;}enqueue(t){this.Gr.push(t),this.Kr||this.Yr();}unload(){this.Xr();var t=this.Gr.length>0?this.ti():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.ei(g({},t,{transport:"sendBeacon"}));}));}enable(){this.Zr=false,this.Yr();}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var e=this.ti(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&V$1(i.data)&&Ar(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp;})),t.ei(i);};for(var r in e)i();}}),this.Qr));}ei(t){try{this.Jr(t);}catch(t){_i.error(t);}}Xr(){clearTimeout(this.Kr),this.Kr=void 0;}ti(){var t={};return Ar(this.Gr,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;K$1(t[s])&&(t[s]=g({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data);})),this.Gr=[],t}}var Zo=["retriesPerformedSoFar"];let ta$1 = class ta{constructor(e){this.ri=false,this.ii=3e3,this.Gr=[],this._instance=e,this.Gr=[],this.ni=true,!K$1(t)&&"onLine"in t.navigator&&(this.ni=t.navigator.onLine,this.si=()=>{this.ni=true,this.oi();},this.ai=()=>{this.ni=false;},zr(t,"online",this.si),zr(t,"offline",this.ai));}get length(){return this.Gr.length}retriableRequest(t){var e=t.retriesPerformedSoFar,i=m(t,Zo);et$1(e)&&(i.url=jo(i.url,{retry_count:e})),this._instance._send_request(g({},i,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Ot(g({retriesPerformedSoFar:e},i));0===t.statusCode&&_i.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.");}null==i.callback||i.callback(t);}}));}Ot(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Gr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),_i.warn(s),this.ri||(this.ri=true,this.li());}li(){if(this.ui&&clearTimeout(this.ui),0===this.Gr.length)return this.ri=false,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li();}),this.ii);}oi(){var t=Date.now(),e=[],i=this.Gr.filter((i=>t>i.retryAt||(e.push(i),false)));if(this.Gr=e,i.length>0)for(var r of i)this.retriableRequest(r.requestOptions);}unload(){for(var e of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=false,K$1(t)||(this.si&&(t.removeEventListener("online",this.si),this.si=void 0),this.ai&&(t.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var i=e.requestOptions;try{this._instance._send_request(g({},i,{transport:"sendBeacon"}));}catch(t){_i.error(t);}}this.Gr=[];}};let ea$1 = class ea{constructor(t){this.hi=()=>{var t,e,i,r;this.di||(this.di={});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.di.lastScrollY=Math.ceil(n),this.di.maxScrollY=Math.max(n,null!==(t=this.di.maxScrollY)&&void 0!==t?t:0),this.di.maxScrollHeight=Math.max(o,null!==(e=this.di.maxScrollHeight)&&void 0!==e?e:0),this.di.lastContentY=a,this.di.maxContentY=Math.max(a,null!==(i=this.di.maxContentY)&&void 0!==i?i:0),this.di.maxContentHeight=Math.max(l,null!==(r=this.di.maxContentHeight)&&void 0!==r?r:0);},this._instance=t;}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var t=this.di;return setTimeout(this.hi,0),t}startMeasuringScrollPosition(){zr(t,"scroll",this.hi,{capture:true}),zr(t,"scrollend",this.hi,{capture:true}),zr(t,"resize",this.hi);}scrollElement(){if(!this.ci)return null==t?void 0:t.document.documentElement;var e=V$1(this.ci)?this.ci:[this.ci];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}vi(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.ci){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}};var ia$1=t=>Pn(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);let ra$1 = class ra{constructor(t,e,i,r){this.fi=t=>{var e=this.pi();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.gi(this._instance)};this.mi.register({[hr$1]:i});}},this._instance=t,this.yi=e,this.mi=i,this.gi=r||ia$1,this.yi.onSessionId(this.fi);}pi(){return this.mi.props[hr$1]}getSetOnceProps(){var t,e=null==(t=this.pi())?void 0:t.props;return e?"r"in e?On(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return Ar(Lr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+j$1(i)]=e;})),t}};let sa$1 = class sa{on(t,e){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(e),()=>{this.bi[t]=this.bi[t].filter((t=>t!==e));}}emit(t,e){for(var i of this.bi[t]||[])i(e);for(var r of this.bi["*"]||[])r(t,e);}constructor(){this.bi={};}};var na$1=gi("[SessionId]");let oa$1 = class oa{on(t,e){return this.wi.on(t,e)}constructor(t,e,i){var r;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=false,this.wi=new sa$1,this.Ii=(t,e)=>!(!et$1(t)||!et$1(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===xr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ti=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=e||Yr,this.Ri=i||Yr;var s=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*vt$1(this.Te.session_idle_timeout_seconds||1800,60,36e3,na$1.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+s+"_window_id",this.Fi="ph_"+s+"_primary_window_exists",this.Li()){var n=as.F(this.Oi),o=as.F(this.Fi);n&&!o?this.Ti=n:as.P(this.Oi),as.q(this.Fi,true);}if(null!=(r=this.Te.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Te.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.$i(this.Te.bootstrap.sessionID,(new Date).getTime(),a);}catch(t){na$1.error("Invalid sessionID in bootstrap",t);}this.Ai();}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return K$1(this.ki)&&(this.ki=[]),this.ki.push(t),this.Mi&&t(this.Mi,this.Ti),()=>{this.ki=this.ki.filter((e=>e!==t));}}Li(){return "memory"!==this.Te.persistence&&!this.mi.yr&&as.N()}Ni(t){t!==this.Ti&&(this.Ti=t,this.Li()&&as.q(this.Oi,t));}Di(){return this.Ti?this.Ti:this.Li()?as.F(this.Oi):null}qi(t){var e=this.xi;return !X$1(e)&&!X$1(t)&&5e3>Math.abs(t-e)}$i(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Mi=t,s&&!r||s&&this.qi(e)||(this.xi=e,this.mi.register({[Bi]:[e,t,i]}));}ji(){var t,e=null==(t=this.Te)?void 0:t.persistence_save_debounce_ms;return et$1(e)&&e>0}Hi(){this.ji()?this.mi.refreshKey(Bi):(this.mi.flush(),this.mi.load());}Bi(){var t;if(!X$1(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var e=this.Ui();e[1]===this.Mi&&e[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[Bi]:[this._sessionActivityTimestamp,null!==(t=this.Mi)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.mi.flush());}}zi(){var t=this.Ui()[0],e=et$1(t)?t:0,i=et$1(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}Vi(t){return this.Hi(),this.Ii(t,this.zi())}Ui(){var t=this.mi.props[Bi];return V$1(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null);}destroy(){this.Ci=true,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&t&&(t.removeEventListener(Rr,this.Si,{capture:false}),this.Si=void 0),this.ki=[];}Ai(){this.Si=()=>{this.Bi(),this.Li()&&as.P(this.Fi);},zr(t,Rr,this.Si,{capture:false});}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=false),void 0===e&&(e=null),this.Te.cookieless_mode===xr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),r=this.Ui(),s=r[1],n=r[2],o=this.zi(),a=this.Di(),l=et$1(n)&&Math.abs(i-n)>864e5,u=false,h=false,d=!s,v=s,c=!d&&!t&&this.Ii(i,o);if(c){(c=this.Vi(i))||na$1.info("cross-tab refresh kept the session alive",{sessionId:s});var f=this.Ui();s=f[1],n=f[2];}d||c||l?(s=this.Ei(),a=this.Ri(),na$1.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l}}),n=i,u=true):(a||(a=this.Ri(),u=true),(h=s!==v)&&(na$1.info("adopted cross-tab session id",{sessionId:s,windowId:a}),u=true));var p=et$1(o)&&t&&!l?o:i,_=et$1(n)?n:(new Date).getTime();this.Ni(a),this.$i(s,p,_),t||this.Pi();var g={noSessionId:d,activityTimeout:c,sessionPastMaximumLength:l,crossTabAdoption:h};return u&&this.ki.forEach((t=>t(s,a,g))),{sessionId:s,windowId:a,sessionStartTimestamp:_,changeReason:u?g:void 0,lastActivityTimestamp:o}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi((new Date).getTime())){var t=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:t});}else this.Pi();}),1.1*this.sessionTimeoutMs));}};var aa$1=function(t,e){if(!t)return false;var i=t.userAgent;if(i&&N$1(i,e))return true;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>N$1(null==t?void 0:t.brand,e))))return !0}catch(t){}return !!t.webdriver};function la$1(){return (la$1=_$3((function*(){var t=null==i$1?void 0:i$1.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var e=yield t.getHighEntropyValues(["model"]),r=null==e?void 0:e.model;return Y$1(r)&&r.length>0?r:void 0}catch(t){return void _i.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}var ua$1=function(t,e){if(!function(t){try{new RegExp(t);}catch(t){return false}return true}(e))return false;try{return new RegExp(e).test(t)}catch(t){return false}};function ha$1(t,e,i){return dn$1({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var da$1={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>ua$1(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!ua$1(e,t))))),icontains:(t,e)=>e.map(va$1).some((e=>t.map(va$1).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(va$1).every((e=>t.map(va$1).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return !isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return !isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},va$1=t=>t.toLowerCase();function ca$1(t,e){return !t||Object.entries(t).every((t=>{var i=t[1],r=null==e?void 0:e[t[0]];if(K$1(r)||X$1(r))return false;var s=[String(r)],n=da$1[i.operator];return !!n&&n(i.values,s)}))}var fa="custom",pa$1="i.posthog.com",_a$2=/^\/static\//;let ga$1 = class ga{constructor(t){this.Zi={},this.instance=t;}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return "https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+pa$1,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.Zi[this.apiHost]||(this.Zi[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":fa),this.Zi[this.apiHost]}Gi(t){if(_a$2.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)return e.trim().replace(/\/$/,"")||void 0}}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.Gi(e);if(i)return ""+i+e}if(this.region===fa)return this.apiHost+e;var r=pa$1+e;switch(t){case "assets":return "https://"+this.region+"-assets."+r;case "api":return "https://"+this.region+"."+r}}};function ma$1(t){var e;return !(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}var ya$1=gi("[Surveys]"),ba$1="seenSurvey_",wa$1=t=>{try{var e=(t=>((t,e)=>""+ba$1+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(e))(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true");}catch(t){ya$1.error("Failed to persist survey seen state",t);}},Ea$1=[Bn$1.Popover,Bn$1.Widget,Bn$1.API],xa$1={ignoreConditions:false,ignoreDelay:false,displayType:Wn.Popover},Sa$1=gi("[PostHog ExternalIntegrations]"),ka={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};let $a$1 = class $a{constructor(t){this._instance=t;}tr(t,e){var i;null==(i=v$1.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Sa$1.error("failed to load script",t);e();}));}startIfEnabledOrStop(){var t=this,e=function(){var e,r,s,n=i[0],o=i[1];!o||null!=(e=v$1.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.tr(ka[n],(()=>{var e;null==(e=v$1.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance);})),!o&&null!=(r=v$1.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=v$1.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop());};for(var i of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;e();}}};var Ta$1={},Ra$1=0,Pa$1=()=>{},Oa$1='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ia$1="Surveys module not available",Ca$1="sanitize_properties is deprecated. Use before_send instead",Ma$1="Invalid value for property_denylist config: ",Aa$1=["token","distinct_id",gr],Fa$1="posthog",Da$1=!Do&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),Na$1=e=>{var i;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:true,cross_subdomain_cookie:Br(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Pa$1,save_campaign_params:true,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:true,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:false,__preview_external_dependency_versioned_paths:false,__preview_cookie_wins_on_conflict:false,debug:s$1&&Y$1(null==s$1?void 0:s$1.search)&&-1!==s$1.search.indexOf("__posthog_debug=true")||false,cookie_expiration:365,upgrade:false,disable_session_recording:false,disable_persistence:false,disable_web_experiments:true,disable_surveys:false,disable_surveys_automatic_display:false,disable_conversations:false,disable_product_tours:false,disableDeviceModel:false,disable_external_dependency_loading:false,strict_script_versioning:false,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:false,opt_out_capturing_by_default:false,opt_out_persistence_by_default:false,opt_out_useragent_filter:false,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:false,property_denylist:[],respect_dnt:false,sanitize_properties:null,request_headers:{},request_batching:true,properties_string_max_length:65535,mask_all_element_attributes:false,mask_all_text:false,mask_personal_data_properties:false,custom_personal_data_properties:[],advanced_disable_flags:false,advanced_disable_decide:false,advanced_disable_feature_flags:false,advanced_disable_feature_flags_on_first_load:false,advanced_only_evaluate_survey_feature_flags:false,advanced_feature_flags_dedup_per_session:false,advanced_enable_surveys:false,advanced_disable_toolbar_metrics:false,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){_i.error("Bad HTTP status: "+t.statusCode+" "+t.text);},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:false,session_idle_timeout_seconds:1800,person_profiles:$r,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:Qo},error_tracking:{},_onCapture:Pa$1},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Is,ignore_text_selection:true}:!t||"2025-11-30">t||{content_ignorelist:true},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-06-25"?{strictMinimumDuration:true,canvasCapture:{resolutionScale:.6},streamNetworkBody:true}:t&&t>="2026-05-30"?{strictMinimumDuration:true,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:true}:{},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)}))(e))},Ua$1=[["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"]],La$1=t=>{var e={};for(var i of Ua$1){var r=i[0],s=i[1];K$1(t[r])||(e[s]=t[r]);}var n=Fr({},e,t),o=t.__preview_external_dependency_versioned_paths;return K$1(o)||(K$1(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),Y$1(o)&&K$1(t.asset_host)&&(n.asset_host=o)),V$1(t.property_blacklist)&&(K$1(t.property_denylist)?n.property_denylist=t.property_blacklist:V$1(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:_i.error(Ma$1+t.property_denylist)),n};let ja$1 = class ja{constructor(){this.__forceAllowLocalhost=false;}get Qi(){return this.__forceAllowLocalhost}set Qi(t){_i.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t;}};let Ba$1 = class Ba{Ji(t,e){if(t){var i=this.Ki.indexOf(t);-1!==i&&this.Ki.splice(i,1);}return this.Ki.push(e),null==e.initialize||e.initialize(),e}Yi(){return this.config.cookieless_mode===xr||this.config.cookieless_mode===Er&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new ja$1,this.Xi=false,this.version=f.LIB_VERSION,this.tn=new sa$1,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Na$1(),this.SentryIntegration=nn$1,this.sentryIntegration=t=>function(t,e){var i=sn$1(t,e);return {name:rn$1,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=false,this.analyticsDefaultEndpoint="/e/",this.en=false,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new ea$1(this),this.pageViewManager=new on$2(this),this.rateLimiter=new Xn(this),this.requestRouter=new ga$1(this),this.consent=new ls(this),this.externalIntegrations=new $a$1(this);var e=null!==(t=Ba.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=Y$1(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({});},set_once:(t,e,i)=>{var r=Y$1(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({});}},this.on("eventCaptured",(t=>_i.info('send "'+(null==t?void 0:t.event)+'"',t)));}init(t,e,i){if(i&&i!==Fa$1){var r,s=null!==(r=Ta$1[i])&&void 0!==r?r:new Ba;return s._init(t,e,i),Ta$1[i]=s,Ta$1[Fa$1][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o=Y$1(e)?e.trim():"";if(!o)return _i.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 console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=true,this.config=Na$1(i.defaults),i.debug=this.an(i.debug),this.ln=i,this.un=[],i.person_profiles?this.nn=i.person_profiles:i.process_person&&(this.nn=i.process_person);var a=Na$1(i.defaults),l=La$1(i),u=Fr({},a,l,{name:r,token:o});W$1(a.rageclick)&&W$1(l.rageclick)&&(u.rageclick=Fr({},a.rageclick,l.rageclick)),W$1(a.session_recording)&&W$1(l.session_recording)&&(u.session_recording=Fr({},a.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&_i.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:io.GZipJS;var h=this.hn();this.persistence=new Dn$1(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Dn$1(g({},this.config,{persistence:"sessionStorage"}),h,false);var d=g({},this.persistence.props),v=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.dn=new Xo((t=>this.cn(t)),this.config.request_queue_config),this.vn=new ta$1(this),this.__request_queue=[];var c=this.Yi();if(c||(this.sessionManager=new oa$1(this),this.sessionPropsManager=new ra$1(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(_i.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(c);}),0)):(_i.info("Initializing extensions synchronously"),this.fn(c)),f.DEBUG=f.DEBUG||this.config.debug,f.DEBUG&&_i.info("Starting in debug mode",{this:this,config:i,thisC:g({},this.config),p:d,s:v}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=g({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:true})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var p=i.bootstrap.distinctID,_=this.get_distinct_id(),m=this.persistence.get_property(ur$1);if(i.bootstrap.isIdentifiedID&&null!=_&&_!==p&&m===Sr$1)this.identify(p);else if(i.bootstrap.isIdentifiedID&&null!=_&&_!==p&&m===kr)_i.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 y=this.config.get_device_id(Yr()),b=i.bootstrap.isIdentifiedID?y:p;this.persistence.set_property(ur$1,i.bootstrap.isIdentifiedID?kr:Sr$1),this.register({distinct_id:p,$device_id:b});}}if(c)this.register_once({distinct_id:_r$1,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Yr());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(ur$1,Sr$1);}return zr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:false}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Yr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(ur$1,kr)),e();},s=i.user();"then"in s&&G$1(s.then)?s.then(r):r(s);}(t,(()=>{i.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||en$1.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(en$1.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(en$1.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return {name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>true,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,Pr),identify:t=>e(t,Ir),screen:t=>e(t,"$screen")}})(t)).then((()=>{e();}));}));}(this,(()=>this.pn())):this.pn(),G$1(this.config._onCapture)&&this.config._onCapture!==Pa$1&&(_i.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&_i.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 la$1.apply(this,arguments)}().then((t=>{t&&this.register({[xi]:t});})).catch(Pa$1),this}fn(t){var e,i,r,s,n,o,a,l,u=performance.now(),h=g({},Ba.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ki.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.Ki.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.Ki.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ki.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Ki.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ki.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition();})),h.autocapture&&this.Ki.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ki.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new h.surveys(this)),h.logs&&this.Ki.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new h.logs(this)),h.metrics&&this.Ki.push(this.metrics=null!==(n=this.metrics)&&void 0!==n?n:new h.metrics(this)),h.conversations&&this.Ki.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Ki.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ki.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ki.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Zs)),h.toolbar&&this.Ki.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Ki.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Ki.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize();}));})),d.push((()=>{if(this.gn){var t=this.gn;this.gn=void 0,this.Hr(t);}})),this.mn(d,u);}mn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.mn(t,e);}),0);var i=t.shift();if(i)try{i();}catch(t){_i.error("Error initializing extension:",t);}}var r=Math.round(performance.now()-e);this.register_for_session({[mr$1]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[yr]:r}),this.config.__preview_deferred_init_extensions&&_i.info("PostHog extensions initialized ("+r+"ms)");}Hr(t){if(!r||!r.body)return _i.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(t);}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=t),this.yn=t,this.compression=void 0,t.ok){var e,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=U$1(i.supportedCompression,io.GZipJS)?io.GZipJS:U$1(i.supportedCompression,io.Base64)?io.Base64:void 0),null!=(e=i.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint);}this.set_config({person_profiles:this.nn?this.nn:$r}),this.Ki.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)));}pn(){try{this.config.loaded(this);}catch(t){_i.critical("`loaded` function failed",t);}if(this.bn(),this.config.internal_or_test_user_hostname&&null!=s$1&&s$1.hostname){var t=s$1.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser();}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Yi())&&this._n();}),1),this.wn=new to(this),this.wn.load();}bn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.dn)||t.enable());}_dom_loaded(){this.is_capturing()&&Mr(this.__request_queue,(t=>this.cn(t))),this.__request_queue=[],this.bn();}_handle_unload(){var t,e,i,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(e=this.metrics)||e.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture(Or),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(r=this.dn)||r.unload(),null==(s=this.vn)||s.unload()):this.xn()&&this.capture(Or,null,{transport:"sendBeacon"});}_send_request(t){this.__loaded?Da$1?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=g({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(K$1(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=g({},t);s.timeout=s.timeout||6e4;var n=null!==(e=s.transport)&&void 0!==e?e:"fetch";"sendBeacon"===n&&K$1(s.compression)&&s.data&&(s.compression=io.Base64),"body"===s.timestampMode&&"POST"===s.method&&s.data&&!V$1(s.data)&&(s.data=g({},s.data,{sent_at:(new Date).toISOString()})),s.url=Ko(s.url,s.method,s.compression,s.timestampMode);var o=Yo.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===io.GZipJS&&l&&"undefined"!=typeof Promise&&!Uo?qo(s).then((t=>{a(t);})).catch((e=>{if(C(e))return Uo=true,void a(g({},s,{compression:void 0,url:Ko(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return false;var e="name"in t?String(t.name):"";return C(t)||e===P$1})(e)&&(Uo=true),a(s);})):a(s);})(g({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e);}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}));}cn(t){this.vn?this.vn.retriableRequest(t):this._send_request(t);}_execute_array(t){Ra$1++;try{var e,i=[],r=[],s=[];Mr(t,(t=>{if(t)if(V$1(e=t[0]))s.push(t);else if(G$1(t))try{t.call(this);}catch(e){_i.error("Error executing queued PostHog call",t,e);}else V$1(t)&&"alias"===e?i.push(t):V$1(t)&&-1!==e.indexOf("capture")&&G$1(this[e])?s.push(t):r.push(t);}));var n=function(t,e){Mr(t,(function(t){try{if(V$1(t[0])){var i=e;Ar(t,(function(t){i=i[t[0]].apply(i,t.slice(1));}));}else e[t[0]].apply(e,t.slice(1));}catch(e){_i.error("Error executing queued PostHog call",t,e);}}));};n(i,this),n(r,this),n(s,this);}finally{Ra$1--;}}push(t){if(Ra$1>0&&V$1(t)&&Y$1(t[0])){var e=Ba.prototype[t[0]];G$1(e)&&e.apply(this,t.slice(1));}else this._execute_array([t]);}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!K$1(t)&&Y$1(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!Y$1(null==e?void 0:e.$current_url)&&(_i.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.kn||_i.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=(null==i?void 0:i.timestamp)||h,v=ye$2(null==i?void 0:i.uuid,Yr),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===Pr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens);var f="$feature_flag_called"===t&&false===c.properties.$feature_flag_has_experiment&&true===this.get_property(Ki);(null==i?void 0:i.$set)&&!f&&(c.$set=null==i?void 0:i.$set);var p=null==i?void 0:i.$unset;p&&(c.$unset=p);var _,m,y,b=f?void 0:this.Sn(null==i?void 0:i.$set_once,t!==Cr,t===Ir);if(b&&(c.$set_once=b),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>Y$1(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){if(e!==Object(e))return o?o(e):e;if(!a.has(e)){var r;if(a.add(e),V$1(e))r=[],Mr(e,(e=>{r.push(t(e));}));else {var s={};Ar(e,((e,i)=>{a.has(e)||(s[i]=t(e));})),r=s;}return r}}(n)),c.timestamp=d,K$1(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=true,c.properties.$event_time_override_system_time=h),f&&(c.properties=function(t,e){ void 0===e&&(e=[]);var i={},r=e=>{ void 0!==t[e]&&(i[e]=t[e]);};return x$1.forEach(r),e.forEach(r),i}(c.properties,Aa$1)),t===Vn.DISMISSED||t===Vn.SENT){var w=null==e?void 0:e[Gn.SURVEY_ID],E=null==e?void 0:e[Gn.SURVEY_ITERATION];wa$1({id:w,current_iteration:E}),c.$set=g({},c.$set,{[(_={id:w,current_iteration:E},m=t===Vn.SENT?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:true});}else t===Vn.SHOWN&&(c.$set=g({},c.$set,{[Gn.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Kn.SHOWN){var S=null==e?void 0:e[Yn.TOUR_TYPE];S&&(c.$set=g({},c.$set,{[Yn.TOUR_LAST_SEEN_DATE+"/"+S]:(new Date).toISOString()}));}var k=g({},c.properties.$set,c.$set);if(J$1(k)||this.setPersonPropertiesForFlags(k),!Z$1(this.config.before_send)){var T=this.Rt(c);if(!T)return;(c=T).uuid=ye$2(c.uuid,Yr);}this.tn.emit("eventCaptured",c);var R={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",timestampMode:"query",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return !this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.cn(R):this.dn.enqueue(R),c}_i.critical("This capture call is ignored due to client rate limiting.");}}else _i.error("No event name provided to posthog.capture");}else _i.uninitializedWarning("posthog.capture");}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=g({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Yi()&&(h[gr]=true),"$snapshot"===e){var d=g({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!Y$1(h.distinct_id)&&!tt$1(h.distinct_id)||Q$1(h.distinct_id))&&_i.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var v,c=function(e,i,r,n){var o,a,l,h;if(void 0===n&&(n=false),!u)return {};var d,v=e?[...yn$1,...i||[]]:[],c=function(t){for(var e=0;_e$2.length>e;e++){var i=_e$2[e],r=i[1],s=i[0].exec(t),n=s&&(G$1(r)?r(s,t):r);if(n)return n}return ["",""]}(u),p=c[0],_=c[1],g=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:true}:{},m={};K$1(r)||(m.detectGoogleSearchApp=r);var y={},b=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,w=null==(a=navigator)?void 0:a.maxTouchPoints,E=null==t||null==(l=t.screen)?void 0:l.width,x=null==t||null==(h=t.screen)?void 0:h.height,S=null==t?void 0:t.devicePixelRatio;K$1(b)||(y.userAgentDataPlatform=b),K$1(w)||(y.maxTouchPoints=w),K$1(E)||(y.screenWidth=E),K$1(x)||(y.screenHeight=x),K$1(S)||(y.devicePixelRatio=S);var k,T,R,P,O,I,C,M,A=Fr(Lr({$os:p,$os_version:_,$browser:ce$2(u,navigator.vendor,g,m),$device:ge$2(u),$device_type:(T=u,R=y,M=ge$2(T),M===yt$1||M===mt$1||"Kobo"===M||"Kindle Fire"===M||M===Kt$1?gt$1:M===Ut$1||M===jt$1||M===Lt$1||M===Gt$1?"Console":M===wt$1?"Wearable":M?ft$1:"Android"===(null==R?void 0:R.userAgentDataPlatform)&&(null!==(P=null==R?void 0:R.maxTouchPoints)&&void 0!==P?P:0)>0?600>Math.min(null!==(O=null==R?void 0:R.screenWidth)&&void 0!==O?O:0,null!==(I=null==R?void 0:R.screenHeight)&&void 0!==I?I:0)/(null!==(C=null==R?void 0:R.devicePixelRatio)&&void 0!==C?C:1)?ft$1:gt$1:"Desktop"),$timezone:In$1(),$timezone_offset:Cn$1()}),{$current_url:fn$1(n?be$1(null==s$1?void 0:s$1.href):null==s$1?void 0:s$1.href,v,wn$1),$host:null==s$1?void 0:s$1.host,$pathname:null==s$1?void 0:s$1.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:pe$2(u,navigator.vendor,g,m),$browser_language:$n(),$browser_language_prefix:(k=$n(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:f.LIB_NAME,$lib_version:f.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return f.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=f.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 p=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime()),_=p.windowId;h.$session_id=p.sessionId,h.$window_id=_;}this.sessionPropsManager&&Fr(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&Fr(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.vn)?void 0:m.length;}catch(t){h.$sdk_debug_error_capturing_properties=String(t);}if(this.requestRouter.region===fa&&(h.$lib_custom_api_host=this.config.api_host),v=e!==Pr||a?e!==Or||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=Fr(h,v),e===Pr&&r&&(h.title=r.title),!K$1(l)){var y=n.getTime()-l;h.$duration=parseFloat((y/1e3).toFixed(3));}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties();Ar(["$referrer","$referring_domain"],(t=>{t in b&&delete w[t];})),(h=Fr({},c,b,w,h)).$is_identified=this._isIdentified(),V$1(this.config.property_denylist)?Ar(this.config.property_denylist,(function(t){delete h[t];})):_i.error(Ma$1+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var E=this.config.sanitize_properties;E&&(_i.error(Ca$1),h=E(h,e));var x=this.Cn();return h.$process_person_profile=x,x&&!a&&this.In("_calculate_event_properties"),h}Sn(t,e,i){var r;if(void 0===e&&(e=true),void 0===i&&(i=false),!this.persistence||!this.Cn())return t;if(this.Xi&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Fr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(_i.error(Ca$1),o=a(o,"$set_once")),e&&(this.Xi=true),J$1(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e);}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i);}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t);}unregister(t){var e;null==(e=this.persistence)||e.unregister(t);}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t);}Tn(t,e){this.register({[t]:e});}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,r;return null!==(i=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags();}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i);}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i);}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=false),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.tn.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:true}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:false,error:Ia$1}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){ void 0===e&&(e=false),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:false,error:Ia$1});}getActiveMatchingSurveys(t,e){ void 0===e&&(e=false),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:false,error:Ia$1});}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e);}displaySurvey(t,e){var i;void 0===e&&(e=xa$1),null==(i=this.surveys)||i.displaySurvey(t,e);}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t);}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:false,disabledReason:Ia$1}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=false),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:false,disabledReason:Ia$1})}Mn(t){return !t||Q$1(t)?(_i.critical("Unique user id has not been set in posthog.identify"),false):t===_r$1?(_i.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),false):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(_i.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.'),false)}identify(t,e,i){if(!this.__loaded||!this.persistence)return _i.uninitializedWarning("posthog.identify");if(tt$1(t)&&(t=t.toString(),_i.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(t)&&this.In("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Ei)||this.register_once({$had_persisted_distinct_id:true,$device_id:r},""),t!==r&&t!==this.get_property(Si)&&(this.unregister(Si),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(ur$1)||Sr$1)===Sr$1;t!==r&&n?(this.persistence.set_property(ur$1,kr),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},false),this.capture(Ir,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.sn=ha$1(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(nr$1));}}setPersonProperties(t,e){if((t||e)&&this.In("posthog.setPersonProperties")){var i=ha$1(this.get_distinct_id(),t,e);this.sn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},true),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.sn=i):_i.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.");}}unsetPersonProperties(t){var e,i=(V$1(t)?t:[t]).filter((t=>Y$1(t)&&t.length>0));0!==i.length&&this.In("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,true),this.capture("$set",{$unset:i}),this.sn=null);}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(Cr,n);}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags();}else _i.error("posthog.group requires a group type and group key");}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags();}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=true),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e);}resetPersonPropertiesForFlags(t){var e;void 0===t&&(t=true),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t);}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=true),this.In("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e));}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t);}reset(t){var e,i,r,s,n,o,a,l,u,h;if(_i.info("reset"),!this.__loaded)return _i.uninitializedWarning("posthog.reset");var d,v=this.get_property(Ei),c=this.get_property(xi),f=this.get_property(Fi);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),K$1(f)||null==(d=this.persistence)||d.register({[Fi]:f}),null==(r=this.surveys)||r.reset(),null==(s=this.wn)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.logs)||a.reset(),null==(l=this.metrics)||l.reset(),null==(u=this.persistence)||u.set_property(ur$1,Sr$1),null==(h=this.sessionManager)||h.resetSessionId(),this.sn=null,this.config.cookieless_mode===xr)this.register_once({distinct_id:_r$1,$device_id:null},"");else {var p=this.config.get_device_id(Yr());this.register_once({distinct_id:p,$device_id:t?p:v},""),t||K$1(c)||this.register({[xi]:c});}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags();}shutdown(t){var e=this;return _$3((function*(){var t,i,r,s,n;e.__loaded?(null==(t=e.logs)||t.flushLogs("sendBeacon"),null==(i=e.metrics)||i.flush("sendBeacon"),null==(r=e.dn)||r.unload(),null==(s=e.vn)||s.unload(),null==(n=e.featureFlags)||n.destroy()):_i.uninitializedWarning("posthog.shutdown");}))()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.En();}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Rn();}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(true).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return "";var e=this.sessionManager.checkAndGetSessionAndWindowId(true),i=e.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e.sessionId);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0);}return r}alias(t,e){return t===this.get_property(wi)?(_i.critical("Attempting to create alias for existing People user - aborting."),-2):this.In("posthog.alias")?(K$1(e)&&(e=this.get_distinct_id()),t!==e?(this.Tn(Si,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(_i.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=g({},this.config);if(W$1(t)){var i,r,s,n,o,a,l,u,h,d,v;Fr(this.config,La$1(t));var c=this.hn();null==(i=this.persistence)||i.update_config(this.config,e,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Dn$1(g({},this.config,{persistence:"sessionStorage"}),c,false);var p=this.an(this.config.debug);it$1(p)&&(this.config.debug=p),it$1(this.config.debug)&&(this.config.debug?(f.DEBUG=true,is.N()&&is.q("ph_debug",true),_i.info("set_config",{config:t,oldConfig:e,newConfig:g({},this.config)})):(f.DEBUG=false,is.N()&&is.P("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.Pn(),null==(v=this.externalIntegrations)||v.startIfEnabledOrStop();}}_overrideSDKInfo(t,e){f.LIB_NAME=t,f.LIB_VERSION=e;}startSessionRecording(t){var e,i,r,s,n,o=true===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:false});}stopSessionRecording(){this.set_config({disable_session_recording:true});}sessionRecordingStarted(){var t;return !(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:true,syntheticException:i});return this.exceptions.sendExceptionEvent(g({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e);}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t);}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:Ba.On}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t});}stopExceptionAutocapture(){this.set_config({capture_exceptions:false});}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Fa$1;return e!==Fa$1&&(e=Fa$1+"."+e),e}_isIdentified(){var t,e;return (null==(t=this.persistence)?void 0:t.get_property(ur$1))===kr||(null==(e=this.sessionPersistence)?void 0:e.get_property(ur$1))===kr}Cn(){var t,e;return !("never"===this.config.person_profiles||this.config.person_profiles===$r&&!this._isIdentified()&&J$1(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Si])&&(null==(e=this.persistence)||null==(e=e.props)||!e[pr]))}xn(){return true===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(true===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Cn()||this.In("posthog.createPersonProfile")&&this.setPersonProperties({},{});}setInternalOrTestUser(){this.In("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:true});}In(t){return "never"===this.config.person_profiles?(_i.error(t+' was called, but process_person is set to "never". This call will be ignored.'),false):(this.Tn(pr,true),true)}hn(){if("always"===this.config.cookieless_mode)return true;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Er)}Pn(){var t,e,i,r,s=this.hn();return (null==(t=this.persistence)?void 0:t.yr)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.yr)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==xr){if(this.Yi()){var i,r,s,n,o;this.reset(true),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new oa$1(this),this.pageViewManager=new on$2(this),this.persistence&&(this.sessionPropsManager=new ra$1(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=Ba.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Ji(this.sessionRecording,new l(this)),this.yn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.yn)));}var u,h;this.consent.optInOut(true),this.Pn(),this.bn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Er&&(null==(u=this.surveys)||u.loadIfEnabled()),(K$1(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:true}),this.config.capture_pageview&&this._n();}else _i.warn(Oa$1);}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==xr?(this.config.cookieless_mode===Er&&this.consent.isOptedIn()&&this.reset(true),this.consent.optInOut(false),this.Pn(),this.config.cookieless_mode===Er&&(this.register({distinct_id:_r$1,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this._n(),this.bn())):_i.warn(Oa$1);}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===xr||(this.config.cookieless_mode===Er?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn();}_is_bot(){return i$1?aa$1(i$1,this.config.custom_blocked_useragents):void 0}_n(){r&&("visible"===r.visibilityState?this.en||(this.en=true,this.capture(Pr,{title:r.title},{send_instantly:true}),this.rn&&(r.removeEventListener(Tr,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),zr(r,Tr,this.rn)));}debug(e){ false===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:false})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:true}));}Ur(){var t=this.ln||{};return "advanced_disable_flags"in t?!!t.advanced_disable_flags:false!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:true===this.config.advanced_disable_decide?(_i.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."),true):function(t,e,i,r,s){var n=e in t&&!Z$1(t[e]),o=i in t&&!Z$1(t[i]);return n?t[e]:!!o&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,_i)}Rt(t){var e;if(Z$1(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(nt$1),r=V$1(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),Z$1(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return st$1(t.event)?_i.warn(o+". This can cause unexpected behavior."):_i.info(o),null}s.properties&&!J$1(s.properties)||_i.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.");}for(var a of i)if(s.properties&&Z$1(s.properties[a]))return _i.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.ir)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e});}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)});}an(t){var e=it$1(t)&&!t,i=is.N()&&"true"===is.A("ph_debug");return !e&&(!!i||t)}};Ba$1.__defaultExtensionClasses={},Ba$1.On=(()=>{var t=()=>{};return {trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Ur(t.prototype[e[i]]);}(Ba$1,["identify"]);let za$1 = class za{constructor(t){this.disabled=false===t;var e=W$1(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[];}isRageClick(t,e,i){if(this.disabled)return false;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return true}else this.clicks=[{x:t,y:e,timestamp:i}];return false}};var Ha$1="$copy_autocapture",qa$1=gi("[AutoCapture]");function Va$1(t,e){return e.length>t?e.slice(0,t)+"...":e}function Ga$1(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling;}while(e&&!ps(e));return e}function Wa$1(e,i){var r,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,u=i.elementsChainAsString,h=i.disableCaptureUrlHashes;if(!ps(e))return {props:{}};for(var d=[e],v=new Set([e]),c=e;c.parentNode&&!_s(c,"body")&&ys>d.length;)if(ms(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f;}else {if(!ps(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode;}var p,_,m=[],y={},b=false,w=false;if(Ar(d,(t=>{var e=Us(t);if(_s(t,"a")){var i=t.getAttribute("href");b=!!(e&&i&&Gs(i))&&(h?be$1(i):i);}U$1(Es(t),"ph-no-capture")&&(w=true),m.push(function(t,e,i,r,s){ void 0===s&&(s=false);var n=t.tagName.toLowerCase(),o={tag_name:n};$s.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Va$1(1024,Ws(t)):Va$1(1024,Ss(t)));var a=Es(t);a.length>0&&(o.classes=a.filter((function(t){return ""!==t}))),Ar(t.attributes,(function(i){var n;if((!Ls(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Gs(i.value)&&(!Y$1(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=bs(a).join(" ")),o["attr__"+i.name]=Va$1(1024,"href"===i.name&&s?be$1(a):a);}}));for(var l=1,u=1,h=t;h=Ga$1(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,o,a,l,h));var r=function(t){if(!Us(t))return {};var e={};return Ar(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&Gs(r)&&(e[i]=r);}})),e}(t);Fr(y,r);})),w)return {props:{},explicitNoCapture:w};if(a||(m[0].$el_text=_s(e,"a")||_s(e,"button")?Ws(e):Ss(e)),b){var E,x;m[0].attr__href=b;var S=null==(E=vn$1(b))?void 0:E.host,k=null==t||null==(x=t.location)?void 0:x.host;S&&k&&S!==k&&(p=b);}return {props:Fr({$event_type:n.type,$ce_version:1},u?{}:{$elements:m},{$elements_chain:(_=m,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=g({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Dr(n).sort(((t,e)=>t[0].localeCompare(e[0]))).forEach((t=>{var e=t[1];return o[Ks(t[0].toString())]=Ks(e.toString())})),(r+=":")+Dr(o).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Ys(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dr(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=m[0])&&r.$el_text?{$el_text:null==(s=m[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},y)}}var Ja$1=gi("[ExceptionAutocapture]"),Ka$1=()=>{},Ya$1=gi("[TracingHeaders]"),Qa$1=gi("[Web Vitals]"),Xa$1=9e5,Za$1="disabled",tl="lazy_loading",el="awaiting_config",il="missing_config";gi("[SessionRecording]"),gi("[SessionRecording]");var rl="[SessionRecording]",sl=gi(rl),nl=gi("[Heatmaps]");function ol(t){return W$1(t)&&"clientX"in t&&"clientY"in t&&tt$1(t.clientX)&&tt$1(t.clientY)}var al=gi("[Product Tours]"),ll=t=>{var e;return !t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(Mi))},ul=["$set_once","$set"],hl=gi("[SiteApps]"),dl="Error while initializing PostHog app with config id ";function vl(t,e,i){if(Z$1(t))return false;switch(i){case "exact":return t===e;case "contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case "regex":try{return new RegExp(e).test(t)}catch(t){return false}default:return false}}class cl{constructor(t){this.Fn=new sa$1,this.Ln=(t,e)=>this.$n(t,e)&&this.An(t,e)&&this.Nn(t,e)&&this.Dn(t,e),this.$n=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.qn=new Set,this.jn=new Set;}init(){var t,e;K$1(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e);})));}register(t){var e,i;if(!K$1(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.jn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.qn)||e.add((null==t?void 0:t.event)||"");}));})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector);}));})),null==(r=this._instance)||r.autocapture.setElementSelectors(s);}}on(t,e){var i;null!=e&&0!=t.length&&(this.qn.has(t)||this.qn.has(e.event))&&this.jn&&(null==(i=this.jn)?void 0:i.size)>0&&this.jn.forEach((t=>{this.Hn(e,t)&&this.Fn.emit("actionCaptured",t.name);}));}Bn(t){this.onAction("actionCaptured",(e=>t(e)));}Hn(t,e){if(null==(null==e?void 0:e.steps))return false;for(var i of e.steps)if(this.Ln(t,i))return true;return false}onAction(t,e){return this.Fn.on(t,e)}An(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return false;if(!vl(r,e.url,e.url_matching||"contains"))return false}return true}Nn(t,e){return !!this.Un(t,e)&&!!this.zn(t,e)&&!!this.Vn(t,e)}Un(t,e){var i;if(null==e||!e.href)return true;var r=this.Wn(t);if(r.length>0)return r.some((t=>vl(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return !!n&&vl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}zn(t,e){var i;if(null==e||!e.text)return true;var r=this.Wn(t);if(r.length>0)return r.some((t=>vl(t.text,e.text,e.text_matching||"exact")||vl(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return !!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!Z$1(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>vl(t,n,o))))}Vn(t,e){var i,r;if(null==e||!e.selector)return true;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return true;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return false}return false}Wn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Dn(t,e){return null==e||!e.properties||0===e.properties.length||ca$1(e.properties.reduce(((t,e)=>{var i=V$1(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class fl{constructor(t){var e;this.Zn=[],this._instance=t,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,null==(e=this._instance)||null==e.onSessionId||e.onSessionId((t=>this.Kn(t)));}Yn(t,e){return !!t&&ca$1(t.propertyFilters,null==e?void 0:e.properties)}Xn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r);}}));})),i}ts(t,e,i){var r=(i===Nn.Activation?this.Gn:this.Qn).get(t),s=[];return this.es((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)));})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Yn(n,e)}))}register(t){var e;K$1(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.rs(t),this.ns(t));}ns(t){var e=t.filter((t=>{var e,i;return (null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.ss&&(this.ss=new cl(this._instance),this.ss.init(),this.ss.Bn((t=>{this.onAction(t);}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.ss)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.Jn.get(e.name);i&&i.push(t.id),this.Jn.set(e.name,i||[t.id]);}})));})));}rs(t){var e,i=t.filter((t=>{var e,i;return (null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return (null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e);})),this.Gn=this.Xn(t,Nn.Activation),this.Qn=this.Xn(t,Nn.Cancellation));}onEvent(t,e){var i,r,s=this.os(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.ls(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.us([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.hs(n)}if(this.Qn.has(t)){var a=this.ts(t,e,Nn.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.us(a.map((t=>t.id))),a.forEach((t=>this.ds(t.id))));}if(this.Gn.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.Gn.get(t)});var l=this.ts(t,e,Nn.Activation);this.cs(l.map((t=>t.id)));}}onAction(t){this.Jn.has(t)&&this.cs(this.Jn.get(t)||[]);}cs(t){0!==t.length&&(this.Zn=[...new Set([...this.Zn,...t])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}));}hs(t){this.Zn=this.Zn.filter((e=>e!==t));var e=this.vs();e.includes(t)||(this.fs([...e,t]),this.ps());}us(t){var e=new Set(t);this.Zn=this.Zn.filter((t=>!e.has(t)));var i=this.gs(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&(this.fs(r),0===r.length&&this.ys());}gs(){var t,e=this.bs();return (null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}vs(){var t,e,i=this.gs();if(0===i.length)return [];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this._s()],s=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();return s&&r===s?i:[]}ps(){var t,e=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();e&&this.ws(e);}ys(){this.xs();}Kn(t){var e,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this._s()];i&&i!==t&&(this.gs().length>0&&this.fs([]),this.ys());}getActivatedIds(){return [...new Set([...this.vs(),...this.Zn])].filter((t=>!this.ks(t)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys();}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}}class pl extends fl{constructor(t){super(t);}bs(){return ir$1}_s(){return rr$1}Cs(){return Vn.SHOWN}es(t){var e;null==(e=this._instance)||e.getSurveys(t);}ds(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t);}os(){return ya$1}fs(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[ir$1]:t});}ws(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[rr$1]:t});}xs(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(rr$1);}ks(){return false}ls(t,e){var i;this.es((t=>{i=t.find((t=>t.id===e));}));var r=!i||function(t){var e;return ma$1(t)&&!(null==(e=t.conditions)||null==(e=e.events)||!e.repeatedActivation)||"always"===t.schedule}(i);return r?t===Vn.SHOWN?"consume":"ignore":t===Vn.SHOWN?"persist":t===Vn.DISMISSED||t===Vn.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var _l="SDK is not enabled or survey functionality is not yet loaded",gl="Disabled. Not loading surveys.",ml=null!=t&&t.location?pn$1(t.location.hash,"__posthog")||pn$1(location.hash,"state"):null,yl="_postHogToolbarParams",bl=gi("[Toolbar]"),wl=gi("[FeatureFlags]"),El=gi("[FeatureFlags]",{debugEnabled:true}),xl="\" failed. Feature flags didn't load in time.",Sl=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=true;return e},kl=t=>{var e={};for(var i of Dr(t||{})){var r=i[1];r&&(e[i[0]]=r);}return e},$l=gi("[Error tracking]"),Tl="Refusing to render web experiment since the viewer is a likely bot",Rl={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>ua$1(e,t),not_regex:(t,e)=>!ua$1(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t};class Pl{get Te(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){ void 0===t&&(t=false),e.getWebExperiments((t=>{Pl.Is("retrieved web experiments from the server"),e.Ts=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Ts&&(Pl.Is("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Ts)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);Y$1(r)&&t.variants[r]&&e.Ms(t.name,r,t.variants[r].transforms);}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Pl.Es(n,e._instance)&&e.Ms(t.name,s,n.transforms);}}));}),t);},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t);}));}initialize(){}onFeatureFlags(t){if(this._is_bot())Pl.Is(Tl);else if(!this.Te.disable_web_experiments){if(Z$1(this.Ts))return this.Ts=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Pl.Is("applying feature flags",t),t.forEach((t=>{var e;if(this.Ts&&null!=(e=this.Ts)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Ts)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Ms(s.name,r,s.variants[r].transforms);}}));}}previewWebExperiment(){var t=Pl.getWindowLocation();if(null!=t&&t.search){var e=cn$1(null==t?void 0:t.search,"__experiment_id"),i=cn$1(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Pl.Is("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Rs(parseInt(e),i,t);}),false,true));}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic();}getWebExperiments(t,e,i){if(this.Te.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])});}Rs(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Pl.Is("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Ms(r[0].name,e,r[0].variants[e].transforms));}static Es(t,e){return !Z$1(t.conditions)&&Pl.Ps(t,e)&&Pl.Os(t)}static Ps(t,e){var i;if(Z$1(t.conditions)||Z$1(null==(i=t.conditions)?void 0:i.url))return true;var r=Pl.getWindowLocation();if(r){var s,n,o,a=us(e,r.href);return null==(s=t.conditions)||!s.url||Rl[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return false}static getWindowLocation(){return null==t?void 0:t.location}static Os(t){var e;if(Z$1(t.conditions)||Z$1(null==(e=t.conditions)?void 0:e.utm))return true;var i=xn$1();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&f&&v}return false}static Is(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];_i.info("[WebExperiments] "+t,i);}Ms(t,e,i){this._is_bot()?Pl.Is(Tl):"control"!==e?i.forEach((i=>{if(i.selector){var r;Pl.Is("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css);}));}})):Pl.Is("Control variants leave the page unmodified.");}_is_bot(){return i$1&&this._instance?aa$1(i$1,this.Te.custom_blocked_useragents):void 0}}var Ol=gi("[Conversations]"),Il="Conversations not available yet.",Cl="console",Ml={featureFlags:class{constructor(e){this.Fs=false,this.Ls=false,this.$s=false,this.As=false,this.Ns=false,this.Ds=false,this.qs=false,this.js=false,this.Hs=0,this.Bs=()=>{var t=this.Us();this.Hs=0,t&&this.reloadFeatureFlags();},this._instance=e,this.featureFlagEventHandlers=[],t&&zr(t,"online",this.Bs);}destroy(){null==t||t.removeEventListener("online",this.Bs);}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(t){return this._instance.get_property(t)}Vs(){var t,e;return null!==(t=null==(e=this.mi)?void 0:e._r(this.Te.feature_flag_cache_ttl_ms))&&void 0!==t&&t}Ws(){return !!this.Vs()&&(this.js||this.$s||(this.js=true,wl.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),true)}Zs(){var t,e=null!==(t=this.Te.evaluation_contexts)&&void 0!==t?t:this.Te.evaluation_environments;return !this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(wl.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=true),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||wl.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}Gs(){return this.Zs().length>0}Qs(){var t=this.Te.flag_keys;if(!K$1(t)){if(V$1(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||wl.error("Invalid flag key found:",t,"Expected non-empty string"),e}));wl.error("Invalid flag_keys found:",t,"Expected array of non-empty strings");}}initialize(){var t,e,i=this._instance.config,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||false,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l});}}updateFlags(t,e,i){var r,s,n=null!=i&&i.merge&&null!==(r=this.zs(Hi))&&void 0!==r?r:{},o=null!=i&&i.merge&&null!==(s=this.zs(Wi))&&void 0!==s?s:{},a=g({},n,t),l=g({},o,e),u={};for(var h of Object.entries(a)){var d=h[0],v=h[1];u[d]={key:d,enabled:b(v),variant:w$1(v),reason:void 0,metadata:K$1(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}};}this.receivedFeatureFlags({flags:u});}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.zs(Gi),e=this.zs(Yi),i=this.zs(Qi);if(!i&&!e)return t||{};var r=Fr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=K$1(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=K$1(u)?l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=g({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=g({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c;}return this.Fs||(wl.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.Fs=true),r}getAllFeatureFlags(){var t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map((i=>{var r=t[i];return {key:i,enabled:b(r),variant:w$1(r),payload:y$1(e[i])}}))}getFlagVariants(){var t=this.zs(Hi),e=this.zs(Yi);if(!e)return t||{};for(var i=Fr({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Fs||(wl.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Fs=true),i}getFlagPayloads(){var t=this.zs(Wi),e=this.zs(Qi);if(!e)return t||{};for(var i=Fr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Fs||(wl.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Fs=true),i}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.tn.emit("featureFlagsReloading",true),this.Js=setTimeout((()=>{this.Ks();}),5));}Ys(){clearTimeout(this.Js),this.Js=void 0;}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags();}setAnonymousDistinctId(t){this.$anon_distinct_id=t;}setReloadingPaused(t){this.As=t;}Ks(t){var e;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=true;else {var i=this.Te.token,r=this.zs(Ei),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},(null==(e=this.mi)?void 0:e.get_initial_props())||{},this.zs(Xi)||{}),group_properties:this.zs(Zi),timezone:In$1()};X$1(r)||K$1(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.Te.advanced_disable_feature_flags)&&(s.disable_flags=true),this.Gs()&&(s.evaluation_contexts=this.Zs());var n=this.Qs();K$1(n)||(s.flag_keys=n);var o=!!this.Te.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=true,this._instance._send_request({method:"POST",url:a,data:s,compression:this.Te.disable_compression?void 0:io.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,n=true;if(this.Xs(t.statusCode),200===t.statusCode&&(this.Ns||(this.$anon_distinct_id=void 0),n=false),this.$s=false,!s.disable_flags||this.Ns){this.Ds=!n;var a=[];t.error?t.error instanceof Error?a.push("AbortError"===t.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&a.push("quota_limited"),null==(r=this.mi)||r.register({[ar$1]:a}),u)wl.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.");else s.disable_flags||this.receivedFeatureFlags(null!==(l=t.json)&&void 0!==l?l:{},n,{partialResponse:o}),this.Ns&&(this.Ns=false,this.Ks());}}});}}Us(){return _n(this.Hs,3)}Xs(t){this.Hs=gn$1(t,this.Hs,3,(()=>wl.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")));}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else wl.warn('getFeatureFlag for key "'+t+xl);}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:false});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.zs(Ji)||void 0,l=this.zs(lr$1)||void 0,u=this.zs(nr$1)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.zs(or$1);d&&d!==v&&(u={},null==(h=this.mi)||h.register({[nr$1]:u,[or$1]:d}));}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,f,p,_,g,m,b,w,E,x,S;V$1(u[t])?u[t].push(o):u[t]=[o],null==(c=this.mi)||c.register({[nr$1]:u});var k=this.getFeatureFlagDetails(t),T=[...null!==(f=this.zs(ar$1))&&void 0!==f?f:[]];K$1(s)&&T.push("flag_missing");var R={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.Te.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Te.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.Ds};K$1(null==k||null==(g=k.metadata)?void 0:g.has_experiment)||(R.$feature_flag_has_experiment=k.metadata.has_experiment),K$1(null==k||null==(m=k.metadata)?void 0:m.version)||(R.$feature_flag_version=k.metadata.version);var P,O=null!==(b=null==k||null==(w=k.reason)?void 0:w.description)&&void 0!==b?b:null==k||null==(E=k.reason)?void 0:E.code;O&&(R.$feature_flag_reason=O),null!=k&&null!=(x=k.metadata)&&x.id&&(R.$feature_flag_id=k.metadata.id),K$1(null==k?void 0:k.original_variant)&&K$1(null==k?void 0:k.original_enabled)||(R.$feature_flag_original_response=K$1(k.original_variant)?k.original_enabled:k.original_variant),null!=k&&null!=(S=k.metadata)&&S.original_payload&&(R.$feature_flag_original_payload=null==k||null==(P=k.metadata)?void 0:P.original_payload),T.length&&(R.$feature_flag_error=T.join(",")),this._instance.capture("$feature_flag_called",R);}if(r)return {key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:y$1(n)}}}else wl.warn('getFeatureFlagResult for key "'+t+xl);}getRemoteConfigPayload(t,e){var i=this.Te.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.Gs()&&(r.evaluation_contexts=this.Zs());var s=this.Qs();K$1(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Te.disable_compression?void 0:io.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0);}});}isFeatureEnabled(t,e){if(void 0===e&&(e={}),e.fresh&&!this.Ds)return e.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return wl.warn('isFeatureEnabled for key "'+t+xl),e.defaultValue;var i=this.getFeatureFlag(t,e);return K$1(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t);}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t));}receivedFeatureFlags(t,e,i){if(this.mi){this.Ls=true;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,e,i,r,s,n){ void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o=(t=>{var e=t.flags;return e?(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]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return 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&&wl.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(V$1(l)){wl.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=true;e&&e.register({[qi]:l,[Hi]:v,[Ki]:false});}else {var f=l,p=u,_=a;if(null!=n&&n.partialResponse)f=g({},i,f),p=g({},r,p),_=g({},s,_);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return !(null!=(e=a[t])&&e.failed)})));f=g({},i,Object.fromEntries(Object.entries(f).filter((t=>m.has(t[0]))))),p=g({},r,Object.fromEntries(Object.entries(p||{}).filter((t=>m.has(t[0]))))),_=g({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0])))));}else f=g({},i,f),p=g({},r,p),_=g({},s,_);e&&e.register(g({[qi]:Object.keys(kl(f)),[Hi]:f||{},[Wi]:p||{},[Gi]:_||{},[Ki]:true===t.minimalFlagCalledEvents},h?{[Ji]:h}:{},d?{[lr$1]:d}:{}));}}}(t,this.mi,r,s,n,i),e||(this.js=false),this.eo(e);}}override(t,e){ void 0===e&&(e=false),wl.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e});}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.mi)return wl.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(false===t)return this.mi.unregister(Yi),this.mi.unregister(Qi),this.eo(),El.info("All overrides cleared");if(V$1(t)){var e=Sl(t);return this.mi.register({[Yi]:e}),this.eo(),El.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Fs=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(false===r.flags)this.mi.unregister(Yi),El.info("Flag overrides cleared");else if(r.flags){if(V$1(r.flags)){var s=Sl(r.flags);this.mi.register({[Yi]:s});}else this.mi.register({[Yi]:r.flags});El.info("Flag overrides set",{flags:r.flags});}return "payloads"in r&&(false===r.payloads?(this.mi.unregister(Qi),El.info("Payload overrides cleared")):r.payloads&&(this.mi.register({[Qi]:r.payloads}),El.info("Payload overrides set",{payloads:r.payloads}))),void this.eo()}if(t&&"object"==typeof t)return this.mi.register({[Yi]:t}),this.eo(),El.info("Flag overrides set",{flags:t});wl.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t});}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ls){var e=this.ro(),i=e.flags,r=e.flagVariants;try{t(i,r);}catch(t){wl.error("Error while running feature flags callback",t);}}return ()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var r,s=(this.zs(Vi)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,false);var a=g({},this.getFlagVariants(),{[t]:e});null==(r=this.mi)||r.register({[qi]:Object.keys(kl(a)),[Hi]:a}),this.eo();}getEarlyAccessFeatures(t,e,i){ void 0===e&&(e=false);var r=this.zs(Vi),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+s),method:"GET",timestampMode:"query",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.mi)||i.unregister(Vi),null==(r=this.mi)||r.register({[Vi]:s}),t(s)}}});}ro(){var t=this.getFlags(),e=this.getFlagVariants();return {flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}eo(t){var e=this.ro(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach((e=>{try{e(i,r,{errorsLoading:t});}catch(t){wl.error("Error while running feature flags callback",t);}}));}setPersonPropertiesForFlags(t,e){ void 0===e&&(e=true);var i=this.zs(Xi)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[Xi]:g({},i,n,r)}),e&&this._instance.reloadFeatureFlags();}unsetPersonPropertiesForFlags(t,e){ void 0===e&&(e=true);var i=g({},this.zs(Xi)||{});t.forEach((t=>{delete i[t];})),this._instance.register({[Xi]:i}),e&&this._instance.reloadFeatureFlags();}resetPersonPropertiesForFlags(t){ void 0===t&&(t=true),this._instance.unregister(Xi),t&&this._instance.reloadFeatureFlags();}setGroupPropertiesForFlags(t,e){ void 0===e&&(e=true);var i=this.zs(Zi)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((e=>{i[e]=g({},i[e],t[e]),delete t[e];})),this._instance.register({[Zi]:g({},i,t)}),e&&this._instance.reloadFeatureFlags();}resetGroupPropertiesForFlags(t){if(t){var e=this.zs(Zi)||{};this._instance.register({[Zi]:g({},e,{[t]:{}})});}else this._instance.unregister(Zi);}reset(){this.Ls=false,this.$s=false,this.As=false,this.Ns=false,this.Ds=false,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=false,this.Hs=0;}}},Al={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var t;return !(null==(t=this.io)||!t.isStarted)}get status(){var t,e;return this.no===el||this.no===il?this.no:null!==(t=null==(e=this.io)?void 0:e.status)&&void 0!==t?t:this.no}constructor(t){if(this._forceAllowLocalhostNetworkCapture=false,this.no=Za$1,this.so=void 0,this._instance=t,!this._instance.sessionManager)throw sl.error("started without valid sessionManager"),new Error(rl+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===xr)throw new Error(rl+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop();}get oo(){var e,i=!(null==(e=this._instance.get_property(Fi))||!e.enabled),r=!this.Te.disable_session_recording,s=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!this.oo||null==(e=this.io)||!e.isStarted){var i=!K$1(Object.assign)&&!K$1(Array.from);this.oo&&i?(this.ao(t),sl.info("starting")):(this.no=Za$1,this.stopRecording());}}ao(t){var e,i,r;this.oo&&(this.no!==el&&this.no!==il&&(this.no=tl),null!=v$1&&null!=(e=v$1.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=v$1.__PosthogExtensions__)&&i.initSessionRecording?this.lo(t):null==(r=v$1.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.uo,(e=>{if(e)return sl.error("could not load recorder",e);this.lo(t);})));}stopRecording(){var t,e;null==(t=this.so)||t.call(this),this.so=void 0,null==(e=this.io)||e.stop();}ho(){var t,e;null==(t=this.so)||t.call(this),this.so=void 0,null==(e=this.io)||e.discard();}do(){var t,e;null==(t=this.mi)||t.unregister(zi),null==(e=this.mi)||e.unregister(Di);}co(t,e){if(Z$1(t))return null;var i,r=tt$1(t)?t:parseFloat(t);return "number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(sl.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}vo(t){if(this.mi){var e,i,r=this.mi,s=()=>{var e,i=false===t.sessionRecording?void 0:t.sessionRecording,s=this.co(null==(e=this.Te.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.co(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;Z$1(o)&&this.do();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Fi]:g({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:K$1(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})});};s(),null==(e=this.so)||e.call(this),this.so=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s);}}onRemoteConfig(t){var e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?false===e.sessionRecording?(this.vo(e),void this.ho()):(this.vo(e),void this.startIfEnabledOrStop()):(this.no===el&&(this.no=il,sl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.io)&&i.log?this.io.log(t,e):sl.warn("log called before recorder was ready");}get uo(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Fi);return (null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}fo(){var t,e,i=this._instance.get_property(Fi);if(!i)return false;try{e="object"==typeof i?i:JSON.parse(i);}catch(t){return sl.warn("persisted remote config for session recording is invalid and will be ignored",t),false}var r=null!==(t=e.cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-r}lo(t){var e,i;if(null==(e=v$1.__PosthogExtensions__)||!e.initSessionRecording)return sl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[br$1]:true});if(this.io||(this.io=null==(i=v$1.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo()){if(this.no===il||this.no===el)return;return this.no=el,sl.info("persisted remote config is stale, requesting fresh config before starting"),void new to(this._instance).load()}this.no=tl,this.io.start(t);}onRRwebEmit(t){var e;null==(e=this.io)||null==e.onRRwebEmit||e.onRRwebEmit(t);}overrideLinkedFlag(){var t,e;this.io||null==(e=this.mi)||e.register({[Ui]:true}),null==(t=this.io)||t.overrideLinkedFlag();}overrideSampling(){var t,e;this.io||null==(e=this.mi)||e.register({[Ni]:true}),null==(t=this.io)||t.overrideSampling();}overrideTrigger(t){var e,i;this.io||null==(i=this.mi)||i.register({["url"===t?Li:ji]:true}),null==(e=this.io)||e.overrideTrigger(t);}get sdkDebugProperties(){var t;return (null==(t=this.io)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return !(null==(i=this.io)||!i.tryAddCustomEvent(t,e))}}},Fl={autocapture:class{constructor(t){this.po=false,this.mo=null,this.yo=false,this.bo=false,this.instance=t,this.rageclicks=new za$1(t.config.rageclick),this._o=null;}initialize(){this.startIfEnabled();}get Te(){var t,e,i=W$1(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}wo(){if(this.isBrowserSupported()){if(t&&r){var e=e=>{e=e||(null==t?void 0:t.event);try{this.xo(e);}catch(t){qa$1.error("Failed to capture event",t);}};if(zr(r,"submit",e,{capture:true}),zr(r,"change",e,{capture:true}),zr(r,"click",e,{capture:true}),this.Te.capture_copied_text){var i=e=>{e=e||(null==t?void 0:t.event);try{this.xo(e,Ha$1);}catch(t){qa$1.error("Failed to capture copy/cut event",t);}};zr(r,"copy",i,{capture:true}),zr(r,"cut",i,{capture:true});}}}else qa$1.info("Disabling Automatic Event Collection because this browser is not supported");}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=true);}onRemoteConfig(t){if(this.yo=true,t.ok){var e=t.config;e.elementsChainAsString&&(this.bo=e.elementsChainAsString);var i=e.autocapture_opt_out;it$1(i)&&(this.instance.persistence&&this.instance.persistence.register({[$i]:i}),this.mo=i),this.startIfEnabled();}else this.startIfEnabled();}setElementSelectors(t){this._o=t;}getElementSelectors(t){var e,i=[];return null==(e=this._o)||e.forEach((e=>{var s=null==r?void 0:r.querySelectorAll(e);null==s||s.forEach((r=>{t===r&&i.push(e);}));})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[$i],r=this.mo,s=this.instance.Ur()&&!this.yo;if(X$1(r)&&!it$1(i)&&!s)return false;var n=null!==(e=this.mo)&&void 0!==e?e:!!i;return !!this.instance.config.autocapture&&!n}xo(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r,s=ks(e);gs(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&Fs(s,this.instance.config.rageclick)&&this.xo(e,"$rageclick");var n=i===Ha$1;if(s&&function(e,i,r,s,n,o){var a;if(!t||Ds(e))return false;if(null!=r&&r.url_allowlist&&!ws(r.url_allowlist,o))return false;if(null!=r&&r.url_ignorelist&&ws(r.url_ignorelist,o))return false;if(null!=r&&r.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((t=>i.type===t)))return false}var u=Ns(e,s),h=u.parentIsUsefulElement,d=u.targetElementList;if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(K$1(i))return true;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return {v:true}};for(var n of t)if(r=s(n))return r.v;return false}(d,r))return false;if(!Ts(d,null==r?void 0:r.css_selector_allowlist))return false;if(Ts(d,null!==(a=null==r?void 0:r.css_selector_ignorelist)&&void 0!==a?a:Ps))return false;try{var v=t.getComputedStyle(e);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return !0}catch(t){}var c=e.tagName.toLowerCase();switch(c){case "html":return false;case "form":return (n||["submit"]).indexOf(i.type)>=0;case "input":case "select":case "textarea":return (n||["change","click"]).indexOf(i.type)>=0;default:return h?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&($s.indexOf(c)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Te,n,n?["copy","cut"]:void 0,this.instance)){var o=Wa$1(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),a=o.props;if(o.explicitNoCapture)return false;var l=this.getElementSelectors(s);if(l&&l.length>0&&(a.$element_selectors=l),i===Ha$1){var u,h=xs(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!h)return false;a.$selected_content=h,a.$copy_type=d;}return this.instance.capture(i,a),true}}}isBrowserSupported(){return G$1(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(e){var i;this._instance=e,this.ko=(null==t||null==(i=t.location)?void 0:i.pathname)||"";}initialize(){this.startIfEnabled();}get isEnabled(){return "history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(_i.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges());}stop(){this.So&&this.So(),this.So=void 0,_i.info("History API monitoring stopped");}monitorHistoryChanges(){t&&t.history&&(this.Co("pushState"),this.Co("replaceState"),this.Io());}Co(e){var i;if(t&&(null==(i=t.history[e])||!i.__posthog_wrapped__)){var r=this;!function(t,e,i){try{if(!(e in t))return Ka$1;var r={next:t[e]},s=i((function(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];return r.next.apply(this,e)}));return G$1(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[e]=s,()=>{if(t[e]!==s)for(var i=t[e];G$1(i)&&i.__posthog_layer__;){var n=i.__posthog_layer__;if(n.next===s)return void(n.next=r.next);i=n.next;}else t[e]=r.next;}}catch(t){return Ka$1}}(t.history,e,(t=>function(i,s,n){t.call(this,i,s,n),r.To(e);}));}}To(e){try{var i,r=null==t||null==(i=t.location)?void 0:i.pathname;if(!r)return;r!==this.ko&&this.isEnabled&&this._instance.capture(Pr,{navigation_type:e}),this.ko=r;}catch(t){_i.error("Error capturing "+e+" pageview",t);}}Io(){if(!this.So){var e=()=>{this.To("popstate");};zr(t,"popstate",e),this.So=()=>{t&&t.removeEventListener("popstate",e);};}}},heatmaps:class{get Te(){return this.instance.config}constructor(t){var e;this.Mo=false,this.po=false,this.Eo=null,this.instance=t,this.Mo=!(null==(e=this.instance.persistence)||!e.props[Ti]),this.rageclicks=new za$1(t.config.rageclick);}initialize(){this.startIfEnabled();}get flushIntervalMilliseconds(){var t=5e3;return W$1(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(t=this.Te.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Z$1(this.Te.capture_heatmaps)?Z$1(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:false!==this.Te.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.po)return;nl.info("starting..."),this.Ro(),this.ke();}else {var t;clearInterval(null!==(t=this.Eo)&&void 0!==t?t:void 0),this.Po(),this.getAndClearBuffer();}}onRemoteConfig(t){if(t.ok){var e=t.config;if("heatmaps"in e){var i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ti]:i}),this.Mo=i,this.startIfEnabled();}}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Oo(t){ol(t.originalEvent)&&this.pe(t.originalEvent,"deadclick");}ke(){this.Eo&&clearInterval(this.Eo),this.Eo="visible"===(null==r?void 0:r.visibilityState)?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null;}Ro(){t&&r&&(this.Fo=this.oi.bind(this),zr(t,Rr,this.Fo),this.Lo=e=>this.pe(e||(null==t?void 0:t.event)),zr(r,"click",this.Lo,{capture:true}),this.$o=e=>this.Ao(e||(null==t?void 0:t.event)),zr(r,"mousemove",this.$o,{capture:true}),this.No=new tn$1(this.instance,Xs,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),zr(r,Tr,this.Do),this.po=true);}Po(){var e;t&&r&&(this.Fo&&t.removeEventListener(Rr,this.Fo),this.Lo&&r.removeEventListener("click",this.Lo,{capture:true}),this.$o&&r.removeEventListener("mousemove",this.$o,{capture:true}),this.Do&&r.removeEventListener(Tr,this.Do),clearTimeout(this.qo),null==(e=this.No)||e.stop(),this.po=false);}jo(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&ps(s)&&!_s(s,"body");){if(s===r)return false;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:t)?void 0:o.getComputedStyle(s).position;}catch(t){return false}if(U$1(i,n))return true;s=Rs(s);}return false}(ks(e),["fixed","sticky"],n);return {x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}pe(t,e){var i;if(void 0===e&&(e="click"),!fs(t.target)&&ol(t)){var r=this.jo(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Fs(ks(t),this.instance.config.rageclick)&&this.Wt(g({},r,{type:"rageclick"})),this.Wt(r);}}Ao(t){!fs(t.target)&&ol(t)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Wt(this.jo(t,"mousemove"));}),500));}Wt(e){if(t){var i=this.Te.disable_capture_url_hashes?be$1(t.location.href):t.location.href,r=this.Te.custom_personal_data_properties,s=this.Te.mask_personal_data_properties?[...yn$1,...r||[]]:[],n=fn$1(i,s,wn$1);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(e);}}oi(){this.R&&!J$1(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()});}},deadClicksAutocapture:tn$1,webVitalsAutocapture:class{constructor(t){var e;this.Mo=false,this.po=false,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,e)=>g({},t,{["$web_vitals_"+e.name+"_event"]:g({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0});},this.Uo=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.zo();if(!K$1(i))if(Z$1(null==t?void 0:t.name)||Z$1(null==t?void 0:t.value))Qa$1.error("Invalid metric received",t);else if(!this.Vo||this.Vo>t.value){this.R.url!==i&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),K$1(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=K$1(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(true),s=g({},t,{$current_url:i,timestamp:Date.now()});K$1(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),this.R.metrics.push(s),this.R.metrics.length===this.allowedMetrics.length&&this.Ho();}else Qa$1.error("Ignoring metric with value >= "+this.Vo,t);},this.Wo=()=>{if(!this.po){var t,e,i,r,s=v$1.__PosthogExtensions__;if(!K$1(s)&&!K$1(s.postHogWebVitalsCallbacks)){var n=s.postHogWebVitalsCallbacks;t=n.onLCP,e=n.onCLS,i=n.onFCP,r=n.onINP;}t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Uo.bind(this)),this.po=true):Qa$1.error("web vitals callbacks not loaded - not starting");}},this._instance=t,this.Mo=!(null==(e=this._instance.persistence)||!e.props[Ii]),this.startIfEnabled();}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=W$1(this.Zo)?null==(t=this.Zo)?void 0:t.web_vitals_allowed_metrics:void 0;return Z$1(i)?(null==(e=this._instance.persistence)?void 0:e.props[Ai])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return (W$1(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=W$1(this.Zo)?this.Zo.web_vitals_attribution:void 0;return null!=t&&t}get Vo(){var t=W$1(this.Zo)&&tt$1(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:Xa$1;return t>0&&6e4>=t?Xa$1:t}get isEnabled(){var t=null==s$1?void 0:s$1.protocol;if("http:"!==t&&"https:"!==t)return Qa$1.info("Web Vitals are disabled on non-http/https protocols"),false;var e=W$1(this.Zo)?this.Zo.web_vitals:it$1(this.Zo)?this.Zo:void 0;return it$1(e)?e:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(Qa$1.info("enabled, starting..."),this.tr(this.Wo));}onRemoteConfig(t){if(t.ok){var e=t.config;if("capturePerformance"in e){var i=W$1(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=W$1(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ii]:i}),this._instance.persistence.register({[Ai]:r})),this.Mo=i,this.startIfEnabled();}}}tr(t){var e,i;null!=(e=v$1.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=v$1.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?Qa$1.error("failed to load script",e):t();}));}zo(){var e=t?this._instance.config.disable_capture_url_hashes?be$1(t.location.href):t.location.href:void 0;if(e){var i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...yn$1,...i||[]]:[];return fn$1(e,r,wn$1)}Qa$1.error("Could not determine current URL");}}},Dl={exceptionObserver:class{constructor(e){var i;this.Wo=()=>{var e;if(t&&this.isEnabled&&null!=(e=v$1.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=v$1.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v$1.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v$1.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=i(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=r(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=s(this.captureException.bind(this)));}catch(t){Ja$1.error("failed to start",t),this.Ko();}}},this._instance=e,this.Yo=!(null==(i=this._instance.persistence)||!i.props[Ri]),this.Xo=new ct$1(g({},function(t){var e,i,r,s;return void 0===t&&(t={}),{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,it:Ja$1})),this.Te=this.ta(),this.startIfEnabledOrStop();}ta(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:false,capture_unhandled_rejections:false,capture_console_errors:false};return W$1(t)?e=g({},e,t):(K$1(t)?this.Yo:t)&&(e=g({},e,{capture_unhandled_errors:true,capture_unhandled_rejections:true})),e}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ja$1.info("enabled"),this.Ko(),this.tr(this.Wo)):this.Ko();}tr(t){var e,i;null!=(e=v$1.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=v$1.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Ja$1.error("failed to load script",e);t();}));}Ko(){var t,e,i;null==(t=this.Go)||t.call(this),this.Go=void 0,null==(e=this.Qo)||e.call(this),this.Qo=void 0,null==(i=this.Jo)||i.call(this),this.Jo=void 0;}onRemoteConfig(t){if(t.ok){var e=t.config;"autocaptureExceptions"in e&&(this.Yo=!!e.autocaptureExceptions||false,this._instance.persistence&&this._instance.persistence.register({[Ri]:this.Yo}),this.Te=this.ta(),this.startIfEnabledOrStop());}}onConfigChange(){this.Te=this.ta();}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.Xo.consumeRateLimit(s)?Ja$1.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t);}},exceptions:class{constructor(t){var e,i;this.ea=[],this.ra=new Le$2([new Qe$2,new ai,new Ze$2,new Xe$1,new ni,new si,new ei,new oi],function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];return function(e,r){ void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Ye$1.test(a)?a.replace(Ye$1,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return [];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return g({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||je$2});var i;}))}(s)}}("web:javascript",Ge$2,Ke$2)),this._instance=t,this.ea=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(Pi))&&void 0!==e?e:[],this.ia=vi(this.na()),this.sa=new ci(this.ia);}onConfigChange(){this.ia=vi(this.na()),this.sa.setConfig(this.ia);}onRemoteConfig(t){var e,i,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(e=null==(i=s.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.ea=n,this._instance.persistence&&this._instance.persistence.register({[Pi]:this.ea,[Oi]:o});}}}get oa(){var t,e=!!this._instance.get_property(Oi),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.ra.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.ia.enabled)try{if(!Y$1(t)||0===t.trim().length)return void $l.warn("Ignoring exception step because message must be a non-empty string");var i=function(t){if(!t)return {sanitizedProperties:{},droppedKeys:[]};var e=[];return {sanitizedProperties:Object.keys(t).reduce(((i,r)=>hi.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(this.aa(e)),r=i.sanitizedProperties,s=i.droppedKeys;s.length>0&&$l.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.sa.add(g({[li]:t,[ui]:(new Date).toISOString()},r));}catch(t){$l.error("Failed to add exception step. Ignoring breadcrumb.",t);}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.la(e)){if(this.ua(e))return this.ha("Exception dropped: matched a suppression rule"),void $l.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(e))return this.ha("Exception dropped: thrown by a browser extension"),void $l.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(e))return this.ha("Exception dropped: thrown by the PostHog SDK"),void $l.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ia.enabled&&Z$1(t.$exception_steps)?this.va(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return r&&this.sa.clear(),r}catch(t){return $l.error("Failed to capture exception event. Dropping this exception.",t),void this.sa.clear()}}catch(t){return void $l.error("Failed to process exception event. Ignoring this exception.",t)}}va(t){try{var e=this.sa.getAttachable();return 0===e.length?t:g({},t,{$exception_steps:e})}catch(e){return $l.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}ha(t){this.ia.enabled&&this.sa.add({[li]:t,[ui]:(new Date).toISOString()});}aa(t){return W$1(t)?g({},t):{}}na(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}ua(t){if(0===t.length)return false;var e=t.reduce(((t,e)=>{var i=e.type,r=e.value;return Y$1(i)&&i.length>0&&t.$exception_types.push(i),Y$1(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ea.some((t=>{var i=t.values.map((t=>{var i,r=da$1[t.operator],s=V$1(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return "OR"===t.type?i.some(Boolean):i.every(Boolean)}))}da(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ca(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return false}la(t){return !Z$1(t)&&V$1(t)}}},Nl=g({productTours:class{get mi(){return this._instance.persistence}constructor(t){this.fa=null,this.pa=null,this._instance=t;}initialize(){this.loadIfEnabled();}onRemoteConfig(t){if(t.ok){var e=t.config;if("productTours"in e){var i,r;if(this.mi&&this.mi.register({[Mi]:!!e.productTours}),!ll(this._instance))return !this.fa&&Z$1(null==(i=this.mi)?void 0:i.props[sr$1])||al.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.fa)||r.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled();}}}loadIfEnabled(){!this.fa&&ll(this._instance)&&this.tr((()=>this.ga()));}tr(t){var e,i;null!=(e=v$1.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=v$1.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?al.error("Could not load product tours script",e):t();}));}ga(){var t;!this.fa&&null!=(t=v$1.__PosthogExtensions__)&&t.generateProductTours&&(this.fa=v$1.__PosthogExtensions__.generateProductTours(this._instance,true));}getProductTours(t,e){if(void 0===e&&(e=false),!V$1(this.pa)||e){var i=this.mi;if(i){var r=i.props[sr$1];if(V$1(r)&&!e)return this.pa=r,void t(r,{isLoaded:true})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:e=>{if(ll(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return al.error(s),void t([],{isLoaded:false,error:s})}var n=V$1(e.json.product_tours)?e.json.product_tours:[];this.pa=n,i&&i.register({[sr$1]:n}),t(n,{isLoaded:true});}else t([],{isLoaded:true});}});}else t(this.pa,{isLoaded:true});}getActiveProductTours(t){Z$1(this.fa)?t([],{isLoaded:false,error:"Product tours not loaded"}):this.fa.getActiveProductTours(t);}showProductTour(t){var e;null==(e=this.fa)||e.showTourById(t);}previewTour(t){this.fa?this.fa.previewTour(t):this.tr((()=>{var e;this.ga(),null==(e=this.fa)||e.previewTour(t);}));}dismissProductTour(){var t;null==(t=this.fa)||t.dismissTour("user_clicked_skip");}nextStep(){var t;null==(t=this.fa)||t.nextStep();}previousStep(){var t;null==(t=this.fa)||t.previousStep();}clearCache(){var t;this.pa=null,null==(t=this.mi)||t.unregister(sr$1);}resetTour(t){var e;null==(e=this.fa)||e.resetTour(t);}resetAllTours(){var t;null==(t=this.fa)||t.resetAllTours();}cancelPendingTour(t){var e;null==(e=this.fa)||e.cancelPendingTour(t);}}},Ml),Ul={siteApps:class{constructor(t){this.ma=0,this._instance=t,this.ya=[],this.apps={};}get isEnabled(){return !!this._instance.config.opt_in_site_apps}ba(t,e){if(e){var i=this.globalsForEvent(e);this.ya.push(i),this.ya.length>1e3&&(this.ya=this.ya.slice(10));}}get siteAppLoaders(){var t;return null==(t=v$1._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ba.bind(this));this._a=()=>{t(),this.ya=[],this._a=void 0;};}}globalsForEvent(t){var e,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(h)){var v=d[0];l[v]={id:u[v],type:v,properties:d[1]};}var c=t.$set_once,f=t.$set;return {event:g({},m(t,ul),{properties:g({},t.properties,f?{$set:g({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},f)}:{},c?{$set_once:g({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}wa(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return "style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(hl.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(hl.error("prepare_external_dependency_script returned null"),null):t}xa(){var t,e,i,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return ()=>{};var u=null==r?void 0:r.defaultView,h=null==u||null==(t=u.Node)?void 0:t.prototype;if(!u||!h)return ()=>{};if(this.ma++,this.ka)return this.Sa();var d=[],v=this,c=new WeakSet,f=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),d.push((()=>{t[e]=r;}));}},p=t=>{if(c.has(t))return t;var e=v.wa(t);return e&&c.add(e),e},_=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!X$1(t)));return f(h,"appendChild",(t=>function(e){var i=p(e);return i?t.call(this,i):e})),f(h,"insertBefore",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):e})),f(h,"replaceChild",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):i})),[null==(e=u.Element)?void 0:e.prototype,null==(i=u.Document)?void 0:i.prototype,null==(s=u.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,_(i))})),f(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,_(i))}));})),[null==(n=u.Element)?void 0:n.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((t=>{f(t,"before",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,_(i))})),f(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,_(i))})),f(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=_(i);return i.length&&!s.length?void 0:t.apply(this,s)}));})),f(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(e,i){var r=p(i);return r?t.call(this,e,r):null})),this.ka=()=>{d.forEach((t=>t())),this.ka=void 0;},this.Sa()}Sa(){var t=false;return ()=>{var e;t||(t=true,this.ma--,0===this.ma&&(null==(e=this.ka)||e.call(this)));}}Ca(t,e){ void 0===e&&(e=true);var i=this.xa();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.ya.length&&(hl.info("Processing "+this.ya.length+" events for site app with id "+t.id),this.ya.forEach((t=>this.Ca((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=true),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this._a)||i.call(this));},r=false,s=s=>{e.errored=!s,e.loaded=true,hl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i();};try{var n=this.Ca((e=>t.init({posthog:this._instance,callback(t){e(),s(t);}})),!1).processEvent;n&&(e.processEvent=n),r=!0;}catch(e){hl.error(dl+t.id,e),s(false);}if(r&&e.loaded)try{i();}catch(i){hl.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=true;}}Ia(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:false,errored:false,processedBuffer:false};for(var i of t)this.setupSiteApp(i);}Ta(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Ca((()=>null==r.processEvent?void 0:r.processEvent(i)));}catch(e){hl.error("Error while processing event "+t.event+" for site app "+r.id,e);}};for(var s of Object.values(this.apps))r(s);}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Ia(),void this._instance.on("eventCaptured",(t=>this.Ta(t)))):void hl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._a)||i.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,e=a.id,i=a.url;v$1["__$$ph_site_app_"+e]=s._instance,null==(t=v$1.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,i,(t=>{if(t)return hl.error(dl+e,t)}));};for(var a of n.siteApps)o();}else hl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');}}}},Ll={tracingHeaders:class{constructor(t){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var t,e,i=this.Pa();i?(K$1(this.Ma)&&(this.Ma=null==(t=v$1.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),K$1(this.Ea)&&(this.Ea=null==(e=v$1.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko();},this._instance=t;}initialize(){this.startIfEnabledOrStop();}tr(t){var e,i;null!=(e=v$1.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=v$1.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Ya$1.error("failed to load script",e);t();}));}Oa(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Pa(){var t=this.Oa();return V$1(t)?(V$1(this.Ra)?this.Ra.splice(0,this.Ra.length,...t):this.Ra=[...t],t.length>0?this.Ra:void 0):(V$1(this.Ra)&&this.Ra.splice(0),this.Ra=t||void 0,this.Ra)}Ko(){var t,e;null==(t=this.Ma)||t.call(this),null==(e=this.Ea)||e.call(this),this.Ma=void 0,this.Ea=void 0;}startIfEnabledOrStop(){this.Pa()?this.tr(this.Wo):this.Ko();}}},jl=g({surveys:class{get Te(){return this._instance.config}constructor(t){this.Fa=void 0,this._surveyManager=null,this.La=false,this.$a=[],this.Aa=null,this.Na=null,this._instance=t,this._surveyEventReceiver=null;}initialize(){this.loadIfEnabled();}onRemoteConfig(t){if(!this.Te.disable_surveys){if(!t.ok)return ya$1.warn("Remote config unavailable. Not loading surveys.");var e=t.config.surveys;if(Z$1(e))return ya$1.warn("Flags not loaded yet. Not loading surveys.");var i=V$1(e);this.Fa=i?e.length>0:e,ya$1.info("flags response received, isSurveysEnabled: "+this.Fa),this.loadIfEnabled();}}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(ba$1)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r);}e.forEach((t=>localStorage.removeItem(t)));}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.La)ya$1.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)ya$1.info(gl);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())ya$1.info("Not loading surveys in cookieless mode without consent.");else {var t=null==v$1?void 0:v$1.__PosthogExtensions__;if(t){if(!K$1(this.Fa)||this.Te.advanced_enable_surveys){var e=this.Fa||this.Te.advanced_enable_surveys;this.La=true;try{var i=t.generateSurveys;if(i)return void this.Da(i,e);var r=t.loadExternalDependency;if(!r)return void this.qa(wr);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.qa("Could not load surveys script",i):this.Da(t.generateSurveys,e);}));}catch(t){throw this.qa("Error initializing surveys",t),t}finally{this.La=false;}}}else ya$1.error("PostHog Extensions not found.");}}Da(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new pl(this._instance),ya$1.info("Surveys loaded successfully"),this.ja({isLoaded:true});}qa(t,e){ya$1.error(t,e),this.ja({isLoaded:false,error:t});}onSurveysLoaded(t){return this.$a.push(t),this._surveyManager&&this.ja({isLoaded:true}),()=>{this.$a=this.$a.filter((e=>e!==t));}}getSurveys(t,e){if(void 0===e&&(e=false),this.Te.disable_surveys)return ya$1.info(gl),t([]);var i,r=this._instance.get_property(tr$1);if(r&&!e)return t(r,{isLoaded:true}),void(this.Ha()&&this.getSurveys((()=>{}),true));"undefined"!=typeof Promise&&this.Aa?this.Aa.then((e=>t(e.surveys,e.context))):("undefined"!=typeof Promise&&(this.Aa=new Promise((t=>{i=t;}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:e=>{var r;this.Aa=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;ya$1.error(n),this.Na=Date.now();var o={isLoaded:false,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}this.Na=null;var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return !(!t.start_date||t.end_date)}(t)&&(ma$1(t)||function(t){var e;return !(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[tr$1]:l,[er$1]:Date.now()});var h={isLoaded:true};t(l,h),null==i||i({surveys:l,context:h});}}));}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var t=this._instance.get_property(er$1);return tt$1(t)&&Date.now()-t>3e5}Ua(){return tt$1(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,e){var i,r={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};wa$1(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString());}catch(t){}}ja(t){for(var e of this.$a)try{if(!t.isLoaded)return e([],t);this.getSurveys(e);}catch(t){ya$1.error("Error in survey callback",t);}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=false),!Z$1(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);ya$1.warn("init was not called");}za(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null;})),e}Va(t){if(Z$1(this._surveyManager))return {eligible:false,reason:_l};var e="string"==typeof t?this.za(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:false,reason:"Survey not found"}}canRenderSurvey(t){if(Z$1(this._surveyManager))return ya$1.warn("init was not called"),{visible:false,disabledReason:_l};var e=this.Va(t);return {visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Z$1(this._surveyManager)?(ya$1.warn("init was not called"),Promise.resolve({visible:false,disabledReason:_l})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.Va(s);i({visible:n.eligible,disabledReason:n.reason});}else i({visible:false,disabledReason:"Survey not found"});}),e);}))}renderSurvey(t,e,i){var s;if(Z$1(this._surveyManager))ya$1.warn("init was not called");else {var n="string"==typeof t?this.za(t):t;if(null!=n&&n.id)if(Ea$1.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(ya$1.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;ya$1.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),ya$1.info("Survey "+n.id+" rendered");}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);ya$1.warn("Survey element not found");}else ya$1.warn("Surveys of type "+n.type+" cannot be rendered in the app");else ya$1.warn("Survey not found");}}displaySurvey(t,e){var i;if(Z$1(this._surveyManager))ya$1.warn("init was not called");else {var r=this.za(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Wn.Popover&&e.initialResponses&&ya$1.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),false===e.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void ya$1.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==Wn.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties);}else ya$1.warn("Survey not found");}}cancelPendingSurvey(t){Z$1(this._surveyManager)?ya$1.warn("init was not called"):this._surveyManager.cancelSurvey(t);}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload();}}},Ml),Bl={toolbar:class{constructor(t){this.instance=t;}Wa(t){v$1.ph_toolbar_state=t;}Za(){var t;return null!==(t=v$1.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),Hr(this.instance.config))return false;if(!t||!r)return false;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test");}catch(t){return !1}i=null==t?void 0:t.localStorage;}var n,o=ml||pn$1(e.hash,"__posthog")||pn$1(e.hash,"state"),a=o?Nr((()=>JSON.parse(atob(decodeURIComponent(o)))))||Nr((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(yl)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return false}}Ga(t){var e=v$1.ph_load_toolbar||v$1.ph_load_editor;!Z$1(e)&&G$1(e)?e(t,this.instance):bl.warn("No toolbar load function found");}loadToolbar(e){var i=!(null==r||!r.getElementById(hs));if(!t||i)return false;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=g({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:false}:{});if(t.localStorage.setItem(yl,JSON.stringify(g({},n,{source:void 0}))),2===this.Za())this.Ga(n);else if(0===this.Za()){var o;this.Wa(1),null==(o=v$1.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return bl.error("[Toolbar] Failed to load",t),void this.Wa(0);this.Wa(2),this.Ga(n);})),zr(t,"turbolinks:load",(()=>{this.Wa(0),this.loadToolbar(n);}));}return true}Qa(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},zl=g({experiments:Pl},Ml),Hl={conversations:class{constructor(t){this.Ja=void 0,this._conversationsManager=null,this.Ka=false,this.Ya=null,this._instance=t;}initialize(){this.loadIfEnabled();}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&t.ok){var e=t.config.conversations;Z$1(e)||(it$1(e)?this.Ja=e:(this.Ja=e.enabled,this.Ya=e),this.loadIfEnabled());}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Ja=void 0,this.Ya=null;}loadIfEnabled(){if(!(this._conversationsManager||this.Ka||this._instance.config.disable_conversations||Hr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v$1?void 0:v$1.__PosthogExtensions__;if(t&&!K$1(this.Ja)&&this.Ja)if(this.Ya&&this.Ya.token){this.Ka=true;try{var e=t.initConversations;if(e)return this.Xa(e),void(this.Ka=!1);var i=t.loadExternalDependency;if(!i)return void this.tl(wr);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.tl("Could not load conversations script",e):this.Xa(t.initConversations),this.Ka=!1;}));}catch(t){this.tl("Error initializing conversations",t),this.Ka=false;}}else Ol.error("Conversations enabled but missing token in remote config.");}}Xa(t){if(this.Ya)try{this._conversationsManager=t(this.Ya,this._instance),Ol.info("Conversations loaded successfully");}catch(t){this.tl("Error completing conversations initialization",t);}else Ol.error("Cannot complete initialization: remote config is null");}tl(t,e){Ol.error(t,e),this._conversationsManager=null,this.Ka=false;}show(){this._conversationsManager?this._conversationsManager.show():Ol.warn("Conversations not loaded yet.");}hide(){this._conversationsManager&&this._conversationsManager.hide();}isAvailable(){return true===this.Ja&&!X$1(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var r=this;return _$3((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(Ol.warn(Il),null)}))()}getMessages(t,e){var i=this;return _$3((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(Ol.warn(Il),null)}))()}markAsRead(t){var e=this;return _$3((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ol.warn(Il),null)}))()}getTickets(t){var e=this;return _$3((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ol.warn(Il),null)}))()}requestRestoreLink(t){var e=this;return _$3((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ol.warn(Il),null)}))()}restoreFromToken(t){var e=this;return _$3((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ol.warn(Il),null)}))()}restoreFromUrlToken(){var t=this;return _$3((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ol.warn(Il),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}En(){var t;null==(t=this._conversationsManager)||t.setIdentity();}Rn(){var t;null==(t=this._conversationsManager)||t.clearIdentity();}}},ql={logs:class{constructor(e){var i;this.el=false,this.rl=false,this.it=gi("[logs]"),this.Gr=[],this.il=[],this.Hs=0,this.nl=()=>{var t,e;this.Hs=0,null==(t=this.sl)||t.onReconnect(),null==(e=this.ol)||e.onReconnect();},this._instance=e,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.el=true),t&&zr(t,"online",this.nl);}al(t,e,i,r){var s,n=function(t,e){var i,r,s,n,o,a,l,u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=K$1(d)?Math.max(h,2048):Math.max(h,d),c=null==t?void 0:t.resourceAttributes;return {serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return [new Oe$2(this.ll(t,e),n,this.it,(()=>this.ul()),(t=>t()),void 0,r),n]}hl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.sl||this.dl!==e){var i;null==(i=this.sl)||i.reset(),this.dl=e;var r=this.al((()=>this.Gr),(t=>{this.Gr=t;}));this.sl=r[0],this.cl=r[1];}return this.sl}vl(){var t,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.ol||this.fl!==e){var i;null==(i=this.ol)||i.reset(),this.fl=e;var r=this.al((()=>this.il),(t=>{this.il=t;}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:true},Cl);this.ol=r[0],this.pl=r[1];}return this.ol}initialize(){this.loadIfEnabled();}onRemoteConfig(t){var e;if(t.ok){var i=null==(e=t.config.logs)?void 0:e.captureConsoleLogs;!Z$1(i)&&i&&(this.el=true,this.loadIfEnabled());}}reset(){var t,e;this.Gr=[],null==(t=this.sl)||t.reset(),this.il=[],null==(e=this.ol)||e.reset(),this.Hs=0;}captureLog(t){this.hl().captureLog(t);}le(t){this.vl().captureLog(t);}get logger(){return this.gl||(this.gl={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.gl}flushLogs(t){t?this.ml(t):(this.sl&&this.sl.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))),this.ol&&this.ol.flush().catch((t=>this.it.error("PostHog logs flush failed:",t))));}loadIfEnabled(){if(this.el&&!this.rl){var t=null==v$1?void 0:v$1.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.it.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.rl=true);})):this.it.error(wr);}else this.it.error("PostHog Extensions not found.");}}ll(t,e){var i=this._instance;return {get isDisabled(){return false},get optedOut(){return !i.is_capturing()},getPersistedProperty:e=>e===S$1.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===S$1.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[]);},$t:t=>this.$t(t),getLibraryId:()=>f.LIB_NAME,getLibraryVersion:()=>f.LIB_VERSION}}$t(t){return new Promise((e=>{if(_n(this.Hs,3))e({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else {var i=false,r=t=>{i||(i=true,clearTimeout(s),e(t));},s=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.yl(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:true,callback:t=>{var e=t.statusCode;if(this.bl(e),e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else {var i;r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)});}}});}}))}bl(t){(0!==t||this._instance.__loaded)&&(this.Hs=gn$1(t,this.Hs,3,(()=>this.it.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."))));}ml(t){this.Gr.length>0&&this._l(t,this.Gr,this.cl,f.LIB_NAME,(t=>{this.Gr=t;})),this.il.length>0&&this._l(t,this.il,this.pl,Cl,(t=>{this.il=t;}));}_l(t,e,i,r,s){if(0!==e.length){var n=e.map((t=>t.record));s([]);var o=Pe$2(n,Re$2(i,f.LIB_NAME,f.LIB_VERSION),r,f.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yl(),data:o,compression:"best-available",batchKey:"logs",transport:t});}}yl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}ul(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(true),r=i.windowId,s=i.sessionStartTimestamp,n=i.lastActivityTimestamp;e.sessionId=i.sessionId,e.windowId=r,Z$1(s)||(e.sessionStartTimestamp=s),Z$1(n)||(e.lastActivityTimestamp=n);}if(null!=v$1&&null!=(t=v$1.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?be$1(v$1.location.href):v$1.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o);}return e}}},Vl={metrics:class{constructor(t){this.it=gi("[metrics]"),this._instance=t;}initialize(){}hl(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.sl&&this.dl===i||(null==(e=this.sl)||e.reset(),this.dl=i,this.sl=new Ae$2(this.ll(),function(t){var e,i,r,s,n,o=null==t?void 0:t.resourceAttributes;return {serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(i),this.it)),this.sl}count(t,e,i){ void 0===e&&(e=1),this.hl().count(t,e,i);}gauge(t,e,i){this.hl().gauge(t,e,i);}histogram(t,e,i){this.hl().histogram(t,e,i);}flush(t){if(!this.sl)return Promise.resolve();if(t){var e=this.sl.drainWindow();return e&&this.Kt(e,t),Promise.resolve()}return this.sl.flush().catch((t=>this.it.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.sl)||t.reset();}ll(){var t=this._instance,e=this;return {get isDisabled(){return false},get optedOut(){return !t.is_capturing()},Kt:t=>e.Kt(t),getLibraryId:()=>f.LIB_NAME,getLibraryVersion:()=>f.LIB_VERSION}}Kt(t,e){return new Promise((i=>{var r=false,s=t=>{r||(r=true,clearTimeout(n),i(t));},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(g({method:"POST",url:this.wl(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e},{fireCallbackOnDrop:true,callback(t){var e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error("metrics request failed with status "+e)});else {var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)});}}}));}))}wl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Gl=g({},Ml,Al,Fl,Dl,Nl,Ul,jl,Ll,Bl,zl,Hl,ql,Vl);Ba$1.__defaultExtensionClasses=g({},Gl);var Wl=function(){f.SDK_DIST_CHANNEL="npm";var e=Ta$1[Fa$1]=new Ba$1;return function(){function e(){e.done||(e.done=true,Da$1=false,Ar(Ta$1,(function(t){t._dom_loaded();})));}null!=r&&r.addEventListener?"complete"===r.readyState?e():zr(r,"DOMContentLoaded",e,{capture:false}):t&&_i.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized");}(),e}();
|
|
12027
|
-
|
|
12026
|
+
const t="u">typeof window?window:void 0,i$1="u">typeof globalThis?globalThis:t,e$1=null==i$1?void 0:i$1.navigator,s$1=null==i$1?void 0:i$1.document,n=null==i$1?void 0:i$1.location,r=null==i$1?void 0:i$1.fetch,o$1=(null==i$1?void 0:i$1.XMLHttpRequest)&&"withCredentials"in new i$1.XMLHttpRequest?i$1.XMLHttpRequest:void 0,l=null==i$1?void 0:i$1.AbortController,u=null==i$1?void 0:i$1.CompressionStream,a=null==e$1?void 0:e$1.userAgent,h$2="undefined"!=typeof globalThis?globalThis:t;h$2&&"undefined"==typeof self&&(h$2.self=h$2),h$2&&"undefined"==typeof File&&(h$2.File=function(){});const d=null!=t?t:{},c="0.10.2",v$1={DEBUG:false,LIB_VERSION:c,LIB_NAME:"browser-common"};var f=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.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),p=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const _$3=["$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"],g=["token"];function m(t,i){return -1!==t.indexOf(i)}const y$1=function(t){return t.trim()},b=function(t){return t.replace(/^\$/,"")};function w$1(t){var i;const 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"}const S$1=Object.prototype,x$1=S$1.hasOwnProperty,E$1=S$1.toString,k$1=Array.isArray||function(t){return "[object Array]"===E$1.call(t)},T$1=t=>"function"==typeof t,P$1=t=>t===Object(t)&&!k$1(t),C=t=>{if(P$1(t)){for(const i in t)if(x$1.call(t,i))return false;return true}return false},R$1=t=>void 0===t,O$1=t=>"[object String]"==E$1.call(t),I$1=t=>O$1(t)&&0===t.trim().length,A$1=t=>null===t,F$1=t=>R$1(t)||A$1(t),M$1=t=>"[object Number]"==E$1.call(t)&&t==t,D$1=t=>M$1(t)&&t>0,N$1=t=>"[object Boolean]"===E$1.call(t),j$1=t=>m(_$3,t),L$1=t=>m(g,t);function U$1(t){return null===t||"object"!=typeof t}function B$1(t,i){return {}.toString.call(t)===`[object ${i}]`}function z$1(t){switch({}.toString.call(t)){case "[object Error]":case "[object Exception]":case "[object DOMException]":case "[object DOMError]":case "[object WebAssembly.Exception]":return true;default:return q$1(t,Error)}}function H$1(t){return "u">typeof Event&&q$1(t,Event)}function q$1(t,i){try{return t instanceof i}catch(t){return false}}const V$1=[true,"true",1,"1","yes"],W$1=t=>m(V$1,t),G$1=[false,"false",0,"0","no"];function K$1(t,i,e,s,n,r,o){try{var l=t[r](o),u=l.value;}catch(t){return void e(t)}l.done?i(u):Promise.resolve(u).then(s,n);}function J$1(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){K$1(r,s,n,o,l,"next",t);}function l(t){K$1(r,s,n,o,l,"throw",t);}o(void 0);})}}const Y$1=["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"],Z$1=new Map,X$1=function(t,i=[]){if(!t)return false;const e=function(t,i){let e="";for(let t=0;i.length>t;t++){const s=i[t];e+=s.length+":"+s;}return t.length+":"+t+"|"+i.length+":"+e}(t,i),s=Z$1.get(e);if(void 0!==s)return s;const n=t.toLowerCase(),r=Y$1.concat(i).some(t=>-1!==n.indexOf(t.toLowerCase()));return 256>Z$1.size||Z$1.clear(),Z$1.set(e,r),r};function Q$1(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),M$1(t)?t>e?(s.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(s.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(s.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+n),Q$1(null!=n?n:e,i,e,s))}var tt$1=class tt{constructor(t){this.C={},this.I=t.I,this.R=Q$1(t.bucketSize,0,100,t.$),this.A=Q$1(t.refillRate,0,this.R,t.$),this.O=Q$1(t.refillInterval,0,864e5,t.$);}F(t,i){const e=Math.floor((i-t.lastAccess)/this.O);e>0&&(t.tokens=Math.min(t.tokens+e*this.A,this.R),t.lastAccess=t.lastAccess+e*this.O);}consumeRateLimit(t){var i;const e=Date.now(),s=String(t);let n=this.C[s];return n?this.F(n,e):(n={tokens:this.R,lastAccess:e},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(i=this.I)||void 0===i||i.call(this,t)),0===n.tokens)}stop(){this.C={};}};const it$1="Mobile",et$1="Android",st$1="Tablet",nt$1="Android Tablet",rt$1="iPad",ot$1="Apple Watch",lt$1="Safari",ut$1="BlackBerry",at$1="Samsung Internet",ht$1="Chrome",dt$1="Chrome iOS",ct$1="Internet Explorer",vt$1="Internet Explorer Mobile",ft$1="Opera",pt$1="Microsoft Edge",_t$2="Firefox",gt$1="Firefox iOS",mt$1="Nintendo",yt$1="PlayStation",bt$1="Xbox",wt$1="Android Mobile",$t$1="Mobile Safari",St$1="Windows",xt$1="Windows Phone",Et$1="Nokia",kt$1="Ouya",Tt$1="Generic "+it$1.toLowerCase(),Pt$1="Generic "+st$1.toLowerCase(),Ct$1="Konqueror",Rt$1="Oculus Browser",Ot$1="Vivaldi",It$1="Yandex",At$1="Whale",Ft$1="DuckDuckGo",Mt$1="Pale Moon",Dt$1="Waterfox",Nt$1="Brave",jt$1="Claude",Lt$1="Codex",Ut$1="ChatGPT",Bt$1="Google Search App",zt$1=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ht$1=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),qt$1=new RegExp(bt$1,"i"),Vt$1=new RegExp("PlayStation \\w+","i"),Wt$1=new RegExp("Nintendo \\w+","i"),Gt$1=new RegExp("BlackBerry|PlayBook|BB10","i"),Kt$1={"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"},Jt$1=function(t,i,e,s){i=i||"";const n=function(t){return (null==t?void 0:t.brave)?Nt$1:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&m(t,"GSA/")?Bt$1:m(t," OPR/")&&m(t,"Mini")?"Opera Mini":m(t," OPR/")?ft$1:Gt$1.test(t)?ut$1:m(t,"IEMobile")||m(t,"WPDesktop")?vt$1:m(t,"OculusBrowser")?Rt$1:m(t,"SamsungBrowser")?at$1:m(t,"Edge")||m(t,"Edg/")?pt$1:m(t,"Vivaldi/")?Ot$1:m(t,"YaBrowser/")?It$1:m(t,"Whale/")?At$1:m(t,"DuckDuckGo/")||m(t,"Ddg/")?Ft$1:m(t,"Claude/")?jt$1:m(t,"Codex/")?Lt$1:m(t,"ChatGPT/")?Ut$1:m(t,"FBIOS")?"Facebook Mobile":m(t,"UCWEB")||m(t,"UCBrowser")?"UC Browser":m(t,"CriOS")?dt$1:m(t,"CrMo")||m(t,ht$1)?ht$1:m(t,et$1)&&m(t,lt$1)?wt$1:m(t,"FxiOS")?gt$1:m(t.toLowerCase(),Ct$1.toLowerCase())?Ct$1:m(t,"Brave/")?Nt$1:((t,i)=>i&&m(i,"Apple")||function(t){return m(t,lt$1)&&!m(t,ht$1)&&!m(t,et$1)}(t))(t,i)?m(t,it$1)?$t$1:lt$1:m(t,"PaleMoon/")?Mt$1:m(t,"Waterfox/")?Dt$1:m(t,_t$2)?_t$2:m(t,"MSIE")||m(t,"Trident/")?ct$1:m(t,"Gecko")?_t$2:"")},Yt$1={[vt$1]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[pt$1]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ht$1]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[dt$1]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[lt$1]:[zt$1],[$t$1]:[zt$1],[ft$1]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[_t$2]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[gt$1]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ct$1]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ut$1]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),zt$1],[wt$1]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[at$1]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Rt$1]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ot$1]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[It$1]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[At$1]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Nt$1]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[jt$1]:[Ht$1],[Lt$1]:[Ht$1],[Ut$1]:[Ht$1],[Ft$1]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Mt$1]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Dt$1]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Bt$1]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ct$1]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Zt$1=function(t,i,e,s){const n=Jt$1(t,i,e,s),r=Yt$1[n];if(R$1(r))return null;for(let i=0;r.length>i;i++){const e=t.match(r[i]);if(e)return parseFloat(e[e.length-2])}return null},Xt$1=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[bt$1,t&&t[1]||""]],[new RegExp(mt$1,"i"),[mt$1,""]],[new RegExp(yt$1,"i"),[yt$1,""]],[Gt$1,[ut$1,""]],[new RegExp(St$1,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return [xt$1,""];if(new RegExp(it$1).test(i)&&!/IEMobile\b/.test(i))return ["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=Kt$1[e[1]]||"";return /arm/i.test(i)&&(t="RT"),[St$1,t]}return [St$1,""]}],[/((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=>{let i="";return t&&t.length>=3&&(i=R$1(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[et$1,[t[2],t[3],t[4]||"0"].join(".")]:[et$1,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const 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",""]]],Qt$1=function(t){for(let i=0;Xt$1.length>i;i++){const[e,s]=Xt$1[i],n=e.exec(t),r=n&&(T$1(s)?s(n,t):s);if(r)return r}return ["",""]},ti=function(t){return Wt$1.test(t)?mt$1:Vt$1.test(t)?yt$1:qt$1.test(t)?bt$1:new RegExp(kt$1,"i").test(t)?kt$1:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?xt$1:/iPad/.test(t)?rt$1:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ot$1:Gt$1.test(t)?ut$1:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Et$1,"i").test(t)?Et$1:/(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(it$1).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)?et$1:nt$1:new RegExp("(pda|Mobile)","i").test(t)?Tt$1:new RegExp(st$1,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Pt$1:""},ii=function(t,i){var e;const s=ti(t);return s===rt$1||s===nt$1||"Kobo"===s||"Kindle Fire"===s||s===Pt$1?st$1:s===mt$1||s===bt$1||s===yt$1||s===kt$1?"Console":s===ot$1?"Wearable":s?it$1:"Android"===(null==i?void 0:i.userAgentDataPlatform)&&(null!==(e=null==i?void 0:i.maxTouchPoints)&&void 0!==e?e:0)>0?600>Math.min(null!==(n=null==i?void 0:i.screenWidth)&&void 0!==n?n:0,null!==(r=null==i?void 0:i.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==i?void 0:i.devicePixelRatio)&&void 0!==o?o:1)?it$1:st$1:"Desktop";var n,r,o;},ei=/\bFBAV\/(\d+(?:\.\d+)*)/i,si=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ei],[/\bFBAN\/EMA\b/i,"Facebook Lite",ei],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ei],[/\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"]],ni="[Truncated]",ri="[Unserializable]";function oi(t){let i="";for(let e=0;t.length>e;e++){const s=t.charCodeAt(e);if(55296>s||s>56319)i+=56320>s||s>57343?t[e]:"�";else {const s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++);}}return i}function li(t,i){if(!i)return t;let e=[];try{e=Object.keys(i);}catch(t){e=[];}for(const s of e){let e;try{e=i[s];}catch(t){e=ri;}Object.defineProperty(t,s,{value:e,enumerable:true,writable:true,configurable:true});}return t}const ui=3e5;var ai=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const i=this.isOpen(),e=Date.now(),s=Math.min(t.retryAfterMs,ui);if(!i)return this.ts=e,void(this.es=e+s);this.es=Math.max(this.es,Math.min(e+s,this.ts+ui));}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const i=Math.min(ui,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0;}constructor(){this.es=0,this.ts=0;}};const hi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function di(t,i){return "string"==typeof(e=t)&&hi.test(e)?t:i();var e;}function ci(t,i){const e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0});}catch(t){}return e}function vi(t){return t?t.split("#")[0]:t}function fi(t){try{return t()}catch(t){return}}function pi(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function _i(t,i,e){return gi.apply(this,arguments)}function gi(){return (gi=J$1(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=pi(()=>{try{null==e||e(),t();}catch(t){n(t);}},i);})])}finally{clearTimeout(s);}})).apply(this,arguments)}function mi(t){return mi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mi(t)}function yi(t,i,e){return (i=function(t){var i=function(t){if("object"!=mi(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=mi(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return "symbol"==mi(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:true,configurable:true,writable:true}):t[i]=e,t}function bi(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s);}return e}function wi(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?bi(Object(e),true).forEach(function(i){yi(t,i,e[i]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):bi(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i));});}return t}let $i,Si,xi,Ei;function ki(t){var i;const e=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!e&&!s)return;const n=e?Object.keys(e):[],r=s?Object.keys(s):[];if(Ei&&Ti(e,n,Si)&&Ti(s,r,xi))return Ei;Si=e?wi({},e):void 0,xi=s?wi({},s):void 0,Ei={},null!==(i=$i)&&void 0!==i||($i={});const o=(i,e)=>{for(const n of i){const i=e[n];if(!i)continue;const r=null==$i?void 0:$i[n];if(r){Ei[r]=i;continue}const o=t(n);for(let t=o.length-1;t>=0;t--){var s;const e=null===(s=o[t])||void 0===s?void 0:s.filename;if(e){Ei[e]=i,$i[n]=e;break}}}};return s&&o(r,s),e&&o(n,e),Ei}function Ti(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var Pi=class{constructor(t,i,e=[]){this.coercers=t,this.stackParser=i,this.modifiers=e;}buildFromUnknown(t,i={}){const e=i&&i.mechanism||{handled:true,type:"generic"},s=this.buildCoercingContext(e,i,0).apply(t),n=this.buildParsingContext(i),r=this.parseStacktrace(s,n);return {$exception_list:this.convertToExceptionList(r,e),$exception_level:"error"}}modifyFrames(t){var i=this;return J$1(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&k$1(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?void 0:i.stack,synthetic:true}}parseStacktrace(t,i){var e;let s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap);}catch(t){}return wi(wi({},t),{},{cause:s,stack:n,errors:null===(e=t.errors)||void 0===e?void 0:e.map(t=>this.parseStacktrace(t,i))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(const e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return J$1(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){const e=[],s=(t,n,r)=>{var o;const l=e.length,u=void 0===n?wi(wi({type:"string"==typeof i.type&&i.type.length>0?i.type:"generic"},"boolean"==typeof i.handled?{handled:i.handled}:void 0===i.handled?{handled:true}:{}),{},{synthetic:"boolean"==typeof i.synthetic?i.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:n},a={type:t.type,value:t.value,mechanism:u};t.stack&&(a.stacktrace={type:"raw",frames:t.stack}),e.push(a),t.cause&&s(t.cause,l,"cause");for(const i of null!==(o=t.errors)&&void 0!==o?o:[])s(i,l,"member");};return s(t),e}buildParsingContext(t){var i;return {chunkIdMap:ki(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(z$1(t)){let e=Object.getPrototypeOf(t);for(let s=0;e&&100>s;s++){var i;const s=null===(i=Object.getOwnPropertyDescriptor(e,"constructor"))||void 0===i?void 0:i.value;if("function"==typeof s&&"AggregateError"===s.name){const i=t.errors;return k$1(i)?i:void 0}e=Object.getPrototypeOf(e);}}}catch(t){}}buildCoercingContext(t,i,e=0){let s=0,n=0,r=false;const o=new Set,l=[],u={},a=(t,i,e=0)=>{const a=h(i,e),d=a.apply;if(a.apply=i=>{l.push(t);try{return d(i)}finally{l.pop();}},e>4||e>0&&-1!==l.indexOf(t))return this.coerceFallback(a);const c="object"==typeof t&&null!==t||"function"==typeof t;if(0===e&&s>=50||c&&o.has(t))return;c&&o.add(t),0===e&&s++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,a),!f)throw u}catch(t){if(t===u)return void(0===e&&s--);if(!r)throw t;f=this.coerceFallback(a);}if(!v||s>=50)return f;try{p=v.length;}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const _=[];for(let t=0;50>s&&1e3>n&&p>t;t++){let e;n++;try{e=a.next(v[t]);}catch(t){s++,e=this.coerceFallback(h(i+1));}e&&_.push(e);}return wi(wi({},f),{},{errors:_})},h=(e,s=0)=>wi(wi({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:0==e?t:{},apply(t){const i=a(t,e,s+1);if(!i)throw u;return i},next:t=>a(t,e+1)}),d=h(e);return wi(wi({},d),{},{apply:t=>{var i;return null!==(i=a(t,e))&&void 0!==i?i:this.coerceFallback(d)}})}};const Ci=/^([a-z][a-z0-9.+-]+):/i,Ri=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Oi(t){if(!t||"<anonymous>"===t)return false;const i=Ci.exec(t);return !i||Ri.includes(i[1].toLowerCase())}function Ii(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:Oi(i)};return R$1(s)||(r.lineno=s),R$1(n)||(r.colno=n),r}const Ai=(t,i)=>{const e=-1!==t.indexOf("safari-extension"),s=-1!==t.indexOf("safari-web-extension");return e||s?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?`safari-extension:${i}`:`safari-web-extension:${i}`]:[t,i]},Fi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Mi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Di=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ni=(t,i)=>{const e=Fi.exec(t);if(e){const[,t,s,n]=e;return Ii(i,t,"?",+s,+n)}const s=Mi.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=Di.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3]);}const[t,e]=Ai(s[1]||"?",s[2]);return Ii(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ji=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Li=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ui=(t,i)=>{const e=ji.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Li.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="");}let t=e[3],s=e[1]||"?";return [s,t]=Ai(s,t),Ii(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Bi=/\(error: (.*)\)/;function zi(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Hi(t){for(let i=1;10>=i;i++){const e=t.length-2*i;if(0>e)break;let s=true;for(let n=0;i>n;n++)if(!zi(t[e+n],t[e+i+n])){s=false;break}if(s){for(let s=0;i>s;s++)t[e+s]=t[e+i+s];return t.length=e+i,{start:e,length:i}}}}function qi(t,i){const e=i.start+i.length,s=Wi(t,i);s&&t.splice(e+s===t.length?e:i.start,s);}function Vi(t,i){let e=i.start;for(;e>0&&zi(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function Wi(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&zi(t[s],t[s-i.length]);)s++;return s-e}function Gi(t,i){const e=i[0];let s=t.length-(e?Vi(t,e):0);for(const e of i)s-=Wi(t,e);return s}function Ki(t,i,e){for(let s=0;t.length>s;s++){const n=t[(i+s)%t.length],r=t[(e+s)%t.length];if(n!==r)return r>n}return false}var Ji=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=O$1(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:false}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${i}: ${t.message}`:i}isDOMException(t){return B$1(t,"DOMException")}isDOMError(t){return B$1(t,"DOMError")}},Yi=class{match(t){return z$1(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s?null===(e=i.syntheticException)||void 0===e?void 0:e.stack:void 0,r=!!n;return {type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:n,cause:t.cause?i.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,i){const e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){try{const i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;const e=t.stack;return "string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Zi=class{match(t){return !!B$1(t,"ErrorEvent")&&(null!=t.error||this.hr(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return wi(wi({},s),{},{stack:null!==(e=this.vr(t))&&void 0!==e?e:s.stack,synthetic:true})}hr(t){return O$1(t.message)&&t.message.length>0}vr(t){var i,e;const s=t,n=null!==(i=s.lineno)&&void 0!==i?i:0,r=null!==(e=s.colno)&&void 0!==e?e:0;if(O$1(s.filename)&&0!==s.filename.length&&0!==n)return `Error\n at ${s.filename}:${n}:${r}`}};const Xi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Qi=class{match(t){return "string"==typeof t}coerce(t,i){var e;const[s,n]=this.getInfos(t);return {type:null!=s?s:"Error",value:null!=n?n:t,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:true}}getInfos(t){let i="Error",e=t;const s=t.match(Xi);return s&&(i=s[1],e=s[2]),[i,e]}};const te$2=["fatal","error","warning","log","info","debug"];function ie$2(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return "[object has no keys]";for(let t=e.length;t>0;t--){const s=e.slice(0,t).join(", ");if(i>=s.length)return t===e.length?s:s.length>i?`${s.slice(0,i)}...`:s}return ""}var ee$2=class ee{match(t){return "object"==typeof t&&null!==t}coerce(t,i){var e,s;const n=this.getErrorPropertyFromObject(t);return n?i.apply(n):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null===(s=i.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:true}}getType(t){if(H$1(t))return t.constructor.name;const i="name"in t?t.name:void 0;return O$1(i)&&!I$1(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let 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;const i=this.getObjectClassName(t);return `${i&&"Object"!==i?`'${i}'`:"Object"} captured as exception with keys: ${ie$2(t)}`}isSeverityLevel(t){return O$1(t)&&!I$1(t)&&te$2.indexOf(t)>=0}getStack(t){try{return O$1(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:O$1(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const i in t)if({}.hasOwnProperty.call(t,i)){const e=t[i];if(z$1(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},se$2=class se{match(t){return H$1(t)}coerce(t,i){var e;const s=t.constructor.name;return {type:s,value:`${s} captured as exception with keys: ${ie$2(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:true}}},ne$2=class ne{match(t){return U$1(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?void 0:e.stack,synthetic:true}}},re$3=class re{match(t){return B$1(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!H$1(t))return false;try{const i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return false}}coerce(t,i){var e;const s=this.getUnhandledRejectionReason(t);return U$1(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:true}:i.apply(s)}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}};const oe$1="$message",le$1="$timestamp",ue$1=new Set([oe$1,le$1]),ae$2={enabled:true,max_bytes:32768};function he$1(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:ae$2.enabled,max_bytes:ce$2(t.max_bytes,ae$2.max_bytes)}:wi({},ae$2)}var de$2=class de{constructor(t){this.ns=[],this.ss=0,this.Ar=he$1(t);}setConfig(t){this.Ar=he$1(t),this.rs();}add(t){const i=function(t){let i;try{i=w$1(t);}catch(t){return}try{const t=JSON.parse(i);if(!P$1(t))return;const e=t,s=e[oe$1],n=e[le$1];if(!O$1(s)||0===s.trim().length)return;if(!O$1(n)&&!M$1(n))return;return {step:e,json:i}}catch(t){return}}(t);if(!i)return;const e=function(t){if("u">typeof TextEncoder)return (new TextEncoder).encode(t).length;const i=encodeURIComponent(t);let e=0;for(let t=0;i.length>t;t++)"%"===i[t]?(e+=1,t+=2):e+=1;return e}(i.json);e>this.Ar.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs());}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0;}size(){return this.ns.length}rs(){for(;this.ss>this.Ar.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes);}}};function ce$2(t,i){if(!M$1(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const ve$1=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function fe$1(t){return "string"==typeof t||t}function pe$2(t){return "string"==typeof t?t:void 0}const _e$2=["$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","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ge$2="NativeGzipValidationError",me$1=t=>t.length>=2&&31===t[0]&&139===t[1],ye$2=(t,i)=>t===p.GZipJS||i===p.GZipJS||"gzip"===i,be$1=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let we$2;const $e$2=t=>{throw ci(ge$2,`Native gzip produced invalid output: ${t}`)},Se$2=(xe$2=J$1(function*(t,i){18>t.size&&$e$2("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());me$1(e)&&8===e[2]||$e$2("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer());s.getUint32(0,true)!==(t=>{const i=(()=>{if(we$2)return we$2;we$2=[];for(let t=0;256>t;t++){let i=t;for(let t=0;8>t;t++)i=1&i?3988292384^i>>>1:i>>>1;we$2[t]=i>>>0;}return we$2})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return (4294967295^e)>>>0})(i)&&$e$2("invalid-crc");const n=i.length>>>0;s.getUint32(4,true)!==n&&$e$2("invalid-size");}),function(t,i){return xe$2.apply(this,arguments)});var xe$2;function Ee$2(){return Ee$2=J$1(function*(t,i=true,e){try{const i=(new TextEncoder).encode(t),e=new globalThis.CompressionStream("gzip"),n=e.writable.getWriter(),r=n.write(i).then(()=>n.close()).catch((s=J$1(function*(t){try{yield n.abort(t);}catch(t){}throw t}),function(t){return s.apply(this,arguments)})),o=new Response(e.readable).blob(),[l]=yield Promise.all([o,r]);return yield Se$2(l,i),l}catch(t){if(null==e?void 0:e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}var s;}),Ee$2.apply(this,arguments)}function ke$1(t,i){if(null==t)return {};var e,s,n=function(t,i){if(null==t)return {};var e={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(i.includes(s))continue;e[s]=t[s];}return e}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;r.length>s;s++)i.includes(e=r[s])||{}.propertyIsEnumerable.call(t,e)&&(n[e]=t[e]);}return n}const Te$2="[redacted]",Pe$2=/^[A-Za-z0-9+/\n\r]+=*$/,Ce$1=/^[A-Za-z0-9_-]+={0,2}$/,Re$2=/[-_]/,Oe$2=/^data:[^,\s]*;base64,/i,Ie$2=/^[A-Za-z0-9+/_-]+={0,2}$/,Ae$2=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Fe$1=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Me$2=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,De$2=/[\s<>"]/,Ne$2=new RegExp(Me$2.source,"i"),je$2=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Le$2=new RegExp(`^${je$2.source}`,"i"),Ue$2=new RegExp(je$2.source,"gi"),Be$2=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,ze$2=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,He$2=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,qe$1=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,Ve$2=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,We$2=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,Ge$2=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Ke$2=/\b\d(?:[ ./-]?\d){12,}\b/g,Je$2=/\d+/g,Ye$1=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Ze$2=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Xe$1(t){return function(t){return Fe$1.test(t)}(t)||Be$2.test(t)||ze$2.test(t)}function Qe$2(t){return t.split("&",129).length>128}function ts(t,i,e){return Xe$1(t)||i.includes(";")&&function(t){return t.split(";").some(t=>Xe$1(t.split("=",1)[0]))}(i)?Te$2:Ne$2.test(i)?e?os(i,{allowNestedUrls:false,stripPunctuation:true}):Te$2:i}function is(t,i){const e=new URLSearchParams;let s=false,n=false;for(const[r,o]of new URLSearchParams(t)){const t=ls(r),l=ls(o);s||(s=t!==r||l!==o);const u=ts(t,l,i);s||(s=u!==l),n=Xe$1(t)||u!==l,e.append(t,u);}return {changed:s,lastFieldSensitive:n,serialized:e.toString()}}function es(t,i){if(!t.includes("="))return {value:ss(t,i),lastFieldSensitive:false};const e=is(t,i);return {value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function ss(t,i){return i?os(t,{allowNestedUrls:false,stripPunctuation:true}):Ne$2.test(t)?Te$2:t}function ns(t,i,e){return "#"===t?!i.fragment&&(i.fragment=true):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=true):!i.query&&(i.query=true))}function rs(t,i){var e;if(t.length>8192&&Le$2.test(t))return Te$2;const{address:s,suffix:n}=i.stripPunctuation?function(t){let i=t.length;for(;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return {address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""};let r;try{r=new URL(s);}catch(t){return Te$2+n}const o=r.search.slice(1),l=""!==r.hash,u=function(t){const i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(Qe$2(o)||Qe$2(u.head)||Qe$2(null!==(e=u.tail)&&void 0!==e?e:""))return Te$2+n;let a=false;(r.username||r.password)&&(r.username=Te$2,r.password="",a=true);const h=is(o,i.allowNestedUrls);h.changed&&(r.search=h.serialized,a=true);const d=es(u.head,i.allowNestedUrls),c=null===u.tail?null:(v=u.tail,d.lastFieldSensitive?{value:""===v?"":Te$2,lastFieldSensitive:true}:es(v,i.allowNestedUrls));var v;const f=null===c?d.value:`${d.value}?${c.value}`;f!==r.hash.slice(1)&&(r.hash=f,a=true);const p=l?null!=c?c:d:h;return (a?ls(r.toString()):s)+(p.lastFieldSensitive?"":n)}function os(t,i){return t.replace(Me$2,e=>function(t,i){const e=function(t){if(!t.includes("://"))return [];const i=[...t.matchAll(Ue$2)].map(t=>t.index),e=[],s={query:false,fragment:false,fragmentQuery:false};let n=0,r=false,o="";for(let l=0;t.length>l&&i.length>n;l++){i[n]===l&&(l>0&&"="!==o&&e.push(l),n++);const u=t[l];ns(u,s,o)?(o=u,r=true):r&&"=&".includes(u)&&(o=u);}return e}(t);if(0===e.length)return rs(t,i);let s="",n=0;for(const r of e)s+=rs(t.slice(n,r),wi(wi({},i),{},{stripPunctuation:false})),n=r;return s+rs(t.slice(n),i)}(e,wi(wi({},i),{},{stripPunctuation:i.stripPunctuation&&e.length!==t.length})))}function ls(t){return t.replace(Ae$2,Te$2)}function us(t,i){return function(t){return t.length>=10240&&(Pe$2.test(t)||function(t){const i=Oe$2.exec(t);if(!i)return false;let e;try{e=decodeURIComponent(t.slice(i[0].length));}catch(t){return false}return Ie$2.test(e.replace(/[\r\n]/g,""))}(t)||Re$2.test(t)&&Ce$1.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){const s=4*e.maxStringLength;if(t.length>s){const n=i(t.slice(0,function(t,i){let e=i;for(;e>0&&!De$2.test(t[e-1]);)e--;return e}(t,s)));if(n.length>=2*e.maxStringLength)return n+e.truncationSuffix}return i(t)}(t,t=>function(t){return os(t,{allowNestedUrls:true,stripPunctuation:true})}(function(t){let i=t.replace(He$2," ");return i=i.replace(qe$1,Te$2),i=i.replace(Ve$2,Te$2),i=i.replace(We$2,`$1${Te$2}`),i=i.replace(Ke$2,hs),i=i.replace(Ge$2,Te$2),i=i.replace(Ye$1,`$1${Te$2}`),i=i.replace(Ze$2,`$1${Te$2}`),i}(ls(t))),i)}function as(t){let i=0,e=false;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;if(0>n||n>9)return false;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e;}return i%10==0}function hs(t){const i=[];for(let e=Je$2.exec(t);null!==e;e=Je$2.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});let e="",s=0,n=0;for(;i.length>n;){let r="",o=-1;for(let t=n;i.length>t&&(r+=i[t].digits,19>=r.length);t++)r.length>=13&&as(r)&&(o=t);0>o?n++:(e+=t.slice(s,i[n].start)+Te$2,s=i[o].end,n=o+1);}return e+t.slice(s)}const ds={}.propertyIsEnumerable;function cs(t,i){try{return ps(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return []}}function vs(t,i,e,s){if(0>=e.remainingNodes)return {stringValue:ni};if(e.remainingNodes--,N$1(t))return {boolValue:t};if("bigint"==typeof t)return function(t,i){const e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>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)};const e=BigInt(t).toString();return t>=0x8000000000000000||-9223372036854776e3>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return {doubleValue:t}}if("string"==typeof t)return {stringValue:oi(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(s>=20)return {stringValue:ni};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return {stringValue:"string"==typeof e?oi(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return vs(n.call(t),i,e,s+1)}catch(t){}return k$1(t)?{arrayValue:{values:fs(t,i,e,s+1)}}:{kvlistValue:{values:ps(t,i,e,s+1)}}}finally{e.ancestors.delete(t);}}return {stringValue:oi(String(t))}}function fs(t,i,e,s){const n=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&e.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(F$1(r))continue;n.push(vs(r,i,e,s));}catch(t){n.push({stringValue:ri});}return t.length>o&&n.push({stringValue:ni}),n}function ps(t,i,e,s){const n=[];for(const r in t)if(ds.call(t,r)){if(!r){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(A$1(o)||R$1(o))continue;n.push({key:oi(r),value:vs(o,i,e,s)});}catch(t){n.push({key:oi(r),value:{stringValue:ri}});}}return n}function _s(t,i,e){return wi(wi(wi(wi({},li({},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})}const gs=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function ms(t,i){const e=li({},t),s={};for(const t of gs)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return [...cs(e,i),...cs(s,i)]}const ys={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const bs={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}},ws=bs.info;function $s(t){try{return oi(String(t))}catch(t){return ri}}function Ss(t,i,e,s){const n=t.level||"info",{text:r,number:o}=bs[n]||ws,l=function(t=Date.now()){return String(t)+"000000"}(M$1(s)?s:void 0),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),F$1(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),F$1(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);const a=wi({},u),h=t.attributes;if(h){let t=[];try{t=Object.keys(h);}catch(i){t=[];}for(const i of t){let t;try{t=h[i];}catch(i){t=ri;}Object.defineProperty(a,i,{value:t,enumerable:true,writable:true,configurable:true});}}const d={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:$s(t.body)},attributes:cs(a,e)};return t.trace_id&&(d.traceId=t.trace_id),t.span_id&&(d.spanId=t.span_id),R$1(t.trace_flags)||(d.flags=t.trace_flags),d}function xs(t,i,e){return _s(t,i,e)}function Es(t,i,e,s){return {resourceLogs:[{resource:{attributes:ms(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var ks=class{constructor(t){this.ls=t,this.us=0;}get pending(){return !!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=pi(()=>{this.cs=void 0,this.ls();},t);}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t);}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0);}};function Ts(){return .75+.5*Math.random()}function Ps(t,i,e,s){const n=Math.min(Math.max(0,i-1),6),r=t*Math.pow(2,n);return Math.round((Math.min(r,Math.max(s,t)))*e)}var Cs=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Ar=i,this.$=e,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new ks(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ai,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=false,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(l=i.maxQueueSize)&&void 0!==l?l:i.maxBufferSize,i.maxBufferSize),this.Ms=i.flushIntervalMs,this.Es=i.maxBatchRecordsPerPost,this.Ps=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval;}clearQueue(){this._s++,this._instance.setPersistedProperty(f.LogsQueue,[]);}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=false,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ar.maxBatchRecordsPerPost;}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs();}captureLog(t,i){var e;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const s=this.Os(t);if(null===s)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:Ss(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.$,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(n));}Os(t){const i=this.Ar.beforeSend;if(!i)return t;const e=k$1(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.$.info("Log was rejected in beforeSend function"),null;s=i;}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return s}Ds(){if(void 0===this.Rs)return true;const t=Date.now(),i=t-this.xs;return this.Ps>i&&i>=0||(this.xs=t,this.$s=0,this.Cs=false),this.Rs>this.$s?(this.$s++,true):(this.Cs||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=true),false)}flush(){var t=this;return J$1(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null;})),t.ys})()}Ns(){var t=this;return J$1(function*(){var i;t.ps.clear();let e=null!==(i=t._instance.getPersistedProperty(f.LogsQueue))&&void 0!==i?i:[];if(0===e.length)return;const s=e.length;let n=0;for(;e.length>0&&s>n;){var r,o;const i=t._s;t.bs=0;const s=Math.min(e.length,t.Es),l=e.slice(0,s),u=Es(l.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),a=yield t._instance.js(u);if(t._s!==i)return;if("too-large"===a.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else {if(t.ws.record(a),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===a.kind)throw a.error;if("too-large"===a.kind?t.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===a.kind&&t.Ar.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Ar.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),e=null!==(o=t._instance.getPersistedProperty(f.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===a.kind)throw a.error}}})()}Bs(t){var i=this;return J$1(function*(){var e;const s=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(f.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(f.LogsQueue,n.slice(s)),yield i.vs();})()}qs(){return xs(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(f.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(f.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Fs():this.gs();}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()));}zs(){return Math.max(Ps(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(f.LogsQueue);return !!t&&t.length>0}shutdown(t){var i=this;return J$1(function*(){i.ps.clear();const e=i.flush().catch(()=>{});void 0!==t?yield _i(e,t):yield e;})()}flushWithTimeout(t){var i=this;return J$1(function*(){const e=i.flush();yield _i(e,t,()=>{e.catch(()=>{});});})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1;},t=>{this.ks++,this.Ss=Ts(),this.$.error("PostHog logs flush failed:",t);}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs());});}};const Rs=/^[0-9a-f]+$/;function Os(t,i,e){return "string"==typeof t&&t.length===i&&t!==e&&Rs.test(t)}const Is=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const As="00",Fs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ms(t){return String(t)+"000000"}function Ds(t,i,e,s){let n="";return s&&(n=Object.keys(s).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(s[t])}`).join(",")),`${t}\0${i}\0${null!=e?e:""}\0${n}`}var Ns=class{constructor(t,i,e){this._instance=t,this.Ar=i,this.$=e,this.Hs=new Map,this.ps=new ks(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t);})),this.ys=null,this.Us=false,this.Ws=new Map,this.Vs=new Set,this.ws=new ai,this.ks=0,this.Ss=1,this.Gs=0;}count(t,i=1,e){this.Qs({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.Qs({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.Qs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes});}flush(){var t=this;const i=this.ys,e=function(){var e=J$1(function*(){i&&(yield i.catch(()=>{})),yield t.Zs();});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null);});return this.ys=e,e}drainWindow(){if(0===this.Hs.size)return null;const t=this.Hs;return this.Hs=new Map,this.Us=false,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=false,this.Ws=new Map,this.Vs=new Set;}Qs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Os(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.$.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"===i.type&&0>i.value)return void this.$.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?wi({},i.attributes):void 0,s=Ds(i.type,i.name,i.unit,e);}catch(t){return void this.$.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Hs.set(s,n);}const r=this.Ws.get(i.name);void 0===r?this.Ws.set(i.name,i.type):r===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.$.warn(`Metric name '${i.name}' is already used as a ${r}; recording it as a ${i.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,i.value);const o=this.Ys();o&&(n.exemplar=wi(wi({},o),{},{value:i.value,timeMs:Date.now()})),this.Fs();}Ys(){try{var t,i;const e=function(t){const i=function(t){if("string"!=typeof t)return;const i=Is.exec(t.trim());if(!i)return;const[,e,s,n,r,o]=i;return "ff"===e||"00"===e&&o||!function(t){return Os(t,32,"00000000000000000000000000000000")}(s)||!function(t){return Os(t,16,"0000000000000000")}(n)?void 0:{version:e,traceId:s,spanId:n,flags:r}}(t);return i&&{traceId:i.traceId,spanId:i.spanId,flags:(e=i.flags,1&parseInt(e,16)?"01":As)};var e;}(null===(t=(i=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(i))||void 0===t?void 0:t.traceparent());if(e&&"01"===e.flags)return {traceId:e.traceId,spanId:e.spanId}}catch(t){}}Ks(){return this.Ar.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=true,this.$.warn(`Metric series cap reached (${this.Ar.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),false)}Xs(t,i){switch(t.type){case "count":var e;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(Fs.length+1).fill(0)});const e=t.hist;e.count+=1,e.sum+=i,e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.bucketCounts[function(t,i){for(let e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Fs)]+=1;break}}}Os(t){const i=this.Ar.beforeSend;if(!i)return t;const e=k$1(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.$.info("Metric was rejected in beforeSend function"),null;s=i;}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return s}Fs(){this.ps.pending||this.ps.arm(this.zs());}zs(){return Math.max(Ps(this.Ar.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var t=this;return J$1(function*(){if(t.ps.clear(),0===t.Hs.size)return;const i=t.Hs;t.Hs=new Map,t.Us=false,t.Ws=new Map,t.Vs=new Set;const e=t.Gs,s=yield t._instance.po(t.Js(i));if(e===t.Gs)switch(t.ws.record(s),"retry-later"===s.kind?(t.ks++,t.Ss=Ts()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),s.kind){case "ok":return;case "retry-later":return t.mo(i),void t.ps.armNoEarlierThan(t.zs());case "too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case "fatal":return void t.$.error("Failed to send metrics batch:",s.error)}})()}Js(t){return i=this.yo(t),e=function(t,i,e){return _s(t,i,e)}(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ms(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n;}yo(t){const i=Ms(Date.now()),e=new Map;for(const o of t.values()){var s;const t=Ds(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=wi({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:true,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},e.set(t,l));const u=cs(null!==(s=o.attributes)&&void 0!==s?s:{},this.$),a=Ms(o.windowStartMs),h=js$1(o.exemplar);if("count"===o.type){var n;const t=wi({attributes:u,startTimeUnixNano:a,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0},h);l.sum.dataPoints.push(t);}else if("gauge"===o.type){var r;const t=wi({attributes:u,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0},h);l.gauge.dataPoints.push(t);}else if(o.hist){const t=wi({attributes:u,startTimeUnixNano:a,timeUnixNano:i,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Fs},h);l.histogram.dataPoints.push(t);}}return Array.from(e.values())}mo(t){for(const[n,r]of t){var i;const t=this.Hs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(i=t.exemplar)&&void 0!==i?i:r.exemplar,t.type){case "count":var e,s;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(s=r.total)&&void 0!==s?s:0);break;case "gauge":break;case "histogram":if(r.hist)if(t.hist){t.hist.count+=r.hist.count,t.hist.sum+=r.hist.sum,t.hist.min=Math.min(t.hist.min,r.hist.min),t.hist.max=Math.max(t.hist.max,r.hist.max);for(let i=0;t.hist.bucketCounts.length>i;i++)t.hist.bucketCounts[i]+=r.hist.bucketCounts[i];}else t.hist=r.hist;}else this.Ks()&&this.Hs.set(n,r);}}};function js$1(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:Ms(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}const Ls=(t,{debugEnabled:i}={})=>{const e={N(e,...s){let n;try{n=typeof window>"u"?void 0:window;}catch(t){return}n&&(v$1.DEBUG||n.POSTHOG_DEBUG||i)&&!R$1(n.console)&&n.console&&("__rrweb_original__"in n.console[e]?n.console[e].__rrweb_original__:n.console[e])(t,...s);},debug(...t){e.N("debug",...t);},info(...t){e.N("log",...t);},warn(...t){e.N("warn",...t);},error(...t){e.N("error",...t);},critical(...i){console.error(t,...i);},uninitializedWarning(t){e.error(`You must initialize PostHog before calling ${t}`);},createLogger:(i,e)=>Ls(`${t} ${i}`,e)};return e},Us=Ls("[PostHog.js]"),Bs=Us.createLogger,zs=Bs("[ExternalScriptsLoader]"),Hs=t=>{const i=null==s$1?void 0:s$1.querySelectorAll("script");if(i)for(let e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},qs=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return zs.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const n=Hs(i);if(n){if(n.__posthog_loading_callback_fired)return e();const t=n.__posthog_loading_error;return t?e(t):(n.addEventListener("load",t=>{n.__posthog_loading_callback_fired=true,e(void 0,t);}),void n.addEventListener("error",t=>{n.__posthog_loading_error=t,e(t);}))}const r=()=>{if(!s$1)return e("document not found");if(Hs(i))return qs(t,i,e);let n=s$1.createElement("script");if(n.type="text/javascript",n.crossOrigin="anonymous",n.src=i,n.onload=t=>{n.__posthog_loading_callback_fired=true,e(void 0,t);},n.onerror=t=>{n.__posthog_loading_error=t,e(t);},t.config.prepare_external_dependency_script&&(n=t.config.prepare_external_dependency_script(n)),!n)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)s$1.head.appendChild(n);else {const t=s$1.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(n,t[0]):s$1.body.appendChild(n);}};(null==s$1?void 0:s$1.body)?r():null==s$1||s$1.addEventListener("DOMContentLoaded",r);},Vs={},Ws=(t,i)=>{let e=`/static/${i}.js?v=${t.version}`;if("toolbar"===i){const t=3e5;e=`${e}&t=${Math.floor(Date.now()/t)*t}`;}return t.requestRouter.endpointFor("assets",e)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void qs(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=Vs[n];if("fallback"===s&&r){if(Hs(r))return void qs(t,r,e);delete Vs[n];}return void qs(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else {var o;const s=Ws(t,i);Vs[n]=s;const r=Hs(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),qs(t,s,e);}else e(void 0,r);}:e)}qs(t,Ws(t,i),e);},d.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{const s=t.requestRouter.endpointFor("api",i);qs(t,s,e);},v$1.DEBUG=false,v$1.LIB_VERSION="1.443.0",v$1.LIB_NAME="web";var Gs=v$1;const Ks="$early_access_features",Js="$active_feature_flags",Ys="$feature_flag_details",Zs="$feature_flag_errors",Xs="$feature_flag_evaluated_at",Qs="$feature_flag_request_id",tn$1="$minimal_flag_called_events",en$1="$enabled_feature_flags",sn$1="$stored_group_properties",nn$1="$stored_person_properties",rn$1="$flag_call_reported",on$2="$flag_call_reported_session_id",ln$1="$feature_flag_payloads",un$1="$override_feature_flags",an$1="$override_feature_flag_payloads",hn$1="visibilitychange",dn$1="$autocapture_disabled_server_side",cn$1="$surveys",vn$1="$surveys_loaded_at",fn$1="PostHog loadExternalDependency extension not found.",pn$1="$surveys_activated",_n="$surveys_activated_session",gn$1="$surveys_activated_timestamps",mn$1="$people_distinct_id",yn$1="distinct_id",bn$1="$device_id",wn$1="$device_model",$n="__alias",Sn$1="__cmpns",xn$1="$fbc",En$1="$fbc_persistence",kn$1="$fbp",Tn="$fbp_persistence",Pn="__timers",Cn$1="$heatmaps_enabled_server_side",Rn$1="$exception_capture_enabled_server_side",On="$error_tracking_suppression_rules",In$1="$error_tracking_capture_extension_exceptions",An$1="$web_vitals_enabled_server_side",Fn$1="$dead_clicks_enabled_server_side",Mn$1="$product_tours_enabled_server_side",Dn$1="$logs_capture_enabled_server_side",Nn="$web_vitals_allowed_metrics",jn="$session_recording_remote_config",Ln$1="$session_recording_enabled_server_side",Un="$replay_sample_rate",Bn$1="$replay_override_sampling",zn$1="$replay_override_linked_flag",Hn="$replay_override_url_trigger",qn="$replay_override_event_trigger",Vn="$sesid",Wn="$session_is_sampled",Gn="$session_past_minimum_duration",Kn="$session_recording_url_trigger_activated_session",Jn="$session_recording_event_trigger_activated_session",Yn="$debug_first_full_snapshot_timestamp",Zn="$sess_rec_flush_size",Xn="$groups",Qn="ph_product_tours",tr$1="$product_tours_activated",ir$1="$product_tours_activated_session",er$1="$conversations_widget_session_id",sr$1="$conversations_ticket_id",nr$1="$conversations_widget_state",rr$1="$conversations_user_traits",or$1="$user_state",lr$1="$client_session_props",ur$1="$capture_rate_limit",ar$1="$initial_campaign_params",hr$1="$initial_referrer_info",dr="$initial_person_info",cr$1="$epp",vr$1="$posthog_cookieless",fr$1="$cookieless_mode",pr="$sdk_debug_extensions_init_method",_r$1="$sdk_debug_extensions_init_time_ms",gr="$sdk_debug_recording_script_not_loaded",mr$1="$sdk_debug_replay_stale_config",yr="$sdk_debug_replay_event_trigger_status",br$1="$sdk_debug_replay_linked_flag_trigger_status",wr="$sdk_debug_replay_matched_recording_trigger_groups",$r="$sdk_debug_replay_pending_trigger_conditions",Sr$1="$sdk_debug_replay_remote_trigger_matching_config",xr="$sdk_debug_replay_trigger_groups_count",Er="$sdk_debug_replay_url_trigger_status",kr="$session_recording_start_reason",Tr="anonymous",Pr="identified",Cr="identified_only",Rr="beforeunload",Or="$pageview",Ir="$pageleave",Ar="$identify",Fr="$groupidentify";function Mr(t,i){k$1(t)&&t.forEach(i);}function Dr(t,i){if(!F$1(t))if(k$1(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)x$1.call(t,e)&&i(t[e],e);}const Nr=function(t,...i){for(const e of i)for(const i in e) void 0!==e[i]&&(t[i]=e[i]);return t};function jr(t){const i=Object.keys(t);let e=i.length;const s=new Array(e);for(;e--;)s[e]=[i[e],t[i[e]]];return s}const Lr=function(t){return function(...i){try{return t.apply(this,i)}catch(t){Us.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Us.critical(t);}}},Ur=function(t){const i={};return Dr(t,function(t,e){(O$1(t)&&t.length>0||M$1(t))&&(i[e]=t);}),i};function Br(t){const i=wi({},t);for(const e of ["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e]);}catch(t){}return i}const zr=["herokuapp.com","vercel.app","netlify.app"];function Hr(t){const i=null==t?void 0:t.hostname;if(!O$1(i))return false;const e=i.split(".").slice(-2).join(".");for(const t of zr)if(e===t)return false;return true}function qr(t,i,e,s){const{capture:n=false,passive:r=true}=null!=s?s:{};null==t||t.addEventListener(i,e,{capture:n,passive:r});}function Vr(t){return "ph_toolbar_internal"===t.name}const Wr=t=>{if(s$1){try{const i=t+"=",e=s$1.cookie.split(";").filter(t=>t.length);for(let t=0;e.length>t;t++){let s=e[t];for(;" "==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}};var Gr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,s,n){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(s)||!Number.isInteger(n)||0>i||0>e||0>s||0>n||i>0xffffffffffff||e>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=i/Math.pow(2,40),r[1]=i/Math.pow(2,32),r[2]=i/Math.pow(2,24),r[3]=i/Math.pow(2,16),r[4]=i/256,r[5]=i,r[6]=112|e>>>8,r[7]=e,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new t(r)}toString(){let t="";for(let 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(let i=0;16>i;i++){const e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},Kr=class{generate(){const t=this.generateOrAbort();if(!R$1(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(R$1(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return M$1(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.It();else {if(this.Ct>=t+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It());}return Gr.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32());}constructor(){this.Ct=0,this.Mt=0,this.Tt=new Zr;}};const Jr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};let Yr;var Zr=class{nextUint32(){var t;return this.Rt.length>this.$t||((null!==(t=Yr)&&void 0!==t?t:Yr="u">typeof window&&!R$1(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(i){return Jr(t)}}:Jr)(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0;}};let Xr;const Qr=()=>to().toString(),to=()=>(Xr||(Xr=new Kr)).generate();let io="";const eo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let so=null;const no={Et(){if(!A$1(so))return so;if(so=false,s$1)try{const t=`__ph_cookie_support_${Qr()}`;no.At(t,"xyz"),so='"xyz"'===Wr(t),no.Pt(t);}catch(t){so=false;}return so},Ft(t){Us.error("cookieStore error: "+t);},Ot:Wr,Lt(t){let i;try{i=JSON.parse(no.Ot(t))||{};}catch(t){}return i},At(t,i,e,n,r){if(!s$1)return false;try{let o="",l="";const u=function(t,i){if(i){let i=function(t,i=s$1){if(io)return io;if(!i)return "";if(["localhost","127.0.0.1"].includes(t))return "";const e=t.split(".");let n=Math.min(e.length,8);const r="dmn_chk_"+Qr();for(;!io&&n--;){const t=e.slice(n).join("."),s=r+"=1;domain=."+t+";path=/";i.cookie=s+";max-age=3",i.cookie.includes(r)&&(i.cookie=s+";max-age=0",io=t);}return io}(t);if(!i){const e=(t=>{const i=t.match(eo);return i?i[0]:""})(t);e!==i&&Us.info("Warning: cookie subdomain discovery mismatch",e,i),i=e;}return i?"; domain=."+i:""}return ""}(s$1.location.hostname,n);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),o="; expires="+t.toUTCString();}r&&(l="; secure");const a=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+u+l;return a.length>3686.4&&Us.warn("cookieStore warning: large cookie, len="+a.length),s$1.cookie=a,!0}catch(t){return false}},Pt(t,i){if((null==s$1?void 0:s$1.cookie)&&(!i||!A$1(Wr(t))))try{no.At(t,"",-1,i);}catch(t){return}}};let ro=null;const oo={Et(){if(!A$1(ro))return ro;let i=true;if(R$1(t))i=false;else try{const t="__mplssupport__";oo.At(t,"xyz"),'"xyz"'!==oo.Ot(t)&&(i=!1),oo.Pt(t);}catch(t){i=false;}return i||Us.error("localStorage unsupported; falling back to cookie store"),ro=i,i},Ft(t){Us.error("localStorage error: "+t);},Ot(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){oo.Ft(t);}return null},Lt(t){try{return JSON.parse(oo.Ot(t))||{}}catch(t){}return null},At(i,e){try{return null==t||t.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){oo.Ft(t);}return false},Pt(i){try{null==t||t.localStorage.removeItem(i);}catch(t){oo.Ft(t);}}},lo=[nn$1,Js,en$1,Ys,ln$1,Qs,Xs,Zs,rn$1],uo=[bn$1,yn$1,Vn,Wn,cr$1,dr,En$1,or$1],ao=t=>t+"_cpm",ho=["__proto__","constructor","prototype"],co=t=>{if(!P$1(t))return {};const i={};return Object.keys(t).forEach(e=>{ -1===ho.indexOf(e)&&(i[e]=t[e]);}),i},vo=(t,i=[])=>{const e={};return [...uo,...i].forEach(i=>{const s=t[i];R$1(s)||A$1(s)||""===s||(e[i]=s);}),e},fo=t=>{let i=5381,e=2166136261;for(let s=0;t.length>s;s++){const n=t.charCodeAt(s);i=33*i^n,e=Math.imul(e^n,16777619);}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},po=(t,i)=>({p:i,f:fo(JSON.stringify(t))}),_o=(t,i)=>{if(!i)return {properties:[],isValid:false};try{const e=no.Lt(ao(t)),s=(null==e?void 0:e.f)===fo(i)&&k$1(e.p);return {properties:s?e.p:[],isValid:s}}catch(t){return {properties:[],isValid:false}}},go=(t,i)=>i+"|"+(no.Ot(ao(t))||""),mo={},yo={Et:()=>true,Ft(t){Us.error("memoryStorage error: "+t);},Ot:t=>t in mo?mo[t]:null,Lt:t=>t in mo?mo[t]:null,At:(t,i)=>(mo[t]=i,true),Pt(t){delete mo[t];}};let bo=null;const wo={Et(){if(!A$1(bo))return bo;if(bo=true,R$1(t))bo=false;else try{const t="__support__";wo.At(t,"xyz"),'"xyz"'!==wo.Ot(t)&&(bo=!1),wo.Pt(t);}catch(t){bo=false;}return bo},Ft(t){Us.error("sessionStorage error: ",t);},Ot(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){wo.Ft(t);}return null},Lt(t){try{return JSON.parse(wo.Ot(t))||null}catch(t){}return null},At(i,e){try{return null==t||t.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){wo.Ft(t);}return false},Pt(i){try{null==t||t.sessionStorage.removeItem(i);}catch(t){wo.Ft(t);}}};var $o=class{constructor(t){this._instance=t;}get Ar(){return this._instance.config}get consent(){return this.Sl()?0:this.xl}isOptedOut(){return "always"===this.Ar.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Ar.cookieless_mode}isOptedIn(){return !this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Ar.opt_out_capturing_by_default}optInOut(t){this.$l.At(this.Cl,t?1:0,this.Ar.cookie_expiration,this.Ar.cross_subdomain_cookie,this.Ar.secure_cookie);}reset(){this.$l.Pt(this.Cl,this.Ar.cross_subdomain_cookie);}get Cl(){const{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get xl(){const t=this.$l.Ot(this.Cl);return W$1(t)?1:m(G$1,t)?0:-1}get $l(){const t=this.Ar.opt_out_capturing_persistence_type,i="localStorage"===t?oo:no,e=i.Et()?i:yo;if(!this.Tl||this.Tl!==e){this.Tl=e;const i="localStorage"===t?no:oo;i.Ot(this.Cl)&&(this.Tl.Ot(this.Cl)||this.optInOut(W$1(i.Ot(this.Cl))),i.Pt(this.Cl,this.Ar.cross_subdomain_cookie));}return this.Tl}Sl(){return !!this.Ar.respect_dnt&&[null==e$1?void 0:e$1.doNotTrack,null==e$1?void 0:e$1.msDoNotTrack,d.doNotTrack,null==e$1?void 0:e$1.globalPrivacyControl].some(t=>W$1(t))}};function So(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!T$1(s))return i;try{const t=s(i);return O$1(t)&&t?t:i}catch(t){return Us.error("Error in get_current_url, falling back to window.location.href",t),i}}function xo(t){var i;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(i=t.closest)||void 0===i?void 0:i.call(t,".toolbar-global-fade-container")))}function Eo(t){return !!t&&1===t.nodeType}function ko(t,i){return !!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function To(t){return !!t&&3===t.nodeType}function Po(t){return !!t&&11===t.nodeType&&Eo(t.host)}function Co(t){return t?y$1(t).split(/\s+/):[]}function Ro(t,i){const e=function(t){var i;const e=typeof window>"u"?void 0:window,s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return R$1(s)?void 0:So(t,s)}(i);return !!(e&&t&&t.some(t=>e.match(t)))}function Oo(t){let 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 Co(i)}function Io(t){return F$1(t)?null:y$1(t).split(/(\s+)/).filter(t=>ul(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ao(t){let i="";return Qo(t)&&!tl(t)&&t.childNodes&&t.childNodes.length&&Dr(t.childNodes,function(t){var e;To(t)&&t.textContent&&(i+=null!==(e=Io(t.textContent))&&void 0!==e?e:"");}),y$1(i)}function Fo(t){var i;return R$1(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Mo=["a","button","form","input","select","textarea","label"];function Do(t,i){const e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return !!e&&e.call(t,i)}catch(t){return false}}function No(t,i){if(R$1(i))return true;for(const e of t)if(i.some(t=>Do(e,t)))return true;return false}function jo(t){const i=t.parentNode;return !(!i||!Eo(i))&&i}const Lo=[".ph-no-autocapture","[data-ph-no-autocapture]"],Uo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Bo=[...Uo,"+","-","−","–"],zo=Bo.length+10,Ho=["button","a","input","select","textarea","label"],qo=["button","link","tab","menuitem","option"],Vo=(t,i)=>/[a-z0-9]/i.test(i)?m(Bo,i)?new RegExp(`\\b${i}\\b`).test(t):t.includes(i):t===i,Wo=t=>m(Ho,t.tagName.toLowerCase())||m(qo,(t.getAttribute("role")||"").toLowerCase());function Go(t){let i="",e="";const s=t=>{Eo(t)&&Qo(t)&&!tl(t)&&(i+=` ${Ao(t)}`,e=e||t.getAttribute("aria-label")||"",Dr(t.childNodes,s));};s(t),i=y$1(i.replace(/\s+/g," "));const n=(ul(i)?i:"").toLowerCase(),r=t.getAttribute("aria-label")||(n?"":e);return {safeText:n,ariaLabel:y$1(r).toLowerCase()}}const Ko=[".ph-no-rageclick",".ph-no-capture"],Jo=["","text","search","email","password","url","tel","number"];function Yo(t,i){if(!(typeof window>"u"?void 0:window)||Zo(t))return false;let e,s,n;var r,o;if(N$1(i)?(e=!!i&&Ko,s=void 0,n=false):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:Ko,s=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),false===e)return false;if(n&&function(t){return !(!t||!Eo(t))&&(!!ko(t,"textarea")||(ko(t,"input")?m(Jo,(t.getAttribute("type")||"").toLowerCase()):function(t){var i;if(t.isContentEditable)return true;const e=null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"contenteditable");return "true"===e||""===e}(t)))}(t))return false;const{targetElementList:l}=Xo(t,false);return !(s&&function(t,{safeText:i,ariaLabel:e}){let s;if(true===t)s=Uo;else {if(!k$1(t))return false;if(t.length>zo)return Us.error(`[PostHog] content_ignorelist array cannot exceed ${zo} items. Use css_selector_ignorelist for more complex matching.`),false;s=t.map(t=>t.toLowerCase());}return s.some(t=>Vo(i,t)||Vo(e,t))}(s,function(t,i){for(const t of i)if(Wo(t))return Go(t);for(const t of i){try{var e;if("pointer"!==(null===(e=window)||void 0===e?void 0:e.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const i=Go(t);if(i.safeText||i.ariaLabel)return i}return Go(t)}(t,l))||No(l,e))}const Zo=t=>!t||ko(t,"html")||!Eo(t),Xo=(t,i)=>{const e=typeof window>"u"?void 0:window;if(!e||Zo(t))return {parentIsUsefulElement:false,targetElementList:[]};let s=false;const n=[t];let r=t;for(;r.parentNode&&!ko(r,"body");){if(Po(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=jo(r);if(!t)break;if(i||Mo.indexOf(t.tagName.toLowerCase())>-1)s=true;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0);}catch(t){}n.push(t),r=t;}return {parentIsUsefulElement:s,targetElementList:n}};function Qo(t){const i=new Set;let e=0;for(let s=t;s.parentNode&&!ko(s,"body");s=s.parentNode){if(e++>=1e3||i.has(s))return false;i.add(s);const t=Oo(s);if(m(t,"ph-sensitive")||m(t,"ph-no-capture"))return false}if(m(Oo(t),"ph-include"))return true;const s=t.type||"";if(O$1(s))switch(s.toLowerCase()){case "hidden":case "password":return false}const n=t.name||t.id||"";return !O$1(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function tl(t){return !!(ko(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ko(t,"select")||ko(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const il=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}))$"),el=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,sl=[16,15,14,13],nl=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),rl=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),ol=/[0-9A-Za-z_]/;function ll(t){let i=0,e=false;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e;}return i%10==0}function ul(t,i=true){if(F$1(t))return false;if(O$1(t)){if(t=y$1(t),i?il.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(el.lastIndex=0;i=el.exec(t);){const t=i[2];if(!t)continue;const e=t.replace(/[- ]/g,"");for(let t=0;e.length>t;t++)for(const i of sl){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(il.test(i)&&ll(i))return true}}}return false}(t))return false;if(i?nl.test(t):function(t){let i;for(rl.lastIndex=0;i=rl.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&ol.test(t)&&ol.test(e)))return true}return false}(t))return false}return true}function al(t){let i=Ao(t);return i=`${i} ${hl(t)}`.trim(),ul(i)?i:""}function hl(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Dr(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=Ao(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${hl(t)}`.trim());}catch(t){Us.error("[AutoCapture]",t);}}),i}function dl(t){return t.replace(/"|\\"/g,'\\"')}function cl(t){const i=t.attr__class;if(i)return k$1(i)?i:Co(i)}const vl=Bs("[Dead Clicks]"),fl=()=>true,pl=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(Fn$1)),s=t.instance.config.capture_dead_clicks;return N$1(s)?s:!!P$1(s)||e};var _l=class{get lazyLoadedDeadClicksAutocapture(){return this.Il}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop();}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Fn$1]:i.captureDeadClicks}),this.startIfEnabledOrStop());}startIfEnabledOrStop(){this.isEnabled(this)?this.Ml(()=>{this.El();}):this.stop();}Ml(t){var i,e,s;(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=d.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this.instance,"dead-clicks-autocapture",i=>{i?vl.error("failed to load script",i):t();});}El(){var t;if(s$1){if(!this.Il&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=P$1(this.instance.config.capture_dead_clicks)?wi({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=false),this.Il=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Il.start(s$1),vl.info("starting...");}}else vl.error("`document` not found. Cannot start.");}stop(){this.Il&&(this.Il.stop(),this.Il=void 0,vl.info("stopping..."));}};const gl=Bs("[SegmentIntegration]");function ml(t,i,e=true){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>T$1(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||Qr();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(or$1,Pr)),e(s?void 0:i.anonymousId()||void 0);},r=i.user();"then"in r&&T$1(r.then)?r.then(n):n(r);}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||gl.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!i&&s.event.anonymousId===i&&!s.event.userId;r||s.event.userId||s.event.anonymousId===t.get_distinct_id()||(gl.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(gl.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!F$1(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))x$1.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=k$1(t)?t:[t];let s=wi({},i);for(const t of e)try{if(s=t(s),F$1(s))return null}catch(t){return gl.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(F$1(n))return s;o=n;}return s.event.properties=Object.assign({},o,s.event.properties),s};return {name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return true},load(){return Promise.resolve()},track(t){return s(t,t.event.event)},page(t){return s(t,Or)},identify(t){return s(t,Ar)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i();},t=>{gl.error("Failed to register the Segment integration",t),i();});},e);}const yl="posthog-js";function bl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=true}={}){return o=>{var l,u,a,h,d;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const c=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:true}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>wi(wi({},t),{},{stacktrace:t.stacktrace?wi(wi({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>wi(wi({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(u=v[0])||void 0===u?void 0:u.value)||o.message,$exception_type:null===(a=v[0])||void 0===a?void 0:a.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(d=v[0])||void 0===d?void 0:d.type,$sentry_tags:o.tags};var _;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(_=t.exceptions)||void 0===_||_.sendExceptionEvent(p)),o}}var wl=class{constructor(t,i,e,s,n,r){this.name=yl,this.setupOnce=function(o){o(bl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}));};}},$l=class{constructor(t){this.Pl=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Us.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Rl=void 0,this._instance.scrollManager.resetContext());},this._instance=t,this.Al();}Al(){var t;this.Fl=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Pl);}destroy(){var t;null===(t=this.Fl)||void 0===t||t.call(this),this.Fl=void 0;}doPageView(i,e){var s;const n=this.Ol(i,e);return this.Rl={pathname:null!==(s=null==t?void 0:t.location.pathname)&&void 0!==s?s:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),n}doPageLeave(t){var i;return this.Ol(t,null===(i=this.Rl)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return {$pageview_id:null===(t=this.Rl)||void 0===t?void 0:t.pageViewId}}Ol(t,i){const e=this.Rl;if(!e)return {$pageview_id:i};let s={$pageview_id:i,$prev_pageview_id:e.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:i,maxScrollY:e,maxContentHeight:r,lastContentY:o,maxContentY:l}=n;if(!(R$1(t)||R$1(i)||R$1(e)||R$1(r)||R$1(o)||R$1(l))){t=Math.ceil(t),i=Math.ceil(i),e=Math.ceil(e),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const n=t>1?Q$1(i/t,0,1,Us):1,u=t>1?Q$1(e/t,0,1,Us):1,a=r>1?Q$1(o/r,0,1,Us):1,h=r>1?Q$1(l/r,0,1,Us):1;s=Nr(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:e,$prev_pageview_max_scroll_percentage:u,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:a,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h});}}return e.pathname&&(s.$prev_pageview_pathname=e.pathname),e.timestamp&&(s.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),s}};const Sl=["flags","surveys"],xl={[mn$1]:{exposure:"hidden"},[$n]:{exposure:"hidden"},[Sn$1]:{exposure:"hidden"},[Pn]:{exposure:"hidden"},[En$1]:{exposure:"hidden"},[Tn]:{exposure:"hidden"},[dn$1]:{exposure:"event"},[Cn$1]:{exposure:"hidden"},[Dn$1]:{exposure:"hidden"},[Rn$1]:{exposure:"event"},[On]:{exposure:"hidden"},[In$1]:{exposure:"event"},[An$1]:{exposure:"event"},[Fn$1]:{exposure:"event"},[Mn$1]:{exposure:"hidden"},[Nn]:{exposure:"event"},[jn]:{exposure:"hidden"},[Ln$1]:{exposure:"hidden"},[Vn]:{exposure:"hidden"},[Wn]:{exposure:"event"},[Un]:{exposure:"event",shouldSkipFromEventProperties:t=>A$1(t)},[Gn]:{exposure:"event"},[Kn]:{exposure:"event"},[Jn]:{exposure:"event"},[Yn]:{exposure:"event"},[Zn]:{exposure:"hidden"},[en$1]:{exposure:"hidden",storageGroup:"flags"},[Js]:{exposure:"hidden",storageGroup:"flags"},[Ks]:{exposure:"hidden"},[Ys]:{exposure:"hidden",storageGroup:"flags"},[ln$1]:{exposure:"hidden",storageGroup:"flags"},[Qs]:{exposure:"hidden",storageGroup:"flags",volatile:true},[tn$1]:{exposure:"hidden",storageGroup:"flags"},[un$1]:{exposure:"hidden"},[an$1]:{exposure:"hidden"},[nn$1]:{exposure:"hidden"},[sn$1]:{exposure:"hidden"},[cn$1]:{exposure:"hidden",storageGroup:"surveys"},[vn$1]:{exposure:"hidden",storageGroup:"surveys",volatile:true},[pn$1]:{exposure:"event"},[_n]:{exposure:"hidden"},[gn$1]:{exposure:"hidden"},[Qn]:{exposure:"hidden"},[tr$1]:{exposure:"hidden"},[ir$1]:{exposure:"hidden"},[er$1]:{exposure:"event"},[sr$1]:{exposure:"event"},[nr$1]:{exposure:"event"},[rr$1]:{exposure:"event"},[rn$1]:{exposure:"hidden"},[on$2]:{exposure:"hidden"},[Xn]:{exposure:"event"},[Zs]:{exposure:"hidden"},[Xs]:{exposure:"hidden",storageGroup:"flags",volatile:true},[or$1]:{exposure:"hidden"},[lr$1]:{exposure:"hidden"},[ur$1]:{exposure:"hidden"},[ar$1]:{exposure:"hidden"},[hr$1]:{exposure:"hidden"},[dr]:{exposure:"hidden"},[cr$1]:{exposure:"hidden"},[Bn$1]:{exposure:"event"},[zn$1]:{exposure:"event"},[Hn]:{exposure:"event"},[qn]:{exposure:"event"},[pr]:{exposure:"event"},[_r$1]:{exposure:"event"},[gr]:{exposure:"hidden"},[mr$1]:{exposure:"hidden"},[yr]:{exposure:"hidden"},[br$1]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[$r]:{exposure:"hidden"},[Sr$1]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Er]:{exposure:"hidden"},[kr]:{exposure:"event"}},El=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],kl=t=>{const i=xl[t];if(i)return i;for(const[i,e]of El)if(0===t.indexOf(i))return e};function Tl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const Pl=t=>{const i=typeof document>"u"?void 0:document,e=null==i?void 0:i.createElement("a");return R$1(e)?null:(e.href=t,e)},Cl=()=>{try{return "u">typeof window&&!1!==window.navigator.onLine}catch(t){return false}},Rl=(t,i)=>t>=i&&Cl(),Ol=(t,i,e,s)=>{if(0===t){if(Cl()){const t=i+1;return t===e&&s(),t}return i}return 0},Il=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return z$1(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,Br(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return w$1(t)}},Al=function(t,i){const e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let t=0;e.length>t;t++){const n=e[t].split(/=(.*)/);if(n[0]===i){s=n;break}}if(!k$1(s)||2>s.length)return "";{let t=s[1].replace(/\+/g," ");try{t=decodeURIComponent(t);}catch(i){Us.error("Skipping decoding for malformed query param: "+t);}return t}},Fl=function(t,i,e){if(!t||!i||!i.length)return t;const s=t.split(/#(.*)/),n=s[1],r=(s[0]||"").split(/\?(.*)/),o=r[1],l=r[0],u=(o||"").split("&"),a=[];for(let t=0;u.length>t;t++){const s=u[t].split("?");let n=0;for(;s.length>n&&!i.includes(s[n].split("=")[0]);)n++;a.push(s.length>n?s.slice(0,n).concat(s[n].split("=")[0]+"="+e).join("?"):u[t]);}let h=l;return null!=o&&(h+="?"+a.join("&")),null!=n&&(h+="#"+n),h},Ml=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Dl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Nl=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Dl],jl="<masked>",Ll=["li_fat_id"];function Ul(t,i,e){if(!s$1)return {};const n=i?[...Dl,...e||[]]:[],r=Bl(Fl(s$1.URL,n,jl),t),o=function(){const t={};return Dr(Ll,function(i){const e=Wr(i);t[i]=e||null;}),t}();return Nr(o,r)}function Bl(t,i){const e=Nl.concat(i||[]),s={};return Dr(e,function(i){const e=Al(t,i);s[i]=e||null;}),s}function zl(t){const 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",n={};if(!A$1(i)){n.$search_engine=i;const t=s$1?Al(s$1.referrer,e):"";t.length&&(n.ph_keyword=t);}return n}function Hl(){return navigator.language||navigator.userLanguage}function ql(){const t=Hl();return "string"==typeof t?t.split("-")[0]:void 0}const Vl="$direct";function Wl(){return (null==s$1?void 0:s$1.referrer)||Vl}function Gl(t,i,e=false){const s=t?[...Dl,...i||[]]:[],r=e?vi(null==n?void 0:n.href):null==n?void 0:n.href,o=null==r?void 0:r.substring(0,1e3);return {r:Wl().substring(0,1e3),u:o?Fl(o,s,jl):void 0}}function Kl(t,i=false){var e;const{r:s,u:n}=t,r=i?vi(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Vl?Vl:null===(e=Pl(s))||void 0===e?void 0:e.host};if(r){o.$current_url=r;const t=Pl(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const i=Bl(r);Nr(o,i);}if(s){const t=zl(s);Nr(o,t);}return o}function Jl(){try{return (new Date).getTimezoneOffset()}catch(t){return}}const Yl={flags:Xs,surveys:vn$1},Zl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Xl=t=>`${t}_cookie_identity_change_pending`,Ql=t=>{let i="",e=0;for(const s of t){const t=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(e+t>1e3)break;i+=s,e+=t;}return i},tu="main",iu=[en$1,Js,Ys,ln$1,Qs,Xs,tn$1,nn$1],eu=t=>-1!==iu.indexOf(t),su=[En$1,Tn],nu=t=>-1!==su.indexOf(t),ru=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},ou=t=>{if(!t)return {};const i=JSON.parse(t);return P$1(i)?i:{}},lu=(t,i)=>{Dr(t,(e,s)=>{const n=kl(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s];});};var uu=class{constructor(i,e,s=true,n=!i.cookieless_mode){if(this.Dl={},this.Ll=false,this.Nl=false,this.ql=false,this.jl=false,this.Bl=false,this.zl=new Map,this.Hl=false,this.Ul=false,this.Wl=false,this.Vl=new Set,this.Gl=new Set,this.Ar=i,this.Ql=s,this.props={},this.Zl=void 0,this.Jl=(t=>{let 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"})(i),this.hi=i.disable_persistence||!!e,this.$l=this.Kl(i),this.ql=this.Xl(i),this.load(n),this.Yl(),i.debug&&Us.info("Persistence loaded",i.persistence,wi({},this.props)),this.update_config(i,i,e),this.save(),t){const i=()=>this.flush();qr(t,"beforeunload",i,{capture:false}),qr(t,"pagehide",i,{capture:false}),this.tu=i=>{if(this.Ll&&(!i.storageArea||i.storageArea===(null==t?void 0:t.localStorage))&&i.key)if(i.key!==this.Jl){if(this.ql){const t=Sl.find(t=>i.key===this.eu(t));t&&this.iu(i.key,t);}}else this.iu(i.key,tu);},qr(t,"storage",this.tu);}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this.zl.get(t);if(!eu(t)||true===e)return;if(true===i)return void this.nu(t,true);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.nu(t,s);});}onCrossTabFeatureFlagChange(t){return this.Gl.add(t),()=>this.Gl.delete(t)}destroy(){this.tu&&t&&(t.removeEventListener("storage",this.tu),this.tu=void 0),this.Gl.clear();}iu(t,i,e=true){if(this.hi)return false;let s,n;try{if(n=oo.Ot(t),A$1(n)){const t=this.su(i);return t.storageValue=null,i!==tu&&(t.persisted=!1),!1}s=ou(n);}catch(t){return false}const r=i===tu?s:oo.Lt(this.Jl);if(r&&this.ru(r))return false;const o=this.ou(s,i,e);return i===tu&&this.ql&&!ru(this.au().main,s)||this.lu(s,i,true,n),o}ru(t){const i=this.props[yn$1],e=t[yn$1];return !R$1(i)&&!R$1(e)&&i!==e}lu(t,i,e,s){const n=this.su(i);n.storageValue=s,i!==tu&&(n.persisted=e);try{n.fingerprint=this.uu(t,i);}catch(t){n.fingerprint=void 0;}}ou(t,i,e){let s=false;return iu.forEach(e=>{var n;const r=null===(n=kl(e))||void 0===n?void 0:n.storageGroup;if(i===tu&&this.ql&&r||i!==tu&&r!==i)return;const o=e in t,l=this.cu(e,o?t[e]:void 0),u=this.zl.has(e)?e in this.props:o;u===e in this.props&&ru(l,this.props[e])||(u?this.hu(e,l,false):this.du(e,false),s=true);}),s&&e&&this.Gl.forEach(t=>t()),s}vu(){if(!this.Ll)return false;try{this.Wl=!1;const t=oo.Ot(this.Jl),i=this.su(tu);let e,s=!1,n=!1;if(t!==i.storageValue)if(A$1(t))i.storageValue=null;else {if(e=ou(t),this.Wl=!this.Ul&&this.ru(e),this.Wl)return !1;n=this.ou(e,tu,!1),!this.ql||ru(this.au().main,e)?this.lu(e,tu,!0,t):i.storageValue=t,s=!0;}return this.ql&&Sl.forEach(t=>{const i=oo.Ot(this.eu(t)),r=this.su(t),o=e||{},l=s&&iu.some(i=>{var e;return (null===(e=kl(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if(A$1(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.ou(o,t,!1)||n));const u=ou(i);n=this.ou(u,t,!1)||n,this.lu(u,t,!0,i);}),n}catch(t){return false}}nu(t,i){this.zl.set(t,i);const e=kl(t);(null==e?void 0:e.volatile)||(this.su((this.ql?null==e?void 0:e.storageGroup:void 0)||tu).fingerprint=void 0,this.fu(t));}pu(){iu.forEach(t=>this.zl.set(t,true));}Yl(){if(this.Ll)try{const t=oo.Ot(this.Jl),i=ou(t);this.su(tu).storageValue=t,iu.forEach(t=>{var e;const s=this.ql?null===(e=kl(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?oo.Ot(this.eu(s)):null;if(s){const t=this.su(s);t.storageValue=n,t.persisted=!A$1(n);}const r=s&&!A$1(n)?ou(n):i;t in this.props?this.gu(t,r[t],this.props[t]):t in r&&this.nu(t,!0);});}catch(t){}}cu(t,i){const e=this.zl.get(t);if(!e)return i;if(true===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(k$1(i)?i:[]),n=new Set(k$1(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=P$1(i)?wi({},i):{},n=P$1(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t];}),s}gu(t,i,e){if(!eu(t))return;const s=this.zl.get(t);if(true===s)return;let n=i;if(this.Ll)try{var r;const i=this.ql?null===(r=kl(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.eu(i):this.Jl;n=ou(oo.Ot(e))[t];}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!R$1(i)&&!k$1(i)||!R$1(n)&&!k$1(n)||!k$1(e))return void this.nu(t,true);const s=new Set(i||[]),r=new Set(n||[]),l=new Set(e);new Set([...s,...l]).forEach(t=>{s.has(t)!==l.has(t)&&o.add(t);}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t);});}else {if(!P$1(e))return void(ru(n,e)?this.zl.delete(t):this.nu(t,true));{if(!R$1(i)&&!P$1(i)||R$1(i)&&C(e)&&R$1(n))return void this.nu(t,true);const s=P$1(i)?i:{},r=P$1(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&ru(s[t],e[t])||o.add(t);}),o.forEach(t=>{t in r==t in e&&ru(r[t],e[t])&&o.delete(t);});}}o.size?this.nu(t,o):this.zl.delete(t);}mu(){var t;const i=null===(t=this.Ar)||void 0===t?void 0:t.persistence_save_debounce_ms;return M$1(i)&&i>0?i:0}yu(t){if(this.Ar.cookieWinsOnConflict&&"localstorage+cookie"===this.Ar.persistence.toLowerCase())if(t)try{const i=vo(t,this.Ar.cookie_persisted_properties||[]),e=po(i,this.Ar.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=no.Ot(this.Jl)||void 0;n&&go(this.Jl,n)===s&&(this.bu=s,this._u=n);}catch(t){}else try{const t=no.Ot(this.Jl)||void 0;this.bu=t?go(this.Jl,t):void 0,this._u=t;}catch(t){}}syncCookieProperties(){return this.wu(this.Ar)}wu(t,i=false){if(this.hi&&!i||this.Bl||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return false;let e;try{e=no.Ot(this.Jl)||void 0;}catch(t){}if(!e||e===this._u)return false;const s=go(this.Jl,e);let n;try{n=co(JSON.parse(e));}catch(t){return false}if((no.Ot(this.Jl)||void 0)!==e)return false;this.bu=s,this._u=e;const r=_o(this.Jl,e),o=[...uo,...r.properties],l={};if(Object.keys(n).forEach(t=>{const i=n[t];(R$1(i)||A$1(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(l[t]=true,delete n[t]);}),C(n))return false;const u="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,a=this.props,h=a[yn$1],d=a[or$1],c=Nr({},a);[...uo,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in n)&&!l[t]&&(u||"distinct_id"!==t&&"$user_state"!==t)){const i=c[t];(r.isValid||-1===uo.indexOf(t)||false!==i&&0!==i)&&delete c[t];}}),this.props=Nr(c,n),iu.forEach(t=>{const i=t in this.props;t in a===i&&ru(a[t],this.props[t])||(i?this.gu(t,a[t],this.props[t]):this.nu(t,true));}),!u||"$user_state"in n||"$user_state"in this.props||this.hu(or$1,Tr);const v=this.props[yn$1],f=this.props[or$1];return !u||v===h&&f===d||(this.Ul=true,this.jl=true,wo.At(Xl(this.Jl),true),this.du(nn$1),this.du(Js),this.du(en$1),this.du(Ys),this.du(ln$1),this.du(Qs),this.du(Xs),this.du(Zs),this.du(rn$1),"anonymous"!==f||"identified"!==d&&"anonymous"!==n.$user_state&&(R$1(h)||v===h)||(lu(this.props,n),this.du(sn$1)),"identified"===f?this.props.$user_id=v:delete this.props.$user_id,this.du($n)),true}consumeCookieIdentityChange(){const t=Xl(this.Jl),i=this.jl||!!wo.Ot(t);return this.jl=false,i&&wo.Pt(t),i}ku(t=false){return !(this.Bl||this.hi&&!t||!this.Ar.cookieWinsOnConflict||"localstorage+cookie"!==this.Ar.persistence.toLowerCase()||(this.Bl=true,0))}Su(){this.Bl&&(R$1(this.xu)||(clearTimeout(this.xu),this.xu=void 0),delete this.Dl[tu],this.$u(true));}Cu(t=true){if(this.Bl)try{t?this.Su():R$1(this.xu)||(clearTimeout(this.xu),this.xu=void 0);}finally{this.Bl=false;}}isDisabled(){return !!this.hi}Kl(i){ -1===Zl.indexOf(i.persistence.toLowerCase())&&(Us.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");const e=((i=[],e=false,s=()=>false)=>{const n=[...uo,...i];return wi(wi({},oo),{},{Tu(t){return [no.Ot(t),no.Ot(ao(t)),oo.Ot(t)].join("\0")},Lt(t){try{let r,o={};try{r=no.Ot(t)||void 0,o=r?co(JSON.parse(r)):{};}catch(t){}const l=JSON.parse(oo.Ot(t)||"{}");let u;if(e){const e=_o(t,r),s=[...uo,...e.properties],a={};Object.keys(o).forEach(t=>{const i=o[t];A$1(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(a[t]=i);});const h="distinct_id"in a||"anonymous"===a.$user_state||"identified"===a.$user_state;if(Object.keys(a).length>0){var i;const t=l[yn$1],r=null!==(i=l.$user_state)&&void 0!==i?i:Tr;n.forEach(t=>{if(-1!==s.indexOf(t)&&!(t in o)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const i=l[t];(e.isValid||-1===uo.indexOf(t)||!1!==i&&0!==i)&&delete l[t];}}),!h||"$user_state"in o||"$user_state"in l||(l[or$1]=Tr),!h||("distinct_id"in a?a[yn$1]:l[yn$1])===t&&("$user_state"in a?a[or$1]:l[or$1])===r||(lo.forEach(t=>delete l[t]),"identified"===a.$user_state&&"distinct_id"in a?l.$user_id=a[yn$1]:delete l.$user_id,"identified"!==a.$user_state&&(delete l[Xn],delete l[sn$1]),delete l.__alias);}u=Nr(l,a);}else u=Nr(o,l);return s()||oo.At(t,u),u}catch(t){}return null},At(t,s,n,r,o,l){const u=oo.At(t,s,void 0,void 0,l);try{const a=vo(s,i);if(Object.keys(a).length){if(e){const e=ao(t),h=po(a,i);if(no.At(e,h,n,r,o,l),no.Ot(e)!==JSON.stringify(h)){no.Pt(e,r);const i=vo(s);return no.At(t,i,n,r,o,l),u}}no.At(t,a,n,r,o,l);}}catch(t){oo.Ft(t);}return u},Pt(i,e){try{null==t||t.localStorage.removeItem(i),no.Pt(i,e),no.Pt(ao(i),e);}catch(t){oo.Ft(t);}}})})(i.cookie_persisted_properties||[],i.cookieWinsOnConflict,()=>!!this.hi);let s,n=false,r=false;const o=i.persistence.toLowerCase();return "localstorage"===o&&oo.Et()?(s=oo,r=true):"localstorage+cookie"===o&&e.Et()?(s=e,r=true,n=true):"sessionstorage"===o&&wo.Et()?s=wo:"memory"===o?s=yo:"cookie"===o&&no.Et()?(s=no,n=true):e.Et()?(s=e,r=true,n=true):no.Et()?(s=no,n=true):s=yo,this.Ll=r,this.Nl=n,s}eu(t){return `${this.Jl}__${t}`}Xl(t){return this.Ll&&!!t.split_storage}properties(){const t={};return Dr(this.props,(i,e)=>{const s=kl(e);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,i))return;t[e]=i;}}),t}load(t=false){if(this.hi&&!t)return;const i=this.Ar.cookieWinsOnConflict&&"localstorage+cookie"===this.Ar.persistence.toLowerCase(),e=i?oo.Lt(this.Jl):null;let s={};if(i)try{s=co(no.Lt(this.Jl)),Dr(s,(t,i)=>{(R$1(t)||A$1(t)||""===t)&&delete s[i];});}catch(t){}const n=this.$l.Lt(this.Jl);if(n&&(this.props=Nr({},n)),this.ql&&this.Iu(),i&&n){var r,o;const t=null==e?void 0:e[yn$1],i=null!==(r=null==e?void 0:e.$user_state)&&void 0!==r?r:Tr,l=n[yn$1],u=null!==(o=n.$user_state)&&void 0!==o?o:Tr;if(l!==t||u!==i){this.jl=true,this.hi||wo.At(Xl(this.Jl),true);const e=Nr({},this.props);lo.forEach(t=>delete e[t]),"anonymous"!==u||"identified"!==i&&"anonymous"!==s.$user_state&&(R$1(t)||l===t)||(lu(e,s),delete e[sn$1]),this.props=e;const n=new Set;lo.forEach(t=>{var i;const e=null===(i=kl(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e);}),n.forEach(t=>{if(this.hi)return;const i={};Dr(this.props,(e,s)=>{var n;(null===(n=kl(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e);}),C(i)?(oo.Pt(this.eu(t)),this.Dl[t]={}):oo.At(this.eu(t),i)&&(this.Dl[t]={persisted:true,fingerprint:this.uu(i,t)});});}}wo.Ot(Xl(this.Jl))&&(this.jl=true);}Iu(){for(const t of Sl){const i=oo.Lt(this.eu(t));if(i&&!C(i)){const e=this.su(t);e.persisted=true,this.Mu(t)||(e.fingerprint=this.uu(i,t)),this.Eu(t,i)||Nr(this.props,i);}}}Mu(t){return Object.keys(this.props).some(i=>{var e;return (null===(e=kl(i))||void 0===e?void 0:e.storageGroup)===t})}Eu(t,i){const e=Yl[t];if(!e)return false;const s=i[e],n=this.props[e];return M$1(s)&&M$1(n)&&n>s}refreshKey(t){this.Pu([t]);}Pu(t){if(this.hi)return;let i,e=false;const s=()=>(e||(i=this.$l.Lt(this.Jl),e=true),i);t.forEach(t=>{var i;if(this.Vl.has(t))return;const e=this.ql?null===(i=kl(t))||void 0===i?void 0:i.storageGroup:void 0,n=e?oo.Lt(this.eu(e)):s();if(n&&t in n)this.hu(t,n[t],false);else {if(e){const i=s();if(i&&t in i)return void this.hu(t,i[t],false)}this.du(t,false);}});}refreshMetaIdentifiers(){if(this.hi)return;const t=this.Ru();(R$1(t)||t!==this.Au)&&(this.Pu(su),this.Fu(t));}Fu(t=this.Ru()){this.Au=0===this.Vl.size?t:void 0;}Ru(){const t=this.$l.Tu?this.$l.Tu(this.Jl):this.$l.Ot(this.Jl);return O$1(t)?t:void 0}save(){if(this.hi)return;const t=this.mu();t>0?R$1(this.xu)&&(this.xu=setTimeout(()=>{this.xu=void 0,this.$u();},t)):this.$u();}flush(){R$1(this.xu)||(clearTimeout(this.xu),this.xu=void 0,this.$u());}$u(t=false){if(this.hi||this.Bl&&!t)return;t||(this.syncCookieProperties(),this.Ar.cookieWinsOnConflict&&"localstorage+cookie"===this.Ar.persistence.toLowerCase()||this.refreshMetaIdentifiers());const i=!t&&!this.Hl;i||(this.Wl=false);const e=!!i&&this.vu();if(this.Wl)return void(this.Ar.debug&&Us.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.ql)return this.Ou(),void(e&&this.Gl.forEach(t=>t()));const s=this.Du(this.$l,this.Jl,this.props,tu);"written"===s&&this.yu(this.props),"failed"!==s&&(this.zl.clear(),this.Ul=false,this.Vl.clear()),"written"===s&&this.Fu(),e&&this.Gl.forEach(t=>t());}Ou(){const{main:t,groups:i}=this.au(),e=this.Du(this.$l,this.Jl,t,tu);"written"===e&&this.yu(t),"failed"!==e&&(this.Ul=false,this.Vl.clear(),iu.forEach(t=>{var i;(null===(i=kl(t))||void 0===i?void 0:i.storageGroup)||this.zl.delete(t);})),"written"===e&&this.Fu();for(const t of Sl){var s;const e=i[t];if(C(e)&&!(null===(s=this.Dl[t])||void 0===s?void 0:s.persisted)){iu.forEach(i=>{var e;(null===(e=kl(i))||void 0===e?void 0:e.storageGroup)===t&&this.zl.delete(i);});continue}const n=this.Du(oo,this.eu(t),e,t);"failed"!==n&&iu.forEach(i=>{const e=kl(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this.zl.delete(i);});}}au(){const t={},i={flags:{},surveys:{}};return Dr(this.props,(e,s)=>{var n;const r=null===(n=kl(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e;}),{main:t,groups:i}}uu(t,i){if(i===tu)return JSON.stringify(t)+"|"+this.Lu+"|"+this.Nu+"|"+this.qu;const e={};return Dr(t,(t,i)=>{var s;e[i]=(null===(s=kl(i))||void 0===s?void 0:s.volatile)?"__volatile__":t;}),JSON.stringify(e)}Du(t,i,e,s){const n=this.su(s);if(s!==tu&&!n.dirty&&!R$1(n.fingerprint))return "skipped";let r;try{if(r=this.uu(e,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0;}return t.At(i,e,this.Lu,this.Nu,this.qu,this.Ar.debug)?(n.dirty=false,s!==tu&&(n.persisted=true),R$1(r)||(n.fingerprint=r),this.Ll&&(n.storageValue=oo.Ot(i)),"written"):(this.Ar.debug&&Us.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=false}={}){if(this.pu(),R$1(this.xu)||(clearTimeout(this.xu),this.xu=void 0),this.$l.Pt(this.Jl,false),this.$l.Pt(this.Jl,true),!t&&this.Ql)for(const t of Sl)oo.Pt(this.eu(t));t?delete this.Dl[tu]:this.Dl={},this.bu=void 0,this._u=void 0;}clear(){this.remove(),this.props={};}register_once(t,i,e){if(P$1(t)){this.syncCookieProperties(),R$1(i)&&(i="None"),this.Lu=R$1(e)?this.ju:e;let s=false;if(Dr(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.hu(e,t),s=true);}),s)return this.save(),true}return false}register(t,i){if(P$1(t)){this.syncCookieProperties(),this.Lu=R$1(i)?this.ju:i;let e=false;if(Dr(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||P$1(i)||k$1(i))&&(this.hu(s,i),e=true);}),e)return this.save(),true}return false}unregister(t){this.syncCookieProperties();const i="string"==typeof t?[t]:t;let e=false;for(const t of i)t in this.props&&(this.du(t),e=true);e&&this.save();}update_campaign_params(){const t=null==s$1?void 0:s$1.URL;if(t===this.Zl)return;const i=Ul(this.Ar.custom_campaign_params,this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties),e=!C(Ur(i));return e&&this.register(i),this.Zl=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==s$1?void 0:s$1.referrer;return t?zl(t):{}}());}update_referrer_info(){var t;this.register_once({$referrer:Wl(),$referring_domain:(null==s$1?void 0:s$1.referrer)&&(null===(t=Pl(s$1.referrer))||void 0===t?void 0:t.host)||Vl},void 0);}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Gl(this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties,this.Ar.disable_capture_url_hashes);this.register_once({[dr]:this.Nl?{r:Ql(t.r),u:t.u?Ql(t.u):void 0}:t},void 0);}get_initial_props(){const t={};Dr([hr$1,ar$1],i=>{const e=this.props[i];e&&Dr(e,function(i,e){t["$initial_"+b(e)]=i;});});const i=this.props[dr];if(i){const e=function(t,i=false){const e=Kl(t,i),s={};return Dr(e,function(t,i){s[`$initial_${b(i)}`]=t;}),s}(i,this.Ar.disable_capture_url_hashes);Nr(t,e);}return t}safe_merge(t){return Dr(this.props,function(i,e){e in t||(t[e]=i);}),t}update_config(t,i,e){const s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return false;const e=[...t].sort(),s=[...i].sort();return e.every((t,i)=>t===s[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),r=s||n,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,u=!!this.hi&&!l;l||this.wu(i,u),this.Ar=t,!l&&(s||n||o)&&(this.bu=void 0,this._u=void 0,this.wu(wi(wi({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),u));const a=r||o?this.Kl(t):this.$l;this.Bu();const h=this.Xl(t),d=r||h!==this.ql,c=!l&&(d||t.cross_subdomain_cookie!==this.Nu||t.secure_cookie!==this.qu)&&this.ku(u);this.Hl=d;try{if(this.ju=this.Lu=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){const t=this.props;this.clear(),this.$l=a,this.ql=h,this.props=t,this.save();}else o&&(this.$l=a,l||(delete this.Dl[tu],this.$u()));}finally{this.Hl=false,c&&this.Cu();}}Bu(){const t=this.props[dr];if(!this.Nl||!P$1(t)||"string"!=typeof t.r)return;const i=Ql(t.r),e="string"==typeof t.u?Ql(t.u):t.u;i===t.r&&e===t.u||this.hu(dr,wi(wi({},t),{},{r:i,u:e}));}set_disabled(t){this.hi=t,this.hi?this.remove():this.save();}set_cross_subdomain(t){t!==this.Nu&&(this.Nu=t,this.remove({keepGroupEntries:true}),this.save());}set_secure(t){t!==this.qu&&(this.qu=t,this.remove({keepGroupEntries:true}),this.save());}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this.hu(Pn,e),this.save();}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return R$1(e)||(delete i[t],this.hu(Pn,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.hu(t,i),this.save();}hu(t,i,e=true){var s;const n=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||n===i||(this.Ul=true),nu(t)&&!ru(n,i)&&this.Vl.add(t),this.gu(t,n,i),(null===(s=kl(t))||void 0===s?void 0:s.volatile)||this.fu(t));}du(t,i=true){delete this.props[t],i&&(eu(t)&&this.nu(t,true),nu(t)&&this.Vl.add(t),this.fu(t));}fu(t){var i;const e=null===(i=kl(t))||void 0===i?void 0:i.storageGroup;e&&(this.su(e).dirty=true);}su(t){return this.Dl[t]||(this.Dl[t]={})}};const au={GZipJS:"gzip-js",Base64:"base64"},hu={Activation:"events",Cancellation:"cancelEvents"},fu={Popover:"popover",API:"api",Widget:"widget"},mu={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},yu={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},bu={Popover:"popover",Inline:"inline"};function wu(t){let i=true;return {dispose(){if(i){i=false;const e=t();e&&T$1(e.then)&&e.then(void 0,()=>{});}}}}const Su={SHOWN:"product tour shown"},xu={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Eu=Bs("[RateLimiter]");var ku=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=false,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{Eu.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4;});}catch(t){return void Eu.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(true).isRateLimited;}get captureEventsPerSecond(){var t;return (null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=false){var i,e,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(i=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:n,last:o};l.tokens+=Math.max(0,o-l.last)/1e3*r,l.last=Math.max(l.last,o),l.tokens>n&&(l.tokens=n);const u=1>l.tokens;if(u||t||(l.tokens=Math.max(0,l.tokens-1)),u&&!t){const t=(M$1(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.zu(t)&&(l.dropped=0);}return this.lastEventRateLimited=u,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",l),{isRateLimited:u,remainingTokens:l.tokens}}Hu(t){const i=this.instance.config.property_denylist;return !k$1(i)||!i.includes(t)}Uu(){var t;if(this.Hu("$current_url")&&this.Hu("$pathname")&&(null==n?void 0:n.pathname))return `${null!==(t=n.origin)&&void 0!==t?t:""}${n.pathname}`}zu(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Uu(),o=this.Hu("$session_id")?null===(i=(e=this.instance).get_session_id)||void 0===i?void 0:i.call(e):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`: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: ${l}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:true})}isServerRateLimited(t){const i=this.serverLimits[t||"events"]||false;return false!==i&&(new Date).getTime()<i}};const Tu=Bs("[RemoteConfig]");var Pu=class{constructor(t){this._instance=t;}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Wu(t){var i,e,s;(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency)?null===(e=d.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"remote-config",()=>t(this.remoteConfig)):t();}Vu(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 Tu.info("Using preloaded remote config",this.remoteConfig),void this.Gu(this.remoteConfig);if(this._instance.Qu())return void Tu.warn("Remote config is disabled. Falling back to local config.");this.Wu(t=>{if(!t)return Tu.info("No config found after loading remote JS config. Falling back to JSON."),void this.Vu(t=>{this.Gu(t.json,t);});this.Gu(t);});}catch(t){Tu.error("Error loading remote config",t),this.Gu();}}Gu(t,i){!t&&i&&(0===i.statusCode?i.error||Tu.warn("Failed to fetch remote config from PostHog."):Tu.error("Failed to fetch remote config from PostHog."));try{this._instance.Gu(t?{ok:!0,config:t}:{ok:!1});}catch(t){Tu.error("Error applying remote config",t);}if(false!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null===(e=this._instance.featureFlags)||void 0===e||e.ensureFlagsLoaded();}catch(t){Tu.error("Error loading feature flags",t);}}};var Ru=Uint8Array,Ou=Uint16Array,Iu=Uint32Array,Au=new Ru([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]),Fu=new Ru([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]),Mu=new Ru([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Du=function(t,i){for(var e=new Ou(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new Iu(e[30]);for(s=1;30>s;++s)for(var r=e[s];e[s+1]>r;++r)n[r]=r-e[s]<<5|s;return [e,n]},Nu=Du(Au,2),ju=Nu[1];Nu[0][28]=258,ju[258]=28;for(var Lu=Du(Fu,0)[1],Uu=new Ou(32768),Bu=0;32768>Bu;++Bu){var zu=(43690&Bu)>>>1|(21845&Bu)<<1;Uu[Bu]=((65280&(zu=(61680&(zu=(52428&zu)>>>2|(13107&zu)<<2))>>>4|(3855&zu)<<4))>>>8|(255&zu)<<8)>>>1;}var Hu=function(t,i,e){for(var s=t.length,n=0,r=new Ou(i);s>n;++n)++r[t[n]-1];var o,l=new Ou(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;for(o=new Ou(s),n=0;s>n;++n)o[n]=Uu[l[t[n]-1]++]>>>15-t[n];return o},qu=new Ru(288);for(Bu=0;144>Bu;++Bu)qu[Bu]=8;for(Bu=144;256>Bu;++Bu)qu[Bu]=9;for(Bu=256;280>Bu;++Bu)qu[Bu]=7;for(Bu=280;288>Bu;++Bu)qu[Bu]=8;var Vu=new Ru(32);for(Bu=0;32>Bu;++Bu)Vu[Bu]=5;var Wu=Hu(qu,9),Gu=Hu(Vu,5),Ku=function(t){return (t/8|0)+(7&t&&1)},Ju=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof Ou?Ou:t instanceof Iu?Iu:Ru)(e-i);return s.set(t.subarray(i,e)),s},Yu=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8;},Zu=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16;},Xu=function(t,i){for(var e=[],s=0;t.length>s;++s)t[s]&&e.push({s:s,f:t[s]});var n=e.length,r=e.slice();if(!n)return [new Ru(0),0];if(1==n){var o=new Ru(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 l=e[0],u=e[1],a=0,h=1,d=2;for(e[0]={s:-1,f:l.f+u.f,l:l,r:u};h!=n-1;)l=e[e[d].f>e[a].f?a++:d++],u=e[a!=h&&e[d].f>e[a].f?a++:d++],e[h++]={s:-1,f:l.f+u.f,l:l,r:u};var c=r[0].s;for(s=1;n>s;++s)r[s].s>c&&(c=r[s].s);var v=new Ou(c+1),f=Qu(e[h-1],v,0);if(f>i){s=0;var p=0,_=f-i,g=1<<_;for(r.sort(function(t,i){return v[i.s]-v[t.s]||t.f-i.f});n>s;++s){var m=r[s].s;if(i>=v[m])break;p+=g-(1<<f-v[m]),v[m]=i;}for(p>>>=_;p>0;){var y=r[s].s;i>v[y]?p-=1<<i-v[y]++-1:++s;}for(;s>=0&&p;--s){var b=r[s].s;v[b]==i&&(--v[b],++p);}f=i;}return [new Ru(v),f]},Qu=function(t,i,e){return -1==t.s?Math.max(Qu(t.l,i,e+1),Qu(t.r,i,e+1)):i[t.s]=e},ta$1=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ou(++i),s=0,n=t[0],r=1,o=function(t){e[s++]=t;},l=1;i>=l;++l)if(t[l]==n&&l!=i)++r;else {if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0);}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0);}for(;r--;)o(n);r=1,n=t[l];}return [e.subarray(0,s),i]},ia$1=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},ea$1=function(t,i,e){var s=e.length,n=Ku(i+2);t[n]=255&s,t[n+1]=s>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var r=0;s>r;++r)t[n+r+4]=e[r];return 8*(n+4+s)},sa$1=function(t,i,e,s,n,r,o,l,u,a,h){Yu(i,h++,e),++n[256];for(var d=Xu(n,15),c=d[0],v=d[1],f=Xu(r,15),p=f[0],_=f[1],g=ta$1(c),m=g[0],y=g[1],b=ta$1(p),w=b[0],S=b[1],x=new Ou(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=Xu(x,7),T=k[0],P=k[1],C=19;C>4&&!T[Mu[C-1]];--C);var R,O,I,A,F=a+5<<3,M=ia$1(n,qu)+ia$1(r,Vu)+o,D=ia$1(n,c)+ia$1(r,p)+o+14+3*C+ia$1(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&D>=F)return ea$1(i,h,t.subarray(u,u+a));if(Yu(i,h,1+(M>D)),h+=2,M>D){R=Hu(c,v),O=c,I=Hu(p,_),A=p;var N=Hu(T,P);for(Yu(i,h,y-257),Yu(i,h+5,S-1),Yu(i,h+10,C-4),h+=14,E=0;C>E;++E)Yu(i,h+3*E,T[Mu[E]]);h+=3*C;for(var j=[m,w],L=0;2>L;++L){var U=j[L];for(E=0;U.length>E;++E)Yu(i,h,N[B=31&U[E]]),h+=T[B],B>15&&(Yu(i,h,U[E]>>>5&127),h+=U[E]>>>12);}}else R=Wu,O=qu,I=Gu,A=Vu;for(E=0;l>E;++E)if(s[E]>255){var B;Zu(i,h,R[257+(B=s[E]>>>18&31)]),h+=O[B+257],B>7&&(Yu(i,h,s[E]>>>23&31),h+=Au[B]);var z=31&s[E];Zu(i,h,I[z]),h+=A[z],z>3&&(Zu(i,h,s[E]>>>5&8191),h+=Fu[z]);}else Zu(i,h,R[s[E]]),h+=O[s[E]];return Zu(i,h,R[256]),h+O[256]},na$1=new Iu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oa$1=function(){for(var t=new Iu(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e;}return t}(),la$1=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8;};function ua$1(t,i){ void 0===i&&(i={});var e=function(){var t=4294967295;return {p(i){for(var e=t,s=0;i.length>s;++s)e=oa$1[255&e^i[s]]^e>>>8;t=e;},d(){return 4294967295^t}}}(),s=t.length;e.p(t);var n,r,o,l,u,h=(l=10+((n=i).filename&&n.filename.length+1||0),u=8,function(t,i,e,s,n,r){var o=t.length,l=new Ru(s+o+5*(1+Math.floor(o/7e3))+n),u=l.subarray(s,l.length-n),a=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?a=ea$1(u,a,t.subarray(h,d)):(u[h]=r,a=ea$1(u,a,t.subarray(h,o)));}else {for(var c=na$1[i-1],v=c>>>13,f=8191&c,p=(1<<e)-1,_=new Ou(32768),g=new Ou(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 Iu(25e3),S=new Ou(288),x=new Ou(32),E=0,k=0,T=(h=0,0),P=0,C=0;o>h;++h){var R=b(h),O=32767&h,I=g[R];if(_[O]=I,g[R]=O,h>=P){var A=o-h;if((E>7e3||T>24576)&&A>423){a=sa$1(t,u,0,w,S,x,k,T,C,h-C,a),T=E=k=0,C=h;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0;}var M=2,D=0,N=f,j=O-I&32767;if(A>2&&R==b(h-j))for(var L=Math.min(v,A)-1,U=Math.min(32767,h),B=Math.min(258,A);U>=j&&--N&&O!=I;){if(t[h+M]==t[h+M-j]){for(var z=0;B>z&&t[h+z]==t[h+z-j];++z);if(z>M){if(M=z,D=j,z>L)break;var H=Math.min(j,z-2),q=0;for(F=0;H>F;++F){var V=h-j+F+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,I=V);}}}j+=(O=I)-(I=_[O])+32768&32767;}if(D){w[T++]=268435456|ju[M]<<18|Lu[D];var G=31&ju[M],K=31&Lu[D];k+=Au[G]+Fu[K],++S[257+G],++x[K],P=h+M,++E;}else w[T++]=t[h],++S[t[h]];}}a=sa$1(t,u,r,w,S,x,k,T,C,h-C,a);}return Ju(l,0,s+Ku(a)+n)}(r=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,l,u,true)),d=h.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&&la$1(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var s=0;e.length>=s;++s)t[s+10]=e.charCodeAt(s);}}(h,i),la$1(h,d-8,e.d()),la$1(h,d-4,s),h}const aa$1=!!o$1||!!r,ha$1=new WeakMap,da$1="text/plain";let ca$1=0,va$1=false;const fa=(t,i)=>{const[e,s]=t.split("#"),[n,r]=e.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==i).join("&");return `${n}${o?`?${o}`:""}${s?`#${s}`:""}`},pa$1=(t,i,e=true)=>{var s;const[n,r]=t.split("?"),o=wi({},i),l=null!==(s=null==r?void 0:r.split("&").map(t=>{var i;const[s,n]=t.split("="),r=e&&null!==(i=o[s])&&void 0!==i?i:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],u=function(t,i="&"){let e,s;const n=[];return Dr(t,function(t,i){R$1(t)||R$1(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),s=encodeURIComponent(i),n[n.length]=s+"="+e);}),n.join(i)}(o);return u&&l.push(u),l.length>0?`${n}?${l.join("&")}`:n},_a$3=t=>{if(t.lr)return t.lr;const{data:i,compression:e}=t;if(!i)return;if(e===au.GZipJS){const t=ua$1(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return (new TextEncoder).encode(t);for(var e=new Ru(t.length+(t.length>>>1)),s=0,n=function(t){e[s++]=t;},r=0;i>r;++r){if(s+5>e.length){var o=new Ru(s+8+(i-r<<1));o.set(e),e=o;}var l=t.charCodeAt(r);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++r))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l));}return Ju(e,0,s)}(Il(i)),{mtime:0});return {contentType:da$1,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===au.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(Il(i)),e=(t=>"data="+encodeURIComponent("string"==typeof t?t:Il(t)))(t);return {contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}const s=Il(i);return {contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},ga$1=t=>{const i=()=>"sendBeacon"===t.transport?{url:pa$1(t.url,{compression:au.Base64}),encodedBody:_a$3(wi(wi({},t),{},{compression:au.Base64,lr:void 0}))}:{url:fa(t.url,"compression"),encodedBody:_a$3(wi(wi({},t),{},{compression:void 0,lr:void 0}))};let e;try{e=_a$3(t);}catch(e){if(ye$2(t.compression,Al(t.url,"compression")))return Us.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&ye$2(t.compression,Al(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?me$1(new Uint8Array(s)):ArrayBuffer.isView(s)&&me$1(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(va$1=true,i()):{url:t.url,encodedBody:e};var s;},ma$1=t=>{try{return ga$1(t)}catch(e){var i;return Us.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},ya$1=function(){var t=J$1(function*(t){const i=yield function(t){return Ee$2.apply(this,arguments)}(Il(t.data),Gs.DEBUG,{rethrow:true});if(!i)return t;const e=yield i.arrayBuffer();return wi(wi({},t),{},{lr:{contentType:da$1,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),ba$1=/Failed to fetch|NetworkError|Load failed/i,wa$1=t=>"TypeError"===(null==t?void 0:t.name)&&ba$1.test((null==t?void 0:t.message)||""),$a$1=t=>{try{const i=function(t,i=Date.now()){if("string"!=typeof t||!t)return;const e=t.trim(),s=/^\d+\s*,/.test(e)?e.slice(0,e.indexOf(",")).trim():e;if(/^\d+$/.test(s)){const t=1e3*Math.min(Number(s),300);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const n=/^\w{3} \w{3} /.test(s)?s+" GMT":s,r=Date.parse(n)-i;return Number.isFinite(r)&&r>0?Math.min(r,ui):void 0}(t());return R$1(i)?void 0:Math.min(i,3e4)}catch(t){return}},Sa$1=t=>{const i=ma$1(t);if(!i)return;const e=new o$1;ha$1.set(e,true);const{url:s,encodedBody:n}=i;e.open(t.method||"GET",s,true);const{contentType:r,body:l}=null!=n?n:{};Dr(t.headers,function(t,i){e.setRequestHeader(i,t);}),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i;const s={statusCode:e.status,text:e.responseText};if(200===e.status)try{s.json=JSON.parse(e.responseText);}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,s,$a$1(()=>e.getResponseHeader("Retry-After")));}},e.send(l);},xa$1=t=>{const i=ma$1(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:o,estimatedSize:u}=null!=s?s:{},a=new Headers;Dr(t.headers,function(t,i){a.append(i,t);}),n&&a.append("Content-Type",n);let h=null,d=false;if(l){const i=new l;h={signal:i.signal,timeout:setTimeout(()=>{d=true;try{i.abort(ci("AbortError","PostHog request timed out"+((e=t.timeout)?` after ${e}ms`:"")));}catch(t){v(t);}var e;},t.timeout)};}let c=false;const v=i=>{var e;c||(c=true,d&&"AbortError"===(null==i?void 0:i.name)||wa$1(i)?Us.warn(i):Us.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}));};let f=0;const p=()=>{ca$1-=f,f=0,h&&clearTimeout(h.timeout);};try{const i=wi({method:(null==t?void 0:t.method)||"GET",headers:a,referrerPolicy:"strict-origin",body:o,signal:null==h?void 0:h.signal},t.fetchOptions),s=null!=u?u:R$1(o)?0:void 0;i.keepalive="POST"===i.method&&!t.kl&&!1!==i.keepalive&&i.body===o&&!R$1(s)&&s>=0&&52428.8>ca$1+s,i.keepalive&&(f=s,ca$1+=f),r(e,i).then(i=>i.text().then(e=>{var s;if(c)return;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e);}catch(t){Us.error(t);}c=!0,p(),null===(s=t.callback)||void 0===s||s.call(t,n,$a$1(()=>i.headers.get("Retry-After")));})).catch(t=>{p(),v(t);}).finally(p);}catch(t){p(),v(t);}},Ea$1=t=>{try{var i;const{url:s,encodedBody:n}=ga$1(t),{contentType:o,body:l,estimatedSize:u}=null!=n?n:{};if(!l)return;const a=l instanceof Blob?l:new Blob([l],{type:o});if(e$1.sendBeacon(s,a))return;const h=k$1(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(k$1(h)&&h.length>1&&(null!=u?u:0)>16384){const i=Math.ceil(h.length/2),e=i=>k$1(t.data)?i:wi(wi({},t.data),{},{batch:i});return Ea$1(wi(wi({},t),{},{data:e(h.slice(0,i))})),void Ea$1(wi(wi({},t),{},{data:e(h.slice(i))}))}Us.warn(`Beacon of ~${null!=u?u:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?xa$1(wi(wi({},t),{},{kl:!0})):Sa$1(t);}catch(t){Us.warn("Beacon send failed",t);}},ka=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return pa$1(e===au.GZipJS?fa(t,"compression"):t,wi(wi({},n?{[n]:Date.now().toString()}:{}),e===au.GZipJS?{}:{compression:e}))},Ta$1=(()=>{const t=[];return r&&t.push({transport:"fetch",method:xa$1}),o$1&&t.push({transport:"XHR",method:Sa$1}),(null==e$1?void 0:e$1.sendBeacon)&&t.push({transport:"sendBeacon",method:Ea$1}),t})();let Pa$1=!aa$1&&-1===(null==a?void 0:a.indexOf("MSIE"))&&-1===(null==a?void 0:a.indexOf("Mozilla"));function Ca$1(t,i,e){var s,n,r;e&&(i=wi(wi({},i),{},{callback:t=>e(t)})),t.__loaded?Pa$1?t.__request_queue.push(i):t.rateLimiter.isServerRateLimited(i.batchKey)?i.fireCallbackOnDrop&&(null===(n=i.callback)||void 0===n||n.call(i,{statusCode:429})):(i.transport=i.transport||t.config.api_transport,i.headers=wi(wi({},t.config.request_headers),i.headers),i.compression="best-available"===i.compression?null!==(s=t.compression)&&void 0!==s?s:i.compressionFallback:i.compression,(R$1(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(i.disableTransport=["sendBeacon"]),i.fetchOptions=i.fetchOptions||t.config.fetch_options,((t,i)=>{var e,s,n;const r=wi(wi({},t),{},{callback:null!=i?i:i=>{var e;return null===(e=t.callback)||void 0===e?void 0:e.call(t,i)}});r.timeout=r.timeout||6e4;const o=null!==(e=r.transport)&&void 0!==e?e:"fetch";"sendBeacon"===o&&R$1(r.compression)&&r.data&&(r.compression=au.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var i,e;const s=(k$1(t)?t:[t]).map(t=>wi(wi({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),n=s[0];return {api_key:null!==(i=null==n||null===(e=n.properties)||void 0===e?void 0:e.token)&&void 0!==i?i:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,i=(new Date).toISOString())=>k$1(t)?t.map(t=>wi(wi({},t),{},{sent_at:i})):wi(wi({},t),{},{sent_at:i}))(r.data))),r.url=ka(r.url,r.method,r.compression,r.timestampMode);const l=Ta$1.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),a=null!==(s=null===(n=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(l,t=>t.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:l[0].method;if(!a)throw new Error("No available transport method");const h=t=>{try{a(t);}catch(t){var i;wa$1(t)?Us.warn(t):Us.error(t),null===(i=r.callback)||void 0===i||i.call(r,{statusCode:0,error:t});}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===au.GZipJS&&u&&"undefined"!=typeof Promise&&!va$1?ya$1(r).then(t=>{h(t);}).catch(i=>{if(be$1(i))return va$1=true,void h(wi(wi({},r),{},{compression:void 0,url:ka(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return false;const i="name"in t?String(t.name):"";return be$1(t)||i===ge$2})(i)&&(va$1=true),h(r);}):h(r);})(i,(s,n)=>{var r,o,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,s),e?e(s,n):null===(l=i.callback)||void 0===l||l.call(i,s);})):i.fireCallbackOnDrop&&(null===(r=i.callback)||void 0===r||r.call(i,{statusCode:0}));}var Ra$1=class Ra{constructor(t,i){this.Zu=true,this.Ju=[],this.Ku=Q$1((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Us.createLogger("flush interval"),3e3),this.Xu=t;}enqueue(t){this.Ju.push(t),this.Yu||this.tc();}unload(){this.ec();const t=this.Ju.length>0?this.nc():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.sc(wi(wi({},t),{},{callback:void 0}),"sendBeacon");});}enable(){this.Zu=false,this.tc();}tc(){this.Zu||(this.Yu=setTimeout(()=>{this.ec(),this.rc();},this.Ku));}rc(){if(this.Ju.length>0){const t=this.nc();for(const i in t)this.sc(t[i]);}}sc(t,i){try{this.Xu(t,i);}catch(t){Us.error(t);}}ec(){clearTimeout(this.Yu),this.Yu=void 0;}nc(){const t={},i={};Dr(this.Ju,e=>{var s;const n=e,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");R$1(t[r])&&(t[r]=wi(wi({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),i[r]=[]),null===(s=t[r].data)||void 0===s||s.push(n.data),n.callback&&i[r].push(n.callback);});for(const e in i){const s=i[e];s.length&&(t[e].callback=t=>{for(const i of s)i(t);});}return this.Ju=[],t}};const Oa$1=["retriesPerformedSoFar"];var Ia$1=class Ia{constructor(t){this._instance=t,this.oc=false,this.ac=3e3,this.Ju=[],this.Ju=[],this.lc=true,this.resume();}resume(){if(!R$1(t)&&"onLine"in t.navigator){if(this.lc=t.navigator.onLine,this.uc)return;this.uc=()=>{this.lc=true,this.rc();},this.cc=()=>{this.lc=false;},qr(t,"online",this.uc),qr(t,"offline",this.cc);}}get length(){return this.Ju.length}retriableRequest(t,i){let{retriesPerformedSoFar:e}=t,s=ke$1(t,Oa$1);D$1(e)&&(s.url=pa$1(s.url,{retry_count:e})),Ca$1(this._instance,i?wi(wi({},s),{},{transport:i}):s,(t,i)=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Ls(wi({retriesPerformedSoFar:e},s),i);0===t.statusCode&&Us.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=e?e:0} retries.`);}null===(n=s.callback)||void 0===n||n.call(s,t);});}Ls(t,i){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const s=Math.max(function(t){const i=3e3*Math.pow(2,t),e=i/2,s=Math.min(18e5,i),n=(Math.random()-.5)*(s-e);return Math.ceil(s+n)}(e),null!=i?i:0),n=Date.now()+s;this.Ju.push({retryAt:n,requestOptions:t});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Us.warn(r),this.oc||(this.oc=true,this.hc());}hc(){if(this.dc&&clearTimeout(this.dc),0===this.Ju.length)return this.oc=false,void(this.dc=void 0);this.dc=setTimeout(()=>{this.lc&&this.Ju.length>0&&this.rc(),this.hc();},this.ac);}rc(){const t=Date.now(),i=[],e=this.Ju.filter(e=>t>e.retryAt||(i.push(e),false));if(this.Ju=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t);}unload(){this.dc&&(clearTimeout(this.dc),this.dc=void 0),this.oc=false,R$1(t)||(this.uc&&(t.removeEventListener("online",this.uc),this.uc=void 0),this.cc&&(t.removeEventListener("offline",this.cc),this.cc=void 0));for(const{requestOptions:t}of this.Ju)try{this._instance._send_request(wi(wi({},t),{},{callback:k$1(t.data)?void 0:t.callback,transport:"sendBeacon"}));}catch(t){Us.error(t);}this.Ju=[];}},Aa$1=class Aa{constructor(t){this._instance=t,this.vc=()=>{var t,i,e,s;this.fc||(this.fc={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=r+((null==n?void 0:n.clientHeight)||0),u=(null==n?void 0:n.scrollHeight)||0;this.fc.lastScrollY=Math.ceil(r),this.fc.maxScrollY=Math.max(r,null!==(t=this.fc.maxScrollY)&&void 0!==t?t:0),this.fc.maxScrollHeight=Math.max(o,null!==(i=this.fc.maxScrollHeight)&&void 0!==i?i:0),this.fc.lastContentY=l,this.fc.maxContentY=Math.max(l,null!==(e=this.fc.maxContentY)&&void 0!==e?e:0),this.fc.maxContentHeight=Math.max(u,null!==(s=this.fc.maxContentHeight)&&void 0!==s?s:0);};}get gc(){return this._instance.config.scroll_root_selector}getContext(){return this.fc}resetContext(){const t=this.fc;return this.fc=void 0,setTimeout(this.vc,0),t}startMeasuringScrollPosition(){qr(t,"scroll",this.vc,{capture:true}),qr(t,"scrollend",this.vc,{capture:true}),qr(t,"resize",this.vc);}scrollElement(){if(this.gc){const e=k$1(this.gc)?this.gc:[this.gc];for(const s of e){var i;const e=null==t||null===(i=t.document)||void 0===i?void 0:i.querySelector(s);if(e)return e}return}var e;return null==t||null===(e=t.document)||void 0===e?void 0:e.documentElement}mc(i){var e,s;const n="y"===i?"scrollTop":"scrollLeft";if(this.gc){const t=this.scrollElement();return t&&t[n]||0}return t?"y"===i?t.scrollY||t.pageYOffset||(null===(e=t.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(s=t.document)||void 0===s||null===(s=s.documentElement)||void 0===s?void 0:s.scrollLeft)||0:0}scrollY(){return this.mc("y")}scrollX(){return this.mc("x")}};const Fa$1=t=>Gl(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);var Ma$1=class Ma{constructor(t,i,e,s){this.qe=t=>{const i=this.yc();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.bc(this._instance)};this._c.register({[lr$1]:e});},this._instance=t,this.wc=i,this._c=e,this.bc=s||Fa$1,this.wc.onSessionId(this.qe);}yc(){return this._c.props[lr$1]}getSetOnceProps(){var t;const i=null===(t=this.yc())||void 0===t?void 0:t.props;return i?"r"in i?Kl(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(){const t={};return Dr(Ur(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${b(e)}`]=i;}),t}},Da$1=class Da{on(t,i){return this.bo[t]||(this.bo[t]=[]),this.bo[t].push(i),()=>{this.bo[t]=this.bo[t].filter(t=>t!==i);}}emit(t,i){for(const e of this.bo[t]||[])e(i);for(const e of this.bo["*"]||[])e(t,i);}constructor(){this.bo={};}};const Na$1=Bs("[SessionId]"),ja$1=864e5;var La$1=class La{on(t,i){return this.kc.on(t,i)}constructor(t,i,e){var s;if(this.Sc=null,this.xc=null,this.$c=[],this.Cc=void 0,this.Tc=false,this.kc=new Da$1,this.Ic=(t,i)=>!(!D$1(t)||!D$1(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.Ar=t.config,this._c=t.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Mc=void 0,this._sessionActivityTimestamp=null,this.Ec=i||Qr,this.Pc=e||Qr;const n=this.Ar.persistence_name||this.Ar.token;if(this._sessionTimeoutMs=1e3*Q$1(this.Ar.session_idle_timeout_seconds||1800,60,36e3,Na$1.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Rc(),this.Ac="ph_"+n+"_window_id",this.Fc="ph_"+n+"_primary_window_exists",this.Oc()){const t=wo.Lt(this.Ac),i=wo.Lt(this.Fc);t&&!i?this.je=t:wo.Pt(this.Ac),wo.At(this.Fc,true);}(null===(s=this.Ar.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Ar.bootstrap.sessionID),this.Dc();}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return R$1(this.$c)&&(this.$c=[]),this.$c.push(t),this.Xt&&t(this.Xt,this.je),()=>{this.$c=this.$c.filter(i=>i!==t);}}Oc(){return "memory"!==this.Ar.persistence&&!this._c.hi&&wo.Et()}Lc(t){t!==this.je&&(this.je=t,this.Oc()&&wo.At(this.Ac,t));}Nc(){return this.je?this.je:this.Oc()?wo.Lt(this.Ac):null}qc(t){const i=this.Sc;return !A$1(i)&&!A$1(t)&&5e3>Math.abs(t-i)}jc(t,i,e){const s=i!==this._sessionActivityTimestamp,n=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,n&&!s||n&&this.qc(i)||(this.Sc=i,this._c.register({[Vn]:[i,t,e]}));}Bc(){var t;const i=null===(t=this.Ar)||void 0===t?void 0:t.persistence_save_debounce_ms;return D$1(i)&&i>0}zc(){this.Bc()?this._c.refreshKey(Vn):(this._c.flush(),this._c.load());}Hc(){var t;if(A$1(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Sc)return;this.zc();const[,i,e]=this.Uc();i===this.Xt&&e===this._sessionStartTimestamp&&(this.Sc=this._sessionActivityTimestamp,this._c.register({[Vn]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this._c.flush());}Wc(){const[t]=this.Uc(),i=D$1(t)?t:0,e=D$1(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Vc(t){return this.zc(),this.Ic(t,this.Wc())}Uc(){const t=this._c.props[Vn];return k$1(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Sc=null,this.Mc=void 0,clearTimeout(this.Gc),this.Gc=void 0,this.jc(null,null,null);}setBootstrapSessionId(t,i=false){const e=((t,i=(new Date).getTime())=>{try{const e=(t=>{const 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 Na$1.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Na$1.error("Invalid sessionID in bootstrap",t)}})(t);return !R$1(e)&&(i?this.Mc={sessionId:t,sessionStartTimestamp:e}:this.jc(t,(new Date).getTime(),e),true)}destroy(){this.Tc=true,this.Hc(),clearTimeout(this.Gc),this.Gc=void 0,this.Cc&&t&&(t.removeEventListener(Rr,this.Cc,{capture:false}),this.Cc=void 0),this.$c=[];}Dc(){this.Cc=()=>{this.Hc(),this.Oc()&&wo.Pt(this.Fc);},qr(t,Rr,this.Cc,{capture:false});}checkAndGetSessionAndWindowId(t=false,i=null,e=false){if("always"===this.Ar.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=i||(new Date).getTime(),n=this.Xt;if(e)this.xc=s;else if(A$1(this.xc)||this.xc>s||s-this.xc>=1e3){var r,o;null===(r=(o=this._c).syncCookieProperties)||void 0===r||r.call(o),this.xc=s;}let[,l,u]=this.Uc();const a=!R$1(n)&&l!==n,h=this.Wc();let d=this.Nc();const c=this.Mc,v=!!c&&(c.sessionStartTimestamp>s+6e4||s-c.sessionStartTimestamp>ja$1),f=c?v:D$1(u)&&Math.abs(s-u)>ja$1;let p=false,_=a,g=!l||!!c;const m=l;let y=!g&&!t&&this.Ic(s,h);if(y&&(y=this.Vc(s),y||Na$1.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,u]=this.Uc(),y||(g=!l||!!c)),g||y||f){_=false;const t=c&&!v;l=t?c.sessionId:this.Ec(),d=this.Pc(),Na$1.info("new session ID assigned",{sessionId:l,windowId:d,bootstrapped:!!t,changeReason:{noSessionId:g,activityTimeout:y,sessionPastMaximumLength:f}}),u=t?c.sessionStartTimestamp:s,this.Mc=void 0,p=true;}else d||(d=this.Pc(),p=true),_=_||l!==m,_&&(Na$1.info("adopted cross-tab session id",{sessionId:l,windowId:d}),p=true);const b=D$1(h)&&t&&!f?h:s,w=D$1(u)?u:(new Date).getTime();this.Lc(d),this.jc(l,b,w),t||this.Rc();const S={noSessionId:g,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:_};return p&&this.$c.forEach(t=>t(l,d,S)),{sessionId:l,windowId:d,sessionStartTimestamp:w,changeReason:p?S:void 0,lastActivityTimestamp:h}}Rc(){this.Tc||(clearTimeout(this.Gc),this.Gc=setTimeout(()=>{if(!this.Tc)if(this.Vc((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.kc.emit("forcedIdleReset",{idleSessionId:t});}else this.Rc();},1.1*this.sessionTimeoutMs));}};const Ua$1=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),Ba$1=function(t,i){if(!t)return false;const e=t.userAgent;if(e&&X$1(e,i))return true;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>X$1(null==t?void 0:t.brand,i)))return !0}catch(t){}return !!t.webdriver};function za$1(){return (za$1=J$1(function*(){const t=null==e$1?void 0:e$1.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return O$1(e)&&e.length>0?e:void 0}catch(t){return void Us.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Ha$1(t,i){let e=`$survey_${i}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(e=`$survey_${i}/${t.id}/${t.current_iteration}`),e}function qa$1(t){var i;return !!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}const Va$1=(t,i)=>{if(!(t=>{try{new RegExp(t);}catch(t){return false}return true})(i))return false;try{return new RegExp(i).test(t)}catch(t){return false}},Wa$1=t=>t.toLowerCase(),Ga$1={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=>Va$1(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Va$1(i,t))),icontains:(t,i)=>i.map(Wa$1).some(i=>t.map(Wa$1).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Wa$1).every(i=>t.map(Wa$1).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{const e=parseFloat(i);return !isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{const e=parseFloat(i);return !isNaN(e)&&t.some(t=>e<parseFloat(t))})};function Ka$1(t,i){return !t||Object.entries(t).every(([t,e])=>{const s=null==i?void 0:i[t];if(null==s)return false;const n=Ga$1[e.operator];return !!n&&n(e.values.map(String),[String(s)])})}function Ja$1(t,i,e){return Il({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Ya$1="custom",Za$1="i.posthog.com",Xa$1=/^\/static\//,Qa$1=["/s/","/e/","/i/"];var th=class{constructor(t){this.Qc={},this.instance=t;}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return "https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let i=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace(`.${Za$1}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Qc[this.apiHost]||(this.Qc[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":Ya$1),this.Qc[this.apiHost]}Zc(t){if(!Xa$1.test(t))return;const i=this.instance.config.asset_host;return "string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}Jc(t){const i=Pl(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Kc(t,i,e){if("ui"===t)return e;let s=e;const n=this.instance.config.rewriteRequestPath;if(n){var r;const t=(null===(r=Pl(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString();}if(n&&"api"===t&&Qa$1.some(t=>0===i.indexOf(t))){const t=this.Jc(s);if(t){const i=this.apiHost;let e=this.Xc;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.Xc=e),e.urls.add(t);}}return s}isIngestionEndpoint(t){const i=this.Xc,e=this.Jc(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(i&&(i="/"===i[0]?i:`/${i}`),"ui"===t)return this.Kc(t,i,this.uiHost+i);if("flags"===t)return this.Kc(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.Zc(i);if(e)return this.Kc(t,i,`${e}${i}`)}if(this.region===Ya$1)return this.Kc(t,i,this.apiHost+i);const e=Za$1+i;switch(t){case "assets":return this.Kc(t,i,`https://${this.region}-assets.${e}`);case "api":return this.Kc(t,i,`https://${this.region}.${e}`)}}};const ih=Bs("[Surveys]"),eh=t=>{try{const 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){ih.error("Failed to persist survey seen state",t);}},sh=[fu.Popover,fu.Widget,fu.API],nh={ignoreConditions:false,ignoreDelay:false,displayType:bu.Popover},rh=Bs("[PostHog ExternalIntegrations]"),oh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var lh=class{constructor(t){this._instance=t;}Ml(t,i){var e,s;null===(e=d.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,t,t=>{if(t)return rh.error("failed to load script",t);i();});}startIfEnabledOrStop(){var t;for(const[n,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var i,e,s;r&&!(null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.Ml(oh[n],()=>{var t;null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[n])||void 0===t||t.start(this._instance);}),!r&&(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=d.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop());}}},uh=class{constructor(t){this.disabled=false===t;const i=P$1(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 false;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>e-s.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return true}else this.clicks=[{x:t,y:i,timestamp:e}];return false}};const ah=()=>typeof window>"u"?void 0:window,hh=()=>typeof document>"u"?void 0:document,dh="$copy_autocapture",ch=["password","hidden","file","checkbox","button","submit","reset","image"],vh=Bs("[AutoCapture]");function fh(t,i){return i.length>t?i.slice(0,t)+"...":i}function ph(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling;}while(i&&!Eo(i));return i}function _h(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,u;if(!Eo(t))return {props:{}};const a=[t],h=new Set([t]);let d=t;for(;d.parentNode&&!ko(d,"body")&&1e3>a.length;){if(Po(d.parentNode)){const t=d.parentNode.host;if(h.has(t))break;h.add(t),a.push(t),d=t;continue}if(!Eo(d.parentNode))break;if(h.has(d.parentNode))break;h.add(d.parentNode),a.push(d.parentNode),d=d.parentNode;}const c="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?a.findIndex(t=>ko(t,"button")||ko(t,"a")):-1;c>0&&(s=s||a.slice(0,c+1).some(t=>!Qo(t)||tl(t)));const v=[],f={};let p,_=false,g=false;if(Dr(a,t=>{const i=Qo(t);if(ko(t,"a")&&!e&&!(null==n?void 0:n.includes("href"))){const e=t.getAttribute("href");_=!!(i&&e&&ul(e))&&(o?vi(e):e);}m(Oo(t),"ph-no-capture")&&(g=true),v.push(function(t,i,e,s,n=false){const r=t.tagName.toLowerCase(),o={tag_name:r};Mo.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?fh(1024,al(t)):fh(1024,Ao(t)));const l=Oo(t);i||(null==s?void 0:s.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return ""!==t})),Dr(t.attributes,function(e){var r;if((!tl(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&ul(e.value)&&(!O$1(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=Co(t).join(" ")),o["attr__"+e.name]=fh(1024,"href"===e.name&&n?vi(t):t);}});let u=1,a=1,h=t;for(;h=ph(h);)u++,h.tagName===t.tagName&&a++;return o.nth_child=u,o.nth_of_type=a,o}(t,e,s,n,o)),Dr(function(t){if(!Qo(t))return {};const i={};return Dr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const e=t.name.replace("data-ph-capture-attribute-",""),s=t.value;e&&s&&ul(s)&&(i[e]=s);}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t);});}),g)return {props:{},explicitNoCapture:g};if(c>0&&(t=a[c],v.splice(0,c)),s||(v[0].$el_text=ko(t,"a")||ko(t,"button")?al(t):Ao(t)),_){var y,b;v[0].attr__href=_;const t=null===(y=Pl(_))||void 0===y?void 0:y.host,i=null===(b=ah())||void 0===b||null===(b=b.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(p=_);}return {props:Nr((S=i.type,{$event_type:S,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(w=v,k$1(w)?function(t){return t.map(t=>{var i,e;let s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class){t.attr_class.sort();for(const i of t.attr_class)s+=`.${i.replace(/"/g,"")}`;}const n=wi(wi(wi(wi({},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),r={};return jr(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[dl(t.toString())]=dl(i.toString())),s+=":",s+=jr(r).map(([t,i])=>`${t}="${i}"`).join(""),s}).join(";")}(function(t){return t.map(t=>{var i,e;const s={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:cl(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return jr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(w)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(u=v[0])||void 0===u?void 0:u.$el_text}:{},p&&"click"===i.type?{$external_click_url:p}:{},f),target:t};var w,S;}const gh="autocapture";var mh=class{el(){this.il=void 0,clearTimeout(this.nl),this.nl=void 0;}sl(t){var i;if(!Qo(t))return true;const e=null!==(i=this.rl().css_selector_ignorelist)&&void 0!==i?i:Lo,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return true;s.add(n);const t=n,i=Oo(t);if(m(i,"ph-no-capture")||m(i,"ph-sensitive")||tl(t)||e.some(i=>Do(t,i)))return true;const r=n.parentNode;n=Po(r)?r.host:r&&Eo(r)?r:null;}return false}ol(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.el();if("pointerdown"===t.type){var i;this.el();const e=Fo(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&Eo(e)&&(this.il={target:e,excluded:this.sl(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:false,distinctId:null===(i=this.xa)||void 0===i?void 0:i.distinctId}))}const e=this.il;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.el():"pointerup"===t.type&&(e.released=true,this.nl=setTimeout(()=>this.el(),0)));}al(t){var i;const e=this.il;this.el();const s=Fo(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.xa)||void 0===i?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&s&&(ko(s,"html")||ko(s,"body"))){var n,r,o;if(e.excluded)return null;const t=null!==(n=this.rl().css_selector_ignorelist)&&void 0!==n?n:Lo;return [s,null===(r=hh())||void 0===r?void 0:r.documentElement,null===(o=hh())||void 0===o?void 0:o.body].some(i=>{if(!i)return false;const e=Oo(i);return m(e,"ph-no-capture")||m(e,"ph-sensitive")||!Qo(i)||tl(i)||t.some(t=>Do(i,t))})?null:e.target}}constructor(t){this.Ta=t,this.name=gh,this.ll=false,this.ul=null,this.cl=false,this.hl=new Map,this.dl=false,this.Ar={enabled:false,rageclick:false,maskAllElementAttributes:false,maskAllText:false,disableCaptureUrlHashes:false,remoteRequestsDisabled:false},this.Ci=false,this.Ta.refresh(this.Ar),this.rageclicks=new uh(this.Ar.rageclick),this.vl=null;}setup(t){this.fl(),this.xa=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ci?i.dispose():(this.qa=i,this.startIfEnabled());}dispose(){var t;this.Ci||(this.Ci=true,this.xa=void 0,null===(t=this.qa)||void 0===t||t.dispose(),this.qa=void 0,this.hl.clear(),this.vl=null,this.pl());}rl(){return this.Ta.refresh(this.Ar),this.Ar}fl(){var t,i;return this.rl(),this.Ar.url_allowlist=null===(t=this.Ar.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Ar.url_ignorelist=null===(i=this.Ar.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Ar}gl(){const t=ah(),i=hh();if(!this.isBrowserSupported())return void vh.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!i)return;this.ml=t,this.yl=i;const e=this.bl=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.el();if(0===i.type.indexOf("pointer"))return void this.ol(i);const t="click"===i.type?this.al(i):void 0;if(A$1(t))return;this._l(i,"$autocapture",t);}catch(t){vh.error("Failed to capture event",t);}};if(qr(t,"blur",e),qr(i,"submit",e,{capture:true}),qr(i,"change",e,{capture:true}),qr(i,"click",e,{capture:true}),Dr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{qr(i,t,e,{capture:true});}),this.rl().capture_copied_text){const e=this.wl=i=>{i=i||(null==t?void 0:t.event);try{this._l(i,dh);}catch(t){vh.error("Failed to capture clipboard event",t);}};qr(i,"copy",e,{capture:true}),qr(i,"cut",e,{capture:true}),qr(i,"paste",e,{capture:true});}}pl(){const t=this.ml,i=this.yl;this.el(),this.bl&&(null==t||t.removeEventListener("blur",this.bl),Dr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.bl,true);}),null==i||i.removeEventListener("submit",this.bl,true),null==i||i.removeEventListener("change",this.bl,true),null==i||i.removeEventListener("click",this.bl,true),this.bl=void 0),this.wl&&(null==i||i.removeEventListener("copy",this.wl,true),null==i||i.removeEventListener("cut",this.wl,true),null==i||i.removeEventListener("paste",this.wl,true),this.wl=void 0),this.ml=void 0,this.yl=void 0,this.ll=false;}startIfEnabled(){this.isEnabled||this.el(),!this.Ci&&this.xa&&this.isEnabled&&!this.ll&&(this.gl(),this.ll=true);}onRemoteConfig(t){if(this.Ci)return;if(this.cl=true,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.dl=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;N$1(e)&&(null===(s=this.xa)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this.ul=e),this.startIfEnabled();}setElementSelectors(t,i=this){if(this.Ci)return;t.size?this.hl.set(i,new Set(t)):this.hl.delete(i);const e=new Set;this.hl.forEach(t=>{t.forEach(t=>e.add(t));}),this.vl=e;}getElementSelectors(t,i){var e;const s=[];return null===(e=this.vl)||void 0===e||e.forEach(e=>{var n;const r=null===(n=hh())||void 0===n?void 0:n.querySelectorAll(e);null==r||r.forEach(n=>{t!==n&&i!==n||m(s,e)||s.push(e);});}),s}get isEnabled(){var t,i;if(this.Ci)return false;const e=null===(t=this.xa)||void 0===t?void 0:t.kv.get(dn$1),s=this.ul,n=this.rl();if(!n.remoteRequestsDisabled&&!this.cl)return false;const r=n.remoteRequestsDisabled&&!this.cl;if(A$1(s)&&!N$1(e)&&!r)return false;const o=null!==(i=this.ul)&&void 0!==i?i:!!e;return !!n.enabled&&!o}_l(t,i="$autocapture",e){if(!this.isEnabled)return void this.el();let s=e||Fo(t);To(s)&&(s=s.parentNode||null);const n=this.fl();var r;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Yo(s,n.rageclick)&&this._l(t,"$rageclick",e);const o=i===dh,l=o?wi(wi({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Zo(t))return false;if((null==e?void 0:e.url_allowlist)&&!Ro(e.url_allowlist,r))return false;if((null==e?void 0:e.url_ignorelist)&&Ro(e.url_ignorelist,r))return false;if(null==e?void 0:e.dom_event_allowlist){const t=e.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return false}const{parentIsUsefulElement:u,targetElementList:a}=Xo(t,s);if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(R$1(e))return true;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return true;return false}(a,e))return false;if(!No(a,null==e?void 0:e.css_selector_allowlist))return false;if(No(a,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Lo))return false;try{const e=l.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return !0}catch(t){}const h=t.tagName.toLowerCase();switch(h){case "html":return false;case "form":return (n||["submit"]).indexOf(i.type)>=0;case "input":case "select":case "textarea":return (n||["change","click"]).indexOf(i.type)>=0;default:return u?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Mo.indexOf(h)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var u;const{props:e,explicitNoCapture:r,target:o}=_h(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.dl,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return false;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===dh){const i=t.type||"clipboard";if("paste"!==i){var a,h;const t=null===(a=ah())||void 0===a||null===(a=a.getSelection())||void 0===a?void 0:a.toString(),i=Io(t);if(!i)return false;e.$selected_content=i,e.$clipboard_text_length=null!==(h=null==t?void 0:t.length)&&void 0!==h?h:0;}e.$copy_type=i;}if("$autocapture"===i&&"change"===t.type&&n.capture_value_css_selector_allowlist&&!n.maskAllText&&(ko(d=s,"input")?!m(ch,d.type):ko(d,"textarea")||ko(d,"select")&&!d.multiple)&&function(t,i){var e;if(!Qo(t))return false;const s=null!==(e=i.css_selector_ignorelist)&&void 0!==e?e:Lo,n=new Set;let r=t;for(ko(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,i=Oo(t);if(n.size>=1e3||n.has(r)||m(i,"ph-sensitive")||m(i,"ph-no-capture")||s.some(i=>Do(t,i)))return false;n.add(r);const e=r.assignedSlot||r.parentNode;r=Po(e)?e.host:e&&Eo(e)?e:null;}return true}(s,n)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const t=n.capture_value_css_selector_allowlist;let i=false;try{i=T$1(t)?!!t(s):k$1(t)&&t.some(t=>Do(s,t));}catch(t){vh.error("capture_value_css_selector_allowlist threw",t);}i&&(e.$input_value=s.value);}return null===(u=this.xa)||void 0===u||u.capture(i,e),true}var d;}isBrowserSupported(){var t;return T$1(null===(t=hh())||void 0===t?void 0:t.querySelectorAll)}};const yh="featureFlags",bh="logs";var wh=class{constructor(t){this._instance=t;}initialize(){}get(t){const i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);const e={};for(const s of t){const t=null==i?void 0:i.get_property(s);R$1(t)||(e[s]=t);}return e}set(t,i){var e;null===(e=this._instance.persistence)||void 0===e||e.register("string"==typeof t?{[t]:i}:t);}remove(t){var i;null===(i=this._instance.persistence)||void 0===i||i.unregister(t);}},$h=class{constructor(t){this.instance=t,this.$=Us,this.kv=new wh(t),this.onSession=t=>wu(this.instance.onSessionId(i=>{try{t(i);}catch(t){this.$.error("Browser extension session listener failed",t);}})),this.onEvent=t=>wu(this.instance._addCaptureHook((i,e)=>{if(e)try{t({event:i,properties:e.properties});}catch(t){this.$.error("Browser extension event listener failed",t);}})),this.onRemoteConfig=t=>{const i=i=>{try{t(i);}catch(t){this.$.error("Browser extension remote config listener failed",t);}},e=this.instance.ur.on("extensionsRemoteConfig",i);return this.instance.cr&&i(this.instance.cr),wu(e)};}get logger(){return this.$}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(){const t=this.instance.get_property(bn$1);return "string"==typeof t?t:void 0}get library(){return {name:Gs.LIB_NAME,version:Gs.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,s,n;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return {sessionId:null!==(i=null==r?void 0:r.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==r?void 0:r.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(n=null==r?void 0:r.lastActivityTimestamp)&&void 0!==n?n:0}}catch(t){return {sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return T$1(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(t){let i;switch(t){case yh:case "featureFlagsCommon":i=this.instance.featureFlags;break;case bh:i=this.instance.logs;break;case "surveys":i=this.instance.surveys;break;case gh:i=this.instance.autocapture;}return i}capture(t,i,e){if(!e)return void this.instance.capture(t,i);const s=wi({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},"unload"===e.delivery?{transport:"sendBeacon",send_instantly:true}:{});this.instance.capture(t,i,s);}registerDynamicEventProperties(t){return wu(this.instance.dr(t))}sendRequest(t){var i=this;return J$1(function*(t,e={}){var s;const n=null!==(s=e.target)&&void 0!==s?s:"api",r=e.query?pa$1(t,e.query):t,o=i.instance.requestRouter.endpointFor(n,r),l={method:e.method,url:o,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:true,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?p.Base64:void 0,timestampMode:e.sentAt};return "api"===n&&"/i/v1/logs"===t&&(l.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(l),{statusCode:202}):new Promise(t=>{l.callback=t,i.instance._send_request(l);})}).apply(this,arguments)}};const Sh={};let xh=0;const Eh=()=>{},kh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Th="Surveys module not available",Ph="sanitize_properties is deprecated. Use before_send instead",Ch="Invalid value for property_denylist config: ",Rh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Oh=["$feature_flag_called","$$heatmap","$snapshot"],Ih=t=>"$"===t.charAt(0)&&!m(Oh,t),Ah=/^[A-Za-z0-9_-]{1,400}$/,Fh=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Mh=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Dh=["token","distinct_id",fr$1],Nh="posthog",jh=[...Ua$1].sort()[Ua$1.length-1],Lh=t=>{const i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=true),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=true),"2026-08-30">t||(i.captureJsonLd=true),i):i},Uh=i=>{var e;return wi({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:true,cross_subdomain_cookie:Hr(null==s$1?void 0:s$1.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Eh,save_campaign_params:true,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:true,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:false,__preview_replay_sync_fetch:true,__preview_external_dependency_versioned_paths:false,__preview_cookie_wins_on_conflict:false,debug:n&&O$1(null==n?void 0:n.search)&&-1!==n.search.indexOf("__posthog_debug=true")||false,cookie_expiration:365,upgrade:false,disable_session_recording:false,disable_persistence:false,disable_web_experiments:true,disable_surveys:false,disable_surveys_automatic_display:false,disable_conversations:false,disable_product_tours:false,disableDeviceModel:false,reuseAnonymousId:false,disable_external_dependency_loading:false,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(e=t.location)||void 0===e?void 0:e.protocol),ip:false,opt_out_capturing_by_default:false,opt_out_persistence_by_default:false,opt_out_useragent_filter:false,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:false,property_denylist:[],respect_dnt:false,sanitize_properties:null,request_headers:{},request_batching:true,properties_string_max_length:65535,mask_all_element_attributes:false,mask_all_text:false,mask_personal_data_properties:false,custom_personal_data_properties:[],advanced_disable_flags:false,advanced_disable_decide:false,advanced_disable_feature_flags:false,advanced_disable_feature_flags_on_first_load:false,advanced_only_evaluate_survey_feature_flags:false,advanced_feature_flags_dedup_per_session:false,advanced_enable_surveys:false,advanced_disable_toolbar_metrics:false,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Us.error("Bad HTTP status: "+t.statusCode+" "+t.text);},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:false,session_idle_timeout_seconds:1800,person_profiles:Cr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Eh},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Bo,ignore_text_selection:true}:!t||"2025-11-30">t||{content_ignorelist:true},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Lh(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)}))(i))},Bh=[["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"]],zh=t=>{const i={};for(const[e,s]of Bh)R$1(t[e])||(i[s]=t[e]);const e=Nr({},i,t),s=t.__preview_external_dependency_versioned_paths;return R$1(s)||(R$1(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),O$1(s)&&R$1(t.asset_host)&&(e.asset_host=s)),k$1(t.property_blacklist)&&(R$1(t.property_denylist)?e.property_denylist=t.property_blacklist:k$1(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Us.error(Ch+t.property_denylist)),e};var Hh=class{constructor(){this.__forceAllowLocalhost=false;}get Yc(){return this.__forceAllowLocalhost}set Yc(t){Us.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t;}},qh=class i{th(t){if(!t)return;const i=this.eh.indexOf(t);-1!==i&&this.eh.splice(i,1);}ih(t,i){var e;return this.th(t),this.eh.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}nh(){return "always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}sh(){if(this.rh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.nh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.oh)return;let i,e,s;t?(i=`persistence is set to '${this.config.persistence}'`,e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",e="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.rh=true,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, 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. ${s}`);}ah(){const t=this.persistence;if(!t||this.uh)return;if(this.nh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.hh(),this.dh()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.fh()||t.load(true);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(Qr());this.register({distinct_id:i,$device_id:i}),t.set_property(or$1,Tr);}this.hh();}get decideEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.ph=false,this.gh=false,this.webPerformance=new Hh,this.mh=false,this.version=Gs.LIB_VERSION,this.yh=new Set,this.bh="",this.ur=new Da$1,this.eh=[],this._h=[],this.wh=false,this.oh=false,this.rh=false,this.uh=false,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Uh(),this.SentryIntegration=wl,this.sentryIntegration=t=>function(t,i){const e=bl(t,i);return {name:yl,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=false,this.analyticsDefaultEndpoint="/e/",this.kh=false,this.Sh=null,this.xh=null,this.$h=null,this.scrollManager=new Aa$1(this),this.pageViewManager=new $l(this),this.rateLimiter=new ku(this),this.requestRouter=new th(this),this.consent=new $o(this),this.externalIntegrations=new lh(this);const e=null!==(t=i.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,i,e)=>{const s=O$1(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({});},set_once:(t,i,e)=>{const s=O$1(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({});}},this.on("eventCaptured",t=>Us.info(`send "${null==t?void 0:t.event}"`,t));}init(t,e,s){if(s&&s!==Nh){var n;const r=null!==(n=Sh[s])&&void 0!==n?n:new i;return r._init(t,e,s),Sh[s]=r,Sh[Nh][s]=r,r}return this._init(t,e,s)}_init(i,e={},s){var n,r,o;const l=O$1(i)?i.trim():"";if(!l)return Us.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var u;if(this.__loaded)return l!==(null===(u=this.config)||void 0===u?void 0:u.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('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=true,this.config=Uh(e.defaults),e.debug=this.Ch(e.debug),this.Th=e,this.Ih=[],e.person_profiles?this.xh=e.person_profiles:e.process_person&&(this.xh=e.process_person);const a=Uh(e.defaults),h=zh(e),d=Nr({},a,h,{name:s,token:l});P$1(a.rageclick)&&P$1(h.rageclick)&&(d.rageclick=Nr({},a.rageclick,h.rageclick)),P$1(a.session_recording)&&P$1(h.session_recording)&&(d.session_recording=Nr({},a.session_recording,h.session_recording)),this.set_config(d),this.config.on_xhr_error&&Us.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:au.GZipJS;const c=this.fh(),v=!this.nh();if(this.persistence=new uu(this.config,c,true,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new uu(wi(wi({},this.config),{},{persistence:"sessionStorage"}),c,false,v),this.bh="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&wo.Et()){const t=wo.Lt(this.bh);k$1(t)&&t.forEach(t=>{O$1(t)&&this.yh.add(t);});}else wo.Pt(this.bh);const f=wi({},this.persistence.props),p=wi({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Mh=new Ra$1((t,i)=>this.Eh(t,i),this.config.request_queue_config),this.Ph=new Ia$1(this),this.__request_queue=[];const _=this.nh();_||(this.sessionManager=new La$1(this),this.sessionPropsManager=new Ma$1(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{((null==e?void 0:e.activityTimeout)||(null==e?void 0:e.sessionPastMaximumLength)||(null==e?void 0:e.crossTabAdoption))&&this.Rh();})),this.Ah(),this.config.__preview_deferred_init_extensions?(Us.info("Deferring extension initialization to improve startup performance"),this.Fh=setTimeout(()=>{this.Fh=void 0,this.Oh(_);},0)):(Us.info("Initializing extensions synchronously"),this.Oh(_)),Gs.DEBUG=Gs.DEBUG||this.config.debug,Gs.DEBUG&&Us.info("Starting in debug mode",{this:this,config:e,thisC:wi({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(n=e.bootstrap)||void 0===n?void 0:n.distinctID)&&(e.bootstrap=wi(wi({},e.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:true}));const g=null===(r=e.bootstrap)||void 0===r?void 0:r.distinctID;if(this.oh=!!g&&!I$1(g),null===(o=e.bootstrap)||void 0===o?void 0:o.distinctID){const t=e.bootstrap.distinctID,i=this.get_distinct_id(),s=this.persistence.get_property(or$1);if(e.bootstrap.isIdentifiedID&&null!=i&&i!==t&&"anonymous"===s)this.identify(t);else if(e.bootstrap.isIdentifiedID&&null!=i&&i!==t&&"identified"===s)Us.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 {const i=this.config.get_device_id(Qr()),s=e.bootstrap.isIdentifiedID?i:t;this.persistence.set_property(or$1,e.bootstrap.isIdentifiedID?Pr:Tr),this.register({distinct_id:t,$device_id:s});}}if(_)this.register_once({distinct_id:vr$1,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Qr());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(or$1,Tr);}return qr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:false}),qr(t,"pageshow",t=>{if(this.ph=false,!this.gh){var i;if(t.persisted&&this.persistence){const t=this.persistence.get_property(yn$1),i=this.persistence.get_property(or$1);this.persistence.load(),this.Dh()||t===this.persistence.get_property("distinct_id")&&i===this.persistence.get_property("$user_state")||this.Lh();}null===(i=this.Ph)||void 0===i||i.resume();}}),e.segment?ml(this,()=>this.Nh()):this.Nh(),T$1(this.config._onCapture)&&this.config._onCapture!==Eh&&(Us.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Us.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$1.apply(this,arguments)}().then(t=>{t&&this.register({[wn$1]:t});}).catch(Eh),this}qh(t){const i=t;return O$1(i.name)&&T$1(i.setup)}jh(t,i){var e=this;this.qh(t)?i.push(J$1(function*(){try{yield t.setup(e.Bh());}catch(e){Us.error(`Failed to set up extension "${t.name}"`,e);try{var i;yield null===(i=t.dispose)||void 0===i?void 0:i.call(t);}catch(i){Us.error(`Failed to dispose extension "${t.name}"`,i);}}})):this.eh.push(t);}Ah(){var t,e,s,n=this;const r=null!==(t=null===(e=this.config.__extensionClasses)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:null===(s=i.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var o,l,u;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.zh)||void 0===o||o.call(this),this.zh=void 0,this.featureFlags=new r(this)),T$1(this.featureFlags.onReloading)&&T$1(this.featureFlags.setup)){if(!this.zh){this.zh=this.featureFlags.onReloading(()=>{this.ur.emit("featureFlagsReloading",true);});const t=this.featureFlags;J$1(function*(){try{yield t.setup(n.Bh());}catch(i){Us.error("Failed to set up feature flags",i);const e=n.zh;n.zh=void 0;try{null==e||e();}catch(t){Us.error("Failed to unsubscribe feature flag reloading",t);}try{yield t.dispose();}catch(t){Us.error("Failed to dispose feature flags",t);}}})();}}else null===(l=(u=this.featureFlags).initialize)||void 0===l||l.call(u);}Oh(t){const e=performance.now(),s=wi(wi({},i.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,u,a,h,d,c;s.exceptions&&this.eh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.eh.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.eh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.eh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.eh.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition();}),s.autocapture&&this.jh(this.autocapture=new s.autocapture(this),n),s.surveys&&this.jh(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.jh(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.eh.push(this.metrics=null!==(u=this.metrics)&&void 0!==u?u:new s.metrics(this)),s.conversations&&this.eh.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new s.conversations(this)),s.productTours&&this.eh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.eh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.eh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.eh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.eh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,pl)),s.toolbar&&this.eh.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.eh.push(this.experiments=null!==(d=this.experiments)&&void 0!==d?d:new s.experiments(this)),s.webMCP&&this.eh.push(this.webMCP=null!==(c=this.webMCP)&&void 0!==c?c:new s.webMCP(this)),this.eh.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t);});}),n.push(()=>{if(this.Hh){const t=this.Hh;this.Hh=void 0,this.eh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)});}}),this.Uh(n,e);}Uh(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.Fh=setTimeout(()=>{this.Fh=void 0,this.Uh(t,i);},0));const e=t.shift();if(e)try{e();}catch(t){Us.error("Error initializing extension:",t);}}const e=Math.round(performance.now()-i);this.register_for_session({[pr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[_r$1]:e}),this.config.__preview_deferred_init_extensions&&Us.info(`PostHog extensions initialized (${e}ms)`);}Gu(t){if(!s$1||!s$1.body)return Us.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Gu(t);},500);if(this.config.__preview_deferred_init_extensions&&(this.Hh=t),this.cr=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=m(e.supportedCompression,au.GZipJS)?au.GZipJS:m(e.supportedCompression,au.Base64)?au.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint);}this.set_config({person_profiles:this.xh?this.xh:Cr}),this.ur.emit("extensionsRemoteConfig",t),this.eh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)});}Nh(){try{this.config.loaded(this);}catch(t){Us.critical("`loaded` function failed",t);}if(this.Wh(),this.config.internal_or_test_user_hostname&&(null==n?void 0:n.hostname)){const t=n.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.nh())&&this.Vh();},1),this.Gh=new Pu(this),this.Gh.load();}Wh(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Mh)||void 0===t||t.enable());}_dom_loaded(){this.is_capturing()&&Mr(this.__request_queue,t=>this.Eh(t)),this.__request_queue=[],this.Wh();}_handle_unload(){var t,i,e,s,n,r;this.ph=true,null===(t=this.surveys)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t),null===(e=this.metrics)||void 0===e||e.flush("sendBeacon"),this.config.request_batching?(this.Qh()&&this.capture(Ir),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Mh)||void 0===n||n.unload(),null===(r=this.Ph)||void 0===r||r.unload()):this.Qh()&&this.capture(Ir,null,{transport:"sendBeacon"});}_send_request(t){Ca$1(this,t);}Eh(t,i){this.Ph?this.Ph.retriableRequest(t,i):this._send_request(i?wi(wi({},t),{},{transport:i}):t);}_execute_array(t){xh++;try{let i;const e=[],s=[],n=[];Mr(t,t=>{if(t)if(i=t[0],k$1(i))n.push(t);else if(T$1(t))try{t.call(this);}catch(i){Us.error("Error executing queued PostHog call",t,i);}else k$1(t)&&"alias"===i?e.push(t):k$1(t)&&-1!==i.indexOf("capture")&&T$1(this[i])?n.push(t):s.push(t);});const r=function(t,i){Mr(t,function(t){try{if(k$1(t[0])){let e=i;Dr(t,function(t){e=e[t[0]].apply(e,t.slice(1));});}else i[t[0]].apply(i,t.slice(1));}catch(i){Us.error("Error executing queued PostHog call",t,i);}});};r(e,this),r(s,this),r(n,this);}finally{xh--;}}push(t){if(xh>0&&k$1(t)&&O$1(t[0])){const e=i.prototype[t[0]];return void(T$1(e)&&e.apply(this,t.slice(1)))}this._execute_array([t]);}get Zh(){return {property:xn$1,persistenceKey:En$1,cookieName:"_fbc",pattern:Fh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[En$1]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(En$1)}}}get Jh(){return {property:kn$1,persistenceKey:Tn,cookieName:"_fbp",pattern:Mh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[Tn]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(Tn)}}}Kh(t){var i;const e=null===(i=this.persistence)||void 0===i?void 0:i.get_property(t.persistenceKey);return O$1(e)&&t.pattern.test(e)?{value:e,delivered:false}:P$1(e)&&O$1(e.value)&&t.pattern.test(e.value)?{value:e.value,delivered:true===e.delivered}:void 0}Xh(t,i,e){return i===(null==e?void 0:e.value)?{value:i,pending:!e.delivered}:(t.register(i,false),{value:i,pending:true})}Yh(t){if(!this.config.save_campaign_params||this.nh())return;const i=Wr(t.cookieName);return O$1(i)&&t.pattern.test(i)?i:void 0}td(t,i,e,s){if(!this.persistence)return;const n=this.Zh;this.persistence.refreshMetaIdentifiers();const r=this.Kh(n);if(s)return void n.unregister();if(e)return O$1(i)&&Fh.test(i)?this.Xh(n,i,r):void n.unregister();const o=O$1(t)&&Ah.test(t)?t:void 0,l=this.Yh(n);return l&&((t,i,e)=>{const s=t.split(".");if(i)return s[3]===i;if(!e)return true;const n=e.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(l,o,r)?this.Xh(n,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.Xh(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}ed(t,i,e){if(!this.persistence)return;const s=this.Jh;this.persistence.refreshMetaIdentifiers();const n=this.Kh(s);if(e)return void s.unregister();if(i)return O$1(t)&&Mh.test(t)?this.Xh(s,t,n):void s.unregister();const r=this.Yh(s);return r?this.Xh(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}nd(t,i){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const e=this.Kh(t);(null==e?void 0:e.value)!==i||e.delivered||t.register(i,true);}capture(t,i,e){var s,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mh))return void Us.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Us.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(R$1(t)||!O$1(t))return void Us.error("No event name provided to posthog.capture");if(this.ah(),"$snapshot"===t&&this.nh())return;const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return void Us.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const o=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Us.critical("This capture call is ignored due to client rate limiting.");let l;(null==i?void 0:i.$current_url)&&!O$1(null==i?void 0:i.$current_url)&&(Us.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?void 0:e.sd)||Us.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(l=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const u=new Date,a=(null==e?void 0:e.timestamp)||u,h=di(null==e?void 0:e.uuid,Qr);let d={uuid:h,event:t,properties:this.calculateEventProperties(t,i||{},a,h)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&r&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const c="$feature_flag_called"===t&&false===d.properties.$feature_flag_has_experiment&&true===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!c&&(d.$set=null==e?void 0:e.$set);const v=P$1(null==i?void 0:i.$set)?i.$set:void 0,f=k$1(null==i?void 0:i.$unset)?i.$unset:[],p=(null==e?void 0:e.$unset)||[],_=t=>{var i;const s=!!(null==e?void 0:e.$set)&&t in e.$set;return {hasProvided:s||!!v&&t in v,provided:s?null==e||null===(i=e.$set)||void 0===i?void 0:i[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},g=_(xn$1),m=_(kn$1),y=[{channel:this.Zh,hasProvided:g.hasProvided,update:this.td(null==l?void 0:l.fbclid,g.provided,g.hasProvided,g.unset)},{channel:this.Jh,hasProvided:m.hasProvided,update:this.ed(m.provided,m.hasProvided,m.unset)}];for(const{channel:t,hasProvided:i,update:e}of y)e&&true===d.properties.$process_person_profile&&e.pending&&!i&&!c&&(d.$set=wi({[t.property]:e.value},d.$set));const b=null==e?void 0:e.$unset;b&&(d.$unset=b);const w=c?void 0:this.rd(null==e?void 0:e.$set_once,t!==Fr,t===Ar);if(w&&(d.$set_once=w),(null==e?void 0:e._noTruncate)||(S=this.config.properties_string_max_length,d=function(t,i){const e=new Set;return function t(s,n){if(s!==Object(s))return i?i(s):s;if(e.has(s))return;let r;if(e.add(s),k$1(s))r=[],Mr(s,i=>{r.push(t(i));});else {const i={};Dr(z$1(s)?Br(s):s,(s,n)=>{e.has(s)||(i[n]=t(s));}),r=i;}return r}(t)}(d,t=>O$1(t)?t.slice(0,S):t)),d.timestamp=a,R$1(null==e?void 0:e.timestamp)||(d.properties.$event_time_override_provided=true,d.properties.$event_time_override_system_time=u),c&&(d.properties=((t,i=[])=>{const e={},s=i=>{ void 0!==t[i]&&(e[i]=t[i]);};return _e$2.forEach(s),i.forEach(s),e})(d.properties,Dh)),t===mu.DISMISSED||t===mu.SENT){const e=null==i?void 0:i[yu.SURVEY_ID],s=null==i?void 0:i[yu.SURVEY_ITERATION];eh({id:e,current_iteration:s}),d.$set=wi(wi({},d.$set),{},{[Ha$1({id:e,current_iteration:s},t===mu.SENT?"responded":"dismissed")]:true});}else t===mu.SHOWN&&(d.$set=wi(wi({},d.$set),{},{[yu.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var S;if(t===Su.SHOWN){const t=null==i?void 0:i[xu.TOUR_TYPE];t&&(d.$set=wi(wi({},d.$set),{},{[`${xu.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}));}const x=wi(wi({},d.properties.$set),d.$set);if(C(x)||this.setPersonPropertiesForFlags(x),!F$1(this.config.before_send)){const t=this.Os(d);if(!t)return;d=t,d.uuid=di(d.uuid,Qr);}this.sessionRecording&&!this.wh&&Ih(t)&&(this.wh=true,setTimeout(()=>this.wh=false,3e4));const E=y.filter(({channel:t,update:i})=>{var e,s,n;const r=null!==(e=null===(s=d.$set)||void 0===s?void 0:s[t.property])&&void 0!==e?e:P$1(null===(n=d.properties)||void 0===n?void 0:n.$set)?d.properties.$set[t.property]:void 0;return (null==i?void 0:i.pending)&&r===i.value});this.ur.emit("eventCaptured",d);const T=null!==(s=null==e?void 0:e._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(T),A=wi(wi(wi({method:"POST",url:T,data:d,compression:"best-available",preferSyncCompression:null==e?void 0:e.send_instantly,timestampMode:I?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},I&&(null===(n=d.properties)||void 0===n?void 0:n.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),E.length?{fireCallbackOnDrop:true,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:i}of E)this.nd(t,i.value);}}:{});if(!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)){var M;let t;!A.transport&&!A.callback&&C(null!==(M=this.config.request_headers)&&void 0!==M?M:{})&&this.ph&&(t="sendBeacon"),this.Eh(A,t);}else this.Mh.enqueue(A);return d}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.od)||void 0===i?void 0:i.getExtension(t)}Bh(){var t;return null!==(t=this.od)&&void 0!==t?t:this.od=new $h(this)}dr(t){this._h.push(t);let i=true;return ()=>{if(!i)return;i=false;const e=this._h.indexOf(t);-1!==e&&this._h.splice(e,1);}}Dh(t=true){var i;return !!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.Lh(t),true)}Lh(t=true){var i,e,s;this.$h=null,"anonymous"===(null===(i=this.persistence)||void 0===i?void 0:i.get_property("$user_state"))&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.yh.clear(),this.ad()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags();}calculateEventProperties(i,e,r,o,l){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.ah(),this.persistence.syncCookieProperties(),this.Dh();const u=l?void 0:this.persistence.remove_event_timer(i);let h=wi({},e);if(h.token=this.config.token,h.$config_defaults="latest"===this.config.defaults?jh:this.config.defaults,this.nh()&&(h[fr$1]=true),"$snapshot"===i){const t=wi(wi({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!O$1(h.distinct_id)&&!M$1(h.distinct_id)||I$1(h.distinct_id))&&Us.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const d=function(i,e,s,r=false){var o,l,u,h;if(!a)return {};const d=i?[...Dl,...e||[]]:[],[c,f]=Qt$1(a),[p,_]=function(t){for(let i=0;si.length>i;i++){const[e,s,n]=si[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return [s,(null==i?void 0:i[1])||""]}}return ["",""]}(a),g=function(){const t="u">typeof navigator?navigator:void 0;return (null==t?void 0:t.brave)?{brave:true}:{}}(),m={};R$1(s)||(m.detectGoogleSearchApp=s);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,w=null===(l=navigator)||void 0===l?void 0:l.maxTouchPoints,S=null==t||null===(u=t.screen)||void 0===u?void 0:u.width,x=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,E=null==t?void 0:t.devicePixelRatio;R$1(b)||(y.userAgentDataPlatform=b),R$1(w)||(y.maxTouchPoints=w),R$1(S)||(y.screenWidth=S),R$1(x)||(y.screenHeight=x),R$1(E)||(y.devicePixelRatio=E);const k=Nr(Ur({$os:c,$os_version:f,$browser:Jt$1(a,navigator.vendor,g,m),$webview_app:p,$webview_app_version:_,$device:ti(a),$device_type:ii(a,y),$timezone:Tl(),$timezone_offset:Jl()}),{$current_url:Fl(r?vi(null==n?void 0:n.href):null==n?void 0:n.href,d,jl),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:Zt$1(a,navigator.vendor,g,m),$browser_language:Hl(),$browser_language_prefix:ql(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v$1.LIB_NAME,$lib_version:v$1.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v$1.SDK_DIST_CHANNEL&&(k.$sdk_dist_channel=v$1.SDK_DIST_CHANNEL),k}(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){const{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId(l,r.getTime(),true);h.$session_id=t,h.$window_id=i;}this.sessionPropsManager&&Nr(h,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){const t=this.sessionRecording.sdkDebugProperties,e=!this.wh&&Ih(i);for(const i in t)(e||m(Rh,i))&&(h[i]=t[i]);}h.$sdk_debug_retry_queue_size=null===(c=this.Ph)||void 0===c?void 0:c.length;}catch(t){h.$sdk_debug_error_capturing_properties=String(t);}let f;if(this.requestRouter.region===Ya$1&&(h.$lib_custom_api_host=this.config.api_host),f="$pageview"!==i||l?"$pageleave"!==i||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Nr(h,f),"$pageview"===i&&s$1&&(h.title=s$1.title),!R$1(u)){const t=r.getTime()-u;h.$duration=parseFloat((t/1e3).toFixed(3));}a&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const p=this.persistence.properties(),_=this.sessionPersistence.properties(),g=h.$groups,y=p.$groups;P$1(g)&&!C(g)&&(h.$groups=wi(wi({},P$1(y)?y:{}),g)),Dr(["$referrer","$referring_domain"],t=>{t in p&&delete _[t];});const b={};if(this._h.length>0)for(const t of this._h.slice())try{Nr(b,t());}catch(t){Us.error("Failed to produce browser extension event properties",t);}h=Nr({},d,p,_,wi(wi({},b),h)),h.$is_identified=this._isIdentified(),k$1(this.config.property_denylist)?Dr(this.config.property_denylist,function(t){delete h[t];}):Us.error(Ch+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const w=this.config.sanitize_properties;w&&(Us.error(Ph),h=w(h,i));const S=this.ld();return h.$process_person_profile=S,S&&!l&&this.ud("_calculate_event_properties"),h}rd(t,i=true,e=false){var s;if(!this.persistence||!this.ld())return t;if(this.mh&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Nr({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Us.error(Ph),o=l(o,"$set_once")),i&&(this.mh=true),C(o)?void 0:o}register(t,i){var e;null===(e=this.persistence)||void 0===e||e.register(t,i);}register_once(t,i,e){var s;null===(s=this.persistence)||void 0===s||s.register_once(t,i,e);}register_for_session(t){var i,e;null===(i=this.persistence)||void 0===i||i.syncCookieProperties(),this.Dh(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.yh.add(t)),this.ad();}unregister(t){var i;null===(i=this.persistence)||void 0===i||i.unregister(t);}unregister_for_session(t){var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t),this.yh.delete(t),this.ad();}hd(t,i){this.register({[t]:i});}Rh(){this.yh.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t);}),this.yh.clear(),this.ad();}ad(){var t;if(!this.bh)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.hi)||!wo.Et())return void wo.Pt(this.bh);const i=[];this.yh.forEach(t=>i.push(t)),i.length>0?wo.At(this.bh,i):wo.Pt(this.bh);}getFeatureFlag(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,s;return null!==(e=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags();}updateFlags(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(t,i,e);}updateEarlyAccessFeatureEnrollment(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(t,i,e);}getEarlyAccessFeatures(t,i=false,e){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.ur.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:true}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:false,error:Th}),()=>{})}onSessionId(t){var i,e;return null!==(i=null===(e=this.sessionManager)||void 0===e?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i=false){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:false,error:Th});}getActiveMatchingSurveys(t,i=false){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:false,error:Th});}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:false,error:Th}),()=>{})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i);}displaySurvey(t,i=nh){var e;null===(e=this.surveys)||void 0===e||e.displaySurvey(t,i);}cancelPendingSurvey(t){var i;null===(i=this.surveys)||void 0===i||i.cancelPendingSurvey(t);}canRenderSurvey(t){var i,e;return null!==(i=null===(e=this.surveys)||void 0===e?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:false,disabledReason:Th}}canRenderSurveyAsync(t,i=false){var e,s;return null!==(e=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:false,disabledReason:Th})}dd(t){return !t||I$1(t)?(Us.critical("Unique user id has not been set in posthog.identify"),false):"$posthog_cookieless"===t?(Us.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),false):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Us.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.`),false)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Us.uninitializedWarning("posthog.identify");if(M$1(t)&&(t=t.toString(),Us.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.dd(t))return;if(!this.ud("posthog.identify"))return;this.ah();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.Dh(false),o=this.persistence.ku();let l=false;try{const s=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property("__alias")&&(this.unregister($n),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Tr,a=t!==s,h=!a&&o;if(a&&o){var u;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(or$1,Pr),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$identify",n,{$set:i||{},$set_once:e||{}})&&(this.$h=Ja$1(t,i,e)),null===(u=this.featureFlags)||void 0===u||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s);}else if(h){this.persistence.set_property(or$1,Pr);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$set",{$set:s,$set_once:n})&&(this.$h=Ja$1(t,i,e));}else (i||e)&&this.setPersonProperties(i,e);a||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(rn$1)):h&&(i||e)&&this.reloadFeatureFlags(),l=!0;}finally{o&&this.persistence.Cu(l);}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.ud("posthog.setPersonProperties"))return;const e=Ja$1(this.get_distinct_id(),t,i);this.$h!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},true),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.$h=e)):Us.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.");}unsetPersonProperties(t){var i;const e=(k$1(t)?t:[t]).filter(t=>O$1(t)&&t.length>0);0!==e.length&&this.ud("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,true),this.capture("$set",{$unset:e}),this.$h=null);}group(t,i,e){var s;if(!t||!i)return void Us.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Dh();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:wi(wi({},n),{},{[t]:i})}),(r||e)&&this.ld()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(Fr,s);}e&&this.setGroupPropertiesForFlags({[t]:e}),r&&!e&&this.reloadFeatureFlags();}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags();}setPersonPropertiesForFlags(t,i=true){var e;null===(e=this.featureFlags)||void 0===e||e.setPersonPropertiesForFlags(t,i);}resetPersonPropertiesForFlags(t=true){var i;null===(i=this.featureFlags)||void 0===i||i.resetPersonPropertiesForFlags(t);}setGroupPropertiesForFlags(t,i=true){var e;this.ud("posthog.setGroupPropertiesForFlags")&&(null===(e=this.featureFlags)||void 0===e||e.setGroupPropertiesForFlags(t,i));}resetGroupPropertiesForFlags(t){var i;null===(i=this.featureFlags)||void 0===i||i.resetGroupPropertiesForFlags(t);}reset(t){const i=N$1(t)?t:null==t?void 0:t.resetDeviceID,e=N$1(t)||null==t?void 0:t.bootstrap;this.vd(i,false,e);}vd(t,i=false,e){var s,n,r,o,l,u;if(Us.info("reset"),!this.__loaded)return Us.uninitializedWarning("posthog.reset");const a=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Th)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Qu());const h=this.get_property(bn$1),d=this.get_property(wn$1),c=this.get_property(jn);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();i||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.");const f=null===(l=this.persistence)||void 0===l||null===(u=l.ku)||void 0===u?void 0:u.call(l),p=this.uh;this.uh=p||i;let _=false;try{var g,m,y,b,w,S,x,E,k,T,P,C,O;if(null===(g=this.persistence)||void 0===g||g.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this.yh.clear(),this.ad(),R$1(c)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:c}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(E=this.persistence)||void 0===E||E.set_property("$user_state","anonymous"),null===(k=this.sessionManager)||void 0===k||k.resetSessionId(),this.$h=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:vr$1,$device_id:null},"");else {const i=this.config.get_device_id(Qr());this.register_once({distinct_id:i,$device_id:t?i:h},""),t||R$1(d)||this.register({[wn$1]:d});}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.nh()&&(null===(O=this.persistence)||void 0===O||O.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(P=this.featureFlags)||void 0===P||P.initialize(),!F$1(a)&&!(null===(C=this.sessionManager)||void 0===C?void 0:C.setBootstrapSessionId(a,!0))){const t=wi({},e);delete t.sessionID,this.config.bootstrap=t;}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0;}finally{var I,A;this.uh=p,f&&(null===(I=this.persistence)||void 0===I||null===(A=I.Cu)||void 0===A||A.call(I,_));}var M;this.cr&&(null===(M=this.conversations)||void 0===M||M.onRemoteConfig(this.cr)),this.reloadFeatureFlags();}shutdown(t){var i=this;return J$1(function*(){if(!i.__loaded)return void Us.uninitializedWarning("posthog.shutdown");i.gh=true,clearTimeout(i.Fh),i.Fh=void 0;const t=i.zh;i.zh=void 0;for(const e of [()=>{var t;return null===(t=i.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=i.Mh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.Ph)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=e();t&&T$1(t.then)&&t.then(void 0,t=>{Us.error("Error during shutdown",t);});}catch(t){Us.error("Error during shutdown",t);}})()}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)||void 0===e||e.fd();}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.pd();}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?void 0:i.checkAndGetSessionAndWindowId(true).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return "";const{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(true);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if((null==t?void 0:t.withTimestamp)&&e){var n;const i=null!==(n=t.timestampLookBack)&&void 0!==n?n:10;if(!e)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-e)/1e3)-i,0)}`;}return s}alias(t,i){return t===this.get_property("$people_distinct_id")?(Us.critical("Attempting to create alias for existing People user - aborting."),-2):this.ud("posthog.alias")?(R$1(i)&&(i=this.get_distinct_id()),t!==i?(this.hd($n,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Us.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=wi({},this.config);if(P$1(t)){var e,s,n,r,o,l,u,a,h,d,c,v,f,p;Nr(this.config,zh(t));const b=this.fh();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var _,g;if(t&&this.sessionPersistence!==this.persistence&&(null===(_=this.sessionPersistence)||void 0===_||_.remove(),null===(g=this.sessionPersistence)||void 0===g||g.destroy()),this.persistence.update_config(this.config,i,b),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new uu(wi(wi({},this.config),{},{persistence:"sessionStorage"}),b,false);else {var m;null===(m=this.sessionPersistence)||void 0===m||m.update_config(wi(wi({},this.config),{},{persistence:"sessionStorage"}),wi(wi({},i),{},{persistence:"sessionStorage"}),b);}}const w=this.Ch(this.config.debug);var y;N$1(w)&&(this.config.debug=w),N$1(this.config.debug)&&(this.config.debug?(Gs.DEBUG=true,oo.Et()&&oo.At("ph_debug",true),Us.info("set_config",{config:t,oldConfig:i,newConfig:wi({},this.config)})):(Gs.DEBUG=false,oo.Et()&&oo.Pt("ph_debug"))),null===(e=this.featureFlags)||void 0===e||null===(s=e.updateConfig)||void 0===s||s.call(e,this.config,this.Qu()),null===(n=this.exceptionObserver)||void 0===n||n.onConfigChange(),null===(r=this.exceptions)||void 0===r||r.onConfigChange(),null===(o=this.metrics)||void 0===o||o.onConfigChange(),null===(l=this.webMCP)||void 0===l||l.startIfEnabled(),null===(u=this.sessionRecording)||void 0===u||u.startIfEnabledOrStop(),null===(a=this.tracingHeaders)||void 0===a||a.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(y=this.historyAutocapture)||void 0===y||y.startIfEnabledOrStop()),null===(c=this.exceptionObserver)||void 0===c||c.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this.hh(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&ml(this,Eh,false);}}_overrideSDKInfo(t,i){Gs.LIB_NAME=t,Gs.LIB_VERSION=i;}startSessionRecording(t){const i=true===t,e={sampling:i||!!(null==t?void 0:t.sampling),linked_flag:i||!!(null==t?void 0:t.linked_flag),url_trigger:i||!!(null==t?void 0:t.url_trigger),event_trigger:i||!!(null==t?void 0:t.event_trigger)};var s,n,r,o,l;Object.values(e).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),e.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),e.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),e.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),e.event_trigger&&(null===(l=this.sessionRecording)||void 0===l||l.overrideTrigger("event")));this.set_config({disable_session_recording:false});}stopSessionRecording(){this.set_config({disable_session_recording:true});}sessionRecordingStarted(){var t;return !!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,i){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(wi(wi({},e),i))}catch(t){return}}addExceptionStep(t,i){var e;null===(e=this.exceptions)||void 0===e||e.addExceptionStep(t,i);}captureLog(t){var i;null===(i=this.logs)||void 0===i||i.captureLog(t);}get logger(){var t,e;return null!==(t=null===(e=this.logs)||void 0===e?void 0:e.logger)&&void 0!==t?t:i.gd}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t});}stopExceptionAutocapture(){this.set_config({capture_exceptions:false});}loadToolbar(t){var i,e;return null!==(i=null===(e=this.toolbar)||void 0===e?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null===(i=this.persistence)||void 0===i?void 0:i.props[t]}getSessionProperty(t){var i;return null===(i=this.sessionPersistence)||void 0===i?void 0:i.props[t]}toString(){var t;let i=null!==(t=this.config.name)&&void 0!==t?t:Nh;return i!==Nh&&(i="posthog."+i),i}_isIdentified(){var t,i;return "identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(i=this.sessionPersistence)||void 0===i?void 0:i.get_property("$user_state"))}ld(){var t,i;return !("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&C(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(i=this.persistence)||void 0===i||null===(i=i.props)||void 0===i?void 0:i.$epp))}Qh(){return true===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.ld()||this.ud("posthog.createPersonProfile")&&this.setPersonProperties({},{});}setInternalOrTestUser(){this.ud("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:true});}ud(t){return "never"===this.config.person_profiles?(Us.error(t+' was called, but process_person is set to "never". This call will be ignored.'),false):(this.sh(),this.hd(cr$1,true),true)}fh(){if("always"===this.config.cookieless_mode)return true;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}hh(){var t,i;const e=this.fh();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.md(),(null===(t=this.persistence)||void 0===t?void 0:t.hi)!==e&&(null===(n=this.persistence)||void 0===n||n.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.hi)!==e&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(e)),this.ad(),e}opt_in_capturing(t){var e;if("always"!==this.config.cookieless_mode){if(this.nh()){var s,n,r,o,l,u;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:true}),this.vd(true,true),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new La$1(this),this.pageViewManager=new $l(this),this.persistence&&(this.sessionPropsManager=new Ma$1(this,this.sessionManager,this.persistence));const t=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(u=i.__defaultExtensionClasses)||void 0===u?void 0:u.sessionRecording;var a,h;t&&(this.sessionRecording=this.ih(this.sessionRecording,new t(this)),this.cr&&(null===(a=this.sessionRecording)||void 0===a||null===(h=a.onRemoteConfig)||void 0===h||h.call(a,this.cr)));}var d,c,v;this.consent.optInOut(true),this.hh(),this.Wh(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(d=this.surveys)||void 0===d||d.loadIfEnabled(),null===(c=this.conversations)||void 0===c||c.loadIfEnabled()),(R$1(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(v=null==t?void 0:t.captureEventName)&&void 0!==v?v:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:true}),this.config.capture_pageview&&this.Vh();}else Us.warn(kh);}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(false),this.hh(),"on_reject"===this.config.cookieless_mode&&this.dh()):Us.warn(kh);}dh(){var t,i;const e=this.sessionRecording;null==e||e.dispose({discardBufferedEvents:true}),"$posthog_cookieless"!==this.get_distinct_id()&&this.vd(true,true),this.register({distinct_id:vr$1,$device_id:null}),this.th(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Vh(),this.Wh();}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return !this.uh&&("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.hh();}_is_bot(){return e$1?Ba$1(e$1,this.config.custom_blocked_useragents):void 0}Vh(){s$1&&("visible"===s$1.visibilityState?this.kh||(this.kh=true,this.capture(Or,{title:s$1.title},{send_instantly:true}),this.Sh&&(s$1.removeEventListener(hn$1,this.Sh),this.Sh=null)):this.Sh||(this.Sh=this.Vh.bind(this),qr(s$1,hn$1,this.Sh)));}debug(i){ false===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:false})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:true}));}Qu(){const t=this.Th||{};return "advanced_disable_flags"in t?!!t.advanced_disable_flags:false!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:true===this.config.advanced_disable_decide?(Us.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."),true):function(t,i,e,s,n){const r=i in t&&!F$1(t[i]),o=e in t&&!F$1(t[e]);return r?t[i]:!!o&&(n&&n.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,Us)}Os(t){var i;if(F$1(this.config.before_send))return t;const e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(L$1),s=k$1(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const i of s)try{if(n=i(n),F$1(n)){const i=`Event '${t.event}' was rejected in beforeSend function`;return j$1(t.event)?Us.warn(`${i}. This can cause unexpected behavior.`):Us.info(i),null}n.properties&&!C(n.properties)||Us.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`);}catch(i){return Us.error(`Error in beforeSend function for event '${t.event}':`,i),null}for(const i of e)if(n.properties&&F$1(n.properties[i]))return Us.warn(`Event '${t.event}' had its '${i}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var t;return null===(t=this.pageViewManager.Rl)||void 0===t?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)});}Ch(t){const i=N$1(t)&&!t,e=oo.Et()&&"true"===oo.Ot("ph_debug");return !i&&(!!e||t)}};qh.__defaultExtensionClasses={},qh.gd=(()=>{const t=()=>{};return {trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(let e=0;i.length>e;e++)t.prototype[i[e]]=Lr(t.prototype[i[e]]);}(qh,["identify"]);const Vh=["[data-ph-capture-value]"];var Wh=class{constructor(t){this._instance=t;}refresh(t){var i;const e=this._instance.config,s=P$1(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Qu(),t.url_allowlist=null==s?void 0:s.url_allowlist,t.url_ignorelist=null==s?void 0:s.url_ignorelist,t.dom_event_allowlist=null==s?void 0:s.dom_event_allowlist,t.element_allowlist=null==s?void 0:s.element_allowlist,t.css_selector_allowlist=null==s?void 0:s.css_selector_allowlist,t.css_selector_ignorelist=null==s?void 0:s.css_selector_ignorelist,t.element_attribute_ignorelist=null==s?void 0:s.element_attribute_ignorelist,t.capture_copied_text=null==s?void 0:s.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(i=null==s?void 0:s.capture_value_css_selector_allowlist)&&void 0!==i?i:Vh;}};const Gh=Bs("[ExceptionAutocapture]"),Kh=()=>{},Jh=t=>{var i;if(T$1(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Yh(t,i,e){try{if(!(i in t))return Kh;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return T$1(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),t[i]=n,()=>{if(t[i]===n)return void(t[i]=s.next);let e=t[i],r=Jh(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=Jh(e);}}}catch(t){return Kh}}const Zh=Bs("[TracingHeaders]"),Xh=Bs("[Web Vitals]"),Qh=9e5,td=["CLS","FCP","INP","LCP"],id=["INP","LCP"],ed=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],sd="disabled",nd="lazy_loading",rd=Bs("[SessionRecording]"),od=[gr,mr$1,yr,br$1,wr,$r,Sr$1,xr,Er],ld=Bs("[Heatmaps]");function ud(t){return P$1(t)&&"clientX"in t&&"clientY"in t&&M$1(t.clientX)&&M$1(t.clientY)}const ad=Bs("[Product Tours]"),hd=t=>{var i;return !t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(Mn$1))},dd=["$set_once","$set"],cd=Bs("[SiteApps]"),vd="Error while initializing PostHog app with config id ";function fd(t,i,e){if(F$1(t))return false;switch(e){case "exact":return t===i;case "contains":{const e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(t)}case "regex":try{return new RegExp(i).test(t)}catch(t){return false}default:return false}}var pd=class{constructor(t){this.Ai=t,this._o=new Set,this.wo=new Set,this.ko=new Da$1,this.So=(t,i)=>this.xo(t,i)&&this.$o(t,i)&&this.Co(t,i)&&this.To(t,i),this.xo=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event);}init(){var t,i;R$1(null===(t=this.Ai)||void 0===t?void 0:t.subscribeCapture)||(this.Io=null===(i=this.Ai)||void 0===i?void 0:i.subscribeCapture((t,i)=>{this.on(t,i);}));}dispose(){var t,i,e;null===(t=this.Io)||void 0===t||t.call(this),this.Io=void 0,null===(i=this.Ai)||void 0===i||null===(e=i.setElementSelectors)||void 0===e||e.call(i,new Set,this),this.ko=new Da$1;}register(t){var i,e;if(!R$1(null===(i=this.Ai)||void 0===i?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this._o.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.wo.add((null==t?void 0:t.event)||"");});}),null===(e=this.Ai)||void 0===e?void 0:e.setElementSelectors)){const t=new Set;this._o.forEach(i=>{var e;null===(e=i.steps)||void 0===e||e.forEach(i=>{(null==i?void 0:i.selector)&&t.add(i.selector);});}),this.Ai.setElementSelectors(t,this);}}replace(t){this._o.clear(),this.wo.clear(),this.register(t);}on(t,i){null!=i&&0!=t.length&&(this.wo.has(t)||this.wo.has(i.event))&&this._o.forEach(t=>{this.Mo(i,t)&&this.ko.emit("actionCaptured",t.name);});}Eo(t){this.onAction("actionCaptured",i=>t(i));}Mo(t,i){if(null==(null==i?void 0:i.steps))return false;for(const e of i.steps)if(this.So(t,e))return true;return false}onAction(t,i){return this.ko.on(t,i)}$o(t,i){if(null==i?void 0:i.url){var e;let r=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var s,n;r=null===(s=this.Ai)||void 0===s||null===(n=s.getActionUrl)||void 0===n?void 0:n.call(s);}catch(t){return false}if(!r||"string"!=typeof r)return false;if(!fd(r,i.url,i.url_matching||"contains"))return false}return true}Co(t,i){return !!this.Po(t,i)&&!!this.Ro(t,i)&&!!this.Ao(t,i)}Po(t,i){var e;if(!(null==i?void 0:i.href))return true;const s=this.Fo(t);if(s.length>0)return s.some(t=>fd(t.href,i.href,i.href_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return !!n&&fd(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}Ro(t,i){var e;if(!(null==i?void 0:i.text))return true;const s=this.Fo(t);if(s.length>0)return s.some(t=>fd(t.text,i.text,i.text_matching||"exact")||fd(t.$el_text,i.text,i.text_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return !!n&&(r=function(t){const i=[],e=/(?::|")text="(.*?)"/g;let s;for(;!F$1(s=e.exec(t));)i.includes(s[1])||i.push(s[1]);return i}(n),o=i.text,l=i.text_matching||"exact",r.some(t=>fd(t,o,l)));var r,o,l;}Ao(t,i){var e,s;if(!(null==i?void 0:i.selector))return true;const n=null==t||null===(e=t.properties)||void 0===e?void 0:e.$element_selectors;if(null==n?void 0:n.includes(i.selector))return true;const r=(null==t||null===(s=t.properties)||void 0===s?void 0:s.$elements_chain)||"";if(i.selector_regex&&r)try{return new RegExp(i.selector_regex).test(r)}catch(t){}return false}Fo(t){var i;return null==(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}To(t,i){return !(null==i?void 0:i.properties)||0===i.properties.length||Ka$1(i.properties.reduce((t,i)=>{const e=k$1(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)}},_d=class{constructor(t,i){this.Oo=i,this.Do=[],this.Ai=t,this.Lo=new Map,this.No=new Map,this.qo=new Map;}jo(){var t,i;this.Bo=null===(t=(i=this.Ai).subscribeSession)||void 0===t?void 0:t.call(i,t=>this.zo(t));}Ho(t){return false}Uo(){return null}Wo(t){}Vo(){}Go(t,i){return !!t&&Ka$1(t.propertyFilters,null==i?void 0:i.properties)}Qo(t,i){const e=new Map;return t.forEach(t=>{var s;null===(s=t.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(i=>{if(null==i?void 0:i.name){const s=e.get(i.name)||[];s.push(t.id),e.set(i.name,s);}});}),e}Zo(t,i,e){const s=(e===hu.Activation?this.Lo:this.No).get(t);let n=[];return this.Jo(t=>{n=t.filter(t=>null==s?void 0:s.includes(t.id));}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(i=>i.name===t);return this.Go(r,i)})}register(t){this.Ko(t,false);}replace(t){this.Ko(t,true);}Ko(t,i){R$1(this.Ai.subscribeCapture)||(this.Xo(t,i),this.Yo(t,i));}Yo(t,i){const e=t.filter(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length});var s;if(i&&this.qo.clear(),0===e.length)return void(i&&(null===(s=this.ta)||void 0===s||s.replace([])));this.ta||(this.ta=new pd(this.Ai),this.ta.init(),this.ta.Eo(t=>this.onAction(t)));const n=[];e.forEach(t=>{var i;null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||i.values.forEach(i=>{if(n.push(i),i.name){var e;const s=null!==(e=this.qo.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.qo.set(i.name,s);}});}),i?this.ta.replace(n):this.ta.register(n);}ea(t,i){i.forEach((i,e)=>{var s;const n=null!==(s=t.get(e))&&void 0!==s?s:[];i.forEach(t=>{n.includes(t)||n.push(t);}),t.set(e,n);});}Xo(t,i){var e,s,n;const r=t.filter(t=>{var i,e;return (null===(i=t.conditions)||void 0===i?void 0:i.events)&&(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),o=t.filter(t=>{var i,e;return (null===(i=t.conditions)||void 0===i?void 0:i.cancelEvents)&&(null===(e=t.conditions)||void 0===e||null===(e=e.cancelEvents)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),l=this.Qo(t,hu.Activation),u=this.Qo(t,hu.Cancellation);i?(this.Lo=l,this.No=u):(this.ea(this.Lo,l),this.ea(this.No,u)),(0!==r.length||0!==o.length||t.some(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length}))&&(null!==(e=this.Io)&&void 0!==e||(this.Io=null===(s=(n=this.Ai).subscribeCapture)||void 0===s?void 0:s.call(n,(t,i)=>{this.onEvent(t,i);})));}onEvent(t,i){var e,s;const n=this.ia(),r=(null==i||null===(e=i.properties)||void 0===e?void 0:e.$survey_id)||(null==i||null===(s=i.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.na(t,r,i);if("consume"===e)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.sa([r]);if("persist"===e)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.ra(r),void this.oa([r])}if(this.No.has(t)){const e=this.Zo(t,i,hu.Cancellation);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this.sa(e.map(t=>t.id)),e.forEach(t=>this.aa(t.id)));}if(!this.Lo.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.Lo.get(t)});const o=this.Zo(t,i,hu.Activation);this.la(o.map(t=>t.id));}onAction(t){this.qo.has(t)&&this.la(this.qo.get(t)||[]);}la(t){if(0===t.length)return;const i=!!this.Ai.getSessionId(),e=[];for(const s of t)i&&this.Ho(s)?this.ra(s)&&this.ua(s):e.push(s);e.length>0&&(this.Do=[...new Set([...this.Do,...e])]),this.ia().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.ca();}ra(t){this.Do=this.Do.filter(i=>i!==t);const i=this.ha();return !i.includes(t)&&(this.da([...i,t]),this.va(),true)}sa(t){const i=new Set(t);this.Do=this.Do.filter(t=>!i.has(t));const e=this.fa(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.da(s),0===s.length&&this.pa()),this.oa(t),this.ca();}ca(){try{var t;null===(t=this.Oo)||void 0===t||t.call(this);}catch(t){this.ia().error("Error while handling activated items change",t);}}ga(){const t=this.Uo();if(!t)return {};const i=this.Ai.getProperty(t);return i&&"object"==typeof i?i:{}}ua(t){if(!this.Uo())return;const i=this.ga();this.Wo(wi(wi({},i),{},{[t]:Date.now()}));}oa(t){if(!this.Uo())return;const i=this.ga(),e={};let s=false;for(const[n,r]of Object.entries(i))t.includes(n)?s=true:e[n]=r;s&&(C(e)?this.Vo():this.Wo(e));}ma(){this.Uo()&&this.Vo();}getActivationTimestamp(t){if(!this.ha().includes(t))return;const i=this.ga()[t];return M$1(i)?i:void 0}fa(){const t=this.ya();return this.Ai.getProperty(t)||[]}ha(){const t=this.fa();if(0===t.length)return [];const i=this.Ai.getProperty(this.ba()),e=this.Ai.getSessionId();return e&&i===e?t:[]}va(){const t=this.Ai.getSessionId();t&&this._a(t);}pa(){this.wa();}zo(t){const i=this.Ai.getProperty(this.ba());if(i&&i!==t){const t=this.fa(),i=this.ga();t.length>0&&(this.da([]),t.filter(t=>M$1(i[t])).forEach(t=>this.aa(t))),this.pa(),this.ma(),t.length>0&&this.ca();}}getActivatedIds(){return [...new Set([...this.ha(),...this.Do])].filter(t=>!this.ka(t))}dispose(){var t,i,e;null===(t=this.Bo)||void 0===t||t.call(this),this.Bo=void 0,null===(i=this.Io)||void 0===i||i.call(this),this.Io=void 0,null===(e=this.ta)||void 0===e||e.dispose(),this.ta=void 0;}reset(){this.Do=[],this.fa().length>0&&this.da([]),this.pa(),this.ma(),this.ca();}getEventToItemsMap(){return this.Lo}Sa(){return this.ta}},gd=class extends _d{constructor(t,i,e,s){var n;super({subscribeCapture(i){const e=t.onEvent(t=>i(t.event,t));return ()=>e.dispose()},subscribeSession(i){const e=t.onSession(i);return ()=>e.dispose()},getSessionId(){var i;return null===(i=t.session)||void 0===i?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(n=null==e?void 0:e.setElementSelectors)&&void 0!==n?n:(i,e)=>{var s;return null===(s=t.getExtension("autocapture"))||void 0===s?void 0:s.setElementSelectors(i,e)}},s),this.xa=t,this.$a=i,this.jo();}ya(){return pn$1}ba(){return _n}Uo(){return gn$1}Wo(t){this.xa.kv.set({[gn$1]:t});}Vo(){this.xa.kv.remove(gn$1);}Ho(t){var i;let e;this.Jo(i=>{e=i.find(i=>i.id===t);});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return M$1(s)&&s>0}Ca(){return mu.SHOWN}Jo(t){this.$a.getSurveys(t);}aa(t){this.$a.cancelPendingSurvey(t);}ia(){return ih}da(t){this.xa.kv.set({[pn$1]:t});}_a(t){this.xa.kv.set({[_n]:t});}wa(){this.xa.kv.remove(_n);}ka(){return false}na(t,i,e){var s;if(t===mu.SENT&&false===(null==e||null===(s=e.properties)||void 0===s?void 0:s.$survey_completed))return "ignore";let n;return this.Jo(t=>{n=t.find(t=>t.id===i);}),!n||function(t){var i;return qa$1(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(n)?t===mu.SHOWN?"consume":"ignore":t===mu.SHOWN?"persist":t===mu.DISMISSED||t===mu.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const md=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),yd="SDK is not enabled or survey functionality is not yet loaded",bd="Disabled. Not loading surveys.";var wd=class{constructor(t){this.Ta=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ia=false,this.Ma=false,this.Ea=[],this.Pa=[],this.Ra=null,this.Aa=null,this.Ci=false,this.Fa=new Set,this.onRemoteConfig=t=>{if(this.Ci)return;if(this.Ar.disableSurveys)return;if(!t.ok)return this.Ma=true,this.Oa({isLoaded:false,error:"Remote config unavailable. Not loading surveys."}),ih.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(F$1(i))return ih.warn("Flags not loaded yet. Not loading surveys.");this.Da=N$1(i)?i:i.length>0,ih.info(`flags response received, isSurveysEnabled: ${this.Da}`),this.loadIfEnabled();},this.Oa=t=>{this.Pa.slice().forEach(i=>this.La(i,t));};}setup(t){if(!this.Ci)return this.Na=t,md(t.kv.initialize(),()=>{if(this.Na!==t||this.Ci)return;this.Na=void 0,this.xa=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.Ci?i.dispose():(this.qa=i,this.loadIfEnabled());})}dispose(){var t,i,e,s,n;this.Ci||(this.Ci=true,this.Na=void 0,this.xa=void 0,null===(t=this.qa)||void 0===t||t.dispose(),this.qa=void 0,null===(i=this._surveyEventReceiver)||void 0===i||i.dispose(),this._surveyEventReceiver=null,null===(e=this._surveyManager)||void 0===e||null===(s=e.dispose)||void 0===s||s.call(e),this._surveyManager=null,this.Ea=[],this.Pa.forEach(t=>{t.active=false;}),this.Pa=[],null===(n=this.ja)||void 0===n||n.call(this),this.ja=void 0,this.Ra=null,this.Fa.forEach(t=>clearTimeout(t)),this.Fa.clear());}get Ar(){return this.Ta.get()}getRenderContext(){if(!this.xa)return;const t=this;return {client:this.xa,get config(){return t.Ar},surveys:t}}initialize(){this.loadIfEnabled();}reset(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.clearInMemoryInProgressSurveyState)||void 0===i||i.call(t);try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let i=0;i<localStorage.length;i++){const e=localStorage.key(i);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&t.push(e);}t.forEach(t=>localStorage.removeItem(t));}catch(t){}this.Oa();}loadIfEnabled(){if(this.Ci||!this.xa)return;const t=this.Ar;if(this._surveyManager)return;if(this.Ia)return void ih.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void ih.info(bd);if(t.cookielessMode&&this.xa.isOptedOut)return void ih.info("Not loading surveys in cookieless mode without consent.");const i=this.Ta.getExtensions();if(!i)return void this.Ba("PostHog Extensions not found.");if(R$1(this.Da)&&!t.advancedEnableSurveys)return;const e=this.Da||t.advancedEnableSurveys;this.Ia=true,this.Ma=false;try{const t=i.generateSurveys;if(t)return this.za(t,e),void(this.Ia=!1);const s=i.loadExternalDependency;if(!s)return this.Ba(fn$1),void(this.Ia=!1);s(t=>{try{if(this.Ci)return;const i=this.Ta.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.Ba("Could not load surveys script",t):this.za(i.generateSurveys,e);}finally{this.Ia=!1;}});}catch(t){throw this.Ia=false,this.Ba("Error initializing surveys",t),t}}za(t,i){var e;if(this.Ci)return;this._surveyManager=t(i),this._surveyEventReceiver=this.Ha(this.xa,this.Oa);const s=null===(e=this.xa)||void 0===e?void 0:e.kv.get(cn$1);s&&this.Ua(s),ih.info("Surveys loaded successfully"),this.Wa(),this.Oa(),this.Va({isLoaded:true});}Ha(t,i){return new gd(t,this,void 0,i)}Ba(t,i){this.Ma=true,ih.error(t,i),this.Oa({isLoaded:false,error:t}),this.Va({isLoaded:false,error:t});}onSurveysLoaded(t){return this.Ea.push(t),this._surveyManager&&this.Va({isLoaded:true}),()=>{this.Ea=this.Ea.filter(i=>i!==t);}}getSurveys(t,i=false){if(this.Ci)return;const e=this.xa;if(!e)return t([],{isLoaded:false,error:yd});if(this.Ar.disableSurveys)return ih.info(bd),t([]);const s=e.kv.get(cn$1);if(s&&!i)return t(s,{isLoaded:true}),void(this.Ga()&&this.getSurveys(()=>{},true));if(this.Ra)return void this.Ra.then(({surveys:i,context:e})=>{this.Ci||t(i,e);}).catch(t=>ih.error("Error in survey callback",t));const n=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Ar.requestTimeoutMs}).then(t=>{try{return this.Qa(e,t)}catch(t){return ih.error("Error processing surveys response",t),this.Qa(e,{statusCode:0,error:t})}},t=>this.Qa(e,{statusCode:0,error:t}));this.Ra=n;const r=()=>{this.Ra===n&&(this.Ra=null);};n.then(i=>{r(),this.Ci||(this.Oa(i.context),t(i.surveys,i.context));},r).catch(t=>ih.error("Error in survey callback",t));}Qa(t,i){if(this.Ci)return {surveys:[],context:{isLoaded:false,error:yd}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?ih.error(t):i.error||ih.warn(t),this.Aa=Date.now(),{surveys:[],context:{isLoaded:false,error:t}}}this.Aa=null;const s=i.json.surveys||[];return t.kv.set({[cn$1]:s,[vn$1]:Date.now()}),this.Ua(s),{surveys:s,context:{isLoaded:true}}}Ua(t){const i=t.filter(t=>function(t){return !(!t.start_date||t.end_date)}(t)&&(qa$1(t)||function(t){var i;return !!(null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}(t)));this.Za(i);}Za(t){var i;null===(i=this._surveyEventReceiver)||void 0===i||i.replace(t);}Ga(){return this.Ja()&&!this.Ra&&!this.Ka()}Ja(){var t;const i=null===(t=this.xa)||void 0===t?void 0:t.kv.get(vn$1);return M$1(i)&&Date.now()-i>3e5}Ka(){return M$1(this.Aa)&&3e5>Date.now()-this.Aa}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};eh(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString());}catch(t){}this.Oa();}Va(t){for(const i of this.Ea){if(this.Ci)return;try{t.isLoaded?this.getSurveys(i):i([],t);}catch(t){ih.error("Error in survey callback",t);}}}getActiveMatchingSurveys(t,i=false){if(!F$1(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);ih.warn("init was not called");}onActiveMatchingSurveysChanged(t){var i;if(this.Ci)return ()=>{};const e={callback:t,active:true,revision:0};this.Pa.push(e),this.Wa();const s=null===(i=this.xa)||void 0===i?void 0:i.kv.get(cn$1);return this.Ar.disableSurveys||!this._surveyManager&&this.Ma&&!this.Ia||!s&&!F$1(this.Aa)&&!this.Ra?this.La(e,{isLoaded:false}):this._surveyManager&&this.La(e),()=>{var t;e.active=false,this.Pa=this.Pa.filter(t=>t!==e),0===this.Pa.length&&(null===(t=this.ja)||void 0===t||t.call(this),this.ja=void 0);}}Wa(){var t,i,e;this._surveyManager&&this.Pa.length>0&&(null!==(t=this.ja)&&void 0!==t||(this.ja=null===(i=(e=this.Ta).onMatchingConditionsChanged)||void 0===i?void 0:i.call(e,this.Oa)));}La(t,i){if(this.Ci||!t.active)return;const e=++t.revision,s=s=>{if(!this.Ci&&t.active&&e===t.revision)try{const e=null!=i?i:{isLoaded:!0},n=JSON.stringify([s,e]);if(n===t.lastResult)return;t.lastResult=n,t.callback(s,e);}catch(t){ih.error("Error in active matching surveys callback",t);}};try{i&&!i.isLoaded?s([]):this.getActiveMatchingSurveys(s);}catch(t){ih.error("Error in active matching surveys callback",t);}}Xa(t){let i=null;return this.getSurveys(e=>{var s;i=null!==(s=e.find(i=>i.id===t))&&void 0!==s?s:null;}),i}Ya(t){if(F$1(this._surveyManager))return {eligible:false,reason:yd};const i="string"==typeof t?this.Xa(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:false,reason:"Survey not found"}}tl(t){var i;if(!(null===(i=this.xa)||void 0===i?void 0:i.canCapture))return {eligible:false,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(F$1(this._surveyManager))return {eligible:false,reason:yd};const e="string"==typeof t?this.Xa(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:false,reason:"Survey not found"}}canRenderSurvey(t){if(F$1(this._surveyManager))return ih.warn("init was not called"),{visible:false,disabledReason:yd};const i=this.tl(t);return {visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return F$1(this._surveyManager)?(ih.warn("init was not called"),Promise.resolve({visible:false,disabledReason:yd})):new Promise(e=>{this.getSurveys(i=>{var s;const n=null!==(s=i.find(i=>i.id===t))&&void 0!==s?s:null;if(n){const t=this.tl(n);e({visible:t.eligible,disabledReason:t.reason});}else e({visible:false,disabledReason:"Survey not found"});},i);})}renderSurvey(t,i,e){var s,n,r;if(!(null===(s=this.xa)||void 0===s?void 0:s.canCapture))return;if(F$1(this._surveyManager))return void ih.warn("init was not called");const o="string"==typeof t?this.Xa(t):t;if(!(null==o?void 0:o.id))return void ih.warn("Survey not found");if(!sh.includes(o.type))return void ih.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(n=typeof document>"u"?void 0:document)||void 0===n?void 0:n.querySelector(i);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){ih.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s,n;this.Fa.delete(t),!this.Ci&&(null===(i=this.xa)||void 0===i?void 0:i.canCapture)&&(ih.info(`Rendering survey ${o.id} with delay of ${null===(s=o.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(o,l,e),ih.info(`Survey ${o.id} rendered`));},1e3*o.appearance.surveyPopupDelaySeconds);return void this.Fa.add(t)}this._surveyManager.renderSurvey(o,l,e);}else ih.warn("Survey element not found");}displaySurvey(t,i){var e,s;if(!(null===(e=this.xa)||void 0===e?void 0:e.canCapture))return;if(F$1(this._surveyManager))return void ih.warn("init was not called");const n=this.Xa(t);if(!n)return void ih.warn("Survey not found");let r=n;if((null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)&&i.ignoreDelay&&(r=wi(wi({},n),{},{appearance:wi(wi({},n.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==bu.Popover&&i.initialResponses&&ih.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),false===i.ignoreConditions){const t=this.Ya(n);if(!t.eligible)return void ih.warn("Survey is not eligible to be displayed: ",t.reason)}i.displayType!==bu.Inline?this._surveyManager.handlePopoverSurvey(r,i):this.renderSurvey(r,i.selector,i.properties);}cancelPendingSurvey(t){F$1(this._surveyManager)?ih.warn("init was not called"):this._surveyManager.cancelSurvey(t);}handlePageUnload(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t);}},$d=class{constructor(t){this._instance=t;}get(){var t,i,e,s;const n=null===(t=this._instance)||void 0===t?void 0:t.config;return {disableSurveys:!!(null==n?void 0:n.disable_surveys),cookielessMode:!!(null==n?void 0:n.cookieless_mode),advancedEnableSurveys:!!(null==n?void 0:n.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==n?void 0:n.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!!(null==n||null===(e=n.surveys)||void 0===e?void 0:e.prefillFromUrl),automaticDisplay:!(null==n?void 0:n.disable_surveys_automatic_display),featureFlagEvaluation:!(null==n?void 0:n.advanced_disable_feature_flags),overrideLanguage:null==n?void 0:n.override_display_language,prepareStylesheet:null==n?void 0:n.prepare_external_dependency_stylesheet,get_current_url:null==n?void 0:n.get_current_url,uiHost:null===(s=this._instance)||void 0===s||null===(s=s.requestRouter)||void 0===s?void 0:s.endpointFor("ui","")}}getExtensions(){const t=null==d?void 0:d.__PosthogExtensions__;if(!t||!this._instance)return;const i=this._instance,{generateSurveys:e,loadExternalDependency:s}=t;return {generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:s?t=>s(i,"surveys",t):void 0}}onMatchingConditionsChanged(i){var e,s;const n=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook(t=>{"$pageview"!==t&&t!==mu.SHOWN&&t!==mu.DISMISSED&&t!==mu.SENT||i();}),r=()=>i();qr(t,"PHSurveyShown",r);let o=false;const l=null===(s=this._instance)||void 0===s?void 0:s.onFeatureFlags(()=>{o&&i();});return o=true,()=>{o=false,null==n||n(),null==l||l(),null==t||t.removeEventListener("PHSurveyShown",r);}}};const Sd=(null==t?void 0:t.location)?Ml(t.location.hash,"__posthog")||Ml(location.hash,"state"):null,xd="_postHogToolbarParams",Ed=Bs("[Toolbar]"),kd=Bs("[FeatureFlags]"),Td=Bs("[FeatureFlags]",{debugEnabled:true}),Pd="\" failed. Feature flags didn't load in time.",Cd=[502,504],Rd=["click","keydown","wheel","touchstart","pointerdown"],Od="connection_error",Id=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=true;return i},Ad=t=>{const i={};for(const[e,s]of jr(t||{}))s&&(i[e]=s);return i};var Fd=class{constructor(t){this.name="featureFlags",this.yd=false,this.featureFlagEventHandlers=[],this.$=kd,this.bd={},this._d={},this.wd=[],this.kd=new Set,this.Sd=new Set,this.xd=false,this.$d=false,this.Cd=0,this.Td=false,this.Id=false,this.Md=false,this.Ed=false,this.Pd=false,this.Rd=0,this.Ad=false,this.rn=()=>{const t=this.Fd();this.Rd=0,t&&this.reloadFeatureFlags();},this.Od=()=>{var t,i;const e=this.Dd,s=null!==(t=this.Ld)&&void 0!==t?t:e;R$1(e)||R$1(s)||this.Ar.remoteRequestsDisabled||!this.Nd||"hidden"===this.Nd.visibilityState||Date.now()-(null!==(i=this.qd)&&void 0!==i?i:0)<s||(this.Ld=this.Ad||!this.Ar.idleRefreshBackoff?e:Math.min(2*s,36e5),this.Ad=false,this.reloadFeatureFlags(),this.jd());},this.Bd=()=>{this.Ad&&this.Ld===this.Dd||this.zd();},this.sn=()=>{var t;"visible"===(null===(t=this.Nd)||void 0===t?void 0:t.visibilityState)&&this.zd();},this.Ta=t;}get Hd(){}Ud(){this.xa&&this.Wd();}setup(t){try{this.Vd=typeof window>"u"?void 0:window,this.Nd=typeof document>"u"?void 0:document;}catch(t){this.Vd=void 0,this.Nd=void 0;}return this.Na=t,this.$=t.logger.createLogger("[FeatureFlags]"),md(t.kv.initialize(),()=>{this.Na===t&&(this.Na=void 0,this.xa=t,this.Gd(t));})}Gd(t){var i;if(this.xa===t)return this.Vd&&qr(this.Vd,"online",this.rn),this.Wd(),this.Qd=t.registerDynamicEventProperties(()=>this.Zd()?this.bd:this._d),this.Jd=null===(i=this.Hd)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Kd(),this.Xd(),this.Yd();}),this.Xd(),this.initialize()}zd(){this.Ad=true,this.Ld=this.Dd,this.Od();}Wd(){var t;const i=this.Ar.refreshIntervalMs,e=!this.Ar.remoteRequestsDisabled&&this.Nd&&!R$1(i)&&i>0?i:void 0;this.Ar.idleRefreshBackoff||(this.Ld=e),e!==this.Dd&&(this.tv(),R$1(e)||(this.Dd=e,this.Ld=e,this.jd(),(null===(t=this.Nd)||void 0===t?void 0:t.addEventListener)&&(qr(this.Nd,hn$1,this.sn),Mr(Rd,t=>{qr(this.Nd,t,this.Bd,{capture:true});}))));}jd(){R$1(this.Dd)||(R$1(this.ev)||clearInterval(this.ev),this.qd=Date.now(),this.ev=setInterval(this.Od,this.Dd));}tv(){var t,i;R$1(this.ev)||(clearInterval(this.ev),this.ev=void 0,null===(t=this.Nd)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,"visibilitychange",this.sn),Mr(Rd,t=>{var i,e;null===(i=this.Nd)||void 0===i||null===(e=i.removeEventListener)||void 0===e||e.call(i,t,this.Bd,{capture:true});})),this.Dd=void 0,this.Ld=void 0,this.Ad=false,this.qd=void 0;}destroy(){this.iv();}dispose(){this.iv();}iv(){var t,i,e;this.tv(),this.Cd++,this.Id=false,this.Na=void 0,this.nv(this.kd,"cancelled"),this.nv(this.Sd,"cancelled"),this.xa&&(this.sv(),null===(t=this.Qd)||void 0===t||t.dispose(),this.Qd=void 0,null===(i=this.Jd)||void 0===i||i.call(this),this.Jd=void 0,this.wd=[],null===(e=this.Vd)||void 0===e||e.removeEventListener("online",this.rn),this.xa=void 0);}get Ar(){return this.Ta.get()}rv(t){var i;return this.ov&&t in this.ov?this.ov[t]:null===(i=this.xa)||void 0===i?void 0:i.kv.get(t)}Kd(){return !!this.ov&&(this.ov=void 0,true)}av(){var t;return !R$1(null===(t=this.xa)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.Kd()}At(t){this.lv(()=>{var i;return null===(i=this.xa)||void 0===i?void 0:i.kv.set(t)});}uv(t,i,e){if(!this.Hd||!t.$enabled_feature_flags)return;const s=this.rv("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},r=i.flags||i.featureFlags,o=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,u=l?o:e&&!k$1(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),a=this.rv("$feature_flag_payloads")||{},h=t.$feature_flag_payloads||{},d=l||e?u:Array.from(new Set([...Object.keys(a),...Object.keys(h)])),c=!l&&!e,v=!!c||u,f=!!c||d,p={[Js]:v,[en$1]:v,[ln$1]:f};t.$feature_flag_details&&(p[Ys]=v);for(const i of [Qs,Xs,tn$1])R$1(t[i])||(p[i]=true);this.Hd.markCrossTabFeatureFlagChanges(p);}Pt(t){this.lv(()=>{var i;return null===(i=this.xa)||void 0===i?void 0:i.kv.remove(t)});}lv(t){try{t();}catch(t){this.$.error("Failed to update feature flag persistence",t);}}Xd(){const t={};for(const i of [Js,ln$1,Qs,un$1]){const e=this.rv(i);R$1(e)||(t[i]=e);}this.bd=t;const i=wi({},t),e=this.rv(en$1);if(e)for(const[t,s]of Object.entries(e))i[`$feature/${t}`]=s;this._d=i;}Zd(){const t=this.Ar.cacheTtlMs;if(!t||0>=t)return false;const i=this.rv(Xs);return "number"!=typeof i||Date.now()-i>t}hv(){return !!this.Zd()&&(this.Pd||this.$d||(this.Pd=true,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),true)}dv(){const t=this.Ar.evaluationContexts;return (null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}vv(){const t=this.Ar.flagKeys;if(!R$1(t))return t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i;const e=this.Ar,s=null!==(t=null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(s).length){var n,r;const t=null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},i=Object.keys(s).filter(t=>!R$1(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,e)=>(i[e]=t[e],i),{});return this.fv({featureFlags:i,featureFlagPayloads:o},void 0,{persist:false})}}updateFlags(t,i,e){var s,n;const r=(null==e?void 0:e.merge)&&null!==(s=this.rv("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==e?void 0:e.merge)&&null!==(n=this.rv("$feature_flag_payloads"))&&void 0!==n?n:{},l=wi(wi({},r),t),u=wi(wi({},o),i),a={};for(const[t,i]of Object.entries(l))a[t]={key:t,enabled:fe$1(i),variant:pe$2(i),reason:void 0,metadata:R$1(null==u?void 0:u[t])?void 0:{id:0,version:void 0,description:void 0,payload:u[t]}};this.fv({flags:a});}get hasLoadedFlags(){return this.xd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.rv(Ys),i=this.rv(un$1),e=this.rv(an$1);if(!e&&!i)return t||{};const s=Nr({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var r,o;const n=s[t],l=null==i?void 0:i[t],u=R$1(l)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!l,a=R$1(l)?null==n?void 0:n.variant:"string"==typeof l?l:void 0,h=null==e?void 0:e[t],d=wi(wi({},n),{},{enabled:u,variant:u?null!=a?a:null==n?void 0:n.variant:void 0});u!==(null==n?void 0:n.enabled)&&(d.original_enabled=null==n?void 0:n.enabled),a!==(null==n?void 0:n.variant)&&(d.original_variant=null==n?void 0:n.variant),h&&(d.metadata=wi(wi({},null==n?void 0:n.metadata),{},{payload:h,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[t]=d;}return this.yd||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.yd=true),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return {key:e,enabled:fe$1(s),variant:pe$2(s),payload:ve$1(i[e])}})}getFlagVariants(){const t=this.rv(en$1),i=this.rv(un$1);if(!i)return t||{};const e=Nr({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.yd||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.yd=true),e}getFlagPayloads(){const t=this.rv(ln$1),i=this.rv(an$1);if(!i)return t||{};const e=Nr({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.yd||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.yd=true),e}reloadFeatureFlags(){this.Td||this.Ar.featureFlagsDisabled||this.Fd()||(this.Md&&this.$.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.$d&&(this.Id=true),this.pv||(this.wd.slice().forEach(t=>{try{t();}catch(t){this.$.error("Error while running feature flags reloading callback",t);}}),this.pv=setTimeout(()=>{this.gv();},5)));}reloadFeatureFlagsAsync(){return !this.xa||this.Td||this.Ar.featureFlagsDisabled||this.Ar.remoteRequestsDisabled||this.Fd()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.kd.add(t),this.reloadFeatureFlags();})}nv(t,i){t.forEach(t=>t({status:i})),t.clear();}sv(){clearTimeout(this.pv),this.pv=void 0;}onReloading(t){return this.wd.push(t),()=>{this.wd=this.wd.filter(i=>i!==t);}}ensureFlagsLoaded(){this.xd||this.$d||this.pv||this.reloadFeatureFlags();}setAnonymousDistinctId(t){this.$anon_distinct_id=t;}setReloadingPaused(t){this.Td=t;}resetFlagCallReported(){this.Pt(rn$1);}gv(t){var i;this.sv();const e=this.xa;if(!e||this.Ar.remoteRequestsDisabled||this.Fd())return void this.nv(this.kd,"skipped");if(this.$d)return void(this.Id=true);const s={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:wi(wi(wi({},e.initialPersonProperties),this.rv("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.rv(sn$1),timezone:Tl()};R$1(e.deviceId)||(s.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Ar.featureFlagsDisabled)&&(s.disable_flags=true);const n=this.dv();n.length&&(s.evaluation_contexts=n);const r=this.vv();R$1(r)||(s.flag_keys=r);const o=this.Ar.onlyEvaluateSurveyFeatureFlags,l="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),u=this.Cd,a=this.kd;this.kd=new Set,this.Sd=a,this.$d=true;const h=()=>{this.Id&&(this.Id=false,this.gv());},d=t=>{var i,e;const n=null!==(i=t.json)&&void 0!==i?i:{},r=200!==t.statusCode;if(this.$d=false,u!==this.Cd)return void h();if(this.mv(t.statusCode),r||this.Id||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Id)return void this.nv(a,"skipped");this.Ed=!r;const l=[];t.error?l.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Od:"unknown_error"):200!==t.statusCode&&l.push(`api_error_${t.statusCode}`),n.errorsWhileComputingFlags&&l.push("errors_while_computing_flags");const d=!!(null===(e=n.quotaLimited)||void 0===e?void 0:e.includes("feature_flags"));d&&l.push("quota_limited"),this.At({[Zs]:l}),d?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):s.disable_flags||this.fv(n,r,{partialResponse:o}),this.nv(a,s.disable_flags?"skipped":l.length||!n.flags&&!n.featureFlags?"error":"loaded"),h();},c=t=>{this.$d=false,u===this.Cd?(this.At({[Zs]:[Od]}),this.$.error("Feature flag request failed",t),this.av()&&this.Yd(true),this.nv(a,"error"),h()):h();};let v=null!==(i=this.Ar.requestMaxRetries)&&void 0!==i?i:1;const f=()=>v>0&&u===this.Cd,p=()=>{if(u!==this.Cd||!this.xa||this.Ar.remoteRequestsDisabled)return this.$d=false,this.nv(a,"skipped"),void h();try{e.sendRequest(l,{target:"flags",method:"POST",body:s,compression:this.Ar.compression,sentAt:"body",timeoutMs:this.Ar.requestTimeoutMs}).then(t=>{if((t=>Cd.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(p,500);d(t);}).catch(c);}catch(t){c(t);}};p();}Fd(){return Rl(this.Rd,3)}mv(t){this.Rd=Ol(t,this.Rd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."));}getFeatureFlag(t,i={}){var e;if(i.fresh&&!this.Ed)return;if(!(this.xd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+Pd);if(this.hv())return;const s=this.getFeatureFlagResult(t,i);return null!==(e=null==s?void 0:s.variant)&&void 0!==e?e:null==s?void 0:s.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:false});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){if(i.fresh&&!this.Ed)return;if(!(this.xd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+Pd);if(this.hv())return;const e=this.getFlagVariants(),s=t in e,n=e[t],r=this.getFlagPayloads()[t],o=String(n),l=this.rv("$feature_flag_request_id")||void 0,u=this.rv("$feature_flag_evaluated_at")||void 0;let a,h=this.rv("$flag_call_reported")||{};if(this.Ar.deduplicateCallsPerSession){var d;const t=null===(d=this.xa)||void 0===d||null===(d=d.session)||void 0===d?void 0:d.sessionId,i=this.rv(on$2);t&&t!==i&&(h={},a=t);}if(!i.send_event&&"send_event"in i)a&&this.At({[rn$1]:h,[on$2]:a});else {var c,v;const i=null===(c=this.xa)||void 0===c?void 0:c.canCapture;if(!i&&Object.keys(h).length>0&&(h={},this.At({[rn$1]:h})),i&&!(null===(v=h[t])||void 0===v?void 0:v.includes(o))){var f,p,_,g,m,y,b,w,S,x,E,T,P;k$1(h[t])?h[t].push(o):h[t]=[o],this.At(wi({[rn$1]:h},a?{[on$2]:a}:{}));const i=this.getFeatureFlagDetails(t),e=[...null!==(f=this.rv("$feature_flag_errors"))&&void 0!==f?f:[]];R$1(n)&&e.push("flag_missing");const s={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(p=null===(_=this.Ar.bootstrap)||void 0===_||null===(_=_.featureFlags)||void 0===_?void 0:_[t])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(g=null===(m=this.Ar.bootstrap)||void 0===m||null===(m=m.featureFlagPayloads)||void 0===m?void 0:m[t])&&void 0!==g?g:null,$used_bootstrap_value:!this.Ed};R$1(null==i||null===(y=i.metadata)||void 0===y?void 0:y.has_experiment)||(s.$feature_flag_has_experiment=i.metadata.has_experiment),R$1(null==i||null===(b=i.metadata)||void 0===b?void 0:b.version)||(s.$feature_flag_version=i.metadata.version);const d=null!==(w=null==i||null===(S=i.reason)||void 0===S?void 0:S.description)&&void 0!==w?w:null==i||null===(x=i.reason)||void 0===x?void 0:x.code;d&&(s.$feature_flag_reason=d),(null==i||null===(E=i.metadata)||void 0===E?void 0:E.id)&&(s.$feature_flag_id=i.metadata.id),R$1(null==i?void 0:i.original_variant)&&R$1(null==i?void 0:i.original_enabled)||(s.$feature_flag_original_response=R$1(i.original_variant)?i.original_enabled:i.original_variant),(null==i||null===(T=i.metadata)||void 0===T?void 0:T.original_payload)&&(s.$feature_flag_original_payload=null==i||null===(P=i.metadata)||void 0===P?void 0:P.original_payload),e.length&&(s.$feature_flag_error=e.join(",")),this.yv(s);}else a&&this.At({[rn$1]:h,[on$2]:a});}return s?{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:ve$1(r)}:void 0}yv(t){try{var i;null===(i=this.xa)||void 0===i||i.capture("$feature_flag_called",t);}catch(t){this.$.error("Failed to capture feature flag call",t);}}getRemoteConfigPayload(t,i){this.bv(t,i);}bv(t,i){var e=this;return J$1(function*(){const s=e.xa;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=e.dv();r.length&&(n.evaluation_contexts=r);const o=e.vv();let l;R$1(o)||(n.flag_keys=o);try{var u;const i=null===(u=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:e.Ar.compression,sentAt:"body",timeoutMs:e.Ar.requestTimeoutMs})).json)||void 0===u?void 0:u.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0;}catch(t){return void e.$.error("Remote config feature flag request failed",t)}try{i(l);}catch(t){e.$.error("Remote config feature flag callback failed",t);}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.Ed)return i.defaultValue;if(!(this.xd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+Pd),i.defaultValue;const e=this.getFeatureFlag(t,i);return R$1(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.fv(t,i,e);}fv(t,i,e){if(!this.xa)return;this.xd=true;const s=((t,i={},e={},s={},n,r=kd)=>{const o=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).map(t=>{var i;return [t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),s=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return !R$1(null===(i=e[t].metadata)||void 0===i?void 0:i.payload)}).map(t=>{var i;return [t,null===(i=e[t].metadata)||void 0===i?void 0:i.payload]}));return wi(wi({},t),{},{featureFlags:i,featureFlagPayloads:s})}return t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,u=o.featureFlags,a=o.featureFlagPayloads;if(!u)return;const h=t.requestId,d=t.evaluatedAt;if(k$1(u)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(u)for(let i=0;u.length>i;i++)t[u[i]]=true;return {[Js]:u,[en$1]:t,[tn$1]:false}}let c=u,v=a,f=l;if(null==n?void 0:n.partialResponse){const t=Object.keys(c),n=v||{};c=wi(wi({},i),c),v=wi(wi({},e),n),t.forEach(t=>{t in n||null==v||delete v[t];}),f=wi(wi({},s),f);}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var i;return !(null===(i=l[t])||void 0===i?void 0:i.failed)}));c=wi(wi({},i),Object.fromEntries(Object.entries(c).filter(([i])=>t.has(i))));const n=Object.fromEntries(Object.entries(v||{}).filter(([i])=>t.has(i)));v=wi(wi({},e),n),t.forEach(t=>{t in n||null==v||delete v[t];}),f=wi(wi({},s),Object.fromEntries(Object.entries(f||{}).filter(([i])=>t.has(i))));}else c=wi(wi({},i),c),v=wi(wi({},e),v),f=wi(wi({},s),f);return wi(wi({[Js]:Object.keys(Ad(c)),[en$1]:c||{},[ln$1]:v||{},[Ys]:f||{},[tn$1]:true===t.minimalFlagCalledEvents},h?{[Qs]:h}:{}),d?{[Xs]:d}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.$);if(s)if(false===(null==e?void 0:e.persist)){const t=!R$1(this.xa.kv.get(en$1));this.ov=s,t||this.At(s);}else this.Kd(),this.uv(s,t,!!(null==e?void 0:e.partialResponse)),this.At(s);else i&&this.av();i||(this.Pd=false),this.Yd(i);}override(t,i=false){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i});}overrideFeatureFlags(t){this._v(t);}_v(t){if(this.xa){if(false===t)return this.Pt([un$1,an$1]),this.Yd(),void Td.info("All overrides cleared");if(k$1(t))return this.At({[un$1]:Id(t)}),this.Yd(),void Td.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.yd=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[un$1]=k$1(n)?Id(n):n),r&&(s[an$1]=r),Object.keys(s).length&&this.At(s),false===n&&false===r?this.Pt([un$1,an$1]):false===n?this.Pt(un$1):false===r&&this.Pt(an$1),this.Yd(),false===n?Td.info("Flag overrides cleared"):n&&Td.info("Flag overrides set",{flags:n}),void(false===r?Td.info("Payload overrides cleared"):r&&Td.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[un$1]:t}),this.Yd(),void Td.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t});}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready");}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.xd){const{flags:i,flagVariants:e}=this.wv();try{t(i,e);}catch(t){this.$.error("Error while running feature flags callback",t);}}return ()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;const n=(this.rv("$early_access_features")||[]).find(i=>i.flagKey===t),r={[`$feature_enrollment/${t}`]:i},o={$feature_flag:t,$feature_enrollment:i,$set:r};n&&(o.$early_access_feature_name=n.name),e&&(o.$feature_enrollment_stage=e);const l=wi(wi({},this.getFlagVariants()),{},{[t]:i});null===(s=this.Hd)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[Js]:Object.keys(Ad(l)),[en$1]:l,[nn$1]:wi(wi({},this.rv("$stored_person_properties")||{}),r)}),this.Yd();try{var u;null===(u=this.xa)||void 0===u||u.capture("$feature_enrollment_update",o);}catch(t){this.$.error("Failed to capture early access feature enrollment",t);}}getEarlyAccessFeatures(t,i=false,e){const s=this.rv(Ks);!s||i?this.Sv(t,e):t(s);}Sv(t,i){var e=this;return J$1(function*(){const s=e.xa;if(!s)return;const n=i?`&${i.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,e.At({[Ks]:r});}catch(t){return void e.$.error("Early access feature request failed",t)}try{t(r);}catch(t){e.$.error("Early access feature callback failed",t);}})()}wv(){const 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),{})}}Yd(t){this.Xd();const{flags:i,flagVariants:e}=this.wv(),s=this.Md;this.Md=true,this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t});}catch(t){this.$.error("Error while running feature flags callback",t);}}),this.Md=s;}setPersonPropertiesForFlags(t,i=true){this.xv(t,i);}xv(t,i=true){const e=this.rv("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),n=null==t?void 0:t.$set_once,r={};if(n)for(const t in n)({}).hasOwnProperty.call(n,t)&&(t in e||(r[t]=n[t]));this.At({[nn$1]:wi(wi(wi({},e),r),s)}),i&&this.reloadFeatureFlags();}unsetPersonPropertiesForFlags(t,i=true){const e=wi({},this.rv("$stored_person_properties")||{});t.forEach(t=>{delete e[t];}),this.At({[nn$1]:e}),i&&this.reloadFeatureFlags();}resetPersonPropertiesForFlags(t=true){this.Pt(nn$1),t&&this.reloadFeatureFlags();}setGroupPropertiesForFlags(t,i=true){const e=this.rv("$stored_group_properties")||{},s=wi({},e);for(const i of Object.keys(t))s[i]=wi(wi({},e[i]),t[i]);this.At({[sn$1]:s}),i&&this.reloadFeatureFlags();}resetGroupPropertiesForFlags(t){if(t){const i=this.rv("$stored_group_properties")||{};this.At({[sn$1]:wi(wi({},i),{},{[t]:{}})});}else this.Pt(sn$1);}reset(){this.Cd++,this.nv(this.kd,"cancelled"),this.nv(this.Sd,"cancelled"),this.Id=false,this.bd={},this._d={},this.ov=void 0,this.xd=false,this.Td=false,this.Ed=false,this.$anon_distinct_id=void 0,this.sv(),this.yd=false,this.Rd=0;}};const Md=Bs("[FeatureFlags]");var Dd=class{constructor(t,i=false){this.$v=false,this.update(t,i);}update(t,i){this.Cv=((t,i)=>{var e,s,n,r,o,l,u,a;return {bootstrap:{featureFlags:null!==(e=null===(s=t.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(n=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},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!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:R$1(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(u=null!==(a=t.evaluation_contexts)&&void 0!==a?a:t.evaluation_environments)&&void 0!==u?u:[],flagKeys:k$1(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.$v||(Md.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.$v=true),R$1(t.flag_keys)||k$1(t.flag_keys)||Md.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings");}get(){return this.Cv}};const Nd=t=>z$1(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),jd=Bs("[Error tracking]"),Ld="webkit-masked-url:",Ud=[{value:"isolatedAPI.contexts.topHostname",exact:false},{value:"No response from target",exact:true}],Bd=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Ld],zd=["__firefox__","__gCrWeb"],Hd="Refusing to render web experiment since the viewer is a likely bot",qd={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Va$1(i,t),not_regex:(t,i)=>!Va$1(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Vd=Bs("[Conversations]"),Wd="Conversations not available yet.";function Gd(t,i){var e,s,n,r,o,l,u;const a=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,h=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=R$1(d)?Math.max(h,2048):Math.max(h,d),v=wi(wi({},function(){let t="",i="";try{var e;const s="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,n=null==s||null===(e=s.navigator)||void 0===e?void 0:e.userAgent;n&&([t,i]=Qt$1(n));}catch(t){}return function(t,i){const e=function(t){if(t)return {}.hasOwnProperty.call(ys,t)?ys[t]:t}(t);return wi(wi({},e?{"os.name":e}:{}),i?{"os.version":i}:{})}(t,i)}()),null==t?void 0:t.resourceAttributes);return {serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(u=null==v?void 0:v["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:a,maxBufferSize:h,maxQueueSize:c,maxBatchRecordsPerPost:100,rateCapWindowMs:a,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Kd=["debug","log","warn","error","info"],Jd=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},Yd="console",Zd="__posthogHandledLogsRequestError",Xd=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[Zd]=true,e},Qd=t=>!!t&&"object"==typeof t&&true===t[Zd];var tc=class{get Tv(){return wi(wi({},this.$),{},{error:(...t)=>{t.some(Qd)||this.$.error(...t);}})}constructor(t,i){var e;this.Ta=t,this.Iv=i,this.name="logs",this.Mv=false,this.Ev=false,this.Pv=false,this.$=Bs("[logs]"),this.Ju=[],this.Rv=[],this.Rd=0,this.Av=false,this.Ci=false,this.Fv=[],this.Ov=[],this.Dv=false,this.Lv=false,this.Nv=false,this.qv=()=>{var t,i;this.Ci||(this.Rd=0,null===(t=this.jv)||void 0===t||t.onReconnect(),null===(i=this.Bv)||void 0===i||i.onReconnect());},this.Mv=!!(null===(e=t.get())||void 0===e?void 0:e.captureConsoleLogs);}get zv(){return true}Hv(){}Uv(){if(!this.Nv){try{this.Vd=typeof window>"u"?void 0:window;}catch(t){this.Vd=void 0;}this.Vd&&(qr(this.Vd,"online",this.qv),this.Nv=true);}}Wv(t,i,e,s){this.Uv();const n=Gd(this.Ta.get(),e);return [new Cs(this.Vv(t,i),n,this.Tv,()=>this.Iv(),t=>t(),void 0,s),n]}Gv(){const t=this.Ta.get();var i;return this.jv&&this.Qv===t||(null===(i=this.jv)||void 0===i||i.reset(),this.Qv=t,[this.jv,this.Zv]=this.Wv(()=>this.Ju,t=>{this.Ju=t;})),this.jv}Jv(){const t=this.Ta.get();var i;return this.Bv&&this.Kv===t||(null===(i=this.Bv)||void 0===i||i.reset(),this.Kv=t,[this.Bv,this.Xv]=this.Wv(()=>this.Rv,t=>{this.Rv=t;},{serviceNameDefault:"posthog-browser-logs",consoleCapture:true},Yd)),this.Bv}setup(t){if(!this.Ci&&!this.Av)return this.Av=true,this.xa=t,this.$=t.logger.createLogger("[logs]"),md(t.kv.initialize(),()=>{this.Ci||this.Gd(t);})}Gd(t){var i;this.Uv(),(null===(i=this.Ta.get())||void 0===i?void 0:i.captureConsoleLogs)&&(this.Mv=true),(this.Mv||this.Ta.remoteConfigWillArrive&&t.kv.get(this.Ta.captureHintKey))&&this.Yv();let e=false;const s=t.onRemoteConfig(t=>{var i;e=t.ok&&true===(null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs),this.onRemoteConfig(t);});this.Ci?s.dispose():(this.qa=s,e||this.loadIfEnabled());}dispose(){var t,i,e,s,n,r,o;this.Ci||(this.Ci=true,this.tf(),null===(t=this.qa)||void 0===t||t.dispose(),this.qa=void 0,this.xa=void 0,this.Pv=false,null===(i=this.Vd)||void 0===i||i.removeEventListener("online",this.qv),null===(e=this.ef)||void 0===e||e.call(this),this.ef=void 0,null===(s=this.jv)||void 0===s||s.clearQueue(),null===(n=this.Bv)||void 0===n||n.clearQueue(),null===(r=this.jv)||void 0===r||r.reset(),null===(o=this.Bv)||void 0===o||o.reset());}onRemoteConfig(t){var i,e;if(this.Ci)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;F$1(s)?this.if():(null===(e=this.xa)||void 0===e||e.kv.set(this.Ta.captureHintKey,!!s),s?(this.Mv=true,this.Ev||this.Yv(),this.loadIfEnabled()):this.if());}reset(){var t,i,e,s;this.tf(),null===(t=this.jv)||void 0===t||t.clearQueue(),this.Ju=[],null===(i=this.jv)||void 0===i||i.reset(),null===(e=this.Bv)||void 0===e||e.clearQueue(),this.Rv=[],null===(s=this.Bv)||void 0===s||s.reset(),this.Rd=0;}captureLog(t){!this.Ci&&this.xa&&this.Gv().captureLog(t);}captureConsoleLog(t){!this.Ci&&this.xa&&this.Jv().captureLog(t);}captureBufferedConsoleLog(t,i,e){!this.Ci&&this.xa&&this.Jv().captureLog(t,{context:i,occurredAtMs:e});}md(){var t;this.tf(),null===(t=this.Bv)||void 0===t||t.clearQueue(),this.Rv=[];}if(){this.Mv||this.tf();}Yv(){var t;if(this.Dv||!(null===(t=this.Vd)||void 0===t?void 0:t.console))return;const i=Gd(this.Ta.get()).maxBufferSize;let e=true;this.Ov.push(()=>{e=false;});for(const t of Kd){let s;try{s=Jd(this.Vd.console[t]);}catch(t){continue}s&&this.Ov.push(Yh(this.Vd.console,t,n=>{const r=(...s)=>{try{e&&this.nf(t,s,i);}catch(t){}return n.apply(this.Vd.console,s)};return r.__rrweb_original__=s,r}));}this.Dv=true,this.sf=setTimeout(()=>{this.tf();},3e4);}nf(t,i,e){var s;if(this.Dv&&!this.Lv&&0!==i.length)if(null===(s=this.xa)||void 0===s?void 0:s.canCapture){if(e>this.Fv.length){this.Lv=true;try{this.Fv.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Iv()});}finally{this.Lv=false;}}}else this.tf();}tf(){if(this.Fv=[],this.Dv){this.Dv=false,this.sf&&(clearTimeout(this.sf),this.sf=void 0);for(const t of this.Ov)t();this.Ov=[];}}rf(){const t=this.Fv;return this.tf(),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){this.xa&&(t?this.lf(t):(this.jv&&this.jv.flush().catch(t=>this.uf(t)),this.Bv&&this.Bv.flush().catch(t=>this.uf(t))));}flush(){var t=this;return J$1(function*(){var i,e;const s=null===(i=t.jv)||void 0===i?void 0:i.flush().catch(i=>t.uf(i)),n=null===(e=t.Bv)||void 0===e?void 0:e.flush().catch(i=>t.uf(i));yield s,yield n;})()}uf(t){Qd(t)||this.$.error("PostHog logs flush failed:",t);}loadIfEnabled(){if(this.Ci||!this.Mv||this.Ev||this.Pv)return;const t=this.Hv();if(t){this.Pv=true;try{t((t,i)=>{if(this.Pv=!1,!this.Ci&&this.Mv)if(t||!i)this.$.error("Could not load logs script",t),this.tf();else {const t=this.rf();this.ef=i.initialize(this.xa),this.Ev=!0,t.length>0&&i.replay(this.xa,t);}});}catch(t){throw this.Pv=false,t}}else this.tf();}Vv(t,i){const e=this.xa;return {get isDisabled(){return false},get optedOut(){return !e.canCapture},getPersistedProperty:i=>i===f.LogsQueue?t():void 0,setPersistedProperty(t,e){t===f.LogsQueue&&i(null!=e?e:[]);},js:t=>this.js(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}js(t){return new Promise(i=>{if(Rl(this.Rd,3))return void i({kind:"fatal",error:Xd(void 0,"logs endpoint is unreachable, dropping batch")});let e=false;const s=t=>{e||(e=true,clearTimeout(n),i(t));},n=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Xd(void 0,"logs request timed out")});},9e4),r=this.zv;this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i;const e=t.statusCode;this.cf(e,r),e>=200&&300>e?s({kind:"ok"}):413===e?s({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?s({kind:"fatal",error:new Error(`logs request failed with status ${e}`)}):0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Xd(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)});},t=>{s({kind:"retry-later",error:t});});})}cf(t,i){(0!==t||i)&&(this.Rd=Ol(t,this.Rd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")));}lf(t){this.Ju.length>0&&this.hf(t,this.Ju,this.Zv,this.xa.library.name,t=>{this.Ju=t;}),this.Rv.length>0&&this.hf(t,this.Rv,this.Xv,Yd,t=>{this.Rv=t;});}hf(t,i,e,s,n){if(0===i.length)return;const r=i.map(t=>t.record);n([]);const o=Es(r,xs(e,this.xa.library.name,this.xa.library.version),s,this.xa.library.version);this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.uf(t));}};const ic=Bs("[NetworkMetrics]"),ec=()=>{var i;return (null==t||null===(i=t.performance)||void 0===i?void 0:i.now)?t.performance.now():Date.now()},sc={"http:":80,"https:":443},nc=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),rc=(t,i)=>{var e;const s=String(i);return {method:String(t).toUpperCase(),url:(null===(e=Pl(s))||void 0===e?void 0:e.href)||s}},oc=(t,i,e,s,n,r,o=false)=>{try{var l,u;const a=n();if(!a)return;const h=e||void 0,d=ec()-s,c=Pl(i.url);if(c&&"http:"!==c.protocol&&"https:"!==c.protocol)return;const v={url:(null==c?void 0:c.href)||i.url,method:i.method},f=T$1(a.name)?a.name(v):O$1(a.name)?a.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,r),_=wi(wi(wi(wi(wi({},(t=>{const i=nc.has(t)?t:"_OTHER";return wi({"http.request.method":i},"_OTHER"===i&&t!==i?{"http.request.method_original":t}:{})})(v.method)),c?(t=>{return {"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||sc[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i;})(c):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(l=a.attributes)||void 0===l?void 0:l.call(a,v,{status:h,durationMs:d}));null===(u=t.metrics)||void 0===u||u.histogram(f,d,{unit:"ms",attributes:_});}catch(t){ic.error("Failed to record network metric",t);}},lc=()=>{},uc=(i,e)=>T$1(null==t?void 0:t.fetch)?Yh(t,"fetch",t=>function(...s){const n=ec(),r=t.apply(this,s);if(!e())return r;try{var o,l,u;const[t,a]=s,h=rc(null!==(o=null!==(l=null==a?void 0:a.method)&&void 0!==l?l:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(u=null==t?void 0:t.url)&&void 0!==u?u:t);return r.then(t=>(oc(i,h,null==t?void 0:t.status,n,e,void 0,!0),t),t=>{throw oc(i,h,void 0,n,e,t),t})}catch(t){return ic.error("Failed to observe fetch",t),r}}):lc,ac=(i,e)=>{var s;const n=null==t||null===(s=t.XMLHttpRequest)||void 0===s?void 0:s.prototype;if(!n)return lc;const r=new WeakMap,o=Yh(n,"open",t=>function(...i){try{(()=>ha$1.has(this))()||r.set(this,rc(i[0],i[1]));}catch(t){ic.error("Failed to observe XHR open",t);}return t.apply(this,i)}),l=Yh(n,"send",t=>function(...s){let n;try{const t=r.get(this);if(t&&e()){const s=ec();n=()=>{this.removeEventListener("loadend",n),oc(i,t,this.status,s,e);},qr(this,"loadend",n);}}catch(t){ic.error("Failed to observe XHR send",t);}try{return t.apply(this,s)}catch(t){throw n&&this.removeEventListener("loadend",n),t}});return ()=>{o(),l();}},hc=new WeakMap,dc=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),cc={maxStringLength:2048,truncationSuffix:"..."},vc={maxStringLength:2048,truncationSuffix:"..."};function fc(t){if(t)return true===t?{intent:true,model:true}:{intent:false!==t.intent,model:false!==t.model}}function pc(t,i){return {}.hasOwnProperty.call(t,i)}function _c(t,i){const e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:true,enumerable:true,writable:true,value:i}),e}function gc(t,i,e=false){if(!O$1(t))return;const s=t.trim();return s?(e?us(s,cc):s).slice(0,i):void 0}function mc(t){try{return P$1(t)&&!0===t.isError}catch(t){return false}}function yc(t){return us(t||"Unknown error",vc).slice(0,2048)}function bc(t,i){try{return yc(i?function(t){try{if(!P$1(t)||!k$1(t.content))return;return t.content.filter(t=>P$1(t)&&"text"===t.type&&O$1(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):P$1(t)&&O$1(t.message)?t.message:O$1(t)?t:String(t))}catch(t){return "Unknown error"}}function wc(t,i,e){return i.errorResult?[{type:"Error",value:e,mechanism:{type:"generic",handled:true,synthetic:true,exception_id:0}}]:t.buildProperties(i.error,{handled:true}).$exception_list.map(t=>wi(wi({},t),{},{value:yc(t.value)}))}function $c(t,i){if(i)return "Error";try{if(!P$1(t))return "Error";let i=O$1(t.name)?t.name.trim():"";const e=t.constructor;return i&&"Error"!==i||!T$1(e)||"Error"===e.name||(i=e.name),(i||"Error").slice(0,256)}catch(t){return "Error"}}function Sc(t,i){return {message:bc(t,i),type:$c(t,i)}}const xc={featureFlags:class extends Fd{constructor(t){const i=new Dd(t.config,t.Qu());super(i),this.name=yh,this._instance=t,this.df=i;}get Hd(){return this._instance.persistence}updateConfig(t,i){this.df.update(t,i),this.Ud();}}},Ec={sessionRecording:class{get Ar(){return this._instance.config}get _c(){return this._instance.persistence}get started(){var t;return !!(null===(t=this.vf)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return "awaiting_config"===this.ff||"missing_config"===this.ff?this.ff:null!==(t=null===(i=this.vf)||void 0===i?void 0:i.status)&&void 0!==t?t:this.ff}constructor(i){if(this._instance=i,this._forceAllowLocalhostNetworkCapture=false,this.ff=sd,this.pf=void 0,this.gf=false,this.Je=(()=>{var i,e;if(!(null==s$1?void 0:s$1.visibilityState)||"visible"===s$1.visibilityState)return true;const n=null==t||null===(i=t.performance)||void 0===i||null===(e=i.getEntriesByType)||void 0===e?void 0:e.call(i,"visibility-state");return !(null==n?void 0:n.length)||n.some(t=>"visible"===t.name)})(),this.sn=()=>{var t,i;"visible"===(null==s$1?void 0:s$1.visibilityState)&&(this.Je=true,null===(t=this.vf)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,true));},!this._instance.sessionManager)throw rd.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Ar.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==s$1?void 0:s$1.addEventListener)&&qr(s$1,"visibilitychange",this.sn);}initialize(){this.startIfEnabledOrStop();}dispose({discardBufferedEvents:t=false}={}){var i;this.gf=true,null==s$1||null===(i=s$1.removeEventListener)||void 0===i||i.call(s$1,"visibilitychange",this.sn),t?this.mf(true):this.stopRecording();}get yf(){var i;const e=!!(null===(i=this._instance.get_property("$session_recording_remote_config"))||void 0===i?void 0:i.enabled),s=!this.Ar.disable_session_recording,n=this.Ar.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&s&&!n}startIfEnabledOrStop(t){var i;if(this.gf)return;if(this.yf&&(null===(i=this.vf)||void 0===i?void 0:i.isStarted))return;const e=!R$1(Object.assign)&&!R$1(Array.from);this.yf&&e?(this.bf(t),rd.info("starting")):(this.ff=sd,this.stopRecording());}bf(t){var i,e;if(this.yf)if("awaiting_config"!==this.ff&&"missing_config"!==this.ff&&(this.ff=nd),(null==d||null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this._f(t);else {var s,n;const i=this._instance.sessionManager;null===(s=d.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.wf,e=>{if(!this.gf&&this.yf&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:true}),rd.error("could not load recorder",e)):void this._f(t);this.ff="disabled";});}}stopRecording(){var t,i;null===(t=this.pf)||void 0===t||t.call(this),this.pf=void 0,null===(i=this.vf)||void 0===i||i.stop();}mf(t=false){var i,e;null===(i=this.pf)||void 0===i||i.call(this),this.pf=void 0,null===(e=this.vf)||void 0===e||e.discard({discardProducerEvents:t});}kf(){var t,i;null===(t=this._c)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this._c)||void 0===i||i.unregister("$replay_sample_rate");}Sf(t,i){if(F$1(t))return null;const e=M$1(t)?t:parseFloat(t);return "number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(rd.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s;}xf(t){if(this._c){var i,e;const s=this._c,n=()=>{var i;const e=false===t.sessionRecording?void 0:t.sessionRecording,n=this.Sf(null===(i=this.Ar.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Sf(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;F$1(o)&&this.kf();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[jn]:wi(wi({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:wi({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:o,minimumDurationMilliseconds:R$1(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.pf)||void 0===i||i.call(this),this.pf=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(n);}}onRemoteConfig(t){const i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?false===i.sessionRecording?(this.xf(i),void this.mf()):(this.xf(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.ff&&(this.ff="missing_config",this._instance.register_for_session({[mr$1]:true}),rd.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this.vf)||void 0===e?void 0:e.log)?this.vf.log(t,i):rd.warn("log called before recorder was ready");}get wf(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(jn);return (null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}$f(){const t=this._instance.get_property(jn);if(!t)return false;let i;try{i="object"==typeof t?t:JSON.parse(t);}catch(t){return rd.warn("persisted remote config for session recording is invalid and will be ignored",t),false}return !F$1(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}_f(t){var i,e,s;if(!this.gf&&this.yf&&this._instance.sessionManager){if(!(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return rd.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[gr]:true});var n;if(this.vf||(this.vf=null===(n=d.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Je),this.vf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.$f()){if("missing_config"===this.ff||"awaiting_config"===this.ff)return;return this.ff="awaiting_config",rd.info("persisted remote config is stale, requesting fresh config before starting"),void new Pu(this._instance).load()}this.ff=nd,null===(e=(s=this.vf).setDocumentWasEverVisible)||void 0===e||e.call(s,this.Je),this.vf.start(t);}else this.ff=sd;}onRRwebEmit(t){var i,e;null===(i=this.vf)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t);}overrideLinkedFlag(){var t,i;this.vf||null===(i=this._c)||void 0===i||i.register({$replay_override_linked_flag:true}),null===(t=this.vf)||void 0===t||t.overrideLinkedFlag();}overrideSampling(){var t,i;this.vf||null===(i=this._c)||void 0===i||i.register({$replay_override_sampling:true}),null===(t=this.vf)||void 0===t||t.overrideSampling();}overrideTrigger(t){var i,e;this.vf||null===(e=this._c)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:true}),null===(i=this.vf)||void 0===i||i.overrideTrigger(t);}get sdkDebugProperties(){var t;const i={};for(const t of od){var e;const s=null===(e=this._instance.sessionPersistence)||void 0===e?void 0:e.get_property(t);R$1(s)||(i[t]=s);}return wi(wi({},i),(null===(t=this.vf)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return !!(null===(e=this.vf)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this.vf)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t);}}},kc={autocapture:class extends mh{constructor(t){super(new Wh(t)),this.instance=t;}},historyAutocapture:class{constructor(t){this.Cf=false,this._instance=t,this.Tf=this.If();}initialize(){this.startIfEnabled();}get isEnabled(){const t=this.Mf();return !!(t.path||t.search||this.Ef(t))}startIfEnabled(){this.isEnabled&&(Us.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges());}startIfEnabledOrStop(){this.stop(),this.Tf=this.If(),this.startIfEnabled();}stop(){this.Pf&&this.Pf(),this.Pf=void 0,this.Rf&&this.Rf(),this.Rf=void 0,Us.info("History API monitoring stopped");}monitorHistoryChanges(){t&&t.history&&(this.Af("pushState"),this.Af("replaceState"),this.Ff(),this.Ef()&&this.Of());}Af(i){var e;if(!t||(null===(e=t.history[i])||void 0===e?void 0:e.__posthog_wrapped__))return;const s=this;Yh(t.history,i,e=>function(n,r,o){var l;s.Df(o)&&s.Lf(),e.call(this,n,r,o),s.Nf(i,!s.Cf&&"popstate"!==(null==t||null===(l=t.event)||void 0===l?void 0:l.type));});}If(){const i=null==t?void 0:t.location;if(null==i?void 0:i.pathname)return {pathname:i.pathname,search:i.search,hash:i.hash}}Mf(){const t=this._instance.config.capture_pageview;return "history_change"===t?{path:true}:P$1(t)?t:{}}Ef(t=this.Mf()){return !!t.hash&&!this._instance.config.disable_capture_url_hashes}qf(t){const i=this.Mf(),e=this.Tf;return !(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Ef(i)&&t.hash!==e.hash))}Nf(t,i=false){try{i||this.Lf();const e=this.If();if(!e)return;if(this.qf(e)){const e=()=>this._instance.capture(Or,{navigation_type:t});i?(this.jf=e,Promise.resolve().then(()=>this.Lf())):e();}this.Tf=e;}catch(i){Us.error(`Error capturing ${t} pageview`,i);}}Df(i){var e,s;return !(F$1(i)||!t)&&(null===(e=Pl(String(i)))||void 0===e?void 0:e.href)!==(null===(s=t.location)||void 0===s?void 0:s.href)}Lf(){const t=this.jf;if(t){this.jf=void 0,this.Cf=true;try{t();}catch(t){Us.error("Error capturing deferred pageview",t);}finally{this.Cf=false;}this.Tf=this.If();}}Ff(){if(this.Pf)return;const i=()=>{this.Nf("popstate");};qr(t,"popstate",i),this.Pf=()=>{t&&t.removeEventListener("popstate",i);};}Of(){if(this.Rf)return;const i=()=>{this.Nf("hashchange");};qr(t,"hashchange",i),this.Rf=()=>{t&&t.removeEventListener("hashchange",i);};}},heatmaps:class{get Ar(){return this.instance.config}constructor(t){var i;this.Bf=false,this.ll=false,this.zf=null,this.instance=t,this.Bf=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[Cn$1]),this.rageclicks=new uh(t.config.rageclick);}initialize(){this.startIfEnabled();}get flushIntervalMilliseconds(){let t=5e3;return P$1(this.Ar.capture_heatmaps)&&this.Ar.capture_heatmaps.flush_interval_milliseconds&&(t=this.Ar.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return F$1(this.Ar.capture_heatmaps)?F$1(this.Ar.enable_heatmaps)?this.Bf:this.Ar.enable_heatmaps:false!==this.Ar.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.ll)return;ld.info("starting..."),this.Hf(),this.sn();}else {var t;clearInterval(null!==(t=this.zf)&&void 0!==t?t:void 0),this.Uf(),this.getAndClearBuffer();}}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("heatmaps"in i))return;const e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Cn$1]:e}),this.Bf=e,this.startIfEnabled();}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Wf(t){ud(t.originalEvent)&&this.Er(t.originalEvent,"deadclick");}sn(){this.zf&&clearInterval(this.zf),this.zf="visible"===(null==s$1?void 0:s$1.visibilityState)?setInterval(this.rc.bind(this),this.flushIntervalMilliseconds):null;}Hf(){t&&s$1&&(this.Vf=this.rc.bind(this),qr(t,Rr,this.Vf),this.Gf=i=>this.Er(i||(null==t?void 0:t.event)),qr(s$1,"click",this.Gf,{capture:true}),this.Qf=i=>this.Zf(i||(null==t?void 0:t.event)),qr(s$1,"mousemove",this.Qf,{capture:true}),this.Jf=new _l(this.instance,fl,this.Wf.bind(this)),this.Jf.startIfEnabledOrStop(),this.Kf=this.sn.bind(this),qr(s$1,hn$1,this.Kf),this.ll=true);}Uf(){var i;t&&s$1&&(this.Vf&&t.removeEventListener(Rr,this.Vf),this.Gf&&s$1.removeEventListener("click",this.Gf,{capture:true}),this.Qf&&s$1.removeEventListener("mousemove",this.Qf,{capture:true}),this.Kf&&s$1.removeEventListener(hn$1,this.Kf),clearTimeout(this.Xf),null===(i=this.Jf)||void 0===i||i.stop(),this.ll=false);}Yf(i,e){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(i,e,s){let n=i;for(;n&&Eo(n)&&!ko(n,"body");){if(n===s)return false;let i;try{var r,o,l;i=null===(r=null!==(o=null===(l=n.ownerDocument)||void 0===l?void 0:l.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(n).position;}catch(t){return false}if(m(e,i))return true;n=jo(n);}return false}(Fo(i),["fixed","sticky"],r);return {x:i.clientX+(o?0:n),y:i.clientY+(o?0:s),target_fixed:o,type:e}}Er(t,i="click"){var e;if(xo(t.target)||!ud(t))return;const s=this.Yf(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Yo(Fo(t),this.instance.config.rageclick)&&this.Qs(wi(wi({},s),{},{type:"rageclick"})),this.Qs(s);}Zf(t){!xo(t.target)&&ud(t)&&(clearTimeout(this.Xf),this.Xf=setTimeout(()=>{this.Qs(this.Yf(t,"mousemove"));},500));}Qs(i){if(!t)return;const e=this.Ar.disable_capture_url_hashes?vi(t.location.href):t.location.href,s=this.Ar.custom_personal_data_properties,n=this.Ar.mask_personal_data_properties?[...Dl,...s||[]]:[],r=Fl(e,n,jl);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(i);}rc(){this.Rt&&!C(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()});}},deadClicksAutocapture:_l,webVitalsAutocapture:class{constructor(i){var e;this._instance=i,this.Bf=false,this.ll=false,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.tp=(t=false)=>{clearTimeout(this.ep),this.ep=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",wi({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>wi(wi({},t),{},{[`$web_vitals_${i.name}_event`]:wi({},i),[`$web_vitals_${i.name}_value`]:i.value}),{})),t?{transport:"sendBeacon",send_instantly:true}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0});},this.np=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},F$1(null==t?void 0:t.name)||F$1(null==t?void 0:t.value))return void Xh.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.sp(e);if(R$1(s))return;const n=M$1(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.rp&&t.value>=this.rp)return void Xh.error("Ignoring metric with value >= "+this.rp,t);this.Rt.navigationKey!==n&&(this.tp(),this.ep=setTimeout(this.tp,this.flushToCaptureTimeoutMs)),R$1(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=R$1(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(true),o=wi(wi(wi({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,P$1(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of ed){const s="url"===e&&"string"==typeof t.attribution[e]?this.sp(t.attribution[e]):t.attribution[e];R$1(s)||(i[e]=s);}o.attribution=i;}else delete o.attribution;R$1(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.tp();},this.op=()=>{if(this.ll)return;let i,e,s,n,r=false;const o=d.__PosthogExtensions__,l=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,u=(null==l?void 0:l[this.ap])||("web-vitals"===this.ap&&R$1(l)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!R$1(u)){const t=u.withoutAttribution,o=this.attributionMetrics;r=!R$1(t),i=o.indexOf("LCP")>-1?u.onLCP:(null==t?void 0:t.onLCP)||u.onLCP,e=o.indexOf("CLS")>-1?u.onCLS:(null==t?void 0:t.onCLS)||u.onCLS,s=o.indexOf("FCP")>-1?u.onFCP:(null==t?void 0:t.onFCP)||u.onFCP,n=o.indexOf("INP")>-1?u.onINP:(null==t?void 0:t.onINP)||u.onINP;}if(!(i&&e&&s&&n))return void Xh.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},h=r&&this.attributionMetrics.indexOf("INP")>-1?wi(wi({},a),{},{includeProcessedEventEntries:false}):a;this.allowedMetrics.indexOf("LCP")>-1&&i(this.np.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&e(this.np.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&s(this.np.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&n(this.np.bind(this),h);const c=null==t?void 0:t.document;qr(c,hn$1,()=>{"hidden"===(null==c?void 0:c.visibilityState)&&this.tp(true);}),qr(t,"pagehide",()=>this.tp(true)),this.ll=true;},this.Bf=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[An$1]),this.startIfEnabled();}get lp(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=P$1(this.lp)?null===(t=this.lp)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return F$1(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||td:e}get flushToCaptureTimeoutMs(){return (P$1(this.lp)?this.lp.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=P$1(this.lp)?this.lp.web_vitals_attribution:void 0;return N$1(t)?t?td:[]:k$1(t)?t:id}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=P$1(this.lp)?this.lp.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get rp(){const t=P$1(this.lp)&&M$1(this.lp.__web_vitals_max_value)?this.lp.__web_vitals_max_value:Qh;return t>0&&6e4>=t?Qh:t}get isEnabled(){const t=null==n?void 0:n.protocol;if("http:"!==t&&"https:"!==t)return Xh.info("Web Vitals are disabled on non-http/https protocols"),false;const i=P$1(this.lp)?this.lp.web_vitals:N$1(this.lp)?this.lp:void 0;return N$1(i)?i:this.Bf}startIfEnabled(){this.isEnabled&&!this.ll&&(Xh.info("enabled, starting..."),this.Ml(this.op));}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=P$1(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=P$1(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[An$1]:e}),this._instance.persistence.register({[Nn]:s})),this.Bf=e,this.startIfEnabled();}get ap(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ml(t){var i;const e=d.__PosthogExtensions__,s=this.ap,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&R$1(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null==e||null===(i=e.loadExternalDependency)||void 0===i||i.call(e,this._instance,s,i=>{i?Xh.error("failed to load script",i):t();});}sp(i){const e=i||(null==t?void 0:t.location.href);if(!e)return void Xh.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?vi(e):e,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Dl,...n||[]]:[];return Fl(s,r,jl)}}},Tc={exceptionObserver:class{constructor(i){var e;this.op=()=>{var i;if(!t||!this.isEnabled||!(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions))return;const e=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.up&&this.Ar.capture_unhandled_errors&&(this.up=e(this.captureException.bind(this))),!this.cp&&this.Ar.capture_unhandled_rejections&&(this.cp=s(this.captureException.bind(this))),!this.hp&&this.Ar.capture_console_errors&&(this.hp=n(this.captureException.bind(this)));}catch(t){Gh.error("failed to start",t),this.dp();}},this._instance=i,this.vp=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[Rn$1]),this.wt=new tt$1(wi(wi({},function(t={}){var i,e,s,n;return {refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=null!==(n=t.exceptionRateLimiterBucketSize)&&void 0!==n?n:t.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Gh})),this.Ar=this.fp(),this.startIfEnabledOrStop();}fp(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:false,capture_unhandled_rejections:false,capture_console_errors:false};return P$1(t)?i=wi(wi({},i),t):(R$1(t)?this.vp:t)&&(i=wi(wi({},i),{},{capture_unhandled_errors:true,capture_unhandled_rejections:true})),i}get isEnabled(){return this.Ar.capture_console_errors||this.Ar.capture_unhandled_errors||this.Ar.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Gh.info("enabled"),this.dp(),this.Ml(this.op)):this.dp();}Ml(t){var i,e,s;(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=d.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"exception-autocapture",i=>{if(i)return Gh.error("failed to load script",i);t();});}dp(){var t,i,e;null===(t=this.up)||void 0===t||t.call(this),this.up=void 0,null===(i=this.cp)||void 0===i||i.call(this),this.cp=void 0,null===(e=this.hp)||void 0===e||e.call(this),this.hp=void 0;}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.vp=!!i.autocaptureExceptions||false,this._instance.persistence&&this._instance.persistence.register({[Rn$1]:this.vp}),this.Ar=this.fp(),this.startIfEnabledOrStop());}onConfigChange(){this.Ar=this.fp();}captureException(t){try{var i,e,s;const n=null!==(i=null==t||null===(e=t.$exception_list)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.type)&&void 0!==i?i:"Exception";if(this.wt.consumeRateLimit(n))return void Gh.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(t);}catch(t){}}},exceptions:class{constructor(t){var i,e;this.pp=[],this.gp=new Pi([new Ji,new re$3,new Zi,new Yi,new se$2,new ee$2,new Qi,new ne$2],function(t,...i){return (e,s=0)=>{const n=[],r=e.split("\n"),o=Math.min(r.length,s+1e3),l=[];for(let e=s;o>e;e++){const s=r[e];if(s.length>1024)continue;const o=Bi.test(s)?s.replace(Bi,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Hi(n);if(t){for(let i=l.length-1;i>=0;i--){const e=l[i];if(t.start>=e.start+e.length)break;l.pop();}l.push(t);}break}}if(Gi(n,l)>=50)break}}const u=[...l].sort((t,i)=>i.start-t.start),a=u[u.length-1];if(a){const t=Vi(n,a);n.splice(a.start-t,t);for(const i of u)i.start-=t;}for(const t of u)qi(n,t);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){const i=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let e=0;for(let t=1;i.length>t;t++)Ki(i,t,e)&&(e=t);t.push(...t.splice(0,e));}(n),function(t){if(!t.length)return [];const i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return wi(wi({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e;})}(n)}}("web:javascript",Ni,Ui)),this._instance=t,this.pp=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.mp=he$1(this.yp()),this.bp=new de$2(this.mp);}onConfigChange(){this.mp=he$1(this.yp()),this.bp.setConfig(this.mp);}onRemoteConfig(t){var i,e,s;if(!t.ok)return;const n=t.config;if(!("errorTracking"in n))return;const r=null!==(i=null===(e=n.errorTracking)||void 0===e?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.pp=r,this._instance.persistence&&this._instance.persistence.register({[On]:this.pp,[In$1]:o});}get _p(){var t;const i=!!this._instance.get_property(In$1),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.gp.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.mp.enabled)try{if(!O$1(t)||0===t.trim().length)return void jd.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:e,droppedKeys:s}=function(t){if(!t)return {sanitizedProperties:{},droppedKeys:[]};const i=[];return {sanitizedProperties:Object.keys(t).reduce((e,s)=>ue$1.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.wp(i));s.length>0&&jd.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.bp.add(wi({[oe$1]:t,[le$1]:(new Date).toISOString()},e));}catch(t){jd.error("Failed to add exception step. Ignoring breadcrumb.",t);}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.kp(i)){if(this.Sp(i))return this.xp("Exception dropped: matched a suppression rule"),void jd.info("Skipping exception capture because a suppression rule matched");if(!this._p&&this.$p(i))return this.xp("Exception dropped: thrown by a browser extension"),void jd.info("Skipping exception capture because it was thrown by an extension");if(!this._p&&this.Cp(i))return this.xp("Exception dropped: thrown by an injected browser script"),void jd.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Tp(i))return this.xp("Exception dropped: thrown by the PostHog SDK"),void jd.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.mp.enabled&&F$1(t.$exception_steps)?this.Ip(t):t,s=function(){if("u">typeof process){var t;const i=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(i)return i}const i=globalThis._posthogReleaseId;return "string"==typeof i&&i.length>0?i:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",sd:!0});return t&&this.bp.clear(),t}catch(t){return Nd(t)||jd.error("Failed to capture exception event. Dropping this exception.",t),void this.bp.clear()}}catch(t){return void(Nd(t)||jd.error("Failed to process exception event. Ignoring this exception.",t))}}Ip(t){try{const i=this.bp.getAttachable();return 0===i.length?t:wi(wi({},t),{},{$exception_steps:i})}catch(i){return jd.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}xp(t){this.mp.enabled&&this.bp.add({[oe$1]:t,[le$1]:(new Date).toISOString()});}wp(t){return P$1(t)?wi({},t):{}}yp(){var t,i;return null!==(t=null===(i=this._instance.config.error_tracking)||void 0===i?void 0:i.exception_steps)&&void 0!==t?t:{}}Sp(t){if(0===t.length)return false;try{const i=t.reduce((t,{type:i,value:e})=>(O$1(i)&&i.length>0&&t.$exception_types.push(i),O$1(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.pp.some(t=>{const e=t.values.map(t=>{const e=Ga$1[t.operator],s=i[t.key];if(!e||!s)return !1;const n=k$1(t.value)?t.value:[t.value];return n.length>0&&e(n,s)});return "OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return jd.warn("Failed to evaluate suppression rules. Capturing the exception.",t),false}}$p(t){const i=t.flatMap(t=>{var i,e;return null!==(i=null===(e=t.stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(({filename:t})=>!!t&&Bd.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(Ld))||t.some(({type:t,value:i})=>"NoResponse"===t||O$1(i)&&Ud.some(({value:t,exact:e})=>e?i===t:i.includes(t)))&&!i.some(({in_app:t,filename:i})=>t&&!(null==i?void 0:i.startsWith(Ld))))}Cp(t){return t.some(({value:t})=>O$1(t)&&zd.some(i=>t.includes(i)))}Tp(t){if(t.length>0){var i,e,s,n;const r=null!==(i=null===(e=t[0].stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return false}kp(t){return !F$1(t)&&k$1(t)}}},Pc=wi({productTours:class{get _c(){return this._instance.persistence}constructor(t){this.Mp=null,this.Ep=null,this._instance=t;}initialize(){this.loadIfEnabled();}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if("productTours"in i){var e,s;if(this._c&&this._c.register({[Mn$1]:!!i.productTours}),!hd(this._instance))return !this.Mp&&F$1(null===(e=this._c)||void 0===e?void 0:e.props.ph_product_tours)||ad.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.Mp)||void 0===s||s.stop(),this.Mp=null,void this.clearCache();this.loadIfEnabled();}}loadIfEnabled(){!this.Mp&&hd(this._instance)&&this.Ml(()=>this.Pp());}Ml(t){var i,e,s;(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=d.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"product-tours",i=>{i?ad.error("Could not load product tours script",i):t();});}Pp(){var t;!this.Mp&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Mp=d.__PosthogExtensions__.generateProductTours(this._instance,true));}getProductTours(t,i=false){if(k$1(this.Ep)&&!i)return void t(this.Ep,{isLoaded:true});const e=this._c;if(e){const s=e.props[Qn];if(k$1(s)&&!i)return this.Ep=s,void t(s,{isLoaded:true})}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(!hd(this._instance))return void t([],{isLoaded:true});const s=i.statusCode;if(200!==s||!i.json){const e=`Product Tours API could not be loaded, status: ${s}`;return 0===s?i.error||ad.warn(e):ad.error(e),void t([],{isLoaded:false,error:e})}const n=k$1(i.json.product_tours)?i.json.product_tours:[];this.Ep=n,e&&e.register({[Qn]:n}),t(n,{isLoaded:true});}});}getActiveProductTours(t){F$1(this.Mp)?t([],{isLoaded:false,error:"Product tours not loaded"}):this.Mp.getActiveProductTours(t);}showProductTour(t){var i;null===(i=this.Mp)||void 0===i||i.showTourById(t);}previewTour(t){this.Mp?this.Mp.previewTour(t):this.Ml(()=>{var i;this.Pp(),null===(i=this.Mp)||void 0===i||i.previewTour(t);});}dismissProductTour(){var t;null===(t=this.Mp)||void 0===t||t.dismissTour("user_clicked_skip");}nextStep(){var t;null===(t=this.Mp)||void 0===t||t.nextStep();}previousStep(){var t;null===(t=this.Mp)||void 0===t||t.previousStep();}clearCache(){var t;this.Ep=null,null===(t=this._c)||void 0===t||t.unregister("ph_product_tours");}resetTour(t){var i;null===(i=this.Mp)||void 0===i||i.resetTour(t);}resetAllTours(){var t;null===(t=this.Mp)||void 0===t||t.resetAllTours();}cancelPendingTour(t){var i;null===(i=this.Mp)||void 0===i||i.cancelPendingTour(t);}}},xc),Cc={siteApps:class{constructor(t){this._instance=t,this.Rp=0,this.Ap=[],this.apps={};}get isEnabled(){return !!this._instance.config.opt_in_site_apps}Fp(t,i){if(!i)return;const e=this.globalsForEvent(i);this.Ap.push(e),this.Ap.length>1e3&&(this.Ap=this.Ap.slice(10));}get siteAppLoaders(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.Fp.bind(this));this.Op=()=>{t(),this.Ap=[],this.Op=void 0;};}}globalsForEvent(t){var i,e,s,n,r,o,l;if(!t)throw new Error("Event payload is required");const u={},a=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,i]of Object.entries(h))u[t]={id:a[t],type:t,properties:i};const{$set_once:d,$set:c}=t;return {event:wi(wi({},ke$1(t,dd)),{},{properties:wi(wi(wi({},t.properties),c?{$set:wi(wi({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),c)}:{}),d?{$set_once:wi(wi({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),d)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}Dp(t){var i;const e=null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase();if("style"===e&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(cd.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===e&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(cd.error("prepare_external_dependency_script returned null"),null)}return t}Lp(){var t,i,e,n,r,o,l,u;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return ()=>{};const a=null==s$1?void 0:s$1.defaultView,h=null==a||null===(t=a.Node)||void 0===t?void 0:t.prototype;if(!a||!h)return ()=>{};if(this.Rp++,this.Np)return this.qp();const d=[],c=this,v=new WeakSet,f=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),d.push(()=>{t[i]=s;});},p=t=>{if(v.has(t))return t;const i=c.Dp(t);return i&&v.add(i),i},_=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!A$1(t));return f(h,"appendChild",t=>function(i){const e=p(i);return e?t.call(this,e):i}),f(h,"insertBefore",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):i}),f(h,"replaceChild",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):e}),[null===(i=a.Element)||void 0===i?void 0:i.prototype,null===(e=a.Document)||void 0===e?void 0:e.prototype,null===(n=a.DocumentFragment)||void 0===n?void 0:n.prototype].forEach(t=>{f(t,"append",t=>function(...i){return t.apply(this,_(i))}),f(t,"prepend",t=>function(...i){return t.apply(this,_(i))});}),[null===(r=a.Element)||void 0===r?void 0:r.prototype,null===(o=a.CharacterData)||void 0===o?void 0:o.prototype,null===(l=a.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...i){return t.apply(this,_(i))}),f(t,"after",t=>function(...i){return t.apply(this,_(i))}),f(t,"replaceWith",t=>function(...i){const e=_(i);return i.length&&!e.length?void 0:t.apply(this,e)});}),f(null===(u=a.Element)||void 0===u?void 0:u.prototype,"insertAdjacentElement",t=>function(i,e){const s=p(e);return s?t.call(this,i,s):null}),this.Np=()=>{d.forEach(t=>t()),this.Np=void 0;},this.qp()}qp(){let t=false;return ()=>{var i;t||(t=true,this.Rp--,0===this.Rp&&(null===(i=this.Np)||void 0===i||i.call(this)));}}jp(t,i=true){const e=this.Lp();try{const s=t(e);return i&&e(),s}catch(t){throw e(),t}}setupSiteApp(t){const i=this.apps[t.id],e=()=>{var e;!i.errored&&this.Ap.length&&(cd.info(`Processing ${this.Ap.length} events for site app with id ${t.id}`),this.Ap.forEach(t=>this.jp(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})),i.processedBuffer=true),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(e=this.Op)||void 0===e||e.call(this));};let s=false;const n=n=>{i.errored=!n,i.loaded=true,cd.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e();};try{const{processEvent:e}=this.jp(i=>t.init({posthog:this._instance,callback(t){i(),n(t);}}),!1);e&&(i.processEvent=e),s=!0;}catch(i){cd.error(vd+t.id,i),n(false);}if(s&&i.loaded)try{e();}catch(e){cd.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=true;}}Bp(){const t=this.siteAppLoaders||[];for(const i of t)this.apps[i.id]={id:i.id,loaded:false,errored:false,processedBuffer:false};for(const i of t)this.setupSiteApp(i);}zp(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.jp(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)});}catch(i){cd.error(`Error while processing event ${t.event} for site app ${e.id}`,i);}}onRemoteConfig(t){var i,e,s;if(null===(i=this.siteAppLoaders)||void 0===i?void 0:i.length)return this.isEnabled?(this.Bp(),void this._instance.on("eventCaptured",t=>this.zp(t))):void cd.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.Op)||void 0===e||e.call(this),!t.ok)return;const n=t.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:t,url:i}of n.siteApps){var r,o;d[`__$$ph_site_app_${t}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return cd.error(vd+t,i)});}else cd.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');}}},Rc={tracingHeaders:class{constructor(t){this._instance=t,this.Hp=void 0,this.Up=void 0,this.Wp=void 0,this.op=()=>{const t=this.Vp();var i,e;t?(R$1(this.Hp)&&(this.Hp=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),R$1(this.Up)&&(this.Up=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.dp();};}initialize(){this.startIfEnabledOrStop();}Ml(t){var i,e,s;(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=d.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"tracing-headers",i=>{if(i)return Zh.error("failed to load script",i);t();});}Gp(){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}Vp(){const t=this.Gp();return k$1(t)?(k$1(this.Wp)?this.Wp.splice(0,this.Wp.length,...t):this.Wp=[...t],t.length>0?this.Wp:void 0):(k$1(this.Wp)&&this.Wp.splice(0),this.Wp=t||void 0,this.Wp)}dp(){var t,i;null===(t=this.Hp)||void 0===t||t.call(this),null===(i=this.Up)||void 0===i||i.call(this),this.Hp=void 0,this.Up=void 0;}startIfEnabledOrStop(){this.Vp()?this.Ml(this.op):this.dp();}}},Oc=wi({surveys:class extends wd{constructor(t){super(new $d(t));}}},xc),Ic={toolbar:class{constructor(t){this.instance=t;}Qp(t){d.ph_toolbar_state=t;}Zp(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i=void 0,e=void 0,n=void 0){var r,o;if(Vr(this.instance.config))return false;if(!t||!s$1)return false;i=null!==(r=i)&&void 0!==r?r:t.location,n=null!==(o=n)&&void 0!==o?o:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test");}catch(t){return !1}e=null==t?void 0:t.localStorage;}const s=Sd||Ml(i.hash,"__posthog")||Ml(i.hash,"state");let r;const o=s?fi(()=>JSON.parse(atob(decodeURIComponent(s))))||fi(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?i.hash=o.desiredHash:n?n.replaceState(n.state,"",i.pathname+i.search):i.hash="")):(r=JSON.parse(e.getItem(xd)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return false}}Jp(t){const i=d.ph_load_toolbar||d.ph_load_editor;!F$1(i)&&T$1(i)?i(t,this.instance):Ed.warn("No toolbar load function found");}loadToolbar(i){const e=!!(null==s$1?void 0:s$1.getElementById("__POSTHOG_TOOLBAR__"));if(!t||e)return false;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=wi(wi({token:this.instance.config.token},i),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:false}:{});if(t.localStorage.setItem(xd,JSON.stringify(wi(wi({},r),{},{source:void 0}))),2===this.Zp())this.Jp(r);else if(0===this.Zp()){var o,l;this.Qp(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(l=o.loadExternalDependency)||void 0===l||l.call(o,this.instance,"toolbar",t=>{if(t)return Ed.error("[Toolbar] Failed to load",t),void this.Qp(0);this.Qp(2),this.Jp(r);}),qr(t,"turbolinks:load",()=>{this.Qp(0),this.loadToolbar(r);});}return true}Kp(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}}},Ac=wi({experiments:class i{get Ar(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=false)=>{this.getWebExperiments(t=>{i.Xp("retrieved web experiments from the server"),this.Yp=new Map,t.forEach(t=>{if(t.feature_flag_key){var e;this.Yp&&(i.Xp("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(e=this.Yp)||void 0===e||e.set(t.feature_flag_key,t));const s=this._instance.getFeatureFlag(t.feature_flag_key);O$1(s)&&t.variants[s]&&this.tg(t.name,s,t.variants[s].transforms);}else if(t.variants)for(const e in t.variants){const s=t.variants[e];i.eg(s,this._instance)&&this.tg(t.name,e,s.transforms);}});},t);},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t);});}initialize(){}onFeatureFlags(t){if(this._is_bot())i.Xp(Hd);else if(!this.Ar.disable_web_experiments){if(F$1(this.Yp))return this.Yp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();i.Xp("applying feature flags",t),t.forEach(t=>{var i;if(this.Yp&&(null===(i=this.Yp)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.Yp)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.tg(s.name,i,s.variants[i].transforms);}});}}previewWebExperiment(){const t=i.getWindowLocation();if(null==t?void 0:t.search){const e=Al(null==t?void 0:t.search,"__experiment_id"),s=Al(null==t?void 0:t.search,"__experiment_variant");e&&s&&(i.Xp(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.ig(parseInt(e),s,t);},false,true));}}loadIfEnabled(){this.Ar.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic();}getWebExperiments(t,i,e){if(this.Ar.disable_web_experiments&&!e)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ar.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])});}ig(t,e,s){const n=s.filter(i=>i.id===t);n&&n.length>0&&(i.Xp(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.tg(n[0].name,e,n[0].variants[e].transforms));}static eg(t,e){return !F$1(t.conditions)&&i.ng(t,e)&&i.sg(t)}static ng(t,e){var s;if(F$1(t.conditions)||F$1(null===(s=t.conditions)||void 0===s?void 0:s.url))return true;const n=i.getWindowLocation();if(n){var r,o,l;const i=So(e,n.href);return !(null===(r=t.conditions)||void 0===r?void 0:r.url)||qd[null!==(o=null===(l=t.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,i)}return false}static getWindowLocation(){return null==t?void 0:t.location}static sg(t){var i;if(F$1(t.conditions)||F$1(null===(i=t.conditions)||void 0===i?void 0:i.utm))return true;const e=Ul();if(e.utm_source){var s,n,r,o,l,u,a,h;const i=!(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==e.utm_campaign,d=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==e.utm_source,c=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_medium)==e.utm_medium,v=!(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==e.utm_term;return i&&c&&v&&d}return false}static Xp(t,...i){Us.info(`[WebExperiments] ${t}`,i);}tg(t,e,s){this._is_bot()?i.Xp(Hd):"control"!==e?s.forEach(s=>{if(s.selector){var n;i.Xp(`applying transform of variant ${e} for experiment ${t} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);null==r||r.forEach(t=>{const i=t;s.html&&(i.innerHTML=s.html),s.css&&i.setAttribute("style",s.css);});}}):i.Xp("Control variants leave the page unmodified.");}_is_bot(){return e$1&&this._instance?Ba$1(e$1,this.Ar.custom_blocked_useragents):void 0}}},xc),Fc={conversations:class{constructor(t){this._instance=t,this.rg=void 0,this._conversationsManager=null,this.og=false,this.ne=null,this.ag=false,this.lg=0,this.ug=null;}initialize(){this.loadIfEnabled();}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.ug=null);if(this.cg=t.ok,!t.ok)return;const i=t.config.conversations;F$1(i)?this.ug=null:(N$1(i)?this.rg=i:(this.rg=i.enabled,this.ne=i),this.rg||(this.ug=null),this.loadIfEnabled());}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.lg++,this.rg=void 0,this.ne=null,this.cg=void 0,this.ag=false,this.ug=null;}loadIfEnabled(){if(this._conversationsManager)return;if(this.og)return;if(this._instance.config.disable_conversations)return;if(Vr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==d?void 0:d.__PosthogExtensions__;if(t&&!R$1(this.rg)&&this.rg)if(this.ne&&this.ne.token){this.og=true;try{const i=t.initConversations;if(i)return this.hg(i),void(this.og=!1);const e=t.loadExternalDependency;if(!e)return void this.dg(fn$1);const s=this.lg;e(this._instance,"conversations",i=>{if(s!==this.lg)return this.og=!1,void this.loadIfEnabled();i||!t.initConversations?this.dg("Could not load conversations script",i):this.hg(t.initConversations),this.og=!1;});}catch(t){this.dg("Error initializing conversations",t),this.og=false;}}else Vd.error("Conversations enabled but missing token in remote config.");}hg(t){if(this.ne){try{this._conversationsManager=t(this.ne,this._instance),this.ag=!1,Vd.info("Conversations loaded successfully");}catch(t){return void this.dg("Error completing conversations initialization",t)}this.vg();}else Vd.error("Cannot complete initialization: remote config is null");}vg(){const t=this.ug;this.ug=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close());}dg(t,i){Vd.error(t,i),this._conversationsManager=null,this.og=false,this.ag=true;}show(){this._conversationsManager?this._conversationsManager.show():Vd.warn("Conversations not loaded yet.");}hide(){"open"===this.ug&&(this.ug=null),this._conversationsManager&&this._conversationsManager.hide();}open(){this._conversationsManager?(this.ug=null,this._conversationsManager.open()):this.ug="open";}close(){this._conversationsManager?(this.ug=null,this._conversationsManager.close()):this.ug="close";}isAvailable(){return true===this.rg&&!A$1(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Vr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":false===this.cg?"remote_config_failed":R$1(this.rg)?this.cg?"disabled_in_project":"remote_config_pending":this.rg?F$1(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.og?"initializing":this.ag?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var s=this;return J$1(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(Vd.warn(Wd),null)})()}getMessages(t,i){var e=this;return J$1(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Vd.warn(Wd),null)})()}markAsRead(t){var i=this;return J$1(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Vd.warn(Wd),null)})()}getTickets(t){var i=this;return J$1(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Vd.warn(Wd),null)})()}requestRestoreLink(t){var i=this;return J$1(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Vd.warn(Wd),null)})()}restoreFromToken(t){var i=this;return J$1(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Vd.warn(Wd),null)})()}restoreFromUrlToken(){var t=this;return J$1(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Vd.warn(Wd),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}fd(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity();}pd(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity();}}},Mc={logs:class extends tc{constructor(t){super({get(){var i;return null==t||null===(i=t.config)||void 0===i?void 0:i.logs},captureHintKey:Dn$1,get remoteConfigWillArrive(){var i,e;return !(null===(i=t.Qu)||void 0===i?void 0:i.call(t))||!!(null===(e=d._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[t.config.token])||void 0===e?void 0:e.config)}},()=>function(t){var i;const e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(true);e.sessionId=i,e.windowId=s,F$1(n)||(e.sessionStartTimestamp=n),F$1(r)||(e.lastActivityTimestamp=r);}if((null==d||null===(i=d.location)||void 0===i?void 0:i.href)&&(e.currentUrl=t.config.disable_capture_url_hashes?vi(d.location.href):d.location.href),t.featureFlags){const i=t.featureFlags.getFlags();i&&i.length>0&&(e.activeFeatureFlags=i);}return e}(t)),this._instance=t,this.name=bh,this.Uv();}get zv(){return this._instance.__loaded}Hv(){const t=Bs("[logs]"),i=null==d?void 0:d.__PosthogExtensions__;if(!i)return void t.error("PostHog Extensions not found.");const e=i.loadExternalDependency;if(e)return t=>{e(this._instance,"logs",e=>{const s=i.logs;t(e,(null==s?void 0:s.initializeLogs)?{initialize:t=>s.initializeLogs(t),replay(t,i){var e;return null===(e=s.replayConsoleBuffer)||void 0===e?void 0:e.call(s,t,i)}}:void 0);});};t.error(fn$1);}}},Dc={metrics:class{constructor(t){this._instance=t,this.$=Bs("[metrics]"),this.Ci=false;}initialize(){this.onConfigChange();}onConfigChange(){var t;if(this.Ci)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.fg?this.fg=(t=>{let i=true;const e=()=>i?(t=>{var i;const e=null===(i=t.config.metrics)||void 0===i?void 0:i.network;return true===e?{}:e||void 0})(t):void 0,s=uc(t,e),n=ac(t,e);return ()=>{i=false,s(),n();}})(this._instance):!i&&this.fg&&(this.fg(),this.fg=void 0);}Gv(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var e;return this.jv&&this.Qv===i||(null===(e=this.jv)||void 0===e||e.reset(),this.Qv=i,this.jv=new Ns(this.Vv(),function(t){var i,e,s,n,r;const 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!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(i),this.$)),this.jv}count(t,i=1,e){this.Gv().count(t,i,e);}gauge(t,i,e){this.Gv().gauge(t,i,e);}histogram(t,i,e){this.Gv().histogram(t,i,e);}flush(t){if(!this.jv)return Promise.resolve();if(t){const i=this.jv.drainWindow();return i&&this.po(i,t),Promise.resolve()}return this.jv.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.jv)||void 0===t||t.reset();}dispose(){var t,i;this.Ci=true,null===(t=this.fg)||void 0===t||t.call(this),this.fg=void 0,null===(i=this.jv)||void 0===i||i.reset();}Vv(){const t=this._instance,i=this;return {get isDisabled(){return false},get optedOut(){return !t.is_capturing()},po:t=>i.po(t),getLibraryId:()=>Gs.LIB_NAME,getLibraryVersion:()=>Gs.LIB_VERSION}}po(t,i){return new Promise(e=>{let s=false;const n=t=>{s||(s=true,clearTimeout(r),e(t));},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(wi(wi({method:"POST",url:this.pg(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),{},{fireCallbackOnDrop:true,callback(t){const i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error(`metrics request failed with status ${i}`)});else {var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`metrics request failed with status ${i}`)});}}}));})}pg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Nc={webMCP:class{constructor(t){this._instance=t,this.gg=false;}initialize(){this.startIfEnabled();}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.gg)return;const t=null==s$1?void 0:s$1.modelContext;if(!t||!T$1(t.registerTool))return;const i=hc.get(t);if(i)return i.instances.add(this._instance),void(this.gg=true);const e={instances:new Set([this._instance])},n=t.registerTool,r=this;Yh(t,"registerTool",t=>{const i=t;return function(t,...s){let n=t;try{n=r.mg(t,e);}catch(e){return i.call(this,t,...s)}return i.call(this,n,...s)}}),t.registerTool!==n&&(hc.set(t,e),this.gg=true);}mg(t,i){if(!t||!T$1(t.execute))return t;const e=t.execute,s=this,{tool:n,injected:r}=function(t,i){const e={intent:false,model:false},s=t.inputSchema;if(!function(t){return !!R$1(t)||P$1(t)&&Object.keys(t).every(t=>dc.has(t)||t.startsWith("x-"))&&true!==t.additionalProperties&&!P$1(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||P$1(t.properties))&&(!t.required||k$1(t.required))}(s))return {tool:_c(t),injected:e};const n=(null==s?void 0:s.properties)||{},r=t=>pc(n,t)||k$1(null==s?void 0:s.required)&&s.required.includes(t);if(e.intent=i.intent&&!r("context"),e.model=i.model&&!r("llm_model"),!e.intent&&!e.model)return {tool:_c(t),injected:e};const o=wi({},n),l=k$1(null==s?void 0:s.required)?[...s.required]:[];return e.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),e.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},l.includes("llm_model")||l.push("llm_model")),{tool:_c(t,wi(wi({},s),{},{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:e}}(t,function(t){const i={intent:false,model:false};for(const e of t.instances){const t=fc(e.config.capture_webmcp);i.intent||(i.intent=true===(null==t?void 0:t.intent)),i.model||(i.model=true===(null==t?void 0:t.model));}return i}(i));return Object.defineProperty(n,"execute",{configurable:true,enumerable:true,writable:true,value(...o){const l=new Date,u=function(t,i){if(!P$1(t))return {};try{const e=i.intent?gc(t.context,2048,!0):void 0,s=i.model?gc(t.llm_model,256):void 0;return wi(wi({},e&&"{}"!==e?{intent:e}:{}),s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return {}}}(o[0],r),a=function(t,i){const e=t[0];if(!P$1(e))return t;try{const s=i.intent&&pc(e,"context"),n=i.model&&pc(e,"llm_model");if(!s&&!n)return t;const r=wi({},e);return s&&delete r.context,n&&delete r.llm_model,[r,...t.slice(1)]}catch(i){return t}}(o,r);let h;try{h=e.apply(this===n?t:this,a);}catch(t){throw s.yg(i,n,l,{error:t,errorResult:false},u),t}if((d=h)&&"function"==typeof d.then)return Promise.resolve(h).then(t=>{const e=mc(t)?{error:t,errorResult:true}:void 0;return s.yg(i,n,l,e,u),t},t=>{throw s.yg(i,n,l,{error:t,errorResult:false},u),t});var d;const c=mc(h)?{error:h,errorResult:true}:void 0;return s.yg(i,n,l,c,u),h}}),n}yg(t,i,e,s,r){const o=Date.now()-e.getTime();let l;for(const a of t.instances){var u;const t=fc(a.config.capture_webmcp);if(t){s&&!l&&(l=Sc(s.error,s.errorResult));try{a.capture("$mcp_tool_call",wi(wi(wi({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==n?void 0:n.hostname,$mcp_duration_ms:o,$mcp_is_error:!!s},l?{$mcp_error_type:l.type,$mcp_error_message:l.message}:{}),t.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:e});}catch(t){continue}if(s&&l&&a.exceptions&&(null===(u=a.exceptionObserver)||void 0===u?void 0:u.isEnabled))try{const t={$exception_list:wc(a.exceptions,s,l.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==n?void 0:n.hostname};a.exceptionObserver.captureException(t);}catch(t){}}}}}};qh.__defaultExtensionClasses=wi({},wi(wi(wi(wi(wi(wi(wi(wi(wi(wi(wi(wi(wi(wi({},xc),Ec),kc),Tc),Pc),Cc),Oc),Rc),Ic),Ac),Fc),Mc),Dc),Nc));const jc=function(){Gs.SDK_DIST_CHANNEL="npm";const i=Sh[Nh]=new qh;return function(){function i(){i.done||(i.done=true,Pa$1=false,Dr(Sh,function(t){t._dom_loaded();}));}(null==s$1?void 0:s$1.addEventListener)?"complete"===s$1.readyState?i():qr(s$1,"DOMContentLoaded",i,{capture:false}):t&&Us.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized");}(),i}();var Lc=jc;
|
|
12027
|
+
|
|
12028
|
+
var __extends = (undefined && undefined.__extends) || (function () {
|
|
12029
|
+
var extendStatics = function (d, b) {
|
|
12030
|
+
extendStatics = Object.setPrototypeOf ||
|
|
12031
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
12032
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
12033
|
+
return extendStatics(d, b);
|
|
12034
|
+
};
|
|
12035
|
+
return function (d, b) {
|
|
12036
|
+
if (typeof b !== "function" && b !== null)
|
|
12037
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12038
|
+
extendStatics(d, b);
|
|
12039
|
+
function __() { this.constructor = d; }
|
|
12040
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12041
|
+
};
|
|
12042
|
+
})();
|
|
12043
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
12044
|
+
__assign = Object.assign || function(t) {
|
|
12045
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
12046
|
+
s = arguments[i];
|
|
12047
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12048
|
+
t[p] = s[p];
|
|
12049
|
+
}
|
|
12050
|
+
return t;
|
|
12051
|
+
};
|
|
12052
|
+
return __assign.apply(this, arguments);
|
|
12053
|
+
};
|
|
12054
|
+
var __setFunctionName = (undefined && undefined.__setFunctionName) || function (f, name, prefix) {
|
|
12055
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
12056
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
12057
|
+
};
|
|
12058
|
+
(undefined && undefined.__rest) || function (s, e) {
|
|
12059
|
+
var t = {};
|
|
12060
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
12061
|
+
t[p] = s[p];
|
|
12062
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
12063
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
12064
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
12065
|
+
t[p[i]] = s[p[i]];
|
|
12066
|
+
}
|
|
12067
|
+
return t;
|
|
12068
|
+
};
|
|
12069
|
+
var _a$2;
|
|
12070
|
+
var GLOBAL_KEY = "__POSTHOG_REACT_SHARED_STATE__";
|
|
12071
|
+
var globalObject = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : {};
|
|
12072
|
+
var statesByReact;
|
|
12073
|
+
try {
|
|
12074
|
+
statesByReact = globalObject[GLOBAL_KEY] = globalObject[GLOBAL_KEY] || new WeakMap();
|
|
12075
|
+
}
|
|
12076
|
+
catch (_b) {
|
|
12077
|
+
statesByReact = new WeakMap();
|
|
12078
|
+
}
|
|
12079
|
+
if (!statesByReact.has(React.createContext))
|
|
12080
|
+
statesByReact.set(React.createContext, {});
|
|
12081
|
+
var sharedState = statesByReact.get(React.createContext);
|
|
12028
12082
|
var defaultPostHogInstance;
|
|
12029
12083
|
function setDefaultPostHogInstance(instance) {
|
|
12084
|
+
if (!sharedState.defaultPostHogInstance || sharedState.defaultPostHogInstance === defaultPostHogInstance)
|
|
12085
|
+
sharedState.defaultPostHogInstance = instance;
|
|
12030
12086
|
defaultPostHogInstance = instance;
|
|
12031
12087
|
}
|
|
12032
12088
|
function getDefaultPostHogInstance() {
|
|
12033
12089
|
return defaultPostHogInstance;
|
|
12034
12090
|
}
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
});
|
|
12042
|
-
|
|
12091
|
+
if (!sharedState.context)
|
|
12092
|
+
sharedState.context = React.createContext({
|
|
12093
|
+
get client() {
|
|
12094
|
+
return getDefaultPostHogInstance() || sharedState.defaultPostHogInstance;
|
|
12095
|
+
},
|
|
12096
|
+
bootstrap: void 0
|
|
12097
|
+
});
|
|
12098
|
+
var PostHogContext = sharedState.context;
|
|
12043
12099
|
var isFunction = function (f) {
|
|
12044
|
-
return typeof f ===
|
|
12100
|
+
return typeof f === "function";
|
|
12101
|
+
};
|
|
12102
|
+
var isUndefined = function (x) {
|
|
12103
|
+
return x === void 0;
|
|
12045
12104
|
};
|
|
12046
|
-
|
|
12047
12105
|
function useFeatureFlagVariantKey(flag) {
|
|
12048
|
-
var
|
|
12049
|
-
var
|
|
12050
|
-
var
|
|
12051
|
-
return client.getFeatureFlag(flag);
|
|
12052
|
-
}), featureFlagVariantKey = _c[0], setFeatureFlagVariantKey = _c[1];
|
|
12106
|
+
var _b;
|
|
12107
|
+
var _c = React.useContext(PostHogContext), client = _c.client, bootstrap = _c.bootstrap;
|
|
12108
|
+
var _d = React.useState(function () { return client.getFeatureFlag(flag); }), featureFlagVariantKey = _d[0], setFeatureFlagVariantKey = _d[1];
|
|
12053
12109
|
React.useEffect(function () {
|
|
12054
12110
|
return client.onFeatureFlags(function () {
|
|
12055
12111
|
setFeatureFlagVariantKey(client.getFeatureFlag(flag));
|
|
12056
12112
|
});
|
|
12057
12113
|
}, [client, flag]);
|
|
12058
|
-
if (!((
|
|
12114
|
+
if (!((_b = client === null || client === void 0 ? void 0 : client.featureFlags) === null || _b === void 0 ? void 0 : _b.hasLoadedFlags) && (bootstrap === null || bootstrap === void 0 ? void 0 : bootstrap.featureFlags))
|
|
12059
12115
|
return bootstrap.featureFlags[flag];
|
|
12060
|
-
}
|
|
12061
12116
|
return featureFlagVariantKey;
|
|
12062
12117
|
}
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
var
|
|
12081
|
-
|
|
12082
|
-
(
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12118
|
+
var isError = function (value) {
|
|
12119
|
+
var tag = Object.prototype.toString.call(value);
|
|
12120
|
+
return value instanceof Error || tag === "[object Error]" || tag === "[object Exception]" || tag === "[object DOMException]" || tag === "[object DOMError]";
|
|
12121
|
+
};
|
|
12122
|
+
var defineErrorName = function (error, name) {
|
|
12123
|
+
try {
|
|
12124
|
+
Object.defineProperty(error, "name", {
|
|
12125
|
+
value: name,
|
|
12126
|
+
writable: true,
|
|
12127
|
+
enumerable: true,
|
|
12128
|
+
configurable: true
|
|
12129
|
+
});
|
|
12130
|
+
}
|
|
12131
|
+
catch (_b) { }
|
|
12132
|
+
};
|
|
12133
|
+
var setCause = function (error, cause) {
|
|
12134
|
+
var seenErrors = new WeakSet();
|
|
12135
|
+
var currentError = error;
|
|
12136
|
+
while (!seenErrors.has(currentError)) {
|
|
12137
|
+
seenErrors.add(currentError);
|
|
12138
|
+
if (!isError(currentError.cause)) {
|
|
12139
|
+
if (!isUndefined(currentError.cause))
|
|
12140
|
+
cause.cause = currentError.cause;
|
|
12141
|
+
currentError.cause = cause;
|
|
12142
|
+
return;
|
|
12143
|
+
}
|
|
12144
|
+
currentError = currentError.cause;
|
|
12145
|
+
}
|
|
12146
|
+
};
|
|
12147
|
+
var addReactComponentStack = function (error, componentStack) {
|
|
12148
|
+
if (!componentStack)
|
|
12149
|
+
return error;
|
|
12150
|
+
var componentStackError = new Error(isError(error) ? error.message : "Primitive value captured as exception: ".concat(String(error)));
|
|
12151
|
+
defineErrorName(componentStackError, "React ErrorBoundary ".concat(isError(error) ? error.name : "Error"));
|
|
12152
|
+
componentStackError.stack = componentStack;
|
|
12153
|
+
if (isError(error)) {
|
|
12154
|
+
setCause(error, componentStackError);
|
|
12155
|
+
return error;
|
|
12156
|
+
}
|
|
12157
|
+
return componentStackError;
|
|
12098
12158
|
};
|
|
12099
|
-
|
|
12100
12159
|
var INITIAL_STATE = {
|
|
12101
12160
|
componentStack: null,
|
|
12102
12161
|
exceptionEvent: null,
|
|
12103
|
-
error: null
|
|
12104
|
-
};
|
|
12105
|
-
var __POSTHOG_ERROR_MESSAGES = {
|
|
12106
|
-
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
}
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
}
|
|
12139
|
-
var element = isFunction(fallback)
|
|
12140
|
-
? React.createElement(fallback, {
|
|
12162
|
+
error: null
|
|
12163
|
+
};
|
|
12164
|
+
var __POSTHOG_ERROR_MESSAGES = { INVALID_FALLBACK: "[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element." };
|
|
12165
|
+
(_a$2 = (function (_super) {
|
|
12166
|
+
__extends(class_1, _super);
|
|
12167
|
+
function class_1(props) {
|
|
12168
|
+
var _this = _super.call(this, props) || this;
|
|
12169
|
+
_this._resetError = function () {
|
|
12170
|
+
_this.setState(INITIAL_STATE);
|
|
12171
|
+
};
|
|
12172
|
+
_this.state = INITIAL_STATE;
|
|
12173
|
+
return _this;
|
|
12174
|
+
}
|
|
12175
|
+
class_1.prototype.componentDidCatch = function (error, errorInfo) {
|
|
12176
|
+
var additionalProperties = this.props.additionalProperties;
|
|
12177
|
+
var currentProperties;
|
|
12178
|
+
if (isFunction(additionalProperties))
|
|
12179
|
+
currentProperties = additionalProperties(error, errorInfo);
|
|
12180
|
+
else if (typeof additionalProperties === "object")
|
|
12181
|
+
currentProperties = additionalProperties;
|
|
12182
|
+
var client = this.context.client;
|
|
12183
|
+
var componentStack = errorInfo.componentStack;
|
|
12184
|
+
var exceptionEvent = client.captureException(addReactComponentStack(error, componentStack), currentProperties);
|
|
12185
|
+
this.setState({
|
|
12186
|
+
error: error,
|
|
12187
|
+
componentStack: componentStack !== null && componentStack !== void 0 ? componentStack : null,
|
|
12188
|
+
exceptionEvent: exceptionEvent
|
|
12189
|
+
});
|
|
12190
|
+
};
|
|
12191
|
+
class_1.prototype.render = function () {
|
|
12192
|
+
var _b = this.props, children = _b.children, fallback = _b.fallback;
|
|
12193
|
+
var state = this.state;
|
|
12194
|
+
if (state.componentStack == null)
|
|
12195
|
+
return isFunction(children) ? children() : children;
|
|
12196
|
+
var element = isFunction(fallback) ? React.createElement(fallback, {
|
|
12141
12197
|
error: state.error,
|
|
12142
12198
|
componentStack: state.componentStack,
|
|
12143
12199
|
exceptionEvent: state.exceptionEvent,
|
|
12144
|
-
|
|
12145
|
-
: fallback;
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12200
|
+
resetError: this._resetError
|
|
12201
|
+
}) : fallback;
|
|
12202
|
+
if (React.isValidElement(element))
|
|
12203
|
+
return element;
|
|
12204
|
+
console.warn(__POSTHOG_ERROR_MESSAGES.INVALID_FALLBACK);
|
|
12205
|
+
return React.createElement(React.Fragment, null);
|
|
12206
|
+
};
|
|
12207
|
+
return class_1;
|
|
12208
|
+
}(React.Component)),
|
|
12209
|
+
__setFunctionName(_a$2, "PostHogErrorBoundary"),
|
|
12210
|
+
(function () {
|
|
12211
|
+
_a$2.contextType = PostHogContext;
|
|
12212
|
+
})(),
|
|
12213
|
+
_a$2);
|
|
12214
|
+
setDefaultPostHogInstance(Lc);
|
|
12157
12215
|
|
|
12158
12216
|
/** Nav item `action` of the Automations entry in the management submenu. */
|
|
12159
12217
|
const AUTOMATIONS_NAV_ACTION = 'automations';
|