import { p as proxyCustomElement, H, c as createEvent, h } from './p-3b962989.js';
import { m as faArrowLeft } from './p-5a6c2a4d.js';
import { a as ProviderTypeEnum, d as defineCustomElement$5 } from './p-3bdbad12.js';
import { S as SidePanelSideEnum, d as defineCustomElement$4 } from './p-25c29bab.js';
import { d as defineCustomElement$6 } from './p-5eac8600.js';
import { d as defineCustomElement$3 } from './p-ad9b744f.js';
import { d as defineCustomElement$2 } from './p-61ff68d4.js';

const unlockPanelCss = "*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.flex{display:flex}:host{display:block}.unlock-panel{background:#f5f1ec;max-width:340px}.body{display:flex;flex-direction:column;gap:.2rem;padding:1rem}.static{position:static}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.visible{visibility:visible}.hidden{display:none}";
const UnlockPanelStyle0 = unlockPanelCss;

const UnlockPanel$1 = /*@__PURE__*/ proxyCustomElement(class UnlockPanel extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        this.close = createEvent(this, "close", 7);
        this.login = createEvent(this, "login", 7);
        this.isOpen = false;
        this.allowedProviders = Object.values(ProviderTypeEnum);
        this.isLoggingIn = false;
        this.selectedMethod = null;
        this.anchor = null;
        this.observer = null;
        this.handleLogin = (provider) => {
            this.login.emit({ provider, anchor: this.anchor });
            this.selectedMethod = provider;
        };
        this.resetLoginState = () => {
            this.isLoggingIn = false;
            this.selectedMethod = null;
            if (!this.anchor) {
                return;
            }
            while (this.anchor.firstChild) {
                this.anchor.removeChild(this.anchor.firstChild);
            }
        };
        this.handleClose = () => {
            this.close.emit();
        };
    }
    disconnectedCallback() {
        if (this.observer) {
            this.observer.disconnect();
        }
    }
    observeContainer(element) {
        if (!element) {
            return;
        }
        this.anchor = element;
        if (this.observer) {
            this.observer.disconnect();
        }
        this.observer = new MutationObserver(() => {
            this.isLoggingIn = element.childElementCount > 0;
        });
        this.observer.observe(element, { childList: true, subtree: true });
    }
    render() {
        return (h("side-panel", { key: 'd203daacd5668a2cd747d2513c40723920ec09ae', isOpen: this.isOpen, side: SidePanelSideEnum.RIGHT, onClose: this.handleClose, panelClassName: "unlock-panel" }, h("unlock-header", { key: '647463103e2a40c137c1646dd57344dd15517b4c', text: this.isLoggingIn ? `${this.selectedMethod} connect` : 'Connect your wallet', backIcon: this.isLoggingIn ? faArrowLeft : null, onBack: this.resetLoginState, onClose: this.handleClose }), h("div", { key: 'bd81fb668f3412dda763044793aa4e73891dda0c', id: "anchor", ref: element => this.observeContainer(element) }), !this.isLoggingIn && (h("div", { key: '2e0492caf5cbc65b9fec9c2aad92e2e3d81e6c4e', class: "body" }, this.allowedProviders.map(method => (h("provider-button", { type: method, onClick: () => this.handleLogin(method) }))), h("slot", { key: 'b1cfe8a67e84089fd2c7426bc57454639a3b5363' })))));
    }
    static get style() { return UnlockPanelStyle0; }
}, [1, "unlock-panel", {
        "isOpen": [4, "is-open"],
        "allowedProviders": [16],
        "isLoggingIn": [32],
        "selectedMethod": [32]
    }]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["unlock-panel", "fa-icon", "provider-button", "side-panel", "unlock-button", "unlock-header"];
    components.forEach(tagName => { switch (tagName) {
        case "unlock-panel":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, UnlockPanel$1);
            }
            break;
        case "fa-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$6();
            }
            break;
        case "provider-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$5();
            }
            break;
        case "side-panel":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "unlock-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "unlock-header":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const UnlockPanel = UnlockPanel$1;
const defineCustomElement = defineCustomElement$1;

export { UnlockPanel, defineCustomElement };

//# sourceMappingURL=unlock-panel.js.map