var roll=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return(r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function a(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(Object.keys(a)),u=c.next();!u.done;u=c.next()){var l=u.value;if(r===l||r.endsWith("."+l))return new e(!0,a[l],o)}}catch(e){i={error:e}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(i)throw i.error}}}return new e(!1,o)},e.prototype.shouldFallbackToAdobe=function(e){return!!this.proxied&&("feature_disabled"===e.error&&"cdsc"===e.error_description)},e.THIRD_PARTY_DOMAINS_PROD={"behance.net":"https://sso.behance.net"},e.THIRD_PARTY_DOMAINS_STAGE={"s2stagehance.com":"https://sso.s2stagehance.com"},e}(),k=new(function(){function e(){this.baseUrlAdobe="",this.baseUrlServices="",this.checkTokenEndpoint=new y,this.jslibver="v2-v0.56.0-3-gd881755"}return e.prototype.loadEnvironment=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r="");var n=e===l.STAGE;n?(this.baseUrlAdobe="https://ims-na1-stg1.adobelogin.com",this.baseUrlServices="https://adobeid-na1-stg1.services.adobe.com"):(this.baseUrlAdobe="https://ims-na1.adobelogin.com",this.baseUrlServices="https://adobeid-na1.services.adobe.com"),this.checkTokenEndpoint=y.computeEndpoint(t,r,n,this.baseUrlServices)},e}());function b(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function w(e,t){if(null==e)return t;if(e===t)return e;if(!b(e))return e;var r=Object.assign({},e);return b(t)&&Object.keys(t).forEach((function(n){var o,i;b(t[n])?n in e?r[n]=w(e[n],t[n]):Object.assign(r,((o={})[n]=t[n],o)):Object.assign(r,((i={})[n]=t[n],i))})),r}var S=new(function(){function e(){this.getCustomApiParameters=function(e,t){return e[t]||{}}}return e.prototype.mergeExternalParameters=function(e,t,r){return w(this.getCustomApiParameters(t,r),e)},e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(e){return null}},e}()),I=new(function(){function e(){}return e.prototype.fragmentToObject=function(e){var t=this.getHashFromURL(e);if(!t)return null;var r=this.processHashUrl(t),n=this.getOldHash(r),o=n?r.slice(r.indexOf("old_hash")):r,i=this.removeOldHash(o),s=this.getQueryParamsAsMap(i);n&&(s.old_hash=n);var a=s.state;return a&&(s.state=S.toJson(a)),s},e.prototype.getOldHash=function(e){if(!e)return"";var t=e.match("old_hash=(.*?)&from_ims=true");return t?t[1]:""},e.prototype.removeOldHash=function(e){return e?e.replace(/old_hash=(.*?)&from_ims=true/gi,"from_ims=true"):e},e.prototype.removeAccessToken=function(e){return void 0===e&&(e=window.location.hash),!e&&e.length<1?e:e.startsWith("#")?"#"+this.removeAccessToken(e.substring(1)):e.replace(/(^access_token=[^&]+&?)|(&access_token=[^&]+)/g,"")},e.prototype.getHashFromURL=function(e){void 0===e&&(e=window.location.href);var t=e.indexOf("#");return-1!==t?e.substring(t+1):""},e.prototype.getQueryParamsAsMap=function(e){if(!e)return{};var t={};return(e=e.replace(/^(#\/|\/|#|\?|&)/,"")).split("&").forEach((function(e){if(e.length){var r=e.split("=");t[r[0]]=decodeURIComponent(r[1])}})),t},e.prototype.processHashUrl=function(e){return e.replace("?error","#error").replace(/#/gi,"&").replace("from_ims=true?","from_ims=true&")},e}()),T=function(){function e(){}return e.getInitialRedirectUri=function(e,t){var r=e.redirect_uri||t||window.location.href,n="function"==typeof r?r():r,o=n.indexOf("from_ims");return-1===o?n:("#"===n[o-1]&&o--,n.substr(0,o))},e.createDefaultRedirectUrl=function(e,t,r,n){var o=this.getInitialRedirectUri(r,e),i=this.createOldHash(o);return i.indexOf("?")>0?"".concat(i,"&client_id=").concat(t,"&api=").concat(n):"".concat(i,"?client_id=").concat(t,"&api=").concat(n)},e.createRedirectUrl=function(e,t,r,n,o){void 0===o&&(o="");var i=this.createDefaultRedirectUrl(e,t,r,n);(o=o||r.scope||"")&&(i="".concat(i,"&scope=").concat(o));var s=r.reauth||"";return s&&(i="".concat(i,"&reauth=").concat(s)),i},e.createOldHash=function(e){var t=e.indexOf("#");if(t<0)return"".concat(e,"#old_hash=&from_ims=true");var r=e.substring(0,t),n=I.removeAccessToken(e.substring(t+1));return"".concat(r,"#old_hash=").concat(n,"&from_ims=true")},e.mergeApiParamsWithExternalParams=function(e,t,r){return w(S.getCustomApiParameters(e,r),t)},e}(),_=function(){var e=this;this.composeRedirectUrl=function(e){var t=e.apiParameters,n=e.externalParameters,o=void 0===n?{}:n,i=e.adobeIdRedirectUri,s=void 0===i?"":i,a=e.clientId,c=e.locale,u=e.state,l=void 0===u?{}:u,d=e.scope,p=void 0===d?o.scope||t.scope||"":d,h=T.mergeApiParamsWithExternalParams(t,o,"authorize");l&&(h.state=w(h.state||{},l));var f=T.createRedirectUrl(s,a,h,"authorize",p),v=o.locale||c||"",g=e.response_type,m=void 0===g?h.response_type||"":g;return r(r({},h),{client_id:a,scope:p,locale:v,response_type:m,jslVersion:k.jslibver,redirect_uri:f})},this.createRedirectUrl=function(t){var r=e.composeRedirectUrl(t),n=m.uriEncodeData(r);return"".concat(k.baseUrlAdobe,"/ims/authorize/v1?").concat(n)}},P=function(e){function r(){var t=e.apply(this,a([],s(arguments),!1))||this;return t.signIn=function(e){var r=t.createRedirectUrl(e);m.setHrefUrl(r)},t.authorizeToken=function(e,r){var n=t.composeRedirectUrl(r);e&&(n.user_assertion=e,n.user_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),t.createAuthorizeForm(n).submit()},t}return t(r,e),r.prototype.createAuthorizeForm=function(e){var t="".concat(k.baseUrlAdobe,"/ims/authorize/v1"),r=document.createElement("form");r.style.display="none",r.setAttribute("method","post"),r.setAttribute("action",t);var n=null,o=null,i="";for(var s in e){if("object"==typeof(o=e[s])){if(0===Object.keys(o).length)continue;i=JSON.stringify(o)}else i=o;""!==i&&(n=this.createFormElement("input","text",s,i),r.appendChild(n))}return document.getElementsByTagName("body")[0].appendChild(r),r},r.prototype.createFormElement=function(e,t,r,n){var o=document.createElement(e);return o.setAttribute("type",t),o.setAttribute("name",r),o.setAttribute("value",n),o},r}(_),R=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/,E=["https://auth.services.adobe.com","https://auth-stg1.services.adobe.com","https://localhost.corp.adobe.com:9000"],A=new function(){var e=this;this.windowObjectReference=null,this.previousUrl="",this.openSignInWindow=function(t,r,n,o){e.onProcessLocation=o,e.allowOrigin=n.allowOrigin,e.timerId&&clearInterval(e.timerId),window.removeEventListener("message",e.receiveMessage),window.addEventListener("message",e.receiveMessage),e.broadcastChannel&&e.broadcastChannel.close(),e.broadcastChannel=new BroadcastChannel("imslib"),e.broadcastChannel.onmessage=e.receiveMessage;var i="popup=yes, width=".concat(n.width,", height=").concat(n.height,", top=").concat(n.top,", left=").concat(n.left);!e.windowObjectReference||e.windowObjectReference&&e.windowObjectReference.closed?e.windowObjectReference=window.open(t,n.title,i):e.previousUrl!==t?(e.windowObjectReference=window.open(t,n.title,i),e.windowObjectReference&&e.windowObjectReference.focus()):e.windowObjectReference.focus(),e.previousUrl=t},this.receiveMessage=function(t){if(a(a([],s(E),!1),[e.allowOrigin],!1).includes(t.origin)){try{if(!R.test(t.data))return void console.warn("refused to receive message containing unknown data format",t.data)}catch(e){return void console.error(e)}e.broadcastChannel&&e.broadcastChannel.close(),e.onProcessLocation&&e.onProcessLocation(t.data)}else console.warn("refused to receive message from origin not whitelisted",t.origin)}},O=function(e){function n(t,n){var o=e.call(this)||this;return o.signIn=function(e){e.state=r(r({},e.state),{imslibmodal:!0});var t=e.state.nonce,n=o.createRedirectUrl(e);A.openSignInWindow(n,t,o.popupSettings,o.onPopupMessage)},o.onPopupMessage=t,o.popupSettings=n,o}return t(n,e),n}(_),j=function(){function e(e,t){this.status=0,this.data="",this.status=e,this.data=this.toJson(t)}return e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(t){return e}},e}(),x=new(function(){function e(){}return e.prototype.http=function(e){return new Promise((function(t,r){var n=new(0,window.XMLHttpRequest);"boolean"==typeof e.withCredentials?n.withCredentials=e.withCredentials:n.withCredentials=!0,"number"==typeof e.timeout&&(n.timeout=e.timeout),n.open(e.method,e.url,!0);var o;n.onload=function(){return this.status>=200&&this.status<300?t(new j(this.status,this.response)):r(new j(this.status,this.response))},n.onerror=function(){var e=new j(this.status,this.response);return r(e)},n.ontimeout=function(){var e=new j(0,"timeout");return r(e)},n.onabort=function(){var e=new j(0,"aborted");return r(e)},(o=e.headers)&&Object.keys(o).forEach((function(e){n.setRequestHeader(e,o[e])})),n.send(e.data)}))},e.prototype.post=function(e,t,r,n,o){return void 0===r&&(r={}),this.http({headers:r,method:"POST",url:e,data:t,withCredentials:n,timeout:o})},e.prototype.get=function(e,t,r,n){return void 0===t&&(t={}),this.http({headers:t,method:"GET",url:e,withCredentials:r,timeout:n})},e}()),D=function(){this.probe=function(e,t,r){if(void 0===r&&(r=2e3),!e||0===e.length)return Promise.resolve([]);for(var n={"Content-Type":"application/json","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:0,"X-IMS-CLIENTID":t},o="/ims/cdsc_probe?"+m.uriEncodeData({client_id:t}),i=[],s=[],a=function(t){var a=e[t]+o;s.push(x.post(a,{},n,!1,r).then((function(e){return 200==e.status&&i.push(t)})).catch((function(){})))},c=0;c=0?new K("ride_pba_idle_session","",!0):null;var o=this.addRedirectUriToJump(r,n);return new K(r,o)},e.prototype.addRedirectUriToJump=function(e,t){if(!t||"string"!=typeof t)return"";var r=t;this.adobeIdThinData||(this.adobeIdThinData=new H);var n=this.adobeIdThinData.computeRideRedirectUri(e);if(!n||0===n.length)return r;try{var o=new URL(r);return o.searchParams.append("redirect_uri",n),o.toString()}catch(e){return r}},e.prototype.isUnauthorizedException=function(e){var t=e.status;return 401===(void 0===t?0:t)},e}()),Y=new(function(){function e(){this.triggerOnError=null}return e.prototype.post=function(e,t,r){var n=this;void 0===r&&(r={});var o=G.getCachedApiResponse(e,t);if(o){var i=o.status,s=o.data;return 200===i?Promise.resolve(s):Promise.reject(s)}return x.post(e,t,r).then((function(r){return n.storeApiResponse(e,JSON.stringify(t),r)})).catch((function(r){return n.verifyError(e,JSON.stringify(t),r)}))},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var n=G.getCachedApiResponse(e);if(n){var o=n.status,i=n.data;return 200===o?Promise.resolve(i):Promise.reject(i)}return x.get(e,t).then((function(t){return r.storeApiResponse(e,"",t)})).catch((function(t){return r.verifyError(e,"",t)}))},e.prototype.verifyError=function(e,t,r){this.storeApiResponse(e,t,r);var n=W.verify(r,e);return Promise.reject(n||r.data)},e.prototype.storeApiResponse=function(e,t,r){return void 0===t&&(t=""),G.storeApiResponse(e,t,r),Promise.resolve(r.data)},e}()),X=function(){function e(e){void 0===e&&(e={}),this.CONTENT_FORM_ENCODED="application/x-www-form-urlencoded;charset=utf-8",this.apiParameters=e}return e.prototype.validateToken=function(e){var t=e.token,n=e.client_id,o=e.type,i=m.uriEncodeData(r(r({},S.getCustomApiParameters(this.apiParameters,"validate_token")),{type:o||"access_token",client_id:n,token:t})),s="".concat(k.baseUrlAdobe,"/ims/validate_token/v1?jslVersion=").concat(k.jslibver),a=this.formEncoded();return Y.post(s,i,a)},e.prototype.getProfile=function(e){var t=e.token,n=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"profile")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(n,i);var s=m.uriEncodeData(r({client_id:n},o)),a="".concat(k.baseUrlAdobe,"/ims/profile/v1?").concat(s,"&jslVersion=").concat(k.jslibver);return Y.get(a,i)},e.prototype.getUserInfo=function(e){var t=e.token,n=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"userinfo")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(n,i);var s=m.uriEncodeData(r({client_id:n},o)),a="".concat(k.baseUrlAdobe,"/ims/userinfo/v1?").concat(s,"&jslVersion=").concat(k.jslibver);return Y.get(a,i)},e.prototype.logoutToken=function(e){var t=e.client_id,n=e.token,o=r({},S.getCustomApiParameters(this.apiParameters,"logout_token")),i="".concat(k.baseUrlServices,"/ims/logout/v1?jslVersion=").concat(k.jslibver),s=this.addClientIdInHeader(t);return Y.post(i,r({client_id:t,access_token:n},o),s)},e.prototype.checkStatus=function(){var e="".concat(k.baseUrlServices,"/ims/check/v1/status");return Y.get(e)},e.prototype.checkToken=function(e,t,o){var i=e.client_id,s=e.scope,a=t.arkoseSessionToken,c=t.fingerprintRequestId,u=n(t,["arkoseSessionToken","fingerprintRequestId"]),l=r({},S.mergeExternalParameters(u,this.apiParameters,"check_token")),d=r(r({},l),{client_id:i,scope:s});return a&&(d.arkose_session_token=a),c&&(d.fingerprint_request_id=c),o&&(d.user_id=o),this.callCheckToken(m.uriEncodeData(d),"/check/v6/token?jslVersion=".concat(k.jslibver))},e.prototype.switchProfile=function(e,t,n){void 0===n&&(n="");var o=e.client_id,i=e.scope,s=void 0===i?"":i,a=r({},S.mergeExternalParameters(t,this.apiParameters,"check_token")),c=m.uriEncodeData(r(r({},a),{client_id:o,scope:s,user_id:n}));return this.callCheckToken(c,"/check/v6/token?jslVersion=".concat(k.jslibver))},e.prototype.listSocialProviders=function(e){var t=e.client_id,n=r({},S.getCustomApiParameters(this.apiParameters,"providers")),o=m.uriEncodeData(r({client_id:t},n)),i="".concat(k.baseUrlServices,"/ims/social/v2/providers?").concat(o,"&jslVersion=").concat(k.jslibver),s=this.addClientIdInHeader(t);return Y.get(i,s)},e.prototype.exchangeIjt=function(e,t){var n=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"ijt")),i="".concat(k.baseUrlServices,"/ims/jump/implicit/").concat(t),s=m.uriEncodeData(r({client_id:n},o)),a="".concat(i,"?").concat(s,"&jslVersion=").concat(k.jslibver);a.length>2048&&(delete o.redirect_uri,s=m.uriEncodeData(o),a="".concat(i,"?").concat(s));var c=this.addClientIdInHeader(n);return Y.get(a,c)},e.prototype.avatarUrl=function(e){return"".concat(k.baseUrlAdobe,"/ims/avatar/download/").concat(e)},e.prototype.getOrganizations=function(e){var t=e.token,n=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"organizations")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(n,i);var s=m.uriEncodeData(r({client_id:n},o)),a="".concat(k.baseUrlAdobe,"/ims/organizations/v6?").concat(s,"&jslVersion=").concat(k.jslibver);return Y.get(a,i)},e.prototype.getReleaseFlags=function(e){var t=e.token,n=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"fg_value")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(n,i);var s=m.uriEncodeData(r({client_id:n},o)),a="".concat(k.baseUrlAdobe,"/ims/fg/value/v1?").concat(s,"&jslVersion=").concat(k.jslibver);return Y.get(a,i)},e.prototype.getTransitoryAuthorizationCode=function(e,t,n){void 0===t&&(t={});var o=r({},S.mergeExternalParameters(t,this.apiParameters,"check_token")),i=m.uriEncodeData(r(r({},o),e));return this.callCheckToken(i,"/check/v6/token?client_id=".concat(n,"&jslVersion=").concat(k.jslibver))},e.prototype.getTokenFromCode=function(e,t){void 0===t&&(t={});var n=r({},S.mergeExternalParameters(t,this.apiParameters,"token"));n.grant_type="authorization_code",delete e.other;var o="".concat(k.baseUrlServices,"/ims/token/v3?jslVersion=").concat(k.jslibver),i=m.uriEncodeData(r(r({},n),e)),s=this.formEncoded();return this.addClientIdInHeader(e.client_id,s),Y.post(o,i,s)},e.prototype.jumpToken=function(e,t,n){void 0===t&&(t={});var o=r({},S.mergeExternalParameters(t,this.apiParameters,"jumptoken")),i="".concat(k.baseUrlServices,"/ims/jumptoken/v1?client_id=").concat(n,"&jslVersion=").concat(k.jslibver),s=m.uriEncodeData(r(r({},o),e)),a=this.formEncoded();return this.addClientIdInHeader(n,a),Y.post(i,s,a)},e.prototype.jumpTokenToDevice=function(e,t,n,o){void 0===t&&(t={});var i=r({},S.mergeExternalParameters(t,this.apiParameters,"jumptoken_to_device"));!i.user_id&&o&&(i.user_id=o);var s="".concat(k.baseUrlServices,"/ims/jumptoken/v2?client_id=").concat(n,"&jslVersion=").concat(k.jslibver),a=m.uriEncodeData(r(r({},i),e)),c=this.formEncoded();return this.addClientIdInHeader(n,c),Y.post(s,a,c)},e.prototype.socialHeadlessSignIn=function(e,t){void 0===t&&(t={});var n=r({},S.mergeExternalParameters(t,this.apiParameters,"jumptoken")),o="".concat(k.baseUrlServices,"/ims/social/v2/native?jslVersion=").concat(k.jslibver),i=m.uriEncodeData(r(r(r({},n),e),{response_type:"implicit_jump"}));return Y.post(o,i,this.formEncoded())},e.prototype.createAuthorizationHeader=function(e){var t={};return e&&(t[d]="Bearer ".concat(e)),t},e.prototype.formEncoded=function(e){return void 0===e&&(e={}),e["content-type"]=this.CONTENT_FORM_ENCODED,e},e.prototype.addClientIdInHeader=function(e,t){return void 0===t&&(t={}),t.client_id=e,t},e.prototype.callCheckToken=function(e,t){var r=this.formEncoded();return Y.post("".concat(k.checkTokenEndpoint.url,"/ims").concat(t),e,r).catch((function(n){if(!k.checkTokenEndpoint.shouldFallbackToAdobe(n))throw n;return Y.post("".concat(k.checkTokenEndpoint.fallbackUrl,"/ims").concat(t),e,r)}))},e}();!function(e){e.INITIALIZE_ERROR="initialize_error",e.HTTP="http",e.FRAGMENT="fragment",e.CSRF="csrf",e.NOT_ALLOWED="not_allowed",e.PROFILE_EXCEPTION="profile_exception",e.TOKEN_EXPIRED="token_expired",e.SOCIAL_PROVIDERS="SOCIAL_PROVIDERS",e.RIDE_EXCEPTION="ride_exception",e.ARKOSE_ERROR="arkose_error",e.BFP_ERROR="bfp_error"}(M||(M={}));var Z=function(e){this.message=null,this.errorType=M.PROFILE_EXCEPTION,this.message=e},Q=/\s|,/g;function $(e){return e.split(Q).sort().join(",")}var ee,te=function(){function e(e){this.memoryCache=new Map,this.profileServiceRequest=e,this.storage=v.getStorageByName(c.SessionStorage)}return e.prototype.getProfile=function(e){var t=this,r=this.profileServiceRequest,n=r.clientId,o=r.imsApis,i=this.getProfileFromStorage();return i?Promise.resolve(i):o.getProfile({client_id:n,token:e}).then((function(e){if(!e)throw new Z("NO profile response");if(0===Object.keys(e).length)throw new Z("NO profile value");return t.saveProfileToStorage(e),Promise.resolve(e)})).catch((function(e){return e instanceof J||t.removeProfile(),Promise.reject(e)}))},e.prototype.getProfileStorageKey=function(){var e=this.profileServiceRequest,t=e.clientId,r=e.scope;return"".concat("adobeid_ims_profile","/").concat(t,"/").concat(!1,"/").concat($(r))},e.prototype.getProfileFromStorage=function(){var e=this.getProfileStorageKey(),t=this.storage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){this.removeProfile()}return this.memoryCache.get(e)||null},e.prototype.saveProfileToStorage=function(e){var t=this.getProfileStorageKey();this.memoryCache.set(t,e);try{this.storage.setItem(t,JSON.stringify(e))}catch(e){h.warn("profile session-storage write failed; using memory only",e)}},e.prototype.removeProfile=function(){var e=this.getProfileStorageKey();this.storage.removeItem(e),this.memoryCache.delete(e)},e.prototype.removeProfileIfOtherUser=function(e){if(e){var t=this.getProfileFromStorage();t&&t.userId!==e&&this.removeProfile()}},e}();!function(e){e.GUEST="guest"}(ee||(ee={}));var re,ne=function(){function e(e,t){var r=this;this.REAUTH_SCOPE="reauthenticated",this.valid=!1,this.isReauth=function(){return r.scope.indexOf(r.REAUTH_SCOPE)>=0},this.client_id="",this.scope="",this.expire=new Date,this.user_id="",this.tokenValue="",this.sid="",this.state=null,this.fromFragment=!1,this.impersonatorId="",this.isImpersonatedSession=!1;var n=e.valid,o=e.tokenValue,i=e.access_token,s=e.state,a=e.other,c=o||i,u=this.parseJwt(c);if(!u)throw new Error("token cannot be decoded ".concat(c));this.state=S.toJson(s);var l=u.client_id,d=u.user_id,p=u.scope,h=u.sid,f=u.imp_id,v=u.imp_sid,g=u.pba,m=u.atp,y=u.gse,k=u.fdi;this.atp=m,this.client_id=l,this.expire=t,this.user_id=d,this.scope=p,this.valid=n,this.tokenValue=c,this.sid=h,this.other=a,this.impersonatorId=f||"",this.isImpersonatedSession=!!v,this.pbaSatisfiedPolicies=g&&g.split(",")||[],this.isGuestToken=this.atp===ee.GUEST,this.gse=y,this.fdi=k}return e.prototype.parseJwt=function(e){if(!e)return null;try{return JSON.parse(atob(e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/")))}catch(t){return h.error("error on decoding token ",e,t),null}},e.prototype.validate=function(e,t){var r,n,o,i=this.valid,s=this.client_id,a=this.scope,c=this.expire;return c0&&(r=new Array(n+1).join(e)+r),r}("0",5,e.toString(2))},pe=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("Data is not a string");var r=e.toLowerCase().split("");!function(e){if(e.length%8!=0)throw new Error("Data length is not a multiple of 8");e.forEach((function(e){if(!(e in le))throw new Error("Unknown encoded character "+e)}));var t=!1;e.forEach((function(e){if("="!==e&&t)throw new Error("Found padding char in the middle of the string");"="===e&&(t=!0)}))}(r);var n=function(e){for(var t=e.length-1,r=0;"="===e[t];)++r,--t;return r}(r),o=[];r.forEach((function(e){o.push(de(le[e]))}));var i=o.join("");return n>0&&(i=i.slice(0,-5*n)),i.length%8!=0&&(i=i.slice(0,i.length%8*-1)),t?function(e){var t="";if(e.length%8!=0)throw new Error("Length must be a multiple of 8");for(var r=0,n=e.length;r9e5?(h.info("Organizations cache expired"),this.clearOrganizationsCache(),null):r}catch(e){return h.error("Error parsing cached organizations",e),this.clearOrganizationsCache(),null}},e.prototype.saveOrganizationsToCache=function(e){var t=this.getOrganizationsStorageKey();this.storage.setItem(t,JSON.stringify(e))},e.prototype.clearOrganizationsCache=function(){var e=this.getOrganizationsStorageKey();this.storage.removeItem(e)},e}(),Se=function(){function e(e,t){void 0===e&&(e=null);var n=this;this.initialized=!1,this.instanceKey="adobeIMS",this.onPopupMessage=function(e){if(e&&n.adobeIdData.onModalModeSignInComplete){var t=n.tokenService.getTokenFromFragment(e);if(t instanceof ne&&(n.tokenService.addTokenToStorage(t),n.adobeIdData.onModalModeSignInComplete(t)))return Promise.resolve()}return m.replaceUrl(e),n.initialize()},this.signIn=function(){for(var e=[],t=0;tke.lastUserInteraction&&(ke.lastUserInteraction=o)}return n.tokenService.refreshToken(e).then((function(e){return n.onTokenProfileReceived(e)})).catch((function(e){if(h.error("refresh token error",e),e instanceof J)return Promise.reject(e);var t=n.verifyRideErrorExceptionStrict(e);return t||(n.profileService.removeProfile(),n.onTokenExpired(e),Promise.reject(e))}))},this.switchProfile=function(e,t){return void 0===t&&(t={}),e?n.tokenService.switchProfile(e,t).then((function(e){return n.onTokenProfileReceived(e)})).catch((function(e){return n.verifyRideErrorException(e)})):Promise.reject(new Error("Please provide the user id for switchProfile"))},this.executeErrorCallback=function(e){if(h.info("initialize exception ended",e),!e||e.type!==re.LOGOUT){var t=n.adobeIdData.onError;t&&t(M.HTTP,"Initialization error",be(e))}},this.triggerOnImsInstance=function(e){var t=document.createEvent("CustomEvent"),r={clientId:n.adobeIdData.client_id,instance:e};t.initCustomEvent("onImsLibInstance",!1,!1,r),window.dispatchEvent(t)},this.processInitializeException=function(e){return void 0===e&&(e={}),h.warn("initialize",e),n.restoreHash(),Promise.reject(e)},this.verifyModalSignInEvent=function(e){return e instanceof ue?n.notifyParentAboutModalSignIn(e):Promise.reject(e)},this.verifyTokenExpiredException=function(e){return e instanceof ae?(n.adobeIdData.handlers.triggerOnAccessTokenHasExpired(e),Promise.resolve()):Promise.reject(e)},this.verifyRideErrorException=function(e){return o(n,void 0,Promise,(function(){return i(this,(function(t){switch(t.label){case 0:return e instanceof K?this.adobeIdData.overrideErrorHandler&&!this.adobeIdData.overrideErrorHandler(e)?[2,Promise.reject(e)]:e.isPbaExpiredIdleSessionWorkaround?[4,this.signIn()]:[3,2]:[3,4];case 1:return t.sent(),[3,4];case 2:return e.jump?(this.purgeCredentialsAndProfile(),[4,m.replaceUrlAndWait(e.jump,1e4)]):[3,4];case 3:t.sent(),t.label=4;case 4:return[2,Promise.reject(e)]}}))}))},this.verifyRideErrorExceptionStrict=function(e){return e instanceof K?n.verifyRideErrorException(e):null},this.verifyCsrfException=function(e){var t=e.type;return t&&t===M.CSRF&&n.signOut(),Promise.reject(e)},this.processTokenResponse=function(e){var t=n.adobeIdData.handlers,r=e.tokenFields,o=e.profile,i=r.tokenValue,s=r.state,a=r.expire,c=r.sid,u=r.user_id,l=r.other,d=void 0===l?{}:l,p=r.impersonatorId,f=r.isImpersonatedSession,v=r.pbaSatisfiedPolicies,g=r.isGuestToken,y=r.gse,k=r.fdi;h.info("token",i),d.from_ims&&m.setHash(d.old_hash||""),n.profileService.removeProfileIfOtherUser(u);var b={token:i,expire:a,sid:c,impersonatorId:p,isImpersonatedSession:f,pbaSatisfiedPolicies:v,isGuestToken:g,gse:y,fdi:k};return r.isReauth()?t.triggerOnReauthAccessToken(b):n.tokenReceived(b),o&&n.profileService.saveProfileToStorage(o),Promise.resolve(s)},this.exchangeIjt=function(e){var t=n.adobeIdData.ijt;return e||t?n.tokenService.exchangeIjt(e||t).then((function(e){return e.profile?n.profileService.saveProfileToStorage(e.profile):n.profileService.removeProfile(),Promise.resolve(e)})):Promise.reject(new Error("please set the adobeid.ijt value"))},this.adobeIdData=new B(e),t&&(this.instanceKey=t),this.instanceId="imslib-".concat(Math.random().toString(36).substring(2,9));var c=this.adobeIdData,u=c.api_parameters,l=void 0===u?{}:u,d=c.client_id,p=c.scope,f=c.useLocalStorage,v=c.autoValidateToken,y=c.modalMode,k=c.modalSettings,b=c.ignoreUrlToken;this.imsApis=new X(l),this.csrfService=new g(d,this.instanceKey),this.serviceRequest={clientId:d,scope:p,imsApis:this.imsApis},this.tokenService=new me(r(r({},this.serviceRequest),{useLocalStorage:f,autoValidateToken:v,ignoreUrlToken:b}),this.csrfService),this.profileService=new te(this.serviceRequest),this.organizationsService=new we(this.serviceRequest),this.signInservice=y?new O(this.onPopupMessage,k):new P;var w=new BroadcastChannel("imslib-signout");w.addEventListener("message",this.onSignOutEventReceived.bind(this)),window.signoutBroadcastChannel=w}return Object.defineProperty(e.prototype,"version",{get:function(){return k.jslibver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adobeid",{get:function(){return r({},this.adobeIdData)},enumerable:!1,configurable:!0}),e.prototype.enableLogging=function(){h.enableLogging()},e.prototype.disableLogging=function(){h.disableLogging()},e.prototype.checkInitialized=function(){this.initialized},e.prototype.signUp=function(e,t){var r=this;void 0===e&&(e={}),this.checkInitialized();var n=this.adobeIdData,o=this.csrfService;if(!n)throw new Error("no adobeId on reAuthenticate");var i=o.initialize();return n.createSignUpRedirectRequest(e,t,i).then((function(e){r.signInservice.signIn(e)}))},e.prototype.isSignedInUser=function(){var e=this.getAccessToken();return(!e||!e.isGuestToken)&&!(!e&&!this.getReauthAccessToken())},e.prototype.getProfile=function(){var e=this,t=this.profileService.getProfileFromStorage();if(t)return Promise.resolve(t);var r=this.getAccessToken()||this.getReauthAccessToken();if(!r){var n="please login before getting the profile";return Promise.reject(new Z(n))}if(r.isGuestToken){n="guest account does not have a profile";return Promise.reject(new Z(n))}return this.profileService.getProfile(r.token).then((function(e){return Promise.resolve(e)})).catch((function(t){return h.error("get profile exception ",t),t instanceof J?e.refreshToken().then((function(e){return Promise.resolve(e.profile)})):Promise.reject(new Z(t.message||t))}))},e.prototype.getOrganizations=function(){var e=this.getAccessToken()||this.getReauthAccessToken();return e?e.isGuestToken?(h.warn("getOrganizations: guest account does not have organizations"),Promise.reject(new Error("Guest accounts do not have organizations."))):this.organizationsService.getOrganizations(e.token).then((function(e){return Promise.resolve(e)})).catch((function(e){return h.error("get organizations exception",e),Promise.reject(e)})):(h.warn("getOrganizations: please login before getting organizations"),Promise.reject(new Error("No access token available. Please login before getting organizations.")))},e.prototype.avatarUrl=function(e){return this.imsApis.avatarUrl(e)},e.prototype.getReleaseFlags=function(e){return void 0===e&&(e=!1),e?this.tokenService.getDecodedReleaseFlags():this.tokenService.getReleaseFlags()},e.prototype.getAccessToken=function(){return this.getTokenFromStorage(!1)},e.prototype.getOrFetchAccessToken=function(){var e=this.getAccessToken();return e?Promise.resolve(e):this.refreshToken().then((function(e){return e.tokenInfo}))},e.prototype.getReauthAccessToken=function(){return this.getTokenFromStorage(!0)},e.prototype.getTokenFromStorage=function(e){var t=this.tokenService.getTokenFieldsFromStorage(e);return t?{token:t.tokenValue,expire:t.expire,sid:t.sid,impersonatorId:t.impersonatorId,isImpersonatedSession:t.isImpersonatedSession,pbaSatisfiedPolicies:t.pbaSatisfiedPolicies,isGuestToken:t.isGuestToken,gse:t.gse,fdi:t.fdi}:null},e.prototype.listSocialProviders=function(){var e=this;return new Promise((function(t,r){var n=e.adobeIdData.client_id;e.imsApis.listSocialProviders({client_id:n}).then((function(e){t(e)})).catch((function(e){r(e)}))}))},e.prototype.tokenReceived=function(e){this.adobeIdData.handlers.triggerOnAccessToken(e),ke.startAutoRefreshFlow({expire:e.expire,refreshTokenMethod:this.refreshToken})},e.prototype.onTokenProfileReceived=function(e){var t=e.tokenInfo,r=e.profile;return h.info("token",t),this.tokenReceived(t),this.profileService.saveProfileToStorage(r),Promise.resolve(e)},e.prototype.validateToken=function(){var e=this;return this.tokenService.validateToken().then((function(){return Promise.resolve(!0)})).catch((function(t){return h.warn("validate token exception",t),t instanceof J||e.profileService.removeProfile(),Promise.reject(!1)}))},e.prototype.onTokenExpired=function(e){var t=this.adobeIdData.handlers;this.tokenService.purge(),t.triggerOnAccessTokenHasExpired(e)},e.prototype.setStandAloneToken=function(e){return this.tokenService.setStandAloneToken(e)},e.prototype.initialize=function(){var e,t=this,r=this.adobeIdData,n=r.handlers,o=r.standalone,i=r.ijt,s=r.alwaysRemoveTokenFromUrl,a=r.enableGuestAccounts,c=r.enableGuestTokenForceRefresh,u=r.enableGuestBotDetection,l=r.guestBotDetectionProvider,d=null;switch(o&&this.setStandAloneToken(o),!0){case!!i:e=this.exchangeIjt;break;case a:e=this.tokenService.getGuestToken.bind(this.tokenService,{},{enableGuestAccounts:a,enableGuestTokenForceRefresh:c,enableGuestBotDetection:u,guestBotDetectionProvider:l});break;default:e=this.tokenService.getTokenAndProfile}return e().then(this.processTokenResponse,this.processError.apply(this)).then((function(e){d=e})).finally((function(){h.info("onReady initialization"),window.addEventListener("getImsLibInstance",(function(){t.triggerOnImsInstance(t)}),!1),s&&m.setHash(I.removeAccessToken()),n.triggerOnReady(d?d.context:null),t.triggerOnImsInstance(t),t.initialized=!0}))},e.prototype.purgeCredentialsAndProfile=function(){this.tokenService.purge(),this.profileService.removeProfile()},e.prototype.processError=function(){var e=this;return function(t){return e.verifyModalSignInEvent(t).catch(e.processInitializeException).catch(e.verifyTokenExpiredException).catch(e.verifyRideErrorException).catch(e.verifyCsrfException).catch(e.executeErrorCallback)}},e.prototype.notifyParentAboutModalSignIn=function(e){var t=window.location.href.replace("imslibmodal","wasmodal");if(window.opener)window.opener.postMessage(t,window.location.origin),window.close();else{var r=new BroadcastChannel("imslib");r.postMessage(t),r.close(),window.close()}return Promise.reject("popup")},e.prototype.restoreHash=function(){var e=I.fragmentToObject();e&&e.from_ims&&m.setHash(e.old_hash||"")},e.prototype.getTransitoryAuthorizationCode=function(e,t){return void 0===t&&(t={}),(e=e||{}).response_type=e.response_type||"code",e.target_client_id=e.target_client_id||this.adobeIdData.client_id,e.target_scope=e.target_scope||this.adobeIdData.scope,this.imsApis.getTransitoryAuthorizationCode(e,t,this.adobeIdData.client_id)},e.prototype.jumpToken=function(e,t){return void 0===t&&(t={}),e.target_client_id=e.target_client_id||this.adobeIdData.client_id,e.target_scope=e.target_scope||this.adobeIdData.scope,this.imsApis.jumpToken(e,t,this.adobeIdData.client_id)},e.prototype.getVerifierByKey=function(e){return(new q).getVerifierByKey(e)},e.prototype.socialHeadlessSignIn=function(e){return o(this,arguments,Promise,(function(e,t){var r=this;return void 0===t&&(t={}),i(this,(function(n){return[2,this.imsApis.socialHeadlessSignIn(e,t).then((function(e){return r.exchangeIjt(e.token)})).catch((function(t){return"ride_AdobeID_social"===t.error&&r.signIn({idp_flow:"social.native",provider_id:e.provider_id,idp_token:e.idp_token}),Promise.reject(t)}))]}))}))},e.prototype.getAccountType=function(){var e=this.getAccessToken();if(!e)throw new Error("please login before getting the account type");if(e.isGuestToken)return ie.GUEST;var t=this.profileService.getProfileFromStorage();if(!t)throw new Error("you need to first get the profile before getting the account type");return t.account_type},e.prototype.getSessionExpiration=function(){var e=this.getAccessToken();if(!e)throw new Error("please obtain a token before getting the session expiration");return e.gse},e.prototype.jumpTokenToDevice=function(e,t){void 0===t&&(t={});var r=this.tokenService.getTokenFieldsFromStorage(),n=r?r.user_id:null;return this.imsApis.jumpTokenToDevice(e,t,this.adobeIdData.client_id,n)},e.prototype.onSignOutEventReceived=function(e){e.data.clientId===this.adobeIdData.client_id&&e.data.instanceId!==this.instanceId&&(this.tokenService.purge(),this.profileService.removeProfile(),"function"==typeof this.adobeIdData.onSignOutEventReceived&&this.adobeIdData.onSignOutEventReceived())},e}(),Ie=new(function(){function e(){this.createIMSLib=function(e,t){void 0===e&&(e=null),void 0===t&&(t="adobeIMS");var r=new Se(e,t);return window[t]=r,r}}return e.prototype.initAdobeIms=function(){window.adobeImsFactory={createIMSLib:this.createIMSLib};var e=window.adobeIMS||null;if(!e){var t=window.adobeid;if(!t||!t.client_id)return;(e=this.createIMSLib(t,"adobeIMS")).initialize()}},e}());return new(function(){function e(){Ie.initAdobeIms()}return e.prototype.initialize=function(){return!0},e}())}();