"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    AtomicTabButton: ()=>AtomicTabButton
});
const external_lit_namespaceObject = require("lit");
const decorators_js_namespaceObject = require("lit/decorators.js");
const error_guard_cjs_namespaceObject = require("../../../decorators/error-guard.cjs");
const with_tailwind_styles_cjs_namespaceObject = require("../../../decorators/with-tailwind-styles.cjs");
const light_dom_cjs_namespaceObject = require("../../../mixins/light-dom.cjs");
function _ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
    else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function _ts_metadata(k, v) {
    if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
}
class AtomicTabButton extends (0, light_dom_cjs_namespaceObject.LightDomMixin)(external_lit_namespaceObject.LitElement) {
    connectedCallback() {
        super.connectedCallback();
        this.addEventListener('click', this.handleClick);
        this.addEventListener('keydown', this.handleKeydown);
        this.updateHostAttributes();
        this.updateHostClasses();
    }
    disconnectedCallback() {
        super.disconnectedCallback();
        this.removeEventListener('click', this.handleClick);
        this.removeEventListener('keydown', this.handleKeydown);
    }
    updated(changedProperties) {
        if (changedProperties.has('active')) {
            this.updateHostAttributes();
            this.updateHostClasses();
        }
    }
    updateHostAttributes() {
        this.setAttribute('role', 'tab');
        this.setAttribute('aria-selected', this.active ? 'true' : 'false');
        this.setAttribute('part', this.active ? 'button-container-active' : 'button-container');
        this.tabIndex = this.active ? 0 : -1;
    }
    updateHostClasses() {
        this.classList.add('cursor-pointer', 'hover:text-primary', 'focus-visible:text-primary', 'focus-visible:outline-none');
        this.classList.toggle('text-on-background', this.active);
        this.classList.toggle('text-neutral-dark', !this.active);
        this.classList.toggle('relative', this.active);
        this.classList.toggle('after:block', this.active);
        this.classList.toggle('after:w-full', this.active);
        this.classList.toggle('after:h-1', this.active);
        this.classList.toggle('after:absolute', this.active);
        this.classList.toggle('after:-bottom-0.5', this.active);
        this.classList.toggle('after:bg-primary', this.active);
        this.classList.toggle('after:rounded', this.active);
    }
    render() {
        const buttonClasses = [
            'relative',
            'inline-block',
            'overflow-hidden',
            'w-full',
            'truncate',
            'px-2',
            'pb-1',
            'text-xl',
            'sm:px-6'
        ].filter(Boolean).join(' ');
        return (0, external_lit_namespaceObject.html)`
      <span
        class=${buttonClasses}
        part=${this.active ? 'tab-button-active' : 'tab-button'}
      >
        ${this.label}
      </span>
    `;
    }
    constructor(...args){
        super(...args), this.active = false, this.handleClick = ()=>{
            this.select();
        }, this.handleKeydown = (event)=>{
            if ('Enter' === event.key || ' ' === event.key) {
                event.preventDefault();
                this.select();
            }
        };
    }
}
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: String
    }),
    _ts_metadata("design:type", String)
], AtomicTabButton.prototype, "label", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        type: Boolean
    })
], AtomicTabButton.prototype, "active", void 0);
_ts_decorate([
    (0, decorators_js_namespaceObject.property)({
        attribute: false
    }),
    _ts_metadata("design:type", Function)
], AtomicTabButton.prototype, "select", void 0);
_ts_decorate([
    (0, error_guard_cjs_namespaceObject.errorGuard)(),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", []),
    _ts_metadata("design:returntype", void 0)
], AtomicTabButton.prototype, "render", null);
AtomicTabButton = _ts_decorate([
    (0, decorators_js_namespaceObject.customElement)('atomic-tab-button'),
    with_tailwind_styles_cjs_namespaceObject.withTailwindStyles
], AtomicTabButton);
exports.AtomicTabButton = __webpack_exports__.AtomicTabButton;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "AtomicTabButton"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
