import{r as e,h as t}from"./p-fdd3ce28.js";import{E as i}from"./p-93061dfe.js";const s=class{constructor(t){e(this,t),this.label={name:"Input",labelQuestion:"Formulate your question",labelRequired:"Required",labelMultiline:"Multiline",labelMin:"Min",labelMax:"Max",labelHasAnswer:"Answer",labelAnswer:"",placeholderAnswer:"Formulate the correct answer"},this.onAnswer=e=>{e||this.handler.set("hasAnswer",!1)},this.onHasAnswer=e=>{e||this.handler.set("answer","",{localize:!0})},this.onMultiline=()=>{this.handler.set("hasAnswer",!1),this.handler.set("answer","",{localize:!0})}}prop(e,t={}){return this.handler.prop(e,Object.assign(Object.assign({},t),{label:this.label}))}render(){const{hasAnswer:e,multiline:s}=this.value;return t(i,{question:this.prop("question",{localize:!0}),required:this.prop("required")},t("bce-switch",Object.assign({},this.prop("multiline",{on:this.onMultiline}))),t("bce-input",Object.assign({},this.prop("min"),{type:"number"})),t("bce-input",Object.assign({},this.prop("max"),{type:"number"})),t("bce-switch",Object.assign({},this.prop("hasAnswer",{on:this.onHasAnswer}))),e&&t("bce-input",Object.assign({},this.prop("answer",{on:this.onAnswer,localize:!0}),{type:s?"textarea":"text",validation:"required"})),t("slot",null))}};export{s as bce_element_input_editor};