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AmB,QACpE,EAAU,KAAK,WAAW,OAAO,iBAAmB,KAAK,cAAgB,QAE/E,OAAO;;oCAEqB;uDACmB;6DACM;+DACE;6DACF;sDACP;;yBAE7B,IAAM,KAAK,mBAAmB,KAAK,WAAW,KAAK;;kBAE1D,KAAK,WAAW;;yDAEuB,eAA0B;uBAC5D,KAAK,WAAW;;;SAInC,GA1GS,EAwDF,OAAS;;;;;;;;;;;;;;;;;;;;;;;;MAvDY,EAAA,CAA3B,EAAS,CAAE,KAAM,UADT,EACmB,UAAA,eACA,EAAA,CAA3B,EAAS,CAAE,KAAM,UAFT,EAEmB,UAAA,WACA,EAAA,CAA3B,EAAS,CAAE,KAAM,UAHT,EAGmB,UAAA,WAEX,EAAA,CAAhB,KALQ,EAKQ,UAAA,kBACA,EAAA,CAAhB,KANQ,EAMQ,UAAA,qBANR,EAAN,EAAA,CADN,EAAc,2BACF,U","file":"/npm/@record-evolution/widget-navbutton@1.0.7/dist/widget-navbutton.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@record-evolution/widget-navbutton@1.0.7/dist/widget-navbutton.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { html, css, LitElement, PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { InputData } from './definition-schema'\n\nimport '@material/web/icon/icon.js'\nimport '@material/web/button/filled-button.js'\nimport '@material/web/ripple/ripple.js'\n\ntype Theme = {\n    theme_name: string\n    theme_object: any\n}\n\n@customElement('widget-navbutton-versionplaceholder')\nexport class WidgetNavbutton extends LitElement {\n    @property({ type: Object }) inputData?: InputData\n    @property({ type: Object }) theme?: Theme\n    @property({ type: String }) route?: string\n\n    @state() private themeBgColor?: string\n    @state() private themeTitleColor?: string\n\n    version: string = 'versionplaceholder'\n\n    update(changedProperties: Map<string, any>) {\n        if (changedProperties.has('theme')) {\n            this.registerTheme(this.theme)\n        }\n\n        super.update(changedProperties)\n    }\n\n    protected firstUpdated(_changedProperties: PropertyValues): void {\n        this.registerTheme(this.theme)\n    }\n\n    registerTheme(theme?: Theme) {\n        const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()\n        const cssBgColor = getComputedStyle(this).getPropertyValue('--re-tile-background-color').trim()\n        this.themeBgColor = cssBgColor || this.theme?.theme_object?.backgroundColor\n        this.themeTitleColor = cssTextColor || this.theme?.theme_object?.title?.textStyle?.color\n    }\n\n    handleNavItemClick(route?: string) {\n        let goto: string\n        if (this.inputData?.route === '') {\n            goto = '/' + this.route?.split('/').filter(Boolean).slice(0, -1).join('/') + '/' || '/'\n            goto = goto === '//' ? '/' : goto\n        } else {\n            goto = this.inputData?.route || '/'\n        }\n        console.log('Navigating to:', route, this.route, { goto })\n        const event = new CustomEvent('nav-submit', {\n            detail: { path: goto },\n            bubbles: true,\n            composed: true\n        })\n        this.dispatchEvent(event)\n    }\n\n    addSlashes(item?: any): string | undefined {\n        if (!item.route?.endsWith('/') && item.trailingSlash) {\n            item.route += '/'\n        }\n        if (!item.route?.startsWith('/') && item.leadingSlash) {\n            item.route = '/' + item.route\n        }\n        return item.route\n    }\n\n    static styles = css`\n        :host {\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            width: 100%;\n            height: 100%;\n            font-family: sans-serif;\n            box-sizing: border-box;\n            margin: auto;\n            padding: 2cqh 2cqw;\n        }\n\n        md-icon {\n            font-family: 'Material Symbols Outlined';\n        }\n        md-filled-button {\n            flex: 1;\n            --md-filled-button-container-shape: 4px;\n            --md-filled-button-container-shadow-color: none;\n            --md-sys-color-primary: #006a6a;\n            --md-ripple-hover-color: var(--md-sys-color-primary);\n            --md-ripple-pressed-color: var(--md-sys-color-primary);\n        }\n    `\n\n    render() {\n        const fontSize = this.inputData?.style?.fontSize ?? 16\n        const iconFontSize = (this.inputData?.style?.fontSize ?? 16) * 1.5\n        const fontColor = this.inputData?.style?.color || this.themeTitleColor || 'black'\n        const bgColor = this.inputData?.style?.backgroundColor || this.themeBgColor || 'white'\n        const gap = fontSize * 0.4\n        return html`\n            <md-filled-button\n                style=\"font-size: ${fontSize}px; \n                --md-filled-button-label-text-color: ${fontColor}; \n                --md-filled-button-hover-label-text-color: ${fontColor};\n                --md-filled-button-pressed-label-text-color: ${fontColor};\n                --md-filled-button-focus-label-text-color: ${fontColor};\n                --md-filled-button-container-color: ${bgColor};\n                \"\n                @click=${() => this.handleNavItemClick(this.addSlashes(this.inputData))}\n            >\n                ${this.inputData?.title}\n                <md-ripple></md-ripple>\n                <md-icon slot=\"icon\" style=\"font-size: ${iconFontSize}px; color: ${fontColor}\"\n                    >${this.inputData?.iconName}</md-icon\n                >\n            </md-filled-button>\n        `\n    }\n}\n"]}