'use strict';

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

const core = require('./core-906e2cc9.js');

const SmoothlyAddress = class {
    constructor(hostRef) {
        core.registerInstance(this, hostRef);
        this.type = "primary";
        this.mode = "display";
        this.change = core.createEvent(this, "change", 7);
    }
    onChange(event) {
        event.stopPropagation();
        this.value = event.detail;
        this.mode = "display";
        this.change.emit(Object.assign({ type: this.type }, this.value));
    }
    render() {
        return this.mode == "edit" ?
            [
                core.h("label", null, this.type),
                core.h("smoothly-address-edit", { onChange: (e) => this.onChange(e), value: this.value }),
            ] :
            [
                core.h("label", null, this.type),
                this.editable ? core.h("smoothly-submit", { color: "primary", fill: "clear", prevent: true, onSubmit: () => this.mode = "edit" }, "Edit") : [],
                core.h("smoothly-address-display", { value: this.value }),
            ];
    }
    static get style() { return ".sc-smoothly-address-h{display:block;position:relative}[hidden].sc-smoothly-address-h{display:none}smoothly-submit.sc-smoothly-address{float:right}label.sc-smoothly-address{display:block;-webkit-margin-before:.6em;margin-block-start:.6em;-webkit-margin-after:.2em;margin-block-end:.2em}"; }
};

exports.smoothly_address = SmoothlyAddress;
