import{d as e,p as t,s as n}from"./hooks.module-5xe-uC6c.js";import{E as r,Q as i,j as a}from"./content_renderer-CoENEE63.js";import{t as o}from"./jsxRuntime.module--xb8gfv5.js";import{B as s,J as c,Z as l}from"./hooks-CSTgmcXO.js";import{t as u}from"./ActionButton-CbWZL7Kr.js";var d=`
<div class="card widget">
    <div class="card-header">
        <div class="card-header-title"></div>
        <div class="card-header-buttons"></div>
    </div>

    <div id="[to be set]" class="body-wrapper">
        <div class="card-body"></div>
    </div>
</div>`,f=class extends l{$bodyWrapper;$body;$title;$buttons;get widgetTitle(){return`Untitled widget`}get widgetButtons(){return[]}get help(){return{}}constructor(){super(),this.child(...this.widgetButtons)}doRender(){this.$widget=$(d),this.contentSized(),this.$widget.find(`[data-target]`).attr(`data-target`,`#${this.componentId}`),this.$bodyWrapper=this.$widget.find(`.body-wrapper`),this.$bodyWrapper.attr(`id`,this.componentId),this.$body=this.$bodyWrapper.find(`.card-body`),this.$title=this.$widget.find(`.card-header .card-header-title`),this.$title.text(this.widgetTitle),this.$buttons=this.$widget.find(`.card-header .card-header-buttons`),this.$buttons.empty();for(let e of this.children)this.$buttons.append(e.render());let e=this.doRenderBody();typeof e==`object`&&`catch`in e?this.initialized=e.catch(e=>{this.logRenderingError(e)}):this.initialized=Promise.resolve()}doRenderBody(){}};e();function p({id:e,title:l,buttons:d,children:f,containerRef:p,contextMenuItems:m,grow:h}){let[g,_]=c(`rightPaneCollapsedItems`),[v,y]=n(!g.includes(e)),b=s(p,null),x=t(a);return x&&(x.initialized=Promise.resolve()),o(`div`,{ref:b,id:e,class:r(`card widget`,{collapsed:!v,grow:h}),children:[o(`div`,{class:`card-header`,onClick:()=>{let t=!v;y(t);let n=new Set(g);t?n.delete(e):n.add(e),_(Array.from(n))},children:[o(u,{icon:`bx bx-chevron-down`,text:``}),o(`div`,{class:`card-header-title`,children:l}),o(`div`,{class:`card-header-buttons`,onClick:e=>e.stopPropagation(),children:[d,m&&o(u,{icon:`bx bx-dots-vertical-rounded`,text:``,onClick:e=>{e.stopPropagation(),i.show({x:e.pageX,y:e.pageY,items:m,selectMenuItemHandler:()=>{}})}})]})]}),o(`div`,{id:x?.componentId,class:`body-wrapper`,children:v&&o(`div`,{class:`card-body`,children:f})})]})}export{f as n,p as t};