'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-75aef097.js');

const breadcrumbItemCss = ":host{display:grid;block-size:100%}.opacity-0{opacity:0}.gxi-hidden{display:none !important}.align-center{display:flex;align-items:center}.align-end{display:flex;align-items:end}.overflow-auto{overflow:auto}:host(.gx-ide-component){height:100% !important;display:flex !important;flex-direction:column !important}.gx-ide-main-wrapper{color:var(--gx-ide-component-text-color);font-weight:var(--font-style-regular);font-size:var(--font-size-body-m);font-family:var(--font-family-body);height:100%;display:flex;flex-direction:column;flex-grow:1;box-sizing:border-box}.buttons-container{display:flex;gap:var(--spacing-gap-m)}.giu-static-pill-icon-and-text,.giu-static-pill{background-color:var(--elevation-background-color, var(--color-accent-surface-elevation-1));padding-inline:var(--spacing-padding-m);color:var(--color-text-neutral-default);font-size:var(--font-size-body-s);line-height:var(--line-height-relaxed);font-weight:var(--font-style-regular);border-radius:4px;min-block-size:25px;display:inline-grid;align-items:center;pointer-events:none;inline-size:max-content}.giu-static-pill-icon-and-text{display:inline-grid;grid-auto-flow:column;grid-auto-columns:max-content;gap:var(--spacing-gap-m)}.tab-full-width-buttons::part(tab-list block-start),.tab-full-width-buttons::part(tab-list block-end){grid-auto-columns:1fr}.tab-full-width-buttons::part(tab block-start){justify-content:center}.tree-view::part(item__header){--icon__system_warning_warning--disabled:var(\n    --icon__system_warning_warning--enabled\n  )}.tabular-grid{--focus-outline-width:1px}:host{display:inline-grid}.item-content{display:inline-flex;align-items:center;gap:var(--spacing-gap-xs)}.action{display:inline-flex;align-items:center;gap:var(--spacing-gap-xs);padding-block:var(--spacing-padding-xxs);padding-inline:var(--spacing-padding-xs);border:none;border-radius:4px;background:transparent;text-decoration:none;cursor:pointer;font:inherit;}.action:not(a){color:var(--color-text-interactive-default)}.action:hover:not(.disabled){background-color:var(--color-accent-surface-elevation-1-hover)}.action:not(a):hover:not(.disabled){color:var(--color-text-interactive-hover)}.action:focus-visible{outline:2px solid var(--color-border-focus-default);outline-offset:-2px}.action.disabled{color:var(--color-text-neutral-disabled);cursor:not-allowed}.action.selected{color:var(--color-text-primary-default)}.caption{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item__img{flex-shrink:0;background-size:contain;background-repeat:no-repeat;background-position:center}.item__img:not(.item__img-icon){inline-size:var(--icon-s);block-size:var(--icon-s)}.item__img--mask{background-color:currentColor;background-size:contain;background-repeat:no-repeat;background-position:center}";

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f)
        throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
        throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _GxIdeBreadcrumbItem_resolveImageSrc, _GxIdeBreadcrumbItem_getCaption, _GxIdeBreadcrumbItem_getAccessibleName, _GxIdeBreadcrumbItem_renderStartImage;
const GxIdeBreadcrumbItem = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        _GxIdeBreadcrumbItem_resolveImageSrc.set(this, () => {
            var _a, _b;
            if (this.getImagePathCallback) {
                const result = this.getImagePathCallback(this.model);
                if (result === null || result === void 0 ? void 0 : result.base)
                    return result.base;
            }
            return (_a = this.startImgSrc) !== null && _a !== void 0 ? _a : (_b = this.model) === null || _b === void 0 ? void 0 : _b.startImgSrc;
        });
        _GxIdeBreadcrumbItem_getCaption.set(this, () => { var _a, _b, _c; return (_c = (_a = this.caption) !== null && _a !== void 0 ? _a : (_b = this.model) === null || _b === void 0 ? void 0 : _b.caption) !== null && _c !== void 0 ? _c : ""; });
        _GxIdeBreadcrumbItem_getAccessibleName.set(this, () => {
            var _a, _b, _c, _d;
            return (_d = (_c = (_a = this.accessibleName) !== null && _a !== void 0 ? _a : (_b = this.model) === null || _b === void 0 ? void 0 : _b.accessibleName) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _GxIdeBreadcrumbItem_getCaption, "f").call(this)) !== null && _d !== void 0 ? _d : "";
        });
        _GxIdeBreadcrumbItem_renderStartImage.set(this, () => {
            var _a, _b;
            const src = __classPrivateFieldGet(this, _GxIdeBreadcrumbItem_resolveImageSrc, "f").call(this);
            if (!src)
                return undefined;
            const type = (_a = this.startImgType) !== null && _a !== void 0 ? _a : (_b = this.model) === null || _b === void 0 ? void 0 : _b.startImgType;
            const isUrl = src.trim().toLowerCase().startsWith("url(");
            if (isUrl && (type === "background" || type === "mask")) {
                return (index.h("span", { class: {
                        "item__img": true,
                        "item__img--background": type === "background",
                        "item__img--mask": type === "mask"
                    }, style: type === "background"
                        ? { backgroundImage: src }
                        : { maskImage: src, WebkitMaskImage: src }, "aria-hidden": "true" }));
            }
            return (index.h("ch-image", { class: "item__img item__img-icon icon-m", src: src, "aria-hidden": "true" }));
        });
        this.model = undefined;
        this.caption = undefined;
        this.accessibleName = undefined;
        this.disabled = undefined;
        this.link = undefined;
        this.selected = false;
        this.selectedLinkIndicator = false;
        this.startImgSrc = undefined;
        this.startImgType = undefined;
        this.getImagePathCallback = undefined;
        this.itemId = undefined;
    }
    render() {
        var _a, _b, _c, _d, _e;
        const caption = __classPrivateFieldGet(this, _GxIdeBreadcrumbItem_getCaption, "f").call(this);
        const ariaLabel = __classPrivateFieldGet(this, _GxIdeBreadcrumbItem_getAccessibleName, "f").call(this);
        const isDisabled = (_c = (_a = this.disabled) !== null && _a !== void 0 ? _a : (_b = this.model) === null || _b === void 0 ? void 0 : _b.disabled) !== null && _c !== void 0 ? _c : false;
        const hasLink = ((_d = this.link) === null || _d === void 0 ? void 0 : _d.url) !== undefined && ((_e = this.link) === null || _e === void 0 ? void 0 : _e.url) !== "";
        const imgContent = __classPrivateFieldGet(this, _GxIdeBreadcrumbItem_renderStartImage, "f").call(this);
        const captionClass = {
            "caption": true,
            "body-regular-s": !this.selected || !this.selectedLinkIndicator,
            "body-semi-bold-s": this.selected && this.selectedLinkIndicator
        };
        const content = (index.h("span", { class: "item-content" }, imgContent, caption ? (index.h("span", { class: captionClass, part: "item-caption" }, caption)) : null));
        const actionClass = {
            "action": true,
            "disabled": isDisabled,
            "selected": this.selected && this.selectedLinkIndicator,
            "not-selected": !this.selected
        };
        if (hasLink && !isDisabled) {
            return (index.h(index.Host, { role: "listitem", "data-item-id": this.itemId, "data-has-link": "true", part: "item-action item-link" }, index.h("a", { class: Object.assign(Object.assign({}, actionClass), { "link-primary": true }), href: this.link.url, "aria-current": this.selected ? "page" : undefined, "aria-label": ariaLabel || undefined, part: "item-link" }, content)));
        }
        if (hasLink && isDisabled) {
            return (index.h(index.Host, { role: "listitem", "data-item-id": this.itemId, "data-has-link": "true", part: "item-action disabled" }, index.h("span", { class: actionClass, "aria-disabled": "true", "aria-label": ariaLabel || undefined, part: "item-link disabled" }, content)));
        }
        return (index.h(index.Host, { role: "listitem", "data-item-id": this.itemId, "data-has-link": "false", part: "item-action item-button" }, index.h("button", { type: "button", class: actionClass, disabled: isDisabled, "aria-label": ariaLabel || undefined, part: "item-button" }, content)));
    }
};
_GxIdeBreadcrumbItem_resolveImageSrc = new WeakMap(), _GxIdeBreadcrumbItem_getCaption = new WeakMap(), _GxIdeBreadcrumbItem_getAccessibleName = new WeakMap(), _GxIdeBreadcrumbItem_renderStartImage = new WeakMap();
GxIdeBreadcrumbItem.style = breadcrumbItemCss;

exports.gx_ide_breadcrumb_item = GxIdeBreadcrumbItem;

//# sourceMappingURL=gx-ide-breadcrumb-item.cjs.entry.js.map