var roll=function(){ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ 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)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};function t(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var r=function(){return(r=Object.assign||function(e){for(var t,r=1,i=arguments.length;r0&&o[o.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!o||n[1]>o[0]&&n[1]0)&&!(i=n.next()).done;)s.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function a(){for(var e=[],t=0;t0?n+"&client_id="+t+"&api="+i:n+"?client_id="+t+"&api="+i},e.createRedirectUrl=function(e,t,r,i,o){void 0===o&&(o="");var n=this.createDefaultRedirectUrl(e,t,r,i);(o=o||r.scope||"")&&(n=n+"&scope="+o);var s=r.reauth||"";return s&&(n=n+"&reauth="+s),n},e.createOldHash=function(e){var t=e.indexOf("#");return t<0?e+"#old_hash=&from_ims=true":e.substring(0,t)+"#old_hash="+e.substring(t+1)+"&from_ims=true"},e.mergeApiParamsWithExternalParams=function(e,t,r){return y(S.getCustomApiParameters(e,r),t)},e}(),I=function(){var e=this;this.composeRedirectUrl=function(e){var t=e.apiParameters,i=e.externalParameters,o=void 0===i?{}:i,n=e.adobeIdRedirectUri,s=void 0===n?"":n,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=b.mergeApiParamsWithExternalParams(t,o,"authorize");l&&(h.state=y(h.state||{},l));var f=b.createRedirectUrl(s,a,h,"authorize",p),v=o.locale||c||"",m=e.response_type,k=void 0===m?h.response_type||"":m;return r(r({},h),{client_id:a,scope:p,locale:v,response_type:k,jslVersion:g.jslibver,redirect_uri:f})},this.createRedirectUrl=function(t){var r=e.composeRedirectUrl(t),i=v.uriEncodeData(r);return g.baseUrlAdobe+"/ims/authorize/v1?"+i}},_=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.signIn=function(e){var r=t.createRedirectUrl(e);v.setHrefUrl(r)},t.authorizeToken=function(e,r){var i=t.composeRedirectUrl(r);e&&(i.user_assertion=e,i.user_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),t.createAuthorizeForm(i).submit()},t}return t(r,e),r.prototype.createAuthorizeForm=function(e){var t=g.baseUrlAdobe+"/ims/authorize/v1",r=document.createElement("form");r.style.display="none",r.setAttribute("method","post"),r.setAttribute("action",t);var i=null,o=null,n="";for(var s in e){if("object"==typeof(o=e[s])){if(0===Object.keys(o).length)continue;n=JSON.stringify(o)}else n=o;""!==n&&(i=this.createFormElement("input","text",s,n),r.appendChild(i))}return document.getElementsByTagName("body")[0].appendChild(r),r},r.prototype.createFormElement=function(e,t,r,i){var o=document.createElement(e);return o.setAttribute("type",t),o.setAttribute("name",r),o.setAttribute("value",i),o},r}(I),R=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/,P=["https://auth.services.adobe.com","https://auth-stg1.services.adobe.com","https://localhost.corp.adobe.com:9000"],T=new function(){var e=this;this.windowObjectReference=null,this.previousUrl="",this.openSignInWindow=function(t,r,i,o){e.onProcessLocation=o,e.allowOrigin=i.allowOrigin,e.timerId&&clearInterval(e.timerId),window.removeEventListener("message",e.receiveMessage),window.addEventListener("message",e.receiveMessage);var n="toolbar=no, menubar=no, width="+i.width+", height="+i.height+", top="+i.top+", left="+i.left;!e.windowObjectReference||e.windowObjectReference&&e.windowObjectReference.closed?e.windowObjectReference=window.open(t,i.title,n):e.previousUrl!==t?(e.windowObjectReference=window.open(t,i.title,n),e.windowObjectReference&&e.windowObjectReference.focus()):e.windowObjectReference.focus();var s=e.windowObjectReference||{};s.opener||(e.timerId=setInterval((function(){s[r]&&(clearInterval(e.timerId),e.onProcessLocation&&e.onProcessLocation(s[r]),delete s[r],e.windowObjectReference&&e.windowObjectReference.close())}),500)),e.previousUrl=t},this.receiveMessage=function(t){if(a(P,[e.allowOrigin]).includes(t.origin)){try{if(!R.test(t.data))return}catch(e){return}e.onProcessLocation&&e.onProcessLocation(t.data)}}},A=function(e){function i(t,i){var o=e.call(this)||this;return o.signIn=function(e){e.state=r(r({},e.state),{imslibmodal:!0});var t=e.state.nonce,i=o.createRedirectUrl(e);T.openSignInWindow(i,t,o.popupSettings,o.onPopupMessage)},o.onPopupMessage=t,o.popupSettings=i,o}return t(i,e),i}(I),E=function(){this.signOut=function(e){var t=e.apiParameters,i=e.externalParameters,o=e.adobeIdRedirectUri,n=void 0===o?"":o,s=e.clientId,a=b.mergeApiParamsWithExternalParams(t,i,"logout"),c=b.createDefaultRedirectUrl(n,s,a,"logout"),u=r(r({},a),{client_id:s,redirect_uri:c,jslVersion:g.jslibver}),l=v.uriEncodeData(u),d=g.baseUrlAdobe+"/ims/logout/v1?"+l;v.replaceUrl(d)}},j=function(e){void 0===e&&(e={}),this.title="Adobe ID",this.width=600,this.top=100,this.left=100;var t=e.title,r=void 0===t?"Adobe ID":t,i=e.width,o=void 0===i?600:i,n=e.height,s=void 0===n?700:n,a=e.top,c=void 0===a?100:a,u=e.left,l=void 0===u?100:u,d=e.allowedOrigin;this.title=r,this.width=o,this.height=s,this.top=c,this.left=l,this.allowOrigin=d},O=function(e){this.token="",this.sid="",this.expirems=0;var t=e.token,r=e.expirems;this.token=t,this.expirems=r};!function(e){e.force="force",e.check="check"}(k||(k={})),function(e){e.token="token",e.code="code"}(w||(w={}));var x,D=function(){this.appCode="",this.appVersion=""},U=function(){function e(){this.storage=h.getAvailableStorage()}return e.prototype.b64Uri=function(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},e.prototype.createCodeChallenge=function(e,t){var r=this;void 0===t&&(t=43);for(var i=window.msCrypto||window.crypto,o=this.b64Uri(Array.prototype.map.call(i.getRandomValues(new Uint8Array(t)),(function(e){return String.fromCharCode(e)})).join("")).substring(0,t),n=new Uint8Array(o.length),s=0;s=0?new N("ride_pba_idle_session","",!0):null;var o=this.addRedirectUriToJump(r,i);return new N(r,o)},e.prototype.addRedirectUriToJump=function(e,t){if(!t||"string"!=typeof t)return"";var r=t;this.adobeIdThinData||(this.adobeIdThinData=new F);var i=this.adobeIdThinData.computeRideRedirectUri(e);if(!i||0===i.length)return r;try{var o=new URL(r);return o.searchParams.append("redirect_uri",i),o.toString()}catch(e){return r}},e.prototype.isUnauthorizedException=function(e){var t=e.status;return 401===(void 0===t?0:t)},e}()),M=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}(),L=new(function(){function e(){}return e.prototype.http=function(e){return new Promise((function(t,r){var i=new(0,window.XMLHttpRequest);i.withCredentials=!0,i.open(e.method,e.url,!0);var o;i.onload=function(){return this.status>=200&&this.status<300?t(new M(this.status,this.response)):r(new M(this.status,this.response))},i.onerror=function(){var e=new M(this.status,this.response);return r(e)},(o=e.headers)&&Object.keys(o).forEach((function(e){i.setRequestHeader(e,o[e])})),i.send(e.data)}))},e.prototype.post=function(e,t,r){return void 0===r&&(r={}),this.http({headers:r,method:"POST",url:e,data:t})},e.prototype.get=function(e,t){return void 0===t&&(t={}),this.http({headers:t,method:"GET",url:e})},e}()),q=new(function(){function e(){this.triggerOnError=null}return e.prototype.post=function(e,t,r){var i=this;void 0===r&&(r={});var o=V.getCachedApiResponse(e,t);if(o){var n=o.status,s=o.data;return 200===n?Promise.resolve(s):Promise.reject(s)}return L.post(e,t,r).then((function(r){return i.storeApiResponse(e,JSON.stringify(t),r)})).catch((function(r){return i.verifyError(e,JSON.stringify(t),r)}))},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var i=V.getCachedApiResponse(e);if(i){var o=i.status,n=i.data;return 200===o?Promise.resolve(n):Promise.reject(n)}return L.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 i=z.verify(r,e);return Promise.reject(i||r.data)},e.prototype.storeApiResponse=function(e,t,r){return void 0===t&&(t=""),V.storeApiResponse(e,t,r),Promise.resolve(r.data)},e}()),J=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,i=e.client_id,o=v.uriEncodeData(r(r({},S.getCustomApiParameters(this.apiParameters,"validate_token")),{type:"access_token",client_id:i,token:t})),n=g.baseUrlAdobe+"/ims/validate_token/v1?jslVersion="+g.jslibver,s=this.formEncoded();return this.addClientIdInHeader(i,s),q.post(n,o,s)},e.prototype.getProfile=function(e){var t=e.token,i=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"profile")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/profile/v1?"+s+"&jslVersion="+g.jslibver;return q.get(a,n)},e.prototype.getUserInfo=function(e){var t=e.token,i=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"userinfo")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/userinfo/v1?"+s+"&jslVersion="+g.jslibver;return q.get(a,n)},e.prototype.logoutToken=function(e){var t=e.client_id,i=e.token,o=r({},S.getCustomApiParameters(this.apiParameters,"logout_token")),n=g.baseUrlServices+"/ims/logout/v1?jslVersion="+g.jslibver,s=this.addClientIdInHeader(t);return q.post(n,r({client_id:t,access_token:i},o),s)},e.prototype.checkStatus=function(){var e=g.baseUrlServices+"/ims/check/v1/status";return q.get(e)},e.prototype.checkToken=function(e,t,i){var o=e.client_id,n=e.scope,s=r({},S.mergeExternalParameters(t,this.apiParameters,"check_token")),a=g.baseUrlServices+"/ims/check/v6/token?jslVersion="+g.jslibver,c=r(r({},s),{client_id:o,scope:n});i&&(c.user_id=i);var u=v.uriEncodeData(c),l=this.formEncoded();return this.addClientIdInHeader(o,l),q.post(a,u,l)},e.prototype.switchProfile=function(e,t,i){void 0===i&&(i="");var o=e.client_id,n=e.scope,s=void 0===n?"":n,a=r({},S.mergeExternalParameters(t,this.apiParameters,"check_token")),c=g.baseUrlServices+"/ims/check/v6/token?jslVersion="+g.jslibver,u=v.uriEncodeData(r(r({},a),{client_id:o,scope:s,user_id:i})),l=this.formEncoded();return this.addClientIdInHeader(o,l),q.post(c,u,l)},e.prototype.listSocialProviders=function(e){var t=e.client_id,i=r({},S.getCustomApiParameters(this.apiParameters,"providers")),o=v.uriEncodeData(r({client_id:t},i)),n=g.baseUrlServices+"/ims/social/v1/providers?"+o+"&jslVersion="+g.jslibver,s=this.addClientIdInHeader(t);return q.get(n,s)},e.prototype.exchangeIjt=function(e,t){var i=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"ijt")),n=g.baseUrlServices+"/ims/jump/implicit/"+t,s=v.uriEncodeData(r({client_id:i},o)),a=n+"?"+s+"&jslVersion="+g.jslibver;a.length>2048&&(delete o.redirect_uri,a=n+"?"+(s=v.uriEncodeData(o)));var c=this.addClientIdInHeader(i);return q.get(a,c)},e.prototype.avatarUrl=function(e){return g.baseUrlAdobe+"/ims/avatar/download/"+e},e.prototype.getReleaseFlags=function(e){var t=e.token,i=e.client_id,o=r({},S.getCustomApiParameters(this.apiParameters,"fg_value")),n=this.createAuthorizationHeader(t);this.addClientIdInHeader(i,n);var s=v.uriEncodeData(r({client_id:i},o)),a=g.baseUrlAdobe+"/ims/fg/value/v1?"+s+"&jslVersion="+g.jslibver;return q.get(a,n)},e.prototype.getTransitoryAuthorizationCode=function(e,t,i){void 0===t&&(t={});var o=r({},S.mergeExternalParameters(t,this.apiParameters,"check_token")),n=g.baseUrlServices+"/ims/check/v6/token?client_id="+i+"&jslVersion="+g.jslibver,s=v.uriEncodeData(r(r({},o),e)),a=this.formEncoded();return this.addClientIdInHeader(i,a),q.post(n,s,a)},e.prototype.getTokenFromCode=function(e,t){void 0===t&&(t={});var i=r({},S.mergeExternalParameters(t,this.apiParameters,"token"));i.grant_type="authorization_code",delete e.other;var o=g.baseUrlServices+"/ims/token/v3?jslVersion="+g.jslibver,n=v.uriEncodeData(r(r({},i),e)),s=this.formEncoded();return this.addClientIdInHeader(e.client_id,s),q.post(o,n,s)},e.prototype.jumpToken=function(e,t,i){void 0===t&&(t={});var o=r({},S.mergeExternalParameters(t,this.apiParameters,"jumptoken")),n=g.baseUrlServices+"/ims/jumptoken/v1?client_id="+i+"&jslVersion="+g.jslibver,s=v.uriEncodeData(r(r({},o),e)),a=this.formEncoded();return this.addClientIdInHeader(i,a),q.post(n,s,a)},e.prototype.socialHeadlessSignIn=function(e,t){void 0===t&&(t={});var i=r({},S.mergeExternalParameters(t,this.apiParameters,"jumptoken")),o=g.baseUrlServices+"/ims/social/v2/native?jslVersion="+g.jslibver,n=v.uriEncodeData(r(r(r({},i),e),{response_type:"implicit_jump"}));return q.post(o,n,this.formEncoded())},e.prototype.createAuthorizationHeader=function(e){var t={};return e&&(t[d]="Bearer "+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}();!function(e){e.INITIALIZE_ERROR="initialize_error",e.HTTP="http",e.FRAGMENT="fragment",e.CSRF="csrf",e.NOT_AUTHORIZE="not_authorize",e.PROFILE_EXCEPTION="profile_exception",e.TOKEN_EXPIRED="token_expired",e.SOCIAL_PROVIDERS="SOCIAL_PROVIDERS",e.RIDE_EXCEPTION="ride_exception"}(x||(x={}));var K=function(e){this.message=null,this.errorType=x.PROFILE_EXCEPTION,this.message=e};function B(e){return e.split(",").sort().join(",")}var W,G=function(){function e(e){this.profileServiceRequest=e,this.storage=h.getStorageByName(c.SessionStorage)}return e.prototype.getProfile=function(e){var t=this,r=this.profileServiceRequest,i=r.clientId,o=r.imsApis,n=this.getProfileFromStorage();return n?Promise.resolve(n):o.getProfile({client_id:i,token:e}).then((function(e){if(!e)throw new K("NO profile response");if(0===Object.keys(e).length)throw new K("NO profile value");return t.saveProfileToStorage(e),Promise.resolve(e)})).catch((function(e){return e instanceof H?Promise.reject(e):(t.removeProfile(),Promise.reject(e))}))},e.prototype.getProfileStorageKey=function(){var e=this.profileServiceRequest;return"adobeid_ims_profile/"+e.clientId+"/"+!1+"/"+B(e.scope)},e.prototype.getProfileFromStorage=function(){var e=this.getProfileStorageKey(),t=this.storage.getItem(e);return t&&JSON.parse(t)},e.prototype.saveProfileToStorage=function(e){var t=this.getProfileStorageKey();this.storage.setItem(t,JSON.stringify(e))},e.prototype.removeProfile=function(){var e=this.getProfileStorageKey();this.storage.removeItem(e)},e.prototype.removeProfileIfOtherUser=function(e){if(e){var t=this.getProfileFromStorage();t&&t.userId!==e&&this.removeProfile()}},e}(),Z=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 i=e.valid,o=e.tokenValue,n=e.access_token,s=e.state,a=e.other,c=o||n,u=this.parseJwt(c);if(!u)throw new Error("token cannot be decoded "+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;this.client_id=l,this.expire=t,this.user_id=d,this.scope=p,this.valid=i,this.tokenValue=c,this.sid=h,this.other=a,this.impersonatorId=f||"",this.isImpersonatedSession=!!v,this.pbaSatisfiedPolicies=g&&g.split(",")||[]}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 p.error("error on decoding token ",e,t),null}},e.prototype.validate=function(e,t){var r,i,o,n=this.valid,s=this.client_id,a=this.scope,c=this.expire;return c0&&(r=new Array(i+1).join(e)+r),r}("0",5,e.toString(2))},oe=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 re))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 i=function(e){for(var t=e.length-1,r=0;"="===e[t];)++r,--t;return r}(r),o=[];r.forEach((function(e){o.push(ie(re[e]))}));var n=o.join("");return i>0&&(n=n.slice(0,-5*i)),n.length%8!=0&&(n=n.slice(0,n.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,i=e.length;rae.lastUserInteraction&&(ae.lastUserInteraction=o)}return t.tokenService.refreshToken(e).then((function(e){return t.onTokenProfileReceived(e)})).catch((function(e){if(p.error("refresh token error",e),e instanceof H)return Promise.reject(e);var r=t.verifyRideErrorExceptionStrict(e);return r||(t.profileService.removeProfile(),t.onTokenExpired(),Promise.reject(e))}))},this.switchProfile=function(e,r){return void 0===r&&(r={}),e?t.tokenService.switchProfile(e,r).then((function(e){return t.onTokenProfileReceived(e)})).catch((function(e){return t.verifyRideErrorException(e)})):Promise.reject(new Error("Please provide the user id for switchProfile"))},this.triggerOnImsInstance=function(e){var r=document.createEvent("CustomEvent"),i={clientId:t.adobeIdData.client_id,instance:e};r.initCustomEvent("onImsLibInstance",!1,!1,i),window.dispatchEvent(r)},this.processInitializeException=function(e){void 0===e&&(e={});var r=t.adobeIdData.handlers;return p.warn("initialize",e),e instanceof te?t.notifyParentAboutModalSignIn(e):(t.restoreHash(),e instanceof $&&r.triggerOnAccessTokenHasExpired(),Promise.reject(e))},this.verifyRideErrorException=function(e){return o(t,void 0,Promise,(function(){return n(this,(function(t){if(e instanceof N){if(this.adobeIdData.overrideErrorHandler&&!this.adobeIdData.overrideErrorHandler(e))return[2,Promise.reject(e)];e.isPbaExpiredIdleSessionWorkaround?this.signIn():e.jump&&v.replaceUrl(e.jump)}return[2,Promise.reject(e)]}))}))},this.verifyRideErrorExceptionStrict=function(e){return e instanceof N?t.verifyRideErrorException(e):null},this.verifyCsrfException=function(e){var r=e.type;return r&&r===x.CSRF&&t.signOut(),Promise.reject(e)},this.processTokenResponse=function(e){var r=t.adobeIdData.handlers,i=e.tokenFields,o=e.profile,n=i.tokenValue,s=i.state,a=i.expire,c=i.sid,u=i.user_id,l=i.other,d=void 0===l?{}:l,h=i.impersonatorId,f=i.isImpersonatedSession,g=i.pbaSatisfiedPolicies;p.info("token",n),d.from_ims&&v.setHash(d.old_hash||""),t.profileService.removeProfileIfOtherUser(u);var m={token:n,expire:a,sid:c,impersonatorId:h,isImpersonatedSession:f,pbaSatisfiedPolicies:g};return i.isReauth()?r.triggerOnReauthAccessToken(m):t.tokenReceived(m),o&&t.profileService.saveProfileToStorage(o),Promise.resolve(s)},this.exchangeIjt=function(e){var r=t.adobeIdData.ijt;return e||r?t.tokenService.exchangeIjt(e||r).then((function(e){return e.profile?t.profileService.saveProfileToStorage(e.profile):t.profileService.removeProfile(),Promise.resolve(e)})):Promise.reject(new Error("please set the adobeid.ijt value"))},this.adobeIdData=new C(e);var i=this.adobeIdData,s=i.api_parameters,a=void 0===s?{}:s,c=i.client_id,u=i.scope,l=i.useLocalStorage,d=i.autoValidateToken,h=i.modalMode,g=i.modalSettings;this.imsApis=new J(a),this.csrfService=new f(c),this.serviceRequest={clientId:c,scope:u,imsApis:this.imsApis},this.tokenService=new ne(r(r({},this.serviceRequest),{useLocalStorage:l,autoValidateToken:d}),this.csrfService),this.profileService=new G(this.serviceRequest),this.signInservice=h?new A(this.onPopupMessage,g):new _}return Object.defineProperty(e.prototype,"version",{get:function(){return g.jslibver},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"adobeid",{get:function(){return r({},this.adobeIdData)},enumerable:!0,configurable:!0}),e.prototype.enableLogging=function(){p.enableLogging()},e.prototype.disableLogging=function(){p.disableLogging()},e.prototype.checkInitialized=function(){this.initialized},e.prototype.signUp=function(e,t){var r=this;void 0===e&&(e={}),this.checkInitialized();var i=this.adobeIdData,o=this.csrfService;if(!i)throw new Error("no adobeId on reAuthenticate");var n=o.initialize();return i.createSignUpRedirectRequest(e,t,n).then((function(e){r.signInservice.signIn(e)}))},e.prototype.isSignedInUser=function(){return!(!this.getAccessToken()&&!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){return Promise.reject(new K("please login before getting the profile"))}return this.profileService.getProfile(r.token).then((function(e){return Promise.resolve(e)})).catch((function(t){return p.error("get profile exception ",t),t instanceof H?e.refreshToken().then((function(e){return Promise.resolve(e.profile)})):Promise.reject(new K(t.message||t))}))},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.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}:null},e.prototype.listSocialProviders=function(){var e=this;return new Promise((function(t,r){var i=e.adobeIdData.client_id;e.imsApis.listSocialProviders({client_id:i}).then((function(e){t(e)})).catch((function(e){r(e)}))}))},e.prototype.tokenReceived=function(e){this.adobeIdData.handlers.triggerOnAccessToken(e),ae.startAutoRefreshFlow({expire:e.expire,refreshTokenMethod:this.refreshToken})},e.prototype.onTokenProfileReceived=function(e){var t=e.tokenInfo,r=e.profile;return p.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 p.warn("validate token exception",t),t instanceof H?Promise.reject(!1):(e.profileService.removeProfile(),Promise.reject(!1))}))},e.prototype.onTokenExpired=function(){var e=this.adobeIdData.handlers;this.tokenService.purge(),e.triggerOnAccessTokenHasExpired()},e.prototype.setStandAloneToken=function(e){return this.tokenService.setStandAloneToken(e)},e.prototype.initialize=function(){var e=this,t=this.adobeIdData,r=t.handlers,i=t.standalone,o=t.ijt,n=null;return i&&this.setStandAloneToken(i),(o?this.exchangeIjt:this.tokenService.getTokenAndProfile)().then(this.processTokenResponse,(function(t){return e.processInitializeException(t).catch((function(t){return e.verifyRideErrorException(t)})).catch((function(t){return e.verifyCsrfException(t).catch((function(e){return p.info("initialize exception ended",e)}))}))})).then((function(e){n=e})).finally((function(){return p.info("onReady initialization"),window.addEventListener("getImsLibInstance",(function(){e.triggerOnImsInstance(e)}),!1),r.triggerOnReady(n?n.context:null),e.triggerOnImsInstance(e),e.initialized=!0,Promise.resolve(n)}))},e.prototype.notifyParentAboutModalSignIn=function(e){var t=window.location.href.replace("imslibmodal","wasmodal");return window.opener?(window.opener.postMessage(t,window.location.origin),window.close()):window[""+e.wndRedirectPropName]=t,Promise.reject("popup")},e.prototype.restoreHash=function(){var e=X.fragmentToObject();e&&e.from_ims&&v.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 U).getVerifierByKey(e)},e.prototype.socialHeadlessSignIn=function(e,t){return void 0===t&&(t={}),o(this,void 0,Promise,(function(){var r=this;return n(this,(function(i){return[2,this.imsApis.socialHeadlessSignIn(e,t).then((function(e){return r.exchangeIjt(e.token)})).catch((function(e){return"ride_AdobeID_social"===e.error&&r.signIn(),Promise.reject(e)}))]}))}))},e}(),ue=new(function(){function e(){this.createIMSLib=function(e,t){void 0===e&&(e=null),void 0===t&&(t="adobeIMS");var r=new ce(e);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(){ue.initAdobeIms()}return e.prototype.initialize=function(){return!0},e}())}();