PageSourceSearch

https://app.8figures.com/chunk-3HN5QTDM.js

js 8figures.com collected 2026-10-02 10:14:22 UTC 218,884 bytes, 4 lines download raw bytes

1import{c as Ys,f as Js,o as Xs}from"./chunk-CSNJOHYL.js";import{c as en}from"./chunk-UTRZTJIB.js";import{b as Zs,c as Qs,g as Ks}from"./chunk-FG5FK2MT.js";import{C as Ae,T as ye,Y as G,c as Ws,fa as Gs,i as te,ka as zs,n as $,s as zi}from"./chunk-ETJYMCWV.js";import{a as de,b as oi,d as Oe}from"./chunk-M6FDUCGJ.js";import{a as J,b as me,c as Vs,f as p}from"./chunk-SE5JAREP.js";var xe=(function(r){return r.qa="qa",r.qaLocal="qa-local",r.prod="prod",r.dev="dev",r.intg="intg",r.docker="docker",r})(xe||{}),tn=Object.freeze({[xe.dev]:"Development",[xe.qa]:"Staging",[xe.qaLocal]:"Staging",[xe.intg]:"Integration",[xe.prod]:"Production",[xe.docker]:"Docker"}),Yi=(function(r){return r.qa="https://qa-app.dev.8figures.com",r.dev="https://localhost:4200",r.intg="https://intg-app.dev.8figures.com",r.prod="https://app.8figures.com",r.docker="http://localhost:4200",r})(Yi||{}),rn="16";var ze={name:xe.prod,production:!0,edlTimeout:3600,edlTimeoutNative:600,edlAppSwitchTimeout:3600,edlAppSwitchTimeoutNative:30,config_url:"/assets/config.json",app_domain:Yi.prod,maxLoginPinAttempts:3,web_enable_signup:!0,web_enable_login:!0,firebaseConfig:{apiKey:"AIzaSyC8_1igU54dJwjeDg8fUNXYS8vIZXEmqfo",authDomain:"x8figures.firebaseapp.com",projectId:"x8figures",storageBucket:"x8figures.firebasestorage.app",messagingSenderId:"1073830261472",appId:"1:1073830261472:web:c51cc2f537c6fa72669685",measurementId:"G-M08DR0MGFD"},versionCheckInterval:1800,configCheckInterval:600,capawesomeChannel:`production-${rn}`,liveUpdate:{checkOnResume:!0,promptUser:!1,minCheckIntervalMs:3e5,resumeDebounceMs:3e3,syncTimeoutMs:12e3,failureBackoffMs:36e4,blockOnWelcome:!0,welcomeCheckTimeoutMs:5e3,autoApplyOnSafeScreen:!0},posthog:{enabled:!0,apiKey:"phc_GvHVUcMADb7BApPtJuajwnIqxXIdZzjPQ2JNss3mvt8"},metaPixelId:"1160105669461318"};var Ji=(function(r){return r[r.Password=0]="Password",r[r.Pin=1]="Pin",r[r.Biometric=2]="Biometric",r[r.Google=3]="Google",r[r.RefreshToken=4]="RefreshToken",r[r.Apple=5]="Apple",r[r.GhostUser=6]="GhostUser",r})(Ji||{}),vo=(function(r){return r[r.Asset=0]="Asset",r[r.Liability=1]="Liability",r})(vo||{});var ae=(function(r){return r[r.Other=-1]="Other",r[r.Cash=0]="Cash",r[r.Crypto=1]="Crypto",r[r.Bonds=2]="Bonds",r[r.Stocks=3]="Stocks",r[r.ETF=33]="ETF",r[r.RealEstate=4]="RealEstate",r[r.Startups=5]="Startups",r[r.Receivables=6]="Receivables",r[r.Vehicle=7]="Vehicle",r[r.Retirement=8]="Retirement",r[r.Funds=9]="Funds",r[r.Savings=10]="Savings",r[r.Brokerage=998]="Brokerage",r[r.OtherAssets=999]="OtherAssets",r[r.Mortgages=1e3]="Mortgages",r[r.Loans=1001]="Loans",r[r.Taxes=1003]="Taxes",r[r.Charity=1004]="Charity",r[r.CreditCard=1005]="CreditCard",r[r.OtherLiabilities=9999]="OtherLiabilities",r})(ae||{}),_o=(function(r){return r[r.error_internal=-2]="error_internal",r[r.ok=0]="ok",r[r.error_external=1e3]="error_external",r[r.missingEmail=1001]="missingEmail",r[r.missingUsername=1002]="missingUsername",r[r.userAlreadyExists=1003]="userAlreadyExists",r[r.internalError=1004]="internalError",r[r.missingUid=1005]="missingUid",r[r.badUid=1006]="badUid",r[r.userFailedToActivate=1007]="userFailedToActivate",r[r.userFailedToRegister=1008]="userFailedToRegister",r[r.userFailedToAuthenticate=1009]="userFailedToAuthenticate",r[r.badUsername=1010]="badUsername",r[r.okFailedToSendEmail=1011]="okFailedToSendEmail",r[r.userDoesNotHaveRole=1012]="userDoesNotHaveRole",r[r.notActivated=1013]="notActivated",r[r.noAccess=1014]="noAccess",r[r.notFound=1015]="notFound",r[r.readOnly=1016]="readOnly",r[r.referentialError=1017]="referentialError",r[r.uidExpired=1018]="uidExpired",r[r.aggregatorNotFoundOrDisabled=1019]="aggregatorNotFoundOrDisabled",r[r.notAllAccountsDataCollected=1020]="notAllAccountsDataCollected",r[r.periodNotValid=1021]="periodNotValid",r[r.netWorthDataPointNotManual=1022]="netWorthDataPointNotManual",r[r.userSubscriptionFreeDaysExpired=1029]="userSubscriptionFreeDaysExpired",r[r.maxAllowAmountError=1038]="maxAllowAmountError",r[r.accountSyncPending=1040]="accountSyncPending",r})(_o||{}),mo=(function(r){return r[r.Stock=1]="Stock",r[r.ETF=2]="ETF",r})(mo||{}
vendor: 173,146 bytes, lines 1-4
1),nc=[ae.Mortgages,ae.Loans,ae.Taxes,ae.Charity,ae.CreditCard,ae.OtherLiabilities],ac=[ae.Startups,ae.Bonds,ae.Stocks,ae.Crypto,ae.Funds,ae.RealEstate,ae.OtherAssets];var Xi={version:"2.4.21",hash:"51cfc7d",updateType:0};var li=Xi.version,uc=Xi.hash;var d=typeof window<"u"?window:void 0,Q=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(Q.self=Q),typeof File>"u"&&(Q.File=function(){});var Kn=Array.prototype,sn=Kn.forEach,nn=Kn.indexOf,ge=Q?.navigator,y=Q?.document,le=Q?.location,gr=Q?.fetch,fr=Q!=null&&Q.XMLHttpRequest&&"withCredentials"in new Q.XMLHttpRequest?Q.XMLHttpRequest:void 0,an=Q?.AbortController,oe=ge?.userAgent,S=d??{},Le={DEBUG:!1,LIB_VERSION:"1.338.0"};function on(r,e,t,i,s,n,a){try{var o=r[n](a),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(i,s)}function _t(r){return function(){var e=this,t=arguments;return new Promise(function(i,s){var n=r.apply(e,t);function a(l){on(n,i,s,a,o,"next",l)}function o(l){on(n,i,s,a,o,"throw",l)}a(void 0)})}}function E(){return E=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},E.apply(null,arguments)}function ea(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}var bo=["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"],ln=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return bo.concat(e).some(i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1})},wo=["$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"];function R(r,e){return r.indexOf(e)!==-1}var Ni=function(r){return r.trim()},vr=function(r){return r.replace(/^\$/,"")},Eo=Array.isArray,ta=Object.prototype,ia=ta.hasOwnProperty,Ui=ta.toString,F=Eo||function(r){return Ui.call(r)==="[object Array]"},Ke=r=>typeof r=="function",z=r=>r===Object(r)&&!F(r),mt=r=>{if(z(r)){for(var e in r)if(ia.call(r,e))return!1;return!0}return!1},b=r=>r===void 0,Y=r=>Ui.call(r)=="[object String]",_r=r=>Y(r)&&r.trim().length===0,Se=r=>r===null,C=r=>b(r)||Se(r),Be=r=>Ui.call(r)=="[object Number]"&&r==r,ft=r=>Be(r)&&r>0,je=r=>Ui.call(r)==="[object Boolean]",xo=r=>r instanceof FormData,So=r=>R(wo,r);function mr(r){return r===null||typeof r!="object"}function vi(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function ra(r){return!b(Event)&&(function(e,t){try{return e instanceof t}catch(i){return!1}})(r,Event)}var ko=[!0,"true",1,"1","yes"],Zi=r=>R(ko,r),Po=[!1,"false",0,"0","no"];function Ce(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),Be(r)?r>t?(i.warn(" cannot be  greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),Ce(s||t,e,t,i))}var yr=class{constructor(e){this.t={},this.i=e.i,this.o=Ce(e.bucketSize,0,100,e.h),this.m=Ce(e.refillRate,0,this.o,e.h),this.$=Ce(e.refillInterval,0,864e5,e.h)}S(e,t){var i=t-e.lastAccess,s=Math.floor(i/this.$);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var t,i=Date.now(),s=String(e),n=this.t[s];return n?this.S(n,i):(n={tokens:this.o,lastAccess:i},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}},be="Mobile",_i="iOS",He="Android",Yt="Tablet",sa=He+" "+Yt,na="iPad",aa="Apple",oa=aa+" Watch",Jt="Safari",Et="BlackBerry",la="Samsung",ca=la+"Browser",ua=la+" Internet",at="Chrome",To=at+" OS",ha=at+" "+_i,Ts="Internet Explorer",da=Ts+" "+be,Is="Opera",Io=Is+" Mini",As="Edge",pa="Microsoft "+As,bt="Firefox",ga=bt+" "+_i,Xt="Nintendo",Zt="PlayStation",wt="Xbox",fa=He+" "+be,va=be+" "+Jt,Dt="Windows",br=Dt+" Phone",cn="Nokia",wr="Ouya",_a="Generic",Ao=_a+" "+be.toLowerCase(),ma=_a+" "+Yt.toLowerCase(),Er="Konqueror",ie="(\\d+(\\.\\d+)?)",Qi=new RegExp("Version/"+ie),Oo=new RegExp(wt,"i"),Ro=new RegExp(Zt+" \\w+","i"),Co=new RegExp(Xt+" \\w+","i"),Os=new RegExp(Et+"|PlayBook|BB10","i"),$o={"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"},ci,un,Ki,Fo=(r,e)=>e&&R(e,aa)||(function(t){return R(t,Jt)&&!R(t,at)&&!R(t,He)})(r),ya=function(r,e){return e=e||"",R(r," OPR/")&&R(r,"Mini")?Io:R(r," OPR/")?Is:Os.test(r)?Et:R(r,"IE"+be)||R(r,"WPDesktop")?da:R(r,ca)?ua:R(r,As)||R(r,"Edg/")?pa:R(r,"FBIOS")?"Facebook "+be:R(r,"UCWEB")||R(r,"UCBrowser")?"UC Browser":R(r,"CriOS")?ha:R(r,"CrMo")||R(r,at)?at:R(r,He)&&R(r,Jt)?fa:R(r,"FxiOS")?ga:R(r.toLowerCase(),Er.toLowerCase())?Er:Fo(r,e)?R(r,be)?va:Jt:R(r,bt)?bt:R(r,"MSIE")||R(r,"Trident/")?Ts:R(r,"Gecko")?bt:""},Mo={[da]:[new RegExp("rv:"+ie)],[pa]:[new RegExp(As+"?\\/"+ie)],[at]:[new RegExp("("+at+"|CrMo)\\/"+ie)],[ha]:[new RegExp("CriOS\\/"+ie)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ie)],[Jt]:[Qi],[va]:[Qi],[Is]:[new RegExp("(Opera|OPR)\\/"+ie)],[bt]:[new RegExp(bt+"\\/"+ie)],[ga]:[new RegExp("FxiOS\\/"+ie)],[Er]:[new RegExp("Konqueror[:/]?"+ie,"i")],[Et]:[new RegExp(Et+" "+ie),Qi],[fa]:[new RegExp("android\\s"+ie,"i")],[ua]:[new RegExp(ca+"\\/"+ie)],[Ts]:[new RegExp("(rv:|MSIE )"+ie)],Mozilla:[new RegExp("rv:"+ie)]},Lo=function(r,e){var t=ya(r,e),i=Mo[t];if(b(i))return null;for(var s=0;s<i.length;s++){var n=i[s],a=r.match(n);if(a)return parseFloat(a[a.length-2])}return null},hn=[[new RegExp(wt+"; "+wt+" (.*?)[);]","i"),r=>[wt,r&&r[1]||""]],[new RegExp(Xt,"i"),[Xt,""]],[new RegExp(Zt,"i"),[Zt,""]],[Os,[Et,""]],[new RegExp(Dt,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[br,""];if(new RegExp(be).test(e)&&!/IEMobile\b/.test(e))return[Dt+" "+be,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=$o[i]||"";return/arm/i.test(e)&&(s="RT"),[Dt,s]}return[Dt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[_i,e.join(".")]}return[_i,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=b(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+He+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+He+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[He,e.join(".")]}return[He,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[To,""]],[/Linux|debian/i,["Linux",""]]],dn=function(r){return Co.test(r)?Xt:Ro.test(r)?Zt:Oo.test(r)?wt:new RegExp(wr,"i").test(r)?wr:new RegExp("("+br+"|WPDesktop)","i").test(r)?br:/iPad/.test(r)?na:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?oa:Os.test(r)?Et:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(cn,"i").test(r)?cn:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?new RegExp(be).test(r)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)||/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?He:sa:new RegExp("(pda|"+be+")","i").test(r)?Ao:new RegExp(Yt,"i").test(r)&&!new RegExp(Yt+" pc","i").test(r)?ma:""},Do=r=>r instanceof Error;function No(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Ki&&t.length===un||(un=t.length,Ki=t.reduce((i,s)=>{ci||(ci={});var n=ci[s];if(n)i[n[0]]=n[1];else for(var a=r(s),o=a.length-1;o>=0;o--){var l=a[o],u=l?.filename,c=e[s];if(u&&c){i[u]=c,ci[s]=[u,c];break}}return i},{})),Ki}}var xr=class{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(),a=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(a,i),$exception_level:"error"}}modifyFrames(e){var t=this;return _t(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&F(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),E({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return _t(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,n,a={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,E({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:No(this.stackParser)}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var s=(n,a)=>{if(a<=4){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return E({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}},xt="?";function Sr(r,e,t,i,s){var n={platform:r,filename:e,function:t==="<anonymous>"?xt:t,in_app:!0};return b(i)||(n.lineno=i),b(s)||(n.colno=s),n}var ba=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:xt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},Uo=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ho=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,jo=/\((\S*)(?::(\d+))(?::(\d+))\)/,Bo=(r,e)=>{var t=Uo.exec(r);if(t){var[,i,s,n]=t;return Sr(e,i,xt,+s,+n)}var a=Ho.exec(r);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=jo.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=ba(a[1]||xt,a[2]);return Sr(e,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},qo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Vo=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Wo=(r,e)=>{var t=qo.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=Vo.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var s=t[3],n=t[1]||xt;return[n,s]=ba(n,s),Sr(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},pn=/\(error: (.*)\)/,gn=50;function Go(){return(function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return function(s,n){n===void 0&&(n=0);for(var a=[],o=s.split(`
2`),l=n;l<o.length;l++){var u=o[l];if(!(u.length>1024)){var c=pn.test(u)?u.replace(pn,"$1"):u;if(!c.match(/\S*Error: /)){for(var h of t){var g=h(c,r);if(g){a.push(g);break}}if(a.length>=gn)break}}}return(function(f){if(!f.length)return[];var v=Array.from(f);return v.reverse(),v.slice(0,gn).map(_=>{return E({},_,{filename:_.filename||(m=v,m[m.length-1]||{}).filename,function:_.function||xt});var m})})(a)}})("web:javascript",Bo,Wo)}var kr=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Y(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return vi(e,"DOMException")}isDOMError(e){return vi(e,"DOMError")}},Pr=class{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}},Tr=class{constructor(){}match(e){return vi(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},zo=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ir=class{match(e){return typeof e=="string"}coerce(e,t){var i,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(zo);return s&&(t=s[1],i=s[2]),[t,i]}},Yo=["fatal","error","warning","log","info","debug"];function wa(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}var Ar=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ra(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+wa(e)}isSeverityLevel(e){return Y(e)&&!_r(e)&&Yo.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Do(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(i){return}}},Or=class{match(e){return ra(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+wa(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Rr=class{match(e){return mr(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Cr=class{match(e){return vi(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return mr(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(mr(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(t){}return e}},Ea=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,i={k:function(s){if(d&&(Le.DEBUG||S.POSTHOG_DEBUG||t)&&!b(d.console)&&d.console){for(var n=("__rrweb_original__"in d.console[s])?d.console[s].__rrweb_original__:d.console[s],a=arguments.length,o=new Array(a>1?a-1:0),l=1;l<a;l++)o[l-1]=arguments[l];n(r,...o)}},info:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];i.k("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];console.error(r,...n)},uninitializedWarning:s=>{i.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Ea(r+" "+s,n)};return i},w=Ea("[PostHog.js]"),B=w.createLogger,Jo=B("[ExternalScriptsLoader]"),fn=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return Jo.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=y?.querySelectorAll("script");if(i){for(var s,n=function(){if(i[a].src===e){var l=i[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)}),l.onerror=u=>t(u),{v:void 0})}},a=0;a<i.length;a++)if(s=n())return s.v}var o=()=>{if(!y)return t("document not found");var l=y.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(r.config.external_scripts_inject_target==="head")y.head.appendChild(l);else{var u,c=y.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):y.body.appendChild(l)}};y!=null&&y.body?o():y?.addEventListener("DOMContentLoaded",o)};S.__PosthogExtensions__=S.__PosthogExtensions__||{},S.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);fn(r,n,t)},S.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);fn(r,i,t)};var mi={};function et(r,e,t){if(F(r)){if(sn&&r.forEach===sn)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===mi)return}}}function N(r,e,t){if(!C(r)){if(F(r))return et(r,e,t);if(xo(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===mi)return}else for(var s in r)if(ia.call(r,s)&&e.call(t,r[s],s)===mi)return}}var q=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return et(t,function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])}),r},kt=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return et(t,function(s){et(s,function(n){r.push(n)})}),r};function gi(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var vn=function(r){try{return r()}catch(e){return}},Xo=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(s)}}},Rs=function(r){var e={};return N(r,function(t,i){(Y(t)&&t.length>0||Be(t))&&(e[i]=t)}),e};function Zo(r,e){return t=r,i=n=>Y(n)&&!Se(e)?n.slice(0,e):n,s=new Set,(function n(a,o){return a!==Object(a)?i?i(a,o):a:s.has(a)?void 0:(s.add(a),F(a)?(l=[],et(a,u=>{l.push(n(u))})):(l={},N(a,(u,c)=>{s.has(u)||(l[c]=n(u,c))})),l);var l})(t);var t,i,s}var Qo=["herokuapp.com","vercel.app","netlify.app"];function Ko(r){var e=r?.hostname;if(!Y(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Qo)if(t===i)return!1;return!0}function xa(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function W(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r?.addEventListener(e,t,{capture:s,passive:n})}var Sa="$people_distinct_id",Nt="__alias",Ut="__timers",_n="$autocapture_disabled_server_side",$r="$heatmaps_enabled_server_side",mn="$exception_capture_enabled_server_side",Fr="$error_tracking_suppression_rules",yn="$error_tracking_capture_extension_exceptions",bn="$web_vitals_enabled_server_side",ka="$dead_clicks_enabled_server_side",wn="$product_tours_enabled_server_side",En="$web_vitals_allowed_metrics",er="$session_recording_remote_config",yi="$sesid",Pa="$session_is_sampled",yt="$enabled_feature_flags",Ht="$early_access_features",Mr="$feature_flag_details",jt="$stored_person_properties",nt="$stored_group_properties",Lr="$surveys",bi="$flag_call_reported",De="$user_state",Dr="$client_session_props",Nr="$capture_rate_limit",Ur="$initial_campaign_params",Hr="$initial_referrer_info",wi="$initial_person_info",Ei="$epp",Ta="__POSTHOG_TOOLBAR__",It="$posthog_cookieless",el=[Sa,Nt,"__cmpns",Ut,"$session_recording_enabled_server_side",$r,yi,yt,Fr,De,Ht,Mr,nt,jt,Lr,bi,Dr,Nr,Ur,Hr,Ei,wi,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function xn(r){return r instanceof Element&&(r.id===Ta||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Hi(r){return!!r&&r.nodeType===1}function tt(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function Ia(r){return!!r&&r.nodeType===3}function Aa(r){return!!r&&r.nodeType===11}function Cs(r){return r?Ni(r).split(/\s+/):[]}function Sn(r){var e=d?.location.href;return!!(e&&r&&r.some(t=>e.match(t)))}function xi(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return Cs(e)}function Oa(r){return C(r)?null:Ni(r).split(/(\s+)/).filter(e=>Qt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ei(r){var e="";return jr(r)&&!Ma(r)&&r.childNodes&&r.childNodes.length&&N(r.childNodes,function(t){var i;Ia(t)&&t.textContent&&(e+=(i=Oa(t.textContent))!==null&&i!==void 0?i:"")}),Ni(e)}function Ra(r){return b(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var $s=["a","button","form","input","select","textarea","label"];function Ca(r,e){if(b(e))return!0;var t,i=function(n){if(e.some(a=>n.matches(a)))return{v:!0}};for(var s of r)if(t=i(s))return t.v;return!1}function $a(r){var e=r.parentNode;return!(!e||!Hi(e))&&e}var tl=["next","previous","prev",">","<"],kn=10,Pn=[".ph-no-rageclick",".ph-no-capture"];function il(r,e){if(!d||Fs(r))return!1;var t,i,s;if(je(e)?(t=!!e&&Pn,i=void 0):(t=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Pn,i=e?.content_ignorelist),t===!1)return!1;var{targetElementList:n}=Fa(r,!1);return!(function(a,o){if(a===!1||b(a))return!1;var l;if(a===!0)l=tl;else{if(!F(a))return!1;if(a.length>kn)return w.error("[PostHog] content_ignorelist array cannot exceed "+kn+" items. Use css_selector_ignorelist for more complex matching."),!1;l=a.map(u=>u.toLowerCase())}return o.some(u=>{var{safeText:c,ariaLabel:h}=u;return l.some(g=>c.includes(g)||h.includes(g))})})(i,n.map(a=>{var o;return{safeText:ei(a).toLowerCase(),ariaLabel:((o=a.getAttribute("aria-label"))==null?void 0:o.toLowerCase().trim())||""}}))&&!Ca(n,t)}var Fs=r=>!r||tt(r,"html")||!Hi(r),Fa=(r,e)=>{if(!d||Fs(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!tt(s,"body");)if(Aa(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=$a(s);if(!n)break;if(e||$s.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var a=d.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:i}};function rl(r,e,t,i,s){var n,a,o,l;if(t===void 0&&(t=void 0),!d||Fs(r)||(n=t)!=null&&n.url_allowlist&&!Sn(t.url_allowlist)||(a=t)!=null&&a.url_ignorelist&&Sn(t.url_ignorelist))return!1;if((o=t)!=null&&o.dom_event_allowlist){var u=t.dom_event_allowlist;if(u&&!u.some(v=>e.type===v))return!1}var{parentIsUsefulElement:c,targetElementList:h}=Fa(r,i);if(!(function(v,_){var m=_?.element_allowlist;if(b(m))return!0;var k,P=function(x){if(m.some(A=>x.tagName.toLowerCase()===A))return{v:!0}};for(var O of v)if(k=P(O))return k.v;return!1})(h,t)||!Ca(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var g=d.getComputedStyle(r);if(g&&g.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var f=r.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&($s.indexOf(f)>-1||r.getAttribute("contenteditable")==="true")}}function jr(r){for(var e=r;e.parentNode&&!tt(e,"body");e=e.parentNode){var t=xi(e);if(R(t,"ph-sensitive")||R(t,"ph-no-capture"))return!1}if(R(xi(r),"ph-include"))return!0;var i=r.type||"";if(Y(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(Y(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Ma(r){return!!(tt(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||tt(r,"select")||tt(r,"textarea")||r.getAttribute("contenteditable")==="true")}var La="(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})",sl=new RegExp("^(?:"+La+")$"),nl=new RegExp(La),Da="\\d{3}-?\\d{2}-?\\d{4}",al=new RegExp("^("+Da+")$"),ol=new RegExp("("+Da+")");function Qt(r,e){return e===void 0&&(e=!0),!(C(r)||Y(r)&&(r=Ni(r),(e?sl:nl).test((r||"").replace(/[- ]/g,""))||(e?al:ol).test(r)))}function Na(r){var e=ei(r);return Qt(e=(e+" "+Ua(r)).trim())?e:""}function Ua(r){var e="";return r&&r.childNodes&&r.childNodes.length&&N(r.childNodes,function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=ei(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Ua(t)).trim())}catch(n){w.error("[AutoCapture]",n)}}),e}function ll(r){return(function(e){var t=e.map(i=>{var s,n,a="";if(i.tag_name&&(a+=i.tag_name),i.attr_class)for(var o of(i.attr_class.sort(),i.attr_class))a+="."+o.replace(/"/g,"");var l=E({},i.text?{text:i.text}:{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),u={};return gi(l).sort((c,h)=>{var[g]=c,[f]=h;return g.localeCompare(f)}).forEach(c=>{var[h,g]=c;return u[Tn(h.toString())]=Tn(g.toString())}),a+=":",a+=gi(u).map(c=>{var[h,g]=c;return h+'="'+g+'"'}).join("")});return t.join(";")})((function(e){return e.map(t=>{var i,s,n={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.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 gi(t).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return n.attributes[o]=l}),n})})(r))}function Tn(r){return r.replace(/"|\\"/g,'\\"')}function cl(r){var e=r.attr__class;return e?F(e)?e:Cs(e):void 0}var Si=class{constructor(e){this.disabled=e===!1;var t=z(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&i-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},ki=r=>{var e=y?.createElement("a");return b(e)?null:(e.href=r,e)},ul=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return N(r,function(n,a){b(n)||b(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(n)?n.name:n.toString()),i=encodeURIComponent(a),s[s.length]=i+"="+t)}),s.join(e)},Pi=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!F(t)||t.length<2)return"";var a=t[1];try{a=decodeURIComponent(a)}catch(o){w.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},ti=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],a=s.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),c=[],h=0;h<u.length;h++){var g=u[h].split("=");F(g)&&(e.includes(g[0])?c.push(g[0]+"="+t):c.push(u[h]))}var f=l;return o!=null&&(f+="?"+c.join("&")),n!=null&&(f+="#"+n),f},Ti=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},tr="$copy_autocapture",In=B("[AutoCapture]");function ir(r,e){return e.length>r?e.slice(0,r)+"...":e}function hl(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Hi(e));return e}function dl(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};$s.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=ir(1024,Na(r)):n.$el_text=ir(1024,ei(r)));var a=xi(r);a.length>0&&(n.classes=a.filter(function(c){return c!==""})),N(r.attributes,function(c){var h;if((!Ma(r)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(i==null||!i.includes(c.name))&&!e&&Qt(c.value)&&(h=c.name,!Y(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var g=c.value;c.name==="class"&&(g=Cs(g).join(" ")),n["attr__"+c.name]=ir(1024,g)}});for(var o=1,l=1,u=r;u=hl(u);)o++,u.tagName===r.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}function pl(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=e,u=[r],c=r;c.parentNode&&!tt(c,"body");)Aa(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,g=[],f={},v=!1,_=!1;if(N(u,x=>{var A=jr(x);x.tagName.toLowerCase()==="a"&&(v=x.getAttribute("href"),v=A&&v&&Qt(v)&&v),R(xi(x),"ph-no-capture")&&(_=!0),g.push(dl(x,n,a,o));var V=(function(L){if(!jr(L))return{};var T={};return N(L.attributes,function(ne){if(ne.name&&ne.name.indexOf("data-ph-capture-attribute")===0){var ue=ne.name.replace("data-ph-capture-attribute-",""),Ee=ne.value;ue&&Ee&&Qt(Ee)&&(T[ue]=Ee)}}),T})(x);q(f,V)}),_)return{props:{},explicitNoCapture:_};if(a||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?g[0].$el_text=Na(r):g[0].$el_text=ei(r)),v){var m,k;g[0].attr__href=v;var P=(m=ki(v))==null?void 0:m.host,O=d==null||(k=d.location)==null?void 0:k.host;P&&O&&P!==O&&(h=v)}return{props:q({$event_type:s.type,$ce_version:1},l?{}:{$elements:g},{$elements_chain:ll(g)},(t=g[0])!=null&&t.$el_text?{$el_text:(i=g[0])==null?void 0:i.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},f)}}var Br=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Si(e.config.rageclick),this.C=null}get R(){var e,t,i=z(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map(s=>new RegExp(s)),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map(s=>new RegExp(s)),i}F(){if(this.isBrowserSupported()){if(d&&y){var e=i=>{i=i||d?.event;try{this.O(i)}catch(s){In.error("Failed to capture event",s)}};if(W(y,"submit",e,{capture:!0}),W(y,"change",e,{capture:!0}),W(y,"click",e,{capture:!0}),this.R.capture_copied_text){var t=i=>{i=i||d?.event,this.O(i,tr)};W(y,"copy",t,{capture:!0}),W(y,"cut",t,{capture:!0})}}}else In.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[_n]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,i=[];return(t=this.C)==null||t.forEach(s=>{var n=y?.querySelectorAll(s);n?.forEach(a=>{e===a&&i.push(s)})}),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[_n],s=this.T;if(Se(s)&&!je(i)&&!this.instance.M())return!1;var n=(t=this.T)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=Ra(e);Ia(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&il(s,this.instance.config.rageclick)&&this.O(e,"$rageclick");var n=t===tr;if(s&&rl(s,e,this.R,n,n?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=pl(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(o)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(a.$element_selectors=l),t===tr){var u,c=Oa(d==null||(u=d.getSelection())==null?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;a.$selected_content=c,a.$copy_type=h}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return Ke(y?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return Be(r)&&isFinite(r)&&Math.floor(r)===r});var An="0123456789abcdef",qr=class r{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new r(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+An.charAt(this.bytes[t]>>>4)+An.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new r(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}},Vr=class{constructor(){this.A=0,this.j=0,this.D=new Wr}generate(){var e=this.generateOrAbort();if(b(e)){this.A=0;var t=this.generateOrAbort();if(b(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return qr.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},On,Ha=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};d&&!b(d.crypto)&&crypto.getRandomValues&&(Ha=r=>crypto.getRandomValues(r));var Wr=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Ha(this.N),this.U=0),this.N[this.U++]}},Qe=()=>gl().toString(),gl=()=>(On||(On=new Vr)).generate(),At="",fl=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function vl(r,e){if(e){var t=(function(s,n){if(n===void 0&&(n=y),At)return At;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Qe();!At&&o--;){var u=a.slice(o).join("."),c=l+"=1;domain=."+u+";path=/";n.cookie=c+";max-age=3",n.cookie.includes(l)&&(n.cookie=c+";max-age=0",At=u)}return At})(r);if(!t){var i=(s=>{var n=s.match(fl);return n?n[0]:""})(r);i!==t&&w.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var Re={H:()=>!!y,B:function(r){w.error("cookieStore error: "+r)},q:function(r){if(y){try{for(var e=r+"=",t=y.cookie.split(";").filter(n=>n.length),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch(n){}return null}},W:function(r){var e;try{e=JSON.parse(Re.q(r))||{}}catch(t){}return e},G:function(r,e,t,i,s){if(y)try{var n="",a="",o=vl(y.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(a="; secure");var u=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+u.length),y.cookie=u,u}catch(c){return}},V:function(r,e){if(y!=null&&y.cookie)try{Re.G(r,"",-1,e)}catch(t){return}}},rr=null,j={H:function(){if(!Se(rr))return rr;var r=!0;if(b(d))r=!1;else try{var e="__mplssupport__";j.G(e,"xyz"),j.q(e)!=='"xyz"'&&(r=!1),j.V(e)}catch(t){r=!1}return r||w.error("localStorage unsupported; falling back to cookie store"),rr=r,r},B:function(r){w.error("localStorage error: "+r)},q:function(r){try{return d?.localStorage.getItem(r)}catch(e){j.B(e)}return null},W:function(r){try{return JSON.parse(j.q(r))||{}}catch(e){}return null},G:function(r,e){try{d?.localStorage.setItem(r,JSON.stringify(e))}catch(t){j.B(t)}},V:function(r){try{d?.localStorage.removeItem(r)}catch(e){j.B(e)}}},_l=["$device_id","distinct_id",yi,Pa,Ei,wi],ui={},ml={H:function(){return!0},B:function(r){w.error("memoryStorage error: "+r)},q:function(r){return ui[r]||null},W:function(r){return ui[r]||null},G:function(r,e){ui[r]=e},V:function(r){delete ui[r]}},rt=null,Z={H:function(){if(!Se(rt))return rt;if(rt=!0,b(d))rt=!1;else try{var r="__support__";Z.G(r,"xyz"),Z.q(r)!=='"xyz"'&&(rt=!1),Z.V(r)}catch(e){rt=!1}return rt},B:function(r){w.error("sessionStorage error: ",r)},q:function(r){try{return d?.sessionStorage.getItem(r)}catch(e){Z.B(e)}return null},W:function(r){try{return JSON.parse(Z.q(r))||null}catch(e){}return null},G:function(r,e){try{d?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){Z.B(t)}},V:function(r){try{d?.sessionStorage.removeItem(r)}catch(e){Z.B(e)}}},Ne=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),Gr=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Ne.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===Ne.DENIED||this.consent===Ne.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ne.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return Zi(e)?Ne.GRANTED:R(Po,e)?Ne.DENIED:Ne.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?j:Re;var t=e==="localStorage"?Re:j;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(Zi(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!xa([ge?.doNotTrack,ge?.msDoNotTrack,S.doNotTrack],e=>Zi(e))}},hi=B("[Dead Clicks]"),yl=()=>!0,bl=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(ka)),i=r.instance.config.capture_dead_clicks;return je(i)?i:!!z(i)||t},Ii=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[ka]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,i;(t=S.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=S.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?hi.error("failed to load script",s):e()})}et(){var e;if(y){if(!this.tt&&(e=S.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=z(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=S.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(y),hi.info("starting...")}}else hi.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,hi.info("stopping..."))}},Ot=B("[ExceptionAutocapture]"),zr=class{constructor(e){var t,i,s;this.rt=()=>{var n;if(d&&this.isEnabled&&(n=S.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var a=S.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=S.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=S.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=a(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=o(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(u){Ot.error("failed to start",u),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[mn]),this.dt=new yr({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:Ot}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return z(e)?t=E({},t,e):(b(e)?this.ht:e)&&(t=E({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ot.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,i;(t=S.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=S.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",s=>{if(s)return Ot.error("failed to load script",s);e()})}ut(){var e,t,i;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(i=this.ot)==null||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[mn]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,i,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(s)?Ot.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}};function Rn(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return Ke(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch(n){return()=>{}}}var Yr=class{constructor(e){var t;this._instance=e,this.ct=(d==null||(t=d.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(w.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,w.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(d&&d.history){var i=this;(e=d.history.pushState)!=null&&e.__posthog_wrapped__||Rn(d.history,"pushState",s=>function(n,a,o){s.call(this,n,a,o),i._t("pushState")}),(t=d.history.replaceState)!=null&&t.__posthog_wrapped__||Rn(d.history,"replaceState",s=>function(n,a,o){s.call(this,n,a,o),i._t("replaceState")}),this.bt()}}_t(e){try{var t,i=d==null||(t=d.location)==null?void 0:t.pathname;if(!i)return;i!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=i}catch(s){w.error("Error capturing "+e+" pageview",s)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};W(d,"popstate",e),this.ft=()=>{d&&d.removeEventListener("popstate",e)}}}},sr=B("[SegmentIntegration]");function wl(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var a=l=>{var u=()=>l.anonymousId()||Qe();i.config.get_device_id=u,l.id()&&(i.register({distinct_id:l.id(),$device_id:u()}),i.persistence.set_property(De,"identified")),s()},o=n.user();"then"in o&&Ke(o.then)?o.then(a):a(o)})(r,()=>{t.register((i=>{Promise&&Promise.resolve||sr.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,a)=>{if(!a)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||(sr.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(sr.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var o=i.calculateEventProperties(a,n.event.properties);return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then(()=>{e()})})}var ja="posthog-js";function Ba(r,e){var{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,u,c,h,g;if(!(n==="*"||n.includes(o.level))||!r.__loaded)return o;o.tags||(o.tags={});var f=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());o.tags["PostHog Person URL"]=f,r.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var v=((l=o.exception)==null?void 0:l.values)||[],_=v.map(k=>E({},k,{stacktrace:k.stacktrace?E({},k.stacktrace,{type:"raw",frames:(k.stacktrace.frames||[]).map(P=>E({},P,{platform:"web:javascript"}))}):void 0})),m={$exception_message:((u=v[0])==null?void 0:u.value)||o.message,$exception_type:(c=v[0])==null?void 0:c.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=v[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(g=v[0])==null?void 0:g.type,$sentry_tags:o.tags};return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),a&&r.exceptions.sendExceptionEvent(m),o}}var Jr=class{constructor(e,t,i,s,n,a){this.name=ja,this.setupOnce=function(o){o(Ba(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}},El=d!=null&&d.location?Ti(d.location.hash,"__posthog")||Ti(location.hash,"state"):null,Cn="_postHogToolbarParams",$n=B("[Toolbar]"),Ze=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Ze||{}),Xr=class{constructor(e){this.instance=e}yt(e){S.ph_toolbar_state=e}wt(){var e;return(e=S.ph_toolbar_state)!==null&&e!==void 0?e:Ze.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),!d||!y)return!1;e=e??d.location,i=i??d.history;try{if(!t){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch(o){return!1}t=d?.localStorage}var s,n=El||Ti(e.hash,"__posthog")||Ti(e.hash,"state"),a=n?vn(()=>JSON.parse(atob(decodeURIComponent(n))))||vn(()=>JSON.parse(decodeURIComponent(n))):null;return a&&a.action==="ph_authorize"?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Cn)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(o){return!1}}xt(e){var t=S.ph_load_toolbar||S.ph_load_editor;!C(t)&&Ke(t)?t(e,this.instance):$n.warn("No toolbar load function found")}loadToolbar(e){var t=!(y==null||!y.getElementById(Ta));if(!d||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=E({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(d.localStorage.setItem(Cn,JSON.stringify(E({},s,{source:void 0}))),this.wt()===Ze.LOADED)this.xt(s);else if(this.wt()===Ze.UNINITIALIZED){var n;this.yt(Ze.LOADING),(n=S.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",a=>{if(a)return $n.error("[Toolbar] Failed to load",a),void this.yt(Ze.UNINITIALIZED);this.yt(Ze.LOADED),this.xt(s)}),W(d,"turbolinks:load",()=>{this.yt(Ze.UNINITIALIZED),this.loadToolbar(s)})}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}},xl=B("[TracingHeaders]"),Zr=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,i;b(this.$t)&&((t=S.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),b(this.St)&&((i=S.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;(t=S.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=S.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",s=>{if(s)return xl.error("failed to load script",s);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(t=this.St)==null||t.call(this),this.$t=void 0,this.St=void 0)}},di="https?://(.*)",Pt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Sl=kt(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Pt),ii="<masked>",kl=["li_fat_id"];function qa(r,e,t){if(!y)return{};var i,s=e?kt([],Pt,t||[]):[],n=Va(ti(y.URL,s,ii),r),a=(i={},N(kl,function(o){var l=Re.q(o);i[o]=l||null}),i);return q(a,n)}function Va(r,e){var t=Sl.concat(e||[]),i={};return N(t,function(s){var n=Pi(r,s);i[s]=n||null}),i}function Wa(r){var e=(function(n){return n?n.search(di+"google.([^/?]*)")===0?"google":n.search(di+"bing.com")===0?"bing":n.search(di+"yahoo.com")===0?"yahoo":n.search(di+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",i={};if(!Se(e)){i.$search_engine=e;var s=y?Pi(y.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Fn(){return navigator.language||navigator.userLanguage}function Ga(){return y?.referrer||"$direct"}function za(r,e){var t=r?kt([],Pt,e||[]):[],i=le?.href.substring(0,1e3);return{r:Ga().substring(0,1e3),u:i?ti(i,t,ii):void 0}}function Ya(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=ki(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=ki(i);s.$host=n?.host,s.$pathname=n?.pathname;var a=Va(i);q(s,a)}if(t){var o=Wa(t);q(s,o)}return s}function Ja(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(r){return}}function Pl(){try{return new Date().getTimezoneOffset()}catch(r){return}}function Tl(r,e){if(!oe)return{};var t,i,s,n=r?kt([],Pt,e||[]):[],[a,o]=(function(l){for(var u=0;u<hn.length;u++){var[c,h]=hn[u],g=c.exec(l),f=g&&(Ke(h)?h(g,l):h);if(f)return f}return["",""]})(oe);return q(Rs({$os:a,$os_version:o,$browser:ya(oe,navigator.vendor),$device:dn(oe),$device_type:(i=oe,s=dn(i),s===na||s===sa||s==="Kobo"||s==="Kindle Fire"||s===ma?Yt:s===Xt||s===wt||s===Zt||s===wr?"Console":s===oa?"Wearable":s?be:"Desktop"),$timezone:Ja(),$timezone_offset:Pl()}),{$current_url:ti(le?.href,n,ii),$host:le?.host,$pathname:le?.pathname,$raw_user_agent:oe.length>1e3?oe.substring(0,997)+"...":oe,$browser_version:Lo(oe,navigator.vendor),$browser_language:Fn(),$browser_language_prefix:(t=Fn(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:d?.screen.height,$screen_width:d?.screen.width,$viewport_height:d?.innerHeight,$viewport_width:d?.innerWidth,$lib:"web",$lib_version:Le.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Ye=B("[Web Vitals]"),Mn=9e5,Qr=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((i,s)=>E({},i,{["$web_vitals_"+s.name+"_event"]:E({},s),["$web_vitals_"+s.name+"_value"]:s.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=i=>{var s,n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(b(n))Ye.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.Ct();b(a)||(C(i?.name)||C(i?.value)?Ye.error("Invalid metric received",i):this.Rt&&i.value>=this.Rt?Ye.error("Ignoring metric with value >= "+this.Rt,i):(this.N.url!==a&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),b(this.N.url)&&(this.N.url=a),this.N.firstMetricTimestamp=b(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.N.metrics.push(E({},i,{$current_url:a,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var i,s,n,a,o=S.__PosthogExtensions__;b(o)||b(o.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:a}=o.postHogWebVitalsCallbacks),i&&s&&n&&a?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.It.bind(this)),this.P=!0):Ye.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[bn]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=z(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return C(i)?((t=this._instance.persistence)==null?void 0:t.props[En])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(z(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=z(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=z(this._instance.config.capture_performance)&&Be(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Mn;return 0<e&&e<=6e4?Mn:e}get isEnabled(){var e=le?.protocol;if(e!=="http:"&&e!=="https:")return Ye.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=z(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:je(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return je(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Ye.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=z(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=z(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[bn]:t}),this._instance.persistence.register({[En]:i})),this.kt=t,this.startIfEnabled()}it(e){var t,i;if((t=S.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var s=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(i=S.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,s,n=>{n?Ye.error("failed to load script",n):e()})}}Ct(){var e=d?d.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?kt([],Pt,i||[]):[];return ti(e,s,ii)}Ye.error("Could not determine current URL")}},Il=B("[Heatmaps]");function Ln(r){return z(r)&&"clientX"in r&&"clientY"in r&&Be(r.clientX)&&Be(r.clientY)}var Kr=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[$r]),this.rageclicks=new Si(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return z(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return C(this.instance.config.capture_heatmaps)?C(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;Il.info("starting..."),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[$r]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return e?.visibilityState==="visible"})(y)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){d&&y&&(this.Nt=this.Lt.bind(this),W(d,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||d?.event),W(y,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||d?.event),W(y,"mousemove",this.zt,{capture:!0}),this.Bt=new Ii(this.instance,yl,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),W(y,"visibilitychange",this.qt),this.P=!0)}At(){var e;d&&y&&(this.Nt&&d.removeEventListener("beforeunload",this.Nt),this.Ut&&y.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&y.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&y.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=(function(o,l,u){for(var c=o;c&&Hi(c)&&!tt(c,"body");){if(c===u)return!1;if(R(l,d?.getComputedStyle(c).position))return!0;c=$a(c)}return!1})(Ra(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:s),y:e.clientY+(a?0:i),target_fixed:a,type:t}}Dt(e,t){var i;if(t===void 0&&(t="click"),!xn(e.target)&&Ln(e)){var s=this.Gt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(E({},s,{type:"rageclick"})),this.Vt(s)}}Ht(e){!xn(e.target)&&Ln(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout(()=>{this.Vt(this.Gt(e,"mousemove"))},500))}Vt(e){if(d){var t=d.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?kt([],Pt,s||[]):[],a=ti(t,n,ii);this.N=this.N||{},this.N[a]||(this.N[a]=[]),this.N[a].push(e)}}Lt(){this.N&&!mt(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},Ai=class{constructor(e){this.Jt=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(e,t){var i,s=this.Qt(e,t);return this.Kt={pathname:(i=d?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qt(e,(t=this.Kt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Qt(e,t){var i=this.Kt;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:h}=n;if(!(b(a)||b(o)||b(l)||b(u)||b(c)||b(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var g=a<=1?1:Ce(o/a,0,1,w),f=a<=1?1:Ce(l/a,0,1,w),v=u<=1?1:Ce(c/u,0,1,w),_=u<=1?1:Ce(h/u,0,1,w);s=q(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:g,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};var Ue=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),we=Uint8Array,re=Uint16Array,St=Uint32Array,Ms=new we([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]),Ls=new we([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]),Dn=new we([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xa=function(r,e){for(var t=new re(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new St(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},Za=Xa(Ms,2),Al=Za[0],es=Za[1];Al[28]=258,es[258]=28;for(ts=Xa(Ls,0)[1],Oi=new re(32768),U=0;U<32768;++U)Je=(43690&U)>>>1|(21845&U)<<1,Je=(61680&(Je=(52428&Je)>>>2|(13107&Je)<<2))>>>4|(3855&Je)<<4,Oi[U]=((65280&Je)>>>8|(255&Je)<<8)>>>1;var Je,ts,Oi,U,Wt=function(r,e,t){for(var i=r.length,s=0,n=new re(e);s<i;++s)++n[r[s]-1];var a,o=new re(e);for(s=0;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;if(t){a=new re(1<<e);var l=15-e;for(s=0;s<i;++s)if(r[s])for(var u=s<<4|r[s],c=e-r[s],h=o[r[s]-1]++<<c,g=h|(1<<c)-1;h<=g;++h)a[Oi[h]>>>l]=u}else for(a=new re(i),s=0;s<i;++s)a[s]=Oi[o[r[s]-1]++]>>>15-r[s];return a},ot=new we(288);for(U=0;U<144;++U)ot[U]=8;for(U=144;U<256;++U)ot[U]=9;for(U=256;U<280;++U)ot[U]=7;for(U=280;U<288;++U)ot[U]=8;var Ri=new we(32);for(U=0;U<32;++U)Ri[U]=5;var Ol=Wt(ot,9,0),Rl=Wt(Ri,5,0),Qa=function(r){return(r/8>>0)+(7&r&&1)},Ka=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof re?re:r instanceof St?St:we)(t-e);return i.set(r.subarray(e,t)),i},Fe=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},Rt=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},nr=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new we(0),0];if(s==1){var a=new we(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort(function(A,V){return A.f-V.f}),t.push({s:-1,f:25001});var o=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=s-1;)o=t[t[u].f<t[h].f?u++:h++],l=t[u!=c&&t[u].f<t[h].f?u++:h++],t[c++]={s:-1,f:o.f+l.f,l:o,r:l};var g=n[0].s;for(i=1;i<s;++i)n[i].s>g&&(g=n[i].s);var f=new re(g+1),v=is(t[c-1],f,0);if(v>e){i=0;var _=0,m=v-e,k=1<<m;for(n.sort(function(A,V){return f[V.s]-f[A.s]||A.f-V.f});i<s;++i){var P=n[i].s;if(!(f[P]>e))break;_+=k-(1<<v-f[P]),f[P]=e}for(_>>>=m;_>0;){var O=n[i].s;f[O]<e?_-=1<<e-f[O]++-1:++i}for(;i>=0&&_;--i){var x=n[i].s;f[x]==e&&(--f[x],++_)}v=e}return[new we(f),v]},is=function(r,e,t){return r.s==-1?Math.max(is(r.l,e,t+1),is(r.r,e,t+1)):e[r.s]=t},Nn=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new re(++e),i=0,s=r[0],n=1,a=function(l){t[i++]=l},o=1;o<=e;++o)if(r[o]==s&&o!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=r[o]}return[t.subarray(0,i),e]},Ct=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},rs=function(r,e,t){var i=t.length,s=Qa(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},Un=function(r,e,t,i,s,n,a,o,l,u,c){Fe(e,c++,t),++s[256];for(var h=nr(s,15),g=h[0],f=h[1],v=nr(n,15),_=v[0],m=v[1],k=Nn(g),P=k[0],O=k[1],x=Nn(_),A=x[0],V=x[1],L=new re(19),T=0;T<P.length;++T)L[31&P[T]]++;for(T=0;T<A.length;++T)L[31&A[T]]++;for(var ne=nr(L,7),ue=ne[0],Ee=ne[1],ve=19;ve>4&&!ue[Dn[ve-1]];--ve);var $e,Pe,Te,ut,qe=u+5<<3,it=Ct(s,ot)+Ct(n,Ri)+a,Ie=Ct(s,g)+Ct(n,_)+a+14+3*ve+Ct(L,ue)+(2*L[16]+3*L[17]+7*L[18]);if(qe<=it&&qe<=Ie)return rs(e,c,r.subarray(l,l+u));if(Fe(e,c,1+(Ie<it)),c+=2,Ie<it){$e=Wt(g,f,0),Pe=g,Te=Wt(_,m,0),ut=_;var Ve=Wt(ue,Ee,0);for(Fe(e,c,O-257),Fe(e,c+5,V-1),Fe(e,c+10,ve-4),c+=14,T=0;T<ve;++T)Fe(e,c+3*T,ue[Dn[T]]);c+=3*ve;for(var ht=[P,A],ee=0;ee<2;++ee){var _e=ht[ee];for(T=0;T<_e.length;++T){var he=31&_e[T];Fe(e,c,Ve[he]),c+=ue[he],he>15&&(Fe(e,c,_e[T]>>>5&127),c+=_e[T]>>>12)}}}else $e=Ol,Pe=ot,Te=Rl,ut=Ri;for(T=0;T<o;++T)if(i[T]>255){he=i[T]>>>18&31,Rt(e,c,$e[he+257]),c+=Pe[he+257],he>7&&(Fe(e,c,i[T]>>>23&31),c+=Ms[he]);var dt=31&i[T];Rt(e,c,Te[dt]),c+=ut[dt],dt>3&&(Rt(e,c,i[T]>>>5&8191),c+=Ls[dt])}else Rt(e,c,$e[i[T]]),c+=Pe[i[T]];return Rt(e,c,$e[256]),c+Pe[256]},Cl=new St([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$l=(function(){for(var r=new St(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),Fl=function(r,e,t,i,s){return(function(n,a,o,l,u,c){var h=n.length,g=new we(l+h+5*(1+Math.floor(h/7e3))+u),f=g.subarray(l,g.length-u),v=0;if(!a||h<8)for(var _=0;_<=h;_+=65535){var m=_+65535;m<h?v=rs(f,v,n.subarray(_,m)):(f[_]=c,v=rs(f,v,n.subarray(_,h)))}else{for(var k=Cl[a-1],P=k>>>13,O=8191&k,x=(1<<o)-1,A=new re(32768),V=new re(x+1),L=Math.ceil(o/3),T=2*L,ne=function(Gi){return(n[Gi]^n[Gi+1]<<L^n[Gi+2]<<T)&x},ue=new St(25e3),Ee=new re(288),ve=new re(32),$e=0,Pe=0,Te=(_=0,0),ut=0,qe=0;_<h;++_){var it=ne(_),Ie=32767&_,Ve=V[it];if(A[Ie]=Ve,V[it]=Ie,ut<=_){var ht=h-_;if(($e>7e3||Te>24576)&&ht>423){v=Un(n,f,0,ue,Ee,ve,Pe,Te,qe,_-qe,v),Te=$e=Pe=0,qe=_;for(var ee=0;ee<286;++ee)Ee[ee]=0;for(ee=0;ee<30;++ee)ve[ee]=0}var _e=2,he=0,dt=O,We=Ie-Ve&32767;if(ht>2&&it==ne(_-We))for(var ho=Math.min(P,ht)-1,po=Math.min(32767,_),go=Math.min(258,ht);We<=po&&--dt&&Ie!=Ve;){if(n[_+_e]==n[_+_e-We]){for(var Ge=0;Ge<go&&n[_+Ge]==n[_+Ge-We];++Ge);if(Ge>_e){if(_e=Ge,he=We,Ge>ho)break;var fo=Math.min(We,Ge-2),Hs=0;for(ee=0;ee<fo;++ee){var Wi=_-We+ee+32768&32767,js=Wi-A[Wi]+32768&32767;js>Hs&&(Hs=js,Ve=Wi)}}}We+=(Ie=Ve)-(Ve=A[Ie])+32768&32767}if(he){ue[Te++]=268435456|es[_e]<<18|ts[he];var Bs=31&es[_e],qs=31&ts[he];Pe+=Ms[Bs]+Ls[qs],++Ee[257+Bs],++ve[qs],ut=_+_e,++$e}else ue[Te++]=n[_],++Ee[n[_]]}}v=Un(n,f,c,ue,Ee,ve,Pe,Te,qe,_-qe,v)}return Ka(g,0,l+Qa(v)+u)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},ar=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function Ml(r,e){e===void 0&&(e={});var t=(function(){var o=4294967295;return{p:function(l){for(var u=o,c=0;c<l.length;++c)u=$l[255&u^l[c]]^u>>>8;o=u},d:function(){return 4294967295^o}}})(),i=r.length;t.p(r);var s,n=Fl(r,e,10+((s=e).filename&&s.filename.length+1||0),8),a=n.length;return(function(o,l){var u=l.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=l.level<2?4:l.level==9?2:0,o[9]=3,l.mtime!=0&&ar(o,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),u){o[3]=8;for(var c=0;c<=u.length;++c)o[c+10]=u.charCodeAt(c)}})(n,e),ar(n,a-8,t.d()),ar(n,a-4,i),n}var Ll=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
3`).replace(/\r/g,`
4`)).length,s=0;s<i;s++){var a=r.charCodeAt(s),o=null;a<128?t++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),Se(o)||(t>e&&(n+=r.substring(e,t)),n+=o,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},Dl=!!fr||!!gr,Hn="text/plain",Ci=function(r,e,t){var i;t===void 0&&(t=!0);var[s,n]=r.split("?"),a=E({},e),o=(i=n?.split("&").map(u=>{var c,[h,g]=u.split("="),f=t&&(c=a[h])!==null&&c!==void 0?c:g;return delete a[h],h+"="+f}))!==null&&i!==void 0?i:[],l=ul(a);return l&&o.push(l),s+"?"+o.join("&")},Bt=(r,e)=>JSON.stringify(r,(t,i)=>typeof i=="bigint"?i.toString():i,e),or=r=>{var{data:e,compression:t}=r;if(e){if(t===Ue.GZipJS){var i=Ml((function(l,u){var c=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new we(l.length+(l.length>>>1)),g=0,f=function(k){h[g++]=k},v=0;v<c;++v){if(g+5>h.length){var _=new we(g+8+(c-v<<1));_.set(h),h=_}var m=l.charCodeAt(v);m<128||u?f(m):m<2048?(f(192|m>>>6),f(128|63&m)):m>55295&&m<57344?(f(240|(m=65536+(1047552&m)|1023&l.charCodeAt(++v))>>>18),f(128|m>>>12&63),f(128|m>>>6&63),f(128|63&m)):(f(224|m>>>12),f(128|m>>>6&63),f(128|63&m))}return Ka(h,0,g)})(Bt(e)),{mtime:0}),s=new Blob([i],{type:Hn});return{contentType:Hn,body:s,estimatedSize:s.size}}if(t===Ue.Base64){var n=(function(l){var u,c,h,g,f,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_=0,m=0,k="",P=[];if(!l)return l;l=Ll(l);do u=(f=l.charCodeAt(_++)<<16|l.charCodeAt(_++)<<8|l.charCodeAt(_++))>>18&63,c=f>>12&63,h=f>>6&63,g=63&f,P[m++]=v.charAt(u)+v.charAt(c)+v.charAt(h)+v.charAt(g);while(_<l.length);switch(k=P.join(""),l.length%3){case 1:k=k.slice(0,-2)+"==";break;case 2:k=k.slice(0,-1)+"="}return k})(Bt(e)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Bt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=Bt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},fi=[];gr&&fi.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=or(r))!==null&&e!==void 0?e:{},a=new Headers;N(r.headers,function(c,h){a.append(h,c)}),i&&a.append("Content-Type",i);var o=r.url,l=null;if(an){var u=new an;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),r.timeout)}}gr(o,E({method:r?.method||"GET",headers:a,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then(c=>c.text().then(h=>{var g={statusCode:c.status,text:h};if(c.status===200)try{g.json=JSON.parse(h)}catch(f){w.error(f)}r.callback==null||r.callback(g)})).catch(c=>{w.error(c),r.callback==null||r.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),fr&&fi.push({transport:"XHR",method:r=>{var e,t=new fr;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=or(r))!==null&&e!==void 0?e:{};N(r.headers,function(n,a){t.setRequestHeader(a,n)}),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch(a){}r.callback==null||r.callback(n)}},t.send(s)}}),ge!=null&&ge.sendBeacon&&fi.push({transport:"sendBeacon",method:r=>{var e=Ci(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=or(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;ge.sendBeacon(e,n)}catch(a){}}});var $i=function(r,e){if(!(function(t){try{new RegExp(t)}catch(i){return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch(t){return!1}};function jn(r,e,t){return Bt({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var eo={exact:(r,e)=>e.some(t=>r.some(i=>t===i)),is_not:(r,e)=>e.every(t=>r.every(i=>t!==i)),regex:(r,e)=>e.some(t=>r.some(i=>$i(t,i))),not_regex:(r,e)=>e.every(t=>r.every(i=>!$i(t,i))),icontains:(r,e)=>e.map(pi).some(t=>r.map(pi).some(i=>t.includes(i))),not_icontains:(r,e)=>e.map(pi).every(t=>r.map(pi).every(i=>!t.includes(i))),gt:(r,e)=>e.some(t=>{var i=parseFloat(t);return!isNaN(i)&&r.some(s=>i>parseFloat(s))}),lt:(r,e)=>e.some(t=>{var i=parseFloat(t);return!isNaN(i)&&r.some(s=>i<parseFloat(s))})},pi=r=>r.toLowerCase();function to(r,e){return!r||Object.entries(r).every(t=>{var[i,s]=t,n=e?.[i];if(b(n)||Se(n))return!1;var a=[String(n)],o=eo[s.operator];return!!o&&o(s.values,a)})}var lr=B("[Error tracking]"),ss=class{constructor(e){var t,i;this.Zt=[],this.ti=new xr([new kr,new Cr,new Tr,new Pr,new Or,new Ar,new Ir,new Rr],Go()),this._instance=e,this.Zt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(Fr))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,s,n=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],a=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Zt=n,this._instance.persistence&&this._instance.persistence.register({[Fr]:this.Zt,[yn]:a})}get ii(){var e,t=!!this._instance.get_property(yn),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void lr.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void lr.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void lr.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce((i,s)=>{var{type:n,value:a}=s;return Y(n)&&n.length>0&&i.$exception_types.push(n),Y(a)&&a.length>0&&i.$exception_values.push(a),i},{$exception_types:[],$exception_values:[]});return this.Zt.some(i=>{var s=i.values.map(n=>{var a,o=eo[n.operator],l=F(n.value)?n.value:[n.value],u=(a=t[n.key])!==null&&a!==void 0?a:[];return l.length>0&&o(l,u)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}si(e){return e.flatMap(t=>{var i,s;return(i=(s=t.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]}).some(t=>t.filename&&t.filename.startsWith("chrome-extension://"))}ni(e){if(e.length>0){var t,i,s,n,a=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],o=a[a.length-1];return(s=o==null||(n=o.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ei(e){return!C(e)&&F(e)}},pe=B("[FeatureFlags]"),$t=B("[FeatureFlags]",{debugEnabled:!0}),cr="$active_feature_flags",pt="$override_feature_flags",Bn="$feature_flag_payloads",Ft="$override_feature_flag_payloads",qn="$feature_flag_request_id",Vn="$feature_flag_evaluated_at",Wn=r=>{var e={};for(var[t,i]of gi(r||{}))i&&(e[t]=i);return e},Nl=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]})),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload}).map(t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]}))):pe.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},Ul=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),ns=class{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(pe.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter(i=>{var s=i&&typeof i=="string"&&i.trim().length>0;return s||pe.error("Invalid evaluation context found:",i,"Expected non-empty string"),s}):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Mr),t=this._instance.get_property(pt),i=this._instance.get_property(Ft);if(!i&&!t)return e||{};var s=q({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var a of n){var o,l,u=s[a],c=t?.[a],h=b(c)?(o=u?.enabled)!==null&&o!==void 0&&o:!!c,g=b(c)?u.variant:typeof c=="string"?c:void 0,f=i?.[a],v=E({},u,{enabled:h,variant:h?g??u?.variant:void 0});h!==u?.enabled&&(v.original_enabled=u?.enabled),g!==u?.variant&&(v.original_variant=u?.variant),f&&(v.metadata=E({},u?.metadata,{payload:f,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),s[a]=v}return this.oi||(pe.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.oi=!0),s}getFlagVariants(){var e=this._instance.get_property(yt),t=this._instance.get_property(pt);if(!t)return e||{};for(var i=q({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(pe.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.oi=!0),i}getFlagPayloads(){var e=this._instance.get_property(Bn),t=this._instance.get_property(Ft);if(!t)return e||{};for(var i=q({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(pe.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.oi=!0),i}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this.gi=setTimeout(()=>{this.mi()},5))}bi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.bi(),!this._instance.M())if(this.li)this.hi=!0;else{var i=this._instance.config.token,s=this._instance.get_property("$device_id"),n={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:E({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(jt)||{}),group_properties:this._instance.get_property(nt)};Se(s)||b(s)||(n.$device_id=s),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.pi()&&(n.evaluation_contexts=this.fi());var a=this._instance.config.__preview_remote_config,o=a?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",u=this._instance.requestRouter.endpointFor("flags",o+l);a&&(n.timezone=Ja()),this.li=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this._instance.config.disable_compression?void 0:Ue.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var h,g,f=!0;if(c.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),f=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((g=c.json)!==null&&g!==void 0?g:{})),!n.disable_flags||this.hi)if(this.vi=!f,c.json&&(h=c.json.quotaLimited)!=null&&h.includes(Ul.FeatureFlags))pe.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{var v;n.disable_flags||this.receivedFeatureFlags((v=c.json)!==null&&v!==void 0?v:{},f),this.hi&&(this.hi=!1,this.mi())}}})}}getFeatureFlag(e,t){var i;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}pe.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants(),s=e in i,n=i[e],a=this.getFlagPayloads()[e],o=String(n),l=this._instance.get_property(qn)||void 0,u=this._instance.get_property(Vn)||void 0,c=this._instance.get_property(bi)||{};if((t.send_event||!("send_event"in t))&&(!(e in c)||!c[e].includes(o))){var h,g,f,v,_,m,k,P,O;F(c[e])?c[e].push(o):c[e]=[o],(h=this._instance.persistence)==null||h.register({[bi]:c});var x=this.getFeatureFlagDetails(e),A={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:a||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((g=this._instance.config.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((f=this._instance.config.bootstrap)==null||(f=f.featureFlagPayloads)==null?void 0:f[e])||null,$used_bootstrap_value:!this.vi};b(x==null||(v=x.metadata)==null?void 0:v.version)||(A.$feature_flag_version=x.metadata.version);var V,L=(_=x==null||(m=x.reason)==null?void 0:m.description)!==null&&_!==void 0?_:x==null||(k=x.reason)==null?void 0:k.code;L&&(A.$feature_flag_reason=L),x!=null&&(P=x.metadata)!=null&&P.id&&(A.$feature_flag_id=x.metadata.id),b(x?.original_variant)&&b(x?.original_enabled)||(A.$feature_flag_original_response=b(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(O=x.metadata)!=null&&O.original_payload&&(A.$feature_flag_original_payload=x==null||(V=x.metadata)==null?void 0:V.original_payload),this._instance.capture("$feature_flag_called",A)}if(s){var T=a;if(!b(a))try{T=JSON.parse(a)}catch(ne){}return{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:T}}}else pe.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.pi()&&(s.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:Ue.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;t(o?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return b(i)?void 0:!!i}pe.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var h=Nl(a),g=h.flags,f=h.featureFlags,v=h.featureFlagPayloads;if(f){var _=a.requestId,m=a.evaluatedAt;if(F(f)){pe.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var k={};if(f)for(var P=0;P<f.length;P++)k[f[P]]=!0;o&&o.register({[cr]:f,[yt]:k})}else{var O=f,x=v,A=g;if(a.errorsWhileComputingFlags)if(g){var V=new Set(Object.keys(g).filter(L=>{var T;return!((T=g[L])!=null&&T.failed)}));O=E({},l,Object.fromEntries(Object.entries(O).filter(L=>{var[T]=L;return V.has(T)}))),x=E({},u,Object.fromEntries(Object.entries(x||{}).filter(L=>{var[T]=L;return V.has(T)}))),A=E({},c,Object.fromEntries(Object.entries(A||{}).filter(L=>{var[T]=L;return V.has(T)})))}else O=E({},l,O),x=E({},u,x),A=E({},c,A);o&&o.register(E({[cr]:Object.keys(Wn(O)),[yt]:O||{},[Bn]:x||{},[Mr]:A||{}},_?{[qn]:_}:{},m?{[Vn]:m}:{}))}}})(e,this._instance.persistence,i,s,n),this.wi(t)}}override(e,t){t===void 0&&(t=!1),pe.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return pe.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(pt),this._instance.persistence.unregister(Ft),this.wi(),$t.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.oi=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(pt),$t.info("Flag overrides cleared");else if(i.flags){if(F(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[pt]:s})}else this._instance.persistence.register({[pt]:i.flags});$t.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this._instance.persistence.unregister(Ft),$t.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[Ft]:i.payloads}),$t.info("Payload overrides set",{payloads:i.payloads}))),void this.wi()}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:i}=this.xi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(Ht)||[]).find(u=>u.flagKey===e),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var l=E({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[cr]:Object.keys(Wn(l)),[yt]:l}),this.wi()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(Ht),n=i?"&"+i.map(a=>"stage="+a).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:a=>{var o,l;if(a.json){var u=a.json.earlyAccessFeatures;return(o=this._instance.persistence)==null||o.unregister(Ht),(l=this._instance.persistence)==null||l.register({[Ht]:u}),e(u)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}wi(e){var{flags:t,flagVariants:i}=this.xi();this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(jt)||{};this._instance.register({[jt]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(jt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(nt)||{};Object.keys(i).length!==0&&Object.keys(i).forEach(s=>{i[s]=E({},i[s],e[s]),delete e[s]}),this._instance.register({[nt]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(nt)||{};this._instance.register({[nt]:E({},t,{[e]:{}})})}else this._instance.unregister(nt)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.bi(),this.oi=!1}},Hl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Gt=class{constructor(e,t){this.R=e,this.props={},this.Ei=!1,this.$i=(i=>{var s="";return i.token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.Si(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,E({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){Hl.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(s){s===void 0&&(s=[]);var n=[..._l,...s];return E({},j,{W:function(a){try{var o={};try{o=Re.W(a)||{}}catch(u){}var l=q(o,JSON.parse(j.q(a)||"{}"));return j.G(a,l),l}catch(u){}return null},G:function(a,o,l,u,c,h){try{j.G(a,o,void 0,void 0,h);var g={};n.forEach(f=>{o[f]&&(g[f]=o[f])}),Object.keys(g).length&&Re.G(a,g,l,u,c,h)}catch(f){j.B(f)}},V:function(a,o){try{d?.localStorage.removeItem(a),Re.V(a,o)}catch(l){j.B(l)}}})})(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return i==="localstorage"&&j.H()?j:i==="localstorage+cookie"&&t.H()?t:i==="sessionstorage"&&Z.H()?Z:i==="memory"?ml:i==="cookie"?Re:t.H()?t:Re}properties(){var e={};return N(this.props,function(t,i){if(i===yt&&z(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]];else o=i,l=!1,(Se(a=el)?l:nn&&a.indexOf===nn?a.indexOf(o)!=-1:(N(a,function(u){if(l||(l=u===o))return mi}),l))||(e[i]=t);var a,o,l}),e}load(){if(!this.ki){var e=this.Y.W(this.$i);e&&(this.props=q({},e))}}save(){this.ki||this.Y.G(this.$i,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.$i,!1),this.Y.V(this.$i,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(z(e)){b(t)&&(t="None"),this.Pi=b(i)?this.Ci:i;var s=!1;if(N(e,(n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.props[a]=n,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(z(e)){this.Pi=b(t)?this.Ci:t;var i=!1;if(N(e,(s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Ei){var e=qa(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);mt(Rs(e))||this.register(e),this.Ei=!0}}update_search_keyword(){var e;this.register((e=y?.referrer)?Wa(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ga(),$referring_domain:y!=null&&y.referrer&&((e=ki(y.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ur]||this.props[Hr]||this.register_once({[wi]:za(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};N([Hr,Ur],a=>{var o=this.props[a];o&&N(o,function(l,u){e["$initial_"+vr(u)]=l})});var t,i,s=this.props[wi];if(s){var n=(t=Ya(s),i={},N(t,function(a,o){i["$initial_"+vr(o)]=a}),i);q(e,n)}return e}safe_merge(e){return N(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((a,o)=>{if(a.length!==o.length)return!1;var l=[...a].sort(),u=[...o].sort();return l.every((c,h)=>c===u[h])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.Si(e),n=this.props;this.clear(),this.Y=s,this.props=n,this.save()}}set_disabled(e){this.ki=e,this.ki?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_secure(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ut]||{};i[e]=t,this.props[Ut]=i,this.save()}remove_event_timer(e){var t=(this.props[Ut]||{})[e];return b(t)||(delete this.props[Ut][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Gn=B("[Product Tours]"),ur="ph_product_tours",as=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[wn]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(wn)||this.it(()=>this.Oi())}it(e){var t,i;(t=S.__PosthogExtensions__)!=null&&t.generateProductTours?e():(i=S.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",s=>{s?Gn.error("Could not load product tours script",s):e()})}Oi(){var e;!this.Ri&&(e=S.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=S.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!F(this.Fi)||t){var i=this._instance.persistence;if(i){var s=i.props[ur];if(F(s)&&!t)return this.Fi=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:n=>{var a=n.statusCode;if(a!==200||!n.json){var o="Product Tours API could not be loaded, status: "+a;return Gn.error(o),void e([],{isLoaded:!1,error:o})}var l=F(n.json.product_tours)?n.json.product_tours:[];this.Fi=l,i&&i.register({[ur]:l}),e(l,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){C(this.Ri)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ri.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ri)==null||t.showTourById(e)}previewTour(e){this.Ri?this.Ri.previewTour(e):this.it(()=>{var t;this.Oi(),(t=this.Ri)==null||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Ri)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ri)==null||e.nextStep()}previousStep(){var e;(e=this.Ri)==null||e.previousStep()}clearCache(){var e;this.Fi=null,(e=this._instance.persistence)==null||e.unregister(ur)}resetTour(e){var t;(t=this.Ri)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ri)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ri)==null||t.cancelPendingTour(e)}},Mt=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),dc=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),pc=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),gc=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),hr=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),fc=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),vc=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),_c=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),qt=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),dr=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),os=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),D=B("[Surveys]"),io="seenSurvey_",jl=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},zn=r=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(io,r),Bl=[hr.Popover,hr.Widget,hr.API],ql={ignoreConditions:!1,ignoreDelay:!1,displayType:os.Popover},Kt=class{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter(i=>i!==t)}}emit(e,t){for(var i of this.Mi[e]||[])i(t);for(var s of this.Mi["*"]||[])s(e,t)}};function gt(r,e,t){if(C(r))return!1;switch(t){case"exact":return r===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch(s){return!1}default:return!1}}var ls=class{constructor(e){this.Ai=new Kt,this.ji=(t,i)=>this.Di(t,i)&&this.Li(t,i)&&this.Ni(t,i)&&this.Ui(t,i),this.Di=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!b((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook((i,s)=>{this.on(i,s)})}}register(e){var t,i;if(!b((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach(a=>{var o,l;(o=this.Hi)==null||o.add(a),(l=a.steps)==null||l.forEach(u=>{var c;(c=this.zi)==null||c.add(u?.event||"")})}),(i=this._instance)!=null&&i.autocapture)){var s,n=new Set;e.forEach(a=>{var o;(o=a.steps)==null||o.forEach(l=>{l!=null&&l.selector&&n.add(l?.selector)})}),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t?.event))&&this.Hi&&((i=this.Hi)==null?void 0:i.size)>0&&this.Hi.forEach(s=>{this.Bi(t,s)&&this.Ai.emit("actionCaptured",s.name)})}qi(e){this.onAction("actionCaptured",t=>e(t))}Bi(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.ji(e,i))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!s||typeof s!="string"||!gt(s,t.url,t.url_matching||"contains"))return!1}return!0}Ni(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var i;if(t==null||!t.href)return!0;var s=this.Ji(e);if(s.length>0)return s.some(o=>gt(o.href,t.href,t.href_matching||"exact"));var n,a=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!a&&gt((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Gi(e,t){var i;if(t==null||!t.text)return!0;var s=this.Ji(e);if(s.length>0)return s.some(u=>gt(u.text,t.text,t.text_matching||"exact")||gt(u.$el_text,t.text,t.text_matching||"exact"));var n,a,o,l=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!l&&(n=(function(u){for(var c,h=[],g=/(?::|")text="(.*?)"/g;!C(c=g.exec(u));)h.includes(c[1])||h.push(c[1]);return h})(l),a=t.text,o=t.text_matching||"exact",n.some(u=>gt(u,a,o)))}Vi(e,t){var i,s;if(t==null||!t.selector)return!0;var n=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch(o){return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||to(t.properties.reduce((i,s)=>{var n=F(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i},{}),e?.properties)}},cs=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&to(e.propertyFilters,t?.properties)}Zi(e,t){var i=new Map;return e.forEach(s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach(a=>{if(a!=null&&a.name){var o=i.get(a.name)||[];o.push(s.id),i.set(a.name,o)}})}),i}te(e,t,i){var s=(i===Mt.Activation?this.Ki:this.Yi).get(e),n=[];return this.ie(a=>{n=a.filter(o=>s?.includes(o.id))}),n.filter(a=>{var o,l=(o=a.conditions)==null||(o=o[i])==null||(o=o.values)==null?void 0:o.find(u=>u.name===e);return this.Qi(l,t)})}register(e){var t;b((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter(i=>{var s,n;return((s=i.conditions)==null?void 0:s.actions)&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0});t.length!==0&&(this.se==null&&(this.se=new ls(this._instance),this.se.init(),this.se.qi(i=>{this.onAction(i)})),t.forEach(i=>{var s,n,a,o,l;i.conditions&&(s=i.conditions)!=null&&s.actions&&(n=i.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=i.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.se)==null||o.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var c=this.Xi.get(u.name);c&&c.push(i.id),this.Xi.set(u.name,c||[i.id])}}))}))}ee(e){var t,i=e.filter(n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0}),s=e.filter(n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0});(i.length!==0||s.length!==0)&&((t=this._instance)==null||t._addCaptureHook((n,a)=>{this.onEvent(n,a)}),this.Ki=this.Zi(e,Mt.Activation),this.Yi=this.Zi(e,Mt.Cancellation))}onEvent(e,t){var i,s=this.ne(),n=this.oe(),a=this.ae(),o=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[n])||[];if(a===e&&t&&o.length>0){var l,u;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var c=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(u=t.properties)==null?void 0:u.$product_tour_id);if(c){var h=o.indexOf(c);h>=0&&(o.splice(h,1),this.le(o))}}else{if(this.Yi.has(e)){var g=this.te(e,t,Mt.Cancellation);g.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:g.map(v=>v.id)}),g.forEach(v=>{var _=o.indexOf(v.id);_>=0&&o.splice(_,1),this.ue(v.id)}),this.le(o))}if(this.Ki.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var f=this.te(e,t,Mt.Activation);this.le(o.concat(f.map(v=>v.id)||[]))}}}onAction(e){var t,i=this.oe(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[];this.Xi.has(e)&&this.le(s.concat(this.Xi.get(e)||[]))}le(e){var t,i=this.ne(),s=this.oe(),n=[...new Set(e)].filter(a=>!this.he(a));i.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[s]:n})}getActivatedIds(){var e,t=this.oe(),i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return i||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},us=class extends cs{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return qt.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return D}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},hs=class{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(C(t))return D.warn("Flags not loaded yet. Not loading surveys.");var i=F(t);this.ve=i?t.length>0:t,D.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(io)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(s=>localStorage.removeItem(s))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)D.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)D.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())D.info("Not loading surveys in cookieless mode without consent.");else{var e=S?.__PosthogExtensions__;if(e){if(!b(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var i=e.generateSurveys;if(i)return void this.ge(i,t);var s=e.loadExternalDependency;if(!s)return void this._e("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",n=>{n||!e.generateSurveys?this._e("Could not load surveys script",n):this.ge(e.generateSurveys,t)})}catch(n){throw this._e("Error initializing surveys",n),n}finally{this.ce=!1}}}else D.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new us(this._instance),D.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){D.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return D.info("Disabled. Not loading surveys."),e([]);var i,s=this._instance.get_property(Lr);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.pe?this.pe.then(n=>{var{surveys:a,context:o}=n;return e(a,o)}):(typeof Promise<"u"&&(this.pe=new Promise(n=>{i=n})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:n=>{var a;this.pe=null;var o=n.statusCode;if(o!==200||!n.json){var l="Surveys API could not be loaded, status: "+o;D.error(l);var u={isLoaded:!1,error:l};return e([],u),void(i==null||i({surveys:[],context:u}))}var c,h=n.json.surveys||[],g=h.filter(v=>(function(_){return!(!_.start_date||_.end_date)})(v)&&((function(_){var m;return!((m=_.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)})(v)||(function(_){var m;return!((m=_.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(v)));g.length>0&&((c=this._surveyEventReceiver)==null||c.register(g)),(a=this._instance.persistence)==null||a.register({[Lr]:h});var f={isLoaded:!0};e(h,f),i?.({surveys:h,context:f})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){D.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!C(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);D.warn("init was not called")}be(e){var t=null;return this.getSurveys(i=>{var s;t=(s=i.find(n=>n.id===e))!==null&&s!==void 0?s:null}),t}ye(e){if(C(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.be(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(C(this._surveyManager))return D.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ye(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return C(this._surveyManager)?(D.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(s=>{var n,a=(n=s.find(l=>l.id===e))!==null&&n!==void 0?n:null;if(a){var o=this.ye(a);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(C(this._surveyManager))D.warn("init was not called");else{var n=typeof e=="string"?this.be(e):e;if(n!=null&&n.id)if(Bl.includes(n.type)){var a=y?.querySelector(t);if(a)return(s=n.appearance)!=null&&s.surveyPopupDelaySeconds?(D.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,l;D.info("Rendering survey "+n.id+" with delay of "+((o=n.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(n,a,i),D.info("Survey "+n.id+" rendered")},1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,a,i);D.warn("Survey element not found")}else D.warn("Surveys of type "+n.type+" cannot be rendered in the app");else D.warn("Survey not found")}}displaySurvey(e,t){var i;if(C(this._surveyManager))D.warn("init was not called");else{var s=this.be(e);if(s){var n=s;if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=E({},s,{appearance:E({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==os.Popover&&t.initialResponses&&D.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var a=this.canRenderSurvey(s);if(!a.visible)return void D.warn("Survey is not eligible to be displayed: ",a.disabledReason)}t.displayType!==os.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else D.warn("Survey not found")}}cancelPendingSurvey(e){C(this._surveyManager)?D.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Me=B("[Conversations]"),ds=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;C(t)||(je(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=S?.__PosthogExtensions__;if(e&&!b(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var i=e.loadExternalDependency;if(!i)return void this.Se("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",s=>{s||!e.initConversations?this.Se("Could not load conversations script",s):this.$e(e.initConversations),this.xe=!1})}catch(s){this.Se("Error initializing conversations",s),this.xe=!1}}else Me.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),Me.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else Me.error("Cannot complete initialization: remote config is null")}Se(e,t){Me.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Me.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.we===!0&&!Se(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return _t(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Me.warn("Conversations not available yet."),null)})()}getMessages(e,t){var i=this;return _t(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Me.warn("Conversations not available yet."),null)})()}markAsRead(e){var t=this;return _t(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Me.warn("Conversations not available yet."),null)})()}getTickets(e){var t=this;return _t(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Me.warn("Conversations not available yet."),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},ps=class{constructor(e){var t;this.ke=!1,this.Pe=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.ke=!0)}onRemoteConfig(e){var t,i=(t=e.logs)==null?void 0:t.captureConsoleLogs;!C(i)&&i&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=B("[logs]"),t=S?.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",s=>{var n;s||(n=t.logs)==null||!n.initializeLogs?e.error("Could not load logs script",s):(t.logs.initializeLogs(this._instance),this.Pe=!0)}):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},Yn=B("[RateLimiter]"),gs=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{Yn.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void Yn.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,i,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:a}=this,o=new Date().getTime(),l=(t=(i=this.instance.persistence)==null?void 0:i.get_property(Nr))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var u=l.tokens<1;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=u,(s=this.instance.persistence)==null||s.set_property(Nr,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},st=B("[RemoteConfig]"),fs=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=S._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,i;(t=S.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=S.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(st.error("PostHog Extensions not found. Cannot load remote config."),e())}Ie(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return st.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.M())return void st.warn("Remote config is disabled. Falling back to local config.");this.Te(e=>{if(!e)return st.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ie(t=>{this.yi(t)});this.yi(e)})}catch(e){st.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):st.info("__preview_remote_config is disabled. Logging config instead",e):st.error("Failed to fetch remote config from PostHog.")}},vs=3e3,_s=class{constructor(e,t){this.Ce=!0,this.Re=[],this.Fe=Ce(t?.flush_interval_ms||vs,250,5e3,w.createLogger("flush interval"),vs),this.Oe=e}enqueue(e){this.Re.push(e),this.Me||this.Ae()}unload(){this.je();var e=this.Re.length>0?this.De():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.Oe(E({},i,{transport:"sendBeacon"}))})}enable(){this.Ce=!1,this.Ae()}Ae(){var e=this;this.Ce||(this.Me=setTimeout(()=>{if(this.je(),this.Re.length>0){var t=this.De(),i=function(){var n=t[s],a=new Date().getTime();n.data&&F(n.data)&&N(n.data,o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp}),e.Oe(n)};for(var s in t)i()}},this.Fe))}je(){clearTimeout(this.Me),this.Me=void 0}De(){var e={};return N(this.Re,t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;b(e[n])&&(e[n]=E({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)}),this.Re=[],e}},Vl=["retriesPerformedSoFar"],ms=class{constructor(e){this.Le=!1,this.Ne=3e3,this.Re=[],this._instance=e,this.Re=[],this.Ue=!0,!b(d)&&"onLine"in d.navigator&&(this.Ue=d.navigator.onLine,this.ze=()=>{this.Ue=!0,this.Lt()},this.He=()=>{this.Ue=!1},W(d,"online",this.ze),W(d,"offline",this.He))}get length(){return this.Re.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=ea(e,Vl);ft(t)&&(i.url=Ci(i.url,{retry_count:t})),this._instance._send_request(E({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.Be(E({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}Be(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)})(t),s=Date.now()+i;this.Re.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),w.warn(n),this.Le||(this.Le=!0,this.qe())}qe(){if(this.We&&clearTimeout(this.We),this.Re.length===0)return this.Le=!1,void(this.We=void 0);this.We=setTimeout(()=>{this.Ue&&this.Re.length>0&&this.Lt(),this.qe()},this.Ne)}Lt(){var e=Date.now(),t=[],i=this.Re.filter(n=>n.retryAt<e||(t.push(n),!1));if(this.Re=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.We&&(clearTimeout(this.We),this.We=void 0),this.Le=!1,b(d)||(this.ze&&(d.removeEventListener("online",this.ze),this.ze=void 0),this.He&&(d.removeEventListener("offline",this.He),this.He=void 0)),this.Re))try{this._instance._send_request(E({},e,{transport:"sendBeacon"}))}catch(t){w.error(t)}this.Re=[]}},ys=class{constructor(e){this.Ge=()=>{var t,i,s,n;this.Ve||(this.Ve={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),c=a?.scrollHeight||0;this.Ve.lastScrollY=Math.ceil(o),this.Ve.maxScrollY=Math.max(o,(t=this.Ve.maxScrollY)!==null&&t!==void 0?t:0),this.Ve.maxScrollHeight=Math.max(l,(i=this.Ve.maxScrollHeight)!==null&&i!==void 0?i:0),this.Ve.lastContentY=u,this.Ve.maxContentY=Math.max(u,(s=this.Ve.maxContentY)!==null&&s!==void 0?s:0),this.Ve.maxContentHeight=Math.max(c,(n=this.Ve.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.Ve}resetContext(){var e=this.Ve;return setTimeout(this.Ge,0),e}startMeasuringScrollPosition(){W(d,"scroll",this.Ge,{capture:!0}),W(d,"scrollend",this.Ge,{capture:!0}),W(d,"resize",this.Ge)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d?.document.documentElement;var e=F(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=d?.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}},Wl=r=>za(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),Fi=class{constructor(e,t,i,s){this.Je=n=>{var a=this.Ke();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.Ye(this._instance)};this.Xe.register({[Dr]:o})}},this._instance=e,this.Qe=t,this.Xe=i,this.Ye=s||Wl,this.Qe.onSessionId(this.Je)}Ke(){return this.Xe.props[Dr]}getSetOnceProps(){var e,t=(e=this.Ke())==null?void 0:e.props;return t?"r"in t?Ya(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return N(Rs(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+vr(i)]=t}),e}},pr=B("[SessionId]"),Mi=class{on(e,t){return this.Ze.on(e,t)}constructor(e,t,i){var s;if(this.tr=[],this.ir=void 0,this.Ze=new Kt,this.er=(c,h)=>!(!ft(c)||!ft(h))&&Math.abs(c-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Xe=e.persistence,this.rr=void 0,this.sr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.nr=t||Qe,this.ar=i||Qe;var n=this.R.persistence_name||this.R.token,a=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Ce(a,60,36e3,pr.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+n+"_window_id",this.hr="ph_"+n+"_primary_window_exists",this.dr()){var o=Z.W(this.ur),l=Z.W(this.hr);o&&!l?this.rr=o:Z.V(this.ur),Z.G(this.hr,!0)}if((s=this.R.bootstrap)!=null&&s.sessionID)try{var u=(c=>{var h=c.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.R.bootstrap.sessionID);this.vr(this.R.bootstrap.sessionID,new Date().getTime(),u)}catch(c){pr.error("Invalid sessionID in bootstrap",c)}this.cr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return b(this.tr)&&(this.tr=[]),this.tr.push(e),this.sr&&e(this.sr,this.rr),()=>{this.tr=this.tr.filter(t=>t!==e)}}dr(){return this.R.persistence!=="memory"&&!this.Xe.ki&&Z.H()}pr(e){e!==this.rr&&(this.rr=e,this.dr()&&Z.G(this.ur,e))}gr(){return this.rr?this.rr:this.dr()?Z.W(this.ur):null}vr(e,t,i){e===this.sr&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.sr=e,this.Xe.register({[yi]:[t,e,i]}))}_r(){var e=this.Xe.props[yi];return F(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.vr(null,null,null)}destroy(){clearTimeout(this.mr),this.mr=void 0,this.ir&&d&&(d.removeEventListener("beforeunload",this.ir,{capture:!1}),this.ir=void 0),this.tr=[]}cr(){this.ir=()=>{this.dr()&&Z.V(this.hr)},W(d,"beforeunload",this.ir,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[s,n,a]=this._r(),o=this.gr(),l=ft(a)&&Math.abs(i-a)>864e5,u=!1,c=!n,h=!c&&!e&&this.er(i,s);c||h||l?(n=this.nr(),o=this.ar(),pr.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),a=i,u=!0):o||(o=this.ar(),u=!0);var g=ft(s)&&e&&!l?s:i,f=ft(a)?a:new Date().getTime();return this.pr(o),this.vr(n,g,f),e||this.lr(),u&&this.tr.forEach(v=>v(n,o,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0)),{sessionId:n,windowId:o,sessionStartTimestamp:f,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}lr(){clearTimeout(this.mr),this.mr=setTimeout(()=>{var[e]=this._r();if(this.er(new Date().getTime(),e)){var t=this.sr;this.resetSessionId(),this.Ze.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}},Gl=["$set_once","$set"],Xe=B("[SiteApps]"),bs=class{constructor(e){this._instance=e,this.br=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}yr(e,t){if(t){var i=this.globalsForEvent(t);this.br.push(i),this.br.length>1e3&&(this.br=this.br.slice(10))}}get siteAppLoaders(){var e;return(e=S._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.yr.bind(this));this.wr=()=>{e(),this.br=[],this.wr=void 0}}}globalsForEvent(e){var t,i,s,n,a,o,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[g,f]of Object.entries(h))u[g]={id:c[g],type:g,properties:f};var{$set_once:v,$set:_}=e;return{event:E({},ea(e,Gl),{properties:E({},e.properties,_?{$set:E({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},_)}:{},v?{$set_once:E({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},v)}:{}),elements_chain:(a=(o=e.properties)==null?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var o;!t.errored&&this.br.length&&(Xe.info("Processing "+this.br.length+" events for site app with id "+e.id),this.br.forEach(l=>t.processEvent==null?void 0:t.processEvent(l)),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((o=this.wr)==null||o.call(this))},s=!1,n=o=>{t.errored=!o,t.loaded=!0,Xe.info("Site app with id "+e.id+" "+(o?"loaded":"errored")),s&&i()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:o=>{n(o)}});a&&(t.processEvent=a),s=!0}catch(o){Xe.error("Error while initializing PostHog app with config id "+e.id,o),n(!1)}if(s&&t.loaded)try{i()}catch(o){Xe.error("Error while processing buffered events PostHog app with config id "+e.id,o),t.errored=!0}}Er(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}$r(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(s){Xe.error("Error while processing event "+e.event+" for site app "+i.id,s)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Er(),void this._instance.on("eventCaptured",u=>this.$r(u))):void Xe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.wr)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(u){var c;S["__$$ph_site_app_"+u]=n._instance,(c=S.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(n._instance,l,h=>{if(h)return Xe.error("Error while initializing PostHog app with config id "+u,h)})};for(var{id:o,url:l}of e.siteApps)a(o)}else Xe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},ro=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&ln(t,e))return!0;try{var i=r?.userAgentData;if(i!=null&&i.brands&&i.brands.some(s=>ln(s?.brand,e)))return!0}catch(s){}return!!r.webdriver},Vt=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),Jn="i.posthog.com",ws=class{constructor(e){this.Sr={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Jn,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Sr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Vt.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Sr[this.apiHost]=Vt.EU:this.Sr[this.apiHost]=Vt.CUSTOM),this.Sr[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===Vt.CUSTOM)return this.apiHost+t;var i=Jn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}},zl={icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!d&&$i(e.href,r),not_regex:(r,e)=>!!d&&!$i(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},Es=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments(s=>{r.kr("retrieved web experiments from the server"),t.Pr=new Map,s.forEach(n=>{if(n.feature_flag_key){var a;t.Pr&&(r.kr("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.Pr)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);Y(o)&&n.variants[o]&&t.Tr(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];r.Ir(u)&&t.Tr(n.name,l,u.transforms)}})},i)},this._instance=e,this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}onFeatureFlags(e){if(this._is_bot())r.kr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(C(this.Pr))return this.Pr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();r.kr("applying feature flags",e),e.forEach(t=>{var i;if(this.Pr&&(i=this.Pr)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),a=(s=this.Pr)==null?void 0:s.get(t);n&&a!=null&&a.variants[n]&&this.Tr(a.name,n,a.variants[n].transforms)}})}}previewWebExperiment(){var e=r.getWindowLocation();if(e!=null&&e.search){var t=Pi(e?.search,"__experiment_id"),i=Pi(e?.search,"__experiment_variant");t&&i&&(r.kr("previewing web experiments "+t+" && "+i),this.getWebExperiments(s=>{this.Cr(parseInt(t),i,s)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var a=n.json.experiments||[];return e(a)}})}Cr(e,t,i){var s=i.filter(n=>n.id===e);s&&s.length>0&&(r.kr("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Tr(s[0].name,t,s[0].variants[t].transforms))}static Ir(e){return!C(e.conditions)&&r.Rr(e)&&r.Fr(e)}static Rr(e){var t;if(C(e.conditions)||C((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,a=r.getWindowLocation();return!!a&&((i=e.conditions)==null||!i.url||zl[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,a))}static getWindowLocation(){return d?.location}static Fr(e){var t;if(C(e.conditions)||C((t=e.conditions)==null?void 0:t.utm))return!0;var i=qa();if(i.utm_source){var s,n,a,o,l,u,c,h,g=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,f=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==i.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==i.utm_medium,_=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return g&&v&&_&&f}return!1}static kr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];w.info("[WebExperiments] "+e,i)}Tr(e,t,i){this._is_bot()?r.kr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach(s=>{if(s.selector){var n;r.kr("applying transform of variant "+t+" for experiment "+e+" ",s);var a=(n=document)==null?void 0:n.querySelectorAll(s.selector);a?.forEach(o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)})}}):r.kr("Control variants leave the page unmodified.")}_is_bot(){return ge&&this._instance?ro(ge,this._instance.config.custom_blocked_useragents):void 0}},Yl=B("[PostHog ExternalIntegrations]"),Jl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},xs=class{constructor(e){this._instance=e}it(e,t){var i;(i=S.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,s=>{if(s)return Yl.error("failed to load script",s);t()})}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,u;!s||(o=S.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.it(Jl[a],()=>{var c;(c=S.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.start(e._instance)}),!s&&(l=S.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((u=S.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.stop())};for(var[i,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(i)}}},Ss="[SessionRecording]",Lt=B(Ss),Li=class{get started(){var e;return!((e=this.Or)==null||!e.isStarted)}get status(){return this.Or?this.Or.status:this.Mr&&!this.Ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Mr=!1,this.jr=void 0,this._instance=e,!this._instance.sessionManager)throw Lt.error("started without valid sessionManager"),new Error(Ss+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Ss+' cannot be used with cookieless_mode="always"')}get Ar(){var e,t=!((e=this._instance.get_property(er))==null||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.Ar||(t=this.Or)==null||!t.isStarted){var i=!b(Object.assign)&&!b(Array.from);this.Ar&&i?(this.Dr(e),Lt.info("starting")):this.stopRecording()}}Dr(e){var t,i,s;this.Ar&&(S!=null&&(t=S.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=S.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Lr(e):(s=S.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Nr,n=>{if(n)return Lt.error("could not load recorder",n);this.Lr(e)}))}stopRecording(){var e,t;(e=this.jr)==null||e.call(this),this.jr=void 0,(t=this.Or)==null||t.stop()}Ur(){var e;(e=this._instance.persistence)==null||e.unregister(Pa)}zr(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,n=()=>{var a=e.sessionRecording===!1?void 0:e.sessionRecording,o=a?.sampleRate,l=C(o)?null:parseFloat(o);C(l)&&this.Ur();var u=a?.minimumDurationMilliseconds;s.register({[er]:E({enabled:!!a},a,{networkPayloadCapture:E({capturePerformance:e.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:b(u)?null:u,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers})})};n(),(t=this.jr)==null||t.call(this),this.jr=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.zr(e),this.Mr=!0,this.startIfEnabledOrStop()):this.Mr=!0:Lt.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.Or)!=null&&i.log?this.Or.log(e,t):Lt.warn("log called before recorder was ready")}get Nr(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(er);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Lr(e){var t,i;if((t=S.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Or||(this.Or=(i=S.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.Or._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Or.start(e)}onRRwebEmit(e){var t;(t=this.Or)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Or)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Or||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Or)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.Or||(i=this._instance.persistence)==null||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Or)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Or)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.Or)==null||!i.tryAddCustomEvent(e,t))}},zt={},ks=()=>{},vt="posthog",so=!Dl&&oe?.indexOf("MSIE")===-1&&oe?.indexOf("Mozilla")===-1,Xn=r=>{var e;return E({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ko(y?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ks,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:le&&Y(le?.search)&&le.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;w.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:vs},error_tracking:{},_onCapture:ks,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body"}))(r))},Zn=r=>{var e={};b(r.process_person)||(e.person_profiles=r.process_person),b(r.xhr_headers)||(e.request_headers=r.xhr_headers),b(r.cookie_name)||(e.persistence_name=r.cookie_name),b(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),b(r.store_google)||(e.save_campaign_params=r.store_google),b(r.verbose)||(e.debug=r.verbose);var t=q({},e,r);return F(r.property_blacklist)&&(b(r.property_denylist)?t.property_denylist=r.property_blacklist:F(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:w.error("Invalid value for property_denylist config: "+r.property_denylist)),t},Ps=class{constructor(){this.__forceAllowLocalhost=!1}get Hr(){return this.__forceAllowLocalhost}set Hr(e){w.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Di=class r{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Ps,this.Br=!1,this.version=Le.LIB_VERSION,this.qr=new Kt,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Xn(),this.SentryIntegration=Jr,this.sentryIntegration=e=>(function(t,i){var s=Ba(t,i);return{name:ja,processEvent:n=>s(n)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new ns(this),this.toolbar=new Xr(this),this.scrollManager=new ys(this),this.pageViewManager=new Ai(this),this.surveys=new hs(this),this.conversations=new ds(this),this.logs=new ps(this),this.experiments=new Es(this),this.exceptions=new ss(this),this.rateLimiter=new gs(this),this.requestRouter=new ws(this),this.consent=new Gr(this),this.externalIntegrations=new xs(this),this.people={set:(e,t,i)=>{var s=Y(e)?{[e]:t}:e;this.setPersonProperties(s),i?.({})},set_once:(e,t,i)=>{var s=Y(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i?.({})}},this.on("eventCaptured",e=>w.info('send "'+e?.event+'"',e))}init(e,t,i){if(i&&i!==vt){var s,n=(s=zt[i])!==null&&s!==void 0?s:new r;return n._init(e,t,i),zt[i]=n,zt[vt][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s;if(t===void 0&&(t={}),b(e)||_r(e))return w.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=!0,this.config={},t.debug=this.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(q({},Xn(t.defaults),Zn(t),{name:i,token:e})),this.config.on_xhr_error&&w.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Ue.GZipJS;var n=this.Qr();this.persistence=new Gt(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Gt(E({},this.config,{persistence:"sessionStorage"}),n);var a=E({},this.persistence.props),o=E({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new _s(P=>this.ts(P),this.config.request_queue_config),this.es=new ms(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new Mi(this),this.sessionPropsManager=new Fi(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(w.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.rs(l)},0)):(w.info("Initializing extensions synchronously"),this.rs(l)),Le.DEBUG=Le.DEBUG||this.config.debug,Le.DEBUG&&w.info("Starting in debug mode",{this:this,config:t,thisC:E({},this.config),p:a,s:o}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,c,h=this.config.get_device_id(Qe()),g=(u=t.bootstrap)!=null&&u.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(De,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:g})}if(this.ss()){var f,v,_=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter(P=>{var O;return!((O=t.bootstrap)==null||(O=O.featureFlags)==null||!O[P])}).reduce((P,O)=>{var x;return P[O]=((x=t.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[O])||!1,P},{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter(P=>_[P]).reduce((P,O)=>{var x,A;return(x=t.bootstrap)!=null&&(x=x.featureFlagPayloads)!=null&&x[O]&&(P[O]=(A=t.bootstrap)==null||(A=A.featureFlagPayloads)==null?void 0:A[O]),P},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:It,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(Qe());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(De,"anonymous")}return W(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?wl(this,()=>this.ns()):this.ns(),Ke(this.config._onCapture)&&this.config._onCapture!==ks&&(w.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",P=>this.config._onCapture(P.event,P))),this.config.ip&&w.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}rs(e){var t=performance.now();this.historyAutocapture=new Yr(this),this.historyAutocapture.startIfEnabled();var i=[];i.push(()=>{new Zr(this).startIfEnabledOrStop()}),i.push(()=>{var s;this.siteApps=new bs(this),(s=this.siteApps)==null||s.init()}),e||i.push(()=>{this.sessionRecording=new Li(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.push(()=>{this.autocapture=new Br(this),this.autocapture.startIfEnabled()}),i.push(()=>{this.surveys.loadIfEnabled()}),i.push(()=>{this.logs.loadIfEnabled()}),i.push(()=>{this.conversations.loadIfEnabled()}),i.push(()=>{this.productTours=new as(this),this.productTours.loadIfEnabled()}),i.push(()=>{this.heatmaps=new Kr(this),this.heatmaps.startIfEnabled()}),i.push(()=>{this.webVitalsAutocapture=new Qr(this)}),i.push(()=>{this.exceptionObserver=new zr(this),this.exceptionObserver.startIfEnabledOrStop()}),i.push(()=>{this.deadClicksAutocapture=new Ii(this,bl),this.deadClicksAutocapture.startIfEnabled()}),i.push(()=>{if(this.os){var s=this.os;this.os=void 0,this.yi(s)}}),this.ls(i,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.ls(e,t)},0);var i=e.shift();if(i)try{i()}catch(n){w.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&w.info("PostHog extensions initialized ("+s+"ms)")}yi(e){var t,i,s,n,a,o,l,u,c;if(!y||!y.body)return w.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.yi(e)},500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=R(e.supportedCompression,Ue.GZipJS)?Ue.GZipJS:R(e.supportedCompression,Ue.Base64)?Ue.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(o=this.productTours)==null||o.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(u=this.exceptionObserver)==null||u.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(e){w.critical("`loaded` function failed",e)}this.us(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.hs()},1),new fs(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&et(this.__request_queue,e=>this.ts(e)),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(so?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ci(e.url,{ip:this.config.ip?1:0}),e.headers=E({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,s,n,a=E({},t);a.timeout=a.timeout||6e4,a.url=Ci(a.url,{_:new Date().getTime().toString(),ver:Le.LIB_VERSION,compression:a.compression});var o=(i=a.transport)!==null&&i!==void 0?i:"fetch",l=fi.filter(c=>!a.disableTransport||!c.transport||!a.disableTransport.includes(c.transport)),u=(s=(n=xa(l,c=>c.transport===o))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");u(a)})(E({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(s=this.config).on_request_error)==null||i.call(s,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],s=[],n=[];et(e,o=>{o&&(t=o[0],F(t)?n.push(o):Ke(o)?o.call(this):F(o)&&t==="alias"?i.push(o):F(o)&&t.indexOf("capture")!==-1&&Ke(this[t])?n.push(o):s.push(o))});var a=function(o,l){et(o,function(u){if(F(u[0])){var c=l;N(u,function(h){c=c[h[0]].apply(c,h.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};a(i,this),a(s,this),a(n,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!b(e)&&Y(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var a=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!Y(t?.$current_url)&&(w.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),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 o=new Date,l=i?.timestamp||o,u=Qe(),c={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},l,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),a&&(c.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),i?.$set&&(c.$set=i?.$set);var h,g=e!=="$groupidentify",f=this.vs(i?.$set_once,g);if(f&&(c.$set_once=f),(c=Zo(c,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,b(i?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===qt.DISMISSED||e===qt.SENT){var v=t?.[dr.SURVEY_ID],_=t?.[dr.SURVEY_ITERATION];h={id:v,current_iteration:_},localStorage.getItem(zn(h))||localStorage.setItem(zn(h),"true"),c.$set=E({},c.$set,{[jl({id:v,current_iteration:_},e===qt.SENT?"responded":"dismissed")]:!0})}else e===qt.SHOWN&&(c.$set=E({},c.$set,{[dr.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=E({},c.properties.$set,c.$set);if(mt(m)||this.setPersonPropertiesForFlags(m),!C(this.config.before_send)){var k=this.cs(c);if(!k)return;c=k}this.qr.emit("eventCaptured",c);var P={method:"POST",url:(s=i?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:i?._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.ts(P):this.Zr.enqueue(P),c}w.critical("This capture call is ignored due to client rate limiting.")}}else w.error("No event name provided to posthog.capture")}else w.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=E({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=E({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!Y(o.distinct_id)&&!Be(o.distinct_id)||_r(o.distinct_id))&&w.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,c=Tl(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());o.$session_id=h,o.$window_id=g}this.sessionPropsManager&&q(o,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&q(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(f=this.es)==null?void 0:f.length}catch(k){o.$sdk_debug_error_capturing_properties=String(k)}if(this.requestRouter.region===Vt.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=q(o,u),e==="$pageview"&&y&&(o.title=y.title),!b(a)){var v=i.getTime()-a;o.$duration=parseFloat((v/1e3).toFixed(3))}oe&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=q({},c,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),F(this.config.property_denylist)?N(this.config.property_denylist,function(k){delete o[k]}):w.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(w.error("sanitize_properties is deprecated. Use before_send instead"),o=_(o,e));var m=this.fs();return o.$process_person_profile=m,m&&!n&&this.ps("_calculate_event_properties"),o}vs(e,t){var i;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.Br)return e;var s=this.persistence.get_initial_props(),n=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=q({},s,n||{},e||{}),o=this.config.sanitize_properties;return o&&(w.error("sanitize_properties is deprecated. Use before_send instead"),a=o(a,"$set_once")),t&&(this.Br=!0),mt(a)?void 0:a}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)==null||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var s=i!=null&&i.merge?this.featureFlags.getFlagVariants():{},n=i!=null&&i.merge?this.featureFlags.getFlagPayloads():{},a=E({},s,e),o=E({},n,t),l={};for(var[u,c]of Object.entries(a)){var h=typeof c=="string";l[u]={key:u,enabled:!!h||!!c,variant:h?c:void 0,reason:void 0,metadata:b(o?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:o[u]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.qr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=ql),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return w.uninitializedWarning("posthog.identify");if(Be(e)&&(e=e.toString(),w.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==It){if(this.ps("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(Nt)&&(this.unregister(Nt),this.register({distinct_id:e}));var a=(this.persistence.get_property(De)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(De,"identified"),this.setPersonPropertiesForFlags(E({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Jr=jn(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(bi))}}else w.critical('The string "'+It+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else w.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var i=jn(this.get_distinct_id(),e,t);this.Jr!==i?(this.setPersonPropertiesForFlags(E({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=i):w.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:E({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}else w.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(w.info("reset"),!this.__loaded)return w.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(De,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:It,$device_id:null},"");else{var o=this.config.get_device_id(Qe());this.register_once({distinct_id:o,$device_id:e?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return s}alias(e,t){return e===this.get_property(Sa)?(w.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(b(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(Nt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(w.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=E({},this.config);if(z(e)){var i,s,n,a,o,l,u;q(this.config,Zn(e));var c=this.Qr();(i=this.persistence)==null||i.update_config(this.config,t,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Gt(E({},this.config,{persistence:"sessionStorage"}),c);var h=this.Kr(this.config.debug);je(h)&&(this.config.debug=h),je(this.config.debug)&&(this.config.debug?(Le.DEBUG=!0,j.H()&&j.G("ph_debug","true"),w.info("set_config",{config:e,oldConfig:t,newConfig:E({},this.config)})):(Le.DEBUG=!1,j.H()&&j.V("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this._s(),(u=this.externalIntegrations)==null||u.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,a,o,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),i.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),i.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(E({},s,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:vt;return t!==vt&&(t=vt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(De))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(De))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&mt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Nt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Ei]))}ds(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}ps(e){return this.config.person_profiles==="never"?(w.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(Ei,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,i,s,n=this.Qr();return((e=this.persistence)==null?void 0:e.ki)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.ki)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var i,s,n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new Mi(this),this.pageViewManager=new Ai(this),this.persistence&&(this.sessionPropsManager=new Fi(this,this.sessionManager,this.persistence)),this.sessionRecording=new Li(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(b(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e?.captureEventName)!==null&&n!==void 0?n:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else w.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:It,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(i=this.sessionRecording)==null||i.stopRecording(),this.sessionRecording=void 0,this.hs())):w.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Ne.GRANTED?"granted":e===Ne.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return ge?ro(ge,this.config.custom_blocked_useragents):void 0}hs(){y&&(y.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:y.title},{send_instantly:!0}),this.Gr&&(y.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),W(y,"visibilitychange",this.Gr)))}debug(e){e===!1?(d?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(d?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,i,s,n,a,o,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(w.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=!1,n=w,a=(t="advanced_disable_flags")in(e=l)&&!C(e[t]),o=i in e&&!C(e[i]),a?e[t]:o?(n&&n.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):s)}cs(e){if(C(this.config.before_send))return e;var t=F(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),C(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return So(e.event)?w.warn(n+". This can cause unexpected behavior."):w.info(n),null}i.properties&&!mt(i.properties)||w.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Kr(e){var t=je(e)&&!e,i=j.H()&&j.q("ph_debug")==="true";return!t&&(!!i||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=Xo(r.prototype[e[t]])})(Di,["identify"]);var Qn;var se=(Qn=zt[vt]=new Di,(function(){function r(){r.done||(r.done=!0,so=!1,N(zt,function(e){e._dom_loaded()}))}y!=null&&y.addEventListener?y.readyState==="complete"?r():W(y,"DOMContentLoaded",r,{capture:!1}):d&&w.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Qn);var no="[REDACTED]";var Xl=new Set(["authorization","refresh","password","pin","pincode","pindata","otp","otpcode","authcode","setupcode","magiccode","verificationcode","recoverycode","sessionid","checkoutsessionid","ghostuid","uidrecovery","passwordrecoveryuid","sid"]),Zl=
4/\bcs_[a-zA-Z0-9_=-]+/g,Ql=/((?:https?:\/\/|\/)[^\s?#]+)[?#][^\s]*/g;function lt(r){return ri(String(r??""))}function ao(r){return Ds(r,void 0,0,new WeakSet)}function Ds(r,e,t,i){if(e&&Kl(e))return no;if(r==null||typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return ri(r);if(t>=8)return"[REDACTED_DEPTH]";if(Array.isArray(r))return r.map(n=>Ds(n,void 0,t+1,i));if(typeof r!="object")return String(r);if(i.has(r))return"[REDACTED_CYCLE]";if(i.add(r),r instanceof Error)return{name:ri(r.name),message:ri(r.message),stack:ri(r.stack??"")};let s={};for(let[n,a]of Object.entries(r))s[n]=Ds(a,n,t+1,i);return s}function ri(r){return r.replace(Zl,no).replace(Ql,"$1")}function Kl(r){let e=r.replace(/[_-]/g,"").toLowerCase();return Xl.has(e)||e.endsWith("token")}var oo=(()=>{class r{ngZone=G(zs);platformService=G(Zs);forceDisable=!1;host="https://us.i.posthog.com";personProperties={};globalContext={};normalizeUrl(t){if(!t)return t;try{let i=new URL(t);return`${ze.app_domain}${i.pathname}`}catch(i){return lt(t)}}get isEnabled(){return this.forceDisable?!1:ze.posthog?.enabled??!1}initialize(){this.isEnabled&&this.ngZone.runOutsideAngular(()=>{try{se.init(ze.posthog.apiKey,{api_host:this.host,api_transport:"XHR",defaults:"2025-11-30",person_profiles:"always",autocapture:!0,enable_heatmaps:!0,loaded:()=>{},disable_session_recording:!1,disable_surveys:!0,disable_product_tours:!0,secure_cookie:!this.platformService.isNative(),capture_pageview:"history_change",disable_compression:!0,advanced_disable_flags:!1,capture_exceptions:{capture_unhandled_errors:!0,capture_unhandled_rejections:!0,capture_console_errors:!1},logs:{captureConsoleLogs:!0},enable_recording_console_log:!0,before_send:t=>{if(!t)return t;if(t.event==="$log"){let i=t.properties?.level??"";if(i!=="warn"&&i!=="warning"&&i!=="error")return null}if(t.event==="$exception"){let i=t.properties?.$exception_message||t.properties?.error_message||"";if(this.shouldDropError(i))return null;let s=t.properties?.$exception_list?.[0]?.stacktrace?.frames||[];if(r.isAndroidBridgeUnimplemented(i,s)||s.some(a=>r.THIRD_PARTY_DOMAINS.some(o=>a.filename?.includes(o)||a.source?.includes(o))))return null}if(t.properties?.$current_url){let i=t.properties.$current_url;t.properties.$current_url=this.platformService.isNative()?this.normalizeUrl(i):lt(i),this.platformService.isNative()&&(t.properties.$original_url=lt(i))}for(let i of["$referrer","referrer","url"])t.properties?.[i]&&(t.properties[i]=lt(t.properties[i]));return t},session_recording:{captureCanvas:{recordCanvas:!0},blockClass:/sentry-block|sentry-ignore|ph-no-capture/,maskTextClass:/sentry-mask|ph-mask/,ignoreClass:/sentry-ignore|ph-ignore-input/,inlineImages:!0}}),se.register({platform:this.platformService.getPlatform(),$app_version:li,environment:tn[ze.name]}),se.startSessionRecording(!0)}catch(t){console.warn("[PostHog] Setup error - PosthogService.initialize")}})}getDistinctId(){if(!this.isEnabled)return null;try{return se.get_distinct_id()||null}catch(t){return null}}capture(t,i){return p(this,null,function*(){this.isEnabled&&this.ngZone.runOutsideAngular(()=>{se.capture(`${t}`,me(J(J({},this.globalContext),i),{platform:this.platformService.getPlatform()}))})})}setUser(t,i,s){this.isEnabled&&this.ngZone.runOutsideAngular(()=>{try{if(!t){se.reset(),this.personProperties={};return}let n,a=J({},i);typeof t=="string"?n=t:(n=t.id||"",t.email&&(a.$email=t.email),t.username&&(a.$name=t.username),Object.keys(t).forEach(l=>{l!=="id"&&!a[l]&&(a[l]=t[l])})),this.personProperties=J(J({},this.personProperties),a);let o=me(J({},a),{platform:this.platformService.getPlatform()});s?se.identify(n,o,s):se.identify(n,o)}catch(n){console.warn("[PostHog] Error setting user - PosthogService.setUser")}})}setTag(t,i){this.isEnabled&&this.ngZone.runOutsideAngular(()=>{try{this.personProperties[t]=i,se.setPersonProperties({[t]:i}),this.globalContext[t]=i}catch(s){console.warn("[PostHog] Error setting tag - PosthogService.setTag")}})}setContext(t,i){this.isEnabled&&this.ngZone.runOutsideAngular(()=>{try{if(i===null){delete this.globalContext[t];return}this.globalContext[t]=i;let s={};
4Object.keys(i).forEach(n=>{s[`${t}_${n}`]=i[n]}),se.setPersonProperties(s)}catch(s){console.warn("[PostHog] Error setting context - PosthogService.setContext")}})}addBreadcrumb(t){this.isEnabled&&this.ngZone.runOutsideAngular(()=>{try{se.capture("$breadcrumb",me(J(me(J({},this.globalContext),{category:t.category||"default",message:t.message||"",level:t.level||"info"}),t.data),{platform:this.platformService.getPlatform(),timestamp:new Date().toISOString()}))}catch(i){console.warn("[PostHog] Error adding breadcrumb - PosthogService.addBreadcrumb")}})}captureException(t,i){if(!this.isEnabled)return"";try{let s=me(J({},this.globalContext),{platform:this.platformService.getPlatform()});if(i?.tags)for(let[n,a]of Object.entries(i.tags))s[`tag_${n}`]=a;if(i?.contexts){for(let[n,a]of Object.entries(i.contexts))if(typeof a=="object"&&a!==null)for(let[o,l]of Object.entries(a))s[`context_${n}_${o}`]=l}return this.ngZone.runOutsideAngular(()=>{se.captureException(t,s)}),""}catch(s){return console.warn("[PostHog] Error capturing exception - PosthogService.captureException"),""}}captureMessage(t,i){if(!this.isEnabled)return"";try{let s=me(J({},this.globalContext),{message:t,level:i?.level||"info",platform:this.platformService.getPlatform()});if(i?.tags)for(let[n,a]of Object.entries(i.tags))s[`tag_${n}`]=a;if(i?.contexts){for(let[n,a]of Object.entries(i.contexts))if(typeof a=="object"&&a!==null)for(let[o,l]of Object.entries(a))s[`context_${n}_${o}`]=l}return this.ngZone.runOutsideAngular(()=>{se.capture("$message",s)}),""}catch(s){return console.warn("[PostHog] Error capturing message - PosthogService.captureMessage"),""}}logInfo(t,i){this.captureLog("info",t,i)}logWarning(t,i){this.captureLog("warning",t,i)}logError(t,i){this.captureLog("error",t,i)}captureLog(t,i,s){if(!this.isEnabled)return;let l=s??{},{level:n,message:a}=l,o=Vs(l,["level","message"]);this.ngZone.runOutsideAngular(()=>{try{se.capture("$log",me(J(J({},this.globalContext),o),{level:t,message:i,platform:this.platformService.getPlatform()}))}catch(u){console.warn("[PostHog] Error capturing log - PosthogService.captureLog")}})}static THIRD_PARTY_DOMAINS=["posthog.com","ingest.sentry.io"];static IGNORE_PATTERNS=[/Non-Error promise rejection captured/,/ResizeObserver loop/i,/ChunkLoadError/,/Loading chunk \d+ failed/,/Failed to fetch dynamically imported module/,/Connection reset/,/Operation timed out/,/The Internet connection appears to be offline/,/Network request failed/,/network error/i,/Access is denied for this document/,/Failed to read the '(sessionStorage|localStorage)' property/,/break through the security policy/i,/AbortError.*user aborted/i];shouldDropError(t){return t?r.IGNORE_PATTERNS.some(i=>i.test(t)):!1}static isAndroidBridgeUnimplemented(t,i){return t!=="not implemented"?!1:i.some(s=>(s.function??s.functionName??"").includes("androidBridge.onmessage"))}static \u0275fac=function(i){return new(i||r)};static \u0275prov=ye({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function ke(r,e){if(r==null||r===""||r==="undefined"||r==="null")return e;try{return JSON.parse(r)}catch(t){return e}}var K=(function(r){return r[r.Info=0]="Info",r[r.Warning=1]="Warning",r[r.Error=2]="Error",r})(K||{}),ec=(function(r){return r.CreateLinkToken="CreateLinkToken",r.LinkAccounts="LinkAccounts",r})(ec||{}),ji=(function(r){return r[r.Ghost=0]="Ghost",r[r.Demo=1]="Demo",r[r.Impersonated=2]="Impersonated",r})(ji||{}),ct=(()=>{class r{device=G(Qs);posthogService=G(oo);static ApiPath="/api/AppLog/";static FlushIntervalMs=600*1e3;static MaxAttempt=10;deviceInfoCache=null;getStoredErrors(){let t=localStorage.getItem(I(X.pendingClientLogs));return ke(t,[])}pushLogData(c,h,g,f){return p(this,arguments,function*(t,i,s,n,a=K.Error,o=null,l=null,u=null){let v=yield this.getDeviceInfo(),m=!(yield ce.get(I(X.token),!1,fe.SessionStorage)),P=(yield ce.get(I(X.loginType)))===`${Ji.GhostUser}`,O=yield ce.get(I(X.userReference)),x;m&&(x=ke(O,{}).userReferenceUid);let A=yield ce.get(I(X.uid)),V=li,L=null;P&&(L=ji.Ghost);let T={id:Ks(),level:a,device:v,version:V,observation:t,additionalInfo:this.serializeAdditionalInfo(s),userReferenceUid:x,userAs:L,callStack:i,url:n,clientCreatedAt:Date.now(),userUid:A??void 0,tracingUid:o,tracerId:l,aggregatorId:u},ne=this.getStoredErrors();ne.push(T),this.saveStoredErrors(ne),this.sendToPostHog(T,s)})}sendToPostHog(t,i){return p(this,null,function*(){try{let s={call_stack:t.callStack||"unknown",device:t.device,version:t.version||void 0,user_uid:t.userUid,url:t.url||void 0,tracing_uid:t.tracingUid||void 0,tracer_id:t.tracerId||void 0,aggregator_id:t.aggregatorId||void 0,user_as:typeof t.userAs=="number"?ji[t.userAs]:"normal",client_created_at:t.clientCreatedAt?new Date(t.clientCreatedAt).toISOString():void 0,additional_info:t.additionalInfo,log_entry_id:t.id,user_reference_uid:t.userReferenceUid||void 0},n=this.mapLevel(t.level);if(t.level<K.Error){this.posthogService.addBreadcrumb({category:"app-log",message:`${t.callStack}: ${t.observation}`,level:n,data:{device:t.device,version:t.version||void 0,userUid:t.userUid,url:t.url||void 0,tracingUid:t.tracingUid||void 0,tracerId:t.tracerId||void 0,aggregatorId:t.aggregatorId||void 0}}),t.level===K.Info?this.posthogService.logInfo(t.observation,s):this.posthogService.logWarning(t.observation,s);return}let a={source:"AppLogService",call_stack:t.callStack||"unknown",device:t.device,version:t.version||"unknown",user_as:typeof t.userAs=="number"?ji[t.userAs]:"normal",tracing_uid:t.tracingUid||void 0,tracer_id:t.tracerId||void 0,aggregator_id:t.aggregatorId||void 0},o={log_entry:{id:t.id,level:K[t.level],user_reference_uid:t.userReferenceUid||void 0}};i&&(i instanceof Error||i?.stack)?this.posthogService.captureException(i,{tags:a,contexts:o}):this.posthogService.captureMessage(t.observation,{level:n,tags:a,contexts:o}),this.posthogService.logError(t.observation,s)}catch(s){console.error("[PostHog] Failed to send log")}})}mapLevel(t){switch(t){case K.Info:return"info";case K.Warning:return"warning";case K.Error:default:return"error"}}saveStoredErrors(t){localStorage.setItem(I(X.pendingClientLogs),JSON.stringify(t))}serializeAdditionalInfo(t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(typeof t=="object"&&t!==null)try{return JSON.parse(JSON.stringify(t))}catch(i){return{message:"Non-serializable object",type:typeof t}}return{message:String(t),type:typeof t}}clearErrorsWhenSuccessfull(t){let s=this.getStoredErrors().filter(n=>
4!t.includes(n.id));this.saveStoredErrors(s)}clearErrorsWhenError(t){let n=this.getStoredErrors().map(a=>t.includes(a.id)?me(J({},a),{attempts:(a.attempts??0)+1}):a).filter(a=>(a.attempts??0)<r.MaxAttempt);this.saveStoredErrors(n)}getDeviceInfo(){return p(this,null,function*(){return this.deviceInfoCache||(yield this.device.getDeviceInfo(!0).then(t=>this.deviceInfoCache=t)),this.deviceInfoCache||"unknown"})}static \u0275fac=function(i){return new(i||r)};static \u0275prov=ye({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var Tt=oi("ChatStreamPlugin");var qi=(()=>{class r{http=G(Js);injector=G(Gs);router=G(Xs);appLogHelperService=G(ct);static DEMO_ACCOUNT_ERROR_CODE=1024;transformData=t=>JSON.stringify(t);userService;UserServiceClass;refreshTokenTimeoutInstance;refreshTokenPromise=null;visibilityListenerRegistered=!1;visibilityChangeHandler=()=>p(this,null,function*(){if(document.visibilityState==="visible")try{let t=yield Bi();if(!t)return;new Date(t).getTime()-Date.now()<300*1e3&&(yield this.triggerRefresh(),yield this.setRefreshTokenTimeout())}catch(t){}});constructor(){typeof document<"u"&&!de.isNativePlatform()&&(document.addEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityListenerRegistered=!0)}ngOnDestroy(){this.visibilityListenerRegistered&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityListenerRegistered=!1),this.destroyRefreshTokenTimeout()}getUserServiceClass(){return p(this,null,function*(){if(!this.UserServiceClass){let t=yield import("./chunk-CKDTKKEA.js");this.UserServiceClass=t.UserService}return this.UserServiceClass})}getWebSessionBootstrap(){return p(this,null,function*(){let t=yield import("./chunk-5E77SPVL.js");return this.injector.get(t.WebSessionBootstrapService)})}triggerRefresh(){return p(this,null,function*(){if(de.isNativePlatform()){let t=yield this.getUserServiceClass();yield this.injector.get(t).refreshToken(!0)}else yield(yield this.getWebSessionBootstrap()).ensureFreshToken()})}apiUrl(t){return p(this,null,function*(){return(yield ce.getServerUrl())+t})}put(t,i=null){return p(this,null,function*(){let s={url:yield this.apiUrl(t),headers:yield this.getHeaders(),data:this.transformData(i)};return de.isNativePlatform()?te((yield Oe.put(s).then(this.checkResponse.bind(this)).catch(n=>{this.webErrorHandler({error:n,class:"HttpService.put()",method:"put",url:s.url})}))?.data):this.http.put(s.url,s.data,{headers:s.headers}).pipe(Ae(n=>(this.webErrorHandler({error:n,class:"HttpService.put()",method:"put",url:s.url}),te(null))))})}get(t){return p(this,null,function*(){let i={url:yield this.apiUrl(t),headers:yield this.getHeaders()};return de.isNativePlatform()?te((yield Oe.get(i).then(this.checkResponse.bind(this)))?.data):this.http.get(i.url,{headers:i.headers}).pipe(Ae(s=>(this.webErrorHandler({error:s,class:"HttpService.get()",method:"get",url:i.url}),te(null))))})}$get(t){return zi(()=>p(this,null,function*(){let i={url:yield this.apiUrl(t),headers:yield this.getHeaders()};if(!de.isNativePlatform())return yield $(this.http.get(i.url,{headers:i.headers}).pipe(Ae(n=>(this.webErrorHandler({error:n,class:"HttpService.$get()",method:"get$",url:t}),te(null)))));let s=yield Oe.get(i);return(yield this.checkResponse(s))?.data}))}post(a){return p(this,arguments,function*(t,i=null,s,n={}){let o={url:yield this.apiUrl(t),headers:yield this.getHeaders(t,n),data:this.transformData(i)};return de.isNativePlatform()?te((yield Oe.post(o).then(l=>l.status>=400?(typeof s=="function"&&s(l),this.webErrorHandler({error:l,class:"HttpService",method:"post",url:o.url}),l):this.checkResponse(l)).catch(l=>(typeof s=="function"&&s(l),this.webErrorHandler({error:l,class:"HttpService",method:"post",url:o.url}),l)))?.data):this.http.post(o.url,o.data,{headers:o.headers,withCredentials:n.withCredentials===!0}).pipe(Ae(l=>(typeof s=="function"&&s(l),this.webErrorHandler({error:l,class:"HttpService",method:"post",url:o.url}),te(l))))})}$post(t,i=null,s){return zi(()=>p(this,null,function*(){let a={url:s?.baseUrl?s.baseUrl+t:yield this.apiUrl(t),headers:yield this.getHeaders(),data:this.transformData(i)};if(!de.isNativePlatform())return yield $(this.http.post(a.url,a.data,{headers:a.headers}).pipe(Ae(l=>(this.webErrorHandler({error:l,class:"HttpService.$post()",method:"post$",url:t}),te(null)))));let o=yield Oe.post(a);return(yield this.checkResponse(o))?.data}))}
4postStream(t,i=null,s){return new Ws(n=>{let a=new AbortController,o,l,u,c=!1,h=!1,g,f=()=>{if(!h&&(h=!0,c=!0,a.abort(),o?.remove(),l?.remove(),u?.remove(),g))try{Tt.stopStream({taskId:g})}catch(v){}};return p(this,null,function*(){let v=s?.baseUrl?s.baseUrl+t:yield this.apiUrl(t),_=me(J({},yield this.getHeaders()),{Accept:"text/plain","Cache-Control":"no-cache"});if(de.isNativePlatform()){try{o=yield Tt.addListener("streamData",k=>{k.taskId&&g&&k.taskId!==g||c||n.next(k.data)}),l=yield Tt.addListener("streamError",k=>{c||n.error(k),f()}),u=yield Tt.addListener("streamComplete",()=>{c||n.complete(),f()}),g=(yield Tt.streamChat({url:v,headers:_,body:this.transformData(i)})).taskId}catch(m){this.appLogHelperService.pushLogData("postStream native platform error","HttpService.postStream()",JSON.stringify(m),v),c||n.error(m),f()}return}try{let m=yield fetch(v,{method:"POST",headers:_,body:this.transformData(i),signal:a.signal});if(!m.ok||!m.body)throw new Error(`HTTP error! status: ${m.status}`);let k=m.body.getReader(),P=new TextDecoder;for(;!c;){let{done:O,value:x}=yield k.read();if(O){c||n.complete();break}let A=P.decode(x,{stream:!0});A&&!c&&n.next(A)}}catch(m){yield this.webErrorHandler({error:m,class:"HttpService.postStream()",method:"postStream",url:v}),m instanceof Error&&m.name==="AbortError"?c||n.complete():(this.appLogHelperService.pushLogData("postStream web platform error","HttpService.postStream()",JSON.stringify(m),v),c||n.error(m))}finally{f()}}),f})}postText(t,i=null){return p(this,null,function*(){let s={url:yield this.apiUrl(t),headers:yield this.getHeaders(t),data:this.transformData(i),responseType:"text"};return de.isNativePlatform()?te((yield Oe.post(s).then(this.checkResponse.bind(this)).catch(n=>{this.webErrorHandler({error:n,class:"HttpService",method:"postText",url:s.url})}))?.data):this.http.post(s.url,s.data,{headers:s.headers,responseType:"text"}).pipe(Ae(n=>(this.webErrorHandler({error:n,class:"HttpService",method:"postText",url:s.url}),te(""))))})}delete(t){return p(this,null,function*(){let i={url:yield this.apiUrl(t),headers:yield this.getHeaders()};return de.isNativePlatform()?te((yield Oe.delete(i).then(this.checkResponse.bind(this)).catch(s=>{this.webErrorHandler({error:s,class:"HttpService.delete()",method:"delete",url:i.url})}))?.data):this.http.delete(i.url,{headers:i.headers}).pipe(Ae(s=>(this.webErrorHandler({error:s,class:"HttpService.delete()",method:"delete",url:i.url}),te(null))))})}patch(t,i=null){return p(this,null,function*(){let s={url:yield this.apiUrl(t),headers:yield this.getHeaders(),data:this.transformData(i)};return de.isNativePlatform()?te((yield Oe.patch(s).then(this.checkResponse.bind(this)).catch(n=>{this.webErrorHandler({error:n,class:this.constructor.name,method:"patch",url:s.url})}))?.data):this.http.patch(s.url,s.data,{headers:s.headers}).pipe(Ae(n=>(this.webErrorHandler({error:n,class:"HttpService.patch()",method:"patch",url:s.url}),te(null))))})}uploadFile(t,i){let s=new Ys;return s.append("Content-Type",i.type),s.append("Accept","application/json"),this.http.put(t,i,{headers:s})}postFormData(t,i){return p(this,null,function*(){let s=yield ni(),n=yield ce.getAgentsUrl(),a=n?n+t:yield this.apiUrl(t),o={Authorization:"Bearer "+s},l=yield ce.getImpersonateUser();return l?.uid&&(o["X-Impersonate-User-Uid"]=l.uid),$(this.http.post(a,i,{headers:o}).pipe(Ae(u=>{throw this.webErrorHandler({error:u,class:"HttpService.postFormData()",method:"postFormData",url:a}),u})))})}postUpload(t,i=null){return p(this,null,function*(){return this.http.post(yield this.apiUrl(t),i,{headers:{Authorization:"Bearer "+(yield ni())},reportProgress:!0,observe:"events"})})}getHeaders(){return p(this,arguments,function*(t="",i={}){let s={"Content-Type":"application/json",responseType:"json"},n=["user/login","user/loginExternal"];!i.skipAuthorization&&!n.some(o=>t.includes(o))&&(s.Authorization="Bearer "+(yield ni()));let a=yield ce.getImpersonateUser();return a?.uid&&(s["X-Impersonate-User-Uid"]=a?.uid),s})}checkResponse(t){return p(this,null,function*(){let i=yield Ns(),n=yield(yield this.getUserServiceClass()).isGhostUser();return i&&!n&&t.status===401&&(yield this.refreshToken()),t})}refreshToken(t=!0){return this.refreshTokenPromise?this.refreshTokenPromise:(this.refreshTokenPromise=this.doRefreshToken(t).finally(()=>{this.refreshTokenPromise=null}),this.refreshTokenPromise)}doRefreshToken(t){return p(this,null,function*(){if(!this.userService){let s=yield this.getUserServiceClass();this.userService=this.injector.get(s)}let i=yield this.userService.refreshToken(t);if(!i||!i?.token){let{AuthGuardService:s}=yield import("./chunk-XDSMX42F.js");throw this.injector.get(s).logoutAndNavigateToErrorPage("/login"),"Token is not val
4id"}else yield this.router.navigate(["/secure/main"]),document.location.href="index.html"})}webErrorHandler(t){return p(this,null,function*(){if(this.refreshTokenPromise)return;let s=yield(yield this.getUserServiceClass()).isGhostUser();if((yield Ns())&&!s&&t.error?.status===401){de.isNativePlatform()?yield this.refreshToken():(yield(yield this.getWebSessionBootstrap()).ensureFreshToken())==="unauthenticated"&&(yield this.router.navigate(["/login"]));return}let a=t.error?.status;if(typeof a=="number"&&a>=400){let o=ao(t);yield this.appLogHelperService.pushLogData("HTTP error","HttpService.webErrorHandler(context)",J({feature:"Http"},o),lt(t.url),K.Warning)}})}postWithoutErrorManager(t,i){return p(this,null,function*(){let s={url:yield this.apiUrl(t),headers:yield this.getHeaders(),data:this.transformData(i)};try{let n=yield Oe.post(s);return(yield this.checkResponse(n))?.data}catch(n){return null}})}setRefreshTokenTimeout(){return p(this,null,function*(){try{let t=yield Bi();if(t){let i=new Date(t);if(isNaN(i.getTime()))return;let s=new Date,n=i.getTime()-s.getTime()-300*1e3;n>0?(yield this.destroyRefreshTokenTimeout(),this.refreshTokenTimeoutInstance=setTimeout(()=>p(this,null,function*(){yield this.triggerRefresh(),yield this.setRefreshTokenTimeout()}),n)):(yield this.triggerRefresh(),yield this.setRefreshTokenTimeout())}}catch(t){this.destroyRefreshTokenTimeout()}})}destroyRefreshTokenTimeout(){return p(this,null,function*(){try{this.refreshTokenTimeoutInstance&&(clearTimeout(this.refreshTokenTimeoutInstance),this.refreshTokenTimeoutInstance=null)}catch(t){}})}static \u0275fac=function(i){return new(i||r)};static \u0275prov=ye({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var Us=(function(r){return r[r.Quarter=0]="Quarter",r[r.SemiAnnual=1]="SemiAnnual",r[r.Annual=2]="Annual",r})(Us||{});var lo=(()=>{class r{appLogHelperService=G(ct);http=G(qi);constructor(){setInterval(()=>this.flushStoredErrors(),ct.FlushIntervalMs);try{this.flushStoredErrors()}catch(t){}}flushStoredErrors(){return p(this,null,function*(){let t=this.appLogHelperService.getStoredErrors();if(t.length===0)return;let i=t.filter(a=>(a.attempts??0)<ct.MaxAttempt);if(i.length===0)return;for(let a of i)a.delayMs=Date.now()-(a.clientCreatedAt??0);let s={logs:i},n=yield this.http.postWithoutErrorManager(`${ct.ApiPath}AddRange`,s);n&&n.code==0?this.appLogHelperService.clearErrorsWhenSuccessfull(i.map(a=>a.id)):this.appLogHelperService.clearErrorsWhenError(i.map(a=>a.id))})}log(o,l,u,c){return p(this,arguments,function*(t,i,s,n,a=K.Error){yield this.appLogHelperService.pushLogData(t,i,s,n,a)})}logLinking(c,h,g){return p(this,arguments,function*(t,i,s,n=null,a=null,o=null,l=null,u=K.Error){yield this.appLogHelperService.pushLogData(t,i,s,l,u,n,a,o)})}logInfo(t,i,s=null){return p(this,null,function*(){yield this.appLogHelperService.pushLogData(t,i,s,null,K.Info)})}logWarning(t,i,s=null){return p(this,null,function*(){yield this.appLogHelperService.pushLogData(t,i,s,null,K.Warning)})}static \u0275fac=function(i){return new(i||r)};static \u0275prov=ye({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var co={USER:"/api/user/",USER_ADMIN:"/api/UserAdminUser/",MARKETING:"/api/Marketing/",ACCOUNT:"/api/Account/",ACCOUNT_PAYMENT:"/api/AccountPayment/",PORTFOLIO_GROUP:"/api/PortfolioGroup/",CRUD:"/api/Crud/",BANK_SEARCH:"/api/bank/search",SUBSCRIPTION:"/api/Subscription/",STRIPE:"/api/Stripe/",USER_SETTINGS:"/api/usersettings/",APP_VERSION_CHECK:"/api/AppVersion/check",NET_WORTH:"/api/NetWorth/",BENCHMARK:"/api/benchmark/",DATA_CONSUMERS:"/api/DataConsumers/",PLAID:"/api/DataConsumers/Plaid/",CARTA:"/api/DataConsumers/Carta/",SNAPTRADE:"/api/DataConsumers/Snaptrade/",TRUELAYER:"/api/DataConsumers/TrueLayer/",VEZGO:"/api/DataConsumers/Vezgo/",YODLEE:"/api/DataConsumers/Yodlee/",COINGECKO:"/api/DataConsumers/CoinGecko/",CBONDS:"/api/DataConsumers/CBonds/",LINKS:"/api/links/",REQUEST_STATUS:"/api/RequestStatus/",AI:"/api/AI/",SUGGESTION:"/api/suggestion/",MCP_ONBOARDING_STATE:"/api/MCP/onboarding-state",PAYWALL_STATE:"/api/paywall-state",ANALYTIC:"/api/Analytic/",PARSER:"/api/parser/",QUESTIONNAIRE:"/api/questionnaire/"};var uo=(()=>{class r{http=G(qi);appLog=G(lo);
4apiPath=co.USER_SETTINGS;userSettingsNetWorth={netWorthPeriod:Us.Annual,netWorthReturnVisible:!0,netWorthPnLVisible:!0,netWorthReturnsAnualized:!0,netWorthForecastVisible:!1};stablecoinPreferences=new Map;stablecoinPreferencesLoaded=!1;stablecoinPreferencesPromise=null;setAINewsEnabled(t){return p(this,null,function*(){return $(yield this.http.post(`${this.apiPath}setAINewsEnabled`,{value:t}))})}getAINewsEnabled(){return p(this,null,function*(){return $(yield this.http.get(`${this.apiPath}getAINewsEnabled`))})}setBalanceSheetAssetTypeOrder(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setBalanceSheetAssetTypeOrder",i))})}setBalanceSheetLiabilityTypeOrder(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setBalanceSheetLiabilityTypeOrder",i))})}setBalanceSheetAssetTypeHidden(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setBalanceSheetAssetTypeHidden",i))})}setBalanceSheetLiabilityTypeHidden(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setBalanceSheetLiabilityTypeHidden",i))})}getHiddenExposureAssetTypes(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getHiddenExposureAssetTypes"))})}setHiddenExposureAssetTypes(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setHiddenExposureAssetTypes",i))})}setHiddenExposureAssets(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setHiddenExposureAssets",i))})}getHiddenExposureAssets(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getHiddenExposureAssets"))})}getBalanceSheetAssetTypeOrder(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getBalanceSheetAssetTypeOrder"))})}getBalanceSheetLiabilityTypeOrder(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getBalanceSheetLiabilityTypeOrder"))})}getBalanceSheetAssetTypeHidden(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getBalanceSheetAssetTypeHidden"))})}getBalanceSheetLiabilityTypeHidden(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getBalanceSheetLiabilityTypeHidden"))})}getUserSettingsNetWorth(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getUserSettingsNetWorth"))})}setUserSettingsNetWorthPeriod(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setUserSettingsNetWorthPeriod",i))})}setUserSettingsNetWorthPnlVisible(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setUserSettingsNetWorthPnlVisible",i))})}setUserSettingsNetWorthReturnVisible(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setUserSettingsNetWorthReturnVisible",i))})}setUserSettingsNetWorthReturnsAnualized(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setUserSettingsNetWorthReturnsAnualized",i))})}setUserSettingsNetWorthForecastVisible(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setUserSettingsNetWorthForecastVisible",i))})}setDemoMode(t){return p(this,null,function*(){let i={demoMode:t};return $(yield this.http.post(this.apiPath+"setDemoMode",i))})}setUITheme(t){return p(this,null,function*(){let i={value:t};return $(yield this.http.post(this.apiPath+"setUITheme",i))})}getUITheme(){return p(this,null,function*(){return $(yield this.http.get(this.apiPath+"getUITheme"))})}setStablecoinDisplayPreference(t,i){return p(this,null,function*(){let s=yield $(yield this.http.post(`${this.apiPath}setStablecoinDisplayPreference`,{ticker:t,value:i}));return this.stablecoinPreferences.set(t.toUpperCase(),i),s})}getStablecoinDisplayAsCrypto(t){return this.stablecoinPreferences.get(t?.toUpperCase())??!0}getUserSettings(){return p(this,null,function*(){return $(yield this.http.get(`${this.apiPath}getUserSettings`))})}getStablecoinDisplayPreferences(){return p(this,null,function*(){return $(yield this.http.get(`${this.apiPath}getStablecoinDisplayPreferences`))})}loadStablecoinPreferences(){return p(this,null,function*(){return this.stablecoinPreferencesLoaded?this.stablecoinPreferences:this.stablecoinPreferencesPromise?this.stablecoinPreferencesPromise:(this.stablecoinPreferencesPromise=p(this,null,function*(){try{let t=yield this.get
4StablecoinDisplayPreferences();t?.payload&&(this.stablecoinPreferences=new Map(Object.entries(t.payload)))}catch(t){this.stablecoinPreferences=new Map,this.appLog.log("Failed to load stablecoin preferences",t?.stack||"",{feature:"UserSettings"},null,K.Error)}finally{this.stablecoinPreferencesLoaded=!0,this.stablecoinPreferencesPromise=null}return this.stablecoinPreferences}),this.stablecoinPreferencesPromise)})}resetStablecoinPreferenceCache(){this.stablecoinPreferencesLoaded=!1,this.stablecoinPreferencesPromise=null}getPortfolioExportSchedule(){return p(this,null,function*(){return $(yield this.http.get(`${this.apiPath}getPortfolioExportSchedule`))})}setPortfolioExportSchedule(t){return p(this,null,function*(){return $(yield this.http.post(`${this.apiPath}setPortfolioExportSchedule`,t))})}static \u0275fac=function(i){return new(i||r)};static \u0275prov=ye({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var M=oi("Preferences",{web:()=>import("./chunk-OQXO6GSY.js").then(r=>new r.PreferencesWeb)});var ai=(function(r){return r[r.Assets=0]="Assets",r[r.Industry=1]="Industry",r[r.Country=2]="Country",r})(ai||{});var Vi=en("SecureStorage",{web:()=>p(null,null,function*(){let r=yield import("./chunk-7UEDMN32.js");return new r.SecureStorageWeb}),ios:()=>p(null,null,function*(){let r=yield import("./chunk-LCGSKORV.js");return new r.SecureStorageNative(Vi)}),android:()=>p(null,null,function*(){let r=yield import("./chunk-LCGSKORV.js");return new r.SecureStorageNative(Vi)})});var fe=(function(r){return r[r.Preferences=0]="Preferences",r[r.SessionStorage=1]="SessionStorage",r})(fe||{}),X=(function(r){return r.pinOld="pin",r.uid="uid",r.token="token",r.pin="pin_v2",r.config="config",r.pinData="pinData",r.fcmToken="fcmToken",r.username="username",r.loginType="loginType",r.logincode="logincode",r.themeColor="themeColor",r.lastUsedPin="lastUsedPin",r.pricingData="pricingData",r.signupSoftPaywallSkipped="signupSoftPaywallSkipped",r.lastTrackAt="lastDAUTrackAt",r.refreshToken="refreshToken",r.userReference="userReference",r.lastAdviceUid="lastAdviceUid",r.dateExpiration="dateExpiration",r.veryFirstLaunch="veryFirstLaunch",r.marketingOnboardingLock="marketingOnboardingLock",r.lastRefreshedAt="lastRefreshedAt",r.downloadTracked="downloadTracked",r.loginPinAttempts="loginPinAttempts",r.linkingTrackUID="linkingTrackUID",r.sessionExpiresAt="sessionExpiresAt",r.onboardingStarted="onboardingStarted",r.isFirstChatWithAI="isFirstChatWithAI",r.dailyMessageCounter="dailyMessageCounter",r.lastUserInteractionAt="lastUserInteractionAt",r.onboardingAnswersDone="onboardingAnswersDone",r.availableBiometrics="availableBiometrics",r.unlockwithbiometrics="unlockwithbiometrics",r.bookExpertCallClosed="bookExpertCallClosed",r.exposureDonutHintSeenV2="exposureDonutHintSeenV2",r.demoModeBeenDisabled="demoModeBeenDisabled",r.onboardingIncomplete="onboardingIncomplete",r.quickReplyChips="quickReplyChips",r.isAIInfoMessageClosed="isAIInfoMessageClosed",r.welcomePaywallBeenClosed="welcomePaywallBeenClosed",r.pendingClientLogs="pendingClientLogs",r.showPrivacyComponent="showPrivacyComponent",r.refreshRequestStatusUid="refreshRequestStatusUid",r.refreshRequestStatusMaxAttempt="refreshRequestStatusMaxAttempt",r.lastTimeInstallAppDialogOpenAt="lastTimeInstallAppDialogOpenAt",r.liveUpdateApplied="liveUpdateApplied",r.firstAdviceReadDone="firstAdviceReadDone",r.ratingLastShownAt="ratingLastShownAt",r.ratingAppOpenCount="ratingAppOpenCount",r.ratingLastCountedOpenAt="ratingLastCountedOpenAt",r.isB2B="isB2B",r.pendingReferralCode="pendingReferralCode",r.pushPrimerPending="pushPrimerPending",r.pushPrimerShown="pushPrimerShown",r})(X||{});function I(r){return`${ze.name===xe.prod?"":`${ze.name}_`}${r}`}var H=(function(r){return r.hiddenAssetTypes="hiddenAssetTypes",r.assetsListOrder="assetsListOrder",r.hiddenLiabilityTypes="hiddenLiabilityTypes",r.liabilitiesListOrder="liabilitiesListOrder",r.hiddenExposureAssetTypes="hiddenExposureAssetTypes",r.hiddenExposureAssets="hiddenExposureAssets",r})(H||{}),ce=(()=>{class r{apiUserSettings=G(uo);static expiredTime;cacheMap=new Map;clear(){return p(this,null,function*(){sessionStorage.clear(),localStorage.clear(),yield M.clear();try{yield Vi.clear()}catch(t){console.warn("[StorageService.clear] SecureStorage.clear failed",t)}})}clearCache(){this.cacheMap.clear()}static get(n){return p(this,arguments,function*(t,i=!1,s=fe.Preferences){let a=yield r.getUniquePrefix(t,s);return s===fe.SessionStorage?sessionStorage.getItem(i?a:t):(yield M.get({key:i?a:t})).value})}static set(a,o){return p(this,arguments,function*(t,i,s=!1,n=fe.Preferences){let l=yield r.getUniquePrefix(t,n);if(i==null||i==="undefined"||i==="null"){yield r.remove(s?l:t,!1,n);return}n===fe.SessionStorage?sessionStorage.setItem(s?l:t,i):yield M.set({key:s?l:t,value:i})})}static remove(n){return p(this,arguments,function*(t,i=!1,s=fe.Preferences){let a=yield r.getUniquePrefix(t,s);s===fe.SessionStorage?sessionStorage.removeItem(i?a:t):yield M.remove({key:i?a:t})})}static getServerUrl(){return p(this,null,function*(){return(yield M.get({key:I("server_url")})).value})}static setServerUrl(t){return p(this,null,function*(){yield M.set({key:I("server_url"),value:t})})}static getAgentsUrl(){return p(this,null,function*(){return(yield M.get({key:I("agents_url")})).value})}static setAgentsUrl(t){return p(this,null,function*(){yield M.set({key:I("agents_url"),value:t})})}static clearAgentsUrl(){return p(this,null,function*(){yield M.remove({key:I("agents_url")})})}static getRefreshAtSetting(){return p(this,null,function*(){return(yield M.get({key:I("refresh_data_at")})).value})}static setRefreshAtSetting(t){return p(this,null,function*(){yield M.set({key:I("refresh_data_at"),value:t})})}static getGoogleRedirectUrl(){return p(this,null,function*(){let t=(yield M.get({key:I("google_redirect_url")})).value;return t===null?"":t})}static setGoogleRedirectUrl(t){return p(this,null,function*(){yield M.set({key:I("google_redirect_url"),value:t})})}static getGoogleClientId(){return p(this,null,function*(){return(yield M.get({key:I("google_client_id")})).value})}static setGoogleClientId(t){return p(this,null,function*(){yield M.set({key:I("google_client_id"),value:t})})}setAssetsListOrder(t){return p(this,null,function*(){this.cacheMap.set(H.assetsListOrder,t),yield this.apiUserSettings.setBalanceSheetAssetTypeOrder(JSON.stringify(t))})}getAssetsListOrder(){return p(this,null,function*(){if(this.cacheMap.has(H.assetsListOrder))return this.cacheMap.get(H.assetsListOrder);let t=yield this.apiUserSettings.getBalanceSheetAssetTypeOrder(),i=ke(t.payload,[]);return this.cacheMap.set(H.assetsListOrder,i),i})}getLiabilitiesListOrder(){return p(this,null,function*(){if(this.cacheMap.has(H.liabilitiesListOrder))return this.cacheMap.get(H.liabilitiesListOrder);let t=yield this.apiUserSettings.getBalanceSheetLiabilityTypeOrder(),i=ke(t.payload,[]);return this.cacheMap.set(H.liabilitiesListOrder,i),i})}setLiabilitiesListOrder(t){return p(this,null,function*(){this.cacheMap.set(H.liabilitiesListOrder,t),yield this.apiUserSettings.setBalanceSheetLiabilityTypeOrder(JSON.stringify(t))})}hasCachedData(){return this.cacheMap.size>0}getHiddenAssetTypes(){return p(this,null,function*(){if(this.cacheMap.has(H.hiddenAssetTypes))return this.cacheMap.get(H.hiddenAssetTypes);let t=yield this.apiUserSettings.getBalanceSheetAssetTypeHidden(),i=ke(t.payload,[]);return this.cacheMap.set(H.hiddenAssetTypes,i),i})}setHiddenAssetTypes(t){return p(this,null,function*(){this.cacheMap.set(H.hiddenAssetTypes,t),yield this.apiUserSettings.setBalanceSheetAssetTypeHidden(JSON.stringify(t))})}getHiddenExposureAssetTypes(){return p(this,null,function*(){if(this.cacheMap.has(H.hiddenExposureAssetTypes))return this.cacheMap.get(H.hiddenExposureAssetTypes);let t=yield this.apiUserSettings.getHiddenExposureAssetTypes(),i=this.getValidPayload(t.payload);return this.cacheMap.set(H.hiddenExposureAssetTypes,i),i})}setHiddenExposureAssetTypes(t){return p(this,null,function*(){this.cacheMap.set(H.hiddenExposureAssetTypes,t),yield this.apiUserSettings.setHiddenExposureAssetTypes(JSON.stringify(t))})}getHiddenExposureAssets(){return p(this,null,function*(){if(this.cacheMap.has(H.hiddenExposureAssets))return this.cacheMap.get(H.hiddenExposureAssets);let t=yield this.apiUserSettings.getHiddenExposureAssets(),i=this.getValidPayload(t.payload);return this.cacheMap.set(H.hiddenExposureAssets,i),i})}getValidPayload(t){let i={[ai.Assets]:[],[ai.Industry]:[],[ai.Country]:[]},s=ke(t,null);if(Array.isArray(s)||s===null)return i;if(typeof s=="object"){let n=s;
4return Object.keys(i).forEach(a=>{Object.hasOwn(n,a)||(n[a]={})}),n}return i}setHiddenExposureAssets(t){return p(this,null,function*(){this.cacheMap.set(H.hiddenExposureAssets,t),yield this.apiUserSettings.setHiddenExposureAssets(JSON.stringify(t))})}getHiddenLiabilityTypes(){return p(this,null,function*(){if(this.cacheMap.has(H.hiddenLiabilityTypes))return this.cacheMap.get(H.hiddenLiabilityTypes);let t=yield this.apiUserSettings.getBalanceSheetLiabilityTypeHidden(),i=ke(t.payload,[]);return this.cacheMap.set(H.hiddenLiabilityTypes,i),i})}setHiddenLiabilityTypes(t){return p(this,null,function*(){this.cacheMap.set(H.hiddenLiabilityTypes,t),yield this.apiUserSettings.setBalanceSheetLiabilityTypeHidden(JSON.stringify(t))})}static getUserIdleExpiryTimer(){let t=this.expiredTime;return parseInt(t===null?"0":t,10)}static setUserIdleExpiryTimer(t){return p(this,null,function*(){this.expiredTime=t,yield r.set(I(X.sessionExpiresAt),`${t}`)})}static setLastUserInteraction(){return p(this,null,function*(){yield r.set(I(X.lastUserInteractionAt),`${Date.now()}`)})}static getLastUserInteraction(){return p(this,null,function*(){let t=yield r.get(I(X.lastUserInteractionAt));return t===null?0:parseInt(t,10)})}static removeUserIdleExpiryTimer(){return p(this,null,function*(){this.expiredTime=null,yield r.remove(I(X.sessionExpiresAt))})}static setHiddenAccountAttributes(t,i){return p(this,null,function*(){yield M.set({key:I("hiddenAccountAttributes_"+t),value:JSON.stringify(i)})})}static getHiddenAccountAttributes(t){return p(this,null,function*(){let i=(yield M.get({key:I("hiddenAccountAttributes_"+t)})).value;return ke(i,[])})}static getShowSettingsSubscriptionButton(){return p(this,null,function*(){return(yield M.get({key:I("showSettingsSubscriptionButton")})).value==="true"})}static setShowSettingsSubscriptionButton(t){return p(this,null,function*(){yield M.set({key:I("showSettingsSubscriptionButton"),value:t?"true":"false"})})}static storeLastError(t){localStorage.setItem(I("last_error"),t)}static getLastError(){return p(this,null,function*(){let t=localStorage.getItem(I("last_error"));return t===null?"":t})}static getUniquePrefix(t,i){return p(this,null,function*(){let s=yield p(null,null,function*(){return i===fe.SessionStorage?sessionStorage.getItem(I(X.uid)):(yield M.get({key:I(X.uid)})).value});return s&&`${s}`.length>0?`${s}_${t}`:t})}static encryptAndSave(t,i,s=!0){return p(this,null,function*(){let n=t.split("").map(a=>String.fromCharCode(a.charCodeAt(0)+1)).join("");yield r.set(i,n,s)})}static getDecryptedDataBy(t,i=!0){return p(this,null,function*(){let s=yield r.get(t,i);return s?s.split("").map(n=>String.fromCharCode(n.charCodeAt(0)-1)).join(""):""})}static setAppBaseUrl(t){return p(this,null,function*(){yield M.set({key:I("app_base_url"),value:t})})}static getAppBaseUrl(){return p(this,null,function*(){return(yield M.get({key:I("app_base_url")})).value})}static setAppUpdateNotified(t){return p(this,null,function*(){yield M.set({key:I("app_update_notify_count"),value:String(t)})})}static getAppUpdateNotificationCount(){return p(this,null,function*(){return(yield M.get({key:I("app_update_notify_count")})).value=="true"})}static setImpersonateUser(t){return p(this,null,function*(){yield M.set({key:I("impersonate_user"),value:JSON.stringify(t)})})}static getImpersonateUser(){return p(this,null,function*(){let t=(yield M.get({key:I("impersonate_user")})).value;return ke(t,null)})}static removeImpersonateUser(){return p(this,null,function*(){yield M.remove({key:I("impersonate_user")})})}static \u0275fac=function(i){return new(i||r)};static \u0275prov=ye({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function Ns(){return p(this,null,function*(){return!!(yield ce.get(I(X.token),!1,fe.SessionStorage))})}function ni(){return p(this,null,function*(){let r=yield ce.get(I(X.token),!1,fe.SessionStorage);return r==null||r==null||r=="undefined"?"":r})}function Bi(){return p(this,null,function*(){return yield ce.get(I(X.dateExpiration))})}function tc(r,e=0){if(!r||r==="undefined")return!1;let t=new Date(r).getTime();return isNaN(t)?!1:t-Date.now()>e}function Bu(r=0){return p(this,null,function*(){return(yield ni())?tc(yield Bi(),r):!1})}export{xe as a,ze as b,se as c,Ns as d,ni as e,Bi as f,tc as g,Bu as h,Ji as i,vo as j,ae as k,_o as l,mo as m,nc as n,li as o,uc as p,lt as q,ao as r,oo as s,ke as t,K as u,ec as v,co as w,lo as x,qi as y,uo as z,Vi as A,fe as B,X as C,I as D,ce as E};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.