import { a3 as t, f5 as c, am as z, cS as H, ad as I, H as i, fa as u, fc as k, eh as R, fk as W, h3 as O, aC as F, aD as G, aE as p, fj as h } from "./56c67d3b.js";
import { useContext as T } from "react";
import "react-dom";
const A = (o) => F`
    border-radius: ${o.radius ? o.radius : "4px"};
    border: ${o.borderWidth ? o.borderWidth : "0px"} ${o.borderStyle ? o.borderStyle : "solid"} ${o.border};
    color: ${o.text};
    font-size: ${o.textSize} !important;
    font-weight: ${o.textWeight} !important;
    font-family: ${o.fontFamily} !important;
    font-style:${o.fontStyle} !important;
    text-transform:${o.textTransform} !important;
    text-decoration:${o.textDecoration} !important;
    ${c(o)}

    .markdown-body a {
      color: ${o.links};
    }
    .markdown-body {
      margin: ${o.margin} !important;	
      padding: ${o.padding};	
      width: ${G(o.margin)};	
      // height: ${p(o.margin)};
      h1 {
        line-height: 1.5;
      }
      h5 {
        line-height: 2.2;
      }
    }

    .markdown-body {
      &,
      p,
      div,
      h1,
      h2,
      h3,
      h4,
      h5,
      h6 {
        color: ${o.text};
      }
      img,
      pre {
        background-color: ${o.background};
        code {
          color: #000000;
        }
      }
      background-color: transparent;
    }
  `, j = t.div`
${(o) => o.$animationStyle && o.$animationStyle}
  display: flex;
  flex-flow: column;
  height: 100%;
  overflow-y: scroll;
  border: ${(o) => o.$style.borderWidth} ${(o) => o.$style.borderStyle ? o.$style.borderStyle : "solid"} ${(o) => o.$style.border};
  border-radius: ${(o) => o.$style.radius};
  padding: ${(o) => o.$style.padding};
  margin: ${(o) => o.$style.margin};
  ${(o) => c(o.$style)}
`, D = t.div`
  ${(o) => o.$style && A(o.$style)}
  text-align: ${(o) => o.$horizontalAlignment};
  padding: ${(o) => o.$style.padding};
  margin: ${(o) => o.$style.margin};
`, E = t(h)`
  overflow: visible;
  border-radius: 0;
  ${(o) => c({
  background: o.$backgroundColor,
  backgroundImage: o.$headerBackgroundImage,
  backgroundImageSize: o.$headerBackgroundImageSize,
  backgroundImageRepeat: o.$headerBackgroundImageRepeat,
  backgroundImageOrigin: o.$headerBackgroundImageOrigin,
  backgroundImagePosition: o.$headerBackgroundImagePosition
})}
`, M = t(h)`
  border-top: ${(o) => `${o.$showBorder ? o.$borderWidth : 0} solid ${o.$borderColor}`};
  flex: 1;
  border-radius: 0;
  ${(o) => c({
  background: o.$backgroundColor,
  backgroundImage: o.$bodyBackgroundImage,
  backgroundImageSize: o.$bodyBackgroundImageSize,
  backgroundImageRepeat: o.$bodyBackgroundImageRepeat,
  backgroundImageOrigin: o.$bodyBackgroundImageOrigin,
  backgroundImagePosition: o.$bodyBackgroundImagePosition
})}
`, N = t(h)`
  border-top: ${(o) => `${o.$showBorder ? o.$borderWidth : 0} solid ${o.$borderColor}`};
  overflow: visible;
  ${(o) => o.$backgroundColor && `background-color: ${o.$backgroundColor};`}
  border-radius: 0;
  ${(o) => c({
  background: o.$backgroundColor,
  backgroundImage: o.$footerBackgroundImage,
  backgroundImageSize: o.$footerBackgroundImageSize,
  backgroundImageRepeat: o.$footerBackgroundImageRepeat,
  backgroundImageOrigin: o.$footerBackgroundImageOrigin,
  backgroundImagePosition: o.$footerBackgroundImagePosition
})}
`;
function L(o) {
  const {
    container: n,
    text: b,
    animationStyle: s
  } = o, {
    showHeader: g,
    showFooter: m,
    horizontalGridCells: $
  } = n, l = n.showBody || !g && !m, {
    items: B,
    ...f
  } = n.header, {
    items: w,
    ...x
  } = n.body[0].children.view.getView(), {
    items: P,
    ...C
  } = n.footer, v = T(z).getAppSettings().maxWidth;
  H(v);
  const {
    style: d,
    headerStyle: a,
    bodyStyle: e,
    footerStyle: r
  } = n;
  return /* @__PURE__ */ I(j, {
    $style: d,
    $animationStyle: s,
    children: [g && /* @__PURE__ */ i(u.Provider, {
      value: n.style.background,
      children: /* @__PURE__ */ i(E, {
        ...f,
        horizontalGridCells: $,
        items: k(B),
        autoHeight: !0,
        emptyRows: 5,
        minHeight: "46px",
        containerPadding: [0, 0],
        showName: {
          bottom: m ? 20 : 0
        },
        $backgroundColor: (a == null ? void 0 : a.headerBackground) || "transparent",
        $headerBackgroundImage: a == null ? void 0 : a.headerBackgroundImage,
        $headerBackgroundImageRepeat: a == null ? void 0 : a.headerBackgroundImageRepeat,
        $headerBackgroundImageSize: a == null ? void 0 : a.headerBackgroundImageSize,
        $headerBackgroundImagePosition: a == null ? void 0 : a.headerBackgroundImagePosition,
        $headerBackgroundImageOrigin: a == null ? void 0 : a.headerBackgroundImageOrigin,
        style: {
          padding: a.containerHeaderPadding
        }
      })
    }), l && /* @__PURE__ */ i(u.Provider, {
      value: n.style.background,
      children: /* @__PURE__ */ i(R, {
        style: {
          height: n.autoHeight ? "auto" : "100%",
          margin: "0px",
          padding: "0px"
        },
        hideScrollbar: !n.showVerticalScrollbar,
        children: /* @__PURE__ */ I("div", {
          style: {
            background: `${n.style.background}`
          },
          children: [/* @__PURE__ */ i(M, {
            $showBorder: !1,
            ...x,
            horizontalGridCells: $,
            items: k(w),
            autoHeight: n.autoHeight,
            emptyRows: 14,
            minHeight: g ? "143px" : "142px",
            containerPadding: [0, 0],
            hintPlaceholder: o.hintPlaceholder ?? W,
            $backgroundColor: (e == null ? void 0 : e.background) || "transparent",
            $bodyBackgroundImage: e == null ? void 0 : e.backgroundImage,
            $bodyBackgroundImageRepeat: e == null ? void 0 : e.backgroundImageRepeat,
            $bodyBackgroundImageSize: e == null ? void 0 : e.backgroundImageSize,
            $bodyBackgroundImagePosition: e == null ? void 0 : e.backgroundImagePosition,
            $bodyBackgroundImageOrigin: e == null ? void 0 : e.backgroundImageOrigin,
            $borderColor: d == null ? void 0 : d.border,
            $borderWidth: d == null ? void 0 : d.borderWidth,
            style: {
              float: `${o.float}`,
              width: `${o.float === "none" ? "100%" : `${o.width}%`}`,
              height: "100%",
              ...n.bodyStyle
            }
          }), /* @__PURE__ */ i(D, {
            $style: o.style,
            $horizontalAlignment: o.horizontalAlignment,
            children: /* @__PURE__ */ i("p", {
              children: o.type === "markdown" ? /* @__PURE__ */ i(O, {
                children: b.value
              }) : b.value
            })
          })]
        })
      })
    }), m && /* @__PURE__ */ i(u.Provider, {
      value: n.style.background,
      children: /* @__PURE__ */ i(N, {
        $showBorder: g,
        ...C,
        horizontalGridCells: $,
        items: k(P),
        autoHeight: !0,
        emptyRows: 5,
        minHeight: "48px",
        containerPadding: [0, 0],
        showName: {
          top: g ? 20 : 0
        },
        $backgroundColor: (r == null ? void 0 : r.footerBackground) || "transparent",
        $footerBackgroundImage: r == null ? void 0 : r.footerBackgroundImage,
        $footerBackgroundImageRepeat: r == null ? void 0 : r.footerBackgroundImageRepeat,
        $footerBackgroundImageSize: r == null ? void 0 : r.footerBackgroundImageSize,
        $footerBackgroundImagePosition: r == null ? void 0 : r.footerBackgroundImagePosition,
        $footerBackgroundImageOrigin: r == null ? void 0 : r.footerBackgroundImageOrigin,
        $borderColor: d == null ? void 0 : d.border,
        $borderWidth: d == null ? void 0 : d.borderWidth,
        style: {
          padding: r.containerFooterPadding
        }
      })
    })]
  });
}
export {
  L as TriContainer
};
