1"use strict";(self.webpackChunkweb_frontend_reactjs=self.webpackChunkweb_frontend_reactjs||[]).push([[9217],{69217:(e,i,t)=>{t.r(i),t.d(i,{AppleSignInWeb:()=>l});var n=t(29344);class l extends n.E_{constructor(){super(...arguments),this.scriptLoaded=!1}async initialize(e){this.clientId=e.clientId,await this.loadScript()}async signIn(e){var i,t,n,l,o,a,d,s;if(!this.clientId)throw new Error("clientId must be provided. Call initialize() first.");const r=(null!==(i=null===e||void 0===e?void 0:e.scopes)&&void 0!==i?i:[]).map(e=>"FULL_NAME"===e?"name":"email").join(" ");window.AppleID.auth.init({clientId:this.clientId,scope:r||void 0,redirectURI:null===e||void 0===e?void 0:e.redirectUrl,state:null===e||void 0===e?void 0:e.state,nonce:null===e||void 0===e?void 0:e.nonce,usePopup:!0});const c=await window.AppleID.auth.signIn(),u=c.authorization,p=u.id_token,v=u.code,h=u.state,m=this.decodeJwtPayload(p),w=m.sub,I=null!==(t=m.email)&&void 0!==t?t:null;let _=null,b=null;c.user&&(_=null!==(l=null===(n=c.user.name)||void 0===n?void 0:n.firstName)&&void 0!==l?l:null,b=null!==(a=null===(o=c.user.name)||void 0===o?void 0:o.lastName)&&void 0!==a?a:null);const f={authorizationCode:v,idToken:p,user:w,email:null!==(s=null===(d=c.user)||void 0===d?void 0:d.email)&&void 0!==s?s:I,givenName:_,familyName:b};return void 0!==h&&(f.state=h),f}decodeJwtPayload(e){const i=e.split(".")[1],t=atob(i.replace(/-/g,"+").replace(/_/g,"/"));return JSON.parse(t)}loadScript(){return this.scriptLoaded?Promise.resolve():new Promise((e,i)=>{const t=document.createElement("script");t.src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",t.onload=()=>{this.scriptLoaded=!0,e()},t.onerror=()=>{i(new Error("Failed to load Apple Sign-In SDK."))},document.head.appendChild(t)})}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.