/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
import { l as listSvg } from './list2.js';
import { r as reorderTwoSharp, s as reorderThreeOutline } from './index6.js';
import { c as config } from './index4.js';
import { b as getIonTheme } from './ionic-global.js';
import { d as defineCustomElement$2 } from './icon.js';

const ionicReorderMdCss = ":host([slot]){display:none;line-height:0;z-index:100}.reorder-icon{display:block}::slotted(ion-icon){font-size:dynamic-font(16px)}.reorder-icon{font-size:1.9375rem;opacity:0.3}";

const reorderIosCss = ":host([slot]){display:none;line-height:0;z-index:100}.reorder-icon{display:block}::slotted(ion-icon){font-size:dynamic-font(16px)}.reorder-icon{font-size:2.125rem;opacity:0.4}";

const reorderMdCss = ":host([slot]){display:none;line-height:0;z-index:100}.reorder-icon{display:block}::slotted(ion-icon){font-size:dynamic-font(16px)}.reorder-icon{font-size:1.9375rem;opacity:0.3}";

const Reorder = /*@__PURE__*/ proxyCustomElement(class Reorder extends HTMLElement {
    constructor(registerHost) {
        super();
        if (registerHost !== false) {
            this.__registerHost();
        }
        this.__attachShadow();
    }
    onClick(ev) {
        const reorderGroup = this.el.closest('ion-reorder-group');
        ev.preventDefault();
        // Only stop event propagation if the reorder is inside of an enabled
        // reorder group. This allows interaction with clickable children components.
        if (!reorderGroup || !reorderGroup.disabled) {
            ev.stopImmediatePropagation();
        }
    }
    /**
     * Get the icon to use for the handle icon.
     * Otherwise, use the icon set in the config.
     * If no icon is set in the config, use the default icon.
     */
    get reorderHandleIcon() {
        // Determine the theme and map to default icons
        const theme = getIonTheme(this);
        const defaultIcons = {
            ios: reorderThreeOutline,
            ionic: listSvg,
            md: reorderTwoSharp,
        };
        // Get the default icon based on the theme, falling back to 'md' icon if necessary
        const defaultIcon = defaultIcons[theme] || defaultIcons.md;
        // Return the configured reorder handle icon or the default icon
        return config.get('reorderHandleIcon', defaultIcon);
    }
    render() {
        const { reorderHandleIcon } = this;
        const theme = getIonTheme(this);
        return (h(Host, { key: 'e42645240aa9a32cc6768289eb1af656ed15482d', class: {
                [theme]: true,
            } }, h("slot", { key: '9e6d2fb09480e7e0ef6bb84524bfc2a23fa1d9cb' }, h("ion-icon", { key: '411e5791ce7575383c54c05ba305c1c83acaacde', icon: reorderHandleIcon, lazy: false, class: "reorder-icon", part: "icon", "aria-hidden": "true" }))));
    }
    get el() { return this; }
    static get style() { return {
        ionic: ionicReorderMdCss,
        ios: reorderIosCss,
        md: reorderMdCss
    }; }
}, [289, "ion-reorder", undefined, [[2, "click", "onClick"]]]);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["ion-reorder", "ion-icon"];
    components.forEach(tagName => { switch (tagName) {
        case "ion-reorder":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, Reorder);
            }
            break;
        case "ion-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}

const IonReorder = Reorder;
const defineCustomElement = defineCustomElement$1;

export { IonReorder, defineCustomElement };
