import { b9 as y, w as x, a0 as s, ba as p, bv as C, bw as B, bd as M, bc as V, U as k, V as o, bx as v, P as a, bh as u, bi as l, bj as d, bg as r, bk as D, bl as E, bn as P, bo as I, bp as R, by as W, bz as j } from "./684d2f28.js";
import w, { useContext as b } from "react";
import { getButtonStyle as h, ButtonStyleControl as z, ButtonCompWrapper as F, Button100 as N } from "./926d8ea1.js";
import "react-dom";
import "./d6402597.js";
const T = y(W)`
  width: 100%;
  
  .ant-btn-group {
    width: 100%;
   
  }
`, U = y.div`
  width: calc(100%);
  ${(t) => `margin: ${t.$buttonStyle.margin};`}
  margin-right: 0;
  .ant-btn span {
    ${(t) => `text-decoration: ${t.$buttonStyle.textDecoration};`}
    ${(t) => `font-family: ${t.$buttonStyle.fontFamily};`}
  }
  
  .ant-btn {
    ${(t) => h(t.$buttonStyle)}
    margin: 0 !important;
    height: 100%;
    &.ant-btn-default {
      margin: 0 !important;
      ${(t) => `border-radius: ${t.$buttonStyle.radius} 0 0 ${t.$buttonStyle.radius};`}
      ${(t) => `text-transform: ${t.$buttonStyle.textTransform};`}
      ${(t) => `font-weight: ${t.$buttonStyle.textWeight};`}
    }
    ${(t) => `background-color: ${t.$buttonStyle.background};`}
    ${(t) => `color: ${t.$buttonStyle.text};`}
    ${(t) => `padding: ${t.$buttonStyle.padding};`}
    ${(t) => `font-size: ${t.$buttonStyle.textSize};`}
    ${(t) => `font-style: ${t.$buttonStyle.fontStyle};`}

    width: 100%;
  }
  
`, _ = y.div`
  // width: 32px;
  ${(t) => `margin: ${t.$buttonStyle.margin};`}
  margin-left: -1px;
  .ant-btn {
    ${(t) => h(t.$buttonStyle)}
    margin: 0 !important;
    height: 100%;
    &.ant-btn-default {
      margin: 0 !important;
      ${(t) => `border-radius: 0 ${t.$buttonStyle.radius} ${t.$buttonStyle.radius} 0;`}
    }
    width: 100%;
  }
`, H = function() {
  const t = {
    text: x(p, s("menu")),
    onlyMenu: C,
    options: B,
    disabled: M,
    onEvent: V,
    style: z
  };
  return new k(t, (e) => {
    var c;
    const S = e.options.findIndex((n) => {
      var i;
      return (i = n.prefixIcon) == null ? void 0 : i.props.value;
    }) > -1, $ = e.options.filter((n) => !n.hidden).map((n, i) => ({
      title: n.label,
      label: n.label,
      style: {
        padding: e.style.padding
      },
      key: n.label + " - " + i,
      disabled: n.disabled,
      icon: S && /* @__PURE__ */ o("span", {
        children: n.prefixIcon
      }),
      index: i
    })), m = /* @__PURE__ */ o(j, {
      items: $,
      onClick: ({
        key: n
      }) => {
        var g;
        const i = $.find((f) => f.key === n);
        i && ((g = e.options[i.index]) == null || g.onEvent("click"));
      }
    });
    return /* @__PURE__ */ o(F, {
      disabled: e.disabled,
      children: e.onlyMenu ? /* @__PURE__ */ o(v, {
        disabled: e.disabled,
        dropdownRender: () => m,
        children: /* @__PURE__ */ o(N, {
          $buttonStyle: e.style,
          disabled: e.disabled,
          children: e.text || " "
          /* Avoid button disappearing */
        })
      }) : /* @__PURE__ */ o(T, {
        disabled: e.disabled,
        dropdownRender: () => m,
        onClick: () => e.onEvent("click"),
        buttonsRender: ([n, i]) => [/* @__PURE__ */ o(U, {
          $buttonStyle: e.style,
          children: w.cloneElement(n, {
            disabled: e.disabled
          })
        }), /* @__PURE__ */ o(_, {
          $buttonStyle: e.style,
          children: w.cloneElement(i, {
            disabled: e.disabled
          })
        })],
        children: !e.text || ((c = e.text) == null ? void 0 : c.length) === 0 ? " " : e.text
      })
    });
  }).setPropertyViewFn((e) => /* @__PURE__ */ a(u, {
    children: [/* @__PURE__ */ o(l, {
      name: d.basic,
      children: e.options.propertyView({})
    }), (b(r).editorModeStatus === "logic" || b(r).editorModeStatus === "both") && /* @__PURE__ */ o(u, {
      children: /* @__PURE__ */ a(l, {
        name: d.interaction,
        children: [!e.onlyMenu.getView() && e.onEvent.getPropertyView(), D(e), E(e)]
      })
    }), (b(r).editorModeStatus === "layout" || b(r).editorModeStatus === "both") && /* @__PURE__ */ a(u, {
      children: [/* @__PURE__ */ a(l, {
        name: d.layout,
        children: [e.text.propertyView({
          label: s("label")
        }), e.onlyMenu.propertyView({
          label: s("dropdown.onlyMenu")
        })]
      }), /* @__PURE__ */ o(l, {
        name: d.style,
        children: e.style.getPropertyView()
      })]
    })]
  })).build();
}(), J = P(H, [new I("text", s("dropdown.textDesc")), ...R]);
export {
  J as DropdownComp
};
