diff --git a/libs/deps/imslib.min.js b/libs/deps/imslib.min.js index ab5505bf74..ee4e1f813e 100644 --- a/libs/deps/imslib.min.js +++ b/libs/deps/imslib.min.js @@ -1,4 +1,4 @@ -// Built 2024-08-14T01:18:38.920Z - Last Modified 2024-08-13T11:31:26.000Z +// Built 2024-09-12T01:22:29.208Z - Last Modified 2024-09-11T13:09:14.000Z var roll=function(){ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. @@ -14,4 +14,4 @@ var roll=function(){ 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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}var r=function(){return(r=Object.assign||function(e){for(var t,r=1,o=arguments.length;r0&&n[n.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s}function a(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[o++],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],n)}}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,n)},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}(),m=new(function(){function e(){this.baseUrlAdobe="",this.baseUrlServices="",this.checkTokenEndpoint=new g,this.jslibver="v2-v0.44.0-4-g6b36690"}return e.prototype.loadEnvironment=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r="");var o=e===l.STAGE;o?(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=g.computeEndpoint(t,r,o,this.baseUrlServices)},e}());function y(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function k(e,t){if(null==e)return t;if(e===t)return e;if(!y(e))return e;var r=Object.assign({},e);return y(t)&&Object.keys(t).forEach((function(o){var n,i;y(t[o])?o in e?r[o]=k(e[o],t[o]):Object.assign(r,((n={})[o]=t[o],n)):Object.assign(r,((i={})[o]=t[o],i))})),r}var w=new(function(){function e(){this.getCustomApiParameters=function(e,t){return e[t]||{}}}return e.prototype.mergeExternalParameters=function(e,t,r){return k(this.getCustomApiParameters(t,r),e)},e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(e){return null}},e}()),b=function(){function e(){}return e.getInitialRedirectUri=function(e,t){var r=e.redirect_uri||t||window.location.href,o="function"==typeof r?r():r,n=o.indexOf("from_ims");return-1===n?o:("#"===o[n-1]&&n--,o.substr(0,n))},e.createDefaultRedirectUrl=function(e,t,r,o){var n=this.getInitialRedirectUri(r,e),i=this.createOldHash(n);return i.indexOf("?")>0?i+"&client_id="+t+"&api="+o:i+"?client_id="+t+"&api="+o},e.createRedirectUrl=function(e,t,r,o,n){void 0===n&&(n="");var i=this.createDefaultRedirectUrl(e,t,r,o);(n=n||r.scope||"")&&(i=i+"&scope="+n);var s=r.reauth||"";return s&&(i=i+"&reauth="+s),i},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 k(w.getCustomApiParameters(e,r),t)},e}(),S=function(){var e=this;this.composeRedirectUrl=function(e){var t=e.apiParameters,o=e.externalParameters,n=void 0===o?{}:o,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?n.scope||t.scope||"":d,h=b.mergeApiParamsWithExternalParams(t,n,"authorize");l&&(h.state=k(h.state||{},l));var f=b.createRedirectUrl(s,a,h,"authorize",p),v=n.locale||c||"",g=e.response_type,y=void 0===g?h.response_type||"":g;return r(r({},h),{client_id:a,scope:p,locale:v,response_type:y,jslVersion:m.jslibver,redirect_uri:f})},this.createRedirectUrl=function(t){var r=e.composeRedirectUrl(t),o=v.uriEncodeData(r);return m.baseUrlAdobe+"/ims/authorize/v1?"+o}},T=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 o=t.composeRedirectUrl(r);e&&(o.user_assertion=e,o.user_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),t.createAuthorizeForm(o).submit()},t}return t(r,e),r.prototype.createAuthorizeForm=function(e){var t=m.baseUrlAdobe+"/ims/authorize/v1",r=document.createElement("form");r.style.display="none",r.setAttribute("method","post"),r.setAttribute("action",t);var o=null,n=null,i="";for(var s in e){if("object"==typeof(n=e[s])){if(0===Object.keys(n).length)continue;i=JSON.stringify(n)}else i=n;""!==i&&(o=this.createFormElement("input","text",s,i),r.appendChild(o))}return document.getElementsByTagName("body")[0].appendChild(r),r},r.prototype.createFormElement=function(e,t,r,o){var n=document.createElement(e);return n.setAttribute("type",t),n.setAttribute("name",r),n.setAttribute("value",o),n},r}(S),I=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/,_=["https://auth.services.adobe.com","https://auth-stg1.services.adobe.com","https://localhost.corp.adobe.com:9000"],P=new function(){var e=this;this.windowObjectReference=null,this.previousUrl="",this.openSignInWindow=function(t,r,o,n){e.onProcessLocation=n,e.allowOrigin=o.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="+o.width+", height="+o.height+", top="+o.top+", left="+o.left;!e.windowObjectReference||e.windowObjectReference&&e.windowObjectReference.closed?e.windowObjectReference=window.open(t,o.title,i):e.previousUrl!==t?(e.windowObjectReference=window.open(t,o.title,i),e.windowObjectReference&&e.windowObjectReference.focus()):e.windowObjectReference.focus(),e.previousUrl=t},this.receiveMessage=function(t){if(a(_,[e.allowOrigin]).includes(t.origin)){try{if(!I.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)}},R=function(e){function o(t,o){var n=e.call(this)||this;return n.signIn=function(e){e.state=r(r({},e.state),{imslibmodal:!0});var t=e.state.nonce,o=n.createRedirectUrl(e);P.openSignInWindow(o,t,n.popupSettings,n.onPopupMessage)},n.onPopupMessage=t,n.popupSettings=o,n}return t(o,e),o}(S),E=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}(),A=new(function(){function e(){}return e.prototype.http=function(e){return new Promise((function(t,r){var o=new(0,window.XMLHttpRequest);"boolean"==typeof e.withCredentials?o.withCredentials=e.withCredentials:o.withCredentials=!0,"number"==typeof e.timeout&&(o.timeout=e.timeout),o.open(e.method,e.url,!0);var n;o.onload=function(){return this.status>=200&&this.status<300?t(new E(this.status,this.response)):r(new E(this.status,this.response))},o.onerror=function(){var e=new E(this.status,this.response);return r(e)},o.ontimeout=function(){var e=new E(0,"timeout");return r(e)},o.onabort=function(){var e=new E(0,"aborted");return r(e)},(n=e.headers)&&Object.keys(n).forEach((function(e){o.setRequestHeader(e,n[e])})),o.send(e.data)}))},e.prototype.post=function(e,t,r,o,n){return void 0===r&&(r={}),this.http({headers:r,method:"POST",url:e,data:t,withCredentials:o,timeout:n})},e.prototype.get=function(e,t,r,o){return void 0===t&&(t={}),this.http({headers:t,method:"GET",url:e,withCredentials:r,timeout:o})},e}()),O=function(){this.probe=function(e,t,r){if(void 0===r&&(r=2e3),!e||0===e.length)return Promise.resolve([]);for(var o={"Content-Type":"application/json","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:0,"X-IMS-CLIENTID":t},n="/ims/cdsc_probe?"+v.uriEncodeData({client_id:t}),i=[],s=[],a=function(t){var a=e[t]+n;s.push(A.post(a,{},o,!1,r).then((function(e){return 200==e.status&&i.push(t)})).catch((function(){})))},c=0;c=0?new G("ride_pba_idle_session","",!0):null;var n=this.addRedirectUriToJump(r,o);return new G(r,n)},e.prototype.addRedirectUriToJump=function(e,t){if(!t||"string"!=typeof t)return"";var r=t;this.adobeIdThinData||(this.adobeIdThinData=new M);var o=this.adobeIdThinData.computeRideRedirectUri(e);if(!o||0===o.length)return r;try{var n=new URL(r);return n.searchParams.append("redirect_uri",o),n.toString()}catch(e){return r}},e.prototype.isUnauthorizedException=function(e){var t=e.status;return 401===(void 0===t?0:t)},e}()),K=new(function(){function e(){this.triggerOnError=null}return e.prototype.post=function(e,t,r){var o=this;void 0===r&&(r={});var n=z.getCachedApiResponse(e,t);if(n){var i=n.status,s=n.data;return 200===i?Promise.resolve(s):Promise.reject(s)}return A.post(e,t,r).then((function(r){return o.storeApiResponse(e,JSON.stringify(t),r)})).catch((function(r){return o.verifyError(e,JSON.stringify(t),r)}))},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var o=z.getCachedApiResponse(e);if(o){var n=o.status,i=o.data;return 200===n?Promise.resolve(i):Promise.reject(i)}return A.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 o=J.verify(r,e);return Promise.reject(o||r.data)},e.prototype.storeApiResponse=function(e,t,r){return void 0===t&&(t=""),z.storeApiResponse(e,t,r),Promise.resolve(r.data)},e}()),B=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,o=e.client_id,n=e.type,i=v.uriEncodeData(r(r({},w.getCustomApiParameters(this.apiParameters,"validate_token")),{type:n||"access_token",client_id:o,token:t})),s=m.baseUrlAdobe+"/ims/validate_token/v1?jslVersion="+m.jslibver,a=this.formEncoded();return this.addClientIdInHeader(o,a),K.post(s,i,a)},e.prototype.getProfile=function(e){var t=e.token,o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"profile")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(o,i);var s=v.uriEncodeData(r({client_id:o},n)),a=m.baseUrlAdobe+"/ims/profile/v1?"+s+"&jslVersion="+m.jslibver;return K.get(a,i)},e.prototype.getUserInfo=function(e){var t=e.token,o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"userinfo")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(o,i);var s=v.uriEncodeData(r({client_id:o},n)),a=m.baseUrlAdobe+"/ims/userinfo/v1?"+s+"&jslVersion="+m.jslibver;return K.get(a,i)},e.prototype.logoutToken=function(e){var t=e.client_id,o=e.token,n=r({},w.getCustomApiParameters(this.apiParameters,"logout_token")),i=m.baseUrlServices+"/ims/logout/v1?jslVersion="+m.jslibver,s=this.addClientIdInHeader(t);return K.post(i,r({client_id:t,access_token:o},n),s)},e.prototype.checkStatus=function(){var e=m.baseUrlServices+"/ims/check/v1/status";return K.get(e)},e.prototype.checkToken=function(e,t,o){var n=e.client_id,i=e.scope,s=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),a=r(r({},s),{client_id:n,scope:i});return o&&(a.user_id=o),this.callCheckToken(v.uriEncodeData(a),n,"/check/v6/token?jslVersion="+m.jslibver)},e.prototype.switchProfile=function(e,t,o){void 0===o&&(o="");var n=e.client_id,i=e.scope,s=void 0===i?"":i,a=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),c=v.uriEncodeData(r(r({},a),{client_id:n,scope:s,user_id:o}));return this.callCheckToken(c,n,"/check/v6/token?jslVersion="+m.jslibver)},e.prototype.listSocialProviders=function(e){var t=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"providers")),n=v.uriEncodeData(r({client_id:t},o)),i=m.baseUrlServices+"/ims/social/v2/providers?"+n+"&jslVersion="+m.jslibver,s=this.addClientIdInHeader(t);return K.get(i,s)},e.prototype.exchangeIjt=function(e,t){var o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"ijt")),i=m.baseUrlServices+"/ims/jump/implicit/"+t,s=v.uriEncodeData(r({client_id:o},n)),a=i+"?"+s+"&jslVersion="+m.jslibver;a.length>2048&&(delete n.redirect_uri,a=i+"?"+(s=v.uriEncodeData(n)));var c=this.addClientIdInHeader(o);return K.get(a,c)},e.prototype.avatarUrl=function(e){return m.baseUrlAdobe+"/ims/avatar/download/"+e},e.prototype.getReleaseFlags=function(e){var t=e.token,o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"fg_value")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(o,i);var s=v.uriEncodeData(r({client_id:o},n)),a=m.baseUrlAdobe+"/ims/fg/value/v1?"+s+"&jslVersion="+m.jslibver;return K.get(a,i)},e.prototype.getTransitoryAuthorizationCode=function(e,t,o){void 0===t&&(t={});var n=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),i=v.uriEncodeData(r(r({},n),e));return this.callCheckToken(i,o,"/check/v6/token?client_id="+o+"&jslVersion="+m.jslibver)},e.prototype.getTokenFromCode=function(e,t){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"token"));o.grant_type="authorization_code",delete e.other;var n=m.baseUrlServices+"/ims/token/v3?jslVersion="+m.jslibver,i=v.uriEncodeData(r(r({},o),e)),s=this.formEncoded();return this.addClientIdInHeader(e.client_id,s),K.post(n,i,s)},e.prototype.jumpToken=function(e,t,o){void 0===t&&(t={});var n=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),i=m.baseUrlServices+"/ims/jumptoken/v1?client_id="+o+"&jslVersion="+m.jslibver,s=v.uriEncodeData(r(r({},n),e)),a=this.formEncoded();return this.addClientIdInHeader(o,a),K.post(i,s,a)},e.prototype.jumpTokenToDevice=function(e,t,o){void 0===t&&(t={});var n=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken_to_device")),i=m.baseUrlServices+"/ims/jumptoken/v2?client_id="+o+"&jslVersion="+m.jslibver,s=v.uriEncodeData(r(r({},n),e)),a=this.formEncoded();return this.addClientIdInHeader(o,a),K.post(i,s,a)},e.prototype.socialHeadlessSignIn=function(e,t){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),n=m.baseUrlServices+"/ims/social/v2/native?jslVersion="+m.jslibver,i=v.uriEncodeData(r(r(r({},o),e),{response_type:"implicit_jump"}));return K.post(n,i,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.prototype.callCheckToken=function(e,t,r){var o=this.formEncoded();return this.addClientIdInHeader(t,o),K.post(m.checkTokenEndpoint.url+"/ims"+r,e,o).catch((function(t){if(!m.checkTokenEndpoint.shouldFallbackToAdobe(t))throw t;return K.post(m.checkTokenEndpoint.fallbackUrl+"/ims"+r,e,o)}))},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"}(N||(N={}));var W=function(e){this.message=null,this.errorType=N.PROFILE_EXCEPTION,this.message=e},Y=/\s|,/g;function X(e){return e.split(Y).sort().join(",")}var Z,Q=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,o=r.clientId,n=r.imsApis,i=this.getProfileFromStorage();return i?Promise.resolve(i):n.getProfile({client_id:o,token:e}).then((function(e){if(!e)throw new W("NO profile response");if(0===Object.keys(e).length)throw new W("NO profile value");return t.saveProfileToStorage(e),Promise.resolve(e)})).catch((function(e){return e instanceof q?Promise.reject(e):(t.removeProfile(),Promise.reject(e))}))},e.prototype.getProfileStorageKey=function(){var e=this.profileServiceRequest;return"adobeid_ims_profile/"+e.clientId+"/"+!1+"/"+X(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}();!function(e){e.GUEST="guest"}(Z||(Z={}));var $,ee=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 o=e.valid,n=e.tokenValue,i=e.access_token,s=e.state,a=e.other,c=n||i,u=this.parseJwt(c);if(!u)throw new Error("token cannot be decoded "+c);this.state=w.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;this.atp=m,this.client_id=l,this.expire=t,this.user_id=d,this.scope=p,this.valid=o,this.tokenValue=c,this.sid=h,this.other=a,this.impersonatorId=f||"",this.isImpersonatedSession=!!v,this.pbaSatisfiedPolicies=g&&g.split(",")||[],this.isGuestToken=this.atp===Z.GUEST,this.gse=y}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,o,n,i=this.valid,s=this.client_id,a=this.scope,c=this.expire;return c0&&(r=new Array(o+1).join(e)+r),r}("0",5,e.toString(2))},le=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 ce))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 o=function(e){for(var t=e.length-1,r=0;"="===e[t];)++r,--t;return r}(r),n=[];r.forEach((function(e){n.push(ue(ce[e]))}));var i=n.join("");return o>0&&(i=i.slice(0,-5*o)),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,o=e.length;rfe.lastUserInteraction&&(fe.lastUserInteraction=n)}return o.tokenService.refreshToken(e).then((function(e){return o.onTokenProfileReceived(e)})).catch((function(e){if(p.error("refresh token error",e),e instanceof q)return Promise.reject(e);var t=o.verifyRideErrorExceptionStrict(e);return t||(o.profileService.removeProfile(),o.onTokenExpired(),Promise.reject(e))}))},this.switchProfile=function(e,t){return void 0===t&&(t={}),e?o.tokenService.switchProfile(e,t).then((function(e){return o.onTokenProfileReceived(e)})).catch((function(e){return o.verifyRideErrorException(e)})):Promise.reject(new Error("Please provide the user id for switchProfile"))},this.executeErrorCallback=function(e){if(p.info("initialize exception ended",e),!e||e.type!==$.LOGOUT){var t=o.adobeIdData.onError;t&&t(N.HTTP,"Initialization error")}},this.triggerOnImsInstance=function(e){var t=document.createEvent("CustomEvent"),r={clientId:o.adobeIdData.client_id,instance:e};t.initCustomEvent("onImsLibInstance",!1,!1,r),window.dispatchEvent(t)},this.processInitializeException=function(e){return void 0===e&&(e={}),p.warn("initialize",e),o.restoreHash(),Promise.reject(e)},this.verifyModalSignInEvent=function(e){return e instanceof ae?o.notifyParentAboutModalSignIn(e):Promise.reject(e)},this.verifyTokenExpiredException=function(e){return e instanceof ie?(o.adobeIdData.handlers.triggerOnAccessTokenHasExpired(),Promise.resolve()):Promise.reject(e)},this.verifyRideErrorException=function(e){return n(o,void 0,Promise,(function(){return i(this,(function(t){switch(t.label){case 0:return e instanceof G?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?[4,v.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 G?o.verifyRideErrorException(e):null},this.verifyCsrfException=function(e){var t=e.type;return t&&t===N.CSRF&&o.signOut(),Promise.reject(e)},this.processTokenResponse=function(e){var t=o.adobeIdData.handlers,r=e.tokenFields,n=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,h=r.impersonatorId,f=r.isImpersonatedSession,g=r.pbaSatisfiedPolicies,m=r.isGuestToken,y=r.gse;p.info("token",i),d.from_ims&&v.setHash(d.old_hash||""),o.profileService.removeProfileIfOtherUser(u);var k={token:i,expire:a,sid:c,impersonatorId:h,isImpersonatedSession:f,pbaSatisfiedPolicies:g,isGuestToken:m,gse:y};return r.isReauth()?t.triggerOnReauthAccessToken(k):o.tokenReceived(k),n&&o.profileService.saveProfileToStorage(n),Promise.resolve(s)},this.exchangeIjt=function(e){var t=o.adobeIdData.ijt;return e||t?o.tokenService.exchangeIjt(e||t).then((function(e){return e.profile?o.profileService.saveProfileToStorage(e.profile):o.profileService.removeProfile(),Promise.resolve(e)})):Promise.reject(new Error("please set the adobeid.ijt value"))},this.adobeIdData=new L(e),t&&(this.instanceKey=t);var s=this.adobeIdData,a=s.api_parameters,c=void 0===a?{}:a,u=s.client_id,l=s.scope,d=s.useLocalStorage,h=s.autoValidateToken,g=s.modalMode,m=s.modalSettings;this.imsApis=new B(c),this.csrfService=new f(u,this.instanceKey),this.serviceRequest={clientId:u,scope:l,imsApis:this.imsApis},this.tokenService=new pe(r(r({},this.serviceRequest),{useLocalStorage:d,autoValidateToken:h}),this.csrfService),this.profileService=new Q(this.serviceRequest),this.signInservice=g?new R(this.onPopupMessage,m):new T}return Object.defineProperty(e.prototype,"version",{get:function(){return m.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 o=this.adobeIdData,n=this.csrfService;if(!o)throw new Error("no adobeId on reAuthenticate");var i=n.initialize();return o.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 o="please login before getting the profile";return Promise.reject(new W(o))}if(r.isGuestToken){o="guest account does not have a profile";return Promise.reject(new W(o))}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 q?e.refreshToken().then((function(e){return Promise.resolve(e.profile)})):Promise.reject(new W(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,isGuestToken:t.isGuestToken,gse:t.gse}:null},e.prototype.listSocialProviders=function(){var e=this;return new Promise((function(t,r){var o=e.adobeIdData.client_id;e.imsApis.listSocialProviders({client_id:o}).then((function(e){t(e)})).catch((function(e){r(e)}))}))},e.prototype.tokenReceived=function(e){this.adobeIdData.handlers.triggerOnAccessToken(e),fe.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 q?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,t=this,r=this.adobeIdData,o=r.handlers,n=r.standalone,i=r.ijt,s=r.alwaysRemoveTokenFromUrl,a=r.enableGuestAccounts,c=r.enableGuestTokenForceRefresh,u=null;switch(n&&this.setStandAloneToken(n),!0){case!!i:e=this.exchangeIjt;break;case a:e=this.tokenService.getGuestToken.bind(this.tokenService,{},{enableGuestAccounts:a,enableGuestTokenForceRefresh:c});break;default:e=this.tokenService.getTokenAndProfile}return e().then(this.processTokenResponse,this.processError.apply(this)).then((function(e){u=e})).finally((function(){p.info("onReady initialization"),window.addEventListener("getImsLibInstance",(function(){t.triggerOnImsInstance(t)}),!1),s&&v.setHash(te.removeAccessToken()),o.triggerOnReady(u?u.context:null),t.triggerOnImsInstance(t),t.initialized=!0}))},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=te.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 H).getVerifierByKey(e)},e.prototype.socialHeadlessSignIn=function(e,t){return void 0===t&&(t={}),n(this,void 0,Promise,(function(){var r=this;return i(this,(function(o){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 oe.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){return void 0===t&&(t={}),this.imsApis.jumpTokenToDevice(e,t,this.adobeIdData.client_id)},e}(),ge=new(function(){function e(){this.createIMSLib=function(e,t){void 0===e&&(e=null),void 0===t&&(t="adobeIMS");var r=new ve(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(){ge.initAdobeIms()}return e.prototype.initialize=function(){return!0},e}())}(); +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 o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}var r=function(){return(r=Object.assign||function(e){for(var t,r=1,o=arguments.length;r0&&n[n.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s}function a(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[o++],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],n)}}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,n)},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}(),m=new(function(){function e(){this.baseUrlAdobe="",this.baseUrlServices="",this.checkTokenEndpoint=new g,this.jslibver="v2-v0.45.0-8-gd14e654"}return e.prototype.loadEnvironment=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r="");var o=e===l.STAGE;o?(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=g.computeEndpoint(t,r,o,this.baseUrlServices)},e}());function k(e){return null!=e&&"object"==typeof e&&!Array.isArray(e)}function y(e,t){if(null==e)return t;if(e===t)return e;if(!k(e))return e;var r=Object.assign({},e);return k(t)&&Object.keys(t).forEach((function(o){var n,i;k(t[o])?o in e?r[o]=y(e[o],t[o]):Object.assign(r,((n={})[o]=t[o],n)):Object.assign(r,((i={})[o]=t[o],i))})),r}var w=new(function(){function e(){this.getCustomApiParameters=function(e,t){return e[t]||{}}}return e.prototype.mergeExternalParameters=function(e,t,r){return y(this.getCustomApiParameters(t,r),e)},e.prototype.toJson=function(e){try{return"string"!=typeof e?e:JSON.parse(e)}catch(e){return null}},e}()),b=function(){function e(){}return e.getInitialRedirectUri=function(e,t){var r=e.redirect_uri||t||window.location.href,o="function"==typeof r?r():r,n=o.indexOf("from_ims");return-1===n?o:("#"===o[n-1]&&n--,o.substr(0,n))},e.createDefaultRedirectUrl=function(e,t,r,o){var n=this.getInitialRedirectUri(r,e),i=this.createOldHash(n);return i.indexOf("?")>0?i+"&client_id="+t+"&api="+o:i+"?client_id="+t+"&api="+o},e.createRedirectUrl=function(e,t,r,o,n){void 0===n&&(n="");var i=this.createDefaultRedirectUrl(e,t,r,o);(n=n||r.scope||"")&&(i=i+"&scope="+n);var s=r.reauth||"";return s&&(i=i+"&reauth="+s),i},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(w.getCustomApiParameters(e,r),t)},e}(),S=function(){var e=this;this.composeRedirectUrl=function(e){var t=e.apiParameters,o=e.externalParameters,n=void 0===o?{}:o,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?n.scope||t.scope||"":d,h=b.mergeApiParamsWithExternalParams(t,n,"authorize");l&&(h.state=y(h.state||{},l));var f=b.createRedirectUrl(s,a,h,"authorize",p),v=n.locale||c||"",g=e.response_type,k=void 0===g?h.response_type||"":g;return r(r({},h),{client_id:a,scope:p,locale:v,response_type:k,jslVersion:m.jslibver,redirect_uri:f})},this.createRedirectUrl=function(t){var r=e.composeRedirectUrl(t),o=v.uriEncodeData(r);return m.baseUrlAdobe+"/ims/authorize/v1?"+o}},T=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 o=t.composeRedirectUrl(r);e&&(o.user_assertion=e,o.user_assertion_type="urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),t.createAuthorizeForm(o).submit()},t}return t(r,e),r.prototype.createAuthorizeForm=function(e){var t=m.baseUrlAdobe+"/ims/authorize/v1",r=document.createElement("form");r.style.display="none",r.setAttribute("method","post"),r.setAttribute("action",t);var o=null,n=null,i="";for(var s in e){if("object"==typeof(n=e[s])){if(0===Object.keys(n).length)continue;i=JSON.stringify(n)}else i=n;""!==i&&(o=this.createFormElement("input","text",s,i),r.appendChild(o))}return document.getElementsByTagName("body")[0].appendChild(r),r},r.prototype.createFormElement=function(e,t,r,o){var n=document.createElement(e);return n.setAttribute("type",t),n.setAttribute("name",r),n.setAttribute("value",o),n},r}(S),I=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/,_=["https://auth.services.adobe.com","https://auth-stg1.services.adobe.com","https://localhost.corp.adobe.com:9000"],P=new function(){var e=this;this.windowObjectReference=null,this.previousUrl="",this.openSignInWindow=function(t,r,o,n){e.onProcessLocation=n,e.allowOrigin=o.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="+o.width+", height="+o.height+", top="+o.top+", left="+o.left;!e.windowObjectReference||e.windowObjectReference&&e.windowObjectReference.closed?e.windowObjectReference=window.open(t,o.title,i):e.previousUrl!==t?(e.windowObjectReference=window.open(t,o.title,i),e.windowObjectReference&&e.windowObjectReference.focus()):e.windowObjectReference.focus(),e.previousUrl=t},this.receiveMessage=function(t){if(a(_,[e.allowOrigin]).includes(t.origin)){try{if(!I.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)}},R=function(e){function o(t,o){var n=e.call(this)||this;return n.signIn=function(e){e.state=r(r({},e.state),{imslibmodal:!0});var t=e.state.nonce,o=n.createRedirectUrl(e);P.openSignInWindow(o,t,n.popupSettings,n.onPopupMessage)},n.onPopupMessage=t,n.popupSettings=o,n}return t(o,e),o}(S),A=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}(),E=new(function(){function e(){}return e.prototype.http=function(e){return new Promise((function(t,r){var o=new(0,window.XMLHttpRequest);"boolean"==typeof e.withCredentials?o.withCredentials=e.withCredentials:o.withCredentials=!0,"number"==typeof e.timeout&&(o.timeout=e.timeout),o.open(e.method,e.url,!0);var n;o.onload=function(){return this.status>=200&&this.status<300?t(new A(this.status,this.response)):r(new A(this.status,this.response))},o.onerror=function(){var e=new A(this.status,this.response);return r(e)},o.ontimeout=function(){var e=new A(0,"timeout");return r(e)},o.onabort=function(){var e=new A(0,"aborted");return r(e)},(n=e.headers)&&Object.keys(n).forEach((function(e){o.setRequestHeader(e,n[e])})),o.send(e.data)}))},e.prototype.post=function(e,t,r,o,n){return void 0===r&&(r={}),this.http({headers:r,method:"POST",url:e,data:t,withCredentials:o,timeout:n})},e.prototype.get=function(e,t,r,o){return void 0===t&&(t={}),this.http({headers:t,method:"GET",url:e,withCredentials:r,timeout:o})},e}()),O=function(){this.probe=function(e,t,r){if(void 0===r&&(r=2e3),!e||0===e.length)return Promise.resolve([]);for(var o={"Content-Type":"application/json","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:0,"X-IMS-CLIENTID":t},n="/ims/cdsc_probe?"+v.uriEncodeData({client_id:t}),i=[],s=[],a=function(t){var a=e[t]+n;s.push(E.post(a,{},o,!1,r).then((function(e){return 200==e.status&&i.push(t)})).catch((function(){})))},c=0;c=0?new G("ride_pba_idle_session","",!0):null;var n=this.addRedirectUriToJump(r,o);return new G(r,n)},e.prototype.addRedirectUriToJump=function(e,t){if(!t||"string"!=typeof t)return"";var r=t;this.adobeIdThinData||(this.adobeIdThinData=new M);var o=this.adobeIdThinData.computeRideRedirectUri(e);if(!o||0===o.length)return r;try{var n=new URL(r);return n.searchParams.append("redirect_uri",o),n.toString()}catch(e){return r}},e.prototype.isUnauthorizedException=function(e){var t=e.status;return 401===(void 0===t?0:t)},e}()),J=new(function(){function e(){this.triggerOnError=null}return e.prototype.post=function(e,t,r){var o=this;void 0===r&&(r={});var n=z.getCachedApiResponse(e,t);if(n){var i=n.status,s=n.data;return 200===i?Promise.resolve(s):Promise.reject(s)}return E.post(e,t,r).then((function(r){return o.storeApiResponse(e,JSON.stringify(t),r)})).catch((function(r){return o.verifyError(e,JSON.stringify(t),r)}))},e.prototype.get=function(e,t){var r=this;void 0===t&&(t={});var o=z.getCachedApiResponse(e);if(o){var n=o.status,i=o.data;return 200===n?Promise.resolve(i):Promise.reject(i)}return E.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 o=B.verify(r,e);return Promise.reject(o||r.data)},e.prototype.storeApiResponse=function(e,t,r){return void 0===t&&(t=""),z.storeApiResponse(e,t,r),Promise.resolve(r.data)},e}()),K=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,o=e.client_id,n=e.type,i=v.uriEncodeData(r(r({},w.getCustomApiParameters(this.apiParameters,"validate_token")),{type:n||"access_token",client_id:o,token:t})),s=m.baseUrlAdobe+"/ims/validate_token/v1?jslVersion="+m.jslibver,a=this.formEncoded();return this.addClientIdInHeader(o,a),J.post(s,i,a)},e.prototype.getProfile=function(e){var t=e.token,o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"profile")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(o,i);var s=v.uriEncodeData(r({client_id:o},n)),a=m.baseUrlAdobe+"/ims/profile/v1?"+s+"&jslVersion="+m.jslibver;return J.get(a,i)},e.prototype.getUserInfo=function(e){var t=e.token,o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"userinfo")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(o,i);var s=v.uriEncodeData(r({client_id:o},n)),a=m.baseUrlAdobe+"/ims/userinfo/v1?"+s+"&jslVersion="+m.jslibver;return J.get(a,i)},e.prototype.logoutToken=function(e){var t=e.client_id,o=e.token,n=r({},w.getCustomApiParameters(this.apiParameters,"logout_token")),i=m.baseUrlServices+"/ims/logout/v1?jslVersion="+m.jslibver,s=this.addClientIdInHeader(t);return J.post(i,r({client_id:t,access_token:o},n),s)},e.prototype.checkStatus=function(){var e=m.baseUrlServices+"/ims/check/v1/status";return J.get(e)},e.prototype.checkToken=function(e,t,n){var i=e.client_id,s=e.scope,a=t.arkoseSessionToken,c=o(t,["arkoseSessionToken"]),u=r({},w.mergeExternalParameters(c,this.apiParameters,"check_token")),l=r(r({},u),{client_id:i,scope:s});return a&&(l.arkose_session_token=a),n&&(l.user_id=n),this.callCheckToken(v.uriEncodeData(l),i,"/check/v6/token?jslVersion="+m.jslibver)},e.prototype.switchProfile=function(e,t,o){void 0===o&&(o="");var n=e.client_id,i=e.scope,s=void 0===i?"":i,a=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),c=v.uriEncodeData(r(r({},a),{client_id:n,scope:s,user_id:o}));return this.callCheckToken(c,n,"/check/v6/token?jslVersion="+m.jslibver)},e.prototype.listSocialProviders=function(e){var t=e.client_id,o=r({},w.getCustomApiParameters(this.apiParameters,"providers")),n=v.uriEncodeData(r({client_id:t},o)),i=m.baseUrlServices+"/ims/social/v2/providers?"+n+"&jslVersion="+m.jslibver,s=this.addClientIdInHeader(t);return J.get(i,s)},e.prototype.exchangeIjt=function(e,t){var o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"ijt")),i=m.baseUrlServices+"/ims/jump/implicit/"+t,s=v.uriEncodeData(r({client_id:o},n)),a=i+"?"+s+"&jslVersion="+m.jslibver;a.length>2048&&(delete n.redirect_uri,a=i+"?"+(s=v.uriEncodeData(n)));var c=this.addClientIdInHeader(o);return J.get(a,c)},e.prototype.avatarUrl=function(e){return m.baseUrlAdobe+"/ims/avatar/download/"+e},e.prototype.getReleaseFlags=function(e){var t=e.token,o=e.client_id,n=r({},w.getCustomApiParameters(this.apiParameters,"fg_value")),i=this.createAuthorizationHeader(t);this.addClientIdInHeader(o,i);var s=v.uriEncodeData(r({client_id:o},n)),a=m.baseUrlAdobe+"/ims/fg/value/v1?"+s+"&jslVersion="+m.jslibver;return J.get(a,i)},e.prototype.getTransitoryAuthorizationCode=function(e,t,o){void 0===t&&(t={});var n=r({},w.mergeExternalParameters(t,this.apiParameters,"check_token")),i=v.uriEncodeData(r(r({},n),e));return this.callCheckToken(i,o,"/check/v6/token?client_id="+o+"&jslVersion="+m.jslibver)},e.prototype.getTokenFromCode=function(e,t){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"token"));o.grant_type="authorization_code",delete e.other;var n=m.baseUrlServices+"/ims/token/v3?jslVersion="+m.jslibver,i=v.uriEncodeData(r(r({},o),e)),s=this.formEncoded();return this.addClientIdInHeader(e.client_id,s),J.post(n,i,s)},e.prototype.jumpToken=function(e,t,o){void 0===t&&(t={});var n=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),i=m.baseUrlServices+"/ims/jumptoken/v1?client_id="+o+"&jslVersion="+m.jslibver,s=v.uriEncodeData(r(r({},n),e)),a=this.formEncoded();return this.addClientIdInHeader(o,a),J.post(i,s,a)},e.prototype.jumpTokenToDevice=function(e,t,o,n){void 0===t&&(t={});var i=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken_to_device"));!i.user_id&&n&&(i.user_id=n);var s=m.baseUrlServices+"/ims/jumptoken/v2?client_id="+o+"&jslVersion="+m.jslibver,a=v.uriEncodeData(r(r({},i),e)),c=this.formEncoded();return this.addClientIdInHeader(o,c),J.post(s,a,c)},e.prototype.socialHeadlessSignIn=function(e,t){void 0===t&&(t={});var o=r({},w.mergeExternalParameters(t,this.apiParameters,"jumptoken")),n=m.baseUrlServices+"/ims/social/v2/native?jslVersion="+m.jslibver,i=v.uriEncodeData(r(r(r({},o),e),{response_type:"implicit_jump"}));return J.post(n,i,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.prototype.callCheckToken=function(e,t,r){var o=this.formEncoded();return this.addClientIdInHeader(t,o),J.post(m.checkTokenEndpoint.url+"/ims"+r,e,o).catch((function(t){if(!m.checkTokenEndpoint.shouldFallbackToAdobe(t))throw t;return J.post(m.checkTokenEndpoint.fallbackUrl+"/ims"+r,e,o)}))},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"}(N||(N={}));var W=function(e){this.message=null,this.errorType=N.PROFILE_EXCEPTION,this.message=e},Y=/\s|,/g;function X(e){return e.split(Y).sort().join(",")}var Z,Q=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,o=r.clientId,n=r.imsApis,i=this.getProfileFromStorage();return i?Promise.resolve(i):n.getProfile({client_id:o,token:e}).then((function(e){if(!e)throw new W("NO profile response");if(0===Object.keys(e).length)throw new W("NO profile value");return t.saveProfileToStorage(e),Promise.resolve(e)})).catch((function(e){return e instanceof q?Promise.reject(e):(t.removeProfile(),Promise.reject(e))}))},e.prototype.getProfileStorageKey=function(){var e=this.profileServiceRequest;return"adobeid_ims_profile/"+e.clientId+"/"+!1+"/"+X(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}();!function(e){e.GUEST="guest"}(Z||(Z={}));var $,ee=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 o=e.valid,n=e.tokenValue,i=e.access_token,s=e.state,a=e.other,c=n||i,u=this.parseJwt(c);if(!u)throw new Error("token cannot be decoded "+c);this.state=w.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,k=u.gse;this.atp=m,this.client_id=l,this.expire=t,this.user_id=d,this.scope=p,this.valid=o,this.tokenValue=c,this.sid=h,this.other=a,this.impersonatorId=f||"",this.isImpersonatedSession=!!v,this.pbaSatisfiedPolicies=g&&g.split(",")||[],this.isGuestToken=this.atp===Z.GUEST,this.gse=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 p.error("error on decoding token ",e,t),null}},e.prototype.validate=function(e,t){var r,o,n,i=this.valid,s=this.client_id,a=this.scope,c=this.expire;return c0&&(r=new Array(o+1).join(e)+r),r}("0",5,e.toString(2))},le=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 ce))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 o=function(e){for(var t=e.length-1,r=0;"="===e[t];)++r,--t;return r}(r),n=[];r.forEach((function(e){n.push(ue(ce[e]))}));var i=n.join("");return o>0&&(i=i.slice(0,-5*o)),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,o=e.length;rge.lastUserInteraction&&(ge.lastUserInteraction=n)}return o.tokenService.refreshToken(e).then((function(e){return o.onTokenProfileReceived(e)})).catch((function(e){if(p.error("refresh token error",e),e instanceof q)return Promise.reject(e);var t=o.verifyRideErrorExceptionStrict(e);return t||(o.profileService.removeProfile(),o.onTokenExpired(),Promise.reject(e))}))},this.switchProfile=function(e,t){return void 0===t&&(t={}),e?o.tokenService.switchProfile(e,t).then((function(e){return o.onTokenProfileReceived(e)})).catch((function(e){return o.verifyRideErrorException(e)})):Promise.reject(new Error("Please provide the user id for switchProfile"))},this.executeErrorCallback=function(e){if(p.info("initialize exception ended",e),!e||e.type!==$.LOGOUT){var t=o.adobeIdData.onError;t&&t(N.HTTP,"Initialization error")}},this.triggerOnImsInstance=function(e){var t=document.createEvent("CustomEvent"),r={clientId:o.adobeIdData.client_id,instance:e};t.initCustomEvent("onImsLibInstance",!1,!1,r),window.dispatchEvent(t)},this.processInitializeException=function(e){return void 0===e&&(e={}),p.warn("initialize",e),o.restoreHash(),Promise.reject(e)},this.verifyModalSignInEvent=function(e){return e instanceof ae?o.notifyParentAboutModalSignIn(e):Promise.reject(e)},this.verifyTokenExpiredException=function(e){return e instanceof ie?(o.adobeIdData.handlers.triggerOnAccessTokenHasExpired(),Promise.resolve()):Promise.reject(e)},this.verifyRideErrorException=function(e){return n(o,void 0,Promise,(function(){return i(this,(function(t){switch(t.label){case 0:return e instanceof G?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?[4,v.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 G?o.verifyRideErrorException(e):null},this.verifyCsrfException=function(e){var t=e.type;return t&&t===N.CSRF&&o.signOut(),Promise.reject(e)},this.processTokenResponse=function(e){var t=o.adobeIdData.handlers,r=e.tokenFields,n=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,h=r.impersonatorId,f=r.isImpersonatedSession,g=r.pbaSatisfiedPolicies,m=r.isGuestToken,k=r.gse;p.info("token",i),d.from_ims&&v.setHash(d.old_hash||""),o.profileService.removeProfileIfOtherUser(u);var y={token:i,expire:a,sid:c,impersonatorId:h,isImpersonatedSession:f,pbaSatisfiedPolicies:g,isGuestToken:m,gse:k};return r.isReauth()?t.triggerOnReauthAccessToken(y):o.tokenReceived(y),n&&o.profileService.saveProfileToStorage(n),Promise.resolve(s)},this.exchangeIjt=function(e){var t=o.adobeIdData.ijt;return e||t?o.tokenService.exchangeIjt(e||t).then((function(e){return e.profile?o.profileService.saveProfileToStorage(e.profile):o.profileService.removeProfile(),Promise.resolve(e)})):Promise.reject(new Error("please set the adobeid.ijt value"))},this.adobeIdData=new L(e),t&&(this.instanceKey=t);var s=this.adobeIdData,a=s.api_parameters,c=void 0===a?{}:a,u=s.client_id,l=s.scope,d=s.useLocalStorage,h=s.autoValidateToken,g=s.modalMode,m=s.modalSettings;this.imsApis=new K(c),this.csrfService=new f(u,this.instanceKey),this.serviceRequest={clientId:u,scope:l,imsApis:this.imsApis},this.tokenService=new fe(r(r({},this.serviceRequest),{useLocalStorage:d,autoValidateToken:h}),this.csrfService),this.profileService=new Q(this.serviceRequest),this.signInservice=g?new R(this.onPopupMessage,m):new T}return Object.defineProperty(e.prototype,"version",{get:function(){return m.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 o=this.adobeIdData,n=this.csrfService;if(!o)throw new Error("no adobeId on reAuthenticate");var i=n.initialize();return o.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 o="please login before getting the profile";return Promise.reject(new W(o))}if(r.isGuestToken){o="guest account does not have a profile";return Promise.reject(new W(o))}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 q?e.refreshToken().then((function(e){return Promise.resolve(e.profile)})):Promise.reject(new W(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,isGuestToken:t.isGuestToken,gse:t.gse}:null},e.prototype.listSocialProviders=function(){var e=this;return new Promise((function(t,r){var o=e.adobeIdData.client_id;e.imsApis.listSocialProviders({client_id:o}).then((function(e){t(e)})).catch((function(e){r(e)}))}))},e.prototype.tokenReceived=function(e){this.adobeIdData.handlers.triggerOnAccessToken(e),ge.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 q?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,t=this,r=this.adobeIdData,o=r.handlers,n=r.standalone,i=r.ijt,s=r.alwaysRemoveTokenFromUrl,a=r.enableGuestAccounts,c=r.enableGuestTokenForceRefresh,u=r.enableGuestBotDetection,l=null;switch(n&&this.setStandAloneToken(n),!0){case!!i:e=this.exchangeIjt;break;case a:e=this.tokenService.getGuestToken.bind(this.tokenService,{},{enableGuestAccounts:a,enableGuestTokenForceRefresh:c,enableGuestBotDetection:u});break;default:e=this.tokenService.getTokenAndProfile}return e().then(this.processTokenResponse,this.processError.apply(this)).then((function(e){l=e})).finally((function(){p.info("onReady initialization"),window.addEventListener("getImsLibInstance",(function(){t.triggerOnImsInstance(t)}),!1),s&&v.setHash(te.removeAccessToken()),o.triggerOnReady(l?l.context:null),t.triggerOnImsInstance(t),t.initialized=!0}))},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=te.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 H).getVerifierByKey(e)},e.prototype.socialHeadlessSignIn=function(e,t){return void 0===t&&(t={}),n(this,void 0,Promise,(function(){var r=this;return i(this,(function(o){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 oe.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(),o=r?r.user_id:null;return this.imsApis.jumpTokenToDevice(e,t,this.adobeIdData.client_id,o)},e}(),ke=new(function(){function e(){this.createIMSLib=function(e,t){void 0===e&&(e=null),void 0===t&&(t="adobeIMS");var r=new me(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(){ke.initAdobeIms()}return e.prototype.initialize=function(){return!0},e}())}();