import { BottomContent as t } from "./BottomContent-ec64e353.js";
import { iF as e, cr as o, iG as r, iH as s, fe as i, iI as a, iJ as n } from "./index-6d97e67f.js";
import { d as m } from "./styled-components-b776227d.js";
import { useContext as p, useRef as d, useState as l, useMemo as c } from "react";
import { D as j } from "./react-draggable-1ced44e5.js";
import { u as h, H as u } from "./index-4bbbae28.js";
import { lA as x, lR as f, lS as b } from "./ant-design-icons-a81e6d18.js";
import { H as g } from "./antd-eb0b81b8.js";
import "./react-router-38313ddc.js";
import "./DraggableTree-52c9f7ce.js";
import "./dnd-kit-e0a0bf75.js";
import "react-dom";
import "./lodash-226cb5b1.js";
import "./alasql-f59e855e.js";
import "./BottomMetaDrawer-0d8ad1f3.js";
import "./axios-0ffd51b8.js";
import "./redux-devtools-36ca30b8.js";
import "./fontawesome-7bcd29b1.js";
import "./moment-d731d247.js";
import "./crypto-js-8020edb5.js";
import "./dayjs-63343308.js";
import "./numbro-48e81844.js";
import "./papaparse-088c0adc.js";
import "./uuid-82f303b2.js";
import "./supabase-6aa220db.js";
import "./websockets-80729b50.js";
import "./fetch-03ca8116.js";
import "./remark-gfm-72b87c7d.js";
import "./buffer-f89d742d.js";
import "./rehype-raw-49057806.js";
import "./parse5-31d0cb5d.js";
import "./rehype-sanitize-38a120e4.js";
import "./simplebar-react-a37a9b2a.js";
import "./react-best-gradient-color-picker-2e7ff36d.js";
import "./ua-parser-js-1d18a3f8.js";
import "./clsx-b06d39d3.js";
import "./loglevel-5e7e37fc.js";
import "./codemirror-8fe65581.js";
import "./really-relaxed-json-e5391d6a.js";
import "./immer-c0428a8d.js";
import "./redux-saga-3b3a9c7b.js";
import "./hotkeys-js-216206c9.js";
import "./cnchar-8c3eaa86.js";
import "./react-documents-a03b99c9.js";
import "./sql-formatter-69e8df59.js";
import "./rc-trigger-7d152aa4.js";
import "./react-json-view-364658b4.js";
import "./qrcode-react-417e3716.js";
import "./katex-05fb1c31.js";
import "./ecogis-maps-10e82de5.js";
import "./devextreme-be18bda8.js";
import "./exceljs-1678d36b.js";
import "./file-saver-es-c18fae8f.js";
const w = m.div`
  right: calc(313px + 4px); // FIXME: don't rely on the width of the right panel
  bottom: ${(t2) => t2.$bottom ? t2.$bottom + 4 + "px" : "289px"};
  position: fixed;
  z-index: ${e.queryResultPanel};

  display: flex;
  flex-direction: column;
  width: 592px;
  height: fit-content;
  max-height: 250px;
  background: #ffffff;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  pointer-events: auto;
  padding-bottom: 16px;
`, v = (t2) => {
  const { bottom: e2 } = t2, r2 = p(o), s2 = r2.showResultComp(), i2 = s2 == null ? void 0 : s2.result(), a2 = d(null), [n2, m2] = l(true), [c2, b2] = l({ left: 0, top: 0, bottom: 0, right: 0 }), { header: g2, body: v2 } = h({ ...i2 ?? { data: "", dataType: "default", success: true }, onClose: () => r2.setShowResultCompName(void 0) });
  return i2 ? x(j, { nodeRef: a2, disabled: n2, bounds: c2, enableUserSelectHack: false, onStart: (t3, e3) => {
    var _a;
    const { clientWidth: o2, clientHeight: r3 } = window.document.documentElement, s3 = (_a = a2.current) == null ? void 0 : _a.getBoundingClientRect();
    s3 && b2({ left: -s3.left + e3.x, right: o2 - (s3.right - e3.x), top: -s3.top + e3.y, bottom: r3 - (s3.bottom - e3.y) });
  }, children: f(w, { $bottom: e2, ref: a2, children: [x(u, { onMouseOver: () => m2(false), onMouseOut: () => m2(true), children: g2 }), v2] }) }) : null;
}, y = m(n)`
  position: relative;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  border-top: 1px solid #e1e3eb;
  // remove z-index

  .react-resizable-handle {
    position: absolute;
    border-top: transparent solid 3px;
    width: 100%;
    padding: 0 3px 3px 0;
    top: 0;
    cursor: row-resize;
  }
`;
m(g)`
  width: 40px;
  padding: 6px 0;

  .ant-menu-item {
    height: 30px;
    line-height: 30px;
  }
`, m.div`
  flex: 0 0 35px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e1e3eb;
  background: #fafafa;
`, m.h3`
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: #222222;
`;
const z = (t2) => {
  t2.preventDefault();
}, k = () => {
  window.addEventListener("mousedown", z);
};
const R = r((t2) => ({ orgId: i(t2).currentOrgId, datasourceInfos: t2.entities.datasource.data }), null)(function(e2) {
  const o2 = c(() => s(), []), r2 = document.documentElement.clientHeight, [i2, n2] = l(o2.bottom.h);
  return l("data"), f(b, { children: [x(v, { bottom: i2 }), x(y, { width: 1 / 0, height: o2.bottom.h, resizeHandles: ["n"], minConstraints: [680, 285], maxConstraints: [1 / 0, r2 - 48 - 40], onResizeStart: k, onResizeStop: (t2, e3) => {
    a({ ...o2, bottom: { h: e3.size.height } }), n2(e3.size.height), window.removeEventListener("mousedown", z);
  }, children: x(t, {}) })] });
});
export {
  R as default
};
