'use strict';

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

const index = require('./index-75aef097.js');
const assetsManager = require('./assets-manager-089e91b1.js');
require('./mer-animated-dots-78490ca4.js');
require('lit');
require('lit/directives/when.js');
require('lit/directives/if-defined.js');
const locale = require('./locale-ff30a5f3.js');

const detailsAcknowledgementsCss = "@charset \"UTF-8\";button.button-secondary{border-color:var(--color-border-neutral-default)}:host{display:grid;block-size:100%;grid-auto-rows:max-content;justify-content:center;padding:95px 24px 95px 24px;overflow:auto}.licenses-descriptions-list,.licenses-names-list{list-style:none;margin:0;padding:0}.main-wrapper{max-inline-size:1000px;display:grid;gap:var(--spacing-gap-xxxl)}.logo{inline-size:201px;block-size:41px;margin:0 auto;margin-block-end:40px;opacity:0;transform:translateY(4px);animation:showLogo var(--timing-regular) ease-out forwards;animation-delay:var(--timing-regular);background-color:var(--color-icon-neutral-default)}@keyframes showLogo{100%{opacity:1;transform:translateY(0)}}.card{display:grid;border-radius:4px;border-width:1px;border-color:var(--elevation-border-color);border-style:solid;padding:var(--spacing-padding-xxl);gap:var(--spacing-gap-xl);opacity:0;animation:showCard var(--timing-fast) ease-out forwards;animation-delay:calc(var(--timing-regular) * 2)}@keyframes showCard{100%{opacity:1}}h1.title{font-weight:var(--font-style-semi-bold)}.intro-container{display:grid;gap:var(--spacing-gap-xl)}.date-container{display:grid;gap:var(--spacing-gap-l)}.card-package{opacity:0;transition:opacity var(--timing-fast)}.package-name{--package-name-color:var(--color-text-primary-default);color:var(--package-name-color)}.package-name a{display:flex;align-items:center;gap:var(--spacing-gap-m)}.package-name.has-link:hover{--package-name-color:var(--color-text-primary-hover)}.package-name.has-link:active{--package-name-color:var(--color-text-primary-pressed)}.package-link{display:inline-block}.licenses-names-list{display:flex;align-items:center}.licenses-names-item:not(:first-child)::before{content:\"•\";padding-inline:8px}.licenses-descriptions-description{white-space:break-spaces;max-block-size:940px;overflow:auto;line-height:var(--line-height-spacious)}.licenses-descriptions-item{display:grid;gap:var(--spacing-gap-xl)}.code-box{border-radius:4px;background-color:var(--color-accent-surface-surface);border:1px solid var(--color-border-surface-on-elevation-1);padding:var(--spacing-padding-xl);font-family:var(--font-family-code);font-size:var(--font-size-body-s);display:grid;gap:var(--spacing-gap-xxl)}.description-list{display:grid;gap:var(--spacing-gap-m);max-inline-size:400px;margin:0 auto}.show-more-button{justify-self:start}.color-neutral{color:var(--color-text-neutral-on-disabled)}.color-primary{color:var(--color-text-primary-default)}p{--line-height-tight:1.5;--font-weight-regular:var(\n    --font-style-regular\n  )}hr{border-block-start:0;border-color:var(--color-border-surface-on-elevation-1);inline-size:100%;margin:0}";

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 _GxIdeDetailsAcknowledgements_getFormatedDate, _GxIdeDetailsAcknowledgements_renderLicenseInfo, _GxIdeDetailsAcknowledgements_renderLicensesViewButtons, _GxIdeDetailsAcknowledgements_getLicenseId, _GxIdeDetailsAcknowledgements_viewLicenseClickedHandler, _GxIdeDetailsAcknowledgements_openLinkClickedHandler;
const OPEN_WINDOW_ICON = assetsManager.getIconPath({
    category: "gemini-tools",
    name: "open-window",
    colorType: "primary"
});
const IMAGES_PATH = "./gx-ide-assets/details-acknowledgements/images";
const BACKGROUND_SIZE = "300px";
const GENEXUS_NEXT_LOGO_SRC = index.getAssetPath(`${IMAGES_PATH}/genexus-next-logo.svg`);
const BG_IMAGE_TOP_START = index.getAssetPath(`${IMAGES_PATH}/top-start.svg`);
const BG_IMAGE_BOTTOM_START = index.getAssetPath(`${IMAGES_PATH}/bottom-start.svg`);
const BG_IMAGE_BOTTOM_END = index.getAssetPath(`${IMAGES_PATH}/bottom-end.svg`);
const CSS_BUNDLES = [
    "resets/box-sizing",
    "utils/typography",
    "utils/elevation",
    "components/button",
    "components/icon",
    "chameleon/scrollbar"
];
const GxIdeDetailsAcknowledgements = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        _GxIdeDetailsAcknowledgements_getFormatedDate.set(this, (date) => {
            return date === null || date === void 0 ? void 0 : date.toISOString().split("T")[0];
        });
        _GxIdeDetailsAcknowledgements_renderLicenseInfo.set(this, (license, type = "name", packageData) => {
            const licenseId = __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_getLicenseId, "f").call(this, packageData, license.name);
            const showDescription = licenseId === this.expandedLicenseId;
            return type === "name" ? (index.h("ul", { class: "licenses-names-list" }, index.h("li", { class: "body-regular-m licenses-names-item" }, license.name))) : (index.h("ul", { class: "licenses-descriptions-list" }, index.h("li", { class: "licenses-descriptions-item", key: license.name }, showDescription ? (index.h("p", { class: "code-box color-neutral licenses-descriptions-description scrollable" }, license.description)) : null)));
        });
        _GxIdeDetailsAcknowledgements_renderLicensesViewButtons.set(this, (license, packageData) => {
            const licenseId = __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_getLicenseId, "f").call(this, packageData, license.name);
            const visibleLicenseButton = licenseId === this.expandedLicenseId;
            const viewLicenseButtonLabel = visibleLicenseButton
                ? this._componentLocale.detailsCard.hide
                : this._componentLocale.detailsCard.show;
            return (index.h("div", { class: "licenses-buttons-container buttons-spacer" }, index.h("button", { class: {
                    "button-icon-and-text": true,
                    "button-primary": !visibleLicenseButton,
                    "button-secondary": visibleLicenseButton,
                    "show-more-button": true
                }, onClick: __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_viewLicenseClickedHandler, "f").call(this, licenseId) }, viewLicenseButtonLabel)));
        });
        _GxIdeDetailsAcknowledgements_getLicenseId.set(this, (packageData, licenseName) => {
            return `${packageData.packageName}-${packageData.packageVersion}-${licenseName}`;
        });
        _GxIdeDetailsAcknowledgements_viewLicenseClickedHandler.set(this, (licenseId) => () => {
            if (licenseId === this.expandedLicenseId) {
                // collapse
                this.expandedLicenseId = undefined;
            }
            else {
                // expand collapse
                this.expandedLicenseId = licenseId;
            }
        });
        _GxIdeDetailsAcknowledgements_openLinkClickedHandler.set(this, (url) => (e) => {
            if (this.openPackageUrlCallback) {
                e.preventDefault();
                this.openPackageUrlCallback(url);
            }
        });
        this.expandedLicenseId = undefined;
        this.dateGenerated = undefined;
        this.release = undefined;
        this.packages = undefined;
        this.openPackageUrlCallback = undefined;
    }
    async componentWillLoad() {
        this._componentLocale = await locale.Locale.getComponentStrings(this.el);
    }
    render() {
        var _a;
        const formatedDate = __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_getFormatedDate, "f").call(this, this.dateGenerated);
        return (index.h(index.Host, { class: "scrollable", style: {
                backgroundImage: `url(${BG_IMAGE_TOP_START}), url(${BG_IMAGE_BOTTOM_START}), url(${BG_IMAGE_BOTTOM_END})`,
                backgroundPosition: "left top, left bottom, right bottom",
                backgroundRepeat: "no-repeat, no-repeat, no-repeat",
                backgroundSize: `${BACKGROUND_SIZE}, ${BACKGROUND_SIZE}, ${BACKGROUND_SIZE}`
            } }, index.h("ch-theme", { model: CSS_BUNDLES }), index.h("div", { class: "main-wrapper" }, index.h("div", { style: {
                mask: `url(${GENEXUS_NEXT_LOGO_SRC}) no-repeat center`
            }, class: "logo" }), index.h("div", { class: "card card-details elevation-1" }, index.h("div", { class: "intro-container" }, index.h("h1", { class: "title heading-3" }, this._componentLocale.detailsCard.title), index.h("p", { class: "body-regular-m" }, this._componentLocale.detailsCard.mainDescription), index.h("p", { class: "color-neutral body-italic-s" }, this._componentLocale.detailsCard.secondaryDescription)), index.h("hr", null), index.h("div", { class: "date-container" }, index.h("p", { class: "color-neutral" }, this._componentLocale.detailsCard.dateGenerated), index.h("time", { dateTime: formatedDate }, formatedDate))), (_a = this.packages) === null || _a === void 0 ? void 0 :
            _a.map(packageItem => {
                let packageName = `${packageItem.packageName} ${packageItem.packageVersion}`;
                const headingContent = packageItem.packageURL ? (index.h("a", { href: packageItem.packageURL, target: "_blank", onClick: __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_openLinkClickedHandler, "f").call(this, packageItem.packageURL), class: "package-link" }, packageName, index.h("ch-image", { src: OPEN_WINDOW_ICON, class: "package-icon icon-s" }))) : (packageName);
                return (index.h("article", { class: "card card-package elevation-1" }, index.h("h2", { class: {
                        "subtitle-semi-bold-s": true,
                        "package-name": true,
                        "has-link": !!packageItem.packageURL
                    } }, headingContent), index.h("p", { class: "subtitle-semi-bold-s" }, this._componentLocale.packageCard.declaredLicenses), __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_renderLicenseInfo, "f").call(this, packageItem.declaredLicense, "name", packageItem), __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_renderLicenseInfo, "f").call(this, packageItem.declaredLicense, "description", packageItem), __classPrivateFieldGet(this, _GxIdeDetailsAcknowledgements_renderLicensesViewButtons, "f").call(this, packageItem.declaredLicense, packageItem)));
            }))));
    }
    static get assetsDirs() { return ["gx-ide-assets/details-acknowledgements"]; }
    get el() { return index.getElement(this); }
};
_GxIdeDetailsAcknowledgements_getFormatedDate = new WeakMap(), _GxIdeDetailsAcknowledgements_renderLicenseInfo = new WeakMap(), _GxIdeDetailsAcknowledgements_renderLicensesViewButtons = new WeakMap(), _GxIdeDetailsAcknowledgements_getLicenseId = new WeakMap(), _GxIdeDetailsAcknowledgements_viewLicenseClickedHandler = new WeakMap(), _GxIdeDetailsAcknowledgements_openLinkClickedHandler = new WeakMap();
GxIdeDetailsAcknowledgements.style = detailsAcknowledgementsCss;

exports.gx_ide_details_acknowledgements = GxIdeDetailsAcknowledgements;

//# sourceMappingURL=gx-ide-details-acknowledgements.cjs.entry.js.map