/*!
 * Built by ShiftSoftware
 * Copyright (c)
 */
'use strict';

var index = require('./index-CmK48vN3.js');
var cn = require('./cn-BHnqYtun.js');

function containerHasTag(root, tag) {
    /**
     * Checks if the given root node or any of its descendants has an element with the specified tag.
     * @param root - The root node to start the search from.
     * @param tag - The tag name to search for (case-insensitive).
     * @returns True if an element with the specified tag is found, otherwise false.
     */
    function traverse(node) {
        if (node.nodeType === Node.ELEMENT_NODE) {
            const el = node;
            if (el.tagName.toLowerCase().startsWith(tag))
                return true;
            const shadowRoot = el === null || el === void 0 ? void 0 : el.shadowRoot;
            if (shadowRoot)
                return traverse(shadowRoot);
            return Array.from(el.children).some(traverse);
        }
        else if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
            return Array.from(node.children).some(traverse);
        }
        return false;
    }
    return traverse(root);
}

const shiftSliderCss = "*,: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}.\\!pointer-events-none{pointer-events:none!important}.static{position:static}.absolute{position:absolute}.relative{position:relative}.top-0{top:0}.w-full{width:100%}.-translate-x-\\[110\\%\\]{--tw-translate-x:-110%}.-translate-x-\\[110\\%\\],.translate-x-\\[110\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\\[110\\%\\]{--tw-translate-x:110%}.opacity-0{opacity:0}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.\\!duration-1000{transition-duration:1s!important}.\\[\\&_\\*\\]\\:\\!pointer-events-none *{pointer-events:none!important}.\\!h-auto{height:auto!important}.min-w-full{min-width:100%}.resize{resize:both}.overflow-hidden{overflow:hidden}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.\\!transition-none{transition-property:none!important}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.\\!duration-0{transition-duration:0s!important}.\\!duration-500{transition-duration:.5s!important}.duration-500{transition-duration:.5s}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}";

const ShiftSlider = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
    }
    async componentDidLoad() {
        this.flexibleContainerRef = this.el.getElementsByTagName('flexible-container')[0];
    }
    async onActiveIndexChange(newActiveIndex) {
        clearTimeout(this.ChildUpdatesActionTimeout);
        const newActiveElement = this.el.getElementsByClassName('element-number-' + newActiveIndex)[0];
        if (newActiveElement && containerHasTag(newActiveElement, 'flexible-container')) {
            this.flexibleContainerRef.stopAnimation = false;
            this.ChildUpdatesActionTimeout = setTimeout(() => {
                this.flexibleContainerRef.stopAnimation = true;
            }, 600);
        }
        else
            this.flexibleContainerRef.stopAnimation = false;
    }
    render() {
        return (index.h(index.Host, { key: '0e4b9e09b949824d216af9be2489541dc6472711', translate: "no" }, index.h("flexible-container", { key: 'c9fbeb11fc8d04286eb5ed40b08a2999245df80b', stopAnimation: true, classes: "relative" }, this.components.map((listElement, idx) => (index.h("div", { class: cn.cn('w-full transition !duration-1000', 'element-number-' + idx, {
                'opacity-0 absolute top-0 !pointer-events-none [&_*]:!pointer-events-none': this.activeIndex !== idx,
                'translate-x-[110%]': this.activeIndex < idx,
                '-translate-x-[110%]': this.activeIndex > idx,
            }) }, listElement()))))));
    }
    get el() { return index.getElement(this); }
    static get watchers() { return {
        "activeIndex": ["onActiveIndexChange"]
    }; }
};
ShiftSlider.style = shiftSliderCss;

exports.shift_slider = ShiftSlider;
