var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") 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;
};
import { PartInlineDisplay } from '../../inline-display.js';
import { html, render } from 'lit-html/lit-html.js';
import { memoize } from '../../../util/decorators.js';
function getTemplate(units, callback) {
    return html `
        <style>
            select {
                color: #8F9195;
                background: transparent;
                font-family: var(--font-body);
                border-radius: 3px;
                margin-right: 8px;
            }
            option {
                color: black;
            }
        </style>
        <select @change=${() => callback()} .selectedIndex=${units === 'metric' ? 0 : 1}>
            <option value="metric">Metric</option>
            <option value="imperial">Imperial</option>
        </select>
    `;
}
export class WeatherInlineDisplay extends PartInlineDisplay {
    constructor(part) {
        super(part);
        this.domNode = document.createElement('div');
        this.part = part;
        this.domNode.style.display = 'flex';
        this.domNode.style.flexDirection = 'row';
        this.domNode.style.justifyContent = 'flex-end';
        render(getTemplate(part._units, () => this._updateUnits()), this.domNode);
    }
    getSelect() {
        return this.domNode.querySelector('select');
    }
    _updateUnits() {
        const select = this.getSelect();
        const index = select.selectedIndex;
        const option = select.options[index];
        this.part._units = option.value;
    }
    onInject() { }
    onDispose() { }
}
__decorate([
    memoize
], WeatherInlineDisplay.prototype, "getSelect", null);
//# sourceMappingURL=inline.js.map