import{r as i,h as e}from"./p-d8146ddb.js";import{f as o}from"./p-d8f0bd7d.js";let r=class{constructor(e){i(this,e),this.signInSuccessWithAuthResult=i=>{var e;const o=this.getGithubAccessToken(i);return this.signInSuccess({uid:null===(e=null==i?void 0:i.user)||void 0===e?void 0:e.uid,githubAccessToken:o}),!1}}async componentDidLoad(){await this.setupFirebaseUI()}async disconnectedCallback(){const i=firebaseui.auth.AuthUI.getInstance();i&&await i.delete()}async setupFirebaseUI(){await(({id:i,src:e,module:o})=>new Promise(((r,a)=>{if(document?.getElementById(i))return void r("JS already loaded.");let s=document.createElement("script");s.id=i,s.src=e,o?s.type="module":(s.async=!0,s.defer=!0),s.addEventListener("load",(()=>r("JS loaded.")),{once:!0}),s.addEventListener("error",(()=>a("Error loading script.")),{once:!0}),s.addEventListener("abort",(()=>a("Script loading aborted.")),{once:!0}),document.head.appendChild(s)})))({id:"firebase-ui-script",src:"https://www.gstatic.com/firebasejs/ui/4.8.0/firebase-ui-auth.js"}),await(({id:i,src:e})=>new Promise(((o,r)=>{if(document?.getElementById(i))return void o("CSS already loaded.");let a=document.createElement("link");a.id=i,a.setAttribute("rel","stylesheet"),a.setAttribute("href",e),a.addEventListener("load",(()=>o("CSS loaded.")),{once:!0}),a.addEventListener("error",(()=>r("Error loading css.")),{once:!0}),a.addEventListener("abort",(()=>r("CSS loading aborted.")),{once:!0}),document.head.appendChild(a)})))({id:"firebase-ui-css",src:"https://www.gstatic.com/firebasejs/ui/4.8.0/firebase-ui-auth.css"});const i=[];i.push({provider:o.auth.GithubAuthProvider.PROVIDER_ID,scopes:["public_repo"]}),i.push(o.auth.GoogleAuthProvider.PROVIDER_ID),i.push(o.auth.EmailAuthProvider.PROVIDER_ID);const e={signInFlow:"redirect",signInSuccessUrl:this.config.appUrl,signInOptions:i,tosUrl:"https://deckdeckgo.com/terms",privacyPolicyUrl:"https://deckdeckgo.com/privacy",credentialHelper:firebaseui.auth.CredentialHelper.GOOGLE_YOLO,autoUpgradeAnonymousUsers:!1,callbacks:{signInSuccessWithAuthResult:this.signInSuccessWithAuthResult}};window.firebase=o;const r=firebaseui.auth.AuthUI.getInstance()||new firebaseui.auth.AuthUI(o.auth());r.isPendingRedirect()||r.reset(),r.start("#firebaseui-auth-container",e)}getGithubAccessToken(i){if(i&&i.credential&&"github.com"===i.credential.providerId&&i.credential.accessToken)return i.credential.accessToken}render(){return e("div",{id:"firebaseui-auth-container"})}};r.style="deckgo-firebase-signin{display:block}deckgo-firebase-signin .firebaseui-container{background:transparent}deckgo-firebase-signin form button.firebaseui-idp-password,deckgo-firebase-signin form button.firebaseui-idp-password:hover{background-color:var(--ion-color-primary) !important}deckgo-firebase-signin .mdl-textfield--floating-label.is-focused .mdl-textfield__label{color:var(--ion-color-medium)}deckgo-firebase-signin .firebaseui-textfield.mdl-textfield .firebaseui-label::after{background-color:var(--ion-color-primary)}deckgo-firebase-signin .mdl-button--primary.mdl-button--primary{color:var(--ion-color-primary)}deckgo-firebase-signin .mdl-button--primary.mdl-button--primary:hover,deckgo-firebase-signin .mdl-button--primary.mdl-button--primary:active{background:transparent}deckgo-firebase-signin .mdl-button--raised.mdl-button--colored{background:var(--ion-color-primary);border-radius:64px}deckgo-firebase-signin .mdl-button--raised.mdl-button--colored:hover,deckgo-firebase-signin .mdl-button--raised.mdl-button--colored:active{background:var(--ion-color-primary)}deckgo-firebase-signin button.firebaseui-idp-google>.firebaseui-idp-text{color:black}deckgo-firebase-signin .firebaseui-idp-button{font-family:var(--ion-font-family, inherit);border-radius:64px;padding:8px 16px 8px 30px}deckgo-firebase-signin p.firebaseui-tos{color:black;font-family:var(--ion-font-family, inherit);padding-top:16px}deckgo-firebase-signin p.firebaseui-tos a,deckgo-firebase-signin p.firebaseui-tos a:hover,deckgo-firebase-signin p.firebaseui-tos a:active,deckgo-firebase-signin p.firebaseui-tos a:focus{text-decoration:none}deckgo-firebase-signin a.firebaseui-link{text-decoration:none;color:var(--ion-color-primary)}deckgo-firebase-signin div.mdl-shadow--2dp{box-shadow:none}deckgo-firebase-signin div.mdl-shadow--2dp div.firebaseui-card-header{display:none}";export{r as deckgo_firebase_signin}