PageSourceSearch

https://www.paradisepost.com/_static/??-eJydjEEOwiAQAD8krBqr6cF48A…/j3xLRFJbwE0/D9OuXj5jCut/txNwzxAfm8Z1M=

js paradisepost.com collected 2026-09-24 20:02:28 UTC 405,755 bytes, 9 lines download raw bytes

1(function(){({initialize:function(){this.initializeHsslCheck()},debug:function(){let e=!1;return typeof DFM_AD_MODS_DEBUG<`u`&&(e=!0),e},checkForBangPremiumOffer:function(){let e,t,n=window.blueConicClient.profile.getProfile();this.debug()&&console.log(`DEBUG: blueconic profile = `+n);let r=[`bang_accept_premium_offer`,`bang_accept_premium_offer_date`];this.debug()&&console.log(`DEBUG: blueconic premium offer properties = `+r),n.loadValues(r,this,function(){if(e=n.getValue(`bang_accept_premium_offer`),t=n.getValue(`bang_accept_premium_offer_date`),e===`yes`&&t.length>0){let e=new Date(t);new Date-e>7200*60*1e3==0?localStorage.setItem(`hhsl`,`access`):localStorage.removeItem(`hhsl`)}})},initializeHsslCheck:function(){this.debug()&&console.log(`DEBUG: initializeHsslCheck success`);let e=!1,t=this,n;typeof DFM_AD_MODS_LEVEL<`u`&&(n=parseInt(DFM_AD_MODS_LEVEL[0])),this.debug()&&console.log(`DEBUG: hhslFromOptions `+n),document.addEventListener(`onLoginSuccess`,function(n){e=!0,t.debug()&&console.log(`DEBUG: onLoginSuccess is true`)}),window.blueConicClient!==void 0&&window.blueConicClient.event!==void 0&&window.blueConicClient.event.subscribe!==void 0?(t.debug()&&console.log(`DEBUG: blueconic detected and not undefined; running checkForBangPremiumOffer`),t.checkForBangPremiumOffer()):(t.debug()&&console.log(`DEBUG: blueconic not loaded, adding event listener`),window.addEventListener(`onBlueConicLoaded`,function(){t.checkForBangPremiumOffer()},!1)),document.addEventListener(`onHasAccess`,function(r){t.debug()&&console.log(`DEBUG: onHasAccess event listener hit`);let i=[];n!==void 0&&i.push(n),t.debug()&&console.log(`DEBUG: hhsl level is `+i);let a,o=r.detail.MG2AccountData.DigitalAccess.Subscription.HouseHoldSubscriptionLevel;t.debug()&&console.log(`DEBUG: hhsl level is `+o),a=!!(o!==void 0&&i.includes(o)),t.debug()&&console.log(`DEBUG: hhslAccess `+a),!0===a?(localStorage.setItem(`hhsl`,`access`),t.debug()&&console.log(`DEBUG: setting localStorage item for hhsl`)):(localStorage.removeItem(`hhsl`),t.debug()&&console.log(`DEBUG: removing localStorage item for hhsl`)),e&&!0===a&&window.location.reload()})}}).initialize()})();;
2let domainToNumberMap={"dailypress.com":"197837618","courant.com":"197837617","mcall.com":"197837616","orlandosentinel.com":"197837614","sun-sentinel.com":"197837613","pilotonline.com":"197837701","bostonherald.com":"239876507","advocate-news.com":"239876509","chicoer.com":"239876509","dailydemocrat.com":"239876509","marinij.com":"239876509","mendocinobeacon.com":"239876509","montereyherald.com":"239876509","orovillemr.com":"239876509","paradisepost.com":"239876509","record-bee.com":"239876509","redbluffdailynews.com":"239876509","santacruzsentinel.com":"239876509","thereporter.com":"239876509","timesheraldonline.com":"239876509","times-standard.com":"239876509","ukiahdailyjournal.com":"239876509","willitsnews.com":"239876509","morningjournal.com":"239876511","news-herald.com":"239876511","dailylocal.com":"239876512","delcotimes.com":"239876512","mainlinemedianews.com":"239876512","pottsmerc.com":"239876512","readingeagle.com":"239876512","thereporteronline.com":"239876512","timesherald.com":"239876512","trentonian.com":"239876512","twincities.com":"239876515","denverpost.com":"239876503","lowellsun.com":"239876505","nashobavalleyvoice.com":"239876505","sentinelandenterprise.com":"239876505","macombdaily.com":"239876508","themorningsun.com":"239876508","thenewsherald.com":"239876508","theoaklandpress.com":"239876508","dailyfreeman.com":"239876510","oneidadispatch.com":"239876510","saratogian.com":"239876510","troyrecord.com":"239876510","eastbaytimes.com":"239876506","mercurynews.com":"239876506","siliconvalley.com":"239876506","coloradohometownweekly.com":"239876513","dailycamera.com":"239876513","timescall.com":"239876513","broomfieldenterprise.com":"239876513","canoncitydailyrecord.com":"239876513","eptrail.com":"239876513","reporterherald.com":"239876513","akronnewsreporter.com":"239876513","brushnewstribune.com":"239876513","julesburgadvocate.com":"239876513","fortmorgantimes.com":"239876513","journal-advocate.com":"239876513","greeleytribune.com":"239876513","dailybreeze.com":"239876514","dailybulletin.com":"239876514","nydailynews.com":"197837700","excelsiorcalifornia.com":"239876514","ocregister.com":"239876514","pasadenastarnews.com":"239876514","pressenterprise.com":"239876514","presstelegram.com":"239876514","redlandsdailyfacts.com":"239876514","sbsun.com":"239876514","sgvtribune.com":"239876514","whittierdailynews.com":"239876514","dailynews.com":"239876514","baltimoresun.com":"197837615","capitalgazette.com":"197837619","chicagotribune.com":"197837611","sandiegouniontribune.com":"239876514","republicanherald.com":"239876516","standardspeaker.com":"239876516","citizensvoice.com":"239876516","thetimes-tribune.com":"239876516","wcexaminer.com":"239876516","petalumanews.com":"239876517","pressdemocrat.com":"239876517","sonomanews.com":"239876517"};let currentDomain=window.location.hostname.toLowerCase().replace(/^(www\.|preprod\.|staging\.|develop\.)/,'');let TRIB_DOMAINS=['mcall.com','courant.com','sun-sentinel.com','orlandosentinel.com','growthspotter.com','dailypress.com','pilotonline.com','nydailynews.com','baltimoresun.com','capitalgazette.com','chicagotribune.com'];const isTrib=TRIB_DOMAINS.includes(currentDomain);let gtmId=isTrib?"ma89701":"ma23578";let matherId=domainToNumberMap[currentDomain]||null;(function(cid,mkt,config,domain){var ml=document.createElement('script');var s=document.getElementsByTagName('script')[0]||document.head;var cb;try{if(!(cb=localStorage._matherVer)){throw false;}}catch(e){cb=Math.round(new Date()/1.0368e9);}ml.type='text/javascript';ml.async=true;ml.defer=true;
vendor: 2,706 bytes, lines 2-5
2ml.id='_mljs';ml.src=('https:'==window.location.protocol?'https':'http')+'://'+(domain||'js.matheranalytics.com/s')+'/'+cid+'/'+mkt+'/'+(config?config+'/': '')+'ml.js?cb='+cb;s.parentNode.insertBefore(ml,s);})(gtmId,matherId,'wp');
3;
4/*! For license information please see mng-digisubs.sophi.bundle.js.LICENSE.txt */
5(()=>{var e={5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n<l.length;n++){var o,i=l[n],p=h.p,f=i[2];e>3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&p<i[1])?(a=0,h.v=r,h.n=i[1]):p<f&&(o=e<3||i[0]>r||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function w(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m:w}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports}
5,1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,forceLogoutOnExpiredIdToken:!!window.authentication_config&&"1"===window.authentication_config.forceLogoutOnExpiredIdToken,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaC
5heckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment,enableSocialSigninModal:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSigninModal,enableSocialAllPages:!!window.authentication_config&&"1"===window.authentication_config.enableSocialAllPages,enableSocialHomepage:!!window.authentication_config&&"1"===window.authentication_config.enableSocialHomepage,enableSocialArticle:!!window.authentication_config&&"1"===window.authentication_config.enableSocialArticle,enableSocialSection:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSection};n.d(t,["A",0,c])}};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],i=t[r++],a=0===i?{enumerable:!0,value:t[r++]}:{enumerable:!0,get:i};n.o(e,o)||Object.defineProperty(e,o,a)}else for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=t.apply(n,r);function s(t){e(a,o,i,s,c,"next",t)}function c(t){e(a,o,i,s,c,"throw",t)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=n(4756);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}
5finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}class h extends Error{}function p(e,t){this.v=e,this.k=t}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function y(e){return new p(e,0)}function m(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function g(e,t){return e.get(w(e,t))}function v(e,t,n){m(e,t),t.set(e,n)}function A(e,t,n){return e.set(w(e,t),n),n}function E(e,t){m(e,t),t.add(e)}function S(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?b(Object(n),!0).forEach(function(t){S(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e){return function(){return new N(e.apply(this,arguments))}}function N(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof p;Promise.resolve(s?a.v:a).then(function(n){if(s){var c="return"===t&&a.k?t:"next";if(!a.k||n.done)return r(c,n);n=e[c](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var s={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}h.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError,N.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},N.prototype.next=function(e){return this._invoke("next",e)},N.prototype.throw=function(e){return this._invoke("throw",e)},N.prototype.return=function(e){return this._invoke("return",e)};Error;var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},I={},k={};Object.defineProperty(k,"__esModule",{value:!0});var P=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(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(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();k.default=function(){return P.getInstance()};
5var L=C&&C.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},M=C&&C.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},x=C;Object.defineProperty(I,"__esModule",{value:!0});var D=k,U="browser-tabs-lock-key",B={key:function(e){return L(x,void 0,void 0,function(){return M(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return L(x,void 0,void 0,function(){return M(this,function(e){throw new Error("Unsupported")})})},clear:function(){return L(x,void 0,void 0,function(){return M(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return L(x,void 0,void 0,function(){return M(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return L(x,void 0,void 0,function(){return M(this,function(e){throw new 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 H(e){return new Promise(function(t){return setTimeout(t,e)})}function G(e){for(var t="",n=0;n<e;n++)t+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(61*Math.random())];return t}var W=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+G(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,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return void 0===n&&(n=5e3),L(this,void 0,void 0,function(){var r,o,i,a,s,c,u;return M(this,function(l){switch(l.label){case 0:r=Date.now()+G(4),o=Date.now()+n,i=U+"-"+t,a=void 0===this.storageHandler?B:this.storageHandler,l.label=1;case 1:return Date.now()<o?[4,H(30)]:[3,8];case 2:return l.sent(),null!==a.getItemSync(i)?[3,5]:(s=this.id+"-"+t+"-"+r,[4,H(Math.floor(25*Math.random()))]);case 3:return l.sent(),a.setItemSync(i,JSON.stringify({id:this.id,iat:r,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,H(30)];case 4:return l.sent(),null!==(c=a.getItemSync(i))&&(u=JSON.parse(c)).id===this.id&&u.iat===r?(this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(i,r),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?B:this.storageHandler),[4,this.waitForSomethingToChange(o)];case 6:l.sent(),l.label=7;case 7:return r=Date.now()+G(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return L(this,void 0,void 0,function(){var n=this;return M(this,function(r){return setTimeout(function(){return L(n,void 0,void 0,function(){var n,r,o;return M(this,function(i){switch(i.label){case 0:return[4,D.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?B:this.storageHandler,null===(r=n.getItemSync(e))?(D.default().unlock(t),[2]):((o=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(o)),D.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(D.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return L(this,void 0,void 0,function(){return M(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var r=!1,o=Date.now(),i=!1;function a(){if(i||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),i=!0),!r){r=!0;var t=50-(Date.now()-o);t>0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEac
5h(function(e){return e()})},e.prototype.releaseLock=function(e){return L(this,void 0,void 0,function(){return M(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 L(this,void 0,void 0,function(){var n,r,o,i;return M(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?B:this.storageHandler,r=U+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,D.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),D.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;c<o.length;c++){var u=o[c];if(u.includes(U)){var l=r.getItemSync(u);if(null!==l){var d=JSON.parse(l);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(u),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}();I.default=W;new TextEncoder,new TextDecoder;let K;if(Uint8Array.prototype.toBase64)K=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;K=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}Error;Error;var F=C&&C.__assign||function(){return F=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},F.apply(this,arguments)};var X;!function(e){e.Code="code",e.ConnectCode="connect_code"}(X||(X={}));var j;var J;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(J||(J={}));Error;var V,Y;let z;if("undefined"==typeof navigator||null===(V=navigator.userAgent)||void 0===V||null===(Y=V.startsWith)||void 0===Y||!Y.call(V,"Mozilla/5.0 ")){const e="v3.8.6";z="".concat("oauth4webapi","/").concat(e)}function q(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch(e){return!1}}const Z="ERR_INVALID_ARG_VALUE",Q="ERR_INVALID_ARG_TYPE";function $(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const ee=Symbol(),te=Symbol(),ne=Symbol(),re=Symbol(),oe=Symbol(),ie=Symbol(),ae=new TextEncoder,se=new TextDecoder;function ce(e){return"string"==typeof e?ae.encode(e):se.decode(e)}let ue,le;if(Uint8Array.prototype.toBase64)ue=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;ue=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function de(e){return"string"==typeof e?le(e):ue(e)}le=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw $("The input to be decoded is not correctly encoded.",Z,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw $("The input to be decoded is not correctly encoded.",Z,e)}};class he extends Error{constructor(e,t){var n;super(e,t),S(this,"code",void 0),this.name=this.constructor.name,this.code=wt,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class pe extends Error{constructor(e,t){var n;super(e,t),S(this,"code",void 0),this.name=this.constructor.name,null!=t&&t.code&&(this.code=null==t?void 0:t.code),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function fe(e,t,n){return new pe(e,{code:t,cause:n})}function we(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function ye(e){q(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(z&&!t.has("user-agent")&&t.set("user-agent",z),t.has("authorization"))throw $('"options.headers" must not include the "authorization" header name',Z);return t}function me(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw $('"options.signal" must return or be an instance of AbortSignal',Q);return t}}function ge(e){return e.includes("//")?e.replace("//","/"):e}function ve(e,t,n,r,o){try{if("number"!=typeof e||!Number.isFinite(e))throw $("".concat(n," must be a number"),Q,o);if(e>0)return;if(t){if(0!==e)throw $("".concat(n," must be a non-negative number"),Z,o);return}throw $("".concat(n," must be a positive number"),Z,o)}catch(e){if(r)throw fe(e.message,r,o);throw e}}function Ae(e,t,n,r){try{if("string"!=typeof e)throw $("".concat(t," must be a string"),Q,r);if(0===e.length)throw $("".concat(t," must not be empty"),Z,r)}catch(e){if(n)throw fe(e.message,n,r);throw e}}function Ee(e){!function(e,t){if(Ye(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];if(r.length>2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return fe(t,At,e)}(e,t)}(e,"application/json")}function Se(){return de(crypto.getRandomValues(new Uint8Array(32)))}function be(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new he("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new he("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new he("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new he("unsupported CryptoKey algorithm name",{cause:e})}}function Te(e){const t=null==e?void 0:e[te];return"number"==typeof t&&Number.isFinite(t)?t:0}function _e(e){const t=null==e?void 0:e[ne];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Re(){return Math.floor(Date.now()/1e3)}function Oe(e){if("object"!=typeof e||null===e)throw $('"as" must be an object',Q);Ae(e.issuer,'"as.issuer"')}function Ne(e){if("object"!=typeof e||null===e)throw $('"client" must be an object',Q);Ae(e.client_id,'"client.client_id"')}function Ce(e){return Ae(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Ie(e,t){const n=e instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&Ae(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},r=n.key,o=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw $("".concat(t," must be a CryptoKey"),Q)}(e,t),"private"!==e.type)throw $("".concat(t," must be a private CryptoKey"),Z)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:be(r),kid:o},u=function(e,t){const n=Re()+Te(t);return{jti:Se(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===t[oe]||void 0===s||s.call(t,c,u),i.set("client_id",n.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw $('CryptoKey instances used for signing assertions must include "sign" in their "usages"',Z);const r="".concat(de(ce(JSON.stringify(e))),".").concat(de(ce(JSON.stringify(t)))),o=de(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Pt(e)};case"RSA-PSS":switch(kt(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new he("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return kt(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new he("unsupported CryptoKey algorithm name",{cause:e})}(n),n,ce(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const ke=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Pe(e,t){if(t&&"https:"!==e.protocol)throw fe("only requests to HTTPS are allowed",St,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw fe("only HTTP and HTTPS requests are allowed",bt,e)}function Le(e,t,n,r){let o;if("string"!=typeof e||!(o=ke(e)))throw fe("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?Ot:Nt,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Pe(o,r),o}function Me(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Le(e.mtls_endpoint_aliases[t],t,n,r):Le(e[t],t,n,r)}
5class xe extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"status",void 0),S(this,"error_description",void 0),S(this,"response",void 0),this.name=this.constructor.name,this.code=ft,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class De extends Error{constructor(e,t){var n,r;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"error",void 0),S(this,"error_description",void 0),this.name=this.constructor.name,this.code=yt,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class Ue extends Error{constructor(e,t){var n;super(e,t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"response",void 0),S(this,"status",void 0),this.name=this.constructor.name,this.code=pt,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const Be="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",He="("+Be+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',Ge="("+Be+")\\s*=\\s*("+Be+")",We=new RegExp("^[,\\s]*("+Be+")"),Ke=new RegExp("^[,\\s]*"+He+"[,\\s]*(.*)"),Fe=new RegExp("^[,\\s]*"+Ge+"[,\\s]*(.*)"),Xe=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function je(e,t,n){if(e.status!==t){let t;var r;if(nt(e),t=await async function(e){if(e.status>399&&e.status<500){It(e),Ee(e);try{const t=await e.clone().json();if(we(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new xe("server responded with an error in the response body",{cause:t,response:e});throw fe('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Et,e)}}function Je(e){if(!st.has(e))throw $('"options.DPoP" is not a valid DPoPHandle',Z)}const Ve=Symbol();function Ye(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function ze(e,t,n,r,o){if(Oe(e),Ne(t),!q(r,Response))throw $('"response" must be an instance of Response',Q);if(nt(r),200!==r.status)throw fe('"response" is not a conform UserInfo Endpoint response (unexpected HTTP status code)',Et,r);let i;if(It(r),"application/jwt"===Ye(r)){const n=await Lt(await r.text(),Mt.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),Te(t),_e(t),null==o?void 0:o[ie]).then(rt.bind(void 0,t.client_id)).then(it.bind(void 0,e)),i=n.claims,a=n.jwt;$e.set(r,a)}else{if(t.userinfo_signed_response_alg)throw fe("JWT UserInfo Response expected",mt,r);await Bt(r)}if(Ae(i.sub,'"response" body "sub" property',vt,{body:i}),n===Ve);else if(Ae(n,'"expectedSubject"'),i.sub!==n)throw fe('unexpected "response" body "sub" property value',Rt,{expected:n,body:i,attribute:"sub"});return i}async function qe(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[re])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:me(r,null==a?void 0:a.signal)})}async function Ze(e,t,n,r,o,i){var a;const s=Me(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[ee]));o.set("grant_type",r);const c=ye(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Je(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await qe(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const Qe=new WeakMap,$e=new WeakMap;function et(e){if(!e.id_token)return;const t=Qe.get(e);if(!t)throw $('"ref" was already garbage collected or did not resolve from the proper sources',Z);return t}
5async function tt(e,t,n,r,o,i){if(Oe(e),Ne(t),!q(n,Response))throw $('"response" must be an instance of Response',Q);await je(n,200,"Token Endpoint"),It(n);const a=await Bt(n);if(Ae(a.access_token,'"response" body "access_token" property',vt,{body:a}),Ae(a.token_type,'"response" body "token_type" property',vt,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;ve(e,!0,'"response" body "expires_in" property',vt,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Ae(a.refresh_token,'"response" body "refresh_token" property',vt,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw fe('"response" body "scope" property must be a string',vt,{body:a});if(void 0!==a.id_token){Ae(a.id_token,'"response" body "id_token" property',vt,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(ve(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await Lt(a.id_token,Mt.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Te(t),_e(t),o).then(lt.bind(void 0,i)).then(at.bind(void 0,e)).then(ot.bind(void 0,t.client_id)),c=s.claims,u=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw fe('ID Token "aud" (audience) claim includes additional untrusted audiences',_t,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw fe('unexpected ID Token "azp" (authorized party) claim value',_t,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&ve(c.auth_time,!0,'ID Token "auth_time" (authentication time)',vt,{claims:c}),$e.set(n,u),Qe.set(a,c)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new he("unsupported `token_type` value",{cause:{body:a}});return a}function nt(e){let t;if(t=function(e){if(!q(e,Response))throw $('"response" must be an instance of Response',Q);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(We);const c=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!c)return;const u=r.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;r=l?l[1]:void 0;const h={};let p;if(d)for(;r;){let n,o;if(t=r.match(Ke)){var i=R(t,4);if(n=i[1],o=i[2],r=i[3],o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}h[n.toLowerCase()]=o}else{if(!(t=r.match(Fe))){if(t=r.match(Xe)){if(Object.keys(h).length)break;var a=R(t,3);p=a[1],r=a[2];break}return}var s=R(t,4);n=s[1],o=s[2],r=s[3],h[n.toLowerCase()]=o}}else r=u||void 0;const f={scheme:c,parameters:h};p&&(f.token68=p),n.push(f)}return n.length?n:void 0}(e))throw new Ue("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}function rt(e,t){return void 0!==t.claims.aud?ot(e,t):t}function ot(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw fe('unexpected JWT "aud" (audience) claim value',_t,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw fe('unexpected JWT "aud" (audience) claim value',_t,{expected:e,claims:t.claims,claim:"aud"});return t}function it(e,t){return void 0!==t.claims.iss?at(e,t):t}function at(e,t){var n,r;const o=null!==(n=null===(r=e[Gt])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw fe('unexpected JWT "iss" (issuer) claim value',_t,{expected:o,claims:t.claims,claim:"iss"});return t}const st=new WeakSet,ct=Symbol(),ut={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function lt(e,t){for(const n of e)if(void 0===t.claims[n])throw fe('JWT "'.concat(n,'" (').concat(ut[n],") claim missing"),vt,{claims:t.claims});return t}const dt=Symbol(),ht=Symbol();const pt="OAUTH_WWW_AUTHENTICATE_CHALLENGE",ft="OAUTH_RESPONSE_BODY_ERROR",wt="OAUTH_UNSUPPORTED_OPERATION",yt="OAUTH_AUTHORIZATION_RESPONSE_E
5RROR",mt="OAUTH_JWT_USERINFO_EXPECTED",gt="OAUTH_PARSE_ERROR",vt="OAUTH_INVALID_RESPONSE",At="OAUTH_RESPONSE_IS_NOT_JSON",Et="OAUTH_RESPONSE_IS_NOT_CONFORM",St="OAUTH_HTTP_REQUEST_FORBIDDEN",bt="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Tt="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",_t="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Rt="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",Ot="OAUTH_MISSING_SERVER_METADATA",Nt="OAUTH_INVALID_SERVER_METADATA";async function Ct(e){if(!q(e,Response))throw $('"response" must be an instance of Response',Q);await je(e,200,"Revocation Endpoint")}function It(e){if(e.bodyUsed)throw $('"response" body has been used already',Z)}function kt(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new he("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Pt(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new he("unsupported ECDSA namedCurve",{cause:e})}}async function Lt(e,t,n,r,o){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===o)throw new he("JWE decryption is not configured",{cause:e});var d=(e=await o(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw fe("Invalid JWT",vt,e);try{i=JSON.parse(ce(de(c)))}catch(e){throw fe("failed to parse JWT Header body as base64url encoded JSON",gt,e)}if(!we(i))throw fe("JWT Header must be a top level object",vt,e);if(t(i),void 0!==i.crit)throw new he('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(ce(de(u)))}catch(e){throw fe("failed to parse JWT Payload body as base64url encoded JSON",gt,e)}if(!we(a))throw fe("JWT Payload must be a top level object",vt,e);const h=Re()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw fe('unexpected JWT "exp" (expiration time) claim type',vt,{claims:a});if(a.exp<=h-r)throw fe('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Tt,{claims:a,now:h,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw fe('unexpected JWT "iat" (issued at) claim type',vt,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw fe('unexpected JWT "iss" (issuer) claim type',vt,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw fe('unexpected JWT "nbf" (not before) claim type',vt,{claims:a});if(a.nbf>h+r)throw fe('unexpected JWT "nbf" (not before) claim value',Tt,{claims:a,now:h,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw fe('unexpected JWT "aud" (audience) claim type',vt,{claims:a});return{header:i,claims:a,jwt:e}}function Mt(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw fe('unexpected JWT "alg" header parameter',vt,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw fe('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw fe('unexpected JWT "alg" header parameter',vt,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw fe('unexpected JWT "alg" header parameter',vt,{header:r,expected:e,reason:"client configuration"})}function xt(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw fe('"'.concat(t,'" parameter must be provided only once'),vt);return r}const Dt=Symbol(),Ut=Symbol();async function Bt(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ee;try{t=await e.json()}catch(t){throw n(e),fe('failed to parse "response" body as JSON',gt,t)}if(!we(t))throw fe('"response" body must be a top level object',vt,{body:t});return t}const Ht=Symbol(),Gt=Symbol(),Wt=new TextEncoder,Kt=new TextDecoder,Ft=new TextDecoder("utf-8",{fatal:!0});function Xt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t.reduce((e,t)=>e+t.length,0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}function jt(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(r>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}const Jt=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};const Vt=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(r.length>2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}("Key for the ".concat(e," algorithm must be "),t,...r)};
5class Yt extends Error{constructor(e,t){var n;super(e,t),S(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}S(Yt,"code","ERR_JOSE_GENERIC");class zt extends Yt{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),S(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(zt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class qt extends Yt{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),S(this,"code","ERR_JWT_EXPIRED"),S(this,"claim",void 0),S(this,"reason",void 0),S(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}S(qt,"code","ERR_JWT_EXPIRED");class Zt extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}S(Zt,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Qt extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JOSE_NOT_SUPPORTED")}}S(Qt,"code","ERR_JOSE_NOT_SUPPORTED"),S(class extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),S(class extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class $t extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWS_INVALID")}}S($t,"code","ERR_JWS_INVALID");class en extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWT_INVALID")}}S(en,"code","ERR_JWT_INVALID"),S(class extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class tn extends Yt{constructor(){super(...arguments),S(this,"code","ERR_JWKS_INVALID")}}S(tn,"code","ERR_JWKS_INVALID");class nn extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}S(nn,"code","ERR_JWKS_NO_MATCHING_KEY");class rn extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),S(this,Symbol.asyncIterator,O(function*(){})),S(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}S(rn,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class on extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWKS_TIMEOUT")}}S(on,"code","ERR_JWKS_TIMEOUT");class an extends Yt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),S(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}S(an,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const sn=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}};function cn(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}const un="The input to be decoded is not correctly encoded.";function ln(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:Kt.decode(e),{alphabet:"base64url"})}catch(e){throw new TypeError(un,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=Kt.decode(t)),t.includes("+")||t.includes("/"))throw new TypeError(un);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return cn(t)}catch(e){throw new TypeError(un)}}function dn(e){let t=e;return"string"==typeof t&&(t=Wt.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();const t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join(""))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function hn(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function pn(e){return hn(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(hn)}function fn(e,t,n){try{return ln(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}async function wn(e,t){var n,r,o,i;if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new Qt('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new Qt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');const a=null!==(n=null===(r=e.resolve)||void 0===r?void 0:r.call(e,{kty:t.kty,crv:t.crv}))&&void 0!==n?n:e.subtle,s=!(!t.d&&!t.priv),c=T({},t);return"AKP"!==c.kty&&delete c.alg,delete c.use,crypto.subtle.importKey("jwk",c,a,null!==(o=t.ext)&&void 0!==o?o:!s,null!==(i=t.key_ops)&&void 0!==i?i:e.usages[s?1:0])}function yn(e){return T({__proto__:null},e)}const mn=e=>e[Symbol.toStringTag];function gn(e,t,n){const r=e.alg,o=e.secret,i="decrypt"===n||"sign"===n;if(o&&t instanceof Uint8Array)return[vn,t];if(hn(t)){const a=function(e){const t=yn(e);if(void 0!==t.ext&&"boolean"!=typeof t.ext)throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(void 0!==t.key_ops){const e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>"string"!=typeof e)||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}(t);if("string"!=typeof a.kty)throw new TypeError(o?Vt(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Vt(r,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(o?"oct"===a.kty&&"string"==typeof a.k:"oct"!==a.kty&&(i?"AKP"===a.kty&&"string"==typeof a.priv||"string"==typeof a.d:void 0===a.d&&void 0===a.priv)))throw new TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':"JSON Web Key for this operation must be a ".concat(i?"private":"public"," JWK"));return((e,t,n)=>{const r=e.alg;if(void 0!==t.use){const e="sign"===n||"verify"===n?"sig":"enc";if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==r)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(r,'" when present'));if(Array.isArray(t.key_ops)){var o;const r="encrypt"===n||"decrypt"===n?null===(o=e.ops)||void 0===o?void 0:o["encrypt"===n?0:1]:n;if(r&&!t.key_ops.includes(r))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(r,'" when present'))}})(e,a,n),[Sn,t,a]}if(!(e=>sn(e)||(e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]))(e))(t))throw new TypeError(o?Vt(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):Vt(r,t,"CryptoKey","KeyObject","JSON Web Key"));if(o){if("secret"!==t.type)throw new TypeError("".concat(mn(t),' instances for symmetric algorithms must be of type "secret"'))}else{if("secret"===t.type)throw new TypeError("".concat(mn(t),' instances for asymmetric algorithms must not be of type "secret"'));const e=i?"private":"public";if(("public"===t.type||"private"===t.type)&&t.type!==e){const r="sign"===n?"signing":"verify"===n?"verifying":"".concat(n.slice(0,-1),"tion");throw new TypeError("".concat(mn(t)," instances for asymmetric algorithm ").concat(r,' must be of type "').concat(e,'"'))}}return sn(t)?[An,t]:[En,t]}const vn=0,An=1,En=2,Sn=3;let bn;const Tn={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};
5function _n(e,t,n){bn||(bn=new WeakMap);const r=bn.get(e);return n&&(r?r[t]=n:bn.set(e,{[t]:n})),null!=n?n:null==r?void 0:r[t]}const Rn=async(e,t,n)=>{var r;return null!==(r=_n(e,n.alg))&&void 0!==r?r:_n(e,n.alg,await wn(n,T(T({},t),{},{alg:n.alg})))};async function On(e,t,n){const r=gn(e,t,n);switch(r[0]){case vn:case An:return r[1];case Sn:{const t=r[1],n=r[2];if("oct"===n.kty)return ln(n.k);if(!Object.isFrozen(t)){const e=t.key_ops;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return Rn(t,n,e)}case En:{const t=r[1];return"secret"===t.type?t.export():"toCryptoKey"in t&&"function"==typeof t.toCryptoKey?((e,t)=>{var n,r,o;const i=_n(e,t.alg);if(i)return i;const a="public"===e.type,s=t.usages[a?0:1],c=e.asymmetricKeyType,u=Tn[null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve],l=null!==(r=null===(o=t.resolve)||void 0===o?void 0:o.call(t,{crv:u,asymmetricKeyType:c}))&&void 0!==r?r:t.subtle;return _n(e,t.alg,e.toCryptoKey(l,a,s))})(t,e):Rn(t,t.export({format:"jwk"}),e)}}}function Nn(e){const t={__proto__:null};for(const n in e)t[n]=T(T({},e[n]),{},{alg:n});return t}const Cn=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],In=[[],["deriveBits"]],kn=[[],[]];function Pn(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:"SHA-".concat(e)},usages:Cn,ops:["wrapKey","unwrapKey"]}}function Ln(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:e=>{let t=e.kty,n=e.crv,r=e.asymmetricKeyType;if("X25519"===n||"x25519"===r)return{name:"X25519"};if("OKP"===t)throw new Qt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:n}},usages:In,ops:[void 0,"deriveBits"]}}function Mn(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:kn,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function xn(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:kn,ops:["deriveBits","deriveBits"]}}const Dn=Nn({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:kn,ops:["encrypt","decrypt"]},"RSA-OAEP":Pn(1),"RSA-OAEP-256":Pn(256),"RSA-OAEP-384":Pn(384),"RSA-OAEP-512":Pn(512),"ECDH-ES":Ln(),"ECDH-ES+A128KW":Ln(),"ECDH-ES+A192KW":Ln(),"ECDH-ES+A256KW":Ln(),A128KW:Mn(128),A192KW:Mn(192),A256KW:Mn(256),A128GCMKW:Mn(128,!0),A192GCMKW:Mn(192,!0),A256GCMKW:Mn(256,!0),"PBES2-HS256+A128KW":xn(),"PBES2-HS384+A192KW":xn(),"PBES2-HS512+A256KW":xn()}),Un=["encrypt","decrypt"];function Bn(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:kn,ops:Un,cekBits:e,ivBits:t?128:96,cbc:t}}Nn({A128GCM:Bn(128),A192GCM:Bn(192),A256GCM:Bn(256),"A128CBC-HS256":Bn(256,!0),"A192CBC-HS384":Bn(384,!0),"A256CBC-HS512":Bn(512,!0)});const Hn={__proto__:null,b64:!0};function Gn(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}function Wn(e,t,n,r,o){if(void 0!==o.crit&&void 0===(null==r?void 0:r.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||void 0===r.crit)return[];if(!Array.isArray(r.crit)||0===r.crit.length||r.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');const i=void 0===n?t:T(T({__proto__:null},n),t);for(const t of r.crit){if(!(t in i))throw new Qt('Extension Header Parameter "'.concat(t,'" is not recognized'));if(!Object.hasOwn(o,t)||void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i[t]&&(!Object.hasOwn(r,t)||void 0===r[t]))throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return r.crit}function Kn(e,t){if(t.includes("b64")){const t=e.b64;if("boolean"!=typeof t)throw new $t('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return t}return!0}var Fn,Xn;let jn,Jn;if("undefined"==typeof navigator||null===(Fn=navigator.userAgent)||void 0===Fn||null===(Xn=Fn.startsWith)||void 0===Xn||!Xn.call(Fn,"Mozilla/5.0 ")){const e="v6.8.4";Jn="".concat("openid-client","/").concat(e),jn={"user-agent":Jn}}const Vn=e=>Yn.get(e);let Yn,zn;function qn(e){return void 0!==e?Ce(e):(zn||(zn=new WeakMap),(e,t,n,r)=>{let o;return(o=zn.get(t))||(function(e,t){if("string"!=typeof e)throw tr("".concat(t," must be a string"),er);if(0===e.length)throw tr("".concat(t," must not be empty"),$n)}(t.client_secret,'"metadata.client_secret"'),o=Ce(t.client_secret),zn.set(t,o)),o(e,t,n,r)})}const Zn=Ve,Qn=re,$n="ERR_INVALID_ARG_VALUE",er="ERR_INVALID_ARG_TYPE";function tr(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}
5class nr extends Error{constructor(e,t){var n;super(e,t),S(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function rr(e,t,n){return new nr(e,{cause:t,code:n})}function or(e){if(e instanceof TypeError||e instanceof nr||e instanceof xe||e instanceof De||e instanceof Ue)throw e;if(e instanceof pe)switch(e.code){case St:throw rr("only requests to HTTPS are allowed",e,e.code);case bt:throw rr("only requests to HTTP or HTTPS are allowed",e,e.code);case Et:throw rr("unexpected HTTP response status code",e.cause,e.code);case At:throw rr("unexpected response content-type",e.cause,e.code);case gt:throw rr("parsing error occured",e,e.code);case vt:throw rr("invalid response encountered",e,e.code);case _t:throw rr("unexpected JWT claim value encountered",e,e.code);case Rt:throw rr("unexpected JSON attribute value encountered",e,e.code);case Tt:throw rr("JWT timestamp claim value failed validation",e,e.code);default:throw rr(e.message,e,e.code)}if(e instanceof he)throw rr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw rr("runtime operation error",e,wt);case"NotSupportedError":throw rr("runtime unsupported operation",e,wt);case"TimeoutError":throw rr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw rr("operation aborted",e,"OAUTH_ABORT")}throw new nr("something went wrong",{cause:e})}async function ir(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw tr('"server" must be an instance of URL',er);const o=!e.href.includes("/.well-known/"),i=null!==(null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw $('"'.concat("issuerIdentifier",'" must be an instance of URL'),Q);Pe(e,!0!==(null==r?void 0:r[ee]));const o=n(new URL(e.href)),i=ye(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[re])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:me(o,null==r?void 0:r.signal)}
5)}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=ge("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=ge("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw $('"options.algorithm" must be "oidc" (default), or "oauth2"',Z)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[re]:null==t?void 0:t[Qn],[ee]:null==t||null===t.execute||void 0===r?void 0:r.includes(pr),signal:a,headers:new Headers(jn)}):((null==t?void 0:t[Qn])||fetch)((Pe(e,null==t||null===t.execute||void 0===c||!c.includes(pr)),e.href),{headers:Object.fromEntries(new Headers(T({accept:"application/json"},jn)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Ht)throw $('"expectedIssuerIdentifier" must be an instance of URL',Q);if(!q(t,Response))throw $('"response" must be an instance of Response',Q);if(200!==t.status)throw fe('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Et,t);It(t);const r=await Bt(t);if(Ae(r.issuer,'"response" body "issuer" property',vt,{body:r}),n!==Ht&&new URL(r.issuer).href!==n.href)throw fe('"response" body "issuer" property does not match the expected value',Rt,{expected:n.href,body:r,attribute:"issuer"});return r}(Ht,e)).catch(or);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[ar]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new nr("discovered metadata issuer does not match the expected issuer",{code:Rt,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new sr(i,t,n,r);let s=Vn(a);if(null!=o&&o[Qn]&&(s.fetch=o[Qn]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const ar=Symbol();class sr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw tr('"clientId" must be a non-empty string',er);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw tr('"clientId" and "metadata.client_id" must be the same',$n);const u=T(T({},structuredClone(n)),{},{client_id:t});let l;u[te]=null!==(i=null===(a=n)||void 0===a?void 0:a[te])&&void 0!==i?i:0,u[ne]=null!==(s=null===(c=n)||void 0===c?void 0:c[ne])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?qn(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);ar in e&&(h[Gt]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Yn||(Yn=new WeakMap),Yn.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Vn(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(Vn(this).c)}get timeout(){return Vn(this).timeout}set timeout(e){Vn(this).timeout=e}get[Qn](){return Vn(this).fetch}set[Qn](e){Vn(this).fetch=e}}function cr(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}
5return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return et(this)}catch(e){return}}}}}(e))}async function ur(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===e.headers.get("retry-after")||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&Math.ceil(n/1e3)}}if(o&&!Number.isFinite(a))throw new pe("invalid Retry-After header value",{cause:e});a>t&&await lr(a-t,n)}function lr(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function dr(e,t){vr(e);const n=Vn(e),r=n.as,o=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,r,o){Oe(e),Ne(t);const i=Me(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[ee])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=ye(null==o?void 0:o.headers);return s.set("accept","application/json"),qe(e,t,n,i,a,s,o)}(r,o,i,t,{[re]:a,[ee]:!s,headers:new Headers(jn),signal:Ar(c)}).then(e=>async function(e,t,n){if(Oe(e),Ne(t),!q(n,Response))throw $('"response" must be an instance of Response',Q);await je(n,200,"Backchannel Authentication Endpoint"),It(n);const r=await Bt(n);Ae(r.auth_req_id,'"response" body "auth_req_id" property',vt,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return ve(o,!0,'"response" body "expires_in" property',vt,{body:r}),r.expires_in=o,void 0!==r.interval&&ve(r.interval,!1,'"response" body "interval" property',vt,{body:r}),r}(r,o,e)).catch(or)}async function hr(e,t,n,r){var o,i;vr(e),new URLSearchParams(n);let a=null!==t.interval&&void 0!==o?o:5;const s=null!==(null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await lr(a,s)}catch(e){or(e)}const c=Vn(e),u=c.as,l=c.c,d=c.auth,h=c.fetch,p=c.tlsOnly,f=c.nonRepudiation,w=c.timeout,y=c.decrypt,m=(o,i)=>hr(e,T(T({},t),{},{interval:o}),n,T(T({},r),{},{signal:s,flag:i})),g=function(e,t){const n=Ar(t);if(!n)return{signal:e,cleanup(){}};const r=new AbortController,o=e=>{const t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener("abort",o,{once:!0}),n.addEventListener("abort",o,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener("abort",o),n.removeEventListener("abort",o)}}}(s,w),v=await async function(e,t,n,r,o){Oe(e),Ne(t),Ae(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Ze(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[re]:h,[ee]:!p,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:g.signal}).catch(or).finally(g.cleanup);var A;if(503===v.status&&v.headers.has("retry-after"))return await ur(v,a,s,!0),await(null===v.body||void 0===A?void 0:A.cancel()),m(a);const E=async function(e,t,n,r){return tt(e,t,n,void 0,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(u,l,v,{[ie]:y});let S;try{await E}catch(e){if(Sr(e,r))return m(a,br);if(e instanceof xe)switch(e.error){case"slow_down":0;case"authorization_pending":return await ur(e.response,a,s),m(a)}or(e)}return S.id_token&&await(null==f?void 0:f(v)),cr(S),S}function pr(e){Vn(e).tlsOnly=!1}async function fr(e,t,n,r,o){if(vr(e),!((null==o?void 0:o.flag)===br||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw tr('"currentUrl" must be an instance of URL, or Request',er);let i,a;const s=Vn(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,h=s.tlsOnly,p=s.jarm,f=s.hybrid,w=s.nonRepudiation,y=s.timeout,m=s.decrypt,g=s.implicit;if((null==o?void 0:o.flag)===br)o.authResponse,o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw $("form_post responses are expected to use the POST method",Z,{cause:e});if("application/x-www-form-urlencoded"!==Ye(e))throw $("form_post responses are expected to use the application/x-www-form-urlencoded content-type",Z,{cause:e});return async function(e){if(e.bodyUsed)throw $("form_post Request instances must contain a readable body",Z,{cause:e});return e.text()}(e)}(e));if(f)t.hash=n.toString();else for(const e of n.entries()){var v=R(e,2);const n=v[0],r=v[1];t.searchParams.append(n,r)}break;default:throw tr("unexpected Request HTTP method",$n)}}switch(function(e){return new URL(e).search="",e.hash="",e.href}(t),!0){case!!p:await p(t,null==n?void 0:n.expectedState);break;case!!f:await f(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!g:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{(function(e,t,n,r){if(Oe(e),Ne(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw $('"parameters" must be an instance of URLSearchParams, or URL',Q);if(xt(n,"response"))throw fe('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',vt,{parameters:n});
5const o=xt(n,"iss"),i=xt(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw fe('response parameter "iss" (issuer) missing',vt,{parameters:n});if(o&&o!==e.issuer)throw fe('unexpected "iss" (issuer) response parameter value',vt,{expected:e.issuer,parameters:n});switch(r){case void 0:case Ut:if(void 0!==i)throw fe('unexpected "state" response parameter encountered',vt,{expected:void 0,parameters:n});break;case Dt:break;default:if(Ae(r,'"expectedState" argument'),i!==r)throw fe(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',vt,{expected:r,parameters:n})}if(xt(n,"error"))throw new De("authorization response from the server is an error",{cause:n});const a=xt(n,"id_token"),s=xt(n,"token");if(void 0!==a||void 0!==s)throw new he("implicit and hybrid flows are not supported");return new URLSearchParams(n),st.add(c),c;var c})(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){or(e)}}}const A=await async function(e,t,n,r,o,i,a){if(Oe(e),Ne(t),!st.has(r))throw $('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',Z);Ae(o,'"redirectUri"');const s=xt(r,"code");if(!s)throw fe('no authorization code in "callbackParameters"',vt);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==ct&&(Ae(i,'"codeVerifier"'),c.set("code_verifier",i)),Ze(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||ct,{additionalParameters:r,[re]:d,[ee]:!h,DPoP:null==o?void 0:o.DPoP,headers:new Headers(jn),signal:Ar(y)}).catch(or);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const E=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];
5switch(r){case void 0:0;break;case dt:break;default:Ae(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case ht:break;default:ve(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await tt(e,t,n,s,i,a);Ae(c.id_token,'"response" body "id_token" property',vt,{body:c});const u=et(c);if(o!==ht){const e=Re()+Te(t),n=_e(t);if(u.auth_time+o<e-n)throw fe("too much time has elapsed since the last End-User authentication",Tt,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(r===dt){if(void 0!==u.nonce)throw fe('unexpected ID Token "nonce" claim value',_t,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==r)throw fe('unexpected ID Token "nonce" claim value',_t,{expected:r,claims:u,claim:"nonce"});return c}(e,t,n,r.expectedNonce,r.maxAge,r[ie],r.recognizedTokenTypes):async function(e,t,n,r,o){const i=await tt(e,t,n,void 0,r,o),a=et(i);if(a){if(void 0!==t.default_max_age){ve(t.default_max_age,!0,'"client.default_max_age"');const e=Re()+Te(t),n=_e(t);if(a.auth_time+t.default_max_age<e-n)throw fe("too much time has elapsed since the last End-User authentication",Tt,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw fe('unexpected ID Token "nonce" claim value',_t,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(c,u,A,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[ie]:m});let S;try{await E}catch(t){if(Sr(t,o))return fr(e,void 0,n,r,T(T({},o),{},{flag:br,authResponse:i,redirectUri:a}));or(t)}return S.id_token&&await(null==w?void 0:w(A)),cr(S),S}async function wr(e,t,n,r){vr(e),new URLSearchParams(n);const o=Vn(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.nonRepudiation,d=o.timeout,h=o.decrypt,p=await async function(e,t,n,r,o){Oe(e),Ne(t),Ae(r,'"refreshToken"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("refresh_token",r),Ze(e,t,n,"refresh_token",i,o)}(i,a,s,t,{[re]:c,[ee]:!u,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:Ar(d)}).catch(or),f=async function(e,t,n,r){return tt(e,t,n,void 0,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(i,a,p,{[ie]:h});let w;try{await f}catch(o){if(Sr(o,r))return wr(e,t,n,T(T({},r),{},{flag:br}));or(o)}return w.id_token&&await(null==l?void 0:l(p)),cr(w),w}async function yr(e,t,n){vr(e),new URLSearchParams(t);const r=Vn(e),o=r.as,i=r.c,a=r.auth,s=r.fetch,c=r.tlsOnly,u=r.timeout,l=await async function(e,t,n,r,o){return Oe(e),Ne(t),Ze(e,t,n,"client_credentials",new URLSearchParams(r),o)}(o,i,a,t,{[re]:s,[ee]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers(jn),signal:Ar(u)}).catch(or),d=async function(e,t,n){return tt(e,t,n,void 0,void 0,void 0)}(o,i,l);let h;try{await d}catch(r){if(Sr(r,n))return yr(e,t,T(T({},n),{},{flag:br}));or(r)}return cr(h),h}function mr(e,t){vr(e);const n=Vn(e),r=n.as,o=n.c,i=n.tlsOnly,a=n.hybrid,s=n.jarm,c=n.implicit,u=Me(r,"authorization_endpoint",!1,i);if(new URLSearchParams(t).has("client_id")||t.set("client_id",o.client_id),!t.has("request_uri")&&!t.has("request")){if(t.has("response_type")||t.set("response_type",a?"code id_token":c?"id_token":"code"),c&&!t.has("nonce"))throw tr("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",$n);s&&t.set("response_mode","jwt")}for(const e of t.entries()){var l=R(e,2);const t=l[0],n=l[1];u.searchParams.append(t,n)}return u}async function gr(e,t,n){vr(e);const r=mr(e,t),o=Vn(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.timeout,d=await async function(e,t,n,r,o){var i;Oe(e),Ne(t);const a=Me(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[ee])),s=new URLSearchParams(r);s.set("client_id",t.client_id);const c=ye(null==o?void 0:o.headers);c.set("accept","application/json"),void 0!==(null==o?void 0:o.DPoP)&&(Je(o.DPoP),await o.DPoP.addProof(a,c,"POST"));const u=await qe(e,t,n,a,s,c,o);return null==o||null===o.DPoP||void 0===i||i.cacheNonce(u,a),u}(i,a,s,r.searchParams,{[re]:c,[ee]:!u,DPoP:null==n?void 0:n.DPoP,headers:new Headers(jn),signal:Ar(l)}).catch(or),h=async function(e,t,n){if(Oe(e),Ne(t),!q(n,Response))throw $('"response" must be an instance of Response',Q);await je(n,201,"Pushed Authorization Request Endpoint"),It(n);const r=await Bt(n);Ae(r.request_uri,'"response" body "request_uri" property',vt,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return ve(o,!0,'"response" body "expires_in" property',vt,{body:r}),r.expires_in=o,r}(i,a,d);let p;try{await h}catch(r){if(Sr(r,n))return gr(e,t,T(T({},n),{},{flag:br}));or(r)}return mr(e,{request_uri:p.request_uri})}function vr(e){if(!(e instanceof sr))throw tr('"config" must be an instance of Configuration',er);if(Object.getPrototypeOf(e)!==sr.prototype)throw tr("subclassing Configuration is not allowed",$n)}function Ar(e){return e?AbortSignal.timeout(1e3*e):void 0}async function Er(e,t,n,r){vr(e);const o=Vn(e),i=o.as,a=o.c,s=o.fetch,c=o.tlsOnly,u=o.nonRepudiation,l=o.timeout,d=o.decrypt,h=await async function(e,t,n,r){Oe(e),Ne(t);const o=Me(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[ee])),i=ye(null==r?void 0:r.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),async function(e,t,n,r,o,i){var a;if(Ae(e,'"accessToken"'),!(n instanceof URL))throw $('"url" must be an instance of URL',Q);Pe(n,!0!==(null==i?void 0:i[ee])),ye(r),null!=i&&i.DPoP&&(Je(i.DPoP),await i.DPoP.addProof(n,r,"GET".toUpperCase(),e)),r.set("authorization","".concat(r.has("dpop")?"DPoP":"Bearer"," ").concat(e));const s=await((null==i?void 0:i[re])||fetch)(n.href,{duplex:q(null,ReadableStream)?"half":void 0,body:null,headers:Object.fromEntries(r.entries()),method:"GET",redirect:"manual",signal:me(n,null==i?void 0:i.signal)}
5);return null==i||null===i.DPoP||void 0===a||a.cacheNonce(s,n),s}(n,0,o,i,0,T(T({},r),{},{[te]:Te(t)}))}(i,a,t,{[re]:s,[ee]:!c,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:Ar(l)}).catch(or);let p,f=ze(i,a,n,h,{[ie]:d});try{await f}catch(o){if(Sr(o,r))return Er(e,t,n,T(T({},r),{},{flag:br}));or(o)}return"application/jwt"===Ye(h)&&await(null==u?void 0:u(h)),p}function Sr(e,t){return!(null==t||!t.DPoP||t.flag===br)&&function(e){if(e instanceof Ue){const t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof xe&&"use_dpop_nonce"===e.error}(e)}Object.freeze(sr.prototype);const br=Symbol();async function Tr(e,t,n,r){vr(e);const o=Vn(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.timeout,d=o.decrypt,h=o.nonRepudiation,p=await async function(e,t,n,r,o,i){return Oe(e),Ne(t),Ae(r,'"grantType"'),Ze(e,t,n,r,new URLSearchParams(o),i)}(i,a,s,t,new URLSearchParams(n),{[re]:c,[ee]:!u,DPoP:null==r?void 0:r.DPoP,headers:new Headers(jn),signal:Ar(l)}).catch(or);let f;"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(f={n_a:()=>{}});const w=async function(e,t,n,r){return tt(e,t,n,void 0,null==r?void 0:r[ie],null==r?void 0:r.recognizedTokenTypes)}(i,a,p,{[ie]:d,recognizedTokenTypes:f});let y;try{y=await w}catch(o){if(Sr(o,r))return Tr(e,t,n,T(T({},r),{},{flag:br}));or(o)}return y.id_token&&await(null==h?void 0:h(p)),cr(y),y}async function _r(e,t,n){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,e.subtle,!1,[n]):(function(e,t,n){var r;const o=e.algorithm;if(o.name!==t.name)throw Jt(t.name);if(t.hash&&(null===(r=o.hash)||void 0===r?void 0:r.name)!==t.hash)throw Jt(t.hash,"algorithm.hash");if(t.namedCurve&&o.namedCurve!==t.namedCurve)throw Jt(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&o.length!==t.length)throw Jt(t.length,"algorithm.length");!function(e,t){if(t&&!e.usages.includes(t))throw new TypeError("CryptoKey does not support this operation, its usages must include ".concat(t,"."))}(e,n)}(t,e.subtle,n),e.minRsaBits&&function(e,t){const n=t.algorithm.modulusLength;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}(e.alg,t),t)}const Rr=[["verify"],["sign"]];function Or(e){const t={name:"HMAC",hash:"SHA-".concat(e)};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:Rr}}function Nr(e,t){const n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e)};return{kty:["RSA"],subtle:n,signing:t?T(T({},n),{},{saltLength:t}):n,usages:Rr,minRsaBits:2048}}function Cr(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:"SHA-".concat(t)},usages:Rr}}function Ir(){const e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:Rr}}function kr(e){const t={name:"ML-DSA-".concat(e)};return{kty:["AKP"],subtle:t,signing:t,usages:Rr}}const Pr=Nn({HS256:Or(256),HS384:Or(384),HS512:Or(512),RS256:Nr(256),RS384:Nr(384),RS512:Nr(512),PS256:Nr(256,32),PS384:Nr(384,48),PS512:Nr(512,64),ES256:Cr("P-256",256),ES384:Cr("P-384",384),ES512:Cr("P-521",512),EdDSA:Ir(),Ed25519:Ir(),"ML-DSA-44":kr(44),"ML-DSA-65":kr(65),"ML-DSA-87":kr(87)});function Lr(e){const t="string"==typeof e?Pr[e]:void 0;if(!t)throw new Qt("alg ".concat(e," is not supported either by JOSE or your javascript runtime"));return t}async function Mr(e,t,n){if(e instanceof Uint8Array&&Kt.decode(e),"string"!=typeof e)throw new $t("Compact JWS must be a string or Uint8Array");const r=e.split("."),o=r[0],i=r[1],a=r[2];if(3!==r.length)throw new $t("Invalid Compact JWS");const s={payload:i,protected:o,signature:a},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0===e?{}:function(e,t,n){let r;try{JSON.parse(Ft.decode(ln(e)))}catch(e){throw new t(n)}if(!hn(r))throw new t(n);return r}(e,$t,"JWS Protected Header is invalid");return t}(o),u=function(e,t,n){const r=Kn(e,Wn($t,Hn,n[1],e,t)),o=t.alg;if("string"!=typeof o||!o)throw new $t('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(n[0]&&!n[0].has(o))throw new Zt('"alg" (Algorithm) Header Parameter value not allowed');return[r,o]}
5(c,c,t),l=R(u,2),d=l[0],h=l[1],p=d?i:function(e){try{return jt(e)}catch(e){throw new $t("JWS Compact Serialization payload must use only ASCII characters")}}(i);return async function(e,t,n,r,o,i,a){var s;let c=!1;"function"==typeof n&&(await n(o,e),!0);const u="string"==typeof a,l=Lr(i),d=Xt(void 0!==r?jt(r):new Uint8Array,jt("."),u?null!==t[2]&&void 0!==s?s:t[2]=function(e,t,n){try{return jt(e)}catch(e){throw new n("The ".concat("payload"," is not a valid base64url string"))}}(a,0,$t):a),h=fn(e.signature,"signature",$t),p=await On(l,n,"verify");if(!await async function(e,t,n,r){const o=await _r(e,t,"verify");try{return await crypto.subtle.verify(e.signing,o,n,r)}catch(e){return!1}}(l,p,h,d))throw new an;return[u?fn(a,"payload",$t):a,o,u,p,c]}(s,t,n,o,c,h,p)}const xr=e=>Math.floor(e.getTime()/1e3),Dr={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Ur=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Br="check_failed";function Hr(){throw new TypeError("Invalid time period format")}function Gr(e){"string"!=typeof e&&Hr();const t=Ur.exec(e);(!t||t[4]&&t[1])&&Hr();const n=parseFloat(t[2]),r=Math.round(n*Dr[t[3][0].toLowerCase()]);return Number.isFinite(r)||Hr(),"-"===t[1]||"ago"===t[4]?-r:r}function Wr(e,t){if(!Number.isFinite(t))throw new TypeError("Invalid ".concat(e," input"));return t}function Kr(e,t){if("string"!=typeof t)throw new TypeError('"'.concat(e,'" claim must be a string'))}function Fr(e,t){return"number"==typeof e?Wr(t,e):e instanceof Date?Wr(t,xr(e)):xr(new Date)+Gr(e)}const Xr=e=>{const t=e.toLowerCase();return e.includes("/")?t:"application/".concat(t)};function jr(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e[t];if(void 0!==r||n){if("number"!=typeof r)throw new zt('"'.concat(t,'" claim must be a number'),e,t,"invalid");return r}}function Jr(e,t){throw new zt('unexpected "'.concat(t,'" claim value'),e,t,Br)}function Vr(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(Ft.decode(t))}catch(e){}if(!hn(n))throw new en("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(void 0!==o&&("string"!=typeof e.typ||Xr(e.typ)!==Xr(o)))throw new zt('unexpected "typ" JWT header value',n,"typ",Br);const i=r.requiredClaims,a=void 0===i?[]:i,s=r.issuer,c=r.subject,u=r.audience,l=r.maxTokenAge,d=[...a];void 0!==l&&d.push("iat"),void 0!==u&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==s&&d.push("iss");for(const e of new Set(d.reverse()))if(!Object.hasOwn(n,e))throw new zt('missing required "'.concat(e,'" claim'),n,e,"missing");var h,p;void 0===s||(Array.isArray(s)?s:[s]).includes(n.iss)||Jr(n,"iss"),void 0!==c&&n.sub!==c&&Jr(n,"sub"),void 0===u||("string"==typeof n.aud?p.includes(h):Array.isArray(h)&&p.some(e=>h.includes(e)))||Jr(n,"aud");const f=r.clockTolerance;let w=0;if("string"==typeof f)Gr(f);else if(void 0!==f){if("number"!=typeof f)throw new TypeError("Invalid clockTolerance option type");0}Wr("clockTolerance option",w);const y=r.currentDate,m=Wr("currentDate option",xr(void 0===y?new Date:y)),g=jr(n,"iat",void 0!==l),v=jr(n,"nbf");if(void 0!==v&&v>m+w)throw new zt('"nbf" claim timestamp check failed',n,"nbf",Br);const A=jr(n,"exp");if(void 0!==A&&A<=m-w)throw new qt('"exp" claim timestamp check failed',n,"exp",Br);if(void 0!==l){const e=m-g;if(e-w>Wr("maxTokenAge option","number"==typeof l?l:Gr(l)))throw new qt('"iat" claim timestamp check failed (too far in the past)',n,"iat",Br);if(e<-w)throw new zt('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Br)}return n}let Yr;function zr(e){return Yr.get(e)}async function qr(e,t,n,r,o){const i=R(function(e){if(void 0===e)return[void 0,""];const t=function(e,t){let n,r;try{n=JSON.stringify(t),r=JSON.parse(n)}catch(t){throw new e("JOSE Header is not valid JSON",{cause:t})}if(!hn(r))throw new e("JOSE Header is not a JSON object");return[r,n]}($t,e);return[t[0],dn(t[1])]}(t),2),a=i[0],s=i[1];if(!a)throw new $t("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");(function(e,t,n){return function(e,t){const n=(null!=t?t:{}).crit;if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}($t,e),Kn(e,Wn($t,Hn,n,e,t))})(a,a,n)||o();const c=function(e){const t=e.alg;if("string"!=typeof t||!t)throw new $t('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Lr(t)}(a),u=dn(e),l=await async function(e,t,n,r){const o=Xt(jt(e),jt("."),t),i=await On(n,r,"sign");return dn(await async function(e,t,n){const r=await _r(e,t,"sign"),o=await crypto.subtle.sign(e.signing,r,n);return new Uint8Array(o)}(n,i,o))}(s,jt(u),c,r);return"".concat(s,".").concat(u,".").concat(l)}const Zr=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!hn(e))throw new TypeError("JWT Claims Set MUST be an object");(Yr||(Yr=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return Kr("iss",e),zr(this).iss=e,this}setSubject(e){return Kr("sub",e),zr(this).sub=e,this}setAudience(e){return function(e){if("string"!=typeof e&&(!Array.isArray(e)||Array.from(e).some(e=>"string"!=typeof e)))throw new TypeError('"aud" claim must be a string or an array of str
5ings')}(e),zr(this).aud=e,this}setJti(e){return Kr("jti",e),zr(this).jti=e,this}setNotBefore(e){return zr(this).nbf=Fr(e,"setNotBefore"),this}setExpirationTime(e){return zr(this).exp=Fr(e,"setExpirationTime"),this}setIssuedAt(e){return zr(this).iat=void 0===e?xr(new Date):"string"==typeof e?Wr("setIssuedAt",xr(new Date)+Gr(e)):Fr(e,"setIssuedAt"),this}};var Qr=new WeakMap;class $r extends Zr{constructor(){super(...arguments),v(this,Qr,void 0)}setProtectedHeader(e){return function(e){if(void 0!==e)throw new TypeError("".concat("setProtectedHeader"," can only be called once"))}(g(Qr,this)),A(Qr,this,e),this}async sign(e,t){return qr(function(e){const t=zr(e);for(const e of["iat","nbf","exp"]){const n=t[e];if("number"==typeof n&&!Number.isFinite(n))throw new TypeError('"'.concat(e,'" claim must be a finite number'))}return Wt.encode(JSON.stringify(t))}(this),g(Qr,this),null==t?void 0:t.crit,e,()=>{throw new en("JWTs MUST NOT use unencoded payload")})}}const eo='"alg" (Algorithm)';function to(){throw new Qt("Invalid or unsupported ".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:'JWK "alg" (Algorithm) Parameter'," value"))}const no=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0},ro=e=>{const t=e.data[e.pos++];if(void 0===t)throw new Error("Unexpected end of ASN.1 input");return t},oo=e=>{const t=ro(e);if(128&t){const n=127&t;let r=0;for(let t=0;t<n;t++)r=r<<8|ro(e);return r}return t},io=(e,t,n)=>{if(ro(e)!==t)throw new Error(n)},ao=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw new Error("Unexpected end of ASN.1 input");const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},so=e=>{const t=(e=>{io(e,6,"Expected algorithm OID");const t=oo(e);return ao(e,t)})(e);if(no(t,[43,101,110]))return"X25519";if(!no(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");io(e,6,"Expected curve OID");const n=oo(e),r=ao(e,n);if(no(r,[42,134,72,206,61,3,1,7]))return"P-256";if(no(r,[43,129,4,0,34]))return"P-384";if(no(r,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},co=(e,t,n)=>{const r=(e=>cn(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);return(async(e,t,n,r)=>{const o=function(e){if(void 0!==e&&"boolean"!=typeof e)throw new TypeError('"extractable" option must be a boolean');return e}(null==r?void 0:r.extractable),i=function(e,t){var n,r;return null!==(n="string"==typeof e?null!==(r=Pr[e])&&void 0!==r?r:Dn[e]:void 0)&&void 0!==n?n:to(t)}(n,eo);i.secret&&to(eo);const a="spki"===e;let s;if(i.resolve)try{const n={data:t,pos:0};!function(e,t){if(io(e,48,"Invalid ".concat("spki"===t?"SPKI":"PKCS#8"," structure")),oo(e),"pkcs8"===t){io(e,2,"Expected version field");const t=oo(e);e.pos+=t}io(e,48,"Expected algorithm identifier"),oo(e)}(n,e),s=i.resolve({crv:so(n)})}catch(e){throw new Qt("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(e,t,s,null!=o?o:a,i.usages[a?0:1])})("pkcs8",r,t,n)};async function uo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t),o=n.alg;if(void 0===r[o]){const e=await wn(n,T(T({},t),{},{alg:o,ext:!0}));if("public"!==e.type)throw new tn("JSON Web Key Set members must be public keys");r[o]=e}return r[o]}function lo(e){let t;try{structuredClone(e)}catch(e){}if(!pn(t))throw new tn("JSON Web Key Set malformed");const n=new WeakMap;return Object.defineProperty(async(e,r)=>{const o=T(T({},e),null==r?void 0:r.header),i=o.alg,a=o.kid,s="string"==typeof i?Pr[i]:void 0;if(!s||s.secret)throw new Qt('Unsupported "alg" value for a JSON Web Key Set');const c=t.keys.filter(e=>function(e,t,n,r){const o=yn(e),i=o.kty,a=o.key_ops,s=o.ext,c=o.kid,u=o.alg,l=o.use,d=o.crv,h=Array.isArray(a)?[...a]:a;return(void 0===s||"boolean"==typeof s)&&(void 0===h||Array.isArray(h)&&h.every((e,t)=>"string"==typeof e&&h.indexOf(e)===t)&&h.includes("verify"))&&t.kty.includes(i)&&(void 0===r||"string"==typeof r&&r===c)&&(void 0===u?"AKP"!==i:n===u)&&(void 0===l||"sig"===l)&&(!t.crv||d===t.crv)}(e,s,i,a)),u=c[0],l=c.length;if(!l)throw new nn;if(1!==l){const e=new rn;throw e[Symbol.asyncIterator]=O(function*(){for(const e of c)try{yield yield y(uo(n,e,s))}catch(e){}}),e}return uo(n,u,s)},"jwks",{value:()=>structuredClone(t)})}var ho,po;let fo;
5if("undefined"==typeof navigator||null===(ho=navigator.userAgent)||void 0===ho||null===(po=ho.startsWith)||void 0===po||!po.call(ho,"Mozilla/5.0 ")){const e="v6.2.10";fo="".concat("jose","/").concat(e)}const wo=Symbol(),yo=Symbol();function mo(e,t){return Number.isFinite(e)&&Date.now()<e+t}function go(e,t,n){if(Number.isNaN(e))throw new TypeError('"'.concat(n,'" option must not be NaN'));return"number"==typeof e?e:t}async function vo(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return co(e,t,n)}const Ao=["mfaToken"],Eo=["mfaToken"];var So,bo,To,_o,Ro,Oo,No,Co,Io,ko,Po,Lo,Mo,xo,Do,Uo,Bo,Ho,Go,Wo,Ko,Fo,Xo,jo,Jo,Vo,Yo,zo,qo,Zo,Qo,$o,ei,ti,ni,ri,oi,ii,ai,si,ci,ui,li,di,hi,pi,fi,wi,yi,mi,gi,vi;function Ai(e){if("object"!=typeof e||null===e)return{};const t=e;return{statusCode:"number"==typeof t.statusCode?t.statusCode:void 0,headers:t.headers instanceof Headers?t.headers:void 0,body:"string"==typeof t.body?t.body:void 0}}function Ei(e){var t,n;if("object"!=typeof e||null===e)return{error:"unknown_error",error_description:String(e)};const r=e;let o;if(r.response instanceof Response)try{o=new Headers(r.response.headers),o.delete("set-cookie")}catch(e){o=void 0}const i={error:null!==(t=r.error)&&void 0!==t?t:"",error_description:null!==(n=r.error_description)&&void 0!==n?n:"",message:r.message,statusCode:"number"==typeof r.status?r.status:void 0,headers:o};if("mfa_required"===r.error&&r.cause){i.mfa_token="string"==typeof r.cause.mfa_token?r.cause.mfa_token:void 0;const e=r.cause.mfa_requirements;"object"==typeof e&&null!==e&&(i.mfa_requirements=e)}return i}var Si=class extends Error{constructor(e,t){super(t),S(this,"code",void 0),this.name="NotSupportedError",this.code=e}},bi=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements};const r=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Ti=class extends bi{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},_i=class extends bi{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Ri=class extends bi{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Oi=class extends bi{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ni=class extends bi{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Ci=class extends bi{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Ii=class extends bi{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},ki=class extends bi{constructor(e,t){super("user_info_error",e,t),this.name="UserInfoError"}},Pi=class extends Error{constructor(e){super(e),S(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Li=class extends bi{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),S(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Mi=class extends bi{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},xi=class extends bi{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Di=class extends bi{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Ui=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),S(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}}
5,Bi=class extends Error{constructor(e){super(e),S(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}},Hi=class extends Error{constructor(e){super(e||"fullResponse: true requested but no HTTP Response was captured. This is a bug in CapturingFetch."),S(this,"code","missing_captured_response_error"),this.name="MissingCapturedResponseError"}};function Gi(e){try{const t=new Headers(e);return t.delete("set-cookie"),t}catch(e){return new Headers}}function Wi(e,t,n){var r;const o="object"==typeof t&&null!==t?t:void 0,i=null!==(r=null==o?void 0:o.response)&&void 0!==r?r:n,a="number"==typeof(null==o?void 0:o.status)?o.status:null==i?void 0:i.status;"number"==typeof a&&(e.statusCode=a),null!=i&&i.headers&&(e.headers=Gi(i.headers))}function Ki(e){return Object.entries(e).filter(e=>void 0!==R(e,2)[1]).reduce((e,t)=>T(T({},e),{},{[t[0]]:t[1]}),{})}function Fi(e){if(!e.trim())throw new Bi("organization must not be blank")}function Xi(e,t){if(!e)return;const n=t.trim();if(n.startsWith("org_")){const t=e.org_id;if("string"!=typeof t)throw new Bi("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new Bi('Organization Id (org_id) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}else{const t=e.org_name;if("string"!=typeof t)throw new Bi("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new Bi('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var ji=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Ji=class extends ji{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Vi=class extends ji{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Yi=class extends ji{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},zi=class extends ji{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},qi=class extends ji{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function Zi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Qi=class e{constructor(e,t,n,r,o,i,a){S(this,"accessToken",void 0),S(this,"idToken",void 0),S(this,"refreshToken",void 0),S(this,"expiresAt",void 0),S(this,"scope",void 0),S(this,"claims",void 0),S(this,"authorizationDetails",void 0),S(this,"tokenType",void 0),S(this,"issuedTokenType",void 0),S(this,"recoveryCode",void 0),S(this,"act",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}};function $i(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,T(T({},n),{},{headers:o}))}}function ea(e){var t,n;return!1===(null==e?void 0:e.enabled)?e:{enabled:!0,name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"@auth0/auth0-auth-js",version:null!==(n=null==e?void 0:e.version)&&void 0!==n?n:"1.15.0"}}function ta(e){let t;const n=async(n,r)=>{const o=await e(n,r);return t=o.clone(),o};return n.getCapturedResponse=()=>t,n}function na(e,t,n){if(!t)return e;const r=t.signal,o=t.headers,i=t.customFetch,a=i?$i(i,n):e;return r||o?async(e,t)=>{const n=o?new Headers(e instanceof Request?e.headers:void 0):void 0;
5if(n&&null!=t&&t.headers&&new Headers(t.headers).forEach((e,t)=>n.set(t,e)),o)for(const e of Object.entries(o)){var i=R(e,2);const t=i[0],r=i[1],o=t.toLowerCase();"authorization"!==o&&"auth0-client"!==o&&n.set(t,r)}const s=function(e,t){if(!e)return{signal:null!=t?t:void 0};if(!t)return{signal:e};if("undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.any)return{signal:AbortSignal.any([e,t])};const n=new AbortController,r=[e,t],o=r.find(e=>e.aborted);if(o)return n.abort(o.reason),{signal:n.signal};const i=[],a=()=>{r.forEach((e,t)=>{const n=i[t];n&&e.removeEventListener("abort",n)})};return r.forEach((e,t)=>{const r=()=>{a(),n.abort(e.reason)};i[t]=r,e.addEventListener("abort",r,{once:!0})}),{signal:n.signal,cleanup:a}}(r,null==t?void 0:t.signal);try{return await a(e,T(T(T({},t),n&&{headers:n}),{},{signal:s.signal}))}finally{var c;null===(c=s.cleanup)||void 0===c||c.call(s)}}:a}var ra={otp:"http://auth0.com/oauth/grant-type/mfa-otp",oob:"http://auth0.com/oauth/grant-type/mfa-oob","recovery-code":"http://auth0.com/oauth/grant-type/mfa-rec
5overy-code"},oa=(So=new WeakMap,bo=new WeakMap,To=new WeakMap,_o=new WeakMap,Ro=new WeakMap,Oo=new WeakMap,No=new WeakMap,Co=new WeakSet,class{constructor(e){var t,n;E(this,Co),v(this,So,void 0),v(this,bo,void 0),v(this,To,void 0),v(this,_o,void 0),v(this,Ro,void 0),v(this,Oo,void 0),v(this,No,void 0),A(So,this,"https://".concat(e.domain)),A(bo,this,e.clientId),A(To,this,e.clientSecret),A(_o,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Ro,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea()),A(Oo,this,e.getConfiguration),A(No,this,e.createCaptureConfiguration)}async listAuthenticators(e,t){const n="".concat(g(So,this),"/mfa/authenticators"),r=e.mfaToken,o=await w(Co,this,ia).call(this,t)(n,{method:"GET",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(!o.ok){const e=await o.clone().text(),t=o.status,n=Gi(o.headers);let i;try{i=JSON.parse(e)}catch(r){throw new Ji("Failed to list authenticators",{error:"unknown_error",error_description:"Failed to list authenticators",statusCode:t,headers:n,body:e})}throw new Ji(i.error_description||"Failed to list authenticators",T(T({},i),{},{statusCode:t,headers:n,body:e}))}return(await o.json()).map(Zi)}async enrollAuthenticator(e,t){const n="".concat(g(So,this),"/mfa/associate"),r=e.mfaToken,o=_(e,Ao),i={authenticator_types:o.authenticatorTypes};"oobChannels"in o&&(i.oob_channels=o.oobChannels),"phoneNumber"in o&&o.phoneNumber&&(i.phone_number=o.phoneNumber),"email"in o&&o.email&&(i.email=o.email);const a=await w(Co,this,ia).call(this,t)(n,{method:"POST",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Gi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new Vi("Failed to enroll authenticator",{error:"unknown_error",error_description:"Failed to enroll authenticator",statusCode:t,headers:n,body:e})}throw new Vi(o.error_description||"Failed to enroll authenticator",T(T({},o),{},{statusCode:t,headers:n,body:e}))}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await a.json())}async deleteAuthenticator(e,t){const n=e.authenticatorId,r=e.mfaToken,o="".concat(g(So,this),"/mfa/authenticators/").concat(encodeURIComponent(n)),i=await w(Co,this,ia).call(this,t)(o,{method:"DELETE",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(!i.ok){const e=await i.clone().text(),t=i.status,n=Gi(i.headers);let o;try{o=JSON.parse(e)}catch(r){throw new Yi("Failed to delete authenticator",{error:"unknown_error",error_description:"Failed to delete authenticator",statusCode:t,headers:n,body:e})}throw new Yi(o.error_description||"Failed to delete authenticator",T(T({},o),{},{statusCode:t,headers:n,body:e}))}}async challengeAuthenticator(e,t){const n="".concat(g(So,this),"/mfa/challenge"),r=e.mfaToken,o=_(e,Eo),i={mfa_token:r,client_id:g(bo,this),challenge_type:o.challengeType};g(To,this)&&(i.client_secret=g(To,this)),o.authenticatorId&&(i.authenticator_id=o.authenticatorId);const a=await w(Co,this,ia).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Gi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new zi("Failed to challenge authenticator",{error:"unknown_error",error_description:"Failed to challenge authenticator",statusCode:t,headers:n,body:e})}throw new zi(o.error_description||"Failed to challenge authenticator",T(T({},o),{},{statusCode:t,headers:n,body:e}))}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await a.json())}async verify(e,t){if(!g(Oo,this))throw new Error("MFA verify requires a configuration provider (getConfiguration was not set)");const n={mfa_token:e.mfaToken};if(e.audience&&(n.audience=e.audience),"otp"===e.factorType?n.otp=e.otp:"oob"===e.factorType?(n.oob_code=e.oobCode,e.bindingCode&&(n.binding_code=e.bindingCode)):"recovery-code"===e.factorType&&(n.recovery_code=e.recoveryCode),e.fullResponse){var r;if(!g(No,this))throw new Error("MFA verify fullResponse requires a capture-config factory (createCaptureConfiguration was not set)");const s=ta(null!==(r=(await g(Oo,this).call(this,t))[Qn])&&void 0!==r?r:fetch),c=await g(No,this).call(this,s);
5try{const t=await Tr(c,ra[e.factorType],n),r=Qi.fromTokenEndpointResponse(t);t.recovery_code&&(r.recoveryCode=t.recovery_code);const o=s.getCapturedResponse();if(!o)throw new Hi;return{data:r,response:o}}catch(e){var o,i,a;if(e instanceof Hi)throw e;if(e instanceof qi)throw e;const t=e,n=new qi(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(o=t.error)&&void 0!==o?o:"mfa_verify_error",error_description:null!==(i=null!==(a=t.error_description)&&void 0!==a?a:t.message)&&void 0!==i?i:"Failed to verify MFA challenge"});throw Wi(n,e,s.getCapturedResponse()),n}}const s=await g(Oo,this).call(this,t);try{const t=await Tr(s,ra[e.factorType],n),r=Qi.fromTokenEndpointResponse(t);return t.recovery_code&&(r.recoveryCode=t.recovery_code),r}catch(e){var c,u,l;if(e instanceof qi)throw e;const t=e,n=new qi(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(c=t.error)&&void 0!==c?c:"mfa_verify_error",error_description:null!==(u=null!==(l=t.error_description)&&void 0!==l?l:t.message)&&void 0!==u?u:"Failed to verify MFA challenge"});throw Wi(n,e),n}}});function ia(e){return na(g(_o,this),e,g(Ro,this))}var aa=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},sa=class extends aa{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},ca=class extends aa{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},ua=class extends aa{constructor(e,t){super("passkey_get_token_error",e,t),this.name="PasskeyGetTokenError",this.cause=t&&{error:t.error,error_description:t.error_description,message:t.message,mfa_token:t.mfa_token,mfa_requirements:t.mfa_requirements}}};function la(e){return e.useMtls?{}:e.clientSecret?{client_secret:e.clientSecret}:{}}var da="urn:okta:params:oauth:grant-type:webauthn",ha=(Io=new WeakMap,ko=new WeakMap,Po=new WeakMap,Lo=new WeakMap,Mo=new WeakMap,xo=new WeakMap,Do=new WeakSet,class{constructor(e){var t,n;E(this,Do),v(this,Io,void 0),v(this,ko,void 0),v(this,Po,void 0),v(this,Lo,void 0),v(this,Mo,void 0),v(this,xo,void 0),A(Io,this,"https://".concat(e.domain)),A(ko,this,e.clientId),A(Po,this,{clientSecret:e.clientSecret,useMtls:e.useMtls}),A(Lo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Mo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea()),A(xo,this,e.grantRequest)}async register(e,t){const n="".concat(g(Io,this),"/passkey/register"),r=T(T(T(T(T(T(T(T({},e.email&&{email:e.email}),e.name&&{name:e.name}),e.phoneNumber&&{phone_number:e.phoneNumber}),e.username&&{username:e.username}),e.givenName&&{given_name:e.givenName}),e.familyName&&{family_name:e.familyName}),e.nickname&&{nickname:e.nickname}),e.picture&&{picture:e.picture}),o=T(T({client_id:g(ko,this)},la(g(Po,this))),{},{user_profile:r});e.realm&&(o.realm=e.realm),e.organization&&(o.organization=e.organization),e.userMetadata&&(o.user_metadata=e.userMetadata);const i=await w(Do,this,pa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await w(Do,this,fa).call(this,i),t=new sa(e.error_description||"Failed to request signup challenge",e);throw t.statusCode=i.status,t.headers=Gi(i.headers),t}return{authSession:(a=await i.json()).auth_session,authnParamsPublicKey:T({},a.authn_params_public_key)};var a}async challenge(e,t){const n="".concat(g(Io,this),"/passkey/challenge"),r=T({client_id:g(ko,this)},la(g(Po,this)));null!=e&&e.realm&&(r.realm=e.realm),null!=e&&e.organization&&(r.organization=e.organization);const o=await w(Do,this,pa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){const e=await w(Do,this,fa).call(this,o),t=new ca(e.error_description||"Failed to request login challenge",e);throw t.statusCode=o.status,t.headers=Gi(o.headers),t}return{authSession:(i=await o.json()).auth_session,authnParamsPublicKey:T({},i.authn_params_public_key)};var i}async getTokenByPasskey(e,t){void 0!==e.organization&&Fi(e.organization);const n=new URLSearchParams({auth_session:e.authSession,authn_response:JSON.stringify(e.credential)});let r;e.realm&&n.append("realm",e.realm),e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
5nce),e.organization&&n.append("organization",e.organization);try{r=await g(xo,this).call(this,da,n,t,e.fullResponse)}catch(e){if(e instanceof Hi)throw e;const t=Ei(e),n=new ua(t.error_description||"Failed to exchange passkey credential for tokens.",t);throw Wi(n,e),n}if(e.fullResponse){const t=r;return e.organization&&Xi(t.data.claims,e.organization),t}const o=r;return e.organization&&Xi(o.claims,e.organization),o}});function pa(e){return na(g(Lo,this),e,g(Mo,this))}async function fa(e){const t=await e.clone().text();try{return T(T({},JSON.parse(t)),{},{statusCode:e.status,headers:e.headers,body:t})}catch(n){return{error:"unknown_error",error_description:"HTTP ".concat(e.status," ").concat(e.statusText),statusCode:e.status,headers:e.headers,body:t}}}var wa=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&(n.error||n.error_description)?{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}:void 0;const r=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},ya=class extends wa{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},ma=class extends wa{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},ga=class extends wa{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},va=class extends wa{constructor(e,t,n,r,o){super("passwordless_challenge_error",e,n),S(this,"statusCode",void 0),S(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=r,this.headers=null!=o?o:this.headers}};function Aa(e){return/^\+[1-9]\d{1,14}$/.test(e)}async function Ea(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var r;const o=null!==(r=e.clientAssertionSigningAlg)&&void 0!==r?r:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await vo(e.clientAssertionSigningKey,o);return{client_assertion:await new $r({}).setProtectedHeader({alg:o}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}if(e.clientSecret)return{client_secret:e.clientSecret};throw new Ui}var Sa=(Uo=new WeakMap,Bo=new WeakMap,Ho=new WeakMap,Go=new WeakMap,Wo=new WeakMap,Ko=new WeakMap,Fo=new WeakMap,Xo=new WeakSet,class{constructor(e){var t,n;E(this,Xo),v(this,Uo,void 0),v(this,Bo,void 0),v(this,Ho,void 0),v(this,Go,void 0),v(this,Wo,void 0),v(this,Ko,void 0),v(this,Fo,void 0),A(Bo,this,e.domain),A(Uo,this,"https://".concat(e.domain)),A(Ho,this,e.clientId),A(Go,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Wo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea()),A(Ko,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),A(Fo,this,e.grantRequest)}async sendEmail(e,t){const n=await w(Xo,this,Ta).call(this,function(e){var t;const n=null!==(t=e.send)&&void 0!==t?t:"code",r={email:e.email,connection:"email",send:n};return"link"===n&&e.authParams&&(r.authParams=e.authParams),r}(e),"Failed to send passwordless email",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async sendSms(e,t){if(!Aa(e.phoneNumber))throw new ya("Phone number must be in E.164 format (e.g. +14155550100).");const n=await w(Xo,this,Ta).call(this,function(e){return{phone_number:e.phoneNumber,connection:"sms"}}(e),"Failed to send passwordless SMS",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async challengeWithEmail(e,t){const n=function(e){var t;return{email:e.email,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t}}(e);return w(Xo,this,_a).call(this,n,"Failed to request email OTP challenge",t)}async challengeWithPhoneNumber(e,t){if(!Aa(e.phoneNumber))throw new va("Phone number must be in E.164 format (e.g. +14155550100).",0,void 0,void 0);const n=function(e){var t;const n={phone_number:e.phoneNumber,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t};return e.deliveryMethod&&(n.delivery_method=e.deliveryMethod),n}(e);return w(Xo,this,_a).call(this,n,"Failed to request phone OTP challenge",t)}async getTokenByPasswordlessDbConnection(e,t){const n=new URLSearchParams({auth_session:e.authSession,otp:e.otp});if(e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
5nce),!g(Fo,this))throw new ga("Missing grant request delegate.",Ei(new Error("missing grantRequest")));try{return await g(Fo,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",n,t,e.fullResponse)}catch(e){if(e instanceof Hi)throw e;const t=new ga("There was an error while trying to request a token.",Ei(e)),n=e;throw t.statusCode=n._statusCode,t.headers=n._headers,t}}});function ba(e){return na(g(Go,this),e,g(Wo,this))}async function Ta(e,t,n,r){var o;const i=await Ea(g(Ko,this),g(Ho,this),g(Bo,this)),a=T(T({client_id:g(Ho,this)},e),i);let s;try{s=await w(Xo,this,ba).call(this,r)("".concat(g(Uo,this),"/passwordless/start"),{method:"POST",headers:T({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(a)})}catch(e){throw new ya("".concat(t,": a network error occurred."))}if(s.ok)return s;const c=await s.clone().text();let u;if(204!==s.status)try{u=JSON.parse(c)}catch(e){u=void 0}const l=new ya((null===(o=u)||void 0===o?void 0:o.error_description)||t,u);throw l.statusCode=s.status,l.headers=Gi(s.headers),l.body=c,l}async function _a(e,t,n){var r,o;const i=await Ea(g(Ko,this),g(Ho,this),g(Bo,this)),a=T(T({client_id:g(Ho,this)},e),i);let s;try{s=await w(Xo,this,ba).call(this,n)("".concat(g(Uo,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){throw new va("challenge error: a network error occurred.",0,void 0,void 0)}if(s.ok){let n;try{n=await s.json()}catch(e){throw new va("".concat(t,": could not parse the response body."),s.status,void 0,void 0,Gi(s.headers))}return{authSession:n.auth_session}}const c=await s.clone().text();let u;try{u=JSON.parse(c)}catch(e){u=void 0}const l=u?T(T({},u),{},{statusCode:s.status,headers:s.headers,body:c}):{error:"",error_description:"",statusCode:s.status,headers:s.headers,body:c};throw new va((null===(r=u)||void 0===r?void 0:r.error_description)||t,s.status,l,null===(o=u)||void 0===o?void 0:o.validation_errors,Gi(s.headers))}var Ra=class extends Error{constructor(e,t,n){super(t),S(this,"cause",void 0),S(this,"code",void 0),S(this,"statusCode",void 0),S(this,"headers",void 0),S(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ai(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Oa=class extends Ra{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},Na=class extends Ra{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function Ca(e,t,n){for(const r of t)if(null===e[r]||void 0===e[r]||""===e[r])throw new n('Required parameter "'.concat(String(r),'" was null, undefined, or empty.'))}function Ia(e){var t,n;return{id:null!==(t=null!==(n=e._id)&&void 0!==n?n:e.user_id)&&void 0!==t?t:e.id,email:"string"==typeof e.email?e.email:"",emailVerified:Boolean(e.email_verified),username:e.username,givenName:e.given_name,familyName:e.family_name,name:e.name,nickname:e.nickname,picture:e.picture,userMetadata:e.user_metadata}}var ka=(jo=new WeakMap,Jo=new WeakMap,Vo=new WeakMap,Yo=new WeakMap,zo=new WeakSet,class{constructor(e){var t,n;E(this,zo),v(this,jo,void 0),v(this,Jo,void 0),v(this,Vo,void 0),v(this,Yo,void 0),A(jo,this,"https://".concat(e.domain)),A(Jo,this,e.clientId),A(Vo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),A(Yo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ea())}async signUp(e,t){var n;Ca(e,["email","password","connection"],Oa);const r=T({client_id:null!==(n=e.clientId)&&void 0!==n?n:g(Jo,this)},function(e){const t={email:e.email,password:e.password,connection:e.connection};return void 0!==e.username&&(t.username=e.username),void 0!==e.givenName&&(t.given_name=e.givenName),void 0!==e.familyName&&(t.family_name=e.familyName),void 0!==e.name&&(t.name=e.name),void 0!==e.nickname&&(t.nickname=e.nickname),void 0!==e.picture&&(t.picture=e.picture),void 0!==e.userMetadata&&(t.user_metadata=e.userMetadata),t}(e)),o=await w(zo,this,Pa).call(this,"/dbconnections/signup",r,Oa,"Failed to sign up",t);if(e.fullResponse){const e=o.clone();return{data:Ia(await o.json()),response:e}}return Ia(await o.json())}async changePassword(e,t){var n;if(Ca(e,["connection"],Na),!e.email&&!e.username)throw new Na('Either "email" or "username" is required.');const r=T({client_id:null!==(n=e.clientId)&&void 0!==n?n:g(Jo,this)},function(e){const t={connection:e.connection};return void 0!==e.email&&(t.email=e.email),void 0!==e.username&&(t.username=e.username),void 0!==e.organization&&(t.organization=e.organization),t}(e)),o=await w(zo,this,Pa).call(this,"/dbconnections/change_password",r,Na,"Failed to request a password change",t);if(e.fullResponse){const e=o.clone();return{data:await o.text(),response:e}}return o.text()}});async function Pa(e,t,n,r,o){const i=na(g(Vo,this),o,g(Yo,this));let a;try{a=await i("".concat(g(jo,this)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){throw new n("".concat(r,": a network error occurred."))}if(a.ok)return a;const s=await a.clone().text(),c=await async function(e){let t;try{t=await e.json()}catch(e){return}return"string"==typeof t.error?t:"string"==typeof t.code?{error:t.code,error_description:"string"==typeof t.description?t.description:""}:void 0}(a.clone()),u=new n((null==c?void 0:c.error_description)||r,null!=c?c:{error:"unknown_error",error_description:r});throw u.statusCode=a.status,u.headers=Gi(a.headers),u.body=s,u}
5var La=class extends Error{constructor(e,t,n){super(t),S(this,"code",void 0),S(this,"cause",void 0),this.name="AnonymousSessionError",this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Ma=new Set(["session_expired","invalid_session_token"]);async function xa(e){const t="Request failed with status ".concat(e.status);let n={};try{n=await e.json()}catch(e){}return{error:"string"==typeof n.error?n.error:"server_error",error_description:"string"==typeof n.error_description?n.error_description:t}}var Da=(qo=new WeakMap,Zo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakSet,class{constructor(e){var t;E(this,oi),v(this,qo,void 0),v(this,Zo,void 0),v(this,Qo,void 0),v(this,$o,void 0),v(this,ei,void 0),v(this,ti,void 0),v(this,ni,void 0),v(this,ri,void 0),A(qo,this,e.domain),A(Zo,this,"https://".concat(e.domain)),A(Qo,this,e.clientId),A($o,this,e.clientSecret),A(ei,this,e.clientAssertionSigningKey),A(ti,this,e.clientAssertionSigningAlg),A(ni,this,e.useMtls),A(ri,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async createSession(e){const t={client_id:g(Qo,this)};null!=e&&e.audience&&(t.audience=e.audience),null!=e&&e.scope&&(t.scope=e.scope),null!=e&&e.metadata&&(t.metadata=e.metadata);const n=await w(oi,this,Ba).call(this,t);if(!n.sessionToken)throw new La("server_error","session_token missing from create session response");return{sessionToken:n.sessionToken,accessToken:n.accessToken,expiresAt:n.expiresAt,sessionTokenExpiresAt:n.sessionTokenExpiresAt,scope:n.scope}}async getAccessToken(e){if(null==e||!e.sessionToken)return this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope});try{return await w(oi,this,Ua).call(this,e.sessionToken,e)}catch(t){if(t instanceof La&&Ma.has(t.code))return T(T({},await this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope})),{},{sessionReplaced:!0});throw t}}async logout(){const e="".concat(g(Zo,this),"/anonymous/logout"),t={client_id:g(Qo,this)},n=await g(ri,this).call(this,e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(t)});if(!n.ok){const e=await xa(n);throw new La(e.error,e.error_description||"Failed to end anonymous session",e)}}});async function Ua(e,t){const n={client_id:g(Qo,this),session_token:e};null!=t&&t.audience&&(n.audience=t.audience),null!=t&&t.scope&&(n.scope=t.scope);const r=await w(oi,this,Ba).call(this,n);return{sessionToken:e,accessToken:r.accessToken,expiresAt:r.expiresAt,sessionTokenExpiresAt:r.sessionTokenExpiresAt,scope:r.scope,sessionReplaced:!1}}async function Ba(e){const t="".concat(g(Zo,this),"/anonymous/token"),n=await async function(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var r;const o=null!==(r=e.clientAssertionSigningAlg)&&void 0!==r?r:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await vo(e.clientAssertionSigningKey,o);return{client_assertion:await new $r({}).setProtectedHeader({alg:o}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}return e.clientSecret?{client_secret:e.clientSecret}:{}}({clientSecret:g($o,this),clientAssertionSigningKey:g(ei,this),clientAssertionSigningAlg:g(ti,this),useMtls:g(ni,this)},g(Qo,this),g(qo,this));Object.assign(e,n);const r=await g(ri,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(e)});if(!r.ok){const e=await xa(r);throw new La(e.error,e.error_description||"Anonymous token request failed",e)}let o;try{o=await r.json()}catch(e){throw new La("server_error","Invalid response from anonymous token endpoint")}return function(e){const t=Math.floor(Date.now()/1e3);if("string"!=typeof e.access_token||!e.access_token)throw new La("server_error","access_token missing or invalid in anonymous token response");const n=e.expires_in;if("number"!=typeof n||!Number.isFinite(n))throw new La("server_error","expires_in missing or invalid in anonymous token response");return{accessToken:e.access_token,expiresAt:t+n,scope:e.scope,sessionToken:e.session_token,sessionTokenExpiresAt:"number"==typeof e.session_expires_in&&Number.isFinite(e.session_expires_in)?t+e.session_expires_in:void 0}}(o)}var Ha=(ii=new WeakMap,ai=new WeakMap,si=new WeakMap,class{constructor(e,t){v(this,ii,new Map),v(this,ai,void 0),v(this,si,void 0),A(si,this,Math.max(1,Math.floor(e))),A(ai,this,Math.max(0,Math.floor(t)))}get(e){const t=g(ii,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return g(ii,this).delete(e),g(ii,this).set(e,t),t.value;g(ii,this).delete(e)}}set(e,t,n){g(ii,this).has(e)&&g(ii,this).delete(e);const r=null!=n&&Number.isFinite(n)&&n>0?n:g(ai,this);for(g(ii,this).set(e,{value:t,expiresAt:Date.now()+r});g(ii,this).size>g(si,this);){const e=g(ii,this).keys().next().value;if(void 0===e)break;g(ii,this).delete(e)}}}),Ga=new Map;function Wa(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var Ka=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Ga.get(i));var i;return o||(o=new Ha(e.maxEntries,e.ttlMs),Ga.set(t,o)),o}static createJwksCache(){return{}}},Fa="openid profile email offline_access",Xa=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function ja(e){if(null==e)throw new Ci("subject_token is required");if("string"!=typeof e)throw new Ci("subject_token must be a string");if(0===e.trim().length)throw new Ci("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Ci("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Ci("subject_token must not include the 'Bearer ' prefix")}function Ja(e,t){if(t)for(const r of Object.entries(t)){var n=R(r,2);const t=n[0],o=n[1];if(!Xa.has(t))if(Array.isArray(o)){if(o.length>20)throw new Ci("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}
5else e.append(t,o)}}var Va="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",Ya="urn:ietf:params:oauth:grant-type:token-exchange",za="urn:ietf:params:oauth:token-type:access_token";function qa(e,t){return(n,r)=>{const o=null==r?void 0:r.body;if(t!==da||!(o instanceof URLSearchParams))return e(n,r);const i={};for(const e of o){var a=R(e,2);const t=a[0],n=a[1];i[t]="authn_response"===t?JSON.parse(n):n}const s=new Headers(null==r?void 0:r.headers);return s.set("Content-Type","application/json"),e(n,T(T({},r),{},{headers:s,body:JSON.stringify(i)}))}}ci=new WeakMap,ui=new WeakMap,li=new WeakMap,di=new WeakMap,hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,wi=new WeakMap,yi=new WeakMap,mi=new WeakMap,gi=new WeakMap,vi=new WeakSet;function Za(){const e=g(hi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(g(hi,this).useMtls?"1":"0")}async function Qa(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=await w(vi,this,ss).call(this,n),o=new sr(e,g(hi,this).clientId,{client_secret:g(hi,this).clientSecret,use_mtls_endpoint_aliases:g(hi,this).useMtls},r);return o[Qn]=null!=t?t:g(pi,this),o}function $a(e){return na(g(pi,this),e,g(fi,this))}async function es(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=await w(vi,this,ts).call(this,t),r=n.configuration,o=n.serverMetadata;if(!e)return{configuration:r,serverMetadata:o};const i=w(vi,this,$a).call(this,e);return{configuration:await w(vi,this,Qa).call(this,o,i,t),serverMetadata:o}}async function ts(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=g(e?ui:ci,this);if(t&&g(li,this))return{configuration:t,serverMetadata:g(li,this)};const n=w(vi,this,Za).call(this);e||await w(vi,this,ss).call(this,!1);const r=g(yi,this).get(n);if(r)return w(vi,this,ns).call(this,r.serverMetadata,e);const o=g(mi,this).get(n);if(o){const t=await o;return w(vi,this,ns).call(this,t.serverMetadata,e)}const i=(async()=>{const e=(await ir(new URL("https://".concat(g(hi,this).domain)),g(hi,this).clientId,{use_mtls_endpoint_aliases:g(hi,this).useMtls},(e,t,n,r)=>{n.set("client_id",t.client_id)},{[Qn]:g(pi,this)})).serverMetadata();return g(yi,this).set(n,{serverMetadata:e}),{serverMetadata:e}})();i.catch(()=>{}),g(mi,this).set(n,i);try{const t=(await i).serverMetadata;return w(vi,this,ns).call(this,t,e)}finally{g(mi,this).delete(n)}}async function ns(e,t){const n=await w(vi,this,Qa).call(this,e,void 0,t);return A(li,this,e),A(t?ui:ci,this,n),{configuration:n,serverMetadata:e}}async function rs(e,t,n){var r,o,i;const a=(await w(vi,this,es).call(this,t)).configuration;if("audience"in e||"resource"in e)throw new Ci("audience and resource parameters are not supported for Token Vault exchanges");ja(e.subjectToken);const s=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==r?r:za,requested_token_type:null!==e.requestedTokenType&&void 0!==o?o:"http://auth0.com/oauth/token-type/federated-connection-access-token"});if(e.loginHint&&s.append("login_hint",e.loginHint),e.scope&&s.append("scope",e.scope),Ja(s,e.extra),n){var c;const t=ta(null!==a[Qn]&&void 0!==c?c:g(pi,this)),r=await w(vi,this,Qa).call(this,a.serverMetadata(),t);try{const e=await Tr(r,Va,s),n=Qi.fromTokenEndpointResponse(e),o=t.getCapturedResponse();if(!o)throw new Hi;return{data:n,response:o}}catch(n){if(n instanceof Hi)throw n;const r=new Ci("Failed to exchange token for connection '".concat(e.connection,"'."),Ei(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Gi(o.headers):void 0,r}}const u=ta(null!==a[Qn]&&void 0!==i?i:g(pi,this)),l=await w(vi,this,Qa).call(this,a.serverMetadata(),u);try{const e=await Tr(l,Va,s);return Qi.fromTokenEndpointResponse(e)}catch(t){const n=new Ci("Failed to exchange token for connection '".concat(e.connection,"'."),Ei(t)),r=u.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Gi(r.headers):void 0,n}}function os(e,t,n){var r;if(n.organization&&Xi(e.claims,n.organization),n.actorToken)if(null!==e.claims&&void 0!==r&&r.act)e.act=e.claims.act;else try{e.act=function(e){if("string"!=typeof e)throw new en("JWTs must use Compact JWS serialization, JWT must be a string");const t=e.split("."),n=t[1],r=t.length;if(5===r)throw new en("Only JWTs using Compact JWS serialization can be decoded");
5if(3!==r)throw new en("Invalid JWT");if(!n)throw new en("JWTs must contain a payload");let o,i;try{ln(n)}catch(e){throw new en("Failed to base64url decode the payload")}try{JSON.parse(Ft.decode(o))}catch(e){throw new en("Failed to parse the decoded payload as JSON")}if(!hn(i))throw new en("Invalid JWT Claims Set");return i}(t.access_token).act}catch(e){}return e}async function is(e,t,n){var r;const o=(await w(vi,this,es).call(this,t)).configuration;if(ja(e.subjectToken),void 0!==e.organization&&Fi(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new Ci("actorTokenType is required when actorToken is provided");const i=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});if(e.audience&&i.append("audience",e.audience),e.scope&&i.append("scope",e.scope),e.requestedTokenType&&i.append("requested_token_type",e.requestedTokenType),e.organization&&i.append("organization",e.organization),e.actorToken&&i.append("actor_token",e.actorToken),e.actorTokenType&&i.append("actor_token_type",e.actorTokenType),Ja(i,e.extra),n){var a;const t=ta(null!==o[Qn]&&void 0!==a?a:g(pi,this)),r=await w(vi,this,Qa).call(this,o.serverMetadata(),t);let s,c,u;try{if(await Tr(r,Ya,i),Qi.fromTokenEndpointResponse(c),t.getCapturedResponse(),!u)throw new Hi}catch(n){if(n instanceof Hi)throw n;const r=new Ci("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ei(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Gi(o.headers):void 0,r}return w(vi,this,os).call(this,s,c,e),{data:s,response:u}}const s=ta(null!==o[Qn]&&void 0!==r?r:g(pi,this)),c=await w(vi,this,Qa).call(this,o.serverMetadata(),s);let u,l;try{await Tr(c,Ya,i),Qi.fromTokenEndpointResponse(l)}catch(t){const n=new Ci("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ei(t)),r=s.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Gi(r.headers):void 0,n}return w(vi,this,os).call(this,u,l,e),u}async function as(e,t,n){var r;const o=(await w(vi,this,es).call(this,t)).configuration;if(n){var i;const t=ta(null!==o[Qn]&&void 0!==i?i:g(pi,this)),n=await w(vi,this,Qa).call(this,o.serverMetadata(),t);try{const r=await Tr(n,"http://auth0.com/oauth/grant-type/passwordless/otp",e),o=Qi.fromTokenEndpointResponse(r),i=t.getCapturedResponse();if(!i)throw new Hi;return{data:o,response:i}}catch(e){if(e instanceof Hi)throw e;const n=new ma("There was an error while trying to request a token.",Ei(e)),r=t.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Gi(r.headers):void 0,n}}const a=ta(null!==o[Qn]&&void 0!==r?r:g(pi,this)),s=await w(vi,this,Qa).call(this,o.serverMetadata(),a);try{const t=await Tr(s,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return Qi.fromTokenEndpointResponse(t)}catch(e){const t=new ma("There was an error while trying to request a token.",Ei(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Gi(n.headers):void 0,t}}async function ss(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!!g(hi,this).clientSecret||!!g(hi,this).clientAssertionSigningKey||!!g(hi,this).useMtls;return e&&!t?(e,t,n,r)=>{n.set("client_id",t.client_id)}:(g(di,this)||A(di,this,(async()=>{if(!g(hi,this).clientSecret&&!g(hi,this).clientAssertionSigningKey&&!g(hi,this).useMtls)throw new Ui;if(g(hi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=g(hi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||await vo(e,g(hi,this).clientAssertionSigningAlg||"RS256"),e?function(e){return Ie(e,void 0)}(e):qn(g(hi,this).clientSecret)})().catch(e=>{throw A(di,this,void 0),e})),g(di,this))}async function cs(e){const t=(await w(vi,this,ts).call(this)).configuration,n=Se(),r=await function(e){return async function(e){return Ae(e,"codeVerifier"),de(await crypto.subtle.digest("SHA-256",ce(e)))}(e)}(n),o=Ki(T(T({},g(hi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(T(T({scope:Fa},o),{},{client_id:g(hi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await gr(t,i):await mr(t,i),codeVerifier:n}}new Ha(1e3,6e4);Error;new WeakMap,new WeakMap;var us=n(3612);const ls={log:function(){if(us.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];
5(e=console).log.apply(e,["MNGDigisubs:"].concat(n))}},error:function(){if(us.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,["MNGDigisubs:"].concat(n))}}};var ds=function(){function e(){r(this,e),c(this,"readyPromise",null),c(this,"readyResolved",!1),c(this,"readyValue",!1)}return s(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return ls.log("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return ls.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return ls.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(ls.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return ls.log("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var a=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){ls.log("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),ls.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(a,500)};a()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(ls.log("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();c(ds,"DEFAULT_TIMEOUT",3e3);new ds;var hs,ps;function fs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ws(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fs(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}window.addEventListener("mng-all-islands-ready",function(e){hs||(hs=e,ps&&(ls.log("utils | Dispatching mng-auth-complete event (islands were not ready): ",ps),window.dispatchEvent(ps)))}),ls.log("Waiting for islands ready");var ys=function(){var e=window.location.href;return new URL(e)},ms=function(e){for(var t="".concat(e,"="),n=decodeURIComponent(document.cookie).split(";"),r=0;r<n.length;r+=1){var o=n[r].trimLeft();if(0===o.indexOf(t))return o.substring(t.length,o.length)}return!1},gs=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(ls.log("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=d(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},vs=function(){return ys().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},As=function(){return"complete"===document.readyState},Es=function(){return new Promise(function(e){if(("interactive"===document.readyState||As())&&window.dataLayer)ls.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{ls.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var n=setInterval(t(u.mark(function t(){return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(n),e(!0));case 1:case"end":return t.stop()}},t)})),50)}})},Ss=function(){var e,t=new Promise(function(t){e=setTimeout(function(){ls.log("Utils engageLibraryReady: engageLibrary failed to load within 10 seconds."),t(!1)},1e4)}),n=new Promise(function(t){var n=function(){clearTimeout(e),t(!0)};window.engageLibrary?n():window.addEventListener("engageLibraryReady",n,{once:!0})});return Promise.race([n,t])},bs=function(){var e=t(u.mark(function e(t){var n,r,o;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Es();case 1:return ls.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",ls.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return ls.log("Utils dataLayerLoop:  look for this element ",e),e[t]?(ls.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(ls.log("Utils dataLayerLoop: dataLayer search ",!1),!1)},o=window.dataLayer.some(r),e.abrupt("return",o?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Ts=function(){var e=t(u.mark(function e(){var t,n,r=arguments;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,bs(t);case 1:return n=e.sent,ls.log("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),_s=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(ls.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(ls.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};ls.log("utils | Event: authentication ready: ",r),e(r)}catch(e){ls.log(e),t(e)}},!1))})},Rs=function(){var e=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return us.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(ls.log("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,ls.log("Received entitlementsReady event:",r),e(r)}catch(e){ls.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(ls.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Os=function(e){ls.log("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMM
5BANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SO
5CIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return ls.log("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=Os;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Ns=function(e){ps=new CustomEvent("mng-auth-check-complete",{detail:e}),hs?(ls.log("utils | Dispatching mng-auth-complete event (islands were ready): ",e),window.dispatchEvent(ps)):ls.log("Islands not ready")};window.addEventListener("authenticationReady",function(e){return Ns(e.detail)});var Cs=function(){var e=t(u.mark(function e(){var t,n,r=arguments;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Content ID",e.next=1,bs(t);case 1:return n=e.sent,ls.log("utils | contentId: Content ID is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Is=function(){var e=t(u.mark(function e(){var t,n,r=arguments;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Section",e.next=1,bs(t);case 1:return n=e.sent,ls.log("utils | section: Section is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ks=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(n,r){var o={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},i=function(){var i=t(u.mark(function t(){var i,a,s,c,l,d,h,p,f,w,y;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"1"!==(null===(i=window.sophi_config)||void 0===i?void 0:i.enableSophiSSPW)){t.next=1;break}if(!document.getElementById("server-paywall")){t.next=1;break}return o.sspw=!0,t.abrupt("return",n({paywall:!0,details:ws({},o)}));case 1:return t.next=2,Ts();case 2:return s=t.sent,t.next=3,bs("Paywall_Level");case 3:if(c=t.sent,"article"===s&&"free"!==c){t.next=4;break}return t.abrupt("return",n({paywall:!1,details:"article"!==s?"Page type is not an article":"Free article"}));case 4:return t.next=5,Rs();case 5:if(!(l=t.sent)||!l.isEntitled){t.next=6;break}return t.abrupt("return",n({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==c){t.next=7;break}return t.abrupt("return",n({paywall:!0,details:"Premium article"}));case 7:if(d=null===(a=window.ConnextUtils)||void 0===a?void 0:a.runningSophi,ls.log("checkPaywallStatus - Sophi is running: ",d),!d){t.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(o.sophiClient=!0,o.engageStatus=!0,o.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(o.sophiClient=!0),n({paywall:!0,details:ws({},o)})},{once:!0}),t.next=12;break;case 8:if(d){t.next=12;break}return h=window.ConnextUtils.connextReady("onPaywallShown"),p=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),t.prev=9,t.next=10,Promise.race([h,p]);case 10:!0===(f=t.sent)?(o.engagePaywall=!0,o.engageStatus="Engage paywall detected"):(o.engagePaywall=!1,o.engageStatus="Engage response: ".concat(f)),t.next=12;break;case 11:t.prev=11,w=t.catch(9),o.engagePaywall=!1,o.engageStatus="Engage response: ".concat(w);case 12:return t.abrupt("return",n({paywall:Object.values(o).some(function(e){return e}),details:ws({},o)}));case 13:t.prev=13,y=t.catch(0),r(y);case 14:case"end":return t.stop()}},t,null,[[0,13],[9,11]])}));return function(){return i.apply(this,arguments)}}();i()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=ks);var Ps=function(){function e(){r(this,e),c(this,"pendingSets",new Map),c(this,"flushTimer",null),c(this,"hasFlushed",!1),c(this,"isPaused",!1)}return s(e,[{key:"pauseTargeting",value:function(t){if(!this.isPaused&&!this.hasFlushed)if(e.isAvailable())try{window.admiral("targeting","pause",t),this.isPaused=!0,ls.log("AdmiralUtils | pauseTargeting | paused (".concat(t,"ms auto-resume)."))}catch(e){ls.error("AdmiralUtils | pauseTargeting | failed",e)}else ls.log("AdmiralUtils | pauseTargeting | window.admiral is not available, skipping pause.")}},{key:"queueSet",value:function(e,t){if(this.hasFlushed)ls.log('AdmiralUtils | queueSet | already ready — skipping late set for "'.concat(e,'".'));else{var n=null==t?"":String(t);this.pendingSets.set(e,n)}}},{key:"flush",value:function(){if(!this.hasFlushed){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!e.isAvailable())return ls.log("AdmiralUtils | flush | window.admiral is not available, skipping flush."),void this.pendingSets.clear();
5try{this.pendingSets.forEach(function(e,t){window.admiral("targeting","set",t,e),ls.log('AdmiralUtils | flush | set "'.concat(t,'" = "').concat(e,'"'))}),window.admiral("targeting","ready"),this.hasFlushed=!0,this.isPaused=!1,this.pendingSets.clear(),ls.log("AdmiralUtils | flush | targeting ready.")}catch(e){ls.error("AdmiralUtils | flush | failed",e)}}}},{key:"scheduleReady",value:function(){var t=this;if(!this.hasFlushed)if(this.flushTimer)ls.log("AdmiralUtils | scheduleReady | deadline already set — ignoring repeated call.");else{var n=e.DEFAULT_READY_DELAY_MS;this.flushTimer=setTimeout(function(){t.flushTimer=null,t.flush()},n),ls.log("AdmiralUtils | scheduleReady | targeting ready scheduled in ".concat(n,"ms."))}}}],[{key:"isAvailable",value:function(){return"function"==typeof window.admiral}},{key:"getInstance",value:function(){return window.admiralUtils||(window.admiralUtils=new e),window.admiralUtils}}])}();c(Ps,"DEFAULT_READY_DELAY_MS",2e3);const Ls=Ps;var Ms=function(){return s(function e(){var t,n,o,i,a,s;r(this,e),c(this,"simpleHostname",void 0),c(this,"sophiHostname",void 0),c(this,"sophiCallStartTime",void 0),c(this,"section",void 0),c(this,"contentId",void 0),c(this,"visitorType",void 0),c(this,"admiralUtils",Ls.getInstance()),this.simpleHostname=vs();var u=window.location.hostname;""!==window.sophi_config.sophiHostname?this.sophiHostname=window.sophi_config.sophiHostname:this.sophiHostname=u,this.onDeviceEnabled=!(null===(t=window.authentication_config)||void 0===t||!t.sophiOnDevice)&&"1"===(null===(n=window.authentication_config)||void 0===n?void 0:n.sophiOnDevice),this.sdkEnabled=!(null===(o=window.authentication_config)||void 0===o||!o.sophiSDKEnabled)&&"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.sophiSDKEnabled),this.useEventListener=!(null===(a=window.sophi_config)||void 0===a||!a.useEventListener)&&(this.sdkEnabled&&"1"===(null===(s=window.sophi_config)||void 0===s?void 0:s.useEventListener)),this.log("site settings: onDeviceEnabled = ".concat(this.onDeviceEnabled,", sdkEnabled = ").concat(this.sdkEnabled))},[{key:"init",value:(l=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pauseAdmiralTargeting(),this.log("Starting normal SDK flow."),this.sdkEnabled){e.next=1;break}return this.resumeAdmiralTargeting(),e.abrupt("return");case 1:return e.next=2,this.setupSophiDecision();case 2:if(!e.sent){e.next=3;break}return e.next=3,this.makeSophiCall();case 3:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)})},{key:"getSophiDecisionTimeout",value:function(){var e,t,n=4e3;if(""!==(null===(e=window.sophi_config)||void 0===e?void 0:e.sophiGetDesicionTimer)&&"number"!=typeof(null===(t=window.sophi_config)||void 0===t?void 0:t.sophiGetDesicionTimer)){var r=parseInt(window.sophi_config.sophiGetDesicionTimer,10);Number.isNaN(r)||(n=r)}return this.log("getSophiDecisionTimeout is equal to: ",n),n}},{key:"waitForSophiReady",value:(a=t(u.mark(function e(){var n=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.useEventListener){e.next=1;break}return this.log("Not using AB test listener, will call Sophi decision directly."),e.abrupt("return",!1);case 1:return e.abrupt("return",new Promise(function(e){window.addEventListener("sophi.abTests:ready",t(u.mark(function t(){var r,o;return u.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(r=window.sophi)||void 0===r||!r.abTests||"function"!=typeof window.sophi.abTests.getAllExperiments){t.next=2;break}return t.next=1,window.sophi.abTests.getAllExperiments();case 1:o=t.sent,e(o);case 2:n.log("AB Tests loaded successfully!"),e(!1);case 3:case"end":return t.stop()}},t)}))),n.log("Added A/B test listener...")}));case 2:case"end":return e.stop()}},e,this)})),function(){return a.apply(this,arguments)})},{key:"getVisitorType",value:(i=t(u.mark(function e(){var t,n,r;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t="anonymous",e.prev=1,e.next=2,Rs();case 2:"isEntitled"in(n=e.sent)&&(t=n.isEntitled?"subscriber":"registered"),"yes"===window.localStorage.getItem("sophiRegiliteUser")&&"anonymous"===t&&(this.log("User is regilite and anonymous. Setting to registered."),t="registered"),e.next=4;break;case 3:e.prev=3,r=e.catch(1),this.error("Unable to determine visitorType Using",t,r);case 4:return window.sophiUserType=t,this.log("visitorType is",t),e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this,[[1,3]])}
5)),function(){return i.apply(this,arguments)})},{key:"setupSophiDecision",value:(o=t(u.mark(function e(){var t,n,r,o,i,a,s,c=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!0,n=!1,e.prev=1,!this.useEventListener){e.next=5;break}return e.next=2,this.waitForSophiReady();case 2:if(t=e.sent,!(!this.onDeviceEnabled&&!t||t&&t.length<1)){e.next=3;break}return this.log("experiments variable was not in the expected format.",t),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 3:if(t){e.next=4;break}return this.log("window.sophi.abTests.getAllExperiments is not available"),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 4:n=null===(r=t[0])||void 0===r?void 0:r.assignedGroup,this.log("onSuccess callback:",n);case 5:if(o=function(e){console.error("onError callback, rerunning Connext if silent:",e),c.rerunConnextIfIsSilent()},i=this.section){e.next=7;break}return e.next=6,Is();case 6:i=e.sent;case 7:return this.section=i,e.prev=8,e.next=9,this.getVisitorType();case 9:if(this.visitorType=e.sent,!(this.useEventListener&&"control"===n||"subscriber"===this.visitorType)){e.next=10;break}return this.log("User is in ".concat(n,", and is ").concat(this.visitorType,". Ending sophi flow.")),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 10:return e.next=11,Ts();case 11:if("article"===e.sent){e.next=12;break}return this.log("Page type was not article, returning."),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 12:return e.next=13,Es();case 13:return this.useEventListener&&(window.dataLayer.push({event:"sophi_cookie",sophi_type:"".concat(this.simpleHostname,"UserIsInVariantOrHoldout"),sophi_cookie_val:n}),window.sophiCookie=n),e.next=14,Cs();case 14:return this.contentId=e.sent,this.log("Content ID ",this.contentId),e.abrupt("return",!0);case 15:return e.prev=15,a=e.catch(8),o(a),e.abrupt("return",!1);case 16:return e.prev=16,s=e.catch(1),this.log("Event listener",s),this.rerunConnextIfIsSilent(),e.abrupt("return",!1);case 17:case"end":return e.stop()}},e,this,[[1,16],[8,15]])})),function(){return o.apply(this,arguments)})},{key:"rerunConnextIfIsSilent",value:(n=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.resumeAdmiralTargeting(),this.log("About to call rerunConnextEntitlements."),e.next=1,window.ConnextUtils.rerunConnextEntitlements(!1,!1);case 1:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"handleSophiResponse",value:function(e){var t=Date.now()-this.sophiCallStartTime;this.log("response with response time of ".concat(t," ms: "),e),this.resumeAdmiralTargeting((null==e?void 0:e.wallType)||"no_wall"),delete e.trace;var n="";this.useEventListener||(n=window.sophi.dataLayer.assignedGroup,window.sophiCookie=n),(!this.useEventListener&&"variant"===n||this.useEventListener)&&window.dataLayer.push({event:"sophi_decision",sophi_type:"getDecision",sophi_time:t,sophi_response:JSON.stringify(e)}),window.sophiWallConfig=e,this.rerunConnextIfIsSilent()}},{key:"makeSophiCall",value:(e=t(u.mark(function e(){var t=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e){try{var n=window.sophi.paywall.init({hostname:t.sophiHostname,getContentId:Cs});if(t.log("2.0 SDK init complete: ",n),!window.sophi.paywall)return t.log("window.sophi.paywall was undefined. About to run Connext"),void t.rerunConnextIfIsSilent();t.useEventListener&&(window.dataLayer.push({event:"sophi_cookie",sophi_type:"beforeSDKCall",sophi_cookie_val:window.sophiCookie}),t.log("about to call SDK, cookie is ".concat(window.sophiCookie))),t.sophiCallStartTime=Date.now()}catch(e){t.log("logic error 1",e),t.rerunConnextIfIsSilent()}var r=t.getSophiDecisionTimeout();window.sophi.paywall.getDecision({contentId:t.contentId,section:t.section,visitor:t.visitorType,timeout:r}).then(function(n){t.handleSophiResponse(n),e()}).catch(function(n){var r=Date.now()-t.sophiCallStartTime;t.log("error sdk, response time of ".concat(r," ms: "),n),window.dataLayer.push({event:"sophi_error",sophi_time:r,sophi_err_msg:n}),t.rerunConnextIfIsSilent(),e()})}));case 1:case"end":return e.stop()}},e)})),function(){return e.apply(this,arguments)})},{key:"pauseAdmiralTargeting",value:function(){if(!this.admiralPaused&&!this.admiralResumed){this.admiralPaused=!0,this.admiralResumed=!1;var e=this.getSophiDecisionTimeout()+2e3;this.admiralUtils.pauseTargeting(e)}}},{key:"resumeAdmiralTargeting",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no_wall";this.admiralResumed||(this.admiralResumed=!0,this.admiralPaused=!1,this.admiralUtils.queueSet("sophi_wall",e),this.admiralUtils.scheduleReady(),this.log("Admiral sophi_wall queued (".concat(e,").")))}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];ls.log.apply(ls,["Sophi: "].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];ls.error.apply(ls,["Sophi: "].concat(t))}}]);var e,n,o,i,a,l}();const xs=Ms;function Ds(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}
5function Us(e){return Us=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Us(e)}function Bs(){return Bs="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Us(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Bs.apply(null,arguments)}function Hs(e,t){return Hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hs(e,t)}function Gs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Gs=function(){return!!e})()}function Ws(e,t,n,r){var o=Bs(Us(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof o?function(e){return o.apply(n,e)}:o}var Ks,Fs=function(e){function n(){return r(this,n),function(e,t,n){return t=Us(t),Ds(e,Gs()?Reflect.construct(t,n||[],Us(e).constructor):t.apply(e,n))}(this,n,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Hs(e,t)}(n,e),s(n,[{key:"init",value:(l=t(u.mark(function e(){var t;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.pauseAdmiralTargeting(),!this.sdkEnabled){e.next=1;break}return this.resumeAdmiralTargeting(),e.abrupt("return");case 1:if("undefined"!=typeof demeter){e.next=2;break}return this.log("demeter undefined, aborting on-device init."),this.resumeAdmiralTargeting(),e.abrupt("return");case 2:return demeter("config",{args:{logLevel:"1"===window.authentication_config.debug?"debug":"warn"}}),demeter("enableAllFeatures"),this.sspwEnabled="1"===window.sophi_config.enableSophiSSPW,this.sophiEngageVsSophiSSPWEnabled="1"===window.sophi_config.enableSophiEngageVsSophiSSPW,this.log("Sophi Engage vs Sophi SSPW A/B Test Enabled: ".concat(this.sophiEngageVsSophiSSPWEnabled)),e.next=3,Is();case 3:return this.section=e.sent,e.next=4,Ts();case 4:if(this.pageType=e.sent,!this.onDeviceEnabled){e.next=6;break}return this.log("On-Device module is enabled."),e.next=5,this.listenForEventForDemeter();case 5:e.next=7;break;case 6:return this.log("On-Device module is NOT enabled, aborting."),this.resumeAdmiralTargeting(),e.abrupt("return");case 7:if(!this.sophiEngageVsSophiSSPWEnabled){e.next=9;break}if(t=this.setEngageVsSophiCookie(),this.sspwEnabled&&"engage"!==t){e.next=8;break}return this.log(this.sspwEnabled?"(".concat(this.sspwEnabled?"SSPW ON":"SSPW OFF",", and cookie=").concat(t,")"):"(".concat(this.sspwEnabled?"SSPW ON":"SSPW OFF"," → About to setup Sophi decision)")),this.handleSophiProcess(),e.abrupt("return");case 8:return this.log("SSPW is active, skipping client-side Sophi decision call."),this.handleSSPWProcess(),e.abrupt("return");case 9:if(this.sspwEnabled){e.next=10;break}return this.log("About to setup Sophi decision."),this.handleSophiProcess(),e.abrupt("return");case 10:return this.log("SSPW is active, skipping client-side Sophi decision call."),e.next=11,this.getVisitorType();case 11:this.visitorType=e.sent,this.handleSSPWProcess();case 12:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)})},{key:"sendPageViewEvent",value:function(){var e;demeter("pageview",{args:{article:null!==(e="article"===this.pageType)&&void 0!==e&&e,section:this.section}}),this.log("demeter pagetype tracking sent, pagetype is ".concat(this.pageType," and section is ").concat(this.section))}},{key:"listenForEventForDemeter",value:(c=t(u.mark(function e(){var t,n,r,o,i=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.log("Setting up listeners for demeter..."),this.sendPageViewEvent(),this.sspwEnabled||(this.log("adding paywall listener"),document.addEventListener("onPaywallShown",function(e){var t,n=((null===(t=e.detail)||void 0===t||null===(t=t.EventData)||void 0===t?void 0:t.Name)||"").toLowerCase().includes("regwall")?"regwall":"paywall";i.log("paywall event, is ".concat(n)),demeter("wall",{args:{wallType:n,section:i.section}}),i.log("demeter paywall tracking sent, wall type is ".concat(n,", section is ").concat(i.section))})),e.next=1,_s();case 1:t=e.sent,n=window.localStorage.getItem("sophiRegiliteUser"),r=t.isAuthenticated,o=r||"yes"===n?"registered":"anonymous",demeter("userProperties",{args:{visitorType:o}}),this.log("demeter userProperties tracking sent, user type is ".concat(o));case 2:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"makeSophiCall",value:(a=t(u.mark(function e(){var t=this;return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e){var r=function(n){var r=Date.now()-t.sophiCallStartTime;t.log("error sdk, response time of ".concat(r," ms: "),n),window.dataLayer.push({event:"sophi_error",sophi_time:r,sophi_err_msg:n}),t.resumeAdmiralTargeting(),t.rerunConnextIfIsSilent(),e()};try{t.sophiCallStartTime=Date.now(),demeter("getDecision",{args:{visitor:t.visitorType,section:t.section}}).then(function(r){r&&r.outcome?(Ws(n,"handleSophiResponse",t,3)([r.outcome]),e()):function(n){var r=Date.now()-t.sophiCallStartTime;t.log("getDecision resolved without an outcome, response time of ".concat(r," ms: "),n);var o=[t.contentId,t.section,t.pageType,t.visitorType].join("|");window.dataLayer.push({event:"sophi_null_decision",sophi_type:"getDecision",sophi_time:r,sophi_response:JSON.stringify(null!=n?n:null),sophi_data:o}),t.rerunConnextIfIsSilent(),t.resumeAdmiralTargeting(),e()}(r)}).catch(r)}catch(e){r(e)}}));case 1:case"end":return e.stop()}},e)})),function(){return a.apply(this,arguments)})},{key:"setSspwTemplateCookie",value:function(){try{var e=ms("sspw-template-test");
5if(e&&""!==e)this.log("Entitlements-setSspwTemplateCookie: User already segmented");else{var t=Math.random()<.5?"GroupA":"GroupB";gs("sspw-template-test",t,{expires:60,path:"/"}),this.log("Entitlements-setSspwTemplateCookie: User segmented in group: ".concat(t))}}catch(e){this.log("Entitlements-setSspwTemplateCookie: There was an error trying to create the sspw template cookie for AB testing, error: ",e)}}},{key:"setEngageVsSophiCookie",value:function(){try{var e=ms("engage_vs_sophi_sspw");return e&&""!==e?this.log("Entitlements-setEngageVsSophiCookie: User already segmented in group: ".concat(e)):(e=Math.random()<.5?"sspw":"engage",gs("engage_vs_sophi_sspw",e,{expires:60,path:"/"}),this.log("Entitlements-setEngageVsSophiCookie: User segmented in group: ".concat(e))),e}catch(e){return this.log("Entitlements-setEngageVsSophiCookie: There was an error trying to create the engage vs sophi cookie for AB testing, error: ",e),null}}},{key:"handleServerSidePaywall",value:function(){this.log("Checking for server-side paywall..."),document.querySelector("#server-paywall, #nav-api-sspw")?(this.log("Server-side paywall detected."),demeter("wall",{args:{wallType:"paywall",section:this.section}}),(window._matherq=window._matherq||[]).push(["paywallEvent",{type:"paywall",category:"block",action:"stop"}]),this.log("demeter and mather events sent for server-side paywall. Section is ".concat(this.section))):this.log("No server-side paywall detected. Element not found.")}},{key:"handleServerSideRegwall",value:(i=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(document.querySelector("#server-regwall .regwall-input-holder.flex-container, #nav-api-ssrw")){e.next=1;break}return this.log("No server-side regwall detected. Element not found."),e.abrupt("return");case 1:return this.log("Server-side regwall detected."),demeter("wall",{args:{wallType:"regwall",section:this.section}}),(window._matherq=window._matherq||[]).push(["paywallEvent",{type:"paywall",category:"block",action:"stop",wall_type:"regwall"}]),this.log("demeter and mather events sent for server-side regwall. Section is ".concat(this.section)),e.next=2,Ss();case 2:if(e.sent){e.next=3;break}return this.log("engageLibrary failed to load within 10 seconds, skipping serverRegwall()."),e.abrupt("return");case 3:window.engageLibrary.serverRegwall();case 4:case"end":return e.stop()}},e,this)})),function(){return i.apply(this,arguments)})},{key:"handleSSPWProcess",value:function(){this.resumeAdmiralTargeting(),this.setSspwTemplateCookie(),"article"===this.pageType&&(this.handleServerSidePaywall(),this.handleServerSideRegwall())}},{key:"handleSophiProcess",value:(o=t(u.mark(function e(){return u.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,this.setupSophiDecision();case 1:if(!e.sent){e.next=2;break}return e.next=2,this.makeSophiCall();case 2:case"end":return e.stop()}},e,this)})),function(){return o.apply(this,arguments)})}]);var o,i,a,c,l}(xs);"1"===(null===(Ks=window.authentication_config)||void 0===Ks?void 0:Ks.sophiOnDevice)?(new Fs).init():(new xs).init()})()})();
6//# sourceMappingURL=mng-digisubs.sophi.bundle.js.map;
7/*! For license information please see mng-digisubs.articleShare.bundle.js.LICENSE.txt */
8(()=>{var e={7526(e,t){"use strict";t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;s<c;s+=a)i.push(u(e,s,s+a>c?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
vendor: 10,099 bytes, line 8
8+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),o.push(c(r));return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},8287(e,t,n){"use strict";const r=n(7526),o=n(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=c,t.IS=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|y(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(z(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(z(e,ArrayBuffer)||e&&z(e.buffer,ArrayBuffer))return f(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(z(e,SharedArrayBuffer)||e&&z(e.buffer,SharedArrayBuffer)))return f(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||q(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function f(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return N(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function w(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;i<s;i++)if(u(e,i)===u(t,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===c)return r*a}else-1!==r&&(i-=i-r),r=-1}else for(n+c>s&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;r<c;r++)if(u(e,i+r)!==u(t,r)){n=!1;break}if(n)return i}return-1}function A(e,t,n,r){n=Number(n)||0;const o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(q(r))return a;e[n+a]=r}return a}function E(e,t,n,r){return Y(J(t,e.length-n),e,n,r)}function b(e,t,n,r){return Y(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return Y(V(t),e,n,r)}function T(e,t,n,r){return Y(function(e,t){let n,r,o;const i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o<n;){const t=e[o];let i=null,a=t>239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=O));return n}(r)}c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,n){return u(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return l(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),z(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let o=0,i=Math.min(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let o=0;for(n=0;n<e.length;++n){let t=e[n];if(z(t,Uint8Array))o+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)w(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):g.apply(this,arguments)}
vendor: 11,996 bytes, line 8
8,c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e<s;++e)if(u[e]!==l[e]){i=u[e],a=l[e];break}return i<a?-1:a<i?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return m(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return m(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":case"latin1":case"binary":return b(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function I(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function N(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function C(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let o="";for(let r=t;r<n;++r)o+=Z[e[r]];return o}function k(e,t,n){const r=e.slice(t,n);let o="";for(let e=0;e<r.length-1;e+=2)o+=String.fromCharCode(r[e]+256*r[e+1]);return o}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function x(e,t,n,r,o){K(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function M(e,t,n,r,o){K(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function U(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,n,r,i){return t=+t,n>>>=0,i||U(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,i){return t=+t,n>>>=0,i||U(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){F(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<<BigInt(32))}),c.prototype.readBigUInt64BE=Q(function(e){F(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(o)}),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i<t&&(o*=256);)r+=this[e+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){F(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),c.prototype.readBigInt64BE=Q(function(e){F(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||j(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)}),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){P(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){P(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return M(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o<n&&(i*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);P(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return M(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const o=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),o},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{const i=c.isBuffer(e)?e:c.from(e,r),a=i.length;
vendor: 4,591 bytes, line 8
8if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-t;++o)this[o+t]=i[o%a]}return this};const H={};function G(e,t,n){H[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function W(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function K(e,t,n,r,o,i){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let o;throw o=i>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new H.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){F(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||j(t,e.length-(n+1))}(r,o,i)}function F(e,t){if("number"!=typeof e)throw new H.ERR_INVALID_ARG_TYPE(t,"number",e)}function j(e,t,n){if(Math.floor(e)!==e)throw F(e,n),new H.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=W(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){let o;for(o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<<s)-1,u=c>>1,l=-7,d=n?o-1:0,h=n?-1:1,f=e[t+d];for(d+=h,i=f&(1<<-l)-1,f>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),i-=u}return(f?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<<u)-1,d=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:i-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+f]=255&s,f+=p,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[n+f]=255&a,f+=p,a/=256,u-=8);e[n+f-p]|=128*y}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:f,f
vendor: 1,956 bytes, line 8
8:f.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function f(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n<l.length;n++){var o,i=l[n],f=h.p,p=i[2];e>3?(o=p===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=f&&((o=e<2&&f<i[1])?(a=0,h.v=r,h.n=i[1]):f<p&&(o=e<3||i[0]>r||r>p)&&(i[4]=e,i[5]=r,h.n=p,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&f(l,p),a=l,s=p;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),f(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var f=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),p=h.prototype=l.prototype=Object.create(f);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return d.prototype=h,r(p,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(p),r(p,s,"Generator"),r(p,a,function(){return this}),r(p,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m:y}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports}
8,1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var f={throw:1,return:2,break:3,continue:3};function p(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,f[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(p(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(p(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,forceLogoutOnExpiredIdToken:!!window.authentication_config&&"1"===window.authentication_config.forceLogoutOnExpiredIdToken,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaC
8heckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment,enableSocialSigninModal:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSigninModal,enableSocialAllPages:!!window.authentication_config&&"1"===window.authentication_config.enableSocialAllPages,enableSocialHomepage:!!window.authentication_config&&"1"===window.authentication_config.enableSocialHomepage,enableSocialArticle:!!window.authentication_config&&"1"===window.authentication_config.enableSocialArticle,enableSocialSection:!!window.authentication_config&&"1"===window.authentication_config.enableSocialSection};n.d(t,["A",0,c])}};const t={};function n(r){const o=t[r];if(void 0!==o)return o.exports;const i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var o=t[r++],i=t[r++],a=0===i?{enumerable:!0,value:t[r++]}:{enumerable:!0,get:i};n.o(e,o)||Object.defineProperty(e,o,a)}else for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function s(e){r(a,o,i,s,c,"next",e)}function c(e){r(a,o,i,s,c,"throw",e)}s(void 0)})}}var i=n(4756),a=n(3612);const s={log:function(){if(a.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).log.apply(e,["MNGDigisubs:"].concat(n))}},error:function(){if(a.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).error.apply(e,["MNGDigisubs:"].concat(n))}}},c="__MNG_Session",u="articlesRemaining",l="user-profile";function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function f(e){var t=function(e,t){if("object"!=h(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==h(t)?t:t+""}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function y(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function g(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=function(){function e(){d(this,e),g(this,"pendingSets",new Map),g(this,"flushTimer",null),g(this,"hasFlushed",!1),g(this,"isPaused",!1)}return y(e,[{key:"pauseTargeting",value:function(t){if(!this.isPaused&&!this.hasFlushed)if(e.isAvailable())try{window.admiral("targeting","pause",t),this.isPaused=!0,s.log("AdmiralUtils | pauseTargeting | paused (".concat(t,"ms auto-resume)."))}catch(e){s.error("AdmiralUtils | pauseTargeting | failed",e)}else s.log("AdmiralUtils | pauseTargeting | window.admiral is not available, skipping pause.")}},{key:"queueSet",value:function(e,t){if(this.hasFlushed)s.log('AdmiralUtils | queueSet | already ready — skipping late set for "'.concat(e,'".'));else{var n=null==t?"":String(t);this.pendingSets.set(e,n)}}},{key:"flush",value:function(){if(!this.hasFlushed){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),!e.isAvailable())return s.log("AdmiralUtils | flush | window.admiral is not available, skipping flush."),void this.pendingSets.clear();
8try{this.pendingSets.forEach(function(e,t){window.admiral("targeting","set",t,e),s.log('AdmiralUtils | flush | set "'.concat(t,'" = "').concat(e,'"'))}),window.admiral("targeting","ready"),this.hasFlushed=!0,this.isPaused=!1,this.pendingSets.clear(),s.log("AdmiralUtils | flush | targeting ready.")}catch(e){s.error("AdmiralUtils | flush | failed",e)}}}},{key:"scheduleReady",value:function(){var t=this;if(!this.hasFlushed)if(this.flushTimer)s.log("AdmiralUtils | scheduleReady | deadline already set — ignoring repeated call.");else{var n=e.DEFAULT_READY_DELAY_MS;this.flushTimer=setTimeout(function(){t.flushTimer=null,t.flush()},n),s.log("AdmiralUtils | scheduleReady | targeting ready scheduled in ".concat(n,"ms."))}}}],[{key:"isAvailable",value:function(){return"function"==typeof window.admiral}},{key:"getInstance",value:function(){return window.admiralUtils||(window.admiralUtils=new e),window.admiralUtils}}])}();g(w,"DEFAULT_READY_DELAY_MS",2e3);class m extends Error{}function v(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return function(e){return decodeURIComponent(atob(e).replace(/(.)/g,(e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function A(e,t){this.v=e,this.k=t}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function S(e){return new A(e,0)}function T(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _(e,t){return e.get(b(e,t))}function R(e,t,n){T(e,t),t.set(e,n)}function O(e,t,n){return e.set(b(e,t),n),n}function I(e,t){T(e,t),t.add(e)}function N(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach(function(t){N(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function L(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function P(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){u=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return E(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?E(e,t):void 0}}
8(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e){return function(){return new M(e.apply(this,arguments))}}function M(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,s=a instanceof A;Promise.resolve(s?a.v:a).then(function(n){if(s){var c="return"===t&&a.k?t:"next";if(!a.k||n.done)return r(c,n);n=e[c](n).value}o(!!i.done,n)},function(e){r("throw",e)})}catch(e){o(2,e)}}function o(e,o){2===e?t.reject(o):t.resolve({value:o,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var s={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=s:(t=n=s,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}m.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError,M.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},M.prototype.next=function(e){return this._invoke("next",e)},M.prototype.throw=function(e){return this._invoke("throw",e)},M.prototype.return=function(e){return this._invoke("return",e)};Error;var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},B={},D={};Object.defineProperty(D,"__esModule",{value:!0});var H=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(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(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();D.default=function(){return H.getInstance()};var G=U&&U.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},W=U&&U.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},K=U;Object.defineProperty(B,"__esModule",{value:!0});var F=D,j="browser-tabs-lock-key",X={key:function(e){return G(K,void 0,void 0,function(){return W(this,function(e){throw new Error("Unsupported")})})},getItem:function(e){return G(K,void 0,void 0,function(){return W(this,function(e){throw new Error("Unsupported")})})},clear:function(){return G(K,void 0,void 0,function(){return W(this,function(e){return[2,window.localStorage.clear()]})})},removeItem:function(e){return G(K,void 0,void 0,function(){return W(this,function(e){throw new Error("Unsupported")})})},setItem:function(e,t){return G(K,void 0,void 0,function(){return W(this,function(e){throw new 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 J(e){return new Promise(function(t){return setTimeout(t,e)})}function V(e){for(var t="",n=0;n<e;n++)t+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"[Math.floor(61*Math.random())];return t}var Y=function(){function e(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=Date.now().toString()+V(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,void 0===e.waiters&&(e.waiters=[])}return e.prototype.acquireLock=function(t,n){return void 0===n&&(n=5e3),G(this,void 0,void 0,function(){var r,o,i,a,s,c,u;return W(this,function(l){switch(l.label){case 0:r=Date.now()+V(4),o=Date.now()+n,i=j+"-"+t,a=void 0===this.storageHandler?X:this.storageHandler,l.label=1;case 1:return Date.now()<o?[4,J(30)]:[3,8];case 2:return l.sent(),null!==a.getItemSync(i)?[3,5]:(s=this.id+"-"+t+"-"+r,[4,J(M
8ath.floor(25*Math.random()))]);case 3:return l.sent(),a.setItemSync(i,JSON.stringify({id:this.id,iat:r,timeoutKey:s,timeAcquired:Date.now(),timeRefreshed:Date.now()})),[4,J(30)];case 4:return l.sent(),null!==(c=a.getItemSync(i))&&(u=JSON.parse(c)).id===this.id&&u.iat===r?(this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(i,r),[2,!0]):[3,7];case 5:return e.lockCorrector(void 0===this.storageHandler?X:this.storageHandler),[4,this.waitForSomethingToChange(o)];case 6:l.sent(),l.label=7;case 7:return r=Date.now()+V(4),[3,1];case 8:return[2,!1]}})})},e.prototype.refreshLockWhileAcquired=function(e,t){return G(this,void 0,void 0,function(){var n=this;return W(this,function(r){return setTimeout(function(){return G(n,void 0,void 0,function(){var n,r,o;return W(this,function(i){switch(i.label){case 0:return[4,F.default().lock(t)];case 1:return i.sent(),this.acquiredIatSet.has(t)?(n=void 0===this.storageHandler?X:this.storageHandler,null===(r=n.getItemSync(e))?(F.default().unlock(t),[2]):((o=JSON.parse(r)).timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(o)),F.default().unlock(t),this.refreshLockWhileAcquired(e,t),[2])):(F.default().unlock(t),[2])}})})},1e3),[2]})})},e.prototype.waitForSomethingToChange=function(t){return G(this,void 0,void 0,function(){return W(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){var r=!1,o=Date.now(),i=!1;function a(){if(i||(window.removeEventListener("storage",a),e.removeFromWaiting(a),clearTimeout(s),i=!0),!r){r=!0;var t=50-(Date.now()-o);t>0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))})];case 1:return n.sent(),[2]}})})},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter(function(e){return e!==t}))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach(function(e){return e()})},e.prototype.releaseLock=function(e){return G(this,void 0,void 0,function(){return W(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 G(this,void 0,void 0,function(){var n,r,o,i;return W(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?X:this.storageHandler,r=j+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,F.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),F.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;c<o.length;c++){var u=o[c];if(u.includes(j)){var l=r.getItemSync(u);if(null!==l){var d=JSON.parse(l);(void 0===d.timeRefreshed&&d.timeAcquired<n||void 0!==d.timeRefreshed&&d.timeRefreshed<n)&&(r.removeItemSync(u),s=!0)}}}s&&e.notifyWaiters()},e.waiters=void 0,e}();B.default=Y;new TextEncoder,new TextDecoder;let z;if(Uint8Array.prototype.toBase64)z=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;z=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}Error;Error;var q=U&&U.__assign||function(){return q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},q.apply(this,arguments)};var Z;!function(e){e.Code="code",e.ConnectCode="connect_code"}(Z||(Z={}));var Q;var ee;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(ee||(ee={}));Error;var te,ne;let re;if("undefined"==typeof navigator||null===(te=navigator.userAgent)||void 0===te||null===(ne=te.startsWith)||void 0===ne||!ne.call(te,"Mozilla/5.0 ")){const e="v3.8.6";re="".concat("oauth4webapi","/").concat(e)}function oe(e,t){if(null==e)return!1;try{return e instanceof t||Object.getPrototypeOf(e)[Symbol.toStringTag]===t.prototype[Symbol.toStringTag]}catch(e){return!1}}const ie="ERR_INVALID_ARG_VALUE",ae="ERR_INVALID_ARG_TYPE";function se(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}const ce=Symbol(),ue=Symbol(),le=Symbol(),de=Symbol(),he=Symbol(),fe=Symbol(),pe=new TextEncoder,ye=new TextDecoder;function ge(e){return"string"==typeof e?pe.encode(e):ye.decode(e)}let we,me;if(Uint8Array.prototype.toBase64)we=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;we=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r<t.byteLength;r+=e)n.push(String.fromCharCode.apply(null,t.subarray(r,r+e)));return btoa(n.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}}function ve(e){return"string"==typeof e?me(e):we(e)}me=Uint8Array.fromBase64?e=>{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw se("The input to be decoded is not correctly encoded.",ie,e)}
8}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch(e){throw se("The input to be decoded is not correctly encoded.",ie,e)}};class Ae extends Error{constructor(e,t){var n;super(e,t),N(this,"code",void 0),this.name=this.constructor.name,this.code=St,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class Ee extends Error{constructor(e,t){var n;super(e,t),N(this,"code",void 0),this.name=this.constructor.name,null!=t&&t.code&&(this.code=null==t?void 0:t.code),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function be(e,t,n){return new Ee(e,{code:t,cause:n})}function Se(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function Te(e){oe(e,Headers)&&(e=Object.fromEntries(e.entries()));const t=new Headers(null!=e?e:{});if(re&&!t.has("user-agent")&&t.set("user-agent",re),t.has("authorization"))throw se('"options.headers" must not include the "authorization" header name',ie);return t}function _e(e,t){if(void 0!==t){if("function"==typeof t&&(t=t(e.href)),!(t instanceof AbortSignal))throw se('"options.signal" must return or be an instance of AbortSignal',ae);return t}}function Re(e){return e.includes("//")?e.replace("//","/"):e}function Oe(e,t,n,r,o){try{if("number"!=typeof e||!Number.isFinite(e))throw se("".concat(n," must be a number"),ae,o);if(e>0)return;if(t){if(0!==e)throw se("".concat(n," must be a non-negative number"),ie,o);return}throw se("".concat(n," must be a positive number"),ie,o)}catch(e){if(r)throw be(e.message,r,o);throw e}}function Ie(e,t,n,r){try{if("string"!=typeof e)throw se("".concat(t," must be a string"),ae,r);if(0===e.length)throw se("".concat(t," must not be empty"),ie,r)}catch(e){if(n)throw be(e.message,n,r);throw e}}function Ne(e){!function(e,t){if(nt(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];if(r.length>2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return be(t,It,e)}(e,t)}(e,"application/json")}function Ce(){return ve(crypto.getRandomValues(new Uint8Array(32)))}function ke(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Ae("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Ae("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Ae("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Ae("unsupported CryptoKey algorithm name",{cause:e})}}function Le(e){const t=null==e?void 0:e[ue];return"number"==typeof t&&Number.isFinite(t)?t:0}function Pe(e){const t=null==e?void 0:e[le];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function xe(){return Math.floor(Date.now()/1e3)}function Me(e){if("object"!=typeof e||null===e)throw se('"as" must be an object',ae);Ie(e.issuer,'"as.issuer"')}function Ue(e){if("object"!=typeof e||null===e)throw se('"client" must be an object',ae);Ie(e.client_id,'"client.client_id"')}function Be(e){return Ie(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function De(e,t){const n=e instanceof CryptoKey?{key:i}:(null==i?void 0:i.key)instanceof CryptoKey?(void 0!==i.kid&&Ie(i.kid,'"kid"'),{key:i.key,kid:i.kid}):{},r=n.key,o=n.kid;var i;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw se("".concat(t," must be a CryptoKey"),ae)}(e,t),"private"!==e.type)throw se("".concat(t," must be a private CryptoKey"),ie)}(r,'"clientPrivateKey.key"'),async(e,n,i,a)=>{var s;const c={alg:ke(r),kid:o},u=function(e,t){const n=xe()+Le(t);return{jti:Ce(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,n);null==t||null===t[he]||void 0===s||s.call(t,c,u),i.set("client_id",n.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw se('CryptoKey instances used for signing assertions must include "sign" in their "usages"',ie);const r="".concat(ve(ge(JSON.stringify(e))),".").concat(ve(ge(JSON.stringify(t)))),o=ve(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Gt(e)};case"RSA-PSS":switch(Ht(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Ae("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Ht(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Ae("unsupported CryptoKey algorithm name",{cause:e})}(n),n,ge(r)));return"".concat(r,".").concat(o)}(c,u,r))}}const He=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Ge(e,t){if(t&&"https:"!==e.protocol)throw be("only requests to HTTPS are allowed",Ct,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw be("only HTTP and HTTPS requests are allowed",kt,e)}function We(e,t,n,r){let o;if("string"!=typeof e||!(o=He(e)))throw be("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?Mt:Ut,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Ge(o,r),o}function Ke(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?We(e.mtls_endpoint_aliases[t],t,n,r):We(e[t],t,n,r)}
8class Fe extends Error{constructor(e,t){var n;super(e,t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"error",void 0),N(this,"status",void 0),N(this,"error_description",void 0),N(this,"response",void 0),this.name=this.constructor.name,this.code=bt,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class je extends Error{constructor(e,t){var n,r;super(e,t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"error",void 0),N(this,"error_description",void 0),this.name=this.constructor.name,this.code=Tt,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class Xe extends Error{constructor(e,t){var n;super(e,t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"response",void 0),N(this,"status",void 0),this.name=this.constructor.name,this.code=Et,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const Je="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",Ve="("+Je+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',Ye="("+Je+")\\s*=\\s*("+Je+")",ze=new RegExp("^[,\\s]*("+Je+")"),qe=new RegExp("^[,\\s]*"+Ve+"[,\\s]*(.*)"),Ze=new RegExp("^[,\\s]*"+Ye+"[,\\s]*(.*)"),Qe=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function $e(e,t,n){if(e.status!==t){let t;var r;if(lt(e),t=await async function(e){if(e.status>399&&e.status<500){Dt(e),Ne(e);try{const t=await e.clone().json();if(Se(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new Fe("server responded with an error in the response body",{cause:t,response:e});throw be('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Nt,e)}}function et(e){if(!yt.has(e))throw se('"options.DPoP" is not a valid DPoPHandle',ie)}const tt=Symbol();function nt(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function rt(e,t,n,r,o){if(Me(e),Ue(t),!oe(r,Response))throw se('"response" must be an instance of Response',ae);if(lt(r),200!==r.status)throw be('"response" is not a conform UserInfo Endpoint response (unexpected HTTP status code)',Nt,r);let i;if(Dt(r),"application/jwt"===nt(r)){const n=await Wt(await r.text(),Kt.bind(void 0,t.userinfo_signed_response_alg,e.userinfo_signing_alg_values_supported,void 0),Le(t),Pe(t),null==o?void 0:o[fe]).then(dt.bind(void 0,t.client_id)).then(ft.bind(void 0,e)),i=n.claims,a=n.jwt;st.set(r,a)}else{if(t.userinfo_signed_response_alg)throw be("JWT UserInfo Response expected",_t,r);await Jt(r)}if(Ie(i.sub,'"response" body "sub" property',Ot,{body:i}),n===tt);else if(Ie(n,'"expectedSubject"'),i.sub!==n)throw be('unexpected "response" body "sub" property value',xt,{expected:n,body:i,attribute:"sub"});return i}async function ot(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[de])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:_e(r,null==a?void 0:a.signal)})}async function it(e,t,n,r,o,i){var a;const s=Ke(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[ce]));o.set("grant_type",r);const c=Te(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(et(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await ot(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const at=new WeakMap,st=new WeakMap;function ct(e){if(!e.id_token)return;const t=at.get(e);if(!t)throw se('"ref" was already garbage collected or did not resolve from the proper sources',ie);return t}
8async function ut(e,t,n,r,o,i){if(Me(e),Ue(t),!oe(n,Response))throw se('"response" must be an instance of Response',ae);await $e(n,200,"Token Endpoint"),Dt(n);const a=await Jt(n);if(Ie(a.access_token,'"response" body "access_token" property',Ot,{body:a}),Ie(a.token_type,'"response" body "token_type" property',Ot,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;Oe(e,!0,'"response" body "expires_in" property',Ot,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Ie(a.refresh_token,'"response" body "refresh_token" property',Ot,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw be('"response" body "scope" property must be a string',Ot,{body:a});if(void 0!==a.id_token){Ie(a.id_token,'"response" body "id_token" property',Ot,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Oe(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const s=await Wt(a.id_token,Kt.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Le(t),Pe(t),o).then(mt.bind(void 0,i)).then(pt.bind(void 0,e)).then(ht.bind(void 0,t.client_id)),c=s.claims,u=s.jwt;if(Array.isArray(c.aud)&&1!==c.aud.length){if(void 0===c.azp)throw be('ID Token "aud" (audience) claim includes additional untrusted audiences',Pt,{claims:c,claim:"aud"});if(c.azp!==t.client_id)throw be('unexpected ID Token "azp" (authorized party) claim value',Pt,{expected:t.client_id,claims:c,claim:"azp"})}void 0!==c.auth_time&&Oe(c.auth_time,!0,'ID Token "auth_time" (authentication time)',Ot,{claims:c}),st.set(n,u),at.set(a,c)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Ae("unsupported `token_type` value",{cause:{body:a}});return a}function lt(e){let t;if(t=function(e){if(!oe(e,Response))throw se('"response" must be an instance of Response',ae);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(ze);const c=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!c)return;const u=r.substring(t[0].length);if(u&&!u.match(/^[\s,]/))return;const l=u.match(/^\s+(.*)$/),d=!!l;r=l?l[1]:void 0;const h={};let f;if(d)for(;r;){let n,o;if(t=r.match(qe)){var i=P(t,4);if(n=i[1],o=i[2],r=i[3],o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}h[n.toLowerCase()]=o}else{if(!(t=r.match(Ze))){if(t=r.match(Qe)){if(Object.keys(h).length)break;var a=P(t,3);f=a[1],r=a[2];break}return}var s=P(t,4);n=s[1],o=s[2],r=s[3],h[n.toLowerCase()]=o}}else r=u||void 0;const p={scheme:c,parameters:h};f&&(p.token68=f),n.push(p)}return n.length?n:void 0}(e))throw new Xe("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}function dt(e,t){return void 0!==t.claims.aud?ht(e,t):t}function ht(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw be('unexpected JWT "aud" (audience) claim value',Pt,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw be('unexpected JWT "aud" (audience) claim value',Pt,{expected:e,claims:t.claims,claim:"aud"});return t}function ft(e,t){return void 0!==t.claims.iss?pt(e,t):t}function pt(e,t){var n,r;const o=null!==(n=null===(r=e[Yt])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw be('unexpected JWT "iss" (issuer) claim value',Pt,{expected:o,claims:t.claims,claim:"iss"});return t}const yt=new WeakSet,gt=Symbol(),wt={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function mt(e,t){for(const n of e)if(void 0===t.claims[n])throw be('JWT "'.concat(n,'" (').concat(wt[n],") claim missing"),Ot,{claims:t.claims});return t}const vt=Symbol(),At=Symbol();const Et="OAUTH_WWW_AUTHENTICATE_CHALLENGE",bt="OAUTH_RESPONSE_BODY_ERROR",St="OAUTH_UNSUPPORTED_OPERATION",Tt="OAUTH_AUTHORIZATION_RESPONSE_E
8RROR",_t="OAUTH_JWT_USERINFO_EXPECTED",Rt="OAUTH_PARSE_ERROR",Ot="OAUTH_INVALID_RESPONSE",It="OAUTH_RESPONSE_IS_NOT_JSON",Nt="OAUTH_RESPONSE_IS_NOT_CONFORM",Ct="OAUTH_HTTP_REQUEST_FORBIDDEN",kt="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Lt="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Pt="OAUTH_JWT_CLAIM_COMPARISON_FAILED",xt="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",Mt="OAUTH_MISSING_SERVER_METADATA",Ut="OAUTH_INVALID_SERVER_METADATA";async function Bt(e){if(!oe(e,Response))throw se('"response" must be an instance of Response',ae);await $e(e,200,"Revocation Endpoint")}function Dt(e){if(e.bodyUsed)throw se('"response" body has been used already',ie)}function Ht(e){const t=e.algorithm;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Ae("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Gt(e){switch(e.algorithm.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Ae("unsupported ECDSA namedCurve",{cause:e})}}async function Wt(e,t,n,r,o){let i,a,s=e.split("."),c=s[0],u=s[1],l=s.length;if(5===l){if(void 0===o)throw new Ae("JWE decryption is not configured",{cause:e});var d=(e=await o(e)).split(".");c=d[0],u=d[1],l=d.length}if(3!==l)throw be("Invalid JWT",Ot,e);try{i=JSON.parse(ge(ve(c)))}catch(e){throw be("failed to parse JWT Header body as base64url encoded JSON",Rt,e)}if(!Se(i))throw be("JWT Header must be a top level object",Ot,e);if(t(i),void 0!==i.crit)throw new Ae('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(ge(ve(u)))}catch(e){throw be("failed to parse JWT Payload body as base64url encoded JSON",Rt,e)}if(!Se(a))throw be("JWT Payload must be a top level object",Ot,e);const h=xe()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw be('unexpected JWT "exp" (expiration time) claim type',Ot,{claims:a});if(a.exp<=h-r)throw be('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Lt,{claims:a,now:h,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw be('unexpected JWT "iat" (issued at) claim type',Ot,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw be('unexpected JWT "iss" (issuer) claim type',Ot,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw be('unexpected JWT "nbf" (not before) claim type',Ot,{claims:a});if(a.nbf>h+r)throw be('unexpected JWT "nbf" (not before) claim value',Lt,{claims:a,now:h,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw be('unexpected JWT "aud" (audience) claim type',Ot,{claims:a});return{header:i,claims:a,jwt:e}}function Kt(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw be('unexpected JWT "alg" header parameter',Ot,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw be('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw be('unexpected JWT "alg" header parameter',Ot,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw be('unexpected JWT "alg" header parameter',Ot,{header:r,expected:e,reason:"client configuration"})}function Ft(e,t){const n=e.getAll(t),r=n[0];if(n.length>1)throw be('"'.concat(t,'" parameter must be provided only once'),Ot);return r}const jt=Symbol(),Xt=Symbol();async function Jt(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ne;try{t=await e.json()}catch(t){throw n(e),be('failed to parse "response" body as JSON',Rt,t)}if(!Se(t))throw be('"response" body must be a top level object',Ot,{body:t});return t}const Vt=Symbol(),Yt=Symbol(),zt=new TextEncoder,qt=new TextDecoder,Zt=new TextDecoder("utf-8",{fatal:!0});function Qt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t.reduce((e,t)=>e+t.length,0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}function $t(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=e.charCodeAt(n);if(r>127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}const en=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))};const tn=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];if(r.length>2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}("Key for the ".concat(e," algorithm must be "),t,...r)};
8class nn extends Error{constructor(e,t){var n;super(e,t),N(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}N(nn,"code","ERR_JOSE_GENERIC");class rn extends nn{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),N(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),N(this,"claim",void 0),N(this,"reason",void 0),N(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}N(rn,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class on extends nn{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),N(this,"code","ERR_JWT_EXPIRED"),N(this,"claim",void 0),N(this,"reason",void 0),N(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}N(on,"code","ERR_JWT_EXPIRED");class an extends nn{constructor(){super(...arguments),N(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}N(an,"code","ERR_JOSE_ALG_NOT_ALLOWED");class sn extends nn{constructor(){super(...arguments),N(this,"code","ERR_JOSE_NOT_SUPPORTED")}}N(sn,"code","ERR_JOSE_NOT_SUPPORTED"),N(class extends nn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),N(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),N(class extends nn{constructor(){super(...arguments),N(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class cn extends nn{constructor(){super(...arguments),N(this,"code","ERR_JWS_INVALID")}}N(cn,"code","ERR_JWS_INVALID");class un extends nn{constructor(){super(...arguments),N(this,"code","ERR_JWT_INVALID")}}N(un,"code","ERR_JWT_INVALID"),N(class extends nn{constructor(){super(...arguments),N(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class ln extends nn{constructor(){super(...arguments),N(this,"code","ERR_JWKS_INVALID")}}N(ln,"code","ERR_JWKS_INVALID");class dn extends nn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),N(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}N(dn,"code","ERR_JWKS_NO_MATCHING_KEY");class hn extends nn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),N(this,Symbol.asyncIterator,x(function*(){})),N(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}N(hn,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class fn extends nn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),N(this,"code","ERR_JWKS_TIMEOUT")}}N(fn,"code","ERR_JWKS_TIMEOUT");class pn extends nn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),N(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}N(pn,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const yn=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}};function gn(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}const wn="The input to be decoded is not correctly encoded.";function mn(e){if(Uint8Array.fromBase64)try{return Uint8Array.fromBase64("string"==typeof e?e:qt.decode(e),{alphabet:"base64url"})}catch(e){throw new TypeError(wn,{cause:e})}let t=e;if(t instanceof Uint8Array&&(t=qt.decode(t)),t.includes("+")||t.includes("/"))throw new TypeError(wn);t=t.replace(/-/g,"+").replace(/_/g,"/");try{return gn(t)}catch(e){throw new TypeError(wn)}}function vn(e){let t=e;return"string"==typeof t&&(t=zt.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):function(e){if(Uint8Array.prototype.toBase64)return e.toBase64();const t=[];for(let n=0;n<e.length;n+=32768)t.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(t.join(""))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function An(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function En(e){return An(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(An)}function bn(e,t,n){try{return mn(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}async function Sn(e,t){var n,r,o,i;if("RSA"===t.kty&&"oth"in t&&void 0!==t.oth)throw new sn('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');if(!e.kty.includes(t.kty))throw new sn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');const a=null!==(n=null===(r=e.resolve)||void 0===r?void 0:r.call(e,{kty:t.kty,crv:t.crv}))&&void 0!==n?n:e.subtle,s=!(!t.d&&!t.priv),c=k({},t);return"AKP"!==c.kty&&delete c.alg,delete c.use,crypto.subtle.importKey("jwk",c,a,null!==(o=t.ext)&&void 0!==o?o:!s,null!==(i=t.key_ops)&&void 0!==i?i:e.usages[s?1:0])}function Tn(e){return k({__proto__:null},e)}const _n=e=>e[Symbol.toStringTag];function Rn(e,t,n){const r=e.alg,o=e.secret,i="decrypt"===n||"sign"===n;if(o&&t instanceof Uint8Array)return[On,t];if(An(t)){const a=function(e){const t=Tn(e);if(void 0!==t.ext&&"boolean"!=typeof t.ext)throw new TypeError('"ext" (Extractable) Parameter must be a boolean');if(void 0!==t.key_ops){const e=t.key_ops,n=Array.isArray(e)?[...e]:void 0;if(!n||n.some(e=>"string"!=typeof e)||new Set(n).size!==n.length)throw new TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');t.key_ops=n}return t}(t);if("string"!=typeof a.kty)throw new TypeError(o?tn(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):tn(r,t,"CryptoKey","KeyObject","JSON Web Key"));if(!(o?"oct"===a.kty&&"string"==typeof a.k:"oct"!==a.kty&&(i?"AKP"===a.kty&&"string"==typeof a.priv||"string"==typeof a.d:void 0===a.d&&void 0===a.priv)))throw new TypeError(o?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':"JSON Web Key for this operation must be a ".concat(i?"private":"public"," JWK"));return((e,t,n)=>{const r=e.alg;if(void 0!==t.use){const e="sign"===n||"verify"===n?"sig":"enc";if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==r)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(r,'" when present'));if(Array.isArray(t.key_ops)){var o;const r="encrypt"===n||"decrypt"===n?null===(o=e.ops)||void 0===o?void 0:o["encrypt"===n?0:1]:n;if(r&&!t.key_ops.includes(r))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(r,'" when present'))}})(e,a,n),[Cn,t,a]}if(!(e=>yn(e)||(e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]))(e))(t))throw new TypeError(o?tn(r,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"):tn(r,t,"CryptoKey","KeyObject","JSON Web Key"));if(o){if("secret"!==t.type)throw new TypeError("".concat(_n(t),' instances for symmetric algorithms must be of type "secret"'))}else{if("secret"===t.type)throw new TypeError("".concat(_n(t),' instances for asymmetric algorithms must not be of type "secret"'));const e=i?"private":"public";if(("public"===t.type||"private"===t.type)&&t.type!==e){const r="sign"===n?"signing":"verify"===n?"verifying":"".concat(n.slice(0,-1),"tion");throw new TypeError("".concat(_n(t)," instances for asymmetric algorithm ").concat(r,' must be of type "').concat(e,'"'))}}return yn(t)?[In,t]:[Nn,t]}
8const On=0,In=1,Nn=2,Cn=3;let kn;const Ln={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};function Pn(e,t,n){kn||(kn=new WeakMap);const r=kn.get(e);return n&&(r?r[t]=n:kn.set(e,{[t]:n})),null!=n?n:null==r?void 0:r[t]}const xn=async(e,t,n)=>{var r;return null!==(r=Pn(e,n.alg))&&void 0!==r?r:Pn(e,n.alg,await Sn(n,k(k({},t),{},{alg:n.alg})))};async function Mn(e,t,n){const r=Rn(e,t,n);switch(r[0]){case On:case In:return r[1];case Cn:{const t=r[1],n=r[2];if("oct"===n.kty)return mn(n.k);if(!Object.isFrozen(t)){const e=t.key_ops;Array.isArray(e)&&Object.freeze(e),Object.freeze(t)}return xn(t,n,e)}case Nn:{const t=r[1];return"secret"===t.type?t.export():"toCryptoKey"in t&&"function"==typeof t.toCryptoKey?((e,t)=>{var n,r,o;const i=Pn(e,t.alg);if(i)return i;const a="public"===e.type,s=t.usages[a?0:1],c=e.asymmetricKeyType,u=Ln[null===(n=e.asymmetricKeyDetails)||void 0===n?void 0:n.namedCurve],l=null!==(r=null===(o=t.resolve)||void 0===o?void 0:o.call(t,{crv:u,asymmetricKeyType:c}))&&void 0!==r?r:t.subtle;return Pn(e,t.alg,e.toCryptoKey(l,a,s))})(t,e):xn(t,t.export({format:"jwk"}),e)}}}function Un(e){const t={__proto__:null};for(const n in e)t[n]=k(k({},e[n]),{},{alg:n});return t}const Bn=[["encrypt","wrapKey"],["decrypt","unwrapKey"]],Dn=[[],["deriveBits"]],Hn=[[],[]];function Gn(e){return{kty:["RSA"],subtle:{name:"RSA-OAEP",hash:"SHA-".concat(e)},usages:Bn,ops:["wrapKey","unwrapKey"]}}function Wn(){return{kty:["EC","OKP"],subtle:{name:"ECDH"},resolve:e=>{let t=e.kty,n=e.crv,r=e.asymmetricKeyType;if("X25519"===n||"x25519"===r)return{name:"X25519"};if("OKP"===t)throw new sn('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');return{name:"ECDH",namedCurve:n}},usages:Dn,ops:[void 0,"deriveBits"]}}function Kn(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-GCM":"AES-KW",length:e},usages:Hn,ops:t?["encrypt","decrypt"]:["wrapKey","unwrapKey"]}}function Fn(){return{kty:["oct"],secret:!0,subtle:{name:"PBKDF2"},usages:Hn,ops:["deriveBits","deriveBits"]}}const jn=Un({dir:{kty:["oct"],secret:!0,subtle:{name:"AES-GCM"},usages:Hn,ops:["encrypt","decrypt"]},"RSA-OAEP":Gn(1),"RSA-OAEP-256":Gn(256),"RSA-OAEP-384":Gn(384),"RSA-OAEP-512":Gn(512),"ECDH-ES":Wn(),"ECDH-ES+A128KW":Wn(),"ECDH-ES+A192KW":Wn(),"ECDH-ES+A256KW":Wn(),A128KW:Kn(128),A192KW:Kn(192),A256KW:Kn(256),A128GCMKW:Kn(128,!0),A192GCMKW:Kn(192,!0),A256GCMKW:Kn(256,!0),"PBES2-HS256+A128KW":Fn(),"PBES2-HS384+A192KW":Fn(),"PBES2-HS512+A256KW":Fn()}),Xn=["encrypt","decrypt"];function Jn(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{kty:["oct"],secret:!0,subtle:{name:t?"AES-CBC":"AES-GCM",length:e},usages:Hn,ops:Xn,cekBits:e,ivBits:t?128:96,cbc:t}}Un({A128GCM:Jn(128),A192GCM:Jn(192),A256GCM:Jn(256),"A128CBC-HS256":Jn(256,!0),"A192CBC-HS384":Jn(384,!0),"A256CBC-HS512":Jn(512,!0)});const Vn={__proto__:null,b64:!0};function Yn(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat(e,'" option must be an array of strings'));if(t)return new Set(t)}function zn(e,t,n,r,o){if(void 0!==o.crit&&void 0===(null==r?void 0:r.crit))throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||void 0===r.crit)return[];if(!Array.isArray(r.crit)||0===r.crit.length||r.crit.some(e=>"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');const i=void 0===n?t:k(k({__proto__:null},n),t);for(const t of r.crit){if(!(t in i))throw new sn('Extension Header Parameter "'.concat(t,'" is not recognized'));if(!Object.hasOwn(o,t)||void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i[t]&&(!Object.hasOwn(r,t)||void 0===r[t]))throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return r.crit}function qn(e,t){if(t.includes("b64")){const t=e.b64;if("boolean"!=typeof t)throw new cn('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return t}return!0}var Zn,Qn;let $n,er;if("undefined"==typeof navigator||null===(Zn=navigator.userAgent)||void 0===Zn||null===(Qn=Zn.startsWith)||void 0===Qn||!Qn.call(Zn,"Mozilla/5.0 ")){const e="v6.8.4";
8er="".concat("openid-client","/").concat(e),$n={"user-agent":er}}const tr=e=>nr.get(e);let nr,rr;function or(e){return void 0!==e?Be(e):(rr||(rr=new WeakMap),(e,t,n,r)=>{let o;return(o=rr.get(t))||(function(e,t){if("string"!=typeof e)throw ur("".concat(t," must be a string"),cr);if(0===e.length)throw ur("".concat(t," must not be empty"),sr)}(t.client_secret,'"metadata.client_secret"'),o=Be(t.client_secret),rr.set(t,o)),o(e,t,n,r)})}const ir=tt,ar=de,sr="ERR_INVALID_ARG_VALUE",cr="ERR_INVALID_ARG_TYPE";function ur(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class lr extends Error{constructor(e,t){var n;super(e,t),N(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function dr(e,t,n){return new lr(e,{cause:t,code:n})}function hr(e){if(e instanceof TypeError||e instanceof lr||e instanceof Fe||e instanceof je||e instanceof Xe)throw e;if(e instanceof Ee)switch(e.code){case Ct:throw dr("only requests to HTTPS are allowed",e,e.code);case kt:throw dr("only requests to HTTP or HTTPS are allowed",e,e.code);case Nt:throw dr("unexpected HTTP response status code",e.cause,e.code);case It:throw dr("unexpected response content-type",e.cause,e.code);case Rt:throw dr("parsing error occured",e,e.code);case Ot:throw dr("invalid response encountered",e,e.code);case Pt:throw dr("unexpected JWT claim value encountered",e,e.code);case xt:throw dr("unexpected JSON attribute value encountered",e,e.code);case Lt:throw dr("JWT timestamp claim value failed validation",e,e.code);default:throw dr(e.message,e,e.code)}if(e instanceof Ae)throw dr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw dr("runtime operation error",e,St);case"NotSupportedError":throw dr("runtime unsupported operation",e,St);case"TimeoutError":throw dr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw dr("operation aborted",e,"OAUTH_ABORT")}throw new lr("something went wrong",{cause:e})}async function fr(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw ur('"server" must be an instance of URL',cr);const o=!e.href.includes("/.well-known/"),i=null!==(null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw se('"'.concat("issuerIdentifier",'" must be an instance of URL'),ae);Ge(e,!0!==(null==r?void 0:r[ce]));const o=n(new URL(e.href)),i=Te(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[de])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:_e(o,null==r?void 0:r.signal)}
8)}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Re("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=Re("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw se('"options.algorithm" must be "oidc" (default), or "oauth2"',ie)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[de]:null==t?void 0:t[ar],[ce]:null==t||null===t.execute||void 0===r?void 0:r.includes(Er),signal:a,headers:new Headers($n)}):((null==t?void 0:t[ar])||fetch)((Ge(e,null==t||null===t.execute||void 0===c||!c.includes(Er)),e.href),{headers:Object.fromEntries(new Headers(k({accept:"application/json"},$n)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Vt)throw se('"expectedIssuerIdentifier" must be an instance of URL',ae);if(!oe(t,Response))throw se('"response" must be an instance of Response',ae);if(200!==t.status)throw be('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Nt,t);Dt(t);const r=await Jt(t);if(Ie(r.issuer,'"response" body "issuer" property',Ot,{body:r}),n!==Vt&&new URL(r.issuer).href!==n.href)throw be('"response" body "issuer" property does not match the expected value',xt,{expected:n.href,body:r,attribute:"issuer"});return r}(Vt,e)).catch(hr);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[pr]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new lr("discovered metadata issuer does not match the expected issuer",{code:xt,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new yr(i,t,n,r);let s=tr(a);if(null!=o&&o[ar]&&(s.fetch=o[ar]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const pr=Symbol();class yr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw ur('"clientId" must be a non-empty string',cr);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw ur('"clientId" and "metadata.client_id" must be the same',sr);const u=k(k({},structuredClone(n)),{},{client_id:t});let l;u[ue]=null!==(i=null===(a=n)||void 0===a?void 0:a[ue])&&void 0!==i?i:0,u[le]=null!==(s=null===(c=n)||void 0===c?void 0:c[le])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?or(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);pr in e&&(h[Yt]=t=>{let n=t.claims.tid;return e.issuer.replace("{tenantid}",n)});let f=Object.freeze(h);nr||(nr=new WeakMap),nr.set(this,{__proto__:null,as:f,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(tr(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(tr(this).c)}get timeout(){return tr(this).timeout}set timeout(e){tr(this).timeout=e}get[ar](){return tr(this).fetch}set[ar](e){tr(this).fetch=e}}function gr(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}
8return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return ct(this)}catch(e){return}}}}}(e))}async function wr(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===e.headers.get("retry-after")||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&Math.ceil(n/1e3)}}if(o&&!Number.isFinite(a))throw new Ee("invalid Retry-After header value",{cause:e});a>t&&await mr(a-t,n)}function mr(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function vr(e,t){Or(e);const n=tr(e),r=n.as,o=n.c,i=n.auth,a=n.fetch,s=n.tlsOnly,c=n.timeout;return async function(e,t,n,r,o){Me(e),Ue(t);const i=Ke(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[ce])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Te(null==o?void 0:o.headers);return s.set("accept","application/json"),ot(e,t,n,i,a,s,o)}(r,o,i,t,{[de]:a,[ce]:!s,headers:new Headers($n),signal:Ir(c)}).then(e=>async function(e,t,n){if(Me(e),Ue(t),!oe(n,Response))throw se('"response" must be an instance of Response',ae);await $e(n,200,"Backchannel Authentication Endpoint"),Dt(n);const r=await Jt(n);Ie(r.auth_req_id,'"response" body "auth_req_id" property',Ot,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Oe(o,!0,'"response" body "expires_in" property',Ot,{body:r}),r.expires_in=o,void 0!==r.interval&&Oe(r.interval,!1,'"response" body "interval" property',Ot,{body:r}),r}(r,o,e)).catch(hr)}async function Ar(e,t,n,r){var o,i;Or(e),new URLSearchParams(n);let a=null!==t.interval&&void 0!==o?o:5;const s=null!==(null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await mr(a,s)}catch(e){hr(e)}const c=tr(e),u=c.as,l=c.c,d=c.auth,h=c.fetch,f=c.tlsOnly,p=c.nonRepudiation,y=c.timeout,g=c.decrypt,w=(o,i)=>Ar(e,k(k({},t),{},{interval:o}),n,k(k({},r),{},{signal:s,flag:i})),m=function(e,t){const n=Ir(t);if(!n)return{signal:e,cleanup(){}};const r=new AbortController,o=e=>{const t=e.target;r.abort(t.reason)};return e.aborted?r.abort(e.reason):n.aborted?r.abort(n.reason):(e.addEventListener("abort",o,{once:!0}),n.addEventListener("abort",o,{once:!0})),{signal:r.signal,cleanup(){e.removeEventListener("abort",o),n.removeEventListener("abort",o)}}}(s,y),v=await async function(e,t,n,r,o){Me(e),Ue(t),Ie(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),it(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(u,l,d,t.auth_req_id,{[de]:h,[ce]:!f,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers($n),signal:m.signal}).catch(hr).finally(m.cleanup);var A;if(503===v.status&&v.headers.has("retry-after"))return await wr(v,a,s,!0),await(null===v.body||void 0===A?void 0:A.cancel()),w(a);const E=async function(e,t,n,r){return ut(e,t,n,void 0,null==r?void 0:r[fe],null==r?void 0:r.recognizedTokenTypes)}(u,l,v,{[fe]:g});let b;try{await E}catch(e){if(Cr(e,r))return w(a,kr);if(e instanceof Fe)switch(e.error){case"slow_down":0;case"authorization_pending":return await wr(e.response,a,s),w(a)}hr(e)}return b.id_token&&await(null==p?void 0:p(v)),gr(b),b}function Er(e){tr(e).tlsOnly=!1}async function br(e,t,n,r,o){if(Or(e),!((null==o?void 0:o.flag)===kr||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw ur('"currentUrl" must be an instance of URL, or Request',cr);let i,a;const s=tr(e),c=s.as,u=s.c,l=s.auth,d=s.fetch,h=s.tlsOnly,f=s.jarm,p=s.hybrid,y=s.nonRepudiation,g=s.timeout,w=s.decrypt,m=s.implicit;if((null==o?void 0:o.flag)===kr)o.authResponse,o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw se("form_post responses are expected to use the POST method",ie,{cause:e});if("application/x-www-form-urlencoded"!==nt(e))throw se("form_post responses are expected to use the application/x-www-form-urlencoded content-type",ie,{cause:e});return async function(e){if(e.bodyUsed)throw se("form_post Request instances must contain a readable body",ie,{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const e of n.entries()){var v=P(e,2);const n=v[0],r=v[1];t.searchParams.append(n,r)}break;default:throw ur("unexpected Request HTTP method",sr)}}switch(function(e){return new URL(e).search="",e.hash="",e.href}(t),!0){case!!f:await f(t,null==n?void 0:n.expectedState);break;case!!p:await p(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!m:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{(function(e,t,n,r){if(Me(e),Ue(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw se('"parameters" must be an instance of URLSearchParams, or URL',ae);if(Ft(n,"response"))throw be('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Ot,{parameters:n});const o=Ft(n,"iss"),i=Ft(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw be('response parameter "iss" (issuer) missing',Ot,{parameters:n});if(o&&o!==e.issuer)throw be('unexpected "iss" (issuer) response parameter value',Ot,{expected:e.issuer,parameters:n});switch(r){case void 0:case Xt:if(void 0!==i)throw be('unexpected "state" response parameter encountered',Ot,{expected:void 0,parameters:n});break;case jt:break;default:if(Ie(r,'"expectedState" argument'),i!==r)throw be(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Ot,{expected:r,parameters:n})}if(Ft(n,"error"))throw new je("authorization response from the server is an error",{cause:n});const a=Ft(n,"id_token"),s=Ft(n,"token");if(void 0!==a||void 0!==s)throw new Ae("implicit and hybrid flows are not supported");return new URLSearchParams(n),yt.add(c),c;var c})(c,u,t.searchParams,null==n?void 0:n.expectedState)}catch(e){hr(e)}}}const A=await async function(e,t,n,r,o,i,a){if(Me(e),Ue(t),!yt.has(r))throw se('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',ie);Ie(o,'"redirectUri"');const s=Ft(r,"code");if(!s)throw be('no authorization code in "callbackParameters"',Ot);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);
8return c.set("redirect_uri",o),c.set("code",s),i!==gt&&(Ie(i,'"codeVerifier"'),c.set("code_verifier",i)),it(e,t,n,"authorization_code",c,a)}(c,u,l,i,a,(null==n?void 0:n.pkceCodeVerifier)||gt,{additionalParameters:r,[de]:d,[ce]:!h,DPoP:null==o?void 0:o.DPoP,headers:new Headers($n),signal:Ir(g)}).catch(hr);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const E=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:0;break;case vt:break;default:Ie(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case At:break;default:Oe(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await ut(e,t,n,s,i,a);Ie(c.id_token,'"response" body "id_token" property',Ot,{body:c});const u=ct(c);if(o!==At){const e=xe()+Le(t),n=Pe(t);if(u.auth_time+o<e-n)throw be("too much time has elapsed since the last End-User authentication",Lt,{claims:u,now:e,tolerance:n,claim:"auth_time"})}if(r===vt){if(void 0!==u.nonce)throw be('unexpected ID Token "nonce" claim value',Pt,{expected:void 0,claims:u,claim:"nonce"})}else if(u.nonce!==r)throw be('unexpected ID Token "nonce" claim value',Pt,{expected:r,claims:u,claim:"nonce"});return c}(e,t,n,r.expectedNonce,r.maxAge,r[fe],r.recognizedTokenTypes):async function(e,t,n,r,o){const i=await ut(e,t,n,void 0,r,o),a=ct(i);if(a){if(void 0!==t.default_max_age){Oe(t.default_max_age,!0,'"client.default_max_age"');const e=xe()+Le(t),n=Pe(t);if(a.auth_time+t.default_max_age<e-n)throw be("too much time has elapsed since the last End-User authentication",Lt,{claims:a,now:e,tolerance:n,claim:"auth_time"})}if(void 0!==a.nonce)throw be('unexpected ID Token "nonce" claim value',Pt,{expected:void 0,claims:a,claim:"nonce"})}return i}(e,t,n,null==r?void 0:r[fe],null==r?void 0:r.recognizedTokenTypes)}(c,u,A,{expectedNonce:null==n?void 0:n.expectedNonce,maxAge:null==n?void 0:n.maxAge,requireIdToken:null==n?void 0:n.idTokenExpected,[fe]:w});let b;try{await E}catch(t){if(Cr(t,o))return br(e,void 0,n,r,k(k({},o),{},{flag:kr,authResponse:i,redirectUri:a}));hr(t)}return b.id_token&&await(null==y?void 0:y(A)),gr(b),b}async function Sr(e,t,n,r){Or(e),new URLSearchParams(n);const o=tr(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.nonRepudiation,d=o.timeout,h=o.decrypt,f=await async function(e,t,n,r,o){Me(e),Ue(t),Ie(r,'"refreshToken"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("refresh_token",r),it(e,t,n,"refresh_token",i,o)}(i,a,s,t,{[de]:c,[ce]:!u,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers($n),signal:Ir(d)}).catch(hr),p=async function(e,t,n,r){return ut(e,t,n,void 0,null==r?void 0:r[fe],null==r?void 0:r.recognizedTokenTypes)}(i,a,f,{[fe]:h});let y;try{await p}catch(o){if(Cr(o,r))return Sr(e,t,n,k(k({},r),{},{flag:kr}));hr(o)}return y.id_token&&await(null==l?void 0:l(f)),gr(y),y}async function Tr(e,t,n){Or(e),new URLSearchParams(t);const r=tr(e),o=r.as,i=r.c,a=r.auth,s=r.fetch,c=r.tlsOnly,u=r.timeout,l=await async function(e,t,n,r,o){return Me(e),Ue(t),it(e,t,n,"client_credentials",new URLSearchParams(r),o)}(o,i,a,t,{[de]:s,[ce]:!c,DPoP:null==n?void 0:n.DPoP,headers:new Headers($n),signal:Ir(u)}).catch(hr),d=async function(e,t,n){return ut(e,t,n,void 0,void 0,void 0)}(o,i,l);let h;try{await d}catch(r){if(Cr(r,n))return Tr(e,t,k(k({},n),{},{flag:kr}));hr(r)}return gr(h),h}function _r(e,t){Or(e);const n=tr(e),r=n.as,o=n.c,i=n.tlsOnly,a=n.hybrid,s=n.jarm,c=n.implicit,u=Ke(r,"authorization_endpoint",!1,i);if(new URLSearchParams(t).has("client_id")||t.set("client_id",o.client_id),!t.has("request_uri")&&!t.has("request")){if(t.has("response_type")||t.set("response_type",a?"code id_token":c?"id_token":"code"),c&&!t.has("nonce"))throw ur("response_type=id_token clients must provide a nonce parameter in their authorization request parameters",sr);s&&t.set("response_mode","jwt")}for(const e of t.entries()){var l=P(e,2);const t=l[0],n=l[1];u.searchParams.append(t,n)}return u}async function Rr(e,t,n){Or(e);const r=_r(e,t),o=tr(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.timeout,d=await async function(e,t,n,r,o){var i;Me(e),Ue(t);const a=Ke(e,"pushed_authorization_request_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[ce])),s=new URLSearchParams(r);s.set("client_id",t.client_id);const c=Te(null==o?void 0:o.headers);c.set("accept","application/json"),void 0!==(null==o?void 0:o.DPoP)&&(et(o.DPoP),await o.DPoP.addProof(a,c,"POST"));const u=await ot(e,t,n,a,s,c,o);return null==o||null===o.DPoP||void 0===i||i.cacheNonce(u,a),u}(i,a,s,r.searchParams,{[de]:c,[ce]:!u,DPoP:null==n?void 0:n.DPoP,headers:new Headers($n),signal:Ir(l)}
8).catch(hr),h=async function(e,t,n){if(Me(e),Ue(t),!oe(n,Response))throw se('"response" must be an instance of Response',ae);await $e(n,201,"Pushed Authorization Request Endpoint"),Dt(n);const r=await Jt(n);Ie(r.request_uri,'"response" body "request_uri" property',Ot,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Oe(o,!0,'"response" body "expires_in" property',Ot,{body:r}),r.expires_in=o,r}(i,a,d);let f;try{await h}catch(r){if(Cr(r,n))return Rr(e,t,k(k({},n),{},{flag:kr}));hr(r)}return _r(e,{request_uri:f.request_uri})}function Or(e){if(!(e instanceof yr))throw ur('"config" must be an instance of Configuration',cr);if(Object.getPrototypeOf(e)!==yr.prototype)throw ur("subclassing Configuration is not allowed",sr)}function Ir(e){return e?AbortSignal.timeout(1e3*e):void 0}async function Nr(e,t,n,r){Or(e);const o=tr(e),i=o.as,a=o.c,s=o.fetch,c=o.tlsOnly,u=o.nonRepudiation,l=o.timeout,d=o.decrypt,h=await async function(e,t,n,r){Me(e),Ue(t);const o=Ke(e,"userinfo_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==r?void 0:r[ce])),i=Te(null==r?void 0:r.headers);return t.userinfo_signed_response_alg?i.set("accept","application/jwt"):(i.set("accept","application/json"),i.append("accept","application/jwt")),async function(e,t,n,r,o,i){var a;if(Ie(e,'"accessToken"'),!(n instanceof URL))throw se('"url" must be an instance of URL',ae);Ge(n,!0!==(null==i?void 0:i[ce])),Te(r),null!=i&&i.DPoP&&(et(i.DPoP),await i.DPoP.addProof(n,r,"GET".toUpperCase(),e)),r.set("authorization","".concat(r.has("dpop")?"DPoP":"Bearer"," ").concat(e));const s=await((null==i?void 0:i[de])||fetch)(n.href,{duplex:oe(null,ReadableStream)?"half":void 0,body:null,headers:Object.fromEntries(r.entries()),method:"GET",redirect:"manual",signal:_e(n,null==i?void 0:i.signal)});return null==i||null===i.DPoP||void 0===a||a.cacheNonce(s,n),s}(n,0,o,i,0,k(k({},r),{},{[ue]:Le(t)}))}(i,a,t,{[de]:s,[ce]:!c,DPoP:null==r?void 0:r.DPoP,headers:new Headers($n),signal:Ir(l)}).catch(hr);let f,p=rt(i,a,n,h,{[fe]:d});try{await p}catch(o){if(Cr(o,r))return Nr(e,t,n,k(k({},r),{},{flag:kr}));hr(o)}return"application/jwt"===nt(h)&&await(null==u?void 0:u(h)),f}function Cr(e,t){return!(null==t||!t.DPoP||t.flag===kr)&&function(e){if(e instanceof Xe){const t=e.cause,n=t[0];return 1===t.length&&"dpop"===n.scheme&&"use_dpop_nonce"===n.parameters.error}return e instanceof Fe&&"use_dpop_nonce"===e.error}(e)}Object.freeze(yr.prototype);const kr=Symbol();async function Lr(e,t,n,r){Or(e);const o=tr(e),i=o.as,a=o.c,s=o.auth,c=o.fetch,u=o.tlsOnly,l=o.timeout,d=o.decrypt,h=o.nonRepudiation,f=await async function(e,t,n,r,o,i){return Me(e),Ue(t),Ie(r,'"grantType"'),it(e,t,n,r,new URLSearchParams(o),i)}(i,a,s,t,new URLSearchParams(n),{[de]:c,[ce]:!u,DPoP:null==r?void 0:r.DPoP,headers:new Headers($n),signal:Ir(l)}).catch(hr);let p;"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(p={n_a:()=>{}});const y=async function(e,t,n,r){return ut(e,t,n,void 0,null==r?void 0:r[fe],null==r?void 0:r.recognizedTokenTypes)}(i,a,f,{[fe]:d,recognizedTokenTypes:p});let g;try{g=await y}catch(o){if(Cr(o,r))return Lr(e,t,n,k(k({},r),{},{flag:kr}));hr(o)}return g.id_token&&await(null==h?void 0:h(f)),gr(g),g}async function Pr(e,t,n){return t instanceof Uint8Array?crypto.subtle.importKey("raw",t,e.subtle,!1,[n]):(function(e,t,n){var r;const o=e.algorithm;if(o.name!==t.name)throw en(t.name);if(t.hash&&(null===(r=o.hash)||void 0===r?void 0:r.name)!==t.hash)throw en(t.hash,"algorithm.hash");if(t.namedCurve&&o.namedCurve!==t.namedCurve)throw en(t.namedCurve,"algorithm.namedCurve");if(void 0!==t.length&&o.length!==t.length)throw en(t.length,"algorithm.length");!function(e,t){if(t&&!e.usages.includes(t))throw new TypeError("CryptoKey does not support this operation, its usages must include ".concat(t,"."))}(e,n)}(t,e.subtle,n),e.minRsaBits&&function(e,t){const n=t.algorithm.modulusLength;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}(e.alg,t),t)}const xr=[["verify"],["sign"]];function Mr(e){const t={name:"HMAC",hash:"SHA-".concat(e)};return{kty:["oct"],secret:!0,subtle:t,signing:t,usages:xr}}function Ur(e,t){const n={name:t?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e)};return{kty:["RSA"],subtle:n,signing:t?k(k({},n),{},{saltLength:t}):n,usages:xr,minRsaBits:2048}}function Br(e,t){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:"SHA-".concat(t)},usages:xr}}function Dr(){const e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:xr}}function Hr(e){const t={name:"ML-DSA-".concat(e)};return{kty:["AKP"],subtle:t,signing:t,usages:xr}}const Gr=Un({HS256:Mr(256),HS384:Mr(384),HS512:Mr(512),RS256:Ur(256),RS384:Ur(384),RS512:Ur(512),PS256:Ur(256,32),PS384:Ur(384,48),PS512:Ur(512,64),ES256:Br("P-256",256),ES384:Br("P-384",384),ES512:
8Br("P-521",512),EdDSA:Dr(),Ed25519:Dr(),"ML-DSA-44":Hr(44),"ML-DSA-65":Hr(65),"ML-DSA-87":Hr(87)});function Wr(e){const t="string"==typeof e?Gr[e]:void 0;if(!t)throw new sn("alg ".concat(e," is not supported either by JOSE or your javascript runtime"));return t}async function Kr(e,t,n){if(e instanceof Uint8Array&&qt.decode(e),"string"!=typeof e)throw new cn("Compact JWS must be a string or Uint8Array");const r=e.split("."),o=r[0],i=r[1],a=r[2];if(3!==r.length)throw new cn("Invalid Compact JWS");const s={payload:i,protected:o,signature:a},c=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0===e?{}:function(e,t,n){let r;try{JSON.parse(Zt.decode(mn(e)))}catch(e){throw new t(n)}if(!An(r))throw new t(n);return r}(e,cn,"JWS Protected Header is invalid");return t}(o),u=function(e,t,n){const r=qn(e,zn(cn,Vn,n[1],e,t)),o=t.alg;if("string"!=typeof o||!o)throw new cn('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(n[0]&&!n[0].has(o))throw new an('"alg" (Algorithm) Header Parameter value not allowed');return[r,o]}(c,c,t),l=P(u,2),d=l[0],h=l[1],f=d?i:function(e){try{return $t(e)}catch(e){throw new cn("JWS Compact Serialization payload must use only ASCII characters")}}(i);return async function(e,t,n,r,o,i,a){var s;let c=!1;"function"==typeof n&&(await n(o,e),!0);const u="string"==typeof a,l=Wr(i),d=Qt(void 0!==r?$t(r):new Uint8Array,$t("."),u?null!==t[2]&&void 0!==s?s:t[2]=function(e,t,n){try{return $t(e)}catch(e){throw new n("The ".concat("payload"," is not a valid base64url string"))}}(a,0,cn):a),h=bn(e.signature,"signature",cn),f=await Mn(l,n,"verify");if(!await async function(e,t,n,r){const o=await Pr(e,t,"verify");try{return await crypto.subtle.verify(e.signing,o,n,r)}catch(e){return!1}}(l,f,h,d))throw new pn;return[u?bn(a,"payload",cn):a,o,u,f,c]}(s,t,n,o,c,h,f)}const Fr=e=>Math.floor(e.getTime()/1e3),jr={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},Xr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Jr="check_failed";function Vr(){throw new TypeError("Invalid time period format")}function Yr(e){"string"!=typeof e&&Vr();const t=Xr.exec(e);(!t||t[4]&&t[1])&&Vr();const n=parseFloat(t[2]),r=Math.round(n*jr[t[3][0].toLowerCase()]);return Number.isFinite(r)||Vr(),"-"===t[1]||"ago"===t[4]?-r:r}function zr(e,t){if(!Number.isFinite(t))throw new TypeError("Invalid ".concat(e," input"));return t}function qr(e,t){if("string"!=typeof t)throw new TypeError('"'.concat(e,'" claim must be a string'))}function Zr(e,t){return"number"==typeof e?zr(t,e):e instanceof Date?zr(t,Fr(e)):Fr(new Date)+Yr(e)}const Qr=e=>{const t=e.toLowerCase();return e.includes("/")?t:"application/".concat(t)};function $r(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e[t];if(void 0!==r||n){if("number"!=typeof r)throw new rn('"'.concat(t,'" claim must be a number'),e,t,"invalid");return r}}function eo(e,t){throw new rn('unexpected "'.concat(t,'" claim value'),e,t,Jr)}function to(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(Zt.decode(t))}catch(e){}if(!An(n))throw new un("JWT Claims Set must be a top-level JSON object");const o=r.typ;if(void 0!==o&&("string"!=typeof e.typ||Qr(e.typ)!==Qr(o)))throw new rn('unexpected "typ" JWT header value',n,"typ",Jr);const i=r.requiredClaims,a=void 0===i?[]:i,s=r.issuer,c=r.subject,u=r.audience,l=r.maxTokenAge,d=[...a];void 0!==l&&d.push("iat"),void 0!==u&&d.push("aud"),void 0!==c&&d.push("sub"),void 0!==s&&d.push("iss");for(const e of new Set(d.reverse()))if(!Object.hasOwn(n,e))throw new rn('missing required "'.concat(e,'" claim'),n,e,"missing");var h,f;void 0===s||(Array.isArray(s)?s:[s]).includes(n.iss)||eo(n,"iss"),void 0!==c&&n.sub!==c&&eo(n,"sub"),void 0===u||("string"==typeof n.aud?f.includes(h):Array.isArray(h)&&f.some(e=>h.includes(e)))||eo(n,"aud");const p=r.clockTolerance;let y=0;if("string"==typeof p)Yr(p);else if(void 0!==p){if("number"!=typeof p)throw new TypeError("Invalid clockTolerance option type");0}zr("clockTolerance option",y);const g=r.currentDate,w=zr("currentDate option",Fr(void 0===g?new Date:g)),m=$r(n,"iat",void 0!==l),v=$r(n,"nbf");if(void 0!==v&&v>w+y)throw new rn('"nbf" claim timestamp check failed',n,"nbf",Jr);const A=$r(n,"exp");if(void 0!==A&&A<=w-y)throw new on('"exp" claim timestamp check failed',n,"exp",Jr);if(void 0!==l){const e=w-m;if(e-y>zr("maxTokenAge option","number"==typeof l?l:Yr(l)))throw new on('"iat" claim timestamp check failed (too far in the past)',n,"iat",Jr);if(e<-y)throw new rn('"iat" claim timestamp check failed (it should be in the past)',n,"iat",Jr)}return n}let no;function ro(e){return no.get(e)}async function oo(e,t,n,r,o){const i=P(function(e){if(void 0===e)return[void 0,""];const t=function(e,t){let n,r;try{n=JSON.stringify(t),r=JSON.parse(n)}
8catch(t){throw new e("JOSE Header is not valid JSON",{cause:t})}if(!An(r))throw new e("JOSE Header is not a JSON object");return[r,n]}(cn,e);return[t[0],vn(t[1])]}(t),2),a=i[0],s=i[1];if(!a)throw new cn("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");(function(e,t,n){return function(e,t){const n=(null!=t?t:{}).crit;if(Array.isArray(n)&&new Set(n).size!==n.length)throw new e('"crit" (Critical) Header Parameter MUST NOT contain duplicate values')}(cn,e),qn(e,zn(cn,Vn,n,e,t))})(a,a,n)||o();const c=function(e){const t=e.alg;if("string"!=typeof t||!t)throw new cn('JWS "alg" (Algorithm) Header Parameter missing or invalid');return Wr(t)}(a),u=vn(e),l=await async function(e,t,n,r){const o=Qt($t(e),$t("."),t),i=await Mn(n,r,"sign");return vn(await async function(e,t,n){const r=await Pr(e,t,"sign"),o=await crypto.subtle.sign(e.signing,r,n);return new Uint8Array(o)}(n,i,o))}(s,$t(u),c,r);return"".concat(s,".").concat(u,".").concat(l)}const io=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!An(e))throw new TypeError("JWT Claims Set MUST be an object");(no||(no=new WeakMap)).set(this,structuredClone(e))}setIssuer(e){return qr("iss",e),ro(this).iss=e,this}setSubject(e){return qr("sub",e),ro(this).sub=e,this}setAudience(e){return function(e){if("string"!=typeof e&&(!Array.isArray(e)||Array.from(e).some(e=>"string"!=typeof e)))throw new TypeError('"aud" claim must be a string or an array of strings')}(e),ro(this).aud=e,this}setJti(e){return qr("jti",e),ro(this).jti=e,this}setNotBefore(e){return ro(this).nbf=Zr(e,"setNotBefore"),this}setExpirationTime(e){return ro(this).exp=Zr(e,"setExpirationTime"),this}setIssuedAt(e){return ro(this).iat=void 0===e?Fr(new Date):"string"==typeof e?zr("setIssuedAt",Fr(new Date)+Yr(e)):Zr(e,"setIssuedAt"),this}};var ao=new WeakMap;class so extends io{constructor(){super(...arguments),R(this,ao,void 0)}setProtectedHeader(e){return function(e){if(void 0!==e)throw new TypeError("".concat("setProtectedHeader"," can only be called once"))}(_(ao,this)),O(ao,this,e),this}async sign(e,t){return oo(function(e){const t=ro(e);for(const e of["iat","nbf","exp"]){const n=t[e];if("number"==typeof n&&!Number.isFinite(n))throw new TypeError('"'.concat(e,'" claim must be a finite number'))}return zt.encode(JSON.stringify(t))}(this),_(ao,this),null==t?void 0:t.crit,e,()=>{throw new un("JWTs MUST NOT use unencoded payload")})}}const co='"alg" (Algorithm)';function uo(){throw new sn("Invalid or unsupported ".concat(arguments.length>0&&void 0!==arguments[0]?arguments[0]:'JWK "alg" (Algorithm) Parameter'," value"))}const lo=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0},ho=e=>{const t=e.data[e.pos++];if(void 0===t)throw new Error("Unexpected end of ASN.1 input");return t},fo=e=>{const t=ho(e);if(128&t){const n=127&t;let r=0;for(let t=0;t<n;t++)r=r<<8|ho(e);return r}return t},po=(e,t,n)=>{if(ho(e)!==t)throw new Error(n)},yo=(e,t)=>{if(t<0||e.pos+t>e.data.length)throw new Error("Unexpected end of ASN.1 input");const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},go=e=>{const t=(e=>{po(e,6,"Expected algorithm OID");const t=fo(e);return yo(e,t)})(e);if(lo(t,[43,101,110]))return"X25519";if(!lo(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");po(e,6,"Expected curve OID");const n=fo(e),r=yo(e,n);if(lo(r,[42,134,72,206,61,3,1,7]))return"P-256";if(lo(r,[43,129,4,0,34]))return"P-384";if(lo(r,[43,129,4,0,35]))return"P-521";throw new Error("Unsupported named curve")},wo=(e,t,n)=>{const r=(e=>gn(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);return(async(e,t,n,r)=>{const o=function(e){if(void 0!==e&&"boolean"!=typeof e)throw new TypeError('"extractable" option must be a boolean');return e}(null==r?void 0:r.extractable),i=function(e,t){var n,r;return null!==(n="string"==typeof e?null!==(r=Gr[e])&&void 0!==r?r:jn[e]:void 0)&&void 0!==n?n:uo(t)}(n,co);i.secret&&uo(co);const a="spki"===e;let s;if(i.resolve)try{const n={data:t,pos:0};!function(e,t){if(po(e,48,"Invalid ".concat("spki"===t?"SPKI":"PKCS#8"," structure")),fo(e),"pkcs8"===t){po(e,2,"Expected version field");const t=fo(e);e.pos+=t}po(e,48,"Expected algorithm identifier"),fo(e)}(n,e),s=i.resolve({crv:go(n)})}catch(e){throw new sn("Invalid or unsupported key format")}else s=i.subtle;return crypto.subtle.importKey(e,t,s,null!=o?o:a,i.usages[a?0:1])})("pkcs8",r,t,n)};async function mo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t),o=n.alg;if(void 0===r[o]){const e=await Sn(n,k(k({},t),{},{alg:o,ext:!0}));if("public"!==e.type)throw new ln("JSON Web Key Set members must be public keys");r[o]=e}return r[o]}function vo(e){let t;try{structuredClone(e)}catch(e){}if(!En(t))throw new ln("JSON Web Key Set malformed");const n=new WeakMap;return Object.defineProperty(async(e,r)=>{const o=k(k({},e),null==r?void 0:r.header),i=o.alg,a=o.kid,s="string"==typeof i?Gr[i]:void 0;if(!s||s.secret)throw new sn('Unsupported "alg" value for a JSON Web Key Set');const c=t.keys.filter(e=>function(e,t,n,r){const o=Tn(e),i=o.kty,a=o.key_ops,s=o.ext,c=o.kid,u=o.alg,l=o.use,d=o.crv,h=Array.isArray(a)?[...a]:a;return(void 0===s||"boolean"==typeof s)&&(void 0===h||Array.isArray(h)&&h.every((e,t)=>"string"==typeof e&&h.indexOf(e)===t)&&h.includes("verify"))&&t.kty.includes(i)&&(void 0===r||"string"==typeof r&&r===c)&&(void 0===u?"AKP"!==i:n===u)&&(void 0===l||"sig"===l)&&(!t.crv||d===t.crv)}(e,s,i,a)),u=c[0],l=c.length;if(!l)throw new dn;if(1!==l){const e=new hn;throw e[Symbol.asyncIterator]=x(function*(){for(const e of c)try{yield yield S(mo(n,e,s))}catch(e){}}),e}return mo(n,u,s)},"jwks",{value:()=>structuredClone(t)})}var Ao,Eo;let bo;
8if("undefined"==typeof navigator||null===(Ao=navigator.userAgent)||void 0===Ao||null===(Eo=Ao.startsWith)||void 0===Eo||!Eo.call(Ao,"Mozilla/5.0 ")){const e="v6.2.10";bo="".concat("jose","/").concat(e)}const So=Symbol(),To=Symbol();function _o(e,t){return Number.isFinite(e)&&Date.now()<e+t}function Ro(e,t,n){if(Number.isNaN(e))throw new TypeError('"'.concat(n,'" option must not be NaN'));return"number"==typeof e?e:t}async function Oo(e,t,n){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return wo(e,t,n)}const Io=["mfaToken"],No=["mfaToken"];var Co,ko,Lo,Po,xo,Mo,Uo,Bo,Do,Ho,Go,Wo,Ko,Fo,jo,Xo,Jo,Vo,Yo,zo,qo,Zo,Qo,$o,ei,ti,ni,ri,oi,ii,ai,si,ci,ui,li,di,hi,fi,pi,yi,gi,wi,mi,vi,Ai,Ei,bi,Si,Ti,_i,Ri,Oi;function Ii(e){if("object"!=typeof e||null===e)return{};const t=e;return{statusCode:"number"==typeof t.statusCode?t.statusCode:void 0,headers:t.headers instanceof Headers?t.headers:void 0,body:"string"==typeof t.body?t.body:void 0}}function Ni(e){var t,n;if("object"!=typeof e||null===e)return{error:"unknown_error",error_description:String(e)};const r=e;let o;if(r.response instanceof Response)try{o=new Headers(r.response.headers),o.delete("set-cookie")}catch(e){o=void 0}const i={error:null!==(t=r.error)&&void 0!==t?t:"",error_description:null!==(n=r.error_description)&&void 0!==n?n:"",message:r.message,statusCode:"number"==typeof r.status?r.status:void 0,headers:o};if("mfa_required"===r.error&&r.cause){i.mfa_token="string"==typeof r.cause.mfa_token?r.cause.mfa_token:void 0;const e=r.cause.mfa_requirements;"object"==typeof e&&null!==e&&(i.mfa_requirements=e)}return i}var Ci=class extends Error{constructor(e,t){super(t),N(this,"code",void 0),this.name="NotSupportedError",this.code=e}},ki=class extends Error{constructor(e,t,n){super(t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"statusCode",void 0),N(this,"headers",void 0),N(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements};const r=Ii(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Li=class extends ki{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Pi=class extends ki{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},xi=class extends ki{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Mi=class extends ki{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ui=class extends ki{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Bi=class extends ki{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Di=class extends ki{constructor(e,t){super("token_revocation_error",e,t),this.name="TokenRevocationError"}},Hi=class extends ki{constructor(e,t){super("user_info_error",e,t),this.name="UserInfoError"}},Gi=class extends Error{constructor(e){super(e),N(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Wi=class extends ki{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),N(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Ki=class extends ki{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Fi=class extends ki{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ji=class extends ki{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Xi=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),N(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}}
8,Ji=class extends Error{constructor(e){super(e),N(this,"code","organization_validation_error"),this.name="OrganizationValidationError"}},Vi=class extends Error{constructor(e){super(e||"fullResponse: true requested but no HTTP Response was captured. This is a bug in CapturingFetch."),N(this,"code","missing_captured_response_error"),this.name="MissingCapturedResponseError"}};function Yi(e){try{const t=new Headers(e);return t.delete("set-cookie"),t}catch(e){return new Headers}}function zi(e,t,n){var r;const o="object"==typeof t&&null!==t?t:void 0,i=null!==(r=null==o?void 0:o.response)&&void 0!==r?r:n,a="number"==typeof(null==o?void 0:o.status)?o.status:null==i?void 0:i.status;"number"==typeof a&&(e.statusCode=a),null!=i&&i.headers&&(e.headers=Yi(i.headers))}function qi(e){return Object.entries(e).filter(e=>void 0!==P(e,2)[1]).reduce((e,t)=>k(k({},e),{},{[t[0]]:t[1]}),{})}function Zi(e){if(!e.trim())throw new Ji("organization must not be blank")}function Qi(e,t){if(!e)return;const n=t.trim();if(n.startsWith("org_")){const t=e.org_id;if("string"!=typeof t)throw new Ji("Organization Id (org_id) claim must be a string present in the ID token");if(t!==n)throw new Ji('Organization Id (org_id) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}else{const t=e.org_name;if("string"!=typeof t)throw new Ji("Organization Name (org_name) claim must be a string present in the ID token");if(t.toLowerCase()!==n.toLowerCase())throw new Ji('Organization Name (org_name) claim value mismatch in the ID token; expected "'.concat(n,'", found "').concat(t,'"'))}}var $i=class extends Error{constructor(e,t,n){super(t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"statusCode",void 0),N(this,"headers",void 0),N(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ii(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},ea=class extends $i{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},ta=class extends $i{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},na=class extends $i{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},ra=class extends $i{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}},oa=class extends $i{constructor(e,t){super("mfa_verify_error",e,t),this.name="MfaVerifyError"}};function ia(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var aa=class e{constructor(e,t,n,r,o,i,a){N(this,"accessToken",void 0),N(this,"idToken",void 0),N(this,"refreshToken",void 0),N(this,"expiresAt",void 0),N(this,"scope",void 0),N(this,"claims",void 0),N(this,"authorizationDetails",void 0),N(this,"tokenType",void 0),N(this,"issuedTokenType",void 0),N(this,"recoveryCode",void 0),N(this,"act",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}};function sa(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,k(k({},n),{},{headers:o}))}}function ca(e){var t,n;return!1===(null==e?void 0:e.enabled)?e:{enabled:!0,name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"@auth0/auth0-auth-js",version:null!==(n=null==e?void 0:e.version)&&void 0!==n?n:"1.15.0"}}function ua(e){let t;const n=async(n,r)=>{const o=await e(n,r);return t=o.clone(),o};return n.getCapturedResponse=()=>t,n}function la(e,t,n){if(!t)return e;const r=t.signal,o=t.headers,i=t.customFetch,a=i?sa(i,n):e;return r||o?async(e,t)=>{const n=o?new Headers(e instanceof Request?e.headers:void 0):void 0;
8if(n&&null!=t&&t.headers&&new Headers(t.headers).forEach((e,t)=>n.set(t,e)),o)for(const e of Object.entries(o)){var i=P(e,2);const t=i[0],r=i[1],o=t.toLowerCase();"authorization"!==o&&"auth0-client"!==o&&n.set(t,r)}const s=function(e,t){if(!e)return{signal:null!=t?t:void 0};if(!t)return{signal:e};if("undefined"!=typeof AbortSignal&&"function"==typeof AbortSignal.any)return{signal:AbortSignal.any([e,t])};const n=new AbortController,r=[e,t],o=r.find(e=>e.aborted);if(o)return n.abort(o.reason),{signal:n.signal};const i=[],a=()=>{r.forEach((e,t)=>{const n=i[t];n&&e.removeEventListener("abort",n)})};return r.forEach((e,t)=>{const r=()=>{a(),n.abort(e.reason)};i[t]=r,e.addEventListener("abort",r,{once:!0})}),{signal:n.signal,cleanup:a}}(r,null==t?void 0:t.signal);try{return await a(e,k(k(k({},t),n&&{headers:n}),{},{signal:s.signal}))}finally{var c;null===(c=s.cleanup)||void 0===c||c.call(s)}}:a}var da={otp:"http://auth0.com/oauth/grant-type/mfa-otp",oob:"http://auth0.com/oauth/grant-type/mfa-oob","recovery-code":"http://auth0.com/oauth/grant-type/mfa-rec
8overy-code"},ha=(Co=new WeakMap,ko=new WeakMap,Lo=new WeakMap,Po=new WeakMap,xo=new WeakMap,Mo=new WeakMap,Uo=new WeakMap,Bo=new WeakSet,class{constructor(e){var t,n;I(this,Bo),R(this,Co,void 0),R(this,ko,void 0),R(this,Lo,void 0),R(this,Po,void 0),R(this,xo,void 0),R(this,Mo,void 0),R(this,Uo,void 0),O(Co,this,"https://".concat(e.domain)),O(ko,this,e.clientId),O(Lo,this,e.clientSecret),O(Po,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),O(xo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ca()),O(Mo,this,e.getConfiguration),O(Uo,this,e.createCaptureConfiguration)}async listAuthenticators(e,t){const n="".concat(_(Co,this),"/mfa/authenticators"),r=e.mfaToken,o=await b(Bo,this,fa).call(this,t)(n,{method:"GET",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(!o.ok){const e=await o.clone().text(),t=o.status,n=Yi(o.headers);let i;try{i=JSON.parse(e)}catch(r){throw new ea("Failed to list authenticators",{error:"unknown_error",error_description:"Failed to list authenticators",statusCode:t,headers:n,body:e})}throw new ea(i.error_description||"Failed to list authenticators",k(k({},i),{},{statusCode:t,headers:n,body:e}))}return(await o.json()).map(ia)}async enrollAuthenticator(e,t){const n="".concat(_(Co,this),"/mfa/associate"),r=e.mfaToken,o=L(e,Io),i={authenticator_types:o.authenticatorTypes};"oobChannels"in o&&(i.oob_channels=o.oobChannels),"phoneNumber"in o&&o.phoneNumber&&(i.phone_number=o.phoneNumber),"email"in o&&o.email&&(i.email=o.email);const a=await b(Bo,this,fa).call(this,t)(n,{method:"POST",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Yi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new ta("Failed to enroll authenticator",{error:"unknown_error",error_description:"Failed to enroll authenticator",statusCode:t,headers:n,body:e})}throw new ta(o.error_description||"Failed to enroll authenticator",k(k({},o),{},{statusCode:t,headers:n,body:e}))}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await a.json())}async deleteAuthenticator(e,t){const n=e.authenticatorId,r=e.mfaToken,o="".concat(_(Co,this),"/mfa/authenticators/").concat(encodeURIComponent(n)),i=await b(Bo,this,fa).call(this,t)(o,{method:"DELETE",headers:{Authorization:"Bearer ".concat(r),"Content-Type":"application/json"}});if(!i.ok){const e=await i.clone().text(),t=i.status,n=Yi(i.headers);let o;try{o=JSON.parse(e)}catch(r){throw new na("Failed to delete authenticator",{error:"unknown_error",error_description:"Failed to delete authenticator",statusCode:t,headers:n,body:e})}throw new na(o.error_description||"Failed to delete authenticator",k(k({},o),{},{statusCode:t,headers:n,body:e}))}}async challengeAuthenticator(e,t){const n="".concat(_(Co,this),"/mfa/challenge"),r=e.mfaToken,o=L(e,No),i={mfa_token:r,client_id:_(ko,this),challenge_type:o.challengeType};_(Lo,this)&&(i.client_secret=_(Lo,this)),o.authenticatorId&&(i.authenticator_id=o.authenticatorId);const a=await b(Bo,this,fa).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!a.ok){const e=await a.clone().text(),t=a.status,n=Yi(a.headers);let o;try{o=JSON.parse(e)}catch(r){throw new ra("Failed to challenge authenticator",{error:"unknown_error",error_description:"Failed to challenge authenticator",statusCode:t,headers:n,body:e})}throw new ra(o.error_description||"Failed to challenge authenticator",k(k({},o),{},{statusCode:t,headers:n,body:e}))}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await a.json())}async verify(e,t){if(!_(Mo,this))throw new Error("MFA verify requires a configuration provider (getConfiguration was not set)");const n={mfa_token:e.mfaToken};if(e.audience&&(n.audience=e.audience),"otp"===e.factorType?n.otp=e.otp:"oob"===e.factorType?(n.oob_code=e.oobCode,e.bindingCode&&(n.binding_code=e.bindingCode)):"recovery-code"===e.factorType&&(n.recovery_code=e.recoveryCode),e.fullResponse){var r;if(!_(Uo,this))throw new Error("MFA verify fullResponse requires a capture-config factory (createCaptureConfiguration was not set)");const s=ua(null!==(r=(await _(Mo,this).call(this,t))[ar])&&void 0!==r?r:fetch),c=await _(Uo,this).call(this,s);
8try{const t=await Lr(c,da[e.factorType],n),r=aa.fromTokenEndpointResponse(t);t.recovery_code&&(r.recoveryCode=t.recovery_code);const o=s.getCapturedResponse();if(!o)throw new Vi;return{data:r,response:o}}catch(e){var o,i,a;if(e instanceof Vi)throw e;if(e instanceof oa)throw e;const t=e,n=new oa(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(o=t.error)&&void 0!==o?o:"mfa_verify_error",error_description:null!==(i=null!==(a=t.error_description)&&void 0!==a?a:t.message)&&void 0!==i?i:"Failed to verify MFA challenge"});throw zi(n,e,s.getCapturedResponse()),n}}const s=await _(Mo,this).call(this,t);try{const t=await Lr(s,da[e.factorType],n),r=aa.fromTokenEndpointResponse(t);return t.recovery_code&&(r.recoveryCode=t.recovery_code),r}catch(e){var c,u,l;if(e instanceof oa)throw e;const t=e,n=new oa(t.error_description||t.message||"Failed to verify MFA challenge",{error:null!==(c=t.error)&&void 0!==c?c:"mfa_verify_error",error_description:null!==(u=null!==(l=t.error_description)&&void 0!==l?l:t.message)&&void 0!==u?u:"Failed to verify MFA challenge"});throw zi(n,e),n}}});function fa(e){return la(_(Po,this),e,_(xo,this))}var pa=class extends Error{constructor(e,t,n){super(t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"statusCode",void 0),N(this,"headers",void 0),N(this,"body",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ii(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},ya=class extends pa{constructor(e,t){super("passkey_register_error",e,t),this.name="PasskeyRegisterError"}},ga=class extends pa{constructor(e,t){super("passkey_challenge_error",e,t),this.name="PasskeyChallengeError"}},wa=class extends pa{constructor(e,t){super("passkey_get_token_error",e,t),this.name="PasskeyGetTokenError",this.cause=t&&{error:t.error,error_description:t.error_description,message:t.message,mfa_token:t.mfa_token,mfa_requirements:t.mfa_requirements}}};function ma(e){return e.useMtls?{}:e.clientSecret?{client_secret:e.clientSecret}:{}}var va="urn:okta:params:oauth:grant-type:webauthn",Aa=(Do=new WeakMap,Ho=new WeakMap,Go=new WeakMap,Wo=new WeakMap,Ko=new WeakMap,Fo=new WeakMap,jo=new WeakSet,class{constructor(e){var t,n;I(this,jo),R(this,Do,void 0),R(this,Ho,void 0),R(this,Go,void 0),R(this,Wo,void 0),R(this,Ko,void 0),R(this,Fo,void 0),O(Do,this,"https://".concat(e.domain)),O(Ho,this,e.clientId),O(Go,this,{clientSecret:e.clientSecret,useMtls:e.useMtls}),O(Wo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),O(Ko,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ca()),O(Fo,this,e.grantRequest)}async register(e,t){const n="".concat(_(Do,this),"/passkey/register"),r=k(k(k(k(k(k(k(k({},e.email&&{email:e.email}),e.name&&{name:e.name}),e.phoneNumber&&{phone_number:e.phoneNumber}),e.username&&{username:e.username}),e.givenName&&{given_name:e.givenName}),e.familyName&&{family_name:e.familyName}),e.nickname&&{nickname:e.nickname}),e.picture&&{picture:e.picture}),o=k(k({client_id:_(Ho,this)},ma(_(Go,this))),{},{user_profile:r});e.realm&&(o.realm=e.realm),e.organization&&(o.organization=e.organization),e.userMetadata&&(o.user_metadata=e.userMetadata);const i=await b(jo,this,Ea).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await b(jo,this,ba).call(this,i),t=new ya(e.error_description||"Failed to request signup challenge",e);throw t.statusCode=i.status,t.headers=Yi(i.headers),t}return{authSession:(a=await i.json()).auth_session,authnParamsPublicKey:k({},a.authn_params_public_key)};var a}async challenge(e,t){const n="".concat(_(Do,this),"/passkey/challenge"),r=k({client_id:_(Ho,this)},ma(_(Go,this)));null!=e&&e.realm&&(r.realm=e.realm),null!=e&&e.organization&&(r.organization=e.organization);const o=await b(jo,this,Ea).call(this,t)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok){const e=await b(jo,this,ba).call(this,o),t=new ga(e.error_description||"Failed to request login challenge",e);throw t.statusCode=o.status,t.headers=Yi(o.headers),t}return{authSession:(i=await o.json()).auth_session,authnParamsPublicKey:k({},i.authn_params_public_key)};var i}async getTokenByPasskey(e,t){void 0!==e.organization&&Zi(e.organization);const n=new URLSearchParams({auth_session:e.authSession,authn_response:JSON.stringify(e.credential)});let r;e.realm&&n.append("realm",e.realm),e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
8nce),e.organization&&n.append("organization",e.organization);try{r=await _(Fo,this).call(this,va,n,t,e.fullResponse)}catch(e){if(e instanceof Vi)throw e;const t=Ni(e),n=new wa(t.error_description||"Failed to exchange passkey credential for tokens.",t);throw zi(n,e),n}if(e.fullResponse){const t=r;return e.organization&&Qi(t.data.claims,e.organization),t}const o=r;return e.organization&&Qi(o.claims,e.organization),o}});function Ea(e){return la(_(Wo,this),e,_(Ko,this))}async function ba(e){const t=await e.clone().text();try{return k(k({},JSON.parse(t)),{},{statusCode:e.status,headers:e.headers,body:t})}catch(n){return{error:"unknown_error",error_description:"HTTP ".concat(e.status," ").concat(e.statusText),statusCode:e.status,headers:e.headers,body:t}}}var Sa=class extends Error{constructor(e,t,n){super(t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"statusCode",void 0),N(this,"headers",void 0),N(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&(n.error||n.error_description)?{error:n.error,error_description:n.error_description,message:n.message,mfa_token:n.mfa_token,mfa_requirements:n.mfa_requirements}:void 0;const r=Ii(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Ta=class extends Sa{constructor(e,t){super("passwordless_start_error",e,t),this.name="PasswordlessStartError"}},_a=class extends Sa{constructor(e,t){super("passwordless_verify_error",e,t),this.name="PasswordlessVerifyError"}},Ra=class extends Sa{constructor(e,t){super("passwordless_db_get_token_error",e,t),this.name="PasswordlessDbGetTokenError"}},Oa=class extends Sa{constructor(e,t,n,r,o){super("passwordless_challenge_error",e,n),N(this,"statusCode",void 0),N(this,"validationErrors",void 0),this.name="PasswordlessChallengeError",this.statusCode=t,this.validationErrors=r,this.headers=null!=o?o:this.headers}};function Ia(e){return/^\+[1-9]\d{1,14}$/.test(e)}async function Na(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var r;const o=null!==(r=e.clientAssertionSigningAlg)&&void 0!==r?r:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await Oo(e.clientAssertionSigningKey,o);return{client_assertion:await new so({}).setProtectedHeader({alg:o}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}if(e.clientSecret)return{client_secret:e.clientSecret};throw new Xi}var Ca=(Xo=new WeakMap,Jo=new WeakMap,Vo=new WeakMap,Yo=new WeakMap,zo=new WeakMap,qo=new WeakMap,Zo=new WeakMap,Qo=new WeakSet,class{constructor(e){var t,n;I(this,Qo),R(this,Xo,void 0),R(this,Jo,void 0),R(this,Vo,void 0),R(this,Yo,void 0),R(this,zo,void 0),R(this,qo,void 0),R(this,Zo,void 0),O(Jo,this,e.domain),O(Xo,this,"https://".concat(e.domain)),O(Vo,this,e.clientId),O(Yo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),O(zo,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ca()),O(qo,this,{clientSecret:e.clientSecret,clientAssertionSigningKey:e.clientAssertionSigningKey,clientAssertionSigningAlg:e.clientAssertionSigningAlg,useMtls:e.useMtls}),O(Zo,this,e.grantRequest)}async sendEmail(e,t){const n=await b(Qo,this,La).call(this,function(e){var t;const n=null!==(t=e.send)&&void 0!==t?t:"code",r={email:e.email,connection:"email",send:n};return"link"===n&&e.authParams&&(r.authParams=e.authParams),r}(e),"Failed to send passwordless email",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async sendSms(e,t){if(!Ia(e.phoneNumber))throw new Ta("Phone number must be in E.164 format (e.g. +14155550100).");const n=await b(Qo,this,La).call(this,function(e){return{phone_number:e.phoneNumber,connection:"sms"}}(e),"Failed to send passwordless SMS",e.language,t);if(e.fullResponse)return{data:void 0,response:n}}async challengeWithEmail(e,t){const n=function(e){var t;return{email:e.email,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t}}(e);return b(Qo,this,Pa).call(this,n,"Failed to request email OTP challenge",t)}async challengeWithPhoneNumber(e,t){if(!Ia(e.phoneNumber))throw new Oa("Phone number must be in E.164 format (e.g. +14155550100).",0,void 0,void 0);const n=function(e){var t;const n={phone_number:e.phoneNumber,connection:e.connection,allow_signup:null!==(t=e.allowSignup)&&void 0!==t&&t};return e.deliveryMethod&&(n.delivery_method=e.deliveryMethod),n}(e);return b(Qo,this,Pa).call(this,n,"Failed to request phone OTP challenge",t)}async getTokenByPasswordlessDbConnection(e,t){const n=new URLSearchParams({auth_session:e.authSession,otp:e.otp});if(e.scope&&n.append("scope",e.scope),e.audience&&n.append("audience",e.audie
8nce),!_(Zo,this))throw new Ra("Missing grant request delegate.",Ni(new Error("missing grantRequest")));try{return await _(Zo,this).call(this,"http://auth0.com/oauth/grant-type/passwordless/otp",n,t,e.fullResponse)}catch(e){if(e instanceof Vi)throw e;const t=new Ra("There was an error while trying to request a token.",Ni(e)),n=e;throw t.statusCode=n._statusCode,t.headers=n._headers,t}}});function ka(e){return la(_(Yo,this),e,_(zo,this))}async function La(e,t,n,r){var o;const i=await Na(_(qo,this),_(Vo,this),_(Jo,this)),a=k(k({client_id:_(Vo,this)},e),i);let s;try{s=await b(Qo,this,ka).call(this,r)("".concat(_(Xo,this),"/passwordless/start"),{method:"POST",headers:k({"Content-Type":"application/json"},n?{"x-request-language":n}:{}),body:JSON.stringify(a)})}catch(e){throw new Ta("".concat(t,": a network error occurred."))}if(s.ok)return s;const c=await s.clone().text();let u;if(204!==s.status)try{u=JSON.parse(c)}catch(e){u=void 0}const l=new Ta((null===(o=u)||void 0===o?void 0:o.error_description)||t,u);throw l.statusCode=s.status,l.headers=Yi(s.headers),l.body=c,l}async function Pa(e,t,n){var r,o;const i=await Na(_(qo,this),_(Vo,this),_(Jo,this)),a=k(k({client_id:_(Vo,this)},e),i);let s;try{s=await b(Qo,this,ka).call(this,n)("".concat(_(Xo,this),"/otp/challenge"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch(e){throw new Oa("challenge error: a network error occurred.",0,void 0,void 0)}if(s.ok){let n;try{n=await s.json()}catch(e){throw new Oa("".concat(t,": could not parse the response body."),s.status,void 0,void 0,Yi(s.headers))}return{authSession:n.auth_session}}const c=await s.clone().text();let u;try{u=JSON.parse(c)}catch(e){u=void 0}const l=u?k(k({},u),{},{statusCode:s.status,headers:s.headers,body:c}):{error:"",error_description:"",statusCode:s.status,headers:s.headers,body:c};throw new Oa((null===(r=u)||void 0===r?void 0:r.error_description)||t,s.status,l,null===(o=u)||void 0===o?void 0:o.validation_errors,Yi(s.headers))}var xa=class extends Error{constructor(e,t,n){super(t),N(this,"cause",void 0),N(this,"code",void 0),N(this,"statusCode",void 0),N(this,"headers",void 0),N(this,"body",void 0),Object.setPrototypeOf(this,new.target.prototype),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message};const r=Ii(n);this.statusCode=r.statusCode,this.headers=r.headers,this.body=r.body}},Ma=class extends xa{constructor(e,t){super("signup_error",e,t),this.name="SignUpError"}},Ua=class extends xa{constructor(e,t){super("change_password_error",e,t),this.name="ChangePasswordError"}};function Ba(e,t,n){for(const r of t)if(null===e[r]||void 0===e[r]||""===e[r])throw new n('Required parameter "'.concat(String(r),'" was null, undefined, or empty.'))}function Da(e){var t,n;return{id:null!==(t=null!==(n=e._id)&&void 0!==n?n:e.user_id)&&void 0!==t?t:e.id,email:"string"==typeof e.email?e.email:"",emailVerified:Boolean(e.email_verified),username:e.username,givenName:e.given_name,familyName:e.family_name,name:e.name,nickname:e.nickname,picture:e.picture,userMetadata:e.user_metadata}}var Ha=($o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakSet,class{constructor(e){var t,n;I(this,ri),R(this,$o,void 0),R(this,ei,void 0),R(this,ti,void 0),R(this,ni,void 0),O($o,this,"https://".concat(e.domain)),O(ei,this,e.clientId),O(ti,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)}),O(ni,this,null!==(n=e.telemetryConfig)&&void 0!==n?n:ca())}async signUp(e,t){var n;Ba(e,["email","password","connection"],Ma);const r=k({client_id:null!==(n=e.clientId)&&void 0!==n?n:_(ei,this)},function(e){const t={email:e.email,password:e.password,connection:e.connection};return void 0!==e.username&&(t.username=e.username),void 0!==e.givenName&&(t.given_name=e.givenName),void 0!==e.familyName&&(t.family_name=e.familyName),void 0!==e.name&&(t.name=e.name),void 0!==e.nickname&&(t.nickname=e.nickname),void 0!==e.picture&&(t.picture=e.picture),void 0!==e.userMetadata&&(t.user_metadata=e.userMetadata),t}(e)),o=await b(ri,this,Ga).call(this,"/dbconnections/signup",r,Ma,"Failed to sign up",t);if(e.fullResponse){const e=o.clone();return{data:Da(await o.json()),response:e}}return Da(await o.json())}async changePassword(e,t){var n;if(Ba(e,["connection"],Ua),!e.email&&!e.username)throw new Ua('Either "email" or "username" is required.');const r=k({client_id:null!==(n=e.clientId)&&void 0!==n?n:_(ei,this)},function(e){const t={connection:e.connection};return void 0!==e.email&&(t.email=e.email),void 0!==e.username&&(t.username=e.username),void 0!==e.organization&&(t.organization=e.organization),t}(e)),o=await b(ri,this,Ga).call(this,"/dbconnections/change_password",r,Ua,"Failed to request a password change",t);if(e.fullResponse){const e=o.clone();return{data:await o.text(),response:e}}return o.text()}});async function Ga(e,t,n,r,o){const i=la(_(ti,this),o,_(ni,this));let a;try{a=await i("".concat(_($o,this)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(e){throw new n("".concat(r,": a network error occurred."))}if(a.ok)return a;const s=await a.clone().text(),c=await async function(e){let t;try{t=await e.json()}catch(e){return}return"string"==typeof t.error?t:"string"==typeof t.code?{error:t.code,error_description:"string"==typeof t.description?t.description:""}:void 0}(a.clone()),u=new n((null==c?void 0:c.error_description)||r,null!=c?c:{error:"unknown_error",error_description:r});throw u.statusCode=a.status,u.headers=Yi(a.headers),u.body=s,u}
8var Wa=class extends Error{constructor(e,t,n){super(t),N(this,"code",void 0),N(this,"cause",void 0),this.name="AnonymousSessionError",this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Ka=new Set(["session_expired","invalid_session_token"]);async function Fa(e){const t="Request failed with status ".concat(e.status);let n={};try{n=await e.json()}catch(e){}return{error:"string"==typeof n.error?n.error:"server_error",error_description:"string"==typeof n.error_description?n.error_description:t}}var ja=(oi=new WeakMap,ii=new WeakMap,ai=new WeakMap,si=new WeakMap,ci=new WeakMap,ui=new WeakMap,li=new WeakMap,di=new WeakMap,hi=new WeakSet,class{constructor(e){var t;I(this,hi),R(this,oi,void 0),R(this,ii,void 0),R(this,ai,void 0),R(this,si,void 0),R(this,ci,void 0),R(this,ui,void 0),R(this,li,void 0),R(this,di,void 0),O(oi,this,e.domain),O(ii,this,"https://".concat(e.domain)),O(ai,this,e.clientId),O(si,this,e.clientSecret),O(ci,this,e.clientAssertionSigningKey),O(ui,this,e.clientAssertionSigningAlg),O(li,this,e.useMtls),O(di,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async createSession(e){const t={client_id:_(ai,this)};null!=e&&e.audience&&(t.audience=e.audience),null!=e&&e.scope&&(t.scope=e.scope),null!=e&&e.metadata&&(t.metadata=e.metadata);const n=await b(hi,this,Ja).call(this,t);if(!n.sessionToken)throw new Wa("server_error","session_token missing from create session response");return{sessionToken:n.sessionToken,accessToken:n.accessToken,expiresAt:n.expiresAt,sessionTokenExpiresAt:n.sessionTokenExpiresAt,scope:n.scope}}async getAccessToken(e){if(null==e||!e.sessionToken)return this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope});try{return await b(hi,this,Xa).call(this,e.sessionToken,e)}catch(t){if(t instanceof Wa&&Ka.has(t.code))return k(k({},await this.createSession({audience:null==e?void 0:e.audience,scope:null==e?void 0:e.scope})),{},{sessionReplaced:!0});throw t}}async logout(){const e="".concat(_(ii,this),"/anonymous/logout"),t={client_id:_(ai,this)},n=await _(di,this).call(this,e,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(t)});if(!n.ok){const e=await Fa(n);throw new Wa(e.error,e.error_description||"Failed to end anonymous session",e)}}});async function Xa(e,t){const n={client_id:_(ai,this),session_token:e};null!=t&&t.audience&&(n.audience=t.audience),null!=t&&t.scope&&(n.scope=t.scope);const r=await b(hi,this,Ja).call(this,n);return{sessionToken:e,accessToken:r.accessToken,expiresAt:r.expiresAt,sessionTokenExpiresAt:r.sessionTokenExpiresAt,scope:r.scope,sessionReplaced:!1}}async function Ja(e){const t="".concat(_(ii,this),"/anonymous/token"),n=await async function(e,t,n){if(e.useMtls)return{};if(e.clientAssertionSigningKey){var r;const o=null!==(r=e.clientAssertionSigningAlg)&&void 0!==r?r:"RS256",i=e.clientAssertionSigningKey instanceof CryptoKey?e.clientAssertionSigningKey:await Oo(e.clientAssertionSigningKey,o);return{client_assertion:await new so({}).setProtectedHeader({alg:o}).setIssuer(t).setSubject(t).setAudience("https://".concat(n,"/")).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("".concat(120,"s")).sign(i),client_assertion_type:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"}}return e.clientSecret?{client_secret:e.clientSecret}:{}}({clientSecret:_(si,this),clientAssertionSigningKey:_(ci,this),clientAssertionSigningAlg:_(ui,this),useMtls:_(li,this)},_(ai,this),_(oi,this));Object.assign(e,n);const r=await _(di,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",redirect:"error",body:JSON.stringify(e)});if(!r.ok){const e=await Fa(r);throw new Wa(e.error,e.error_description||"Anonymous token request failed",e)}let o;try{o=await r.json()}catch(e){throw new Wa("server_error","Invalid response from anonymous token endpoint")}return function(e){const t=Math.floor(Date.now()/1e3);if("string"!=typeof e.access_token||!e.access_token)throw new Wa("server_error","access_token missing or invalid in anonymous token response");const n=e.expires_in;if("number"!=typeof n||!Number.isFinite(n))throw new Wa("server_error","expires_in missing or invalid in anonymous token response");return{accessToken:e.access_token,expiresAt:t+n,scope:e.scope,sessionToken:e.session_token,sessionTokenExpiresAt:"number"==typeof e.session_expires_in&&Number.isFinite(e.session_expires_in)?t+e.session_expires_in:void 0}}(o)}var Va=(fi=new WeakMap,pi=new WeakMap,yi=new WeakMap,class{constructor(e,t){R(this,fi,new Map),R(this,pi,void 0),R(this,yi,void 0),O(yi,this,Math.max(1,Math.floor(e))),O(pi,this,Math.max(0,Math.floor(t)))}get(e){const t=_(fi,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return _(fi,this).delete(e),_(fi,this).set(e,t),t.value;_(fi,this).delete(e)}}set(e,t,n){_(fi,this).has(e)&&_(fi,this).delete(e);const r=null!=n&&Number.isFinite(n)&&n>0?n:_(pi,this);for(_(fi,this).set(e,{value:t,expiresAt:Date.now()+r});_(fi,this).size>_(yi,this);){const e=_(fi,this).keys().next().value;if(void 0===e)break;_(fi,this).delete(e)}}}),Ya=new Map;function za(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var qa=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Ya.get(i));var i;return o||(o=new Va(e.maxEntries,e.ttlMs),Ya.set(t,o)),o}static createJwksCache(){return{}}},Za="openid profile email offline_access",Qa=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function $a(e){if(null==e)throw new Bi("subject_token is required");if("string"!=typeof e)throw new Bi("subject_token must be a string");if(0===e.trim().length)throw new Bi("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Bi("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Bi("subject_token must not include the 'Bearer ' prefix")}function es(e,t){if(t)for(const r of Object.entries(t)){var n=P(r,2);const t=n[0],o=n[1];if(!Qa.has(t))if(Array.isArray(o)){if(o.length>20)throw new Bi("Parameter '".concat(t,"' exceeds maximum array size of ").concat(20));o.forEach(n=>{e.append(t,n)})}
8else e.append(t,o)}}var ts="urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",ns="urn:ietf:params:oauth:grant-type:token-exchange",rs="urn:ietf:params:oauth:token-type:access_token";function os(e,t){return(n,r)=>{const o=null==r?void 0:r.body;if(t!==va||!(o instanceof URLSearchParams))return e(n,r);const i={};for(const e of o){var a=P(e,2);const t=a[0],n=a[1];i[t]="authn_response"===t?JSON.parse(n):n}const s=new Headers(null==r?void 0:r.headers);return s.set("Content-Type","application/json"),e(n,k(k({},r),{},{headers:s,body:JSON.stringify(i)}))}}gi=new WeakMap,wi=new WeakMap,mi=new WeakMap,vi=new WeakMap,Ai=new WeakMap,Ei=new WeakMap,bi=new WeakMap,Si=new WeakMap,Ti=new WeakMap,_i=new WeakMap,Ri=new WeakMap,Oi=new WeakSet;function is(){const e=_(Ai,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(_(Ai,this).useMtls?"1":"0")}async function as(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=await b(Oi,this,ys).call(this,n),o=new yr(e,_(Ai,this).clientId,{client_secret:_(Ai,this).clientSecret,use_mtls_endpoint_aliases:_(Ai,this).useMtls},r);return o[ar]=null!=t?t:_(Ei,this),o}function ss(e){return la(_(Ei,this),e,_(bi,this))}async function cs(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=await b(Oi,this,us).call(this,t),r=n.configuration,o=n.serverMetadata;if(!e)return{configuration:r,serverMetadata:o};const i=b(Oi,this,ss).call(this,e);return{configuration:await b(Oi,this,as).call(this,o,i,t),serverMetadata:o}}async function us(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=_(e?wi:gi,this);if(t&&_(mi,this))return{configuration:t,serverMetadata:_(mi,this)};const n=b(Oi,this,is).call(this);e||await b(Oi,this,ys).call(this,!1);const r=_(Ti,this).get(n);if(r)return b(Oi,this,ls).call(this,r.serverMetadata,e);const o=_(_i,this).get(n);if(o){const t=await o;return b(Oi,this,ls).call(this,t.serverMetadata,e)}const i=(async()=>{const e=(await fr(new URL("https://".concat(_(Ai,this).domain)),_(Ai,this).clientId,{use_mtls_endpoint_aliases:_(Ai,this).useMtls},(e,t,n,r)=>{n.set("client_id",t.client_id)},{[ar]:_(Ei,this)})).serverMetadata();return _(Ti,this).set(n,{serverMetadata:e}),{serverMetadata:e}})();i.catch(()=>{}),_(_i,this).set(n,i);try{const t=(await i).serverMetadata;return b(Oi,this,ls).call(this,t,e)}finally{_(_i,this).delete(n)}}async function ls(e,t){const n=await b(Oi,this,as).call(this,e,void 0,t);return O(mi,this,e),O(t?wi:gi,this,n),{configuration:n,serverMetadata:e}}async function ds(e,t,n){var r,o,i;const a=(await b(Oi,this,cs).call(this,t)).configuration;if("audience"in e||"resource"in e)throw new Bi("audience and resource parameters are not supported for Token Vault exchanges");$a(e.subjectToken);const s=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==r?r:rs,requested_token_type:null!==e.requestedTokenType&&void 0!==o?o:"http://auth0.com/oauth/token-type/federated-connection-access-token"});if(e.loginHint&&s.append("login_hint",e.loginHint),e.scope&&s.append("scope",e.scope),es(s,e.extra),n){var c;const t=ua(null!==a[ar]&&void 0!==c?c:_(Ei,this)),r=await b(Oi,this,as).call(this,a.serverMetadata(),t);try{const e=await Lr(r,ts,s),n=aa.fromTokenEndpointResponse(e),o=t.getCapturedResponse();if(!o)throw new Vi;return{data:n,response:o}}catch(n){if(n instanceof Vi)throw n;const r=new Bi("Failed to exchange token for connection '".concat(e.connection,"'."),Ni(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Yi(o.headers):void 0,r}}const u=ua(null!==a[ar]&&void 0!==i?i:_(Ei,this)),l=await b(Oi,this,as).call(this,a.serverMetadata(),u);try{const e=await Lr(l,ts,s);return aa.fromTokenEndpointResponse(e)}catch(t){const n=new Bi("Failed to exchange token for connection '".concat(e.connection,"'."),Ni(t)),r=u.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Yi(r.headers):void 0,n}}function hs(e,t,n){var r;if(n.organization&&Qi(e.claims,n.organization),n.actorToken)if(null!==e.claims&&void 0!==r&&r.act)e.act=e.claims.act;else try{e.act=function(e){if("string"!=typeof e)throw new un("JWTs must use Compact JWS serialization, JWT must be a string");const t=e.split("."),n=t[1],r=t.length;
8if(5===r)throw new un("Only JWTs using Compact JWS serialization can be decoded");if(3!==r)throw new un("Invalid JWT");if(!n)throw new un("JWTs must contain a payload");let o,i;try{mn(n)}catch(e){throw new un("Failed to base64url decode the payload")}try{JSON.parse(Zt.decode(o))}catch(e){throw new un("Failed to parse the decoded payload as JSON")}if(!An(i))throw new un("Invalid JWT Claims Set");return i}(t.access_token).act}catch(e){}return e}async function fs(e,t,n){var r;const o=(await b(Oi,this,cs).call(this,t)).configuration;if($a(e.subjectToken),void 0!==e.organization&&Zi(e.organization),void 0!==e.actorToken&&void 0===e.actorTokenType)throw new Bi("actorTokenType is required when actorToken is provided");const i=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});if(e.audience&&i.append("audience",e.audience),e.scope&&i.append("scope",e.scope),e.requestedTokenType&&i.append("requested_token_type",e.requestedTokenType),e.organization&&i.append("organization",e.organization),e.actorToken&&i.append("actor_token",e.actorToken),e.actorTokenType&&i.append("actor_token_type",e.actorTokenType),es(i,e.extra),n){var a;const t=ua(null!==o[ar]&&void 0!==a?a:_(Ei,this)),r=await b(Oi,this,as).call(this,o.serverMetadata(),t);let s,c,u;try{if(await Lr(r,ns,i),aa.fromTokenEndpointResponse(c),t.getCapturedResponse(),!u)throw new Vi}catch(n){if(n instanceof Vi)throw n;const r=new Bi("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ni(n)),o=t.getCapturedResponse();throw r.statusCode=null==o?void 0:o.status,r.headers=o?Yi(o.headers):void 0,r}return b(Oi,this,hs).call(this,s,c,e),{data:s,response:u}}const s=ua(null!==o[ar]&&void 0!==r?r:_(Ei,this)),c=await b(Oi,this,as).call(this,o.serverMetadata(),s);let u,l;try{await Lr(c,ns,i),aa.fromTokenEndpointResponse(l)}catch(t){const n=new Bi("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),Ni(t)),r=s.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Yi(r.headers):void 0,n}return b(Oi,this,hs).call(this,u,l,e),u}async function ps(e,t,n){var r;const o=(await b(Oi,this,cs).call(this,t)).configuration;if(n){var i;const t=ua(null!==o[ar]&&void 0!==i?i:_(Ei,this)),n=await b(Oi,this,as).call(this,o.serverMetadata(),t);try{const r=await Lr(n,"http://auth0.com/oauth/grant-type/passwordless/otp",e),o=aa.fromTokenEndpointResponse(r),i=t.getCapturedResponse();if(!i)throw new Vi;return{data:o,response:i}}catch(e){if(e instanceof Vi)throw e;const n=new _a("There was an error while trying to request a token.",Ni(e)),r=t.getCapturedResponse();throw n.statusCode=null==r?void 0:r.status,n.headers=r?Yi(r.headers):void 0,n}}const a=ua(null!==o[ar]&&void 0!==r?r:_(Ei,this)),s=await b(Oi,this,as).call(this,o.serverMetadata(),a);try{const t=await Lr(s,"http://auth0.com/oauth/grant-type/passwordless/otp",e);return aa.fromTokenEndpointResponse(t)}catch(e){const t=new _a("There was an error while trying to request a token.",Ni(e)),n=a.getCapturedResponse();throw t.statusCode=null==n?void 0:n.status,t.headers=n?Yi(n.headers):void 0,t}}async function ys(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=!!_(Ai,this).clientSecret||!!_(Ai,this).clientAssertionSigningKey||!!_(Ai,this).useMtls;return e&&!t?(e,t,n,r)=>{n.set("client_id",t.client_id)}:(_(vi,this)||O(vi,this,(async()=>{if(!_(Ai,this).clientSecret&&!_(Ai,this).clientAssertionSigningKey&&!_(Ai,this).useMtls)throw new Xi;if(_(Ai,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=_(Ai,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||await Oo(e,_(Ai,this).clientAssertionSigningAlg||"RS256"),e?function(e){return De(e,void 0)}(e):or(_(Ai,this).clientSecret)})().catch(e=>{throw O(vi,this,void 0),e})),_(vi,this))}async function gs(e){const t=(await b(Oi,this,us).call(this)).configuration,n=Ce(),r=await function(e){return async function(e){return Ie(e,"codeVerifier"),ve(await crypto.subtle.digest("SHA-256",ge(e)))}(e)}(n),o=qi(k(k({},_(Ai,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(k(k({scope:Za},o),{},{client_id:_(Ai,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Rr(t,i):await _r(t,i),codeVerifier:n}}new Va(1e3,6e4);Error;new WeakMap,new WeakMap;var ws=function(){function e(){d(this,e),g(this,"readyPromise",null),g(this,"readyResolved",!1),g(this,"readyValue",!1)}return y(e,[{key:"blueConicReady",value:function(){var t=this,n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return s.log("BlueConicUtils | blueConicReady | returning c
8ached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return s.log("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return s.log("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(s.log("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return s.log("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var a=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){s.log("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),s.log("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(a,500)};a()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(s.log("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();g(ws,"DEFAULT_TIMEOUT",3e3);new ws;var ms,vs;function As(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Es(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?As(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):As(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}window.addEventListener("mng-all-islands-ready",function(e){ms||(ms=e,vs&&(s.log("utils | Dispatching mng-auth-complete event (islands were not ready): ",vs),window.dispatchEvent(vs)))}),s.log("Waiting for islands ready");var bs=function(){var e=window.location.href;return new URL(e)},Ss=function(e){for(var t="".concat(e,"="),n=decodeURIComponent(document.cookie).split(";"),r=0;r<n.length;r+=1){var o=n[r].trimLeft();if(0===o.indexOf(t))return o.substring(t.length,o.length)}return!1},Ts=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=bs().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},_s=function(){return bs().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},Rs=function(e){return function(e,t){if("string"!=typeof e)throw new m("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new m(`Invalid token specified: missing part #${n+1}`);let o;try{o=v(r)}catch(e){throw new m(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new m(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},Os=function(){var e=Ts();return["mcall.com","courant.com","sun-sentinel.com","orlandosentinel.com","growthspotter.com","dailypress.com","pilotonline.com","nydailynews.com","baltimoresun.com","capitalgazette.com","chicagotribune.com","trbdevcloud.com"].includes(e)},Is=function(){return"complete"===document.readyState},Ns=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(Is())t();else{s.log("UIHandler: ","Waiting for the body to load...");var r=setInterval(o(i.mark(function o(){return i.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:e&&(n=Is()),document.querySelector("body")&&n&&(clearInterval(r),t(!0));case 1:case"end":return o.stop()}},o)})),200)}})},Cs=function(){return new Promise(function(e){if(("interactive"===document.readyState||Is())&&window.dataLayer)s.log("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{s.log("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(o(i.mark(function n(){return i.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},ks=function(){return new Promise(function(e){if(Is())e();else{s.log("Utils digisubsMenuLoaded: ","Waiting for the digisubs dropdown to load...");var t=setInterval(o(i.mark(function n(){return i.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:document.getElementById("account-content")&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),200)}})},Ls=function(){var e=o(i.mark(function e(t){var n,r,o;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Cs();case 1:return s.log("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",s.log("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return s.log("Utils dataLayerLoop:  look for this element ",e),e[t]?(s.log("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(s.log("Utils dataLayerLoop: dataLayer search ",!1),!1)},o=window.dataLayer.some(r),e.abrupt("return",o?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Ps=function(){var e=o(i.mark(function e(){var t,n,r=arguments;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,Ls(t);case 1:return n=e.sent,s.log("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),xs=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(s.log("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(s.log("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};
8s.log("utils | Event: authentication ready: ",r),e(r)}catch(e){s.log(e),t(e)}},!1))})},Ms=function(){var e=o(i.mark(function e(){return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return a.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(s.log("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,s.log("Received entitlementsReady event:",r),e(r)}catch(e){s.error("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(s.log("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Us=function(e){s.log("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARS
8HALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9
8KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return s.log("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=Us;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Bs=function(e){vs=new CustomEvent("mng-auth-check-complete",{detail:e}),ms?(s.log("utils | Dispatching mng-auth-complete event (islands were ready): ",e),window.dispatchEvent(vs)):s.log("Islands not ready")};window.addEventListener("authenticationReady",function(e){return Bs(e.detail)});var Ds=function(e){var t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)};var Hs=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var r={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},a=function(){var a=o(i.mark(function o(){var a,c,u,l,d,h,f,p,y,g,w;return i.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,"1"!==(null===(a=window.sophi_config)||void 0===a?void 0:a.enableSophiSSPW)){o.next=1;break}if(!document.getElementById("server-paywall")){o.next=1;break}return r.sspw=!0,o.abrupt("return",t({paywall:!0,details:Es({},r)}));case 1:return o.next=2,Ps();case 2:return u=o.sent,o.next=3,Ls("Paywall_Level");case 3:if(l=o.sent,"article"===u&&"free"!==l){o.next=4;break}return o.abrupt("return",t({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return o.next=5,Ms();case 5:if(!(d=o.sent)||!d.isEntitled){o.next=6;break}return o.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){o.next=7;break}return o.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(h=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,s.log("checkPaywallStatus - Sophi is running: ",h),!h){o.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(r.sophiClient=!0,r.engageStatus=!0,r.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(r.sophiClient=!0),t({paywall:!0,details:Es({},r)})},{once:!0}),o.next=12;break;case 8:if(h){o.next=12;break}return f=window.ConnextUtils.connextReady("onPaywallShown"),p=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),o.prev=9,o.next=10,Promise.race([f,p]);case 10:!0===(y=o.sent)?(r.engagePaywall=!0,r.engageStatus="Engage paywall detected"):(r.engagePaywall=!1,r.engageStatus="Engage response: ".concat(y)),o.next=12;break;case 11:o.prev=11,g=o.catch(9),r.engagePaywall=!1,r.engageStatus="Engage response: ".concat(g);case 12:return o.abrupt("return",t({paywall:Object.values(r).some(function(e){return e}),details:Es({},r)}));case 13:o.prev=13,w=o.catch(0),n(w);case 14:case"end":return o.stop()}},o,null,[[0,13],[9,11]])}));return function(){return a.apply(this,arguments)}}();a()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Hs);var Gs=function(e){try{window.dataLayer.push({event:e}),s.log("ANALYTICS: ".concat(e," event")),s.log("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){s.log("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var Ws="#main .article-share ul",Ks=".dropdown-menu .account-settings",Fs=".nav-wrapper-secondary .article-share ul",js=function(){return document.querySelectorAll(Ws)},Xs=function(){return document.querySelector(Ks)},Js=function(){return document.querySelector(Fs)},Vs=n(8287).hp,Ys=function(e){return Vs.from(e,"base64").toString("utf8")},zs=function(){var e=window.localStorage.getItem(l),t=e&&Ys(e)&&JSON.parse(Ys(e),function(e,t){return e?function(e){try{var t=parseInt(e,10);return Number.isNaN(t)?e:t}catch(t){return e}}(JSON.parse(Ys(t))):t});return s.log("Got encoded object hash with a value of ".concat(JSON.stringify(t))),t},qs=function(e){var t=zs();return t&&t[e]},Zs=function(e,t){var n=zs()||{};n[e]=t,function(e){var t={};Object.keys(e).forEach(function(n){t[n]=Vs.from(JSON.stringify(e[n])).toString("base64")});var n=Vs.from(JSON.stringify(t)).toString("base64");window.localStorage.setItem("user-profile",n),s.log("Set encoded object hash for ".concat(e))}(n)};var Qs=function(e,t){var n=e,r=document.getElementById("article-share-copy-link-text".concat(t));"Link Copied"!==e&&"Link Updated"!==e&&(document.getElementById("article-share-copy-btn".concat(t)).disabled=!0);s.log("article sharing: user message inside share button: ",e,t),document.getElementById("articleCopyLinkSpinner".concat(t)).setAttribute("style","display:none"),document.getElementById("article-share-copy-btn".concat(t)).classList.remove("spinner-pad"),document.getElementById("articleCopyLinkSpinner".concat(t)).classList.remove("spring-spinner-mar"),document.getElementById("article-share-copy-link-text".concat(t)).setAttribute("style","display:flex;","align-items:center"),r.innerHTML="Link Copied"===e||"Link Updated"===e?'<svg width="18" height="18" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" style="margin-right: 8px">\n\t<path d="M8.61162 13.1453L18.5625 2.72401L21.3087 5.6L8.25 19.276L0.691332 11.36L3.4375 8.48401L7.88838 13.1453L8.25 13.524L8.61162 13.1453Z" fill="#4FF21F" stroke="black"></path>\n\t</svg> '.concat(n):e},$s=function(){var e=o(i.mark(function e(){var t,n,r,o;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,xs();case 1:if(t=e.sent,!(n=t.idToken)){e.next=2;break}return r=Rs(n),o={uuid:r.sub},s.log("Article sharing: get user UUID",o.uuid),e.abrupt("return",o);case 2:return e.abrupt("return",!1);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ec=function(e){return s.log("Article sharing: updating article count everywhere with ",e),document.querySelectorAll(".article-share-count").forEach(function(t){s.log("article sharing: updated article count! ",t),t.innerHTML=e}),s.log("Article sharing: update finished, return true"),!0},tc=function(){s.log("Article sharing: User is being spoofed, retrieving uuid to check remaining articles");var e=JSON.parse(localStorage.getItem(c)).entitlementToken;s.log("Article sharing: spoofed jwtToken: ",e);var t=e?Rs(e):"";return s.log("Article sharing: UUID: ",t.uuid),t},nc=function(e){return new Promise(function(t){var n=a.A.entitlementsEndpoint,r=a.A.entitlementsApiKey,c="".concat(n,"articleSharing/checkRemaining");s.log("Article sharing: api data: ",r);var l=e.uuid;(s.log("Article sharing: callCheckRemainingEndpoint: check if user is spoofed"),window.localStorage.getItem("spoof-user"))&&(l=tc().uuid);var d,h,f={uid:l,entitlementsToken:Ss("mng-entitlements")};s.log("Article sharing: articles remaining api body: ",f),$.ajax({type:"POST",url:c,headers:{"X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(f),success:(h=o(i.mark(function e(n){var r;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s.log("Article sharing: checkRemaining response: successful: ",n.remaining),r="10",r="This user does not exists in the database. Return 10 for sharesRemaining."===n.remaining?"10":n.remaining,Zs(u,r),t(r);case 1:case"end":return e.stop()}},e)})),function(e){return h.apply(this,arguments)}),error:(d=o(i.mark(function e(n,r,o){return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s.log("Article sharing: checkRemaining Failure: ",o),t(!1);case 1:case"end":return e.stop()}},e)})),function(e,t,n){return d.apply(this,arguments)})})})},rc=function(){var e=o(i.mark(function e(t){var n,r,o,a,s=arguments;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>1&&void 0!==s[1]&&s[1],r=qs(u),n||!r){e.next=1;break}return e.abrupt("return",r);case 1:return e.next=2,$s(t);case 2:return o=e.sent,e.next=3,nc(o);case 3:return a=e.sent,e.abrupt("return",a);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),oc=function(){var e=o(i.mark(function e(t){var n,r,o,c,l,d,h,f,p,y,g,w,m,v;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(d=function(e){for(var t="",n=c.replace(/[^0-9a-zA-Z]+/gm,""),r=n.length,o=0;o<e;o+=1)t+=n.charAt(Math.floor(Math.random()*r));return t},s.log("Article sharing: generate copy link"),Gs("articleshare-createlink"),s.log("Article sharing: event details ",t),document.getElementById("articleCopyLinkSpinner".concat(t)).setAttribute("style","display:flex"),document.getElementById("articleCopyLinkSpinner".concat(t)).classList.add("spring-spinner-mar"),document.getElementById("article-share-copy-btn".concat(t)).classList.add("spinner-pad"),document.getElementById("article-share-copy-link-text".concat(t)).setAttribute("style","display:none;"),r="",s.log("Article sharing: generateArticleShareLink: check if user is spoofed"),!window.localStorage.getItem("spoof-user")){e.next=1;break}r=tc(),e.next=3;break;case 1:return e.next=2,$s(t);case 2:r=e.sent;case 3:return e.next=4,Ls("Content ID");case 4:return o=e.sent,e.next=5,Ls("URL");case 5:return c=e.sent,l=_s(),s.log("Article sharing: get article ID",o),s.log("Article sharing: publication: ",l),h=d(20),s.log("Article sharing: unique share code: ",h),f=a.A.entitlementsEndpoint,p=a.A.entitlementsApiKey,y="".concat(f,"articleSharing/checkArticleSharedLink"),g={uid:r.uuid,articleName:o,publication:l,code:h,entitlementsToken:Ss("mng-entitlements")},e.prev=6,e.next=7,$.ajax({type:"POST",url:y,headers:{"X-Api-Key":p},data:JSON.stringify(g)});case 7:return"Link Updated"!==(n=e.sent).status&&"number"==typeof(w=qs(u))&&(Zs(u,m=w-1),ec(m)),e.abrupt("return",n);case 8:return e.prev=8,v=e.catch(6),Qs("Network error, try again",t),s.log("Article sharing: generateArticleShareLink endpoint Failure: ",v),e.abrupt("return",new Error("Article sharing: check article endpoint failure"));case 9:case"end":return e.stop()}},e,null,[[6,8]])}));return function(t){return e.apply(this,arguments)}}(),ic=function(e){try{return new URL(e),!0}catch(e){return!1}},ac=function(){var e=o(i.mark(function e(){var t,n,r,o,a,c,u;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,rc(null,!0);case 1:return t=e.sent,s.log("Article sharing: start nav menu adds, remaining shares is ".concat(t)),e.next=2,ks();case 2:return n=e.sent,s.log("Article sharing: init: digisubs dropdown ready: ",n),r=Xs(),s.log("Article sharing: dropdown foun
8d",r),e.next=3,Ps();case 3:o=e.sent,s.log("Article sharing: pagetype for nav menus is ",o),s.log(),""!==(a=ic(window.article_config.article_sharing_faq)?window.article_config.article_sharing_faq:"")&&(c='<a id="article-share-help" target="_blank" href="'.concat(a,'">?</a>'),null==(u=document.querySelectorAll(".article-share-h6"))||u.forEach(function(e){e.insertAdjacentHTML("beforeend",c)}));case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),sc=function(e){var t,n=document.getElementById("share-icon-position".concat(e));"rgba(0, 0, 0, 0)"===window.getComputedStyle(document.querySelector("li.share-article")).backgroundColor?(n.classList.add("article-share-icon-invert"),t=window.getComputedStyle(document.getElementById("page")).getPropertyValue("--primary")):t="white";var r='<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">\n\t\t<path fill-rule="evenodd" clip-rule="evenodd" d="M15.4835 2.11615V0L21 3L19.8462 3.6289L18.1538 4.54674L15.4835 6V3.76487C15.2527 3.73938 15.011 3.73088 14.7692 3.73088C12.7253 3.73088 10.9451 4.50425 10 5.66856C10.2418 3.67989 12.6044 2.11615 15.4835 2.11615ZM14.5446 9.28271H16.2577H16.2691C16.6802 9.28271 17 9.61414 17 10.0141V13.6484C17 14.0599 16.6688 14.3799 16.2691 14.3799H15.5382V20.9284C15.5382 21.3399 15.207 21.6599 14.8073 21.6599H3.19272C2.78158 21.6599 2.46181 21.3284 2.46181 20.9284V14.3799H1.73091C1.31977 14.3799 1 14.0484 1 13.6484V10.0141C1 9.60271 1.33119 9.28271 1.73091 9.28271H3.44397C3.28408 8.95128 3.19272 8.57414 3.19272 8.19699C3.19272 7.52271 3.46681 6.88271 3.93505 6.40271C4.40328 5.92271 5.05425 5.65985 5.72805 5.65985C7.39543 5.65985 8.41185 6.87128 8.94861 7.85414C8.97145 7.88842 8.98287 7.91128 8.99429 7.94557C9 7.92842 9.00856 7.91414 9.01713 7.89985C9.0257 7.88557 9.03426 7.87128 9.03997 7.85414C9.57673 6.87128 10.5817 5.65985 12.2605 5.65985C12.9343 5.65985 13.5739 5.92271 14.0535 6.40271C14.5332 6.87128 14.7959 7.52271 14.7959 8.19699C14.7959 8.57414 14.7045 8.93985 14.5446 9.28271ZM12.2605 7.09985C11.3926 7.09985 10.7645 7.70556 10.3076 8.53985V8.52842C10.1706 8.77985 10.0564 9.04271 9.96502 9.27128H12.2605C12.5575 9.27128 12.8315 9.14557 13.0371 8.95128C13.2427 8.75699 13.3569 8.47128 13.3569 8.18556C13.3569 7.89985 13.2427 7.62557 13.0371 7.41985C12.8315 7.21414 12.546 7.09985 12.2605 7.09985ZM4.63169 8.19699C4.63169 8.48271 4.7459 8.75699 4.95146 8.96271V8.97414C5.14561 9.17985 5.43112 9.29414 5.71663 9.29414H8.01213C7.92077 9.05414 7.80657 8.80271 7.66952 8.55128C7.2127 7.71699 6.58458 7.11128 5.71663 7.11128C5.43112 7.11128 5.15703 7.22557 4.95146 7.43128C4.7459 7.62557 4.63169 7.91128 4.63169 8.19699ZM8.26338 10.7341H2.45039V12.917H8.26338V10.7341ZM8.26338 14.3684H3.91221V20.1856H8.26338V14.3684ZM9.71378 20.1856H14.0764V14.3684H9.71378V20.1856ZM9.7252 12.917H15.5268H15.5382V10.7341H9.7252V12.917Z" fill="'.concat(t,'"/>\n\t\t</svg>'),o=window.btoa(r),i="url(data:image/svg+xml;base64,".concat(o,")");return n.style.background=i,"url(data:image/svg+xml;base64,".concat(o,")")},cc=function(e){e.classList.contains("article-share-fixed")&&e.classList.remove("article-share-fixed")},uc=function(){var e=o(i.mark(function e(n){var r,a,c,u,l,d,h,f,p;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s.log("Article sharing: build menu here"),e.next=1,Ns();case 1:if(s.log(" Article Sharing: Build sharing menuz!"),r="",a=function(){var e=o(i.mark(function e(t){var o,a,c,u,l;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Gs("articleshare-openui"),o=document.getElementById("share-box-position".concat(t)),s.log("Article Sharing: i clicked this ",o,t),a=document.getElementById(o.id),s.log("article sharing: look for this box: ",o),o.classList.contains("show-article-sharing")||(s.log("article sharing: box already open, do not show spinner"),document.getElementById("articleShareBtnSpinner".concat(t)).setAttribute("style","display:block"),document.getElementById("share-icon-position".concat(t)).setAttribute("style","display:none!important;")),c=!1,n&&!o.classList.contains("show-article-sharing")){e.next=1;break}c=!0,e.next=4;break;case 1:return e.prev=1,e.next=2,rc(t,!1);case 2:c=e.sent,ec(c),e.next=4;break;case 3:e.prev=3,e.catch(1),s.log("Article share article count api error");case 4:s.log("article sharing: api request done, show results ",c),document.getElementById("share-icon-position".concat(t)).setAttribute("style","background:".concat(r,"; display:block!important;")),document.getElementById("articleShareBtnSpinner".concat(t)).setAttribute("style","display:none"),o.classList.toggle("show-article-sharing"),a.classList.toggle("show"),0!==t&&(Ds(o)||o.classList.add("article-share-fixed")),u=document.querySelector("#article-share-position".concat(t," .article-share-link")),s.log("article sharing: accessible ",u),l=a.classList.contains("show"),s.log("article sharing: box isOpen ",l),l||(a.setAttribute("aria-expanded","fal
8se"),u.setAttribute("aria-press","false")),l&&(a.setAttribute("aria-expanded","true"),u.setAttribute("aria-press","true")),c<=0&&(s.log("article share: user out of free views ",c),Qs("No more shares left",t));case 5:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),c='\n\t<svg id="copy-icon-svg" width="18" height="18" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t<path d="M14.7895 2H4.68421C3.75789 2 3 2.73636 3 3.63636V15.0909H4.68421V3.63636H14.7895V2ZM17.3158 5.27273H8.05263C7.12632 5.27273 6.36842 6.00909 6.36842 6.90909V18.3636C6.36842 19.2636 7.12632 20 8.05263 20H17.3158C18.2421 20 19 19.2636 19 18.3636V6.90909C19 6.00909 18.2421 5.27273 17.3158 5.27273ZM17.3158 18.3636H8.05263V6.90909H17.3158V18.3636Z" fill="#ffffff"/>\n\t</svg>\n\tCopy The Shareable Link',u=function(e){var t=document.getElementById("share-box-position".concat(e)),r=document.getElementById("cancel-button-label".concat(e));if(r&&(r.childNodes[0].nodeValue="Cancel"),t&&t.classList.contains("show-article-sharing")){var o=document.getElementById("article-share-copy-link-text".concat(e));n&&o&&(o.innerHTML=c),a(e,"close"),0===e&&cc(t)}},l=function(e,t){t&&t.addEventListener("click",function(){u(e)})},window.addEventListener("click",function(e){var t=e.target,r=t.closest(".article-share-link");if(n){var o=t.closest("#share-box-position0");null===(o&&o.classList.contains("show-article-sharing"))&&null===r&&u(0)}var i=t.closest("#share-box-position1");null===(i&&i.classList.contains("show-article-sharing"))&&null===r&&u(1);var a=t.closest("#share-box-position2");null===(a&&a.classList.contains("show-article-sharing"))&&null===r&&u(2)}),d=function(){var e=o(i.mark(function e(t){var o;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Ls("Page Title");case 1:o=e.sent,t.map(function(e,t){s.log("Article sharing: create button for this: ",e,t);var i=document.createElement("li");i.className="share-article",i.id="article-share-position".concat(t),i.setAttribute("tabindex","0");var u=document.createElement("button");u.className="article-share-link",u.setAttribute("aria-pressed","false"),u.setAttribute("aria-controls","share-box-position".concat(t)),u.setAttribute("aria-label","Article Sharing Button"),u.setAttribute("tabindex","0"),i.append(u);var d=document.createElement("span");d.style.display="none",d.classList.add("spring-spinner"),d.id="articleShareBtnSpinner".concat(t),d.innerHTML='\n\t\t\t<div class="spring-spinner-part top">\n\t\t\t<div class="spring-spinner-rotator"></div>\n\t\t\t</div>\n\t\t\t<div class="spring-spinner-part bottom">\n\t\t\t<div class="spring-spinner-rotator"></div>\n\t\t\t</div>';var h=document.querySelector("li.share-facebook"),f=window.getComputedStyle(h),p=document.createElement("span");s.log("article sharing: share icon color: ",f.backgroundColor),"rgba(0, 0, 0, 0)"===f.backgroundColor&&d.classList.add("spring-spinner-invert"),u.append(d),p.id="share-icon-position".concat(t),p.className="article-share-icon";var y=document.createElement("span");y.className="sharing-screen-reader-text",y.innerHTML="Click to share a free article with a friend",i.append(y),e.appendChild(i),u.append(p),r=sc(t);var g=document.createElement("div");g.id="share-box-position".concat(t),g.className="article-share-box share-box-position".concat(t);var w,m="GIFT THIS ARTICLE",v='You have <span class="article-share-count">'.concat("10","</span> gift articles remaining this month");w=o,s.log(w),s.log("article sharing article title: ",w);var A=document.location.host;if(!1===n){g.classList.add("no-share");var E=A.replace("www.","").replace("develop.","").replace("preprod.",""),b=Os()?"https://subscription.".concat(E):"https://checkout.".concat(E);v='Subscibers get <span class="article-share-count">'.concat("10","</span> gift articles each month"),g.innerHTML='\n\t\t\t\t\t<div id=\'no-sub-article-share-container\'>\n\t\t\t\t\t<div id=\'title-and-info-container\'>\n\t\t\t\t\t<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" id=\'article-share-close'.concat(t,'\' class="article-share-close">\n\t\t\t\t\t<circle class="close-circle" cx="20" cy="20" r="17.5" fill="#9d9a98" stroke="#00000026"/>\n\t\t\t\t\t<path d="M16.5355 16.4645L20.0711 20M20.0711 20L23.6066 23.5355M20.0711 20L23.6066 16.4645M20.0711 20L16.5355 23.5355" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t<h6 id=\'no-sub-title-text\'>').concat(m,"</h6>\n\t\t\t\t\t<h6 id='article-share-copy-title'>What is article sharing?</h6>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id='benefits-text-container'>\n\t\t\t\t\t<p>Subscribers are entitled to 10 gift sharing articles each month. These can be shared with friends and family who are not subscribers.</p>\n\t\t\t\t\t</div>\n\t\t\t\t\t<span id='article-share-line'></span>\n\t\t\t\t\t<div id='subscribe-or-login-container'>\n\t\t\t\t\t<p id='article-share-subscribe-link'> <a href=\"").concat(b,'" target="_blank" style="text-decoration: underline">Subscribe</a> now! or <a href="https://').concat(A,'/login" style="text-decoration: underline">Sign in</a> to your account.</p>\n\t\t\t\t\t<button style="display:none" disabled aria-disabled="true" id=\'article-share-copy-btn').concat(t,'\' class="article-share-copy-btn" >Share Button Disabled</button>\n\t\t\t\t\t<div class="article-login-buttons-container">\n\t\t\t\t\t<a href="').concat(b,'" target="_blank" class="article-user-button">Subscribe</a>\n\t\t\t\t\t<a href="https://').concat(A,'/login" class="article-user-button">Log in</a>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id=\'cancel-button-container\'>\n\t\t\t\t\t<button class="cancel-button" id="cancel-button').concat(t,'">\n\t\t\t\t\t<span id="cancel-button-label').concat(t,'">Cancel<span>\n\t\t\t\t\t<svg style="vertical-align: bottom;" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">\n\t\t\t\t\t<path d="M6.75736 6.75736L11 11M11 11L15.2426 15.2426M11 11L15.2426 6.75736M11 11L6.75736 15.2426" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t\t</svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t')}else g.innerHTML='\n\t\t\t\t<div id=\'article-share-modal-container\'>\n\t\t\t\t<div id=\'article-share-title-container\'>\n\t\t\t\t<svg tabindex="0" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" id=\'article-share-close'.concat(t,'\' class="article-share-close">\n\t\t\t\t<circle class="close-circle" cx="20" cy="20" r="17.5" fill="#9d9a98" stroke="#00000026"/>\n\t\t\t\t<path d="M16.5355 16.4645L20.0711 20M20.0711 20L23.6066 23.5355M20.0711 20L23.6066 16.4645M20.0711 20L16.5355 23.5355" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t</svg>\n\t\t\t\t<div id=\'article-share-title\' style=\'padding-bottom:8px\'>').concat(m,"</div>\n\t\t\t\t<div id='article-share-remaining-text'>").concat(v,"</div>\n\t\t\t\t</div>\n\t\t\t\t<div id='article-share-article-title-container'>\n\t\t\t\t<h3 id='article-share-article-title'>").concat(w,"</h3>\n\t\t\t\t</div>\n\t\t\t\t<span id='article-share-line'></span>\n\t\t\t\t<div id='article-share-link-and-button-container'>\n\t\t\t\t<div id='article-share-link-container'>\n\t\t\t\t<h6 id='article-share-copy-title'>Copy the link</h6>\n\t\t\t\t<div id='copy-button-container'>\n\t\t\t\t<button id='article-share-copy-btn").concat(t,"' class=\"article-share-copy-btn\">\n\t\t\t\t<div id='copy-button-and-icon-container'>\n\t\t\t\t<p id='article-share-copy-link-text").concat(t,"'>\n\t\t\t\t").concat(c,"\n\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t<div id='articleCopyLinkSpinner").concat(t,"' style='display:none;' class='spring-spinner articleCopyLinkSpinner copy-link-spinner-revert'>\n\t\t\t\t<div class='spring-spinner-part top spinner-top").concat(t," spring-spinner-pad'>\n\t\t\t\t<div class='spring-spinner-rotator spring-spinner-invert'></div>\n\t\t\t\t</div>\n\t\t\t\t<div class='spring-spinner-part bottom spinner-bottom").concat(t," spring-spinner-pad'>\n\t\t\t\t<div class='spring-spinner-rotator spring-spinner-invert'></div>\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div id='cancel-button-container'>\n\t\t\t\t<button class=\"cancel-button\" id=\"cancel-button").concat(t,'">\n\t\t\t\t<span id="cancel-button-label').concat(t,'">Cancel<span>\n\t\t\t\t<svg style="vertical-align: bottom;" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">\n\t\t\t\t<path d="M6.75736 6.75736L11 11M11 11L15.2426 15.2426M11 11L15.2426 6.75736M11 11L6.75736 15.2426" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>\n\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t');e.appendChild(g);var S=document.getElementById("article-share-position".concat(t));S.addEventListener("click",function(){a(t,"open")}),S.addEventListener("keydown",function(e){"q"===e.key&&a(t,"open")});var T=document.getElementById("article-share-close".concat(t));l(t,T);var _=document.getElementById("cancel-button".concat(t));return l(t,_),document.getElementById("article-share-copy-btn".concat(t)).addEventListener("click",function(){lc(t)}),"done"});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),h=[Js()].concat(t(js())),s.log("article sharing: target elements are ",h),h.filter(function(e){return null!==e}).length!==h.length){e.next=2;break}return e.next=2,d(h);case 2:if(s.log("Article Sharing: appending sticky nav too"),!n){e.next=4;break}return e.next=3,ac();case 3:(f=document.querySelectorAll("#article-share-dropdown-article-page"))&&f.forEach(function(e){e.addEventListener("click",function(){a(0,"open")})}),(p=document.querySelector(".border-container #push-account-content #article-share-dropdown-article-page"))&&p.addEventListener("click",function(){document.getElementById("digisubs-toggle").
8click()});case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),lc=function(){var e=o(i.mark(function e(t){var n,r,o,a,c,u;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,oc(t);case 1:return n=e.sent,e.next=2,Ls("URL");case 2:if(r=e.sent,s.log("Article sharing: check article endpoint response: successful: ",n),n.sharedCode&&"null"!==n.sharedCode&&void 0!==n.sharedCode){e.next=3;break}Qs("Network error, try again",t),e.next=11;break;case 3:if("Link Updated"===n.status?Qs("Link Updated",t):Qs("Link Copied",t),o="".concat(r,"?share=").concat(n.sharedCode),!document.hasFocus()){e.next=8;break}return e.prev=4,e.next=5,navigator.clipboard.writeText(o);case 5:s.log("Article sharing: Link Copied"),"Link Updated"===n.status?Qs("Link Updated",t):Qs("Link Copied",t),e.next=7;break;case 6:e.prev=6,u=e.catch(4),s.error("Clipboard write failed:",u),Qs("Copy failed. Try again.",t);case 7:e.next=9;break;case 8:s.warn("Clipboard copy blocked: document not focused"),Qs("Copy failed. Try again.",t);case 9:if((a=document.getElementById("cancel-button-label".concat(t)))&&(a.childNodes[0].nodeValue="Close"),"Link Updated"===n.status){e.next=11;break}return e.next=10,rc(t);case 10:c=e.sent,ec(c);case 11:case"end":return e.stop()}},e,null,[[4,6]])}));return function(t){return e.apply(this,arguments)}}(),dc=function(){var e=o(i.mark(function e(){var t,n,r,c,u,l,d,h,f;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.articleShareConvo=!1,window.MNGAuthentication.articleShare="",s.log("article sharing: code check: checking free article code"),t=window.location.search,n=new URLSearchParams(t),e.next=1,Ls("Content ID");case 1:if(r=e.sent,c=_s(),s.log("article sharing: code check: url params array ",n.getAll("share")),0!==n.getAll("share").length){e.next=2;break}return s.log("No share search param"),e.abrupt("return",!1);case 2:return window.MNGAuthentication.articleShareConvo=!0,u=n.getAll("share"),Gs("articleshare-readingshare"),s.log("Article sharing: code check: check share code: ",u),l=a.A.entitlementsEndpoint,d=a.A.entitlementsApiKey,h="".concat(l,"articleSharing/checkArticleSharedLink"),f={articleName:r,publication:c,code:u[0]},e.abrupt("return",$.ajax({type:"POST",url:h,headers:{"X-Api-Key":d},data:JSON.stringify(f),success:function(e){if(s.log("Article sharing: code check: looking for valid share code: ",e),"nocodefound"===e)s.log("Article sharing: code check: code does not exist"),Gs("articleshare-readshare-codenotfound"),window.MNGAuthentication.articleShare="codenotfound";else{s.log("Article sharing: code check: time api timestamp response: ",e.sharedTimestamp);var t=new Date(e.sharedTimestamp),n=(t=t.setDate(t.getDate()+30))/1e3;s.log("Article sharing: code check: time api timestamp response expiration date ",n);var r=new Date;r=Math.floor(r.getTime()/1e3),s.log("Article sharing: code check: current unix time is, ",r),n<r?(s.log("Article sharing: code check: code expired"),Gs("articleshare-readshare-expired"),window.MNGAuthentication.articleShare="expired"):e.sharedCode&&"null"!==e.sharedCode&&void 0!==e.sharedCode?(s.log("Article sharing: code check: code valid, not expired"),Gs("articleshare-readshare-verified"),window.MNGAuthentication.articleShare="sharing",window.ConnextUtils.rerunConnextEntitlements()):(s.log("Article sharing: code check: network error"),window.MNGAuthentication.articleShare="networkerror")}},error:function(){var e=o(i.mark(function e(t,n,r){return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s.log("Article sharing: code check: network error: ",r),window.MNGAuthentication.articleShare="networkerror",e.abrupt("return",new Error("Article sharing: check article code failed"));case 1:case"end":return e.stop()}},e)}));return function(t,n,r){return e.apply(this,arguments)}}()}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),hc=function(){var e=o(i.mark(function e(){var n,r,o,a;return i.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return document.addEventListener("scroll",function(){var e=t(document.querySelectorAll(".share-box-position1, .share-box-position2"));e.length>0&&e.forEach(function(e){if(e&&e.classList.contains("show-article-sharing")){var t=window.scrollY,n=document.getElementById("sharing-bottom"),r=document.getElementById("sharing-top");if(n&&e.classList.contains("share-box-position2"))t/n.offsetTop*100>=93?cc(e):e.classList.contains("article-share-fixed")||e.classList.add("article-share-fixed");
8if(r&&e.classList.contains("share-box-position1"))window.scrollY/(document.documentElement.scrollHeight-window.innerHeight)*100>=11.5?cc(e):e.classList.contains("article-share-fixed")||e.classList.add("article-share-fixed")}})}),e.next=1,xs();case 1:return n=e.sent,r=n.isAuthenticated,e.next=2,Ms();case 2:if(o=e.sent,!0!==r||void 0===window.MNGAuthentication||"function"!=typeof window.MNGAuthentication.isUserSubscriber||!o.isEntitled){e.next=7;break}return s.log("article sharing: subscriber, show sharing tool"),e.next=3,Ps();case 3:if(a=e.sent,s.log("article sharing: page type is ",a),"article"!==a){e.next=5;break}return e.next=4,uc(!0);case 4:e.next=6;break;case 5:return e.next=6,ac();case 6:e.next=9;break;case 7:return s.log("article sharing: not a logged in or a subscriber, show marketing message and check for share code"),e.next=8,dc();case 8:return e.next=9,uc(!1);case 9:window.addEventListener("updateArticlesRemainingUI",function(e){ec(e.detail)});case 10:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();hc()})()})();
9//# sourceMappingURL=mng-digisubs.articleShare.bundle.js.map;

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.