var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,i;r<a;r++){if(i||!(r in t)){if(!i)i=Array.prototype.slice.call(t,0,r);i[r]=t[r]}}return e.concat(i||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-b7735e0d.js";var dvnTagCloudCss="dvn-tag-cloud dvn-button{margin-right:4px}";function toggleOption(e,t){if(e===void 0){e=[]}if(e.indexOf(t)>-1){return e.filter((function(e){return e!==t}))}else{return __spreadArray(__spreadArray([],e,true),[t],false)}}var DvnTagCloud=function(){function e(e){registerInstance(this,e);this.change=createEvent(this,"change",7);this.editable=false;this.value=[];this.options=[]}e.prototype.render=function(){var e=this;var t=this,n=t.disabled,r=t.editable,a=t.options,i=t.value;if(r){return h(Host,null,a.map((function(t){return h("dvn-button",{disabled:n,leaned:true,scale:"small",shape:"rounded",tint:i.includes(t.value)?"primary":"neutral",view:i.includes(t.value)?"solid":"outline",onClick:function(n){n.preventDefault();n.stopPropagation();e.change.emit(toggleOption(e.value,t.value))}},t.label)})))}return h(Host,null,i.map((function(e){var t;return h("dvn-button",{leaned:true,scale:"small",shape:"rounded",view:"outline",tagMode:true},((t=a.find((function(t){return t.value===e})))===null||t===void 0?void 0:t.label)||e)})))};return e}();DvnTagCloud.style=dvnTagCloudCss;export{DvnTagCloud as dvn_tag_cloud};