import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as n,transformTag as l}from"@stencil/core/internal/client";import{b as o}from"./index.esm.js";const s=[{trigger:"rich-text",icon:"font_style_formatting",translationKey:"webclient.composer-toolbar.rich-text"},{trigger:"mention",icon:"email_sign_92447",translationKey:"webclient.composer-toolbar.mention",helperLabel:"@"},{trigger:"text-snippet",icon:"add_text",translationKey:"webclient.composer-toolbar.text-snippet",helperLabel:"!"},{trigger:"internal-link",icon:"hashtag_large",translationKey:"webclient.composer-toolbar.internal-link",helperLabel:"#"}],r=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.triggerInsert=i(this,"triggerInsert",7),this.filesSelected=i(this,"filesSelected",7),this.mentions=!1,this.textSnippets=!1,this.internalLinks=!1,this.richText=!1,this.handleTriggerSelected=e=>{e.stopPropagation(),this.triggerInsert.emit(e.detail.value)},this.handleFilesSelected=e=>{e.stopPropagation(),this.filesSelected.emit(e.detail)}}render(){return[n("div",{key:"34b441a01bfcca09b934ffc5aa5f6852efd359fd",class:"actions"},n("slot",{key:"7b4ebdd76e9b58a7a9aa376aeffedf146f000973",name:"leading"}),this.renderFileInput(),this.renderTriggerActions(),n("slot",{key:"0b3fdc53e1dde0963f131684e7994ffc49e737fa",name:"trailing"})),n("slot",{key:"82ca56d3d8a9e227f343f4bedaaadca5c075f02e",name:"primary-action"})]}get translator(){var e;return null===(e=this.platform)||void 0===e?void 0:e.get(o.Translate)}get triggerActions(){const e={mention:this.mentions,"text-snippet":this.textSnippets,"internal-link":this.internalLinks,"rich-text":this.richText};return s.filter((t=>e[t.trigger])).map((e=>{var t,i;return{text:null!==(i=null===(t=this.translator)||void 0===t?void 0:t.get(e.translationKey))&&void 0!==i?i:e.trigger,commandText:e.helperLabel,icon:e.icon,iconOnly:!0,value:e.trigger}}))}renderTriggerActions(){const e=this.triggerActions;if(0!==e.length)return n("limel-action-bar",{actions:e,onItemSelected:this.handleTriggerSelected})}renderFileInput(){var e,t,i,l,o,s;if(this.fileInput)return n("limel-file-input",{accept:null!==(e=this.fileInput.accept)&&void 0!==e?e:"*",multiple:null!==(t=this.fileInput.multiple)&&void 0!==t&&t,disabled:null!==(i=this.fileInput.disabled)&&void 0!==i&&i,onFilesSelected:this.handleFilesSelected},n("limel-icon-button",{icon:"attach",disabled:null!==(l=this.fileInput.disabled)&&void 0!==l&&l,label:null===(o=this.translator)||void 0===o?void 0:o.get("webclient.attach-files"),helperLabel:null===(s=this.translator)||void 0===s?void 0:s.get("webclient.attach-files-helper")}))}static get style(){return"*{box-sizing:border-box;min-width:0}:host(limebb-composer-toolbar){box-sizing:border-box;display:flex;align-items:center;width:100%;max-width:100%;gap:0.5rem}.actions{display:flex;align-items:center;flex-wrap:nowrap;flex-grow:1}limel-icon-button,::slotted(limel-icon-button){display:inline-block;scale:0.86}limel-file-input{flex-shrink:0}"}},[257,"limebb-composer-toolbar",{platform:[16],mentions:[516],textSnippets:[516,"text-snippets"],internalLinks:[516,"internal-links"],richText:[516,"rich-text"],fileInput:[16]}]),a=r,c=function(){"undefined"!=typeof customElements&&["limebb-composer-toolbar"].forEach((e=>{"limebb-composer-toolbar"===e&&(customElements.get(l(e))||customElements.define(l(e),r))}))};export{a as LimebbComposerToolbar,c as defineCustomElement}