var __spreadArrays=this&&this.__spreadArrays||function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var u=arguments[e],a=0,o=u.length;a<o;a++,i++)n[i]=u[a];return n};System.register(["./p-0bfb8721.system.js"],(function(t){"use strict";var e,r;return{setters:[function(t){e=t.r;r=t.h}],execute:function(){var n=t("bce_element_form_editor",function(){function t(t){var r=this;e(this,t);this.hack=0;this.addInput=function(t){var e={id:window.BCE.generateId(),label:"",required:false,type:"text"};var n=__spreadArrays(t,[e]);r.handler.set("input",n,{emit:true,localize:true});setTimeout((function(){return r.hack++}),60)};this.editInput=function(t,e,n,i){var u;var a=r.input.findIndex((function(e){return e.id===t}));var o=__spreadArrays(r.input);var c=Object.assign(Object.assign({},r.input[a]),(u={},u[n]=i,u));o.splice(a,1,c);r.handler.set("input",o,{emit:true,localize:true});e.stopPropagation()};this.removeInput=function(t,e){var n=t.filter((function(t){return t.id!==e}));r.handler.set("input",n,{emit:true,localize:true});setTimeout((function(){return r.hack++}),60)}}Object.defineProperty(t.prototype,"input",{get:function(){return this.handler.get("input",{localize:true})},enumerable:true,configurable:true});t.prototype.prop=function(t,e){if(e===void 0){e={}}return this.handler.prop(t,Object.assign({},e))};t.prototype.renderInputCreator=function(t,e){var n=this;var i=this.editInput.bind(this,e.id);return r("div",{class:"input-creator",id:e.id,key:e.id},r("bce-select",{placeholder:"Type",type:"dropdown",value:e.type,onInput:function(t){return i(t,"type",t.target.value)}},r("bce-option",{value:"date"},"Date"),r("bce-option",{value:"text"},"Text")),r("bce-input",{placeholder:"Label",value:e.label,onInput:function(t){return i(t,"label",t.target.value||"")}}),r("label",null,this.t("me-required")),r("bce-switch",{value:e.required,onInput:function(t){return i(t,"required",t.target.value)}}),r("bce-button",{design:"text",icon:"fas:trash",onClick:function(){return n.removeInput(t,e.id)}}))};t.prototype.render=function(){var t=this;var e=this.prop("input",{default:function(){return[]},localize:true});var n=e.value;return[n.map((function(e){return t.renderInputCreator(n,e)})),r("bce-button",{design:"text",icon:"fas:plus",onClick:function(){return t.addInput(n)},"data-i":this.hack},this.t("add-item",{item:"Input"})),r("slot",null)]};Object.defineProperty(t,"style",{get:function(){return":host{position:relative;display:block}:host .input-creator{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin:20px 0}:host .input-creator bce-input,:host .input-creator bce-select{margin:0}:host .input-creator bce-input{-ms-flex:1 1 auto;flex:1 1 auto}:host .input-creator label{margin:0 16px}:host .input-creator bce-switch{-ms-flex:0 0 auto;flex:0 0 auto;margin:0 16px 0 0}"},enumerable:true,configurable:true});return t}())}}}));