import{LitElement as t,html as o,css as i}from"lit";import{dispatchCustomEvent as n}from"./lib/events.js";import{linkStyles as e}from"./templates/cc-link/cc-link.js";import{i18n as s}from"./translation.js";import"./cc-addon-option.js";import"./cc-block.js";import"./cc-button.js";class c extends t{static get properties(){return{options:{type:Array},title:{type:String}}}constructor(){super(),this.options=null,this.title=null,this._optionsStates={}}_onSubmit(){this.options.forEach((t=>{null==this._optionsStates[t.name]&&(this._optionsStates[t.name]=t.enabled||!1)})),n(this,"submit",this._optionsStates)}_onOptionToggle(t){return o=>{this._optionsStates[t]=o.detail}}render(){return o`<cc-block><div slot=title>${this.title}</div><slot name=description></slot>${this.options.map((t=>{const i=t.enabled||!1;return o`<cc-addon-option title=${t.title} .icon=${t.icon} logo=${t.logo} ?enabled=${i} @cc-addon-option:input=${this._onOptionToggle(t.name)}>${t.description}</cc-addon-option>`}))}<div class=button-bar><cc-button primary @cc-button:click=${this._onSubmit}>${s("cc-addon-option-form.confirm")}</cc-button></div></cc-block>`}static get styles(){return[e,i`:host{display:block}.button-bar{display:grid;justify-content:flex-end}[name=description]{line-height:1.5}.option-warning{display:grid;gap:.5em;grid-template-columns:min-content 1fr;text-align:left}.option-warning p{margin:0}.icon-warning{align-self:center;color:var(--cc-color-text-warning);--cc-icon-size:1.25em}`]}}window.customElements.define("cc-addon-option-form",c);export{c as CcAddonOptionForm};
//# sourceMappingURL=cc-addon-option-form.js.map
