'use strict';

var index = require('./index-DOPS1LtU.js');
var EventBus = require('./EventBus-Dq4GLNJp.js');

var ToastEventsEnum;
(function (ToastEventsEnum) {
    ToastEventsEnum["OPEN_NOTIFICATIONS_FEED"] = "OPEN_NOTIFICATIONS_FEED";
    ToastEventsEnum["CLOSE_TOAST"] = "CLOSE_TOAST";
    // Event to update the transaction toast data
    ToastEventsEnum["TRANSACTION_TOAST_DATA_UPDATE"] = "TRANSACTION_TOAST_DATA_UPDATE";
    // Event to update the custom toast data
    ToastEventsEnum["CUSTOM_TOAST_DATA_UPDATE"] = "CUSTOM_TOAST_DATA_UPDATE";
})(ToastEventsEnum || (ToastEventsEnum = {}));

const toastListCss = "/*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer theme{:host,:root{--mvx-font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--mvx-font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--mvx-default-font-family:var(--mvx-font-sans);--mvx-default-mono-font-family:var(--mvx-font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--mvx-default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--mvx-default-font-feature-settings,normal);font-variation-settings:var(--mvx-default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--mvx-default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--mvx-default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--mvx-default-mono-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}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentColor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities; /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */@layer base{}@layer components,utilities;:root{--mx-accent:#fff;--mx-white:#fff;--mx-black:#000;--mx-neutral-900:#171717;--mx-neutral-50:#fafafa;--mx-neutral-400:#a3a3a3;--mx-text:var(--mx-white);--mx-primary-text:#262626;--mx-secondary-text:#868686;--mx-warning-text:#facc15;--mx-body-label-color:#a09a93;--mx-tx-bg:#353535;--mx-tx-bg-transparent:#3535354d;--mx-tx-text-primary:#e8e8e8;--mx-tx-text-secondary:#737373;--mx-toast-backdrop-blur:38px;--mx-toast-success-bg:#1d6030;--mx-toast-success-color:#4ade80;--mx-toast-pending-bg:#453412;--mx-toast-pending-color:#facc15;--mx-toast-error-bg:#ff474733;--mx-toast-error-color:#ff4747;--font-family-roobert:\"Roobert PRO\",system-ui,-apple-system,sans-serif;--mx-explorer-link-color:var(--mx-primary-text);--mx-transition:.3s ease-in-out}.toast-list{bottom:16px;display:flex;flex-direction:column;gap:8px;max-width:100%;pointer-events:none;position:fixed;right:16px;z-index:9999}.toast-list-bottom{bottom:64px}.toast-list>*{pointer-events:auto}.view-all-button-container{bottom:-48px;position:absolute;right:0;z-index:1}.view-all-button{-webkit-backdrop-filter:blur(38px);backdrop-filter:blur(38px);background:var(--mx-tx-bg);border:.5px solid var(--mx-tx-bg);border-radius:100px;color:var(--mx-tx-text-primary);cursor:pointer;font-family:var(--font-family-roobert);font-size:16px;font-style:normal;font-weight:400;line-height:140%;padding:8px 16px;transition:opacity .2s}.view-all-button:hover{opacity:.9}";

const ToastList = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.eventBus = new EventBus.EventBus();
    }
    async getEventBus() {
        return this.eventBus;
    }
    disconnectedCallback() {
        this.eventBus.unsubscribe(ToastEventsEnum.TRANSACTION_TOAST_DATA_UPDATE, this.transactionToastUpdate.bind(this));
        this.eventBus.unsubscribe(ToastEventsEnum.CUSTOM_TOAST_DATA_UPDATE, this.customToastsUpdate.bind(this));
    }
    handleCustomToastDelete(toastId) {
        this.eventBus.publish(ToastEventsEnum.CLOSE_TOAST, toastId);
    }
    handleTransactionToastDelete(toastId) {
        this.eventBus.publish(ToastEventsEnum.CLOSE_TOAST, toastId);
    }
    handleViewAllClick() {
        this.eventBus.publish(ToastEventsEnum.OPEN_NOTIFICATIONS_FEED);
    }
    render() {
        var _a, _b, _c;
        const hasTransactionToasts = ((_a = this.transactionToasts) === null || _a === void 0 ? void 0 : _a.length) > 0;
        return (index.h("div", { key: 'edc436072161689938deb40599be8bd34997592b', class: {
                'toast-list': true,
                'toast-list-bottom': hasTransactionToasts,
            }, id: "toast-list" }, (_b = this.customToasts) === null || _b === void 0 ? void 0 :
            _b.map(toast => index.h("mvx-generic-toast", { toast: toast, onDeleteToast: this.handleCustomToastDelete.bind(this, toast.toastId) })), (_c = this.transactionToasts) === null || _c === void 0 ? void 0 :
            _c.map(toast => (index.h("mvx-transaction-toast", Object.assign({}, toast, { onDeleteToast: this.handleTransactionToastDelete.bind(this, toast.toastId) })))), hasTransactionToasts && (index.h("div", { key: 'b4fbf199402480ecbb8fd6166a5ff88a785c1783', class: "view-all-button-container" }, index.h("button", { key: 'b73761b4c5e0a296ad0bc0aed8a24730bbe8e691', class: "view-all-button", onClick: this.handleViewAllClick.bind(this) }, "View All")))));
    }
    transactionToastUpdate(payload) {
        this.transactionToasts = [...payload];
        index.forceUpdate(this);
    }
    customToastsUpdate(payload) {
        this.customToasts = [...payload];
        index.forceUpdate(this);
    }
    componentDidLoad() {
        this.eventBus.subscribe(ToastEventsEnum.TRANSACTION_TOAST_DATA_UPDATE, this.transactionToastUpdate.bind(this));
        this.eventBus.subscribe(ToastEventsEnum.CUSTOM_TOAST_DATA_UPDATE, this.customToastsUpdate.bind(this));
    }
};
ToastList.style = toastListCss;

exports.mvx_toast_list = ToastList;
//# sourceMappingURL=mvx-toast-list.entry.cjs.js.map

//# sourceMappingURL=mvx-toast-list.cjs.entry.js.map