import{r as e,c as t,h as r}from"./p-BIwHMk6j.js";import{b as i}from"./p-D5qhls4G.js";import{L as o}from"./p-C_tMNOSt.js";const s=class{constructor(r){e(this,r),this.negate=t(this,"negate"),this.updateArgs=t(this,"updateArgs"),this.deleteChip=t(this,"deleteChip"),this.isNegated=!1,this.readonly=!1,this.disabled=!1,this.isMutable=!0,this.handleNegateChange=e=>{e.stopPropagation(),this.negate.emit(e.detail)},this.handleArgsChange=e=>{e.stopPropagation(),this.updateArgs.emit(e.detail)},this.handleDelete=()=>{this.deleteChip.emit()}}render(){return r("div",{key:"6aae573b524737ee3d2a4b2d3df68ec9bf1f1a0f",class:"popover"},this.renderHeader(),this.renderBody())}renderHeader(){var e,t,i,o;const s=(null===(e=this.metadata)||void 0===e?void 0:e.title)?this.translator.get(this.metadata.title):null!==(i=null===(t=this.refNode)||void 0===t?void 0:t.id)&&void 0!==i?i:"";return r("limel-header",{class:"popover__header is-narrow",heading:s,icon:null===(o=this.metadata)||void 0===o?void 0:o.icon},this.renderHeaderActions())}renderHeaderActions(){return this.isMutable?r("div",{slot:"actions",class:"popover__header-actions"},r("limel-switch",{class:"popover__negate-switch",label:this.translator.get("webclient.rule-editor.negate"),value:this.isNegated,onChange:this.handleNegateChange}),r("limel-icon-button",{class:"popover__delete-button",icon:"trash",label:this.translator.get("webclient.rule-editor.delete"),onClick:this.handleDelete})):null}get translator(){return this.platform.get(i.Translate)}renderBody(){var e,t;const i=null===(e=this.metadata)||void 0===e?void 0:e.configComponent;return i?r("div",{class:"popover__body"},r(o,{platform:this.platform,context:this.context,name:i.name,props:Object.assign(Object.assign({},i.props),{value:null===(t=this.refNode)||void 0===t?void 0:t.args,readonly:this.readonly,disabled:this.disabled,onChange:this.handleArgsChange})})):null}};s.style=":host{display:block}.popover{display:flex;flex-direction:column;min-width:24rem;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-700));border-radius:0.5rem;box-shadow:0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);overflow:hidden}.popover__header{--header-background-color:rgba(var(--contrast-300));padding-right:0.5rem;gap:1rem}.popover__header-actions{display:grid;grid-auto-flow:column;grid-gap:0.75rem;padding:0.25rem;align-items:center}.popover__delete-button{color:rgb(var(--contrast-1100))}.popover__body{padding:1rem}";export{s as limebb_rule_chip_popover}