PageSourceSearch

https://dashboard.browse.ai/assets/useUser-5PN-i3wu.js

js browse.ai collected 2026-09-24 09:10:45 UTC 236,738 bytes, 9 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0ce9a-fb1f-7e12-9666-b4d21b7ca627")}catch(e){}}();import{r as e,u as t}from"./dist-CzSSeqtW.js";import{n,t as r}from"./log-D39hDywk.js";var i=t(e()),a=typeof window<`u`?window:void 0,o=typeof globalThis<`u`?globalThis:a;typeof self>`u`&&(o.self=o),typeof File>`u`&&(o.File=function(){});var s=Array.prototype,c=s.forEach,l=s.indexOf,u=o==null?void 0:o.navigator,d=o==null?void 0:o.document,f=o==null?void 0:o.location,p=o==null?void 0:o.fetch,m=o!=null&&o.XMLHttpRequest&&`withCredentials`in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,h=o==null?void 0:o.AbortController,g=u==null?void 0:u.userAgent,_=a==null?{}:a,v={DEBUG:!1,LIB_VERSION:`1.353.1`};function y(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function b(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){y(a,r,i,o,s,`next`,e)}function s(e){y(a,r,i,o,s,`throw`,e)}o(void 0)}))}}function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},x.apply(null,arguments)}function S(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var C=[`$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`],w=`amazonbot,amazonproductbot,app.hypefactors.com,applebot,archive.org_bot,awariobot,backlinksextendedbot,baiduspider,bingbot,bingpreview,chrome-lighthouse,dataforseobot,deepscan,duckduckbot,facebookexternal,facebookcatalog,http://yandex.com/bots,hubspot,ia_archiver,leikibot,linkedinbot,meta-externalagent,mj12bot,msnbot,nessus,petalbot,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`.split(`,`),ee=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return w.concat(t).some((e=>{var t=e.toLowerCase();return n.indexOf(t)!==-1}))};function T(e,t){return e.indexOf(t)!==-1}var te=function(e){return e.trim()},E=function(e){return e.replace(/^\$/,``)},ne=Array.isArray,D=Object.prototype,O=D.hasOwnProperty,re=D.toString,k=ne||function(e){return re.call(e)===`[object Array]`},A=e=>typeof e==`function`,j=e=>e===Object(e)&&!k(e),ie=e=>{if(j(e)){for(var t in e)if(O.call(e,t))return!1;return!0}return!1},M=e=>e===void 0,N=e=>re.call(e)==`[object String]`,ae=e=>N(e)&&e.trim().length===0,P=e=>e===null,F=e=>M(e)||P(e),oe=e=>re.call(e)==`[object Number]`&&e==e,se=e=>oe(e)&&e>0,I=e=>re.call(e)===`[object Boolean]`,ce=e=>e instanceof FormData,le=e=>T(C,e);function ue(e){return typeof e!=`object`||!e}function de(e,t){return Object.prototype.toString.call(e)===`[object `+t+`]`}function fe(e){return!M(Event)&&function(e,t){try{return e instanceof t}catch{return!1}}(e,Event)}var pe=[!0,`true`,1,`1`,`yes`],me=e=>T(pe,e),he=[!1,`false`,0,`0`,`no`];function ge(e,t,n,r,i){return t>n&&(r.warn(`min cannot be greater than max.`),t=n),oe(e)?e>n?(r.warn(` cannot be  greater than max: `+n+`. Using max value instead.`),n):e<t?(r.warn(` cannot be less than min: `+t+`. Using min value instead.`),t):e:(r.warn(` must be a number. using max or fallback. max: `+n+`, fallback: `+i),ge(i||n,t,n,r))}var _e=class{constructor(e){this.t={},this.i=e.i,this.o=ge(e.bucketSize,0,100,e.h),this.m=ge(e.refillRate,0,this.o,e.h),this.$=ge(e.refillInterval,0,864e5,e.h)}S(e,t){var n=t-e.lastAccess,r=Math.floor(n/this.$);if(r>0){var i=r*this.m;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess+=r*this.$}}consumeRateLimit(e){var t,n=Date.now(),r=String(e),i=this.t[r];return i?this.S(i,n):(i={tokens:this.o,lastAccess:n},this.t[r]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.i)==null||t.call(this,e)),i.tokens===0)}stop(){this.t={}}},L=`Mobile`,ve=`iOS`,ye=`Android`,be=`Tablet`,xe=ye+` `+be,Se=`iPad`,Ce=`Apple`,we=Ce+` Watch`,Te=`Safari`,Ee=`BlackBerry`,De=`Samsung`,Oe=De+`Browser`,ke=De+` Internet`,Ae=`Chrome`,
1je=Ae+` OS`,Me=Ae+` `+ve,Ne=`Internet Explorer`,Pe=Ne+` `+L,Fe=`Opera`,Ie=Fe+` Mini`,Le=`Edge`,Re=`Microsoft `+Le,ze=`Firefox`,Be=ze+` `+ve,Ve=`Nintendo`,He=`PlayStation`,Ue=`Xbox`,We=ye+` `+L,Ge=L+` `+Te,Ke=`Windows`,qe=Ke+` Phone`,Je=`Nokia`,Ye=`Ouya`,Xe=`Generic`,Ze=Xe+` `+L.toLowerCase(),Qe=Xe+` `+be.toLowerCase(),$e=`Konqueror`,R=`(\\d+(\\.\\d+)?)`,et=RegExp(`Version/`+R),tt=new RegExp(Ue,`i`),nt=RegExp(He+` \\w+`,`i`),rt=RegExp(Ve+` \\w+`,`i`),it=RegExp(Ee+`|PlayBook|BB10`,`i`),at={"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`},ot,st,ct,lt=(e,t)=>t&&T(t,Ce)||function(e){return T(e,Te)&&!T(e,Ae)&&!T(e,ye)}(e),ut=function(e,t){return t=t||``,T(e,` OPR/`)&&T(e,`Mini`)?Ie:T(e,` OPR/`)?Fe:it.test(e)?Ee:T(e,`IE`+L)||T(e,`WPDesktop`)?Pe:T(e,Oe)?ke:T(e,Le)||T(e,`Edg/`)?Re:T(e,`FBIOS`)?`Facebook `+L:T(e,`UCWEB`)||T(e,`UCBrowser`)?`UC Browser`:T(e,`CriOS`)?Me:T(e,`CrMo`)||T(e,Ae)?Ae:T(e,ye)&&T(e,Te)?We:T(e,`FxiOS`)?Be:T(e.toLowerCase(),$e.toLowerCase())?$e:lt(e,t)?T(e,L)?Ge:Te:T(e,ze)?ze:T(e,`MSIE`)||T(e,`Trident/`)?Ne:T(e,`Gecko`)?ze:``},dt={[Pe]:[RegExp(`rv:`+R)],[Re]:[RegExp(Le+`?\\/`+R)],[Ae]:[RegExp(`(`+Ae+`|CrMo)\\/`+R)],[Me]:[RegExp(`CriOS\\/`+R)],"UC Browser":[RegExp(`(UCBrowser|UCWEB)\\/`+R)],[Te]:[et],[Ge]:[et],[Fe]:[RegExp(`(Opera|OPR)\\/`+R)],[ze]:[RegExp(ze+`\\/`+R)],[Be]:[RegExp(`FxiOS\\/`+R)],[$e]:[RegExp(`Konqueror[:/]?`+R,`i`)],[Ee]:[RegExp(Ee+` `+R),et],[We]:[RegExp(`android\\s`+R,`i`)],[ke]:[RegExp(Oe+`\\/`+R)],[Ne]:[RegExp(`(rv:|MSIE )`+R)],Mozilla:[RegExp(`rv:`+R)]},ft=function(e,t){var n=dt[ut(e,t)];if(M(n))return null;for(var r=0;r<n.length;r++){var i=n[r],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},pt=[[RegExp(Ue+`; `+Ue+` (.*?)[);]`,`i`),e=>[Ue,e&&e[1]||``]],[new RegExp(Ve,`i`),[Ve,``]],[new RegExp(He,`i`),[He,``]],[it,[Ee,``]],[new RegExp(Ke,`i`),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[qe,``];if(new RegExp(L).test(t)&&!/IEMobile\b/.test(t))return[Ke+` `+L,``];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=at[n[1]]||``;return/arm/i.test(t)&&(r=`RT`),[Ke,r]}return[Ke,``]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[ve,[e[3],e[4],e[5]||`0`].join(`.`)]:[ve,``]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t=``;return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),[`watchOS`,t]}],[RegExp(`(`+ye+` (\\d+)\\.(\\d+)\\.?(\\d+)?|`+ye+`)`,`i`),e=>e&&e[2]?[ye,[e[2],e[3],e[4]||`0`].join(`.`)]:[ye,``]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=[`Mac OS X`,``];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||`0`].join(`.`)),t}],[/Mac/i,[`Mac OS X`,``]],[/CrOS/,[je,``]],[/Linux|debian/i,[`Linux`,``]]],mt=function(e){return rt.test(e)?Ve:nt.test(e)?He:tt.test(e)?Ue:new RegExp(Ye,`i`).test(e)?Ye:RegExp(`(`+qe+`|WPDesktop)`,`i`).test(e)?qe:/iPad/.test(e)?Se:/iPod/.test(e)?`iPod Touch`:/iPhone/.test(e)?`iPhone`:/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?we:it.test(e)?Ee:/(kobo)\s(ereader|touch)/i.test(e)?`Kobo`:new RegExp(Je,`i`).test(e)?Je:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?`Kindle Fire`:/(Android|ZTE)/i.test(e)?new RegExp(L).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ye:xe:RegExp(`(pda|`+L+`)`,`i`).test(e)?Ze:new RegExp(be,`i`).test(e)&&!RegExp(be+` pc`,`i`).test(e)?Qe:``},ht=e=>e instanceof Error;function gt(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return ct&&n.length===st||(st=n.length,ct=n.reduce(((n,r)=>{ot||(ot={});var i=ot[r];if(i)n[i[0]]=i[1];else for(var a=e(r),o=a.length-1;o>=0;o--){var s=a[o],c=s==null?void 0:s.filename,l=t[r];if(c&&l){n[c]=l,ot[r]=[c,l];break}}return n}),{})),ct}}var _t=class{constructor(e,t,n){n===void 0&&(n=[]),this.coercers=e,this.stackParser=t,this.modifiers=n}buildFromUnknown(e,t){t===void 0&&(t={});var n=t&&t.mechanism||{handled:!0,type:`generic`},r=this.buildCoercingContext(n,t,0).apply(e),i=this.buildParsingContext(t),a=this.parseStacktrace(r,i);return{$exception_list:this.convertToExceptionList(a,n),$exception_level:`error`}}modifyFrames(e){var t=this;return b((function*(){for(var n of e)n.stacktrace&&n.stacktrace.frames&&k(n.stacktrace.frames)&&(n.stacktrace.frames=yield t.applyModifiers(n.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 n,r;return e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=``&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
1pFirstLines:0),t.chunkIdMap)),x({},e,{cause:n,stack:r})}applyChunkIds(e,t){return e.map((e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e)))}applyCoercers(e,t){for(var n of this.coercers)if(n.match(e))return n.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return b((function*(){var n=e;for(var r of t.modifiers)n=yield r(n);return n}))()}convertToExceptionList(e,t){var n,r,i,a={type:e.type,value:e.value,mechanism:{type:(n=t.type)==null?`generic`:n,handled:(r=t.handled)==null||r,synthetic:(i=e.synthetic)!=null&&i}};e.stack&&(a.stacktrace={type:`raw`,frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,x({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:gt(this.stackParser),skipFirstLines:(t=e.skipFirstLines)==null?1:t}}buildCoercingContext(e,t,n){n===void 0&&(n=0);var r=(n,r)=>{if(r<=4){var i=this.buildCoercingContext(e,t,r);return this.applyCoercers(n,i)}};return x({},t,{syntheticException:n==0?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,n),next:e=>r(e,n+1)})}},vt=`?`;function yt(e,t,n,r,i){var a={platform:e,filename:t,function:n===`<anonymous>`?vt:n,in_app:!0};return M(r)||(a.lineno=r),M(i)||(a.colno=i),a}var bt=(e,t)=>{var n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?vt:e.split(`@`)[0],n?`safari-extension:`+t:`safari-web-extension:`+t]:[e,t]},xt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,St=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ct=/\((\S*)(?::(\d+))(?::(\d+))\)/,wt=(e,t)=>{var n=xt.exec(e);if(n){var[,r,i,a]=n;return yt(t,r,vt,+i,+a)}var o=St.exec(e);if(o){if(o[2]&&o[2].indexOf(`eval`)===0){var s=Ct.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[c,l]=bt(o[1]||vt,o[2]);return yt(t,l,c,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Tt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Et=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Dt=(e,t)=>{var n=Tt.exec(e);if(n){if(n[3]&&n[3].indexOf(` > eval`)>-1){var r=Et.exec(n[3]);r&&(n[1]=n[1]||`eval`,n[3]=r[1],n[4]=r[2],n[5]=``)}var i=n[3],a=n[1]||vt;return[a,i]=bt(a,i),yt(t,i,a,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Ot=/\(error: (.*)\)/,kt=50;function At(){return function(e){var t=[...arguments].slice(1);return function(n,r){r===void 0&&(r=0);for(var i=[],a=n.split(`
2`),o=r;o<a.length;o++){var s=a[o];if(!(s.length>1024)){var c=Ot.test(s)?s.replace(Ot,`$1`):s;if(!c.match(/\S*Error: /)){for(var l of t){var u=l(c,e);if(u){i.push(u);break}}if(i.length>=kt)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,kt).map((e=>{return x({},e,{filename:e.filename||(n=t,n[n.length-1]||{}).filename,function:e.function||vt});var n}))}(i)}}(`web:javascript`,wt,Dt)}var jt=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var n=N(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:n?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}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 de(e,`DOMException`)}isDOMError(e){return de(e,`DOMError`)}},Mt=class{match(e){return(e=>e 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 n=e.message;return n.error&&typeof n.error.message==`string`?String(n.error.message):String(n)}getStack(e){return e.stacktrace||e.stack||void 0}},Nt=class{constructor(){}match(e){return de(e,`ErrorEvent`)&&e.error!=null}coerce(e,t){var n;return t.apply(e.error)||{type:`ErrorEvent`,value:e.message,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Pt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ft=class{match(e){return typeof e==`string`}coerce(e,t){var n,[r,i]=this.getInfos(e);return{type:r==null?`Error`:r,value:i==null?e:i,stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}getInfos(e){var t=`Error`,n=e,r=e.match(Pt);return r&&(t=r[1],n=r[2]),[t,n]}},It=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function Lt(e,t){t===void 0&&(t=40);var n=Object.keys(e);if(n.sort(),!n.length)return`[object has no keys]`;for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(`, `);if(!(i.length>t))return r===n.length||i.length<=t?i:i.slice(0,t)+`...`}return``}var Rt=class{match(e){return typeof e==`object`&&!!e}coerce(e,t){var n,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(n=t.syntheticException)==null?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:`error`,synthetic:!0}}getType(e){return fe(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 n=this.getObjectClassName(e);return(n&&n!==`Object`?`'`+n+`'`:`Object`)+` captured as exception with keys: `+Lt(e)}isSeverityLevel(e){return N(e)&&!ae(e)&&It.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=e[t];if(ht(n))return n}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},zt=class{match(e){return fe(e)}coerce(e,t){var n,r=e.constructor.name;return{type:r,value:r+` captured as exception with keys: `+Lt(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Bt=class{match(e){return ue(e)}coerce(e,t){var n;return{type:`Error`,value:`Primitive value captured as exception: `+String(e),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}}},Vt=class{match(e){return de(e,`PromiseRejectionEvent`)}coerce(e,t){var n,r=this.getUnhandledRejectionReason(e);return ue(r)?{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: `+String(r),stack:(n=t.syntheticException)==null?void 0:n.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(ue(e))return e;try{if(`reason`in e)return e.reason;if(`detail`in e&&`reason`in e.detail)return e.detail.reason}catch{}return e}},Ht=function(e,t){var{debugEnabled:n}=t===void 0?{}:t,r={k:function(t){if(a&&(v.DEBUG||_.POSTHOG_DEBUG||n)&&!M(a.console)&&a.console){for(var r=(`__rrweb_original__`in a.console[t])?a.console[t].__rrweb_original__:a.console[t],i=arguments.length,o=Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];r(e,...o)}},info:function(){var e=[...arguments];r.k(`log`,...e)},warn:function(){var e=[...arguments];r.k(`warn`,...e)},error:function(){var e=[...arguments];r.k(`error`,...e)},critical:function(){console.error(e,...arguments)},uninitializedWarning:e=>{r.error(`You must initialize PostHog before calling `+e)},createLogger:(t,n)=>Ht(e+` `+t,n)};return r},z=Ht(`[PostHog.js]`),B=z.createLogger,Ut=B(`[ExternalScriptsLoader]`),Wt=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return Ut.warn(t+` was requested but loading of external scripts is disabled.`),n(`Loa
2ding of external scripts is disabled`);var r=d==null?void 0:d.querySelectorAll(`script`);if(r){for(var i,a=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:n()}:(e.addEventListener(`load`,(t=>{e.__posthog_loading_callback_fired=!0,n(void 0,t)})),e.onerror=e=>n(e),{v:void 0})}},o=0;o<r.length;o++)if(i=a())return i.v}var s=()=>{if(!d)return n(`document not found`);var r=d.createElement(`script`);if(r.type=`text/javascript`,r.crossOrigin=`anonymous`,r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,n(void 0,e)},r.onerror=e=>n(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return n(`prepare_external_dependency_script returned null`);if(e.config.external_scripts_inject_target===`head`)d.head.appendChild(r);else{var i,a=d.querySelectorAll(`body > script`);a.length>0?(i=a[0].parentNode)==null||i.insertBefore(r,a[0]):d.body.appendChild(r)}};d!=null&&d.body?s():d==null||d.addEventListener(`DOMContentLoaded`,s)};_.__PosthogExtensions__=_.__PosthogExtensions__||{},_.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r=`/static/`+t+`.js?v=`+e.version;if(t===`remote-config`&&(r=`/array/`+e.config.token+`/config.js`),t===`toolbar`){var i=3e5;r=r+`&t=`+Math.floor(Date.now()/i)*i}Wt(e,e.requestRouter.endpointFor(`assets`,r),n)},_.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{Wt(e,e.requestRouter.endpointFor(`api`,t),n)};var Gt={};function Kt(e,t,n){if(k(e)){if(c&&e.forEach===c)e.forEach(t,n);else if(`length`in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===Gt)return}}}function V(e,t,n){if(!F(e)){if(k(e))return Kt(e,t,n);if(ce(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===Gt)return}else for(var i in e)if(O.call(e,i)&&t.call(n,e[i],i)===Gt)return}}var H=function(e){return Kt([...arguments].slice(1),(function(t){for(var n in t)t[n]!==void 0&&(e[n]=t[n])})),e},qt=function(e){return Kt([...arguments].slice(1),(function(t){Kt(t,(function(t){e.push(t)}))})),e};function Jt(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var Yt=function(e){try{return e()}catch{return}},Xt=function(e){return function(){try{var t=[...arguments];return e.apply(this,t)}catch(e){z.critical(`Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A.`),z.critical(e)}}},Zt=function(e){var t={};return V(e,(function(e,n){(N(e)&&e.length>0||oe(e))&&(t[n]=e)})),t};function Qt(e,t){return n=e,r=e=>N(e)&&!P(t)?e.slice(0,t):e,i=new Set,function e(t,n){return t===Object(t)?i.has(t)?void 0:(i.add(t),k(t)?(a=[],Kt(t,(t=>{a.push(e(t))}))):(a={},V(t,((t,n)=>{i.has(t)||(a[n]=e(t,n))}))),a):r?r(t,n):t;var a}(n);var n,r,i}var $t=[`herokuapp.com`,`vercel.app`,`netlify.app`];function en(e){var t=e==null?void 0:e.hostname;if(!N(t))return!1;var n=t.split(`.`).slice(-2).join(`.`);for(var r of $t)if(n===r)return!1;return!0}function tn(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function U(e,t,n,r){var{capture:i=!1,passive:a=!0}=r==null?{}:r;e==null||e.addEventListener(t,n,{capture:i,passive:a})}function nn(e){return e.name===`ph_toolbar_internal`}var rn=`$people_distinct_id`,an=`__alias`,on=`__timers`,sn=`$autocapture_disabled_server_side`,cn=`$heatmaps_enabled_server_side`,ln=`$exception_capture_enabled_server_side`,un=`$error_tracking_suppression_rules`,dn=`$error_tracking_capture_extension_exceptions`,fn=`$web_vitals_enabled_server_side`,pn=`$dead_clicks_enabled_server_side`,mn=`$product_tours_enabled_server_side`,hn=`$web_vitals_allowed_metrics`,gn=`$session_recording_remote_config`,_n=`$sesid`,vn=`$session_is_sampled`,yn=`$enabled_feature_flags`,bn=`$early_access_features`,xn=`$feature_flag_details`,Sn=`$stored_person_properties`,Cn=`$stored_group_properties`,wn=`$surveys`,Tn=`$flag_call_reported`,En=`$feature_flag_errors`,Dn=`$user_state`,On=`$client_session_props`,kn=`$capture_rate_limit`,An=`$initial_campaign_params`,jn=`$initial_referrer_info`,Mn=`$initial_person_info`,Nn=`$epp`,Pn=`__POSTHOG_TOOLBAR__`,Fn=`$posthog_cookieless`,In=[rn,an,`__cmpns`,on,`$session_recording_enabled_server_side`,cn,_n,yn,un,Dn,bn,xn,Cn,Sn,wn,Tn,En,On,kn,An,jn,Nn,Mn
2];function Ln(e){return e instanceof Element&&(e.id===Pn||!(e.closest==null||!e.closest(`.toolbar-global-fade-container`)))}function Rn(e){return!!e&&e.nodeType===1}function zn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Bn(e){return!!e&&e.nodeType===3}function Vn(e){return!!e&&e.nodeType===11}function Hn(e){return e?te(e).split(/\s+/):[]}function Un(e){var t=a==null?void 0:a.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function Wn(e){var t=``;switch(typeof e.className){case`string`:t=e.className;break;case`object`:t=(e.className&&`baseVal`in e.className?e.className.baseVal:null)||e.getAttribute(`class`)||``;break;default:t=``}return Hn(t)}function Gn(e){return F(e)?null:te(e).split(/(\s+)/).filter((e=>fr(e))).join(``).replace(/[\r\n]/g,` `).replace(/[ ]+/g,` `).substring(0,255)}function Kn(e){var t=``;return ir(e)&&!ar(e)&&e.childNodes&&e.childNodes.length&&V(e.childNodes,(function(e){var n;Bn(e)&&e.textContent&&(t+=(n=Gn(e.textContent))==null?``:n)})),te(t)}function qn(e){return M(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Jn=[`a`,`button`,`form`,`input`,`select`,`textarea`,`label`];function Yn(e,t){if(M(t))return!0;var n,r=function(e){if(t.some((t=>e.matches(t))))return{v:!0}};for(var i of e)if(n=r(i))return n.v;return!1}function Xn(e){var t=e.parentNode;return!(!t||!Rn(t))&&t}var Zn=[`next`,`previous`,`prev`,`>`,`<`],Qn=10,$n=[`.ph-no-rageclick`,`.ph-no-capture`];function er(e,t){if(!a||tr(e))return!1;var n,r,i;if(I(t)?(n=!!t&&$n,r=void 0):(n=(i=t==null?void 0:t.css_selector_ignorelist)==null?$n:i,r=t==null?void 0:t.content_ignorelist),!1===n)return!1;var{targetElementList:o}=nr(e,!1);return!function(e,t){if(!1===e||M(e))return!1;var n;if(!0===e)n=Zn;else{if(!k(e))return!1;if(e.length>Qn)return z.error(`[PostHog] content_ignorelist array cannot exceed `+Qn+` items. Use css_selector_ignorelist for more complex matching.`),!1;n=e.map((e=>e.toLowerCase()))}return t.some((e=>{var{safeText:t,ariaLabel:r}=e;return n.some((e=>t.includes(e)||r.includes(e)))}))}(r,o.map((e=>{var t;return{safeText:Kn(e).toLowerCase(),ariaLabel:((t=e.getAttribute(`aria-label`))==null?void 0:t.toLowerCase().trim())||``}})))&&!Yn(o,n)}var tr=e=>!e||zn(e,`html`)||!Rn(e),nr=(e,t)=>{if(!a||tr(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[e],i=e;i.parentNode&&!zn(i,`body`);)if(Vn(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var o=Xn(i);if(!o)break;if(t||Jn.indexOf(o.tagName.toLowerCase())>-1)n=!0;else{var s=a.getComputedStyle(o);s&&s.getPropertyValue(`cursor`)===`pointer`&&(n=!0)}r.push(o),i=o}return{parentIsUsefulElement:n,targetElementList:r}};function rr(e,t,n,r,i){var o,s,c,l;if(n===void 0&&(n=void 0),!a||tr(e)||(o=n)!=null&&o.url_allowlist&&!Un(n.url_allowlist)||(s=n)!=null&&s.url_ignorelist&&Un(n.url_ignorelist))return!1;if((c=n)!=null&&c.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:d,targetElementList:f}=nr(e,r);if(!function(e,t){var n=t==null?void 0:t.element_allowlist;if(M(n))return!0;var r,i=function(e){if(n.some((t=>e.tagName.toLowerCase()===t)))return{v:!0}};for(var a of e)if(r=i(a))return r.v;return!1}(f,n)||!Yn(f,(l=n)==null?void 0:l.css_selector_allowlist))return!1;var p=a.getComputedStyle(e);if(p&&p.getPropertyValue(`cursor`)===`pointer`&&t.type===`click`)return!0;var m=e.tagName.toLowerCase();switch(m){case`html`:return!1;case`form`:return(i||[`submit`]).indexOf(t.type)>=0;case`input`:case`select`:case`textarea`:return(i||[`change`,`click`]).indexOf(t.type)>=0;default:return d?(i||[`click`]).indexOf(t.type)>=0:(i||[`click`]).indexOf(t.type)>=0&&(Jn.indexOf(m)>-1||e.getAttribute(`contenteditable`)===`true`)}}function ir(e){for(var t=e;t.parentNode&&!zn(t,`body`);t=t.parentNode){var n=Wn(t);if(T(n,`ph-sensitive`)||T(n,`ph-no-capture`))return!1}if(T(Wn(e),`ph-include`))return!0;var r=e.type||``;if(N(r))switch(r.toLowerCase()){case`hidden`:case`password`:return!1}var i=e.name||e.id||``;return!(N(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,``)))}function ar(e){return!!(zn(e,`input`)&&![`button`,`checkbox`,`submit`,`reset`].includes(e.type)||zn(e,`select`)||zn(e,`textarea`)||e.getAttribute(`contenteditable`)===`true`)}var or=`(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}
2)|((?:2131|1800|35[0-9]{3})[0-9]{11})`,sr=RegExp(`^(?:`+or+`)$`),cr=new RegExp(or),lr=`\\d{3}-?\\d{2}-?\\d{4}`,ur=RegExp(`^(`+lr+`)$`),dr=RegExp(`(`+lr+`)`);function fr(e,t){return t===void 0&&(t=!0),!(F(e)||N(e)&&(e=te(e),(t?sr:cr).test((e||``).replace(/[- ]/g,``))||(t?ur:dr).test(e)))}function pr(e){var t=Kn(e);return fr(t=(t+` `+mr(e)).trim())?t:``}function mr(e){var t=``;return e&&e.childNodes&&e.childNodes.length&&V(e.childNodes,(function(e){var n;if(e&&((n=e.tagName)==null?void 0:n.toLowerCase())===`span`)try{var r=Kn(e);t=(t+` `+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+` `+mr(e)).trim())}catch(e){z.error(`[AutoCapture]`,e)}})),t}function hr(e){return function(e){return e.map((e=>{var t,n,r=``;if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var i of(e.attr_class.sort(),e.attr_class))r+=`.`+i.replace(/"/g,``);var a=x({},e.text?{text:e.text}:{},{"nth-child":(t=e.nth_child)==null?0:t,"nth-of-type":(n=e.nth_of_type)==null?0:n},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Jt(a).sort(((e,t)=>{var[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{var[t,n]=e;return o[gr(t.toString())]=gr(n.toString())})),r+=`:`,r+=Jt(o).map((e=>{var[t,n]=e;return t+`="`+n+`"`})).join(``)})).join(`;`)}(function(e){return e.map((e=>{var t,n,r={text:(t=e.$el_text)==null?void 0:t.slice(0,400),tag_name:e.tag_name,href:(n=e.attr__href)==null?void 0:n.slice(0,2048),attr_class:_r(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Jt(e).filter((e=>{var[t]=e;return t.indexOf(`attr__`)===0})).forEach((e=>{var[t,n]=e;return r.attributes[t]=n})),r}))}(e))}function gr(e){return e.replace(/"|\\"/g,`\\"`)}function _r(e){var t=e.attr__class;return t?k(t)?t:Hn(t):void 0}var vr=class{constructor(e){this.disabled=!1===e;var t=j(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,n){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&n-r.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}},yr=e=>{var t=d==null?void 0:d.createElement(`a`);return M(t)?null:(t.href=e,t)},br=function(e,t){var n,r;t===void 0&&(t=`&`);var i=[];return V(e,(function(e,t){M(e)||M(t)||t===`undefined`||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),i[i.length]=r+`=`+n)})),i.join(t)},xr=function(e,t){for(var n,r=((e.split(`#`)[0]||``).split(/\?(.*)/)[1]||``).replace(/^\?+/g,``).split(`&`),i=0;i<r.length;i++){var a=r[i].split(`=`);
2if(a[0]===t){n=a;break}}if(!k(n)||n.length<2)return``;var o=n[1];try{o=decodeURIComponent(o)}catch{z.error(`Skipping decoding for malformed query param: `+o)}return o.replace(/\+/g,` `)},Sr=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split(`#`),i=r[0]||``,a=r[1],o=i.split(`?`),s=o[1],c=o[0],l=(s||``).split(`&`),u=[],d=0;d<l.length;d++){var f=l[d].split(`=`);k(f)&&(t.includes(f[0])?u.push(f[0]+`=`+n):u.push(l[d]))}var p=c;return s!=null&&(p+=`?`+u.join(`&`)),a!=null&&(p+=`#`+a),p},Cr=function(e,t){var n=e.match(RegExp(t+`=([^&]*)`));return n?n[1]:null},wr=`$copy_autocapture`,Tr=B(`[AutoCapture]`);function Er(e,t){return t.length>e?t.slice(0,e)+`...`:t}function Dr(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Rn(t));return t}function Or(e,t,n,r){var i=e.tagName.toLowerCase(),a={tag_name:i};Jn.indexOf(i)>-1&&!n&&(a.$el_text=i.toLowerCase()===`a`||i.toLowerCase()===`button`?Er(1024,pr(e)):Er(1024,Kn(e)));var o=Wn(e);o.length>0&&(a.classes=o.filter((function(e){return e!==``}))),V(e.attributes,(function(n){var i;if((!ar(e)||[`name`,`id`,`class`,`aria-label`].indexOf(n.name)!==-1)&&(r==null||!r.includes(n.name))&&!t&&fr(n.value)&&(i=n.name,!N(i)||i.substring(0,10)!==`_ngcontent`&&i.substring(0,7)!==`_nghost`)){var o=n.value;n.name===`class`&&(o=Hn(o).join(` `)),a[`attr__`+n.name]=Er(1024,o)}}));for(var s=1,c=1,l=e;l=Dr(l);)s++,l.tagName===e.tagName&&c++;return a.nth_child=s,a.nth_of_type=c,a}function kr(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:c,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!zn(d,`body`);)Vn(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,p=[],m={},h=!1,g=!1;if(V(u,(e=>{var t=ir(e);e.tagName.toLowerCase()===`a`&&(h=e.getAttribute(`href`),h=t&&h&&fr(h)&&h),T(Wn(e),`ph-no-capture`)&&(g=!0),p.push(Or(e,o,s,c)),H(m,function(e){if(!ir(e))return{};var t={};return V(e.attributes,(function(e){if(e.name&&e.name.indexOf(`data-ph-capture-attribute`)===0){var n=e.name.replace(`data-ph-capture-attribute-`,``),r=e.value;n&&r&&fr(r)&&(t[n]=r)}})),t}(e))})),g)return{props:{},explicitNoCapture:g};if(s||(e.tagName.toLowerCase()===`a`||e.tagName.toLowerCase()===`button`?p[0].$el_text=pr(e):p[0].$el_text=Kn(e)),h){var _,v;p[0].attr__href=h;var y=(_=yr(h))==null?void 0:_.host,b=a==null||(v=a.location)==null?void 0:v.host;y&&b&&y!==b&&(f=h)}return{props:H({$event_type:i.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:hr(p)},(n=p[0])!=null&&n.$el_text?{$el_text:(r=p[0])==null?void 0:r.$el_text}:{},f&&i.type===`click`?{$external_click_url:f}:{},m)}}var Ar=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new vr(e.config.rageclick),this.C=null}get R(){var e,t,n=j(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map((e=>new RegExp(e))),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map((e=>new RegExp(e))),n}F(){if(this.isBrowserSupported()){if(a&&d){var e=e=>{e=e||(a==null?void 0:a.event);try{this.O(e)}catch(e){Tr.error(`Failed to capture event`,e)}};if(U(d,`submit`,e,{capture:!0}),U(d,`change`,e,{capture:!0}),U(d,`click`,e,{capture:!0}),this.R.capture_copied_text){var t=e=>{e=e||(a==null?void 0:a.event),this.O(e,wr)};U(d,`copy`,t,{capture:!0}),U(d,`cut`,t,{capture:!0})}}}else Tr.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({[sn]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,n=[];return(t=this.C)==null||t.forEach((t=>{var r=d==null?void 0:d.querySelectorAll(t);r==null||r.forEach((r=>{e===r&&n.push(t)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[sn],r=this.T;if(P(r)&&!I(n)&&!this.instance.M())return!1;var i=(t=this.T)==null?!!n:t;return!!this.instance.config.autocapture&&!i}O(e,t){if(t===void 0&&(t=`$autocapture`),this.isEnabled){var n,r=qn(e);Bn(r)&&(r=r.parentNode||null),t===`$autocapture`&&e.type===`click`&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&er(r,this.instance.config.rageclick)&&this.O(e,`$rageclick`);var i=t===wr;if(r&&rr(r,e,this.R,i,i?[`copy`,`cut`]:void 0)){var{props:o,explicitNoCapture:s}=kr(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsC
2hainAsString:this.I});if(s)return!1;var c=this.getElementSelectors(r);if(c&&c.length>0&&(o.$element_selectors=c),t===wr){var l,u=Gn(a==null||(l=a.getSelection())==null?void 0:l.toString()),d=e.type||`clipboard`;if(!u)return!1;o.$selected_content=u,o.$copy_type=d}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return A(d==null?void 0:d.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return oe(e)&&isFinite(e)&&Math.floor(e)===e});var jr=`0123456789abcdef`,Mr=class e{constructor(e){if(this.bytes=e,e.length!==16)throw TypeError(`not 128-bit length`)}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw RangeError(`invalid field value`);var a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/256,a[5]=t,a[6]=112|n>>>8,a[7]=n,a[8]=128|r>>>24,a[9]=r>>>16,a[10]=r>>>8,a[11]=r,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,new e(a)}toString(){for(var e=``,t=0;t<this.bytes.length;t++)e=e+jr.charAt(this.bytes[t]>>>4)+jr.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+=`-`);if(e.length!==36)throw Error(`Invalid UUIDv7 was generated`);return e}clone(){return new e(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}},Nr=class{constructor(){this.A=0,this.j=0,this.D=new Ir}generate(){var e=this.generateOrAbort();if(M(e)){this.A=0;var t=this.generateOrAbort();if(M(t))throw 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 Mr.fromFieldsV7(this.A,Math.trunc(this.j/2**30),this.j&2**30-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},Pr,Fr=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<`u`&&UUIDV7_DENY_WEAK_RNG)throw Error(`no cryptographically strong RNG available`);for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};a&&!M(a.crypto)&&crypto.getRandomValues&&(Fr=e=>crypto.getRandomValues(e));var Ir=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Fr(this.N),this.U=0),this.N[this.U++]}},Lr=()=>Rr().toString(),Rr=()=>(Pr||(Pr=new Nr)).generate(),zr=``,Br=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Vr(e,t){if(t){var n=function(e,t){if(t===void 0&&(t=d),zr)return zr;if(!t||[`localhost`,`127.0.0.1`].includes(e))return``;for(var n=e.split(`.`),r=Math.min(n.length,8),i=`dmn_chk_`+Lr();!zr&&r--;){var a=n.slice(r).join(`.`),o=i+`=1;domain=.`+a+`;path=/`;t.cookie=o+`;max-age=3`,t.cookie.includes(i)&&(t.cookie=o+`;max-age=0`,zr=a)}return zr}(e);if(!n){var r=(e=>{var t=e.match(Br);return t?t[0]:``})(e);r!==n&&z.info(`Warning: cookie subdomain discovery mismatch`,r,n),n=r}return n?`; domain=.`+n:``}return``}var Hr={H:()=>!!d,B:function(e){z.error(`cookieStore error: `+e)},q:function(e){if(d){try{for(var t=e+`=`,n=d.cookie.split(`;`).filter((e=>e.length)),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==` `;)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},W:function(e){var t;try{t=JSON.parse(Hr.q(e))||{}}catch{}return t},G:function(e,t,n,r,i){if(d)try{var a=``,o=``,s=Vr(d.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),a=`; expires=`+c.toUTCString()}i&&(o=`; secure`);var l=e+`=`+encodeURIComponent(JSON.stringify(t))+a+`; SameSite=Lax; path=/`+s+o;return l.length>3686.4&&z.warn(`cookieStore warning: large cookie, len=`+l.length),d.cookie=l,l}catch{return}},V:function(e,t){if(d!=null&&d.cookie)try{Hr.G(e,``,-1,t)}catch{return}}},Ur=null,W={H:function(){if(!P(Ur))return Ur;var e=!0;if(M(a))e=!1;else try{var t=`__mplssupport__`;W.G(t,`xyz`),W.q(t)!==`"xyz"`&&(e=!1),W.V(t)}catch{e=!1}return e||z.error(`localStorage unsupported; falling back to cookie store`),Ur=e,e},B:function(e){z.error(`localStorage error: `+e)},q:function(e){try{return a==null?void 0:a.localStorage.getItem(e)}catch(e){W.B(e)}return null},W:function(e){try{return JSON.parse(W.q(e))||{}}catch{}return null},G:function(e,t){try{a==null||a.localStorage.setItem(e,JSON.stringify(t))}catch(e){W.B(e)}},V:function(e){try{a==null||a.localStorage.removeItem(e)}catch(e){W.B(e)}}},Wr=[`$device_id`,`distinct_id`,_n,vn,Nn,Mn,Dn],Gr={},Kr={H:function(){return!0},B:function(e){z.error(`memoryStorage error: `+e)},q:function(e){return Gr[e]||null},W:function(e){return Gr[e]||null},G:function(e,t){Gr[e]=t},V:function(e){delete Gr[e]}},qr=null,G={H:function(){if(!P(qr))return qr;if(qr=!0,M(a))qr=!1;else try{var e=`__support__`;G.G(e,`xyz`),G.q(e)!==`"xyz"`&&(qr=!1),G.V(e)}catch{qr=!1}return qr},B:function(e){z.error(`sessionStorage error: `,e)},q:function(e){try{return a==null?void 0:a.sessionStorage.getItem(e)}catch(e){G.B(e)}return null},W:function(e){try{return JSON.parse(G.q(e))||null}catch{}return null},G:function(e,t){try{a==null||a.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){G.B(e)}},V:function(e){try{a==null||a.sessionStorage.removeItem(e)}catch(e){G.B(e)}}},Jr=function(e){return e[e.PENDING=-1]=`PENDING`,e[e.DENIED=0]=`DENIED`,e[e.GRANTED=1]=`GRANTED`,e}({}),Yr=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?Jr.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode===`always`||this.consent===Jr.DENIED||this.consent===Jr.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode===`on_reject`)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Jr.DENIED}optInOut(e){this.Y.G(this.X,+!!e,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:n}=this._instance.config;return n||(t?t+e:`__ph_opt_in_out_`+e)}get K(){var e=this.Y.q(this.X);return me(e)?Jr.GRANTED:T(he,e)?Jr.DENIED:Jr.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e===`localStorage`?W:Hr;var t=e===`localStorage`?Hr:W;
2t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(me(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!tn([u==null?void 0:u.doNotTrack,u==null?void 0:u.msDoNotTrack,_.doNotTrack],(e=>me(e)))}},Xr=B(`[Dead Clicks]`),Zr=()=>!0,Qr=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(pn)),r=e.instance.config.capture_dead_clicks;return I(r)?r:!!j(r)||n},$r=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabledOrStop()}onRemoteConfig(e){`captureDeadClicks`in e&&(this.instance.persistence&&this.instance.persistence.register({[pn]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.it((()=>{this.et()})):this.stop()}it(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,`dead-clicks-autocapture`,(t=>{t?Xr.error(`failed to load script`,t):e()}))}et(){var e;if(d){if(!this.tt&&(e=_.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=j(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=_.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(d),Xr.info(`starting...`)}}else Xr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Xr.info(`stopping...`))}},ei=B(`[ExceptionAutocapture]`),ti=class{constructor(e){var t,n,r;this.rt=()=>{var e;if(a&&this.isEnabled&&(e=_.__PosthogExtensions__)!=null&&e.errorWrappingFunctions){var t=_.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=_.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=_.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=t(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=n(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=r(this.captureException.bind(this)))}catch(e){ei.error(`failed to start`,e),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[ln]),this.dt=new _e({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)==null?1:n,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)==null?10:r,refillInterval:1e4,h:ei}),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 j(e)?t=x({},t,e):(M(e)?this.ht:e)&&(t=x({},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?(ei.info(`enabled`),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`exception-autocapture`,(t=>{if(t)return ei.error(`failed to load script`,t);e()}))}ut(){var e,t,n;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(n=this.ot)==null||n.call(this),this.ot=void 0}onRemoteConfig(e){if(`autocaptureExceptions`in e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[ln]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}}onConfigChange(){this.R=this.vt()}captureException(e){var t,n,r=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)==null?`Exception`:t;this.dt.consumeRateLimit(r)?ei.info(`Skipping exception capture because of client rate limiting.`,{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}};function ni(e,t,n){try{if(!(t in e))return()=>{};var r=e[t],i=n(r);return A(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var ri=class{constructor(e){var t;this._instance=e,this.ct=(a==null||(t=a.location)==null?void 0:t.pathname)||``}get isEnabled(){return this._instance.config.capture_pageview===`history_change`}startIfEnabled(){this.isEnabled&&(z.info(`History API monitoring enabled, starting...`),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,z.info(`History API monitoring stopped`)}monitorHistoryChanges(){var e,t;if(a&&a.history){var n=this;(e=a.history.pushState)!=null&&e.__posthog_wrapped__||ni(a.history,`pushState`,(e=>function(t,r,i){e.call(this,t,r,i),n._t(`pushState`)})),(t=a.history.replaceState)!=null&&t.__posthog_wrapped__||ni(a.history,`replaceState`,(e=>function(t,r,i){e.call(this,t,r,i),n._t(`replaceState`)})),this.bt()}}_t(e){try{var t,n=a==null||(t=a.location)==null?void 0:t.pathname;if(!n)return;n!==this.ct&&this.isEnabled&&this._instance.capture(`$pageview`,{navigation_type:e}),this.ct=n}catch(t){z.error(`Error capturing `+e+` pageview`,t)}}
2bt(){if(!this.ft){var e=()=>{this._t(`popstate`)};U(a,`popstate`,e),this.ft=()=>{a&&a.removeEventListener(`popstate`,e)}}}},ii=B(`[SegmentIntegration]`);function ai(e,t){var n=e.config.segment;if(!n)return t();(function(e,t){var n=e.config.segment;if(!n)return t();var r=n=>{var r=()=>n.anonymousId()||Lr();e.config.get_device_id=r,n.id()&&(e.register({distinct_id:n.id(),$device_id:r()}),e.persistence.set_property(Dn,`identified`)),t()},i=n.user();`then`in i&&A(i.then)?i.then(r):r(i)})(e,(()=>{n.register((e=>{Promise&&Promise.resolve||ii.warn(`This browser does not have Promise support, and can not use the segment integration`);var t=(t,n)=>{if(!n)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(ii.info(`No userId set, resetting PostHog`),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(ii.info(`UserId set, identifying with PostHog`),e.identify(t.event.userId));var r=e.calculateEventProperties(n,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:`PostHog JS`,type:`enrichment`,version:`1.0.0`,isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,`$pageview`),identify:e=>t(e,`$identify`),screen:e=>t(e,`$screen`)}})(e)).then((()=>{t()}))}))}var oi=`posthog-js`;function si(e,t){var{organization:n,projectId:r,prefix:i,severityAllowList:a=[`error`],sendExceptionsToPostHog:o=!0}=t===void 0?{}:t;return t=>{var s,c,l,u,d;if(!(a===`*`||a.includes(t.level))||!e.__loaded)return t;t.tags||(t.tags={});var f=e.requestRouter.endpointFor(`ui`,`/project/`+e.config.token+`/person/`+e.get_distinct_id());t.tags[`PostHog Person URL`]=f,e.sessionRecordingStarted()&&(t.tags[`PostHog Recording URL`]=e.get_session_replay_url({withTimestamp:!0}));var p=((s=t.exception)==null?void 0:s.values)||[],m=p.map((e=>x({},e,{stacktrace:e.stacktrace?x({},e.stacktrace,{type:`raw`,frames:(e.stacktrace.frames||[]).map((e=>x({},e,{platform:`web:javascript`})))}):void 0}
2))),h={$exception_message:((c=p[0])==null?void 0:c.value)||t.message,$exception_type:(l=p[0])==null?void 0:l.type,$exception_level:t.level,$exception_list:m,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:((u=p[0])==null?void 0:u.value)||t.message,$sentry_exception_type:(d=p[0])==null?void 0:d.type,$sentry_tags:t.tags};return n&&r&&(h.$sentry_url=(i||`https://sentry.io/organizations/`)+n+`/issues/?project=`+r+`&query=`+t.event_id),o&&e.exceptions.sendExceptionEvent(h),t}}var ci=class{constructor(e,t,n,r,i,a){this.name=oi,this.setupOnce=function(o){o(si(e,{organization:t,projectId:n,prefix:r,severityAllowList:i,sendExceptionsToPostHog:a==null||a}))}}},li=a!=null&&a.location?Cr(a.location.hash,`__posthog`)||Cr(location.hash,`state`):null,ui=`_postHogToolbarParams`,di=B(`[Toolbar]`),fi=function(e){return e[e.UNINITIALIZED=0]=`UNINITIALIZED`,e[e.LOADING=1]=`LOADING`,e[e.LOADED=2]=`LOADED`,e}(fi||{}),pi=class{constructor(e){this.instance=e}yt(e){_.ph_toolbar_state=e}wt(){var e;return(e=_.ph_toolbar_state)==null?fi.UNINITIALIZED:e}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),nn(this.instance.config)||!a||!d)return!1;e=e==null?a.location:e,n=n==null?a.history:n;try{if(!t){try{a.localStorage.setItem(`test`,`test`),a.localStorage.removeItem(`test`)}catch{return!1}t=a==null?void 0:a.localStorage}var r,i=li||Cr(e.hash,`__posthog`)||Cr(e.hash,`state`),o=i?Yt((()=>JSON.parse(atob(decodeURIComponent(i)))))||Yt((()=>JSON.parse(decodeURIComponent(i)))):null;return o&&o.action===`ph_authorize`?((r=o).source=`url`,r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,``,e.pathname+e.search):e.hash=``)):((r=JSON.parse(t.getItem(ui)||`{}`)).source=`localstorage`,delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}xt(e){var t=_.ph_load_toolbar||_.ph_load_editor;!F(t)&&A(t)?t(e,this.instance):di.warn(`No toolbar load function found`)}loadToolbar(e){var t=!(d==null||!d.getElementById(Pn));if(!a||t)return!1;var n=this.instance.requestRouter.region===`custom`&&this.instance.config.advanced_disable_toolbar_metrics,r=x({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor(`ui`)},n?{instrument:!1}:{});if(a.localStorage.setItem(ui,JSON.stringify(x({},r,{source:void 0}))),this.wt()===fi.LOADED)this.xt(r);else if(this.wt()===fi.UNINITIALIZED){var i;this.yt(fi.LOADING),(i=_.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,`toolbar`,(e=>{if(e)return di.error(`[Toolbar] Failed to load`,e),void this.yt(fi.UNINITIALIZED);this.yt(fi.LOADED),this.xt(r)})),U(a,`turbolinks:load`,(()=>{this.yt(fi.UNINITIALIZED),this.loadToolbar(r)}))}return!0}$t(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}},mi=B(`[TracingHeaders]`),hi=class{constructor(e){this.Et=void 0,this.St=void 0,this.rt=()=>{var e,t;M(this.Et)&&((e=_.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),M(this.St)&&((t=_.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`tracing-headers`,(t=>{if(t)return mi.error(`failed to load script`,t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.Et)==null||e.call(this),(t=this.St)==null||t.call(this),this.Et=void 0,this.St=void 0)}},gi=`https?://(.*)`,_i=[`gclid`,`gclsrc`,`dclid`,`gbraid`,`wbraid`,`fbclid`,`msclkid`,`twclid`,`li_fat_id`,`igshid`,`ttclid`,`rdt_cid`,`epik`,`qclid`,`sccid`,`irclid`,`_kx`],vi=qt([`utm_source`,`utm_medium`,`utm_campaign`,`utm_content`,`utm_term`,`gad_source`,`mc_cid`],_i),yi=`<masked>`,bi=[`li_fat_id`];function xi(e,t,n){if(!d)return{};var r,i=t?qt([],_i,n||[]):[],a=Si(Sr(d.URL,i,yi),e);return H((r={},V(bi,(function(e){var t=Hr.q(e);r[e]=t||null})),r),a)}function Si(e,t){var n=vi.concat(t||[]),r={};return V(n,(function(t){r[t]=xr(e,t)||null})),r}function Ci(e){var t=function(e){return e?e.search(gi+`google.([^/?]*)`)===0?`google`:e.search(gi+`bing.com`)===0?`bing`:e.search(gi+`yahoo.com`)===0?`yaho
2o`:e.search(gi+`duckduckgo.com`)===0?`duckduckgo`:null:null}(e),n=t==`yahoo`?`p`:`q`,r={};if(!P(t)){r.$search_engine=t;var i=d?xr(d.referrer,n):``;i.length&&(r.ph_keyword=i)}return r}function wi(){return navigator.language||navigator.userLanguage}function Ti(){return(d==null?void 0:d.referrer)||`$direct`}function Ei(e,t){var n=e?qt([],_i,t||[]):[],r=f==null?void 0:f.href.substring(0,1e3);return{r:Ti().substring(0,1e3),u:r?Sr(r,n,yi):void 0}}function Di(e){var t,{r:n,u:r}=e,i={$referrer:n,$referring_domain:n==null?void 0:n==`$direct`?`$direct`:(t=yr(n))==null?void 0:t.host};if(r){i.$current_url=r;var a=yr(r);i.$host=a==null?void 0:a.host,i.$pathname=a==null?void 0:a.pathname,H(i,Si(r))}return n&&H(i,Ci(n)),i}function Oi(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function ki(){try{return new Date().getTimezoneOffset()}catch{return}}function Ai(e,t){if(!g)return{};var n,r,i,o=e?qt([],_i,t||[]):[],[s,c]=function(e){for(var t=0;t<pt.length;t++){var[n,r]=pt[t],i=n.exec(e),a=i&&(A(r)?r(i,e):r);if(a)return a}return[``,``]}(g);return H(Zt({$os:s,$os_version:c,$browser:ut(g,navigator.vendor),$device:mt(g),$device_type:(r=g,i=mt(r),i===Se||i===xe||i===`Kobo`||i===`Kindle Fire`||i===Qe?be:i===Ve||i===Ue||i===He||i===Ye?`Console`:i===we?`Wearable`:i?L:`Desktop`),$timezone:Oi(),$timezone_offset:ki()}),{$current_url:Sr(f==null?void 0:f.href,o,yi),$host:f==null?void 0:f.host,$pathname:f==null?void 0:f.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+`...`:g,$browser_version:ft(g,navigator.vendor),$browser_language:wi(),$browser_language_prefix:(n=wi(),typeof n==`string`?n.split(`-`)[0]:void 0),$screen_height:a==null?void 0:a.screen.height,$screen_width:a==null?void 0:a.screen.width,$viewport_height:a==null?void 0:a.innerHeight,$viewport_width:a==null?void 0:a.innerWidth,$lib:`web`,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var ji=B(`[Web Vitals]`),Mi=9e5,Ni=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(((e,t)=>x({},e,{[`$web_vitals_`+t.name+`_event`]:x({},t),[`$web_vitals_`+t.name+`_value`]:t.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=e=>{var t,n=(t=this._instance.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0);if(M(n))ji.error(`Could not read session ID. Dropping metrics!`);else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Ct();M(r)||(F(e==null?void 0:e.name)||F(e==null?void 0:e.value)?ji.error(`Invalid metric received`,e):this.Rt&&e.value>=this.Rt?ji.error(`Ignoring metric with value >= `+this.Rt,e):(this.N.url!==r&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),M(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=M(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(x({},e,{$current_url:r,$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 e,t,n,r,i=_.__PosthogExtensions__;M(i)||M(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:n,onINP:r}=i.postHogWebVitalsCallbacks),e&&t&&n&&r?(this.allowedMetrics.indexOf(`LCP`)>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf(`CLS`)>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf(`FCP`)>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf(`INP`)>-1&&r(this.It.bind(this)),this.P=!0):ji.error(`web vitals callbacks not loaded - not starting`)}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[fn]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=j(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return F(n)?((t=this._instance.persistence)==null?void 0:t.props[hn])||[`CLS`,`FCP`,`INP`,`LCP`]:n}get flushToCaptureTimeoutMs(){return(j(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=j(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=j(this._instance.config.capture_performance)&&oe(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Mi;return 0<e&&e<=6e4?Mi:e}get isEnabled(){var e=f==null?void 0:f.protocol;if(e!==`http:`&&e!==`https:`)return ji.info(`Web Vitals are disabled on non-http/https protocols`),!1;var t=j(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:I(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return I(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(ji.info(`enabled, starting...`),this.it(this.rt))}onRemoteConfig(e){if(`capturePerformance`in e){var t=j(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=j(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[fn]:t}),this._instance.persistence.register({[hn]:n})),this.kt=t,this.startIfEnabled()}}it(e){var t,n;if((t=_.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var r=this.useAttribution?`web-vitals-with-attribution`:`web-vitals`;(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,r,(t=>{t?ji.error(`failed to load script`,t):e()}))}}Ct(){var e=a?a.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,n=this._instance.config.custom_personal_data_properties;return Sr(e,t?qt([],_i,n||[]):[],yi)}ji.error(`Could not determine current URL`)}},Pi=B(`[Heatmaps]`);function Fi(e){return j(e)&&`clientX`in e&&`clientY`in e&&oe(e.clientX)&&oe(e.clientY)}var Ii=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[cn]),this.rageclicks=new vr(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return j(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 F(this.instance.config.capture_heatmaps)?F(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;Pi.info(`starting...`),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)==null?void 0:e),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){if(`heatmaps`in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[cn]: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==null?void 0:e.visibilityState)===`visible`}(d)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){a&&d&&(this.Nt=this.Lt.bind(this),U(a,`beforeunload`,this.Nt),this.Ut=e=>this.Dt(e||(a==null?void 0:a.event)),U(d,`click`,this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||(a==null?void 0:a.event)),U(d,`mousemove`,this.zt,{capture:!0}),this.Bt=new $r(this.instance,Zr,this.jt.bind(this)),this.Bt.startIfEnabledOrStop(),this.qt=this.Mt.bind(this),U(d,`visibilitychange`,this.qt),this.P=!0)}At(){var e;a&&d&&(this.Nt&&a.removeEventListener(`beforeunload`,this.Nt),this.Ut&&d.removeEventListener(`click`,this.Ut,{capture:!0}),this.zt&&d.removeEventListener(`mousemove`,this.zt,{capture:!0}),this.qt&&d.removeEventListener(`visibilitychange`,this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),o=function(e,t,n){for(var r=e;r&&Rn(r)&&!zn(r,`body`);){if(r===n)return!1;if(T(t,a==null?void 0:a.getComputedStyle(r).position))return!0;r=Xn(r)}return!1}(qn(e),[`fixed`,`sticky`],i);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}Dt(e,t){var n;if(t===void 0&&(t=`click`),!Ln(e.target)&&Fi(e)){var r=this.Gt(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(x({},r,{type:`rageclick`})),this.Vt(r)}}Ht(e){!Ln(e.target)&&Fi(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>
2{this.Vt(this.Gt(e,`mousemove`))}),500))}Vt(e){if(a){var t=a.location.href,n=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,i=Sr(t,n?qt([],_i,r||[]):[],yi);this.N=this.N||{},this.N[i]||(this.N[i]=[]),this.N[i].push(e)}}Lt(){this.N&&!ie(this.N)&&this.instance.capture(`$$heatmap`,{$heatmap_data:this.getAndClearBuffer()})}},Li=class{constructor(e){this.Jt=(e,t,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength)&&(z.info(`[PageViewManager] Session rotated, clearing pageview state`,{sessionId:e,changeReason:n}),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 n,r=this.Qt(e,t);return this.Kt={pathname:(n=a==null?void 0:a.location.pathname)==null?``:n,pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}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 n=this.Kt;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:s,maxContentHeight:c,lastContentY:l,maxContentY:u}=i;if(!(M(a)||M(o)||M(s)||M(c)||M(l)||M(u))){a=Math.ceil(a),o=Math.ceil(o),s=Math.ceil(s),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);var d=a<=1?1:ge(o/a,0,1,z),f=a<=1?1:ge(s/a,0,1,z),p=c<=1?1:ge(l/c,0,1,z),m=c<=1?1:ge(u/c,0,1,z);r=H(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:m})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}},Ri=function(e){return e.GZipJS=`gzip-js`,e.Base64=`base64`,e}({}),K=Uint8Array,q=Uint16Array,zi=Uint32Array,Bi=new K([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]),Vi=new K([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]),Hi=new K([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ui=function(e,t){for(var n=new q(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new zi(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},Wi=Ui(Bi,2),Gi=Wi[0],Ki=Wi[1];Gi[28]=258,Ki[258]=28;for(var qi=Ui(Vi,0)[1],Ji=new q(32768),J=0;J<32768;++J){var Yi=(43690&J)>>>1|(21845&J)<<1;Yi=(61680&(Yi=(52428&Yi)>>>2|(13107&Yi)<<2))>>>4|(3855&Yi)<<4,Ji[J]=((65280&Yi)>>>8|(255&Yi)<<8)>>>1}var Xi=function(e,t,n){for(var r=e.length,i=0,a=new q(t);i<r;++i)++a[e[i]-1];var o,s=new q(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){o=new q(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=s[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)o[Ji[d]>>>c]=l}else for(o=new q(r),i=0;i<r;++i)o[i]=Ji[s[e[i]-1]++]>>>15-e[i];return o},Zi=new K(288);for(J=0;J<144;++J)Zi[J]=8;for(J=144;J<256;++J)Zi[J]=9;for(J=256;J<280;++J)Zi[J]=7;for(J=280;J<288;++J)Zi[J]=8;var Qi=new K(32);for(J=0;J<32;++J)Qi[J]=5;var $i=Xi(Zi,9,0),ea=Xi(Qi,5,0),ta=function(e){return(e/8>>0)+(7&e&&1)},na=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof q?q:e instanceof zi?zi:K)(n-t);return r.set(e.subarray(t,n)),r},ra=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},ia=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},aa=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[new K(0),0];if(i==1){var o=new K(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};var f=a[0].s;for(r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new q(f+1),m=oa(n[u-1],p,0);if(m>t){r=0;var h=0,g=m-t,_=1<<g;for(a.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));r<i;++r){var v=a[r].s;if(!(p[v]>t))break;h+=_-(1<<m-p[v]),p[v]=t}for(h>>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}
2return[new K(p),m]},oa=function(e,t,n){return e.s==-1?Math.max(oa(e.l,t,n+1),oa(e.r,t,n+1)):t[e.s]=n},sa=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new q(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[n.subarray(0,r),t]},ca=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},la=function(e,t,n){var r=n.length,i=ta(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},ua=function(e,t,n,r,i,a,o,s,c,l,u){ra(t,u++,n),++i[256];for(var d=aa(i,15),f=d[0],p=d[1],m=aa(a,15),h=m[0],g=m[1],_=sa(f),v=_[0],y=_[1],b=sa(h),x=b[0],S=b[1],C=new q(19),w=0;w<v.length;++w)C[31&v[w]]++;for(w=0;w<x.length;++w)C[31&x[w]]++;for(var ee=aa(C,7),T=ee[0],te=ee[1],E=19;E>4&&!T[Hi[E-1]];--E);var ne,D,O,re,k=l+5<<3,A=ca(i,Zi)+ca(a,Qi)+o,j=ca(i,f)+ca(a,h)+o+14+3*E+ca(C,T)+(2*C[16]+3*C[17]+7*C[18]);if(k<=A&&k<=j)return la(t,u,e.subarray(c,c+l));if(ra(t,u,1+(j<A)),u+=2,j<A){ne=Xi(f,p,0),D=f,O=Xi(h,g,0),re=h;var ie=Xi(T,te,0);for(ra(t,u,y-257),ra(t,u+5,S-1),ra(t,u+10,E-4),u+=14,w=0;w<E;++w)ra(t,u+3*w,T[Hi[w]]);u+=3*E;for(var M=[v,x],N=0;N<2;++N){var ae=M[N];for(w=0;w<ae.length;++w){var P=31&ae[w];ra(t,u,ie[P]),u+=T[P],P>15&&(ra(t,u,ae[w]>>>5&127),u+=ae[w]>>>12)}}}else ne=$i,D=Zi,O=ea,re=Qi;for(w=0;w<s;++w)if(r[w]>255){P=r[w]>>>18&31,ia(t,u,ne[P+257]),u+=D[P+257],P>7&&(ra(t,u,r[w]>>>23&31),u+=Bi[P]);var F=31&r[w];ia(t,u,O[F]),u+=re[F],F>3&&(ia(t,u,r[w]>>>5&8191),u+=Vi[F])}else ia(t,u,ne[r[w]]),u+=D[r[w]];return ia(t,u,ne[256]),u+D[256]},da=new zi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fa=function(){for(var e=new zi(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),pa=function(e,t,n,r,i){return function(e,t,n,r,i,a){var o=e.length,s=new K(r+o+5*(1+Math.floor(o/7e3))+i),c=s.subarray(r,s.length-i),l=0;if(!t||o<8)for(var u=0;u<=o;u+=65535){var d=u+65535;d<o?l=la(c,l,e.subarray(u,d)):(c[u]=a,l=la(c,l,e.subarray(u,o)))}else{for(var f=da[t-1],p=f>>>13,m=8191&f,h=(1<<n)-1,g=new q(32768),_=new q(h+1),v=Math.ceil(n/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&h},x=new zi(25e3),S=new q(288),C=new q(32),w=0,ee=0,T=(u=0,0),te=0,E=0;u<o;++u){var ne=b(u),D=32767&u,O=_[ne];if(g[D]=O,_[ne]=D,te<=u){var re=o-u;if((w>7e3||T>24576)&&re>423){l=ua(e,c,0,x,S,C,ee,T,E,u-E,l),T=w=ee=0,E=u;for(var k=0;k<286;++k)S[k]=0;for(k=0;k<30;++k)C[k]=0}var A=2,j=0,ie=m,M=D-O&32767;if(re>2&&ne==b(u-M))for(var N=Math.min(p,re)-1,ae=Math.min(32767,u),P=Math.min(258,re);M<=ae&&--ie&&D!=O;){if(e[u+A]==e[u+A-M]){for(var F=0;F<P&&e[u+F]==e[u+F-M];++F);if(F>A){if(A=F,j=M,F>N)break;var oe=Math.min(M,F-2),se=0;for(k=0;k<oe;++k){var I=u-M+k+32768&32767,ce=I-g[I]+32768&32767;ce>se&&(se=ce,O=I)}}}M+=(D=O)-(O=g[D])+32768&32767}if(j){x[T++]=268435456|Ki[A]<<18|qi[j];var le=31&Ki[A],ue=31&qi[j];ee+=Bi[le]+Vi[ue],++S[257+le],++C[ue],te=u+A,++w}else x[T++]=e[u],++S[e[u]]}}l=ua(e,c,a,x,S,C,ee,T,E,u-E,l)}return na(s,0,r+ta(l)+i)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},ma=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function ha(e,t){t===void 0&&(t={});var n=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=fa[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}}(),r=e.length;n.p(e);var i,a=pa(e,t,10+((i=t).filename&&i.filename.length+1||0),8),o=a.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&ma(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}}(a,t),ma(a,o-8,n.d()),ma(a,o-4,r),a}var ga=function(e){var t,n,r,i,a=``;for(t=n=0,r=(e=(e+``).replace(/\r\n/g,`
3`).replace(/\r/g,`
4`)).length,i=0;i<r;i++){var o=e.charCodeAt(i),s=null;o<128?n++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),P(s)||(n>t&&(a+=e.substring(t,n)),a+=s,t=n=i+1)}return n>t&&(a+=e.substring(t,e.length)),a},_a=!!m||!!p,va=`text/plain`,ya=function(e,t,n){var r;n===void 0&&(n=!0);var[i,a]=e.split(`?`),o=x({},t),s=(r=a==null?void 0:a.split(`&`).map((e=>{var t,[r,i]=e.split(`=`),a=n&&(t=o[r])!=null?t:i;return delete o[r],r+`=`+a})))==null?[]:r,c=br(o);return c&&s.push(c),i+`?`+s.join(`&`)},ba=(e,t)=>JSON.stringify(e,((e,t)=>
4typeof t==`bigint`?t.toString():t),t),xa=e=>{var{data:t,compression:n}=e;if(t){if(n===Ri.GZipJS){var r=ha(function(e,t){var n=e.length;if(typeof TextEncoder<`u`)return new TextEncoder().encode(e);for(var r=new K(e.length+(e.length>>>1)),i=0,a=function(e){r[i++]=e},o=0;o<n;++o){if(i+5>r.length){var s=new K(i+8+(n-o<<1));s.set(r),r=s}var c=e.charCodeAt(o);c<128||t?a(c):c<2048?(a(192|c>>>6),a(128|63&c)):c>55295&&c<57344?(a(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++o))>>>18),a(128|c>>>12&63),a(128|c>>>6&63),a(128|63&c)):(a(224|c>>>12),a(128|c>>>6&63),a(128|63&c))}return na(r,0,i)}(ba(t)),{mtime:0}),i=new Blob([r],{type:va});return{contentType:va,body:i,estimatedSize:i.size}}if(n===Ri.Base64){var a=(e=>`data=`+encodeURIComponent(typeof e==`string`?e:ba(e)))(function(e){var t,n,r,i,a,o=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,s=0,c=0,l=``,u=[];if(!e)return e;e=ga(e);do t=(a=e.charCodeAt(s++)<<16|e.charCodeAt(s++)<<8|e.charCodeAt(s++))>>18&63,n=a>>12&63,r=a>>6&63,i=63&a,u[c++]=o.charAt(t)+o.charAt(n)+o.charAt(r)+o.charAt(i);while(s<e.length);switch(l=u.join(``),e.length%3){case 1:l=l.slice(0,-2)+`==`;break;case 2:l=l.slice(0,-1)+`=`}return l}(ba(t)));return{contentType:`application/x-www-form-urlencoded`,body:a,estimatedSize:new Blob([a]).size}}var o=ba(t);return{contentType:`application/json`,body:o,estimatedSize:new Blob([o]).size}}},Sa=[];p&&Sa.push({transport:`fetch`,method:e=>{var t,n,{contentType:r,body:i,estimatedSize:a}=(t=xa(e))==null?{}:t,o=new Headers;V(e.headers,(function(e,t){o.append(t,e)})),r&&o.append(`Content-Type`,r);var s=e.url,c=null;if(h){var l=new h;c={signal:l.signal,timeout:setTimeout((()=>l.abort()),e.timeout)}}p(s,x({method:(e==null?void 0:e.method)||`GET`,headers:o,keepalive:e.method===`POST`&&(a||0)<52428.8,body:i,signal:(n=c)==null?void 0:n.signal},e.fetchOptions)).then((t=>t.text().then((n=>{var r={statusCode:t.status,text:n};if(t.status===200)try{r.json=JSON.parse(n)}catch(e){z.error(e)}e.callback==null||e.callback(r)})))).catch((t=>{z.error(t),e.callback==null||e.callback({statusCode:0,error:t})})).finally((()=>c?clearTimeout(c.timeout):null))}}),m&&Sa.push({transport:`XHR`,method:e=>{var t,n=new m;n.open(e.method||`GET`,e.url,!0);var{contentType:r,body:i}=(t=xa(e))==null?{}:t;V(e.headers,(function(e,t){n.setRequestHeader(t,e)})),r&&n.setRequestHeader(`Content-Type`,r),e.timeout&&(n.timeout=e.timeout),e.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var t={statusCode:n.status,text:n.responseText};if(n.status===200)try{t.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(t)}},n.send(i)}}),u!=null&&u.sendBeacon&&Sa.push({transport:`sendBeacon`,method:e=>{var t=ya(e.url,{beacon:`1`});try{var n,{contentType:r,body:i}=(n=xa(e))==null?{}:n,a=typeof i==`string`?new Blob([i],{type:r}):i;u.sendBeacon(t,a)}catch{}}});var Ca=function(e,t){if(!function(e){try{new RegExp(e)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};function wa(e,t,n){return ba({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Ta={exact:(e,t)=>t.some((t=>e.some((e=>t===e)))),is_not:(e,t)=>t.every((t=>e.every((e=>t!==e)))),regex:(e,t)=>t.some((t=>e.some((e=>Ca(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Ca(t,e))))),icontains:(e,t)=>t.map(Ea).some((t=>e.map(Ea).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(Ea).every((t=>e.map(Ea).every((e=>!t.includes(e))))),gt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n>parseFloat(e)))})),lt:(e,t)=>t.some((t=>{var n=parseFloat(t);return!isNaN(n)&&e.some((e=>n<parseFloat(e)))}))},Ea=e=>e.toLowerCase();function Da(e,t){return!e||Object.entries(e).every((e=>{var[n,r]=e,i=t==null?void 0:t[n];if(M(i)||P(i))return!1;var a=[String(i)],o=Ta[r.operator];return!!o&&o(r.values,a)}))}var Oa=B(`[Error tracking]`),ka=class{constructor(e){var t,n;this.Zt=[],this.ti=new _t([new jt,new Vt,new Nt,new Mt,new zt,new Rt,new Ft,new Bt],At()),this._instance=e,this.Zt=(t=(n=this._instance.persistence)==null?void 0:n.get_property(un))==null?[]:t}onRemoteConfig(e){var t,n,r;if(`errorTracking`in e){var i=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)==null?[]:t,a=(r=e.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Zt=i,this._instance.persistence&&this._instance.persistence.register({[un]:this.Zt,[dn]:a})}}get ii(){var e,t=!!this._instance.get_property(dn),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n==null?t:n)!=null&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Oa.info(`Skipping exception capture because a suppression rule matched`);if(!this.ii&&this.si(t))return void Oa.info(`Skipping exception capture because it was thrown by an extension`);if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Oa.info(`Skipping exception capture because it was thrown by the PostHog SDK`)}return this._instance.capture(`$exception`,e,{_noTruncate:!0,_batchKey:`exceptionEvent`,oi:!0})}ri(e){if(e.length===0)return!1;var t=e.reduce(((e,t)=>{var{type:n,value:r}=t;return N(n)&&n.length>0&&e.$exception_types.push(n),N(r)&&r.length>0&&e.$exception_values.push(r),e}),{$exception_types:[],$exception_values:[]});return this.Zt.some((e=>{var n=e.values.map((e=>{var n,r=Ta[e.operator],i=k(e.value)?e.value:[e.value],a=(n=t[e.key])==null?[]:n;return i.length>0&&r(i,a)}));return e.type===`OR`?n.some(Boolean):n.every(Boolean)}))}si(e){return e.flatMap((e=>{var t,n;return(t=(n=e.stacktrace)==null?void 0:n.frames)==null?[]:t})).some((e=>e.filename&&e.filename.startsWith(`chrome-extension://`)))}ni(e){if(e.length>0){var t,n,r,i,a=(t=(n=e[0].stacktrace)==null?void 0:n.frames)==null?[]:t,o=a[a.length-1];return(r=o==null||(i=o.filename)==null?void 0:i.includes(`posthog.com/static`))!=null&&r}return!1}ei(e){return!F(e)&&k(e)}},Y=B(`[FeatureFlags]`),Aa=B(`[FeatureFlags]`,{debugEnabled:!0}),ja=`errors_while_computing_flags`,Ma=`flag_missing`,Na=`quota_limited`,Pa=`timeout`,Fa=`connection_error`,Ia=`unknown_error`,La=e=>`api_error_`+e,Ra=`$active_feature_flags`,za=`$override_feature_flags`,Ba=`$feature_flag_payloads`,Va=`$override_feature_flag_payloads`,Ha=`$feature_flag_request_id`,Ua=`$feature_flag_evaluated_at`,Wa=e=>{var t={};for(var[n,r]of Jt(e||{}))r&&(t[n]=r);return t},Ga=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var n;return[e,(n=t[e].variant)==null?t[e].enabled:n]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var n;return(n=t[e].metadata)==null?void 0:n.payload})).map((e=>{var n;return[e,(n=t[e].metadata)==null?void 0:n.payload]})))):Y.warn(`Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version`),e},Ka=function(e){return e.FeatureFlags=`feature_flags`,e.Recordings=`recordings`,e}({}),qa=class{constructor(e){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?this._instance.config.evaluation_environments:e;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(Y.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((e=>{var t=e&&typeof e==`string`&&e.trim().length>0;return t||Y.error(`Invalid evaluation context found:`,e,`Expected non-empty string`),t})):[]}pi(){return this.fi().length>0}get hasLoadedFlags(){return this.li}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(xn),t=this._instance.get_property(za),n=this._instance.get_property(Va);if(!n&&!t)return e||{};var r=H({},e||{});for(var i of[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])]){var a,o,s=r[i],c=t==null?void 0:t[i],l=M(c)?(a=s==null?void 0:s.enabled)!=null&&a:!!c,u=M(c)?s.variant:typeof c==`string`?c:void 0,d=n==null?void 0:n[i],f=x({},s,{enabled:l,variant:l?u==null?s==null?void 0:s.variant:u:void 0});l!==(s==null?void 0:s.enabled)&&(f.original_enabled=s==null?void 0:s.enabled),u!==(s==null?void 0:s.variant)&&(f.original_variant=s==null?void 0:s.variant),d&&(f.metadata=x({},s==null?void 0:s.metadata,{payload:d,original_payload:s==null||(o=s.metadata)==null?void 0:o.payload})),r[i]=f}return this.ai||(Y.warn(` Overriding feature flag details!`,{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ai=!0),r}getFlagVariants(){var e=this._instance.get_property(yn),t=this._instance.get_property(za);if(!t)return e||{};for(var n=H({},e),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ai||(Y.warn(` Overriding feature flags!`,{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ai=!0),n}getFlagPayloads(){var e=this._instance.get_property(Ba),t=this._instance.get_property(Va);if(!t)return e||{};for(var n=H({},e||{}),r=Object.keys(t),i=0;i<r.length;i++)n[r[i]]=t[r[i]];return this.ai||(Y.warn(` Overriding feature flag payloads!`,{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ai=!0),n}reloadFeatureFlags(){this.hi||this._instance.config.advanced_disable_feature_flags||this.gi||(this._instance.mi.emit(`featureFlagsReloading`,!0),this.gi=setTimeout((()=>{this.bi()}),5))}yi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.li||this.ui||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.hi=e}bi(e){var t;if(this.yi(),!this._instance.M()){if(this.ui)this.di=!0;else{var n=this._instance.config.token,r=this._instance.get_property(`$device_id`),i={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:x({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(Sn)||{}),group_properties:this._instance.get_property(Cn),timezone:Oi()};P(r)||M(r)||(i.$device_id=r),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.pi()&&(i.evaluation_contexts=this.fi());var a=this._instance.config.advanced_only_evaluate_survey_feature_flags?`&only_evaluate_survey_feature_flags=true`:``,o=this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`+a);this.ui=!0,this._instance._send_request({method:`POST`,url:o,data:i,compression:this._instance.config.disable_compression?void 0:Ri.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,n,r,a=!0;if(e.statusCode===200&&(this.di||(this.$anon_distinct_id=void 0),a=!1),this.ui=!1,!i.disable_flags||this.di){this.vi=!a;var o=[];e.error?e.error instanceof Error?o.push(e.error.name===`AbortError`?Pa:Fa):o.push(Ia):e.statusCode!==200&&o.push(La(e.statusCode)),(t=e.json)!=null&&t.errorsWhileComputingFlags&&o.push(ja);var s=!((n=e.json)==null||(n=n.quotaLimited)==null||!n.includes(Ka.FeatureFlags));if(s&&o.push(Na),(r=this._instance.persistence)==null||r.register({[En]:o}
4),s)Y.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 c;i.disable_flags||this.receivedFeatureFlags((c=e.json)==null?{}:c,a),this.di&&(this.di=!1,this.bi())}}}})}}}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.vi){if(this.li||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlagResult(e,t);return(n=r==null?void 0:r.variant)==null?r==null?void 0:r.enabled:n}Y.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==null?void 0:t.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi){if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants(),r=e in n,i=n[e],a=this.getFlagPayloads()[e],o=String(i),s=this._instance.get_property(Ha)||void 0,c=this._instance.get_property(Ua)||void 0,l=this._instance.get_property(Tn)||{};if((t.send_event||!(`send_event`in t))&&(!(e in l)||!l[e].includes(o))){var u,d,f,p,m,h,g,_,v,y;k(l[e])?l[e].push(o):l[e]=[o],(u=this._instance.persistence)==null||u.register({[Tn]:l});var b=this.getFeatureFlagDetails(e),x=[...(d=this._instance.get_property(En))==null?[]:d];M(i)&&x.push(Ma);var S={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:a||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((f=this._instance.config.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[e])||null,$feature_flag_bootstrapped_payload:((p=this._instance.config.bootstrap)==null||(p=p.featureFlagPayloads)==null?void 0:p[e])||null,$used_bootstrap_value:!this.vi};M(b==null||(m=b.metadata)==null?void 0:m.version)||(S.$feature_flag_version=b.metadata.version);var C,w=(h=b==null||(g=b.reason)==null?void 0:g.description)==null?b==null||(_=b.reason)==null?void 0:_.code:h;w&&(S.$feature_flag_reason=w),b!=null&&(v=b.metadata)!=null&&v.id&&(S.$feature_flag_id=b.metadata.id),M(b==null?void 0:b.original_variant)&&M(b==null?void 0:b.original_enabled)||(S.$feature_flag_original_response=M(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(y=b.metadata)!=null&&y.original_payload&&(S.$feature_flag_original_payload=b==null||(C=b.metadata)==null?void 0:C.original_payload),x.length&&(S.$feature_flag_error=x.join(`,`)),this._instance.capture(`$feature_flag_called`,S)}if(r){var ee=a;if(!M(a))try{ee=JSON.parse(a)}catch{}return{key:e,enabled:!!i,variant:typeof i==`string`?i:void 0,payload:ee}}}else Y.warn(`getFeatureFlagResult for key "`+e+`" failed. Feature flags didn't load in time.`)}}getRemoteConfigPayload(e,t){var n=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.pi()&&(r.evaluation_contexts=this.fi()),this._instance._send_request({method:`POST`,url:this._instance.requestRouter.endpointFor(`flags`,`/flags/?v=2`),data:r,compression:this._instance.config.disable_compression?void 0:Ri.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var r,i=(r=n.json)==null?void 0:r.featureFlagPayloads;t((i==null?void 0:i[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.vi){if(this.li||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(e,t);return M(n)?void 0:!!n}Y.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.li=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(e,t,n,r,i){n===void 0&&(n={}),r===void 0&&(r={}),i===void 0&&(i={});var a=Ga(e),o=a.flags,s=a.featureFlags,c=a.featureFlagPayloads;if(s){var l=e.requestId,u=e.evaluatedAt;if(k(s)){Y.warn(`v1 of the feature flags endpoint is deprecated. Please use the latest version.`);var d={};if(s)for(var f=0;f<s.length;f++)d[s[f]]=!0;t&&t.register({[Ra]:s,[yn]:d})}else{var p=s,m=c,h=o;if(e.errorsWhileComputingFlags){if(o){var g=new Set(Object.keys(o).filter((e=>{var t;return!((t=o[e])!=null&&t.failed)})));p=x({},n,Object.fromEntries(Object.entries(p).filter((e=>{var[t]=e;return g.has(t)})))),m=x({},r,Object.fromEntries(Object.entries(m||{}).filter((e=>{var[t]=e;return g.has(t)})))),h=x({},i,Object.fromEntries(Object.entries(h||{}).filter((e=>{var[t]=e;return g.has(t)}))))}else p=x({},n,p),m=x({},r,m),h=x({},i,h)}t&&t.register(x({[Ra]:Object.keys(Wa(p)),[yn]:p||{},[Ba]:m||{},[xn]:h||{}},l?{[Ha]:l}:{},u?{[Ua]:u}:{}))}}})(e,this._instance.persistence,n,r,i),this.wi(t)}}override(e,t){t===void 0&&(t=!1),Y.warn(`override is deprecated. Please use overrideFeatureFlags instead.`),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Y.uninitializedWarning(`posthog.featureFlags.overrideFeatureFlags`);if(!1===e)return this._instance.persistence.unregister(za),this._instance.persistence.unregister(Va),this.wi(),Aa.info(`All overrides cleared`);if(e&&typeof e==`object`&&(`flags`in e||`payloads`in e)){var t,n=e;if(this.ai=!!((t=n.suppressWarning)!=null&&t),`flags`in n){if(!1===n.flags)this._instance.persistence.unregister(za),Aa.info(`Flag overrides cleared`);else if(n.flags){if(k(n.flags)){for(var r={},i=0;i<n.flags.length;i++)r[n.flags[i]]=!0;this._instance.persistence.register({[za]:r})}else this._instance.persistence.register({[za]:n.flags});Aa.info(`Flag overrides set`,{flags:n.flags})}}`payloads`in n&&(!1===n.payloads?(this._instance.persistence.unregister(Va),Aa.info(`Payload overrides cleared`)):n.payloads&&(this._instance.persistence.register({[Va]:n.payloads}),Aa.info(`Payload overrides set`,{payloads:n.payloads}))),this.wi();return}this.wi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.li){var{flags:t,flagVariants:n}=this.xi();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var r,i=(this._instance.get_property(bn)||[]).find((t=>t.flagKey===e)),a={[`$feature_enrollment/`+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture(`$feature_enrollment_update`,o),this.setPersonPropertiesForFlags(a,!1);var s=x({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[Ra]:Object.keys(Wa(s)),[yn]:s}),this.wi()}
4getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(bn),i=n?`&`+n.map((e=>`stage=`+e)).join(`&`):``;if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/early_access_features/?token=`+this._instance.config.token+i),method:`GET`,callback:t=>{var n,r;if(t.json){var i=t.json.earlyAccessFeatures;return(n=this._instance.persistence)==null||n.unregister(bn),(r=this._instance.persistence)==null||r.register({[bn]:i}),e(i)}}})}xi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((e=>t[e])),flagVariants:Object.keys(t).filter((e=>t[e])).reduce(((e,n)=>(e[n]=t[n],e)),{})}}wi(e){var{flags:t,flagVariants:n}=this.xi();this.featureFlagEventHandlers.forEach((r=>r(t,n,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Sn)||{};this._instance.register({[Sn]:x({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Sn)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(Cn)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((t=>{n[t]=x({},n[t],e[t]),delete e[t]})),this._instance.register({[Cn]:x({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Cn)||{};this._instance.register({[Cn]:x({},t,{[e]:{}})})}else this._instance.unregister(Cn)}reset(){this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.yi(),this.ai=!1}},Ja=[`cookie`,`localstorage`,`localstorage+cookie`,`sessionstorage`,`memory`],Ya=class{constructor(e,t){this.R=e,this.props={},this.$i=!1,this.Ei=(e=>{var t=``;return e.token&&(t=e.token.replace(/\+/g,`PL`).replace(/\//g,`SL`).replace(/=/g,`EQ`)),e.persistence_name?`ph_`+e.persistence_name:`ph_`+t+`_posthog`})(e),this.Y=this.Si(e),this.load(),e.debug&&z.info(`Persistence loaded`,e.persistence,x({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.ki}Si(e){Ja.indexOf(e.persistence.toLowerCase())===-1&&(z.critical(`Unknown persistence type `+e.persistence+`; falling back to localStorage+cookie`),e.persistence=`localStorage+cookie`);var t=function(e){e===void 0&&(e=[]);var t=[...Wr,...e];return x({},W,{W:function(e){try{var t={};try{t=Hr.W(e)||{}}catch{}var n=H(t,JSON.parse(W.q(e)||`{}`));return W.G(e,n),n}catch{}return null},G:function(e,n,r,i,a,o){try{W.G(e,n,void 0,void 0,o);var s={};t.forEach((e=>{n[e]&&(s[e]=n[e])})),Object.keys(s).length&&Hr.G(e,s,r,i,a,o)}catch(e){W.B(e)}},V:function(e,t){try{a==null||a.localStorage.removeItem(e),Hr.V(e,t)}catch(e){W.B(e)}}})}(e.cookie_persisted_properties||[]),n=e.persistence.toLowerCase();return n===`localstorage`&&W.H()?W:n===`localstorage+cookie`&&t.H()?t:n===`sessionstorage`&&G.H()?G:n===`memory`?Kr:n===`cookie`?Hr:t.H()?t:Hr}properties(){var e={};return V(this.props,(function(t,n){if(n===yn&&j(t))for(var r=Object.keys(t),i=0;i<r.length;i++)e[`$feature/`+r[i]]=t[r[i]];else o=n,s=!1,(P(a=In)?s:l&&a.indexOf===l?a.indexOf(o)!=-1:(V(a,(function(e){if(s||(s=e===o))return Gt})),s))||(e[n]=t);var a,o,s})),e}load(){if(!this.ki){var e=this.Y.W(this.Ei);e&&(this.props=H({},e))}}save(){this.ki||this.Y.G(this.Ei,this.props,this.Pi,this.Ti,this.Ii,this.R.debug)}remove(){this.Y.V(this.Ei,!1),this.Y.V(this.Ei,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(j(e)){M(t)&&(t=`None`),this.Pi=M(n)?this.Ci:n;var r=!1;if(V(e,((e,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(j(e)){this.Pi=M(t)?this.Ci:t;var n=!1;if(V(e,((t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,n=!0)})),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.$i){var e=xi(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);ie(Zt(e))||this.register(e),this.$i=!0}}update_search_keyword(){var e;this.register((e=d==null?void 0:d.referrer)?Ci(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Ti(),$referring_domain:d!=null&&d.referrer&&((e=yr(d.referrer))==null?void 0:e.host)||`$direct`},void 0)}set_initial_person_info(){this.props[An]||this.props[jn]||this.register_once({[Mn]:Ei(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};V([jn,An],(t=>{var n=this.props[t];n&&V(n,(function(t,n){e[`$initial_`+E(n)]=t}))}));var t,n,r=this.props[Mn];return r&&H(e,(t=Di(r),n={},V(t,(function(e,t){n[`$initial_`+E(t)]=e})),n)),e}
4safe_merge(e){return V(this.props,(function(t,n){n in e||(e[n]=t)})),e}update_config(e,t,n){if(this.Ci=this.Pi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var n=[...e].sort(),r=[...t].sort();return n.every(((e,t)=>e===r[t]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.Si(e),i=this.props;this.clear(),this.Y=r,this.props=i,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 n=this.props[on]||{};n[e]=t,this.props[on]=n,this.save()}remove_event_timer(e){var t=(this.props[on]||{})[e];return M(t)||(delete this.props[on][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Xa=B(`[Product Tours]`),Za=`ph_product_tours`,Qa=class{constructor(e){this.Ri=null,this.Fi=null,this._instance=e}onRemoteConfig(e){`productTours`in e&&(this._instance.persistence&&this._instance.persistence.register({[mn]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.Ri||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(mn)||this.it((()=>this.Oi()))}it(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`product-tours`,(t=>{t?Xa.error(`Could not load product tours script`,t):e()}))}Oi(){var e;!this.Ri&&(e=_.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ri=_.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!k(this.Fi)||t){var n=this._instance.persistence;if(n){var r=n.props[Za];if(k(r)&&!t)return this.Fi=r,void e(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/product_tours/?token=`+this._instance.config.token),method:`GET`,callback:t=>{var r=t.statusCode;if(r!==200||!t.json){var i=`Product Tours API could not be loaded, status: `+r;Xa.error(i),e([],{isLoaded:!1,error:i});return}var a=k(t.json.product_tours)?t.json.product_tours:[];this.Fi=a,n&&n.register({[Za]:a}),e(a,{isLoaded:!0})}})}else e(this.Fi,{isLoaded:!0})}getActiveProductTours(e){F(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(Za)}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)}},$a=function(e){return e.Activation=`events`,e.Cancellation=`cancelEvents`,e}({});(function(e){return e.Button=`button`,e.Tab=`tab`,e.Selector=`selector`,e})({});var eo=function(e){return e.TopLeft=`top_left`,e.TopRight=`top_right`,e.TopCenter=`top_center`,e.MiddleLeft=`middle_left`,e.MiddleRight=`middle_right`,e.MiddleCenter=`middle_center`,e.Left=`left`,e.Center=`center`,e.Right=`right`,e.NextToTrigger=`next_to_trigger`,e}({});(function(e){return e.Top=`top`,e.Left=`left`,e.Right=`right`,e.Bottom=`bottom`,e})({});var to=function(e){return e.Popover=`popover`,e.API=`api`,e.Widget=`widget`,e.ExternalSurvey=`external_survey`,e}({});(function(e){return e.Open=`open`,e.MultipleChoice=`multiple_choice`,e.SingleChoice=`single_choice`,e.Rating=`rating`,e.Link=`link`,e})({}),function(e){return e.NextQuestion=`next_question`,e.End=`end`,e.ResponseBased=`response_based`,e.SpecificQuestion=`specific_question`,e}({}),function(e){return e.Once=`once`,e.Recurring=`recurring`,e.Always=`always`,e}({});var no=function(e){return e.SHOWN=`survey shown`,e.DISMISSED=`survey dismissed`,e.SENT=`survey sent`,e.ABANDONED=`survey abandoned`,e}({}),ro=function(e){return e.SURVEY_ID=`$survey_id`,e.SURVEY_NAME=`$survey_name`,e.SURVEY_RESPONSE=`$survey_response`,e.SURVEY_ITERATION=`$survey_iteration`,e.SURVEY_ITERATION_
4START_DATE=`$survey_iteration_start_date`,e.SURVEY_PARTIALLY_COMPLETED=`$survey_partially_completed`,e.SURVEY_SUBMISSION_ID=`$survey_submission_id`,e.SURVEY_QUESTIONS=`$survey_questions`,e.SURVEY_COMPLETED=`$survey_completed`,e.PRODUCT_TOUR_ID=`$product_tour_id`,e.SURVEY_LAST_SEEN_DATE=`$survey_last_seen_date`,e}({}),io=function(e){return e.Popover=`popover`,e.Inline=`inline`,e}({}),X=B(`[Surveys]`),ao=`seenSurvey_`,oo=(e,t)=>{var n=`$survey_`+t+`/`+e.id;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_`+t+`/`+e.id+`/`+e.current_iteration),n},so=e=>((e,t)=>{var n=``+e+t.id;return t.current_iteration&&t.current_iteration>0&&(n=``+e+t.id+`_`+t.current_iteration),n})(ao,e),co=[to.Popover,to.Widget,to.API],lo={ignoreConditions:!1,ignoreDelay:!1,displayType:io.Popover},uo=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((e=>e!==t))}}emit(e,t){for(var n of this.Mi[e]||[])n(t);for(var r of this.Mi[`*`]||[])r(e,t)}};function fo(e,t,n){if(F(e))return!1;switch(n){case`exact`:return e===t;case`contains`:var r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`).replace(/_/g,`.`).replace(/%/g,`.*`);return new RegExp(r,`i`).test(e);case`regex`:try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var po=class{constructor(e){this.Ai=new uo,this.ji=(e,t)=>this.Di(e,t)&&this.Li(e,t)&&this.Ni(e,t)&&this.Ui(e,t),this.Di=(e,t)=>t==null||!t.event||(e==null?void 0:e.event)===(t==null?void 0:t.event),this._instance=e,this.zi=new Set,this.Hi=new Set}init(){var e;if(!M((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.on(e,t)}))}}register(e){var t,n;if(!M((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,n;(t=this.Hi)==null||t.add(e),(n=e.steps)==null||n.forEach((e=>{var t;(t=this.zi)==null||t.add((e==null?void 0:e.event)||``)}))})),(n=this._instance)!=null&&n.autocapture)){var r,i=new Set;e.forEach((e=>{var t;(t=e.steps)==null||t.forEach((e=>{e!=null&&e.selector&&i.add(e==null?void 0:e.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(i)}}on(e,t){var n;t!=null&&e.length!=0&&(this.zi.has(e)||this.zi.has(t==null?void 0:t.event))&&this.Hi&&((n=this.Hi)==null?void 0:n.size)>0&&this.Hi.forEach((e=>{this.Bi(t,e)&&this.Ai.emit(`actionCaptured`,e.name)}))}qi(e){this.onAction(`actionCaptured`,(t=>e(t)))}Bi(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var n of t.steps)if(this.ji(e,n))return!0;return!1}onAction(e,t){return this.Ai.on(e,t)}Li(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!=`string`||!fo(r,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 n;if(t==null||!t.href)return!0;var r=this.Ji(e);if(r.length>0)return r.some((e=>fo(e.href,t.href,t.href_matching||`exact`)));var i,a=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!a&&fo((i=a.match(/(?::|")href="(.*?)"/))?i[1]:``,t.href,t.href_matching||`exact`)}Gi(e,t){var n;if(t==null||!t.text)return!0;var r=this.Ji(e);if(r.length>0)return r.some((e=>fo(e.text,t.text,t.text_matching||`exact`)||fo(e.$el_text,t.text,t.text_matching||`exact`)));var i,a,o,s=(e==null||(n=e.properties)==null?void 0:n.$elements_chain)||``;return!!s&&(i=function(e){for(var t,n=[],r=/(?::|")text="(.*?)"/g;!F(t=r.exec(e));)n.includes(t[1])||n.push(t[1]);return n}(s),a=t.text,o=t.text_matching||`exact`,i.some((e=>fo(e,a,o))))}Vi(e,t){var n,r;if(t==null||!t.selector)return!0;var i=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(i!=null&&i.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||``;if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}Ui(e,t){return t==null||!t.properties||t.properties.length===0||Da(t.properties.reduce(((e,t)=>{var n=k(t.value)?t.value.map(String):t.value==null?[]:[String(t.value)];return e[t.key]={values:n,operator:t.operator||`exact`},e}),{}),e==null?void 0:e.properties)}},mo=class{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&Da(e.propertyFilters,t==null?void 0:t.properties)}Zi(e,t){var n=new Map;return e.forEach((e=>{var r;(r=e.conditions)==null||(r=r[t])==null||(r=r.values)==null||r.forEach((t=>{if(t!=null&&t.name){var r=n.get(t.name)||[];r.push(e.id),n.set(t.name,r)}}))})),n}te(e,t,n){var r=(n===$a.Activation?this.Ki:this.Yi).get(e),i=[];return this.ie((e=>{i=e.filter((e=>r==null?void 0:r.includes(e.id)))})),i.filter((r=>{var i,a=(i=r.conditions)==null||(i=i[n])==null||(i=i.values)==null?void 0:i.find((t=>t.name===e));return this.Qi(a,t)}))}register(e){var t;M((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ee(e),this.re(e))}re(e){var t=e.filter((e=>{var t,n;return((t=e.conditions)==null?void 0:t.actions)&&((n=e.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.se==null&&(this.se=new po(this._instance),this.se.init(),this.se.qi((e=>{this.onAction(e)}))),t.forEach((e=>{var t,n,r,i,a;e.conditions&&(t=e.conditions)!=null&&t.actions&&(n=e.conditions)!=null&&(n=n.actions)!=null&&n.values&&((r=e.conditions)==null||(r=r.actions)==null||(r=r.values)==null?void 0:r.length)>0&&((i=this.se)==null||i.register(e.conditions.actions.values),(a=e.conditions)==null||(a=a.actions)==null||(a=a.values)==null||a.forEach((t=>{if(t&&t.name){var n=this.Xi.get(t.name);n&&n.push(e.id),this.Xi.set(t.name,n||[e.id])}})))})))}ee(e){var t,n=e.filter((e=>{var t,n;return((t=e.conditions)==null?void 0:t.events)&&((n=e.conditions)==null||(n=n.events)==null||(n=n.values)==null?void 0:n.length)>0})),r=e.filter((e=>{var t,n;return((t=e.conditions)==null?void 0:t.cancelEvents)&&((n=e.conditions)==null||(n=n.cancelEvents)==null||(n=n.values)==null?void 0:n.length)>0}));(n.length!==0||r.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((e,t)=>{this.onEvent(e,t)})),this.Ki=this.Zi(e,$a.Activation),this.Yi=this.Zi(e,$a.Cancellation))}onEvent(e,t){var n,r=this.ne(),i=this.oe(),a=this.ae(),o=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[i])||[];if(a===e&&t&&o.length>0){var s,c;r.info(`event matched, removing item from activated items`,{event:e,eventPayload:t,existingActivatedItems:o});var l=(t==null||(s=t.properties)==null?void 0:s.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(l){var u=o.indexOf(l);u>=0&&(o.splice(u,1),this.le(o))}}else{if(this.Yi.has(e)){var d=this.te(e,t,$a.Cancellation);d.length>0&&(r.info(`cancel event matched, cancelling items`,{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);t>=0&&o.splice(t,1),this.ue(e.id)})),this.le(o))}if(this.Ki.has(e)){r.info(`event name matched`,{event:e,eventPayload:t,items:this.Ki.get(e)});var f=this.te(e,t,$a.Activation);this.le(o.concat(f.map((e=>e.id))||[]))}}}onAction(e){var t,n=this.oe(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[];this.Xi.has(e)&&this.le(r.concat(this.Xi.get(e)||[]))}
4le(e){var t,n=this.ne(),r=this.oe(),i=[...new Set(e)].filter((e=>!this.he(e)));n.info(`updating activated items`,{activatedItems:i}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[r]:i})}getActivatedIds(){var e,t=this.oe();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}},ho=class extends mo{constructor(e){super(e)}oe(){return`$surveys_activated`}ae(){return no.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 X}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},go=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(F(t))return X.warn(`Flags not loaded yet. Not loading surveys.`);var n=k(t);this.ve=n?t.length>0:t,X.info(`flags response received, isSurveysEnabled: `+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem(`lastSeenSurveyDate`);for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(ao)||n!=null&&n.startsWith(`inProgressSurvey_`))&&e.push(n)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager){if(this.ce)X.info(`Already initializing surveys, skipping...`);else if(this._instance.config.disable_surveys)X.info(`Disabled. Not loading surveys.`);else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())X.info(`Not loading surveys in cookieless mode without consent.`);else{var e=_==null?void 0:_.__PosthogExtensions__;if(e){if(!M(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var n=e.generateSurveys;if(n)return void this._e(n,t);var r=e.loadExternalDependency;if(!r)return void this.ge(`PostHog loadExternalDependency extension not found.`);r(this._instance,`surveys`,(n=>{n||!e.generateSurveys?this.ge(`Could not load surveys script`,n):this._e(e.generateSurveys,t)}))}catch(e){throw this.ge(`Error initializing surveys`,e),e}finally{this.ce=!1}}}else X.error(`PostHog Extensions not found.`)}}}_e(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new ho(this._instance),X.info(`Surveys loaded successfully`),this.me({isLoaded:!0})}ge(e,t){X.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 X.info(`Disabled. Not loading surveys.`),e([]);var n,r=this._instance.get_property(wn);if(r&&!t)return e(r,{isLoaded:!0});typeof Promise<`u`&&this.pe?this.pe.then((t=>{var{surveys:n,context:r}=t;return e(n,r)})):(typeof Promise<`u`&&(this.pe=new Promise((e=>{n=e}))),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:t=>{var r;this.pe=null;var i=t.statusCode;if(i!==200||!t.json){var a=`Surveys API could not be loaded, status: `+i;X.error(a);var o={isLoaded:!1,error:a};e([],o),n==null||n({surveys:[],context:o});return}var s,c=t.json.surveys||[],l=c.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}(e)||function(e){var t;return!((t=e.conditions)==null||(t=t.actions)==null||(t=t.values)==null||!t.length)}(e))));l.length>0&&((s=this._surveyEventReceiver)==null||s.register(l)),(r=this._instance.persistence)==null||r.register({[wn]:c});var u={isLoaded:!0};e(c,u),n==null||n({surveys:c,context:u})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){X.error(`Error in survey callback`,e)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!F(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);X.warn(`init was not called`)}be(e){var t=null;
4return this.getSurveys((n=>{var r;t=(r=n.find((t=>t.id===e)))==null?null:r})),t}ye(e){if(F(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(F(this._surveyManager))return X.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 F(this._surveyManager)?(X.warn(`init was not called`),Promise.resolve({visible:!1,disabledReason:`SDK is not enabled or survey functionality is not yet loaded`})):new Promise((n=>{this.getSurveys((t=>{var r,i=(r=t.find((t=>t.id===e)))==null?null:r;if(i){var a=this.ye(i);n({visible:a.eligible,disabledReason:a.reason})}else n({visible:!1,disabledReason:`Survey not found`})}),t)}))}renderSurvey(e,t,n){var r;if(F(this._surveyManager))X.warn(`init was not called`);else{var i=typeof e==`string`?this.be(e):e;if(i!=null&&i.id){if(co.includes(i.type)){var a=d==null?void 0:d.querySelector(t);if(a)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(X.info(`Rendering survey `+i.id+` with delay of `+i.appearance.surveyPopupDelaySeconds+` seconds`),void setTimeout((()=>{var e,t;X.info(`Rendering survey `+i.id+` with delay of `+((e=i.appearance)==null?void 0:e.surveyPopupDelaySeconds)+` seconds`),(t=this._surveyManager)==null||t.renderSurvey(i,a,n),X.info(`Survey `+i.id+` rendered`)}),1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,a,n);X.warn(`Survey element not found`)}else X.warn(`Surveys of type `+i.type+` cannot be rendered in the app`)}else X.warn(`Survey not found`)}}displaySurvey(e,t){var n;if(F(this._surveyManager))X.warn(`init was not called`);else{var r=this.be(e);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=x({},r,{appearance:x({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==io.Popover&&t.initialResponses&&X.warn(`initialResponses is only supported for popover surveys. prefill will not be applied.`),!1===t.ignoreConditions){var a=this.canRenderSurvey(r);if(!a.visible)return void X.warn(`Survey is not eligible to be displayed: `,a.disabledReason)}t.displayType===io.Inline?this.renderSurvey(i,t.selector,t.properties):this._surveyManager.handlePopoverSurvey(i,t)}else X.warn(`Survey not found`)}}cancelPendingSurvey(e){F(this._surveyManager)?X.warn(`init was not called`):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},Z=B(`[Conversations]`),_o=class{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.$e=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;F(t)||(I(t)?this.we=t:(this.we=t.enabled,this.$e=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.$e=null}loadIfEnabled(){if(!(this._conversationsManager||this.xe||this._instance.config.disable_conversations||nn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=_==null?void 0:_.__PosthogExtensions__;if(e&&!M(this.we)&&this.we){if(this.$e&&this.$e.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.Ee(t),void(this.xe=!1);var n=e.loadExternalDependency;if(!n)return void this.Se(`PostHog loadExternalDependency extension not found.`);n(this._instance,`conversations`,(t=>{t||!e.initConversations?this.Se(`Could not load conversations script`,t):this.Ee(e.initConversations),this.xe=!1}))}catch(e){this.Se(`Error initializing conversations`,e),this.xe=!1}}else Z.error(`Conversations enabled but missing token in remote config.`)}}}Ee(e){if(this.$e)try{this._conversationsManager=e(this.$e,this._instance),Z.info(`Conversations loaded successfully`)}catch(e){this.Se(`Error completing conversations initialization`,e)}else Z.error(`Cannot complete initialization: remote config is null`)}Se(e,t){Z.error(e,t),this._conversationsManager=null,this.xe=!1}show(){this._conversationsManager?this._conversationsManager.show():Z.warn(`Conversations not loaded yet.`)}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.we&&!P(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!=null&&e}sendMessage(e,t,n){var r=this;return b((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,t,n):(Z.warn(`Conversations not available yet.`),null)}))()}getMessages(e,t){var n=this;return b((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Z.warn(`Conversations not available yet.`),null)}))()}markAsRead(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Z.warn(`Conversations not available yet.`),null)}))()}getTickets(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Z.warn(`Conversations not available yet.`),null)}))()}requestRestoreLink(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Z.warn(`Conversations not available yet.`),null)}))()}restoreFromToken(e){var t=this;return b((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Z.warn(`Conversations not available yet.`),null)}))()}restoreFromUrlToken(){var e=this;return b((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Z.warn(`Conversations not available yet.`),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())==null?null:e}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())==null?null:e}},vo=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,n=(t=e.logs)==null?void 0:t.captureConsoleLogs;!F(n)&&n&&(this.ke=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.ke&&!this.Pe){var e=B(`[logs]`),t=_==null?void 0:_.__PosthogExtensions__;if(t){var n=t.loadExternalDependency;n?n(this._instance,`logs`,(n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?e.error(`Could not load logs script`,
4n):(t.logs.initializeLogs(this._instance),this.Pe=!0)})):e.error(`PostHog loadExternalDependency extension not found.`)}else e.error(`PostHog Extensions not found.`)}}},yo=B(`[RateLimiter]`),bo=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach((e=>{yo.info((e||`events`)+` is quota limited.`),this.serverLimits[e]=new Date().getTime()+6e4}))}catch(e){yo.warn(`could not rate limit - continuing. Error: "`+(e==null?void 0:e.message)+`"`,{text:t});return}},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,n,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:a}=this,o=new Date().getTime(),s=(t=(n=this.instance.persistence)==null?void 0:n.get_property(kn))==null?{tokens:i,last:o}:t;s.tokens+=(o-s.last)/1e3*a,s.last=o,s.tokens>i&&(s.tokens=i);var c=s.tokens<1;return c||e||(s.tokens=Math.max(0,s.tokens-1)),!c||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 `+i+` events burst limit.`},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(r=this.instance.persistence)==null||r.set_property(kn,s),{isRateLimited:c,remainingTokens:s.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||`events`]||!1;return!1!==t&&new Date().getTime()<t}},xo=B(`[RemoteConfig]`),So=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=_._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Te(e){var t,n;(t=_.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,`remote-config`,(()=>e(this.remoteConfig))):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 xo.info(`Using preloaded remote config`,this.remoteConfig),this.Ce(this.remoteConfig),void this.Re();if(this._instance.M())return void xo.warn(`Remote config is disabled. Falling back to local config.`);this.Te((e=>{if(!e)return xo.info(`No config found after loading remote JS config. Falling back to JSON.`),void this.Ie((e=>{this.Ce(e),this.Re()}));this.Ce(e),this.Re()}))}catch(e){xo.error(`Error loading remote config`,e)}}stop(){this.Fe&&(clearInterval(this.Fe),this.Fe=void 0)}refresh(){this._instance.M()||(d==null?void 0:d.visibilityState)===`hidden`||this._instance.featureFlags.reloadFeatureFlags()}Re(){this.Fe||(this.Fe=setInterval((()=>{this.refresh()}),3e5))}Ce(e){e||xo.error(`Failed to fetch remote config from PostHog.`),this._instance.Ce(e==null?{}:e),!1!==(e==null?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||this._instance.featureFlags.ensureFlagsLoaded())}},Co=3e3,wo=class{constructor(e,t){this.Oe=!0,this.Me=[],this.Ae=ge((t==null?void 0:t.flush_interval_ms)||Co,250,5e3,z.createLogger(`flush interval`),Co),this.je=e}enqueue(e){this.Me.push(e),this.De||this.Le()}unload(){this.Ne();var e=this.Me.length>0?this.Ue():{},t=Object.values(e);[...t.filter((e=>e.url.indexOf(`/e`)===0)),...t.filter((e=>e.url.indexOf(`/e`)!==0))].map((e=>{this.je(x({},e,{transport:`sendBeacon`}))}))}enable(){this.Oe=!1,this.Le()}Le(){var e=this;this.Oe||(this.De=setTimeout((()=>{if(this.Ne(),this.Me.length>0){var t=this.Ue(),n=function(){var n=t[r],i=new Date().getTime();n.data&&k(n.data)&&V(n.data,(e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp})),e.je(n)};for(var r in t)n()}}),this.Ae))}Ne(){clearTimeout(this.De),this.De=void 0}Ue(){var e={};return V(this.Me,(t=>{var n,r=t,i=(r?r.batchKey:null)||r.url;M(e[i])&&(e[i]=x({},r,{data:[]})),(n=e[i].data)==null||n.push(r.data)})),this.Me=[],e}},To=[`retriesPerformedSoFar`],Eo=class{constructor(e){this.ze=!1,this.He=3e3,this.Me=[],this._instance=e,this.Me=[],this.Be=!0,!M(a)&&`onLine`in a.navigator&&(this.Be=a.navigator.onLine,this.qe=()=>{this.Be=!0,this.Lt()},this.We=()=>{this.Be=!1},U(a,`online`,this.qe),U(a,`offline`,this.We))}get length(){return this.Me.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=S(e,To);se(t)&&(n.url=ya(n.url,{retry_count:t})),this._instance._send_request(x({},n,{callback:e=>{e.statusCode!==200&&(e.statusCode<400||e.statusCode>=500)&&(t==null?0:t)<10?this.Ge(x({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(e)}}))}Ge(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(e){var t=3e3*2**e,n=t/2,r=Math.min(18e5,t),i=(Math.random()-.5)*(r-n);return Math.ceil(r+i)}(t),r=Date.now()+n;this.Me.push({retryAt:r,requestOptions:e});var i=`Enqueued failed request for retry in `+n;navigator.onLine||(i+=` (Browser is offline)`),z.warn(i),this.ze||(this.ze=!0,this.Ve())}Ve(){if(this.Je&&clearTimeout(this.Je),this.Me.length===0)return this.ze=!1,void(this.Je=void 0);this.Je=setTimeout((()=>{this.Be&&this.Me.length>0&&this.Lt(),this.Ve()}),this.He)}Lt(){var e=Date.now(),t=[],n=this.Me.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Me=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Je&&(clearTimeout(this.Je),this.Je=void 0),this.ze=!1,M(a)||(this.qe&&(a.removeEventListener(`online`,this.qe),this.qe=void 0),this.We&&(a.removeEventListener(`offline`,this.We),this.We=void 0)),this.Me))try{this._instance._send_request(x({},e,{transport:`sendBeacon`}))}catch(e){z.error(e)}this.Me=[]}},Do=class{constructor(e){this.Ke=()=>{var e,t,n,r;this.Ye||(this.Ye={});var i=this.scrollElement(),a=this.scrollY(),o=i?Math.max(0,i.scrollHeight-i.clientHeight):0,s=a+((i==null?void 0:i.clientHeight)||0),c=(i==null?void 0:i.scrollHeight)||0;this.Ye.lastScrollY=Math.ceil(a),this.Ye.maxScrollY=Math.max(a,(e=this.Ye.maxScrollY)==null?0:e),this.Ye.maxScrollHeight=Math.max(o,(t=this.Ye.maxScrollHeight)==null?0:t),this.Ye.lastContentY=s,this.Ye.maxContentY=Math.max(s,(n=this.Ye.maxContentY)==null?0:n),this.Ye.maxContentHeight=Math.max(c,(r=this.Ye.maxContentHeight)==null?0:r)},this._instance=e}getContext(){return this.Ye}resetContext(){var e=this.Ye;return setTimeout(this.Ke,0),e}startMeasuringScrollPosition(){U(a,`scroll`,this.Ke,{capture:!0}),U(a,`scrollend`,this.Ke,{capture:!0}),U(a,`resize`,this.Ke)}scrollElement(){if(!this._instance.config.scroll_root_selector)return a==null?void 0:a.document.documentElement;for(var e of k(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]){var t=a==null?void 0:a.document.querySelector(e);
4if(t)return t}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return a&&(a.scrollY||a.pageYOffset||a.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return a&&(a.scrollX||a.pageXOffset||a.document.documentElement.scrollLeft)||0}},Oo=e=>Ei(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties),ko=class{constructor(e,t,n,r){this.Xe=e=>{var t=this.Qe();if(!t||t.sessionId!==e){var n={sessionId:e,props:this.Ze(this._instance)};this.tr.register({[On]:n})}},this._instance=e,this.ir=t,this.tr=n,this.Ze=r||Oo,this.ir.onSessionId(this.Xe)}Qe(){return this.tr.props[On]}getSetOnceProps(){var e,t=(e=this.Qe())==null?void 0:e.props;return t?`r`in t?Di(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 V(Zt(this.getSetOnceProps()),((t,n)=>{n===`$current_url`&&(n=`url`),e[`$session_entry_`+E(n)]=t})),e}},Ao=B(`[SessionId]`),jo=class{on(e,t){return this.er.on(e,t)}constructor(e,t,n){var r;if(this.rr=[],this.sr=void 0,this.er=new uo,this.nr=(e,t)=>!(!se(e)||!se(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error(`SessionIdManager requires a PostHogPersistence instance`);if(e.config.cookieless_mode===`always`)throw Error(`SessionIdManager cannot be used with cookieless_mode="always"`);this.R=e.config,this.tr=e.persistence,this.ar=void 0,this.lr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ur=t||Lr,this.hr=n||Lr;var i=this.R.persistence_name||this.R.token,a=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ge(a,60,36e3,Ao.createLogger(`session_idle_timeout_seconds`),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.dr(),this.vr=`ph_`+i+`_window_id`,this.cr=`ph_`+i+`_primary_window_exists`,this.pr()){var o=G.W(this.vr),s=G.W(this.cr);o&&!s?this.ar=o:G.V(this.vr),G.G(this.cr,!0)}if((r=this.R.bootstrap)!=null&&r.sessionID)try{var c=(e=>{var t=e.replace(/-/g,``);if(t.length!==32)throw Error(`Not a valid UUID`);if(t[12]!==`7`)throw Error(`Not a UUIDv7`);return parseInt(t.substring(0,12),16)})(this.R.bootstrap.sessionID);this._r(this.R.bootstrap.sessionID,new Date().getTime(),c)}catch(e){Ao.error(`Invalid sessionID in bootstrap`,e)}this.gr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return M(this.rr)&&(this.rr=[]),this.rr.push(e),this.lr&&e(this.lr,this.ar),()=>{this.rr=this.rr.filter((t=>t!==e))}}pr(){return this.R.persistence!==`memory`&&!this.tr.ki&&G.H()}mr(e){e!==this.ar&&(this.ar=e,this.pr()&&G.G(this.vr,e))}br(){return this.ar?this.ar:this.pr()?G.W(this.vr):null}_r(e,t,n){e===this.lr&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.lr=e,this.tr.register({[_n]:[t,e,n]}))}yr(){var e=this.tr.props[_n];return k(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._r(null,null,null)}destroy(){clearTimeout(this.wr),this.wr=void 0,this.sr&&a&&(a.removeEventListener(`beforeunload`,this.sr,{c
4apture:!1}),this.sr=void 0),this.rr=[]}gr(){this.sr=()=>{this.pr()&&G.V(this.cr)},U(a,`beforeunload`,this.sr,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode===`always`)throw Error(`checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"`);var n=t||new Date().getTime(),[r,i,a]=this.yr(),o=this.br(),s=se(a)&&Math.abs(n-a)>864e5,c=!1,l=!i,u=!l&&!e&&this.nr(n,r);l||u||s?(i=this.ur(),o=this.hr(),Ao.info(`new session ID generated`,{sessionId:i,windowId:o,changeReason:{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}}),a=n,c=!0):o||(o=this.hr(),c=!0);var d=se(r)&&e&&!s?r:n,f=se(a)?a:new Date().getTime();return this.mr(o),this._r(i,d,f),e||this.dr(),c&&this.rr.forEach((e=>e(i,o,c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0))),{sessionId:i,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:l,activityTimeout:u,sessionPastMaximumLength:s}:void 0,lastActivityTimestamp:r}}dr(){clearTimeout(this.wr),this.wr=setTimeout((()=>{var[e]=this.yr();if(this.nr(new Date().getTime(),e)){var t=this.lr;this.resetSessionId(),this.er.emit(`forcedIdleReset`,{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Mo=[`$set_once`,`$set`],No=B(`[SiteApps]`),Po=class{constructor(e){this._instance=e,this.$r=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Er(e,t){if(t){var n=this.globalsForEvent(t);this.$r.push(n),this.$r.length>1e3&&(this.$r=this.$r.slice(10))}}get siteAppLoaders(){var e;return(e=_._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.Er.bind(this));this.Sr=()=>{e(),this.$r=[],this.Sr=void 0}}}globalsForEvent(e){var t,n,r,i,a,o,s;if(!e)throw Error(`Event payload is required`);var c={},l=this._instance.get_property(`$groups`)||[],u=this._instance.get_property(`$stored_group_properties`)||{};for(var[d,f]of Object.entries(u))c[d]={id:l[d],type:d,properties:f};var{$set_once:p,$set:m}=e;return{event:x({},S(e,Mo),{properties:x({},e.properties,m?{$set:x({},(t=(n=e.properties)==null?void 0:n.$set)==null?{}:t,m)}:{},p?{$set_once:x({},(r=(i=e.properties)==null?void 0:i.$set_once)==null?{}:r,p)}:{}),elements_chain:(a=(o=e.properties)==null?void 0:o.$elements_chain)==null?``:a,distinct_id:(s=e.properties)==null?void 0:s.distinct_id}),person:{properties:this._instance.get_property(`$stored_person_properties`)},groups:c}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var n;!t.errored&&this.$r.length&&(No.info(`Processing `+this.$r.length+` events for site app with id `+e.id),this.$r.forEach((e=>t.processEvent==null?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&((n=this.Sr)==null||n.call(this))},r=!1,i=i=>{t.errored=!i,t.loaded=!0,No.info(`Site app with id `+e.id+` `+(i?`loaded`:`errored`)),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:e=>{i(e)}});a&&(t.processEvent=a),r=!0}catch(t){No.error(`Error while initializing PostHog app with config id `+e.id,t),i(!1)}if(r&&t.loaded)try{n()}catch(n){No.error(`Error while processing buffered events PostHog app with config id `+e.id,n),t.errored=!0}}kr(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}Pr(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(t){No.error(`Error while processing event `+e.event+` for site app `+n.id,t)}}}onRemoteConfig(e){var t,n,r,i=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.kr(),void this._instance.on(`eventCaptured`,(e=>this.Pr(e)))):void No.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`);if((n=this.Sr)==null||n.call(this),(r=e.siteApps)!=null&&r.length){if(this.isEnabled){var a=function(e){var t;_[`__$$ph_site_app_`+e]=i._instance,(t=_.__PosthogExtensions__)==null||t.loadSiteApp==null||t.loadSiteApp(i._instance,s,(t=>
4{if(t)return No.error(`Error while initializing PostHog app with config id `+e,t)}))};for(var{id:o,url:s}of e.siteApps)a(o)}else No.error(`PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.`)}}},Fo=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&ee(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some((e=>ee(e==null?void 0:e.brand,t))))return!0}catch{}return!!e.webdriver},Io=function(e){return e.US=`us`,e.EU=`eu`,e.CUSTOM=`custom`,e}({}),Lo=`i.posthog.com`,Ro=class{constructor(e){this.Tr={},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(`.`+Lo,`.posthog.com`)),t===`https://app.posthog.com`?`https://us.posthog.com`:t}get region(){return this.Tr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Tr[this.apiHost]=Io.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Tr[this.apiHost]=Io.EU:this.Tr[this.apiHost]=Io.CUSTOM),this.Tr[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===Io.CUSTOM)return this.apiHost+t;var n=Lo+t;switch(e){case`assets`:return`https://`+this.region+`-assets.`+n;case`api`:return`https://`+this.region+`.`+n}}},zo={icontains:(e,t)=>!!a&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!a&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!a&&Ca(t.href,e),not_regex:(e,t)=>!!a&&!Ca(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e},Bo=class e{constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){t===void 0&&(t=!1),n.getWebExperiments((t=>{e.Ir(`retrieved web experiments from the server`),n.Cr=new Map,t.forEach((t=>{if(t.feature_flag_key){var r;n.Cr&&(e.Ir(`setting flag key `,t.feature_flag_key,` to web experiment `,t),(r=n.Cr)==null||r.set(t.feature_flag_key,t));var i=n._instance.getFeatureFlag(t.feature_flag_key);N(i)&&t.variants[i]&&n.Rr(t.name,i,t.variants[i].transforms)}else if(t.variants)for(var a in t.variants){var o=t.variants[a];e.Fr(o)&&n.Rr(t.name,a,o.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}onFeatureFlags(t){if(this._is_bot())e.Ir(`Refusing to render web experiment since the viewer is a likely bot`);else if(!this._instance.config.disable_web_experiments){if(F(this.Cr))return this.Cr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Ir(`applying feature flags`,t),t.forEach((e=>{var t;if(this.Cr&&(t=this.Cr)!=null&&t.has(e)){var n,r=this._instance.getFeatureFlag(e),i=(n=this.Cr)==null?void 0:n.get(e);r&&i!=null&&i.variants[r]&&this.Rr(i.name,r,i.variants[r].transforms)}}))}}previewWebExperiment(){var t=e.getWindowLocation();if(t!=null&&t.search){var n=xr(t==null?void 0:t.search,`__experiment_id`),r=xr(t==null?void 0:t.search,`__experiment_variant`);n&&r&&(e.Ir(`previewing web experiments `+n+` && `+r),this.getWebExperiments((e=>{this.Or(parseInt(n),r,e)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property(`$web_experiments`);if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor(`api`,`/api/web_experiments/?token=`+this._instance.config.token),method:`GET`,callback:t=>t.statusCode!==200||!t.json?e([]):e(t.json.experiments||[])})}Or(t,n,r){var i=r.filter((e=>e.id===t));i&&i.length>0&&(e.Ir(`Previewing web experiment [`+i[0].name+`] with variant [`+n+`]`),this.Rr(i[0].name,n,i[0].variants[n].transforms))}static Fr(t){return!F(t.conditions)&&e.Mr(t)&&e.Ar(t)}static Mr(t){var n;if(F(t.conditions)||F((n=t.conditions)==null?void 0:n.url))return!0;var r,i,a,o=e.getWindowLocation();return!!o&&((r=t.conditions)==null||!r.url||zo[(i=(a=t.conditions)==null?void 0:a.urlMatchType)==null?`icontains`:i](t.conditions.url,o))}
4static getWindowLocation(){return a==null?void 0:a.location}static Ar(e){var t;if(F(e.conditions)||F((t=e.conditions)==null?void 0:t.utm))return!0;var n=xi();if(n.utm_source){var r,i,a,o,s,c,l,u,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==n.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)==n.utm_source,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,m=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_term||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_term)==n.utm_term;return d&&p&&m&&f}return!1}static Ir(e){var t=[...arguments].slice(1);z.info(`[WebExperiments] `+e,t)}Rr(t,n,r){this._is_bot()?e.Ir(`Refusing to render web experiment since the viewer is a likely bot`):n===`control`?e.Ir(`Control variants leave the page unmodified.`):r.forEach((r=>{if(r.selector){var i;e.Ir(`applying transform of variant `+n+` for experiment `+t+` `,r);var a=(i=document)==null?void 0:i.querySelectorAll(r.selector);a==null||a.forEach((e=>{var t=e;r.html&&(t.innerHTML=r.html),r.css&&t.setAttribute(`style`,r.css)}))}}))}_is_bot(){return u&&this._instance?Fo(u,this._instance.config.custom_blocked_useragents):void 0}},Vo=B(`[PostHog ExternalIntegrations]`),Ho={intercom:`intercom-integration`,crispChat:`crisp-chat-integration`},Uo=class{constructor(e){this._instance=e}it(e,t){var n;(n=_.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,(e=>{if(e)return Vo.error(`failed to load script`,e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var n,i,a;!r||(n=_.__PosthogExtensions__)!=null&&(n=n.integrations)!=null&&n[t]||e.it(Ho[t],(()=>{var n;(n=_.__PosthogExtensions__)==null||(n=n.integrations)==null||(n=n[t])==null||n.start(e._instance)})),!r&&(i=_.__PosthogExtensions__)!=null&&(i=i.integrations)!=null&&i[t]&&((a=_.__PosthogExtensions__)==null||(a=a.integrations)==null||(a=a[t])==null||a.stop())};for(var[n,r]of Object.entries((i=this._instance.config.integrations)==null?{}:i)){var i;t(n)}}};B(`[SessionRecording]`);var Wo=`[SessionRecording]`,Go=B(Wo),Ko=class{get started(){var e;return!((e=this.jr)==null||!e.isStarted)}get status(){return this.jr?this.jr.status:this.Dr&&!this.Lr?`disabled`:`lazy_loading`}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Dr=!1,this.Nr=!1,this.Ur=void 0,this._instance=e,!this._instance.sessionManager)throw Go.error(`started without valid sessionManager`),Error(Wo+` started without valid sessionManager. This is a bug.`);if(this._instance.config.cookieless_mode===`always`)throw Error(Wo+` cannot be used with cookieless_mode="always"`)}get Lr(){var e,t=!((e=this._instance.get_property(gn))==null||!e.enabled),n=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return a&&t&&n&&!r}startIfEnabledOrStop(e){var t;if(!this.Lr||(t=this.jr)==null||!t.isStarted){var n=!M(Object.assign)&&!M(Array.from);this.Lr&&n?(this.zr(e),Go.info(`starting`)):this.stopRecording()}}zr(e){var t,n,r;this.Lr&&(_!=null&&(t=_.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=_.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Hr(e):(r=_.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Br,(t=>{if(t)return Go.error(`could not load recorder`,t);this.Hr(e)})))}stopRecording(){var e,t;(e=this.Ur)==null||e.call(this),this.Ur=void 0,(t=this.jr)==null||t.stop()}qr(){var e;(e=this._instance.persistence)==null||e.unregister(vn)}Wr(e){if(this._instance.persistence){var t,n,r=this._instance.persistence,i=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,n=t==null?void 0:t.sampleRate,i=F(n)?null:parseFloat(n);F(i)&&this.qr();var a=t==null?void 0:t.minimumDurationMilliseconds;r.register({[gn]:x({cache_timestamp:Date.now(),enabled:!!t},t,{networkPayloadCapture:x({capturePerformance:e.capturePerformance},t==null?void 0:t.networkPayloadCapture),canvasRecording:{enabled:t==null?void 0:t.recordCanvas,fps:t==null?void 0:t.canvasFps,quality:t==null?void 0:t.canvasQuality},sampleRate:i,minimumDurationMilliseconds:M(a)?null:a,endpoint:t==null?void 0:t.endpoint,triggerMatchType:t==null?void 0:t.triggerMatchType,masking:t==null?void 0:t.masking,urlTriggers:t==null?void 0:t.urlTriggers})})};i(),(t=this.Ur)==null||t.call(this),this.Ur=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(i)}}onRemoteConfig(e){`sessionRecording`in e?!1===e.sessionRecording?this.Dr=!0:(this.Nr=!1,this.Wr(e),this.Dr=!0,this.startIfEnabledOrStop()):Go.info(`skipping remote config with no sessionRecording`,e)}log(e,t){var n;t===void 0&&(t=`log`),(n=this.jr)!=null&&n.log?this.jr.log(e,t):Go.warn(`log called before recorder was ready`)}get Br(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(gn);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||`lazy-recorder`}Gr(){var e,t=this._instance.get_property(gn);if(!t)return!1;var n=(e=(typeof t==`object`?t:JSON.parse(t)).cache_timestamp)==null?Date.now():e;return Date.now()-n<=3e5}Hr(e){var t,n;if((t=_.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error(`Called on script loaded before session recording is available`);this.jr||(this.jr=(n=_.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.jr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Gr()?this.jr.start(e):this.Nr||(this.Nr=!0,Go.info(`persisted remote config is stale, requesting fresh config before starting`),new So(this._instance).load())}onRRwebEmit(e){var t;(t=this.jr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.jr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.jr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.jr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.jr)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.jr||(n=this._instance.persistence)==null||n.register({[e===`url`?`$replay_override_url_trigger`:`$replay_override_event_trigger`]:!0}),(t=this.jr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.jr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.jr)==null||!n.tryAddCustomEvent(e,t))}},qo={},Jo=0,Yo=()=>{},Xo=`posthog`,Zo=!_a&&(g==null?void 0:g.indexOf(`MSIE`))===-1&&(g==null?void 0:g.indexOf(`Mozilla`))===-1,Qo=e=>{var t;return x({api_host:`https://us.i.posthog.com`,flags_api_host:null,ui_host:null,token:``,autocapture:!0,cross_subdomain_cookie:en(d==null?void 0:d.location),persistence:`localStorage+cookie`,persistence_name:``,cookie_persisted_properties:[],loaded:Yo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:`if_capture_pageview`,defaults:e==null?`unset`:e,__preview_deferred_init_extensions:!1,debug:f&&N(f==null?void 0:f.search)&&f.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:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(a==null||(t=a.location)==null?void 0:t.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:e=>{var t=`Bad HTTP status: `+e.statusCode+` `+e.text;z.error(t)},get_device_id:e=>e,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:Co},error_tracking:{},_onCapture:Yo,__preview_eager_load_replay:!1},(e=>({rageclick:!(e&&e>=`2025-11-30`)||{content_ignorelist:!0},capture_pageview:!(e&&e>=`2025-05-24`)||`history_change`,session_recording:e&&e>=`2025-11-30`?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>=`2026-01-30`?`head`:`body`,internal_or_test_user_hostname:e&&e>=`2026-01-30`?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},$o=e=>{var t={};M(e.process_person)||(t.person_profiles=e.process_person),M(e.xhr_headers)||(t.request_headers=e.x
4hr_headers),M(e.cookie_name)||(t.persistence_name=e.cookie_name),M(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),M(e.store_google)||(t.save_campaign_params=e.store_google),M(e.verbose)||(t.debug=e.verbose);var n=H({},t,e);return k(e.property_blacklist)&&(M(e.property_denylist)?n.property_denylist=e.property_blacklist:k(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:z.error(`Invalid value for property_denylist config: `+e.property_denylist)),n},es=class{constructor(){this.__forceAllowLocalhost=!1}get Vr(){return this.__forceAllowLocalhost}set Vr(e){z.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},ts=class e{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!=null&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!=null&&e}constructor(){this.webPerformance=new es,this.Jr=!1,this.version=v.LIB_VERSION,this.mi=new uo,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qo(),this.SentryIntegration=ci,this.sentryIntegration=e=>function(e,t){var n=si(e,t);return{name:oi,processEvent:e=>n(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint=`/e/`,this.Kr=!1,this.Yr=null,this.Xr=null,this.Qr=null,this.featureFlags=new qa(this),this.toolbar=new pi(this),this.scrollManager=new Do(this),this.pageViewManager=new Li(this),this.surveys=new go(this),this.conversations=new _o(this),this.logs=new vo(this),this.experiments=new Bo(this),this.exceptions=new ka(this),this.rateLimiter=new bo(this),this.requestRouter=new Ro(this),this.consent=new Yr(this),this.externalIntegrations=new Uo(this),this.people={set:(e,t,n)=>{var r=N(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=N(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on(`eventCaptured`,(e=>z.info(`send "`+(e==null?void 0:e.event)+`"`,e)))}init(t,n,r){if(r&&r!==Xo){var i,a=(i=qo[r])==null?new e:i;return a._init(t,n,r),qo[r]=a,qo[Xo][r]=a,a}return this._init(t,n,r)}_init(e,t,n){var r;if(t===void 0&&(t={}),M(e)||ae(e))return z.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.Zr(t.debug),this.ts=t,this.es=[],t.person_profiles?this.Xr=t.person_profiles:t.process_person&&(this.Xr=t.process_person),this.set_config(H({},Qo(t.defaults),$o(t),{name:n,token:e})),this.config.on_xhr_error&&z.error(`on_xhr_error is deprecated. Use on_request_error instead`),this.compression=t.disable_compression?void 0:Ri.GZipJS;var i=this.rs();this.persistence=new Ya(this.config,i),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Ya(x({},this.config,{persistence:`sessionStorage`}),i);var o=x({},this.persistence.props),s=x({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.ss=new wo((e=>this.ns(e)),this.config.request_queue_config),this.os=new Eo(this),this.__request_queue=[];var c=this.config.cookieless_mode===`always`||this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new jo(this),this.sessionPropsManager=new ko(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(z.info(`Deferring extension initialization to improve startup performance`),setTimeout((()=>{this.ls(c)}),0)):(z.info(`Initializing extensions synchronously`),this.ls(c)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&z.info(`Starting in debug mode`,{this:this,config:t,thisC:x({},this.config),p:o,s}),((r=t.bootstrap)==null?void 0:r.distinctID)!==void 0){var l,u,d=this.config.get_device_id(Lr()),f=(l=t.bootstrap)!=null&&l.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(Dn,(u=t.bootstrap)!=null&&u.isIdentifiedID?`identified`:`anonymous`),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.us()){var p,m,h=Object.keys(((p=t.bootstrap)==null?void 0:p.featureFlags)||{}).filter((e=>{var n;return!((n=t.bootstrap)==null||(n=n.featureFlags)==null||!n[e])})).reduce(((e,n)=>{var r;return e[n]=((r=t.bootstrap)==null||(r=r.featureFlags)==null?void 0:r[n])||!1,e}),{}),g=Object.keys(((m=t.bootstrap)==null?void 0:m.featureFlagPayloads)||{}).filter((e=>h[e])).reduce(((e,n)=>{var r,i;return(r=t.bootstrap)!=null&&(r=r.featureFlagPayloads)!=null&&r[n]&&(e[n]=(i=t.bootstrap)==null||(i=i.featureFlagPayloads)==null?void 0:i[n]),e}),{});this.featureFlags.receivedFeatureFlags({featureFlags:h,featureFlagPayloads:g})}if(c)this.register_once({distinct_id:Fn,$device_id:null},``);else if(!this.get_distinct_id()){var _=this.config.get_device_id(Lr());this.register_once({distinct_id:_,$device_id:_},``),this.persistence.set_property(Dn,`anonymous`)}return U(a,`onpagehide`in self?`pagehide`:`unload`,this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?ai(this,(()=>this.hs())):this.hs(),A(this.config._onCapture)&&this.config._onCapture!==Yo&&(z.warn("onCapture is deprecated. Please use `before_send` instead"),this.on(`eventCaptured`,(e=>this.config._onCapture(e.event,e)))),this.config.ip&&z.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}ls(e){var t=performance.now();this.historyAutocapture=new ri(this),this.historyAutocapture.startIfEnabled();var n=[];n.push((()=>{new hi(this).startIfEnabledOrStop()})),n.push((()=>{var e;
4this.siteApps=new Po(this),(e=this.siteApps)==null||e.init()})),e||n.push((()=>{this.sessionRecording=new Ko(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||n.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),n.push((()=>{this.autocapture=new Ar(this),this.autocapture.startIfEnabled()})),n.push((()=>{this.surveys.loadIfEnabled()})),n.push((()=>{this.logs.loadIfEnabled()})),n.push((()=>{this.conversations.loadIfEnabled()})),n.push((()=>{this.productTours=new Qa(this),this.productTours.loadIfEnabled()})),n.push((()=>{this.heatmaps=new Ii(this),this.heatmaps.startIfEnabled()})),n.push((()=>{this.webVitalsAutocapture=new Ni(this)})),n.push((()=>{this.exceptionObserver=new ti(this),this.exceptionObserver.startIfEnabledOrStop()})),n.push((()=>{this.deadClicksAutocapture=new $r(this,Qr),this.deadClicksAutocapture.startIfEnabledOrStop()})),n.push((()=>{if(this.ds){var e=this.ds;this.ds=void 0,this.Ce(e)}})),this.vs(n,t)}vs(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.vs(e,t)}),0);var n=e.shift();if(n)try{n()}catch(e){z.error(`Error initializing extension:`,e)}}var r=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:r}),this.config.__preview_deferred_init_extensions&&z.info(`PostHog extensions initialized (`+r+`ms)`)}Ce(e){var t,n,r,i,a,o,s,c,l;if(!d||!d.body)return z.info(`document not ready yet, trying again in 500 milliseconds...`),void setTimeout((()=>{this.Ce(e)}),500);this.config.__preview_deferred_init_extensions&&(this.ds=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=T(e.supportedCompression,Ri.GZipJS)?Ri.GZipJS:T(e.supportedCompression,Ri.Base64)?Ri.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Xr?this.Xr:`identified_only`}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(i=this.autocapture)==null||i.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),(s=this.webVitalsAutocapture)==null||s.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(l=this.deadClicksAutocapture)==null||l.onRemoteConfig(e)}hs(){try{this.config.loaded(this)}catch(e){z.critical("`loaded` function failed",e)}if(this.cs(),this.config.internal_or_test_user_hostname&&f!=null&&f.hostname){var e=f.hostname,t=this.config.internal_or_test_user_hostname;(typeof t==`string`?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===`always`)&&this.fs()}),1),this.ps=new So(this),this.ps.load()}cs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.ss)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Kt(this.__request_queue,(e=>this.ns(e))),this.__request_queue=[],this.cs()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this._s()&&this.capture(`$pageleave`),(e=this.ss)==null||e.unload(),(t=this.os)==null||t.unload()):this._s()&&this.capture(`$pageleave`,null,{transport:`sendBeacon`})}_send_request(e){this.__loaded&&(Zo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=ya(e.url,{ip:+!!this.config.ip}),e.headers=x({},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,
4(e=>{var t,n,r,i=x({},e);i.timeout=i.timeout||6e4,i.url=ya(i.url,{_:new Date().getTime().toString(),ver:v.LIB_VERSION,compression:i.compression});var a=(t=i.transport)==null?`fetch`:t,o=Sa.filter((e=>!i.disableTransport||!e.transport||!i.disableTransport.includes(e.transport))),s=(n=(r=tn(o,(e=>e.transport===a)))==null?void 0:r.method)==null?o[0].method:n;if(!s)throw Error(`No available transport method`);s(i)})(x({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}ns(e){this.os?this.os.retriableRequest(e):this._send_request(e)}_execute_array(e){Jo++;try{var t,n=[],r=[],i=[];Kt(e,(e=>{e&&(t=e[0],k(t)?i.push(e):A(e)?e.call(this):k(e)&&t===`alias`?n.push(e):k(e)&&t.indexOf(`capture`)!==-1&&A(this[t])?i.push(e):r.push(e))}));var a=function(e,t){Kt(e,(function(e){if(k(e[0])){var n=t;V(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};a(n,this),a(r,this),a(i,this)}finally{Jo--}}us(){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(t){if(Jo>0&&k(t)&&N(t[0])){var n=e.prototype[t[0]];A(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(e,t,n){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.ss){if(this.is_capturing()){if(!M(e)&&N(e)){var i=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(i&&!this.config.__preview_capture_bot_pageviews)){var a=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!N(t==null?void 0:t.$current_url)&&(z.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!==`$exception`||n!=null&&n.oi||z.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,s=(n==null?void 0:n.timestamp)||o,c=Lr(),l={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},s,c)};e===`$pageview`&&this.config.__preview_capture_bot_pageviews&&i&&(l.event=`$bot_pageview`,l.properties.$browser_type=`bot`),a&&(l.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),n!=null&&n.$set&&(l.$set=n==null?void 0:n.$set);var u,d=e!==`$groupidentify`,f=this.gs(n==null?void 0:n.$set_once,d);if(f&&(l.$set_once=f),(l=Qt(l,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=s,M(n==null?void 0:n.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=o),e===no.DISMISSED||e===no.SENT){var p=t==null?void 0:t[ro.SURVEY_ID],m=t==null?void 0:t[ro.SURVEY_ITERATION];u={id:p,current_iteration:m},localStorage.getItem(so(u))||localStorage.setItem(so(u),`true`),l.$set=x({},l.$set,{[oo({id:p,current_iteration:m},e===no.SENT?`responded`:`dismissed`)]:!0})}else e===no.SHOWN&&(l.$set=x({},l.$set,{[ro.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var h=x({},l.properties.$set,l.$set);if(ie(h)||this.setPersonPropertiesForFlags(h),!F(this.config.before_send)){var g=this.bs(l);if(!g)return;l=g}this.mi.emit(`eventCaptured`,l);var _={method:`POST`,url:(r=n==null?void 0:n._url)==null?this.requestRouter.endpointFor(`api`,this.analyticsDefaultEndpoint):r,data:l,compression:`best-available`,batchKey:n==null?void 0:n._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.ns(_):this.ss.enqueue(_),l}z.critical(`This capture call is ignored due to client rate limiting.`)}}else z.error(`No event name provided to posthog.capture`)}}else z.uninitializedWarning(`posthog.capture`)}_addCaptureHook(e){return this.on(`eventCaptured`,(t=>e(t.event,t)))}calculateEventProperties(e,t,n,r,i){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var a=i?void 0:this.persistence.remove_event_timer(e),o=x({},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 s=x({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=s.distinct_id,(!N(o.distinct_id)&&!oe(o.distinct_id)||ae(o.distinct_id))&&z.error(`Invalid distinct_id for replay event. This indicates a bug in your implementation`),o}var c,l=Ai(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:u,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(i,n.getTime());o.$session_id=u,o.$window_id=f}this.sessionPropsManager&&H(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&H(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.os)==null?void 0:p.length}catch(e){o.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===Io.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),c=e!==`$pageview`||i?e!==`$pageleave`||i?this.pageViewM
4anager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),o=H(o,c),e===`$pageview`&&d&&(o.title=d.title),!M(a)){var m=n.getTime()-a;o.$duration=parseFloat((m/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?`bot`:`browser`),(o=H({},l,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),k(this.config.property_denylist)?V(this.config.property_denylist,(function(e){delete o[e]})):z.error(`Invalid value for property_denylist config: `+this.config.property_denylist+` or property_blacklist config: `+this.config.property_blacklist);var h=this.config.sanitize_properties;h&&(z.error(`sanitize_properties is deprecated. Use before_send instead`),o=h(o,e));var _=this.ys();return o.$process_person_profile=_,_&&!i&&this.ws(`_calculate_event_properties`),o}gs(e,t){var n;if(t===void 0&&(t=!0),!this.persistence||!this.ys()||this.Jr)return e;var r=H({},this.persistence.get_initial_props(),((n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps())||{},e||{}),i=this.config.sanitize_properties;return i&&(z.error(`sanitize_properties is deprecated. Use before_send instead`),r=i(r,`$set_once`)),t&&(this.Jr=!0),ie(r)?void 0:r}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}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)}xs(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,n){var r=n!=null&&n.merge?this.featureFlags.getFlagVariants():{},i=n!=null&&n.merge?this.featureFlags.getFlagPayloads():{},a=x({},r,e),o=x({},i,t),s={};for(var[c,l]of Object.entries(a)){var u=typeof l==`string`;s[c]={key:c,enabled:!!u||!!l,variant:u?l:void 0,reason:void 0,metadata:M(o==null?void 0:o[c])?void 0:{id:0,version:void 0,description:void 0,payload:o[c]}}}this.featureFlags.receivedFeatureFlags({flags:s})}updateEarlyAccessFeatureEnrollment(e,t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,n)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this.mi.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.onSessionId(e))==null?()=>{}: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=lo),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,n){if(!this.__loaded||!this.persistence)return z.uninitializedWarning(`posthog.identify`);if(oe(e)&&(e=e.toString(),z.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()))z.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!==Fn){if(this.ws(`posthog.identify`)){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property(`$device_id`)){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},``)}e!==r&&e!==this.get_property(an)&&(this.unregister(an),this.register({distinct_id:e}));var a=(this.persistence.get_property(Dn)||`anonymous`)===`anonymous`;e!==r&&a?(this.persistence.set_property(Dn,`identified`),this.setPersonPropertiesForFlags(x({},n||{},t||{}),!1),this.capture(`$identify`,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}
4),this.Qr=wa(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(Tn))}}else z.critical(`The string "`+Fn+`" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`)}else z.error(`Unique user id has not been set in posthog.identify`)}setPersonProperties(e,t){if((e||t)&&this.ws(`posthog.setPersonProperties`)){var n=wa(this.get_distinct_id(),e,t);this.Qr===n?z.info(`A duplicate setPersonProperties call was made with the same properties. It has been ignored.`):(this.setPersonPropertiesForFlags(x({},t||{},e||{})),this.capture(`$set`,{$set:e||{},$set_once:t||{}}),this.Qr=n)}}group(e,t,n){if(e&&t){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:x({},r,{[e]:t})}),n&&(this.capture(`$groupidentify`,{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}else z.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.ws(`posthog.setGroupPropertiesForFlags`)&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,i,a;if(z.info(`reset`),!this.__loaded)return z.uninitializedWarning(`posthog.reset`);var o=this.get_property(`$device_id`);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),(r=this.ps)==null||r.stop(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(Dn,`anonymous`),(a=this.sessionManager)==null||a.resetSessionId(),this.Qr=null,this.config.cookieless_mode===`always`)this.register_once({distinct_id:Fn,$device_id:null},``);else{var s=this.config.get_device_id(Lr());this.register_once({distinct_id:s,$device_id:e?s:o},``)}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}get_session_replay_url(e){if(!this.sessionManager)return``;var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor(`ui`,`/project/`+this.config.token+`/replay/`+t);if(e!=null&&e.withTimestamp&&n){var i,a=(i=e.timestampLookBack)==null?10:i;if(!n)return r;r+=`?t=`+Math.max(Math.floor((new Date().getTime()-n)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(rn)?(z.critical(`Attempting to create alias for existing People user - aborting.`),-2):this.ws(`posthog.alias`)?(M(t)&&(t=this.get_distinct_id()),e===t?(z.warn(`alias matches current distinct_id - skipping api call.`),this.identify(e),-1):(this.xs(an,e),this.capture(`$create_alias`,{alias:e,distinct_id:t}))):void 0}set_config(e){var t=x({},this.config);if(j(e)){var n,r,i,a,o,s,c,l;H(this.config,$o(e));var u=this.rs();(n=this.persistence)==null||n.update_config(this.config,t,u),this.sessionPersistence=this.config.persistence===`sessionStorage`||this.config.persistence===`memory`?this.persistence:new Ya(x({},this.config,{persistence:`sessionStorage`}),u);var d=this.Zr(this.config.debug);I(d)&&(this.config.debug=d),I(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,W.H()&&W.G(`ph_debug`,`true`),z.info(`set_config`,{config:e,oldConfig:t,newConfig:x({},this.config)})):(v.DEBUG=!1,W.H()&&W.V(`ph_debug`))),(r=this.exceptionObserver)==null||r.onConfigChange(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),(s=this.exceptionObserver)==null||s.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this.$s(),(l=this.externalIntegrations)==null||l.startIfEnabledOrStop()}}startSessionRecording(e){var t=!0===e,n={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(n).some(Boolean)){var r,i,a,o,s;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((i=this.sessionRecording)==null||i.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),n.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger(`url`)),n.event_trigger&&((s=this.sessionRecording)==null||s.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 n=Error(`PostHog syntheticException`),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:n});return this.exceptions.sendExceptionEvent(x({},r,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?Xo:e;return t!==Xo&&(t=Xo+`.`+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(Dn))===`identified`||((t=this.sessionPersistence)==null?void 0:t.get_property(Dn))===`identified`}ys(){var e,t;return!(this.config.person_profiles===`never`||this.config.person_profiles===`identified_only`&&!this._isIdentified()&&ie(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[an])&&((t=this.persistence)==null||(t=t.props)==null||!t[Nn]))}_s(){return!0===this.config.capture_pageleave||this.config.capture_pageleave===`if_capture_pageview`&&(!0===this.config.capture_pageview||this.config.capture_pageview===`history_change`)}createPersonProfile(){this.ys()||this.ws(`posthog.createPersonProfile`)&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ws(`posthog.setInternalOrTestUser`)&&this.setPersonProperties({$internal_or_test_user:!0})}ws(e){return this.config.person_profiles===`never`?(z.error(e+` was called, but process_person is set to "never". This call will be ignored.`),!1):(this.xs(Nn,!0),!0)}rs(){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,n,r,i=this.rs();return((e=this.persistence)==null?void 0:e.ki)!==i&&((n=this.persistence)==null||n.set_disabled(i)),((t=this.sessionPersistence)==null?void 0:t.ki)!==i&&((r=this.sessionPersistence)==null||r.set_disabled(i)),i}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==`always`){var n,r,i;this.config.cookieless_mode===`on_reject`&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(n=this.sessionManager)==null||n.destroy(),(r=this.pageViewM
4anager)==null||r.destroy(),this.sessionManager=new jo(this),this.pageViewManager=new Li(this),this.persistence&&(this.sessionPropsManager=new ko(this,this.sessionManager,this.persistence)),this.sessionRecording=new Ko(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.$s(),this.cs(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==`on_reject`&&this.surveys.loadIfEnabled(),(M(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((i=e==null?void 0:e.captureEventName)==null?`$opt_in`:i,e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.fs()}else z.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`)}opt_out_capturing(){var e,t,n;this.config.cookieless_mode===`always`?z.warn(`Consent opt in/out is not valid with cookieless_mode="always" and will be ignored`):(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:Fn,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(n=this.sessionRecording)==null||n.stopRecording(),this.sessionRecording=void 0,this.fs()))}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===Jr.GRANTED?`granted`:e===Jr.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 u?Fo(u,this.config.custom_blocked_useragents):void 0}fs(){d&&(d.visibilityState===`visible`?this.Kr||(this.Kr=!0,this.capture(`$pageview`,{title:d.title},{send_instantly:!0}),this.Yr&&(d.removeEventListener(`visibilitychange`,this.Yr),this.Yr=null)):this.Yr||(this.Yr=this.fs.bind(this),U(d,`visibilitychange`,this.Yr)))}debug(e){!1===e?(a==null||a.console.log(`You've disabled debug mode.`),this.set_config({debug:!1})):(a==null||a.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,n,r,i,a,o,s=this.ts||{};return`advanced_disable_flags`in s?!!s.advanced_disable_flags:!1===this.config.advanced_disable_flags?!0===this.config.advanced_disable_decide?(z.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):(n=`advanced_disable_decide`,r=!1,i=z,a=(t=`advanced_disable_flags`)in(e=s)&&!F(e[t]),o=n in e&&!F(e[n]),a?e[t]:o?(i&&i.warn(`Config field '`+n+`' is deprecated. Please use '`+t+`' instead. The old field will be removed in a future major version.`),e[n]):r):!!this.config.advanced_disable_flags}bs(e){if(F(this.config.before_send))return e;var t=k(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),F(n)){var i=`Event '`+e.event+`' was rejected in beforeSend function`;return le(e.event)?z.warn(i+`. This can cause unexpected behavior.`):z.info(i),null}n.properties&&!ie(n.properties)||z.warn(`Event '`+e.event+`' has no properties after beforeSend function, this is likely an error.`)}return n}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,n){this.capture(`$ai_metric`,{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}Zr(e){var t=I(e)&&!e,n=W.H()&&W.q(`ph_debug`)===`true`;return!t&&(!!n||e)}};(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=Xt(e.prototype[t[n]])})(ts,[`identify`]);var ns;(function(e){return e.SHOWN=`product tour shown`,e.DISMISSED=`product tour dismissed`,e.COMPLETED=`product tour completed`,e.STEP_SHOWN=`product tour step shown`,e.STEP_COMPLETED=`product tour step completed`,e.BUTTON_CLICKED=`product tour button clicked`,e.STEP_SELECTOR_FAILED=`product tour step selector failed`,e.BANNER_CONTAINER_SELECTOR_FAILED=`product tour banner container selector failed`,e.BANNER_ACTION_CLICKED=`product tour banner action clicked`,e})({}),function(e){return e.TOUR_ID=`$product_tour_id`,e.TOUR_NAME=`$product_tour_name`,e.TOUR_ITERATION=`$product_tour_iteration`,e.TOUR_RENDER_REASON=`$product_tour_render_reason`,e.TOUR_STEP_ID=`$product_tour_step_id`,e.TOUR_STEP_ORDER=`$product_tour_step_order`,e.TOUR_STEP_TYPE=`$product_tour_step_type`,e.TOUR_DISMISS_REASON=`$product_tour_dismiss_reason`,e.TOUR_BUTTON_TEXT=`$product_tour_button_text`,e.TOUR_BUTTON_ACTION=`$product_tour_button_action`,e.TOUR_BUTTON_LINK=`$product_tour_button_link`,e.TOUR_BUTTON_TOUR_ID=`$product_tour_button_tour_id`,e.TOUR_STEPS_COUNT=`$product_tour_steps_count`,e.TOUR_STEP_SELECTOR=`$product_tour_step_selector`,e.TOUR_STEP_SELECTOR_FOUND=`$product_tour_step_selector_found`,e.TOUR_STEP_ELEMENT_TAG=`$product_tour_step_element_tag`,e.TOUR_STEP_ELEMENT_ID=`$product_tour_step_element_id`,e.TOUR_STEP_ELEMENT_CLASSES=`$product_tour_step_element_classes`,e.TOUR_STEP_ELEMENT_TEXT=`$product_tour_step_element_text`,e.TOUR_ERROR=`$product_tour_error`,e.TOUR_MATCHES_COUNT=`$product_tour_matches_count`,e.TOUR_FAILURE_PHASE=`$product_tour_failure_phase`,e.TOUR_WAITED_FOR_ELEMENT=`$product_tour_waited_for_element`,e.TOUR_WAIT_DURATION_MS=`$product_tour_wait_duration_ms`,e.TOUR_BANNER_SELECTOR=`$product_tour_banner_selector`,e.TOUR_LINKED_SURVEY_ID=`$product_tour_linked_survey_id`,e.USE_MANUAL_SELECTOR=`$use_manual_selector`,e.INFERENCE_DATA_PRESENT=`$inference_data_present`,e}({});var rs=(ns=qo[Xo]=new ts,function(){function e(){e.done||(e.done=!0,Zo=!1,V(qo,(function(e){e._dom_loaded()})))}d!=null&&d.addEventListener?d.readyState===`complete`?e():U(d,`DOMContentLoaded`,e,{capture:!1}):a&&z.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),ns),is=(0,i.createContext)({client:rs,bootstrap:void 0});function as(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;
4if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var a=0,o=r;a<o.length;a++){var s=o[a];if(!i.includes(s)||!as(e[s],t[s],n))return!1}return!0}function os(e){var t,n,r=e.children,a=e.client,o=e.apiKey,s=e.options,c=(0,i.useRef)(null),l=(0,i.useMemo)(function(){return a?(o&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),s&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),a):(o||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),rs)},[a,o,JSON.stringify(s)]);return(0,i.useEffect)(function(){if(!a){var e=c.current;e?(o!==e.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),s&&!as(s,e.options)&&rs.set_config(s),c.current={apiKey:o,options:s==null?{}:s}):(rs.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),rs.init(o,s),c.current={apiKey:o,options:s==null?{}:s})}},[a,o,JSON.stringify(s)]),i.createElement(is.Provider,{value:{client:l,bootstrap:(t=s==null?void 0:s.bootstrap)==null?(n=a==null?void 0:a.config)==null?void 0:n.bootstrap:t}},r)}var ss=function(e){return typeof e==`function`},cs=function(e){return e===void 0},ls=function(e){return e===null};function us(e){var t,n,r=(0,i.useContext)(is),a=r.client,o=r.bootstrap,s=(0,i.useState)(function(){return a.isFeatureEnabled(e)}),c=s[0],l=s[1];(0,i.useEffect)(function(){return a.onFeatureFlags(function(){l(a.isFeatureEnabled(e))})},[a,e]);var u=(t=o==null?void 0:o.featureFlags)==null?void 0:t[e];return!((n=a==null?void 0:a.featureFlags)!=null&&n.hasLoadedFlags)&&o!=null&&o.featureFlags?cs(u)?void 0:!!u:c}function ds(e){var t,n=(0,i.useContext)(is),r=n.client,a=n.bootstrap,o=(0,i.useState)(function(){return r.getFeatureFlagPayload(e)}),s=o[0],c=o[1];return(0,i.useEffect)(function(){return r.onFeatureFlags(function(){c(r.getFeatureFlagPayload(e))})},[r,e]),!((t=r==null?void 0:r.featureFlags)!=null&&t.hasLoadedFlags)&&a!=null&&a.featureFlagPayloads?a.featureFlagPayloads[e]:s}function fs(e){var t,n=(0,i.useContext)(is),r=n.client,a=n.bootstrap,o=(0,i.useState)(function(){return r.getFeatureFlag(e)}),s=o[0],c=o[1];return(0,i.useEffect)(function(){return r.onFeatureFlags(function(){c(r.getFeatureFlag(e))})},[r,e]),!((t=r==null?void 0:r.featureFlags)!=null&&t.hasLoadedFlags)&&a!=null&&a.featureFlags?a.featureFlags[e]:s}var ps=function(){return(0,i.useContext)(is).client},ms=function(e,t){return ms=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},ms(e,t)};function hs(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);ms(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var gs=function(){return gs=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},gs.apply(this,arguments)};function _s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function vs(e){var t=e.children,n=e.onIntersect,r=e.onClick,a=e.trackView,o=e.options,s=_s(e,[`children`,`onIntersect`,`onClick`,`trackView`,`options`]),c=(0,i.useRef)(null),l=(0,i.useMemo)(function(){return gs({threshold:.1},o)},[o==null?void 0:o.threshold,o==null?void 0:o.root,o==null?void 0:o.rootMargin]);return(0,i.useEffect)(function(){if(!(ls(c.current)||!a)){var e=new IntersectionObserver(function(e){var t=e[0];return n(t)},l);return e.observe(c.current),function(){return e.disconnect()}}},[l,a,n]),i.createElement(`div`,gs({ref:c},s,{onClick:r}),t)}function ys(e){var t=e.children,n=e.trackInteraction,r=e.trackView,a=e.options,o=e.onInteract,s=e.onView,c=_s(e,[`children`,`trackInteraction`,`trackView`,`options`,`onInteract`,`onView`]),l=(0,i.useRef)(!1),u=(0,i.useRef)(!1),d=(0,i.useCallback)(function(){!l.current&&n&&o&&(o(),l.current=!0)}
4,[n,o]),f=function(e){!u.current&&e.isIntersecting&&s&&(s(),u.current=!0)},p=i.Children.map(t,function(e){return i.createElement(vs,gs({onClick:d,onIntersect:f,trackView:r,options:a},c),e)});return i.createElement(i.default.Fragment,null,p)}function bs(e){var t=e.flag,n=e.match,r=e.children,a=e.fallback,o=e.visibilityObserverOptions,s=e.trackInteraction,c=e.trackView,l=_s(e,[`flag`,`match`,`children`,`fallback`,`visibilityObserverOptions`,`trackInteraction`,`trackView`]),u=ds(t),d=fs(t),f=ps(),p=s==null||s,m=c==null||c;if(cs(n)||d===n){var h=ss(r)?r(u):r;return i.createElement(ys,gs({flag:t,options:o,trackInteraction:p,trackView:m,onInteract:function(){return xs({flag:t,posthog:f,flagVariant:d})},onView:function(){return Ss({flag:t,posthog:f,flagVariant:d})}},l),h)}return i.createElement(i.default.Fragment,null,a)}function xs(e){var t,n=e.flag,r=e.posthog,i=e.flagVariant,a={feature_flag:n,$set:(t={},t[`\$feature_interaction/${n}`]=i==null||i,t)};typeof i==`string`&&(a.feature_flag_variant=i),r.capture(`$feature_interaction`,a)}function Ss(e){var t,n=e.flag,r=e.posthog,i=e.flagVariant,a={feature_flag:n,$set:(t={},t[`\$feature_view/${n}`]=i==null||i,t)};typeof i==`string`&&(a.feature_flag_variant=i),r.capture(`$feature_view`,a)}var Cs={componentStack:null,exceptionEvent:null,error:null},ws={INVALID_FALLBACK:`[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element.`},Ts=function(e){hs(t,e);function t(t){var n=e.call(this,t)||this;return n.state=Cs,n}return t.prototype.componentDidCatch=function(e,t){var n=this.props.additionalProperties,r;ss(n)?r=n(e):typeof n==`object`&&(r=n);var i=this.context.client.captureException(e,r),a=t.componentStack;this.setState({error:e,componentStack:a==null?null:a,exceptionEvent:i})},t.prototype.render=function(){var e=this.props,t=e.children,n=e.fallback,r=this.state;if(r.componentStack==null)return ss(t)?t():t;var a=ss(n)?i.createElement(n,{error:r.error,componentStack:r.componentStack,exceptionEvent:r.exceptionEvent}):n;return i.isValidElement(a)?a:(console.warn(ws.INVALID_FALLBACK),i.createElement(i.default.Fragment,null))},t.contextType=is,t}(i.Component),Es=function(){return Es=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Es.apply(this,arguments)},Ds=(0,i.createContext)({client:rs,bootstrap:void 0}),Os=function(){return(0,i.useContext)(Ds).client},ks=`data-ph-thumb-survey-trigger`;function As(e){var t=e.surveyId,n=e.displayPosition,r=n===void 0?eo.NextToTrigger:n,a=e.properties,o=e.onResponse,s=e.disableAutoShownTracking,c=Os(),l=(0,i.useState)(null),u=l[0],d=l[1],f=(0,i.useState)(function(){return Math.random().toString(36).slice(2,9)})[0],p=(0,i.useMemo)(function(){return`${t}-${f}`},[t,f]),m=(0,i.useRef)(null),h=(0,i.useCallback)(function(e){m.current&&m.current.removeAttribute(ks),m.current=e,e&&e.setAttribute(ks,p)},[p]),g=(0,i.useRef)(!1),_=(0,i.useRef)(!1),v=(0,i.useCallback)(function(){var e,n;g.current||!c||(g.current=!0,c.capture(no.SHOWN,Es((e={},e[ro.SURVEY_ID]=t,e.sessionRecordingUrl=(n=c.get_session_replay_url)==null?void 0:n.call(c),e),a)))},[c,t,a]);(0,i.useEffect)(function(){s||v()},[v,s]);var y=(0,i.useCallback)(function(e){!(c!=null&&c.surveys)||_.current||(_.current=!0,d(e),o==null||o(e),c.surveys.displaySurvey(t,{displayType:io.Popover,ignoreConditions:!0,ignoreDelay:!0,properties:a,initialResponses:{0:e===`up`?1:2},position:r,selector:`[${ks}="${p}"]`,skipShownEvent:!0}))},[c,t,r,a,o,p]);return Es({respond:y,response:u,triggerRef:h},s&&{trackShown:v})}var js=rs,Ms=`workspace`,Ns=864e5;function Ps(e,t){let n=e.getTime()-t.getTime();return Math.max(0,n/Ns)}function Fs(e){var t;let n=(t=e.referenceDate)==null?new Date:t,r={};return e.workspaceCreatedAt&&(r.workspaceAge=Ps(n,e.workspaceCreatedAt)),e.lastQuotaResetAt&&(r.subscriptionAge=Ps(n,e.lastQuotaResetAt)),r}var Is=`browseaiLoggedIn`;function Ls(){if(typeof window>`u`)return`; path=/; samesite=lax`;let{hostname:e,protocol:t}=window.location;return`; path=/${e===`browse.ai`||e.endsWith(`.browse.ai`)?`; domain=.browse.ai`:``}; samesite=lax${t===`https:`?`; secure`:``}`}function Rs(){typeof document>`u`||(document.cookie=`${Is}=1; max-age=2592000${Ls()}`)}function zs(){typeof document<`u`&&(document.cookie=`browseaiLoggedIn=; max-age=0${Ls()}`)}var Bs=new Map;function Vs(e,t){Bs.set(e,t)}function Hs(){Bs.clear()}function Us(e){var t;if(e===null)return e;let n=(t=e.properties)==null?void 0:t.$groups,r=n==null?void 0:n[Ms],i=r?Bs.get(r):void 0;return i&&(e.properties={...e.properties,...Fs(i)}),e}
vendor: 3,002 bytes, line 4
4var Ws=function(e,t){return Ws=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Ws(e,t)};function Gs(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Ws(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Q=function(){return Q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Q.apply(this,arguments)};function Ks(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function qs(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Js(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function Ys(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}var Xs=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};function Zs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Qs(e,t){return e(t={exports:{}},t.exports),t.exports}
4var $s=Qs((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);r===void 0?n===void 0?e.locked.set(t,[]):e.locked.set(t,[n]):n!==void 0&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise((function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())}))},this.unlock=function(t){var n=e.locked.get(t);if(n!==void 0&&n.length!==0){var r=n.pop();e.locked.set(t,n),r!==void 0&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return e.instance===void 0&&(e.instance=new e),e.instance},e}();t.default=function(){return n.getInstance()}}));Zs($s);var ec=Zs(Qs((function(e,t){var n=Xs&&Xs.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(o,s)}c((r=r.apply(e,t||[])).next())}))},r=Xs&&Xs.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},i=Xs;Object.defineProperty(t,"__esModule",{value:!0});var a=`browser-tabs-lock-key`,o={key:function(e){return n(i,void 0,void 0,(function(){return r(this,(function(e){throw Error(`Unsupported`)}))}))},getItem:function(e){return n(i,void 0,void 0,(function(){return r(this,(function(e){throw Error(`Unsupported`)}))}))},clear:function(){return n(i,void 0,void 0,(function(){return r(this,(function(e){return[2,window.localStorage.clear()]}))}))},removeItem:function(e){return n(i,void 0,void 0,(function(){return r(this,(function(e){throw Error(`Unsupported`)}))}))},setItem:function(e,t){return n(i,void 0,void 0,(function(){return r(this,(function(e){throw Error(`Unsupported`)}))}))},keySync:function(e){return window.localStorage.key(e)},getItemSync:function(e){return window.localStorage.getItem(e)},clearSync:function(){return window.localStorage.clear()},removeItemSync:function(e){return window.localStorage.removeItem(e)},setItemSync:function(e,t){return window.localStorage.setItem(e,t)}};function s(e){return new Promise((function(t){return setTimeout(t,e)}))}function c(e){for(var t=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz`,n=``,r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}t.default=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+c(15),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,e.waiters===void 0&&(e.waiters=[])}return e.prototype.acquireLock=function(t,i){return i===void 0&&(i=5e3),n(this,void 0,void 0,(function(){var n,l,u,d,f,p,m;return r(this,(function(r){switch(r.label){case 0:n=Date.now()+c(4),l=Date.now()+i,u=a+`-`+t,d=this.storageHandler===void 0?o:this.storageHandler,r.label=1;case 1:return Date.now()<l?[4,s(30)]:[3,8];case 2:return r.sent(),d.getItemSync(u)===null?(f=this.id+`-`+t+`-`+n,[4,s(Math.floor(25*Math.random()))]):[3,5];case 3:return r.sent(),d.setItemSync(u,JSON.stringify({id:this.id,iat:n,timeoutKey:f,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,s(30)];case 4:return r.sent(),(p=d.getItemSync(u))!==null&&(m=JSON.parse(p)).id===this.id&&m.iat===n?(this.acquiredIatSet.add(n),this.refreshLockWhileAcquired(u,n),[2,!0]):[3,7];case 5:return e.lockCorrector(this.storageHandler===void 0?o:this.storageHandler),[4,this.waitForSomethingToChange(l)];case 6:r.sent(),r.label=7;case 7:return n=Date.now()+c(4),[3,1];case 8:return[2,!1]}}))}))},e.prototype.refreshLockWhileAcquired=function(e,t){return n(this,void 0,void 0,(function(){var i=this;return r(this,(function(a){return setTimeout((function(){return n(i,void 0,void 0,(function(){var n,i,a;return r(this,(function(r){switch(r.label){case 0:return[4,$s.default().lock(t)];case 1:return r.sent(),this.acquiredIatSet.has(t)?(n=this.storageHandler===void 0?o:this.storageHandler,(i=n.getItemSync(e))===null?($s.default().unlock(t),[2]):((a=JSON.parse(i)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(a)),$s.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):($s.default().unlock(t),[2])}}))}))}),1e3),[2]}))}
4))},e.prototype.waitForSomethingToChange=function(t){return n(this,void 0,void 0,(function(){return r(this,(function(n){switch(n.label){case 0:return[4,new Promise((function(n){var r=!1,i=Date.now(),a=!1;function o(){if(a||(window.removeEventListener(`storage`,o),e.removeFromWaiting(o),clearTimeout(s),a=!0),!r){r=!0;var t=50-(Date.now()-i);t>0?setTimeout(n,t):n(null)}}window.addEventListener(`storage`,o),e.addToWaiting(o);var s=setTimeout(o,Math.max(0,t-Date.now()))}))];case 1:return n.sent(),[2]}}))}))},e.addToWaiting=function(t){this.removeFromWaiting(t),e.waiters!==void 0&&e.waiters.push(t)},e.removeFromWaiting=function(t){e.waiters!==void 0&&(e.waiters=e.waiters.filter((function(e){return e!==t})))},e.notifyWaiters=function(){e.waiters!==void 0&&e.waiters.slice().forEach((function(e){return e()}))},e.prototype.releaseLock=function(e){return n(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.releaseLock__private__=function(t){return n(this,void 0,void 0,(function(){var n,i,s,c;return r(this,(function(r){switch(r.label){case 0:return n=this.storageHandler===void 0?o:this.storageHandler,i=a+`-`+t,(s=n.getItemSync(i))===null?[2]:(c=JSON.parse(s)).id===this.id?[4,$s.default().lock(c.iat)]:[3,2];case 1:r.sent(),this.acquiredIatSet.delete(c.iat),n.removeItemSync(i),$s.default().unlock(c.iat),e.notifyWaiters(),r.label=2;case 2:return[2]}}
4))}))},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,i=[],o=0;;){var s=r.keySync(o);if(s===null)break;i.push(s),o++}for(var c=!1,l=0;l<i.length;l++){var u=i[l];if(u.includes(a)){var d=r.getItemSync(u);if(d!==null){var f=JSON.parse(d);(f.timeRefreshed===void 0&&f.timeAcquired<n||f.timeRefreshed!==void 0&&f.timeRefreshed<n)&&(r.removeItemSync(u),c=!0)}}}c&&e.notifyWaiters()},e.waiters=void 0,e}()}))),tc={timeoutInSeconds:60},nc={name:`auth0-spa-js`,version:`2.1.3`},rc=()=>Date.now(),$=class e extends Error{constructor(t,n){super(n),this.error=t,this.error_description=n,Object.setPrototypeOf(this,e.prototype)}static fromPayload({error:t,error_description:n}){return new e(t,n)}},ic=class e extends ${constructor(t,n,r,i=null){super(t,n),this.state=r,this.appState=i,Object.setPrototypeOf(this,e.prototype)}},ac=class e extends ${constructor(){super(`timeout`,`Timeout`),Object.setPrototypeOf(this,e.prototype)}},oc=class e extends ac{constructor(t){super(),this.popup=t,Object.setPrototypeOf(this,e.prototype)}},sc=class e extends ${constructor(t){super(`cancelled`,`Popup closed`),this.popup=t,Object.setPrototypeOf(this,e.prototype)}},cc=class e extends ${constructor(t,n,r){super(t,n),this.mfa_token=r,Object.setPrototypeOf(this,e.prototype)}},lc=class e extends ${constructor(t,n){super(`missing_refresh_token`,`Missing Refresh Token (audience: '${uc(t,[`default`])}', scope: '${uc(n)}')`),this.audience=t,this.scope=n,Object.setPrototypeOf(this,e.prototype)}};function uc(e,t=[]){return e&&!t.includes(e)?e:``}var dc=()=>window.crypto,fc=()=>{let e=``;return Array.from(dc().getRandomValues(new Uint8Array(43))).forEach((t=>e+=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.`[t%66])),e},pc=e=>btoa(e),mc=e=>{var{clientId:t}=e,n=Ys(e,[`clientId`]);return new URLSearchParams((e=>Object.keys(e).filter((t=>e[t]!==void 0)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]})),{}))(Object.assign({client_id:t},n))).toString()},hc=e=>(e=>decodeURIComponent(atob(e).split(``).map((e=>`%`+(`00`+e.charCodeAt(0).toString(16)).slice(-2))).join(``)))(e.replace(/_/g,`/`).replace(/-/g,`+`)),gc=async(e,t)=>{let n=await fetch(e,t);return{ok:n.ok,json:await n.json()}},_c=async(e,t,n)=>{let r=new AbortController,i;return t.signal=r.signal,Promise.race([gc(e,t),new Promise(((e,t)=>{i=setTimeout((()=>{r.abort(),t(Error(`Timeout when executing 'fetch'`))}),n)}))]).finally((()=>{clearTimeout(i)}))},vc=async(e,t,n,r,i,a,o)=>{return s={auth:{audience:t,scope:n},timeout:i,fetchUrl:e,fetchOptions:r,useFormData:o},c=a,new Promise((function(e,t){let n=new MessageChannel;n.port1.onmessage=function(r){r.data.error?t(Error(r.data.error)):e(r.data),n.port1.close()},c.postMessage(s,[n.port2])}));var s,c},yc=async(e,t,n,r,i,a,o=1e4)=>i?vc(e,t,n,r,o,i,a):_c(e,r,o);async function bc(e,t){var{baseUrl:n,timeout:r,audience:i,scope:a,auth0Client:o,useFormData:s}=e,c=Ys(e,[`baseUrl`,`timeout`,`audience`,`scope`,`auth0Client`,`useFormData`]);let l=s?mc(c):JSON.stringify(c);return await async function(e,t,n,r,i,a,o){let s,c=null;for(let l=0;l<3;l++)try{s=await yc(e,n,r,i,a,o,t),c=null;break}catch(e){c=e}if(c)throw c;let l=s.json,{error:u,error_description:d}=l,f=Ys(l,[`error`,`error_description`]),{ok:p}=s;if(!p){let t=d||`HTTP error. Unable to fetch ${e}`;throw u===`mfa_required`?new cc(u,t,f.mfa_token):u===`missing_refresh_token`?new lc(n,r):new $(u||`request_error`,t)}return f}(`${n}/oauth/token`,r,i||`default`,a,{method:`POST`,body:l,headers:{"Content-Type":s?`application/x-www-form-urlencoded`:`application/json`,"Auth0-Client":btoa(JSON.stringify(o||nc))}},t,s)}var xc=(...e)=>{return(t=e.filter(Boolean).join(` `).trim().split(/\s+/),Array.from(new Set(t))).join(` `);var t},Sc=class e{constructor(e,t=`@@auth0spajs@@`,n){this.prefix=t,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join(`::`)}static fromKey(t){let[n,r,i,a]=t.split(`::`);return new e({clientId:r,scope:a,audience:i},n)}static fromCacheEntry(t){let{scope:n,audience:r,client_id:i}=t;return new e({scope:n,audience:r,clientId:i})}},Cc=class{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){let t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch{return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith(`@@auth0spajs@@`)))}},wc=class{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){let n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}},Tc=class{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||rc}async setIdToken(e,t,n){var r;let i=this.getIdTokenCacheKey(e);await this.cache.set(i,{id_token:t,decodedToken:n}),await((r=this.keyManifest)==null?void 0:r.add(i))}async getIdToken(e){let t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){let t=await this.get(e);return!t||!t.id_token||!t.decodedToken?void 0:{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e,t=0){var n;let r=await this.cache.get(e.toKey());if(!r){let t=await this.getCacheKeys();if(!t)return;let n=this.matchExistingCacheKey(e,t);n&&(r=await this.cache.get(n))}if(!r)return;let i=await this.nowProvider(),a=Math.floor(i/1e3);return r.expiresAt-t<a?r.body.refresh_token?(r.body={refresh_token:r.body.refresh_token},await this.cache.set(e.toKey(),r),r.body):(await this.cache.remove(e.toKey()),void await((n=this.keyManifest)==null?void 0:n.remove(e.toKey()))):r.body}async set(e){var t;let n=new Sc({clientId:e.client_id,scope:e.scope,audience:e.audience}),r=await this.wrapCacheEntry(e);await this.cache.set(n.toKey(),r),await((t=this.keyManifest)==null?void 0:t.add(n.toKey()))}async clear(e){var t;let n=await this.getCacheKeys();n&&(await n.filter((t=>!e||t.includes(e))).reduce((async(e,t)=>{await e,await this.cache.remove(t)}),Promise.resolve()),await((t=this.keyManifest)==null?void 0:t.clear()))}async wrapCacheEntry(e){let t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;
4return this.keyManifest?(e=await this.keyManifest.get())==null?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new Sc({clientId:e},`@@auth0spajs@@`,`@@user@@`).toKey()}matchExistingCacheKey(e,t){return t.filter((t=>{var n;let r=Sc.fromKey(t),i=new Set(r.scope&&r.scope.split(` `)),a=((n=e.scope)==null?void 0:n.split(` `))||[],o=r.scope&&a.reduce(((e,t)=>e&&i.has(t)),!0);return r.prefix===`@@auth0spajs@@`&&r.clientId===e.clientId&&r.audience===e.audience&&o}))[0]}},Ec=class{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}},Dc=e=>typeof e==`number`,Oc=`iss.aud.exp.nbf.iat.jti.azp.nonce.auth_time.at_hash.c_hash.acr.amr.sub_jwk.cnf.sip_from_tag.sip_date.sip_callid.sip_cseq_num.sip_via_branch.orig.dest.mky.events.toe.txn.rph.sid.vot.vtm`.split(`.`),kc=e=>{if(!e.id_token)throw Error(`ID token is required but missing`);let t=(e=>{let t=e.split(`.`),[n,r,i]=t;if(t.length!==3||!n||!r||!i)throw Error(`ID token could not be decoded`);let a=JSON.parse(hc(r)),o={__raw:e},s={};return Object.keys(a).forEach((e=>{o[e]=a[e],Oc.includes(e)||(s[e]=a[e])})),{encoded:{header:n,payload:r,signature:i},header:JSON.parse(hc(n)),claims:o,user:s}})(e.id_token);if(!t.claims.iss)throw Error(`Issuer (iss) claim must be a string present in the ID token`);if(t.claims.iss!==e.iss)throw Error(`Issuer (iss) claim mismatch in the ID token; expected "${e.iss}", found "${t.claims.iss}"`);if(!t.user.sub)throw Error(`Subject (sub) claim must be a string present in the ID token`);if(t.header.alg!==`RS256`)throw Error(`Signature algorithm of "${t.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!t.claims.aud||typeof t.claims.aud!=`string`&&!Array.isArray(t.claims.aud))throw Error(`Audience (aud) claim must be a string or array of strings present in the ID token`);if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but was not one of "${t.claims.aud.join(`, `)}"`);if(t.claims.aud.length>1){if(!t.claims.azp)throw Error(`Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values`);if(t.claims.azp!==e.aud)throw Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${e.aud}", found "${t.claims.azp}"`)}}else if(t.claims.aud!==e.aud)throw Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but found "${t.claims.aud}"`);if(e.nonce){if(!t.claims.nonce)throw Error(`Nonce (nonce) claim must be a string present in the ID token`);if(t.claims.nonce!==e.nonce)throw Error(`Nonce (nonce) claim mismatch in the ID token; expected "${e.nonce}", found "${t.claims.nonce}"`)}if(e.max_age&&!Dc(t.claims.auth_time))throw Error(`Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified`);if(t.claims.exp==null||!Dc(t.claims.exp))throw Error(`Expiration Time (exp) claim must be a number present in the ID token`);if(!Dc(t.claims.iat))throw Error(`Issued At (iat) claim must be a number present in the ID token`);let n=e.leeway||60,r=new Date(e.now||Date.now()),i=new Date(0);if(i.setUTCSeconds(t.claims.exp+n),r>i)throw Error(`Expiration Time (exp) claim error in the ID token; current time (${r}) is after expiration time (${i})`);if(t.claims.nbf!=null&&Dc(t.claims.nbf)){let e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),r<e)throw Error(`Not Before time (nbf) claim in the ID token indicates that this token can't be used just yet. Current time (${r}) is before ${e}`)}if(t.claims.auth_time!=null&&Dc(t.claims.auth_time)){let i=new Date(0);if(i.setUTCSeconds(parseInt(t.claims.auth_time)+e.max_age+n),r>i)throw Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${r}) is after last auth at ${i}`)}if(e.organization){let n=e.organization.trim();if(n.startsWith(`org_`)){let e=n;if(!t.claims.org_id)throw Error(`Organization ID (org_id) claim must be a string present in the ID token`);if(e!==t.claims.org_id)throw Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${e}", found "${t.claims.org_id}"`)}else{let e=n.toLowerCase();if(!t.claims.org_name)throw Error(`Organization Name (org_name) claim must be a string present in the ID token`);if(e!==t.claims.org_name)throw Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${e}", found "${t.claims.org_name}"`)}}return t}
vendor: 4,351 bytes, lines 4-5
4,Ac=Qs((function(e,t){var n=Xs&&Xs.__assign||function(){return n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};function r(e,t){if(!t)return``;var n=`; `+e;return!0===t?n:n+`=`+t}function i(e,t,n){return encodeURIComponent(e).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/\(/g,`%28`).replace(/\)/g,`%29`)+`=`+encodeURIComponent(t).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)+function(e){if(typeof e.expires==`number`){var t=new Date;t.setMilliseconds(t.getMilliseconds()+864e5*e.expires),e.expires=t}return r(`Expires`,e.expires?e.expires.toUTCString():``)+r(`Domain`,e.domain)+r(`Path`,e.path)+r(`Secure`,e.secure)+r(`SameSite`,e.sameSite)}(n)}function a(e){for(var t={},n=e?e.split(`; `):[],r=/(%[\dA-F]{2})+/gi,i=0;i<n.length;i++){var a=n[i].split(`=`),o=a.slice(1).join(`=`);o.charAt(0)===`"`&&(o=o.slice(1,-1));try{t[a[0].replace(r,decodeURIComponent)]=o.replace(r,decodeURIComponent)}catch{}}return t}function o(){return a(document.cookie)}function s(e,t,r){document.cookie=i(e,t,n({path:`/`},r))}t.__esModule=!0,t.encode=i,t.parse=a,t.getAll=o,t.get=function(e){return o()[e]},t.set=s,t.remove=function(e,t){s(e,``,n(n({},t),{expires:-1}))}}));Zs(Ac),Ac.encode,Ac.parse,Ac.getAll;var jc=Ac.get,Mc=Ac.set,Nc=Ac.remove,Pc={get(e){let t=jc(e);if(t!==void 0)return JSON.parse(t)},save(e,t,n){let r={};window.location.protocol===`https:`&&(r={secure:!0,sameSite:`none`}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),Mc(e,JSON.stringify(t),r)},remove(e,t){let n={};t!=null&&t.cookieDomain&&(n.domain=t.cookieDomain),Nc(e,n)}},Fc={get(e){return Pc.get(e)||Pc.get(`_legacy_${e}`)},save(e,t,n){let r={};window.location.protocol===`https:`&&(r={secure:!0}),n!=null&&n.daysUntilExpire&&(r.expires=n.daysUntilExpire),n!=null&&n.cookieDomain&&(r.domain=n.cookieDomain),Mc(`_legacy_${e}`,JSON.stringify(t),r),Pc.save(e,t,n)},remove(e,t){let n={};t!=null&&t.cookieDomain&&(n.domain=t.cookieDomain),Nc(e,n),Pc.remove(e,t),Pc.remove(`_legacy_${e}`,t)}},Ic={get(e){if(typeof sessionStorage>`u`)return;let t=sessionStorage.getItem(e);return t==null?void 0:JSON.parse(t)},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};function Lc(e,t,n){var r=t===void 0?null:t,i=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),i=0,a=n.length;i<a;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}(e,n!==void 0&&n),a=i.indexOf(`
5`,10)+1,o=i.substring(a)+(r?`//# sourceMappingURL=`+r:``),s=new Blob([o],{type:`application/javascript`});return URL.createObjectURL(s)}var Rc,zc,Bc,Vc,Hc=(Rc=`Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmc
5oKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo=`,zc=null,Bc=!1,function(e){return Vc=Vc||Lc(Rc,zc,Bc),new Worker(Vc,e)}),Uc={},Wc=class{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;let n=new Set(((t=await this.cache.get(this.manifestKey))==null?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){let t=await this.cache.get(this.manifestKey);if(t){let n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}},Gc={memory:()=>new wc().enclosedCache,localstorage:()=>new Cc},Kc=e=>Gc[e],qc=e=>{let{openUrl:t,onRedirect:n}=e,r=Ys(e,[`openUrl`,`onRedirect`]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},Jc=new ec,Yc=class{constructor(e){let t,n;if(this.userCache=new wc().enclosedCache,this.defaultOptions={authorizationParams:{scope:`openid profile email`},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Jc.releaseLock(`auth0.lock.getTokenSilently`),window.removeEventListener(`pagehide`,this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<`u`&&(()=>{if(!dc())throw Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(dc().subtle===void 0)throw Error(`
6      auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
7    `)})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||`memory`,!Kc(t))throw Error(`Invalid cache location "${t}"`);n=Kc(t)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?Pc:Fc,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(e=>`auth0.${e}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;let r=e.useCookiesForTransactions?this.cookieStorage:Ic;var i;this.scope=xc(`openid`,this.options.authorizationParams.scope,this.options.useRefreshTokens?`offline_access`:``),this.transactionManager=new Ec(r,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||rc,this.cacheManager=new Tc(n,n.allKeys?void 0:new Wc(n,this.options.clientId),this.nowProvider),this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((e,t)=>e?e.startsWith(`https://`)?e:`https://${e}/`:`${t}/`)(this.options.issuer,this.domainUrl),typeof window<`u`&&window.Worker&&this.options.useRefreshTokens&&t===`memory`&&(this.worker=this.options.workerUrl?new Worker(this.options.workerUrl):new Hc)}_url(e){let t=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||nc)));return`${this.domainUrl}${e}&auth0Client=${t}`}_authorizeUrl(e){return this._url(`/authorize?${mc(e)}`)}async _verifyIdToken(e,t,n){let r=await this.nowProvider();return kc({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,typeof i==`string`?parseInt(i,10)||void 0:i),now:r});var i}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,t,n){let r=pc(fc()),i=pc(fc()),a=fc(),o=(e=>{let t=new Uint8Array(e);return(e=>{let t={"+":`-`,"/":`_`,"=":``};return e.replace(/[+/=]/g,(e=>t[e]))})(window.btoa(String.fromCharCode(...Array.from(t))))})(await(async e=>await dc().subtle.digest({name:`SHA-256`},new TextEncoder().encode(e)))(a)),s=((e,t,n,r,i,a,o,s)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:xc(t,n.scope),response_type:`code`,response_mode:s||`query`,state:r,nonce:i,redirect_uri:o||e.authorizationParams.redirect_uri,code_challenge:a,code_challenge_method:`S256`}))(this.options,this.scope,e,r,i,o,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,t==null?void 0:t.response_mode),c=this._authorizeUrl(s);return{nonce:i,code_verifier:a,scope:s.scope,audience:s.audience||`default`,redirect_uri:s.redirect_uri,state:r,url:c}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(e=>{let t=window.screenX+(window.innerWidth-400)/2,n=window.screenY+(window.innerHeight-600)/2;return window.open(e,`auth0:authorize:popup`,`left=${t},top=${n},width=400,height=600,resizable,scrollbars=yes,status=1`)})(``),!t.popup))throw Error("Unable to open a popup for loginWithPopup - window.open returned `null`");let r=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:`web_message`},window.location.origin);t.popup.location.href=r.url;let i=await(e=>new Promise(((t,n)=>{let r,i=setInterval((()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener(`message`,r,!1),n(new sc(e.popup)))}),1e3),a=setTimeout((()=>{clearInterval(i),n(new oc(e.popup)),window.removeEventListener(`message`,r,!1)}),1e3*(e.timeoutInSeconds||60));
7r=function(o){if(o.data&&o.data.type===`authorization_response`){if(clearTimeout(a),clearInterval(i),window.removeEventListener(`message`,r,!1),e.popup.close(),o.data.response.error)return n($.fromPayload(o.data.response));t(o.data.response)}},window.addEventListener(`message`,r)})))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==i.state)throw new $(`state_mismatch`,`Invalid state`);let a=((n=e.authorizationParams)==null?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:`authorization_code`,code:i.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:a})}async getUser(){var e;let t=await this._getIdTokenFromCache();return(e=t==null?void 0:t.decodedToken)==null?void 0:e.user}async getIdTokenClaims(){var e;let t=await this._getIdTokenFromCache();return(e=t==null?void 0:t.decodedToken)==null?void 0:e.claims}async loginWithRedirect(e={}){var t;let n=qc(e),{openUrl:r,fragment:i,appState:a}=n,o=Ys(n,[`openUrl`,`fragment`,`appState`]),s=((t=o.authorizationParams)==null?void 0:t.organization)||this.options.authorizationParams.organization,c=await this._prepareAuthorizeUrl(o.authorizationParams||{}),{url:l}=c,u=Ys(c,[`url`]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:a}),s&&{organization:s}));let d=i?`${l}#${i}`:l;r?await r(d):window.location.assign(d)}async handleRedirectCallback(e=window.location.href){let t=e.split(`?`).slice(1);if(t.length===0)throw Error(`There are no query params available for parsing.`);let{state:n,code:r,error:i,error_description:a}=(e=>{e.indexOf(`#`)>-1&&(e=e.substring(0,e.indexOf(`#`)));let t=new URLSearchParams(e);return{state:t.get(`state`),code:t.get(`code`)||void 0,error:t.get(`error`)||void 0,error_description:t.get(`error_description`)||void 0}})(t.join(``)),o=this.transactionManager.get();if(!o)throw new $(`missing_transaction`,`Invalid state`);if(this.transactionManager.remove(),i)throw new ic(i,a||i,n,o.appState);if(!o.code_verifier||o.state&&o.state!==n)throw new $(`state_mismatch`,`Invalid state`);let s=o.organization,c=o.nonce,l=o.redirect_uri;return await this._requestToken(Object.assign({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:`authorization_code`,code:r},l?{redirect_uri:l}:{}),{nonceIn:c,organization:s}),{appState:o.appState}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(`auth0.is.authenticated`))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(`auth0.is.authenticated`)}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var t;let n=Object.assign(Object.assign({cacheMode:`on`},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:xc(this.scope,(t=e.authorizationParams)==null?void 0:t.scope)})}),r=await((e,t)=>{let n=Uc[t];return n||(n=e().finally((()=>{delete Uc[t],n=null})),Uc[t]=n),n})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return e.detailedResponse?r:r==null?void 0:r.access_token}async _getTokenSilently(e){let{cacheMode:t}=e,n=Ys(e,[`cacheMode`]);if(t!==`off`){let e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||`default`,clientId:this.options.clientId});if(e)return e}if(t!==`cache-only`){if(!await(async(e,t=3)=>{for(let n=0;n<t;n++)if(await e())return!0;return!1})((()=>Jc.acquireLock(`auth0.lock.getTokenSilently`,5e3)),10))throw new ac;try{if(window.addEventListener(`pagehide`,this._releaseLockOnPageHide),t!==`off`){let e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||`default`,clientId:this.options.clientId});if(e)return e}let{id_token:e,access_token:r,oauthTokenScope:i,expires_in:a}=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n);return Object.assign(Object.assign({id_token:e,access_token:r},i?{scope:i}:null),{expires_in:a})}finally{await Jc.releaseLock(`auth0.lock.getTokenSilently`),window.removeEventListener(`pagehide`,this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},t={}){var n;let r=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:xc(this.scope,(n=e.authorizationParams)==null?void 0:n.scope)})});return t=Object.assign(Object.assign({},tc),t),await this.loginWithPopup(r,t),(await this.cacheManager.get(new Sc({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||`default`,clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId===null?delete e.clientId:e.clientId=e.clientId||this.options.clientId;let t=e.logoutParams||{},{federated:n}=t,r=Ys(t,[`federated`]),i=n?`&federated`:``;return this._url(`/v2/logout?${mc(Object.assign({clientId:e.clientId},r))}`)+i}
7async logout(e={}){let t=qc(e),{openUrl:n}=t,r=Ys(t,[`openUrl`]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove(`@@user@@`);let i=this._buildLogoutUrl(r);n?await n(i):!1!==n&&window.location.assign(i)}async _getTokenFromIFrame(e){let t=Object.assign(Object.assign({},e.authorizationParams),{prompt:`none`}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);let{url:r,state:i,nonce:a,code_verifier:o,redirect_uri:s,scope:c,audience:l}=await this._prepareAuthorizeUrl(t,{response_mode:`web_message`},window.location.origin);try{if(window.crossOriginIsolated)throw new $(`login_required`,`The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.`);let n=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,u=await((e,t,n=60)=>new Promise(((r,i)=>{let a=window.document.createElement(`iframe`);a.setAttribute(`width`,`0`),a.setAttribute(`height`,`0`),a.style.display=`none`;let o=()=>{window.document.body.contains(a)&&(window.document.body.removeChild(a),window.removeEventListener(`message`,s,!1))},s,c=setTimeout((()=>{i(new ac),o()}),1e3*n);s=function(e){if(e.origin!=t||!e.data||e.data.type!==`authorization_response`)return;let n=e.source;n&&n.close(),e.data.response.error?i($.fromPayload(e.data.response)):r(e.data.response),clearTimeout(c),window.removeEventListener(`message`,s,!1),setTimeout(o,2e3)},window.addEventListener(`message`,s,!1),window.document.body.appendChild(a),a.setAttribute(`src`,e)})))(r,this.domainUrl,n);if(i!==u.state)throw new $(`state_mismatch`,`Invalid state`);let d=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:o,code:u.code,grant_type:`authorization_code`,redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a,organization:t.organization});return Object.assign(Object.assign({},d),{scope:c,oauthTokenScope:d.scope,audience:l})}catch(e){throw e.error===`login_required`&&this.logout({openUrl:!1}),e}}async _getTokenUsingRefreshToken(e){let t=await this.cacheManager.get(new Sc({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||`default`,clientId:this.options.clientId}));if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new lc(e.authorizationParams.audience||`default`,e.authorizationParams.scope)}let n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,r=typeof e.timeoutInSeconds==`number`?1e3*e.timeoutInSeconds:null;try{let i=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:`refresh_token`,refresh_token:t&&t.refresh_token,redirect_uri:n}),r&&{timeout:r}));return Object.assign(Object.assign({},i),{scope:e.authorizationParams.scope,oauthTokenScope:i.scope,audience:e.authorizationParams.audience||`default`})}catch(t){if((t.message.indexOf(`Missing Refresh Token`)>-1||t.message&&t.message.indexOf(`invalid refresh token`)>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw t}}async _saveEntryInCache(e){let{id_token:t,decodedToken:n}=e,r=Ys(e,[`id_token`,`decodedToken`]);this.userCache.set(`@@user@@`,{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){let e=this.options.authorizationParams.audience||`default`,t=await this.cacheManager.getIdToken(new Sc({clientId:this.options.clientId,audience:e,scope:this.scope})),n=this.userCache.get(`@@user@@`);return t&&t.id_token===(n==null?void 0:n.id_token)?n:(this.userCache.set(`@@user@@`,t),t)}async _getEntryFromCache({scope:e,audience:t,clientId:n}){let r=await this.cacheManager.get(new Sc({scope:e,audience:t,clientId:n}
7),60);if(r&&r.access_token){let{access_token:e,oauthTokenScope:t,expires_in:n}=r,i=await this._getIdTokenFromCache();return i&&Object.assign(Object.assign({id_token:i.id_token,access_token:e},t?{scope:t}:null),{expires_in:n})}}async _requestToken(e,t){let{nonceIn:n,organization:r}=t||{},i=await bc(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),a=await this._verifyIdToken(i.id_token,n,r);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},i),{decodedToken:a,scope:e.scope,audience:e.audience||`default`}),i.scope?{oauthTokenScope:i.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(r||a.claims.org_id),Object.assign(Object.assign({},i),{decodedToken:a})}},Xc={isAuthenticated:!1,isLoading:!0},Zc=function(){throw Error(`You forgot to wrap your component in <Auth0Provider>.`)},Qc=Q(Q({},Xc),{buildAuthorizeUrl:Zc,buildLogoutUrl:Zc,getAccessTokenSilently:Zc,getAccessTokenWithPopup:Zc,getIdTokenClaims:Zc,loginWithRedirect:Zc,loginWithPopup:Zc,logout:Zc,handleRedirectCallback:Zc}),$c=(0,i.createContext)(Qc),el=function(e){Gs(t,e);function t(n,r){var i=e.call(this,r||n)||this;return i.error=n,i.error_description=r,Object.setPrototypeOf(i,t.prototype),i}return t}(Error),tl=/[?&]code=[^&]+/,nl=/[?&]state=[^&]+/,rl=/[?&]error=[^&]+/,il=function(e){return e===void 0&&(e=window.location.search),(tl.test(e)||rl.test(e))&&nl.test(e)},al=function(e){return function(t){return t instanceof Error?t:typeof t==`object`&&t&&`error`in t&&typeof t.error==`string`?`error_description`in t&&typeof t.error_description==`string`?new el(t.error,t.error_description):new el(t.error):Error(e)}},ol=al(`Login failed`),sl=al(`Get access token failed`),cl=function(e){var t;e!=null&&e.redirectUri&&(console.warn("Using `redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `redirectUri` will be no longer supported in a future version"),e.authorizationParams=e.authorizationParams||{},e.authorizationParams.redirect_uri=e.redirectUri,delete e.redirectUri),(t=e==null?void 0:e.authorizationParams)!=null&&t.redirectUri&&(console.warn("Using `authorizationParams.redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `authorizationParams.redirectUri` will be removed in a future version"),e.authorizationParams.redirect_uri=e.authorizationParams.redirectUri,delete e.authorizationParams.redirectUri)},ll=function(e,t){switch(t.type){case`LOGIN_POPUP_STARTED`:return Q(Q({},e),{isLoading:!0});case`LOGIN_POPUP_COMPLETE`:case`INITIALISED`:return Q(Q({},e),{isAuthenticated:!!t.user,user:t.user,isLoading:!1,error:void 0});case`HANDLE_REDIRECT_COMPLETE`:case`GET_ACCESS_TOKEN_COMPLETE`:return e.user===t.user?e:Q(Q({},e),{isAuthenticated:!!t.user,user:t.user});case`LOGOUT`:return Q(Q({},e),{isAuthenticated:!1,user:void 0});case`ERROR`:return Q(Q({},e),{isLoading:!1,error:t.error})}},ul=function(e){return cl(e),Q(Q({},e),{auth0Client:{name:`auth0-react`,version:`2.2.4`}})},dl=function(e){window.history.replaceState({},document.title,(e==null?void 0:e.returnTo)||window.location.pathname)},fl=function(e){var t=e.children,n=e.skipRedirectCallback,r=e.onRedirectCallback,a=r===void 0?dl:r,o=e.context,s=o===void 0?$c:o,c=Ks(e,[`children`,`skipRedirectCallback`,`onRedirectCallback`,`context`]),l=(0,i.useState)(function(){return new Yc(ul(c))})[0],u=(0,i.useReducer)(ll,Xc),d=u[0],f=u[1],p=(0,i.useRef)(!1);(0,i.useEffect)(function(){p.current||(p.current=!0,(function(){return qs(void 0,void 0,void 0,function(){var e,t,r;return Js(this,function(i){switch(i.label){case 0:return i.trys.push([0,7,,8]),e=void 0,il()&&!n?[4,l.handleRedirectCallback()]:[3,3];case 1:return t=i.sent().appState,[4,l.getUser()];case 2:return e=i.sent(),a(t,e),[3,6];case 3:return[4,l.checkSession()];case 4:return i.sent(),[4,l.getUser()];case 5:e=i.sent(),i.label=6;case 6:return f({type:`INITIALISED`,user:e}),[3,8];case 7:return r=i.sent(),f({type:`ERROR`,error:ol(r)}),[3,8];case 8:return[2]}})})})())},[l,a,n]);var m=(0,i.useCallback)(function(e){return cl(e),l.loginWithRedirect(e)},[l]),h=(0,i.useCallback)(function(e,t){return qs(void 0,void 0,void 0,function(){var n,r;return Js(this,function(i){switch(i.label){case 0:f({type:`LOGIN_POPUP_STARTED`}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,l.loginWithPopup(e,t)];case 2:return i.sent(),[3,4];case 3:return n=i.sent(),f({type:`ERROR`,error:ol(n)}),[2];case 4:return[4,l.getUser()];case 5:return r=i.sent(),f({type:`LOGIN_POPUP_COMPLETE`,user:r}),[2]}})})},[l]),g=(0,i.useCallback)(function(e){return e===void 0&&(e={}),qs(void 0,void 0,void 0,function(){return Js(this,function(t){switch(t.label){case 0:return[4,l.logout(e)];case 1:return t.sent(),(e.openUrl||e.openUrl===!1)&&f({type:`LOGOUT`}),[2]}})})},[l]),_=(0,i.useCallback)(function(e){return qs(void 0,void 0,void 0,function(){var t,n,r,i;return Js(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,3,5]),[4,l.getTokenSilently(e)];case 1:return t=a.sent(),[3,5];case 2:throw n=a.sent(),sl(n);case 3:return r=f,i={type:`GET_ACCESS_TOKEN_COMPLETE`},[4,l.getUser()];case 4:return r.apply(void 0,[(i.user=a.sent(),i)]),[7];case 5:return[2,t]}})})},[l]),v=(0,i.useCallback)(function(e,t){return qs(void 0,void 0,void 0,function(){var n,r,i,a;return Js(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,5]),[4,l.getTokenWithPopup(e,t)];case 1:return n=o.sent(),[3,5];case 2:throw r=o.sent(),sl(r);case 3:return i=f,a={type:`GET_ACCESS_TOKEN_COMPLETE`},[4,l.getUser()];case 4:return i.apply(void 0,[(a.user=o.sent(),a)]),[7];case 5:return[2,n]}})})},[l]),y=(0,i.useCallback)(function(){return l.getIdTokenClaims()},[l]),b=(0,i.useCallback)(function(e){return qs(void 0,void 0,void 0,function(){var t,n,r;return Js(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,3,5]),[4,l.handleRedirectCallback(e)];case 1:return[2,i.sent()];case 2:throw t=i.sent(),sl(t);case 3:return n=f,r={type:`HANDLE_REDIRECT_COMPLETE`},[4,l.getUser()];case 4:return n.apply(void 0,[(r.user=i.sent(),r)]),[7];case 5:return[2]}})})},[l]),x=(0,i.useMemo)(function(){return Q(Q({},d),{getAccessTokenSilently:_,getAccessTokenWithPopup:v,getIdTokenClaims:y,loginWithRedirect:m,loginWithPopup:h,logout:g,handleRedirectCallback:b})},[d,_,v,y,m,h,g,b]);return i.createElement(s.Provider,{value:x},t)},pl=function(e){return e===void 0&&(e=$c),(0,i.useContext)(e)},ml=r(`dashboard/src/helpers/getAppUrl.ts`),hl=`https://dashboard.browse.ai`,gl=(e,t=!1)=>{let n=e.substr(0,1)===`/`?e:`/${e}`,r=e.match(/^(https?)?\/\//);return!t&&r?(ml(`error`,`Path may include domain`,{path:e,includeDomain:t}),`/`):(t&&(n=`${hl.replace(/\/$/,``)}${n}`),n)},_l=()=>{let{isAuthenticated:e,logout:t,isLoading:r,user:i,loginWithRedirect:a,getAccessTokenSilently:o,error:s}=pl();return{userIsLoggedIn:!r&&e,userProfile:i,authenticating:r,loginWithRedirect:a,logout:e=>{n({user:void 0,team:void 0}),Hs(),js==null||js.reset(),zs(),t({logoutParams:{federated:!1,returnTo:gl(e,!0)}})},getAccessTokenSilently:o,error:s}};export{rs as _,Us as a,zs as c,As as d,Ts as f,fs as g,us as h,Hs as i,Ms as l,os as m,gl as n,Vs as o,bs as p,fl as r,Rs as s,_l as t,js as u};
8//# sourceMappingURL=useUser-5PN-i3wu.js.map
9//# chunkId=01a0ce9a-fb1f-7e12-9666-b4d21b7ca627

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.