'use strict';

var index = require('./index-DOPS1LtU.js');
var index$1 = require('./index-B-Dw-4Qa.js');
var EventBus = require('./EventBus-Dq4GLNJp.js');

var NotificationsFeedEventsEnum;
(function (NotificationsFeedEventsEnum) {
    NotificationsFeedEventsEnum["CLOSE_NOTIFICATIONS_FEED"] = "CLOSE_NOTIFICATIONS_FEED";
    NotificationsFeedEventsEnum["CLEAR_NOTIFICATIONS_FEED_HISTORY"] = "CLEAR_NOTIFICATIONS_FEED_HISTORY";
    NotificationsFeedEventsEnum["OPEN_NOTIFICATIONS_FEED"] = "OPEN_NOTIFICATIONS_FEED";
    // Event to update the pending transactions list
    NotificationsFeedEventsEnum["PENDING_TRANSACTIONS_UPDATE"] = "PENDING_TRANSACTIONS_UPDATE";
    // Event to update the transactions history list
    NotificationsFeedEventsEnum["TRANSACTIONS_HISTORY_UPDATE"] = "TRANSACTIONS_HISTORY_UPDATE";
})(NotificationsFeedEventsEnum || (NotificationsFeedEventsEnum = {}));

const notificationsFeedCss = "/*! 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; /*! 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}.feed-content{display:flex;flex-direction:column;gap:24px;height:100%;overflow:hidden;padding:4px 0 0;position:relative}.feed-content .transaction-toast-content-wrapper{background:var(--mx-tx-bg-transparent);border-color:var(--mx-tx-bg-transparent);width:100%}.notifications-info{align-items:center;color:var(--mx-warning-text);display:flex;font-size:12px;font-style:normal;font-weight:400;gap:14px;justify-content:space-between;line-height:140%;margin:0}.notifications-info .info-icon{color:var(--mx-warning-text);font-size:16px;height:16px;width:16px}.notifications-container{margin-bottom:24px}.notifications-container .processing-status{color:var(--mx-body-label-color);font-size:16px;margin-bottom:16px}.activity-section{display:flex;flex:1;flex-direction:column;margin:0 -24px 0 0;min-height:0}.activity-header{align-items:center;display:flex;justify-content:space-between;margin:0 24px 16px 0}.activity-header .activity-title{color:var(--mx-body-label-color);font-size:20px;font-weight:500;margin:0}.activity-header .clear-button{background:0 0;border:none;color:#666;cursor:pointer;font-size:16px;padding:0}.activity-header .clear-button:hover{color:#000}.activity-list{display:flex;flex:1;flex-direction:column;gap:4px;min-height:0;overflow:hidden auto;padding:0 24px 0 0}.activity-list .no-activity{color:#666;padding:16px;text-align:center}.activity-list::-webkit-scrollbar{width:4px}.activity-list::-webkit-scrollbar-track{background:#0000000d;border-radius:2px}.activity-list::-webkit-scrollbar-thumb{background:#0003;border-radius:2px}.activity-list>*{box-sizing:border-box;max-width:100%;width:100%}";

const NotificationsFeed = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.isOpen = false;
        this.pendingTransactions = [];
        this.transactionsHistory = [];
        this.eventBus = new EventBus.EventBus();
        this.closeEventTimeout = null;
        this.handleClose = () => {
            this.isOpen = false;
            this.eventBus.publish(NotificationsFeedEventsEnum.CLOSE_NOTIFICATIONS_FEED);
        };
        this.handleClear = () => {
            this.eventBus.publish(NotificationsFeedEventsEnum.CLEAR_NOTIFICATIONS_FEED_HISTORY);
        };
        this.handleViewAll = () => {
            this.isOpen = true;
        };
    }
    clearTimeouts() {
        if (this.closeEventTimeout) {
            clearTimeout(this.closeEventTimeout);
            this.closeEventTimeout = null;
        }
    }
    disconnectedCallback() {
        this.clearTimeouts();
        this.eventBus.unsubscribe(NotificationsFeedEventsEnum.PENDING_TRANSACTIONS_UPDATE, this.pendingTransactionsUpdate.bind(this));
        this.eventBus.unsubscribe(NotificationsFeedEventsEnum.TRANSACTIONS_HISTORY_UPDATE, this.transactionsHistoryUpdate.bind(this));
        this.eventBus.unsubscribe(NotificationsFeedEventsEnum.OPEN_NOTIFICATIONS_FEED, this.handleViewAll.bind(this));
    }
    async getEventBus() {
        return this.eventBus;
    }
    render() {
        var _a, _b, _c;
        const hasActivity = ((_a = this.transactionsHistory) === null || _a === void 0 ? void 0 : _a.length) > 0;
        const hasPending = ((_b = this.pendingTransactions) === null || _b === void 0 ? void 0 : _b.length) > 0;
        return (index.h("mvx-side-panel", { key: '783de8330d5949640a01ca72ac4fe2cac3aba229', isOpen: this.isOpen, panelTitle: "Notifications Feed", onClose: this.handleClose }, index.h("div", { key: '935ab5ad191c5e6d82377488c8f4f29630efac2d', class: "feed-content" }, index.h("div", { key: '1606428b4cd7780f2d1a81282e45c85d7d662c5a', class: "notifications-info" }, index.h("mvx-fa-icon", { key: '658919ecda9ed8ff3b85d6bac6ce10a5b172056e', class: "info-icon", icon: index$1.faInfoCircle }), "This feed is stored in your browser and will be reset when a new session is started.", index.h("fa-icon", { key: '22b2f9859621f9ff86cdcbb3887a4df27192ff24', class: "info-icon", icon: index$1.faInfoCircle })), hasPending && (index.h("div", { key: '6154d0424c2d65893ae1f9a43faf8e513e474f0b', class: "notifications-container" }, index.h("div", { key: '5307c87b0eafc7b7e01c6e3b83f8c23dd5339416', class: "processing-status" }, "Processing..."), (_c = this.pendingTransactions) === null || _c === void 0 ? void 0 :
            _c.map(toast => index.h("mvx-transaction-toast", Object.assign({ fullWidth: true }, toast))))), index.h("div", { key: '03e74818a2c940c32fd712bc89f21ab6a5ba73af', class: "activity-section" }, index.h("div", { key: '73bc9330eafcc8d98ee50c5503bbf58f4dc53fb2', class: "activity-header" }, index.h("h3", { key: '0f7736798d0b04ae05ec75e3f2b94f1f6b62b684', class: "activity-title" }, "Activity"), hasActivity && (index.h("button", { key: 'e2271bdce835c9c54f3ac21e1166d23acd00d312', class: "clear-button", onClick: this.handleClear }, "Clear"))), index.h("div", { key: 'bb1ec5a3a18e55c0102561a14778ac1a22b4a85a', class: "activity-list" }, hasActivity ? (this.transactionsHistory.map(transaction => index.h("mvx-transaction-list-item", { transaction: transaction }))) : (index.h("div", { class: "no-activity" }, "No activity to show")))))));
    }
    pendingTransactionsUpdate(payload) {
        this.pendingTransactions = [...payload];
    }
    transactionsHistoryUpdate(payload) {
        this.transactionsHistory = [...payload];
    }
    componentDidLoad() {
        this.eventBus.subscribe(NotificationsFeedEventsEnum.PENDING_TRANSACTIONS_UPDATE, this.pendingTransactionsUpdate.bind(this));
        this.eventBus.subscribe(NotificationsFeedEventsEnum.TRANSACTIONS_HISTORY_UPDATE, this.transactionsHistoryUpdate.bind(this));
        this.eventBus.subscribe(NotificationsFeedEventsEnum.OPEN_NOTIFICATIONS_FEED, this.handleViewAll.bind(this));
    }
};
NotificationsFeed.style = notificationsFeedCss;

exports.mvx_notifications_feed = NotificationsFeed;
//# sourceMappingURL=mvx-notifications-feed.entry.cjs.js.map

//# sourceMappingURL=mvx-notifications-feed.cjs.entry.js.map