import { useState as e, useEffect as t, useContext as r } from "react";
import { d as o, l as i } from "./styled-components-b776227d.js";
import { jh as n, ji as a, jj as l, dW as s, fi as c, av as d, d$ as p, fU as m, cr as h, f$ as u, g0 as f, fp as y, cu as g, gF as v, ga as x, jk as b, jl as w, fv as j, gG as S, e3 as k, jm as C, jn as q, fg as T, fe as $, jo as F, e8 as I, jp as A, jq as N, jr as R, js as z, jt as D, ju as B, dw as E, jv as P, gj as L, jw as O, jx as Q, jy as U, iM as H, g6 as V, iN as _, jz as W, jA as G, jB as M, eA as X } from "./index-6d97e67f.js";
import { lR as J, lA as K, lS as Z } from "./ant-design-icons-a81e6d18.js";
import { D as Y } from "./DraggableTree-52c9f7ce.js";
import { B as ee } from "./BottomMetaDrawer-0d8ad1f3.js";
import { _ as te, f as re } from "./lodash-226cb5b1.js";
import { K as oe, E as ie, I as ne, U as ae, V as le } from "./antd-eb0b81b8.js";
import { g as se } from "./alasql-f59e855e.js";
import "./axios-0ffd51b8.js";
import "./redux-devtools-36ca30b8.js";
import "./react-router-38313ddc.js";
import "./fontawesome-7bcd29b1.js";
import "react-dom";
import "./dnd-kit-e0a0bf75.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 "./react-draggable-1ced44e5.js";
import "./clsx-b06d39d3.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 "./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 ce = o.div`
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  background-color: #ffffff;
`, de = o.div`
  flex-shrink: 0;
  height: 40px;
  width: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
`, pe = o.span`
  font-weight: 500;
  font-size: 13px;
  color: #222222;
  line-height: 20px;
  display: inline-block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
`, me = o.div`
  display: flex;
  align-items: center;
`, he = o.div`
  height: 28px;
  padding: 0 16px;
  margin-bottom: 4px;
  .ant-input-affix-wrapper {
    height: 28px;
  }
`, ue = o(b)`
  height: 16px;
  width: 16px;
  margin-right: 16px;
  color: #9195a3;
  cursor: pointer;
  &:hover {
    color: ${n};
  }
`, fe = o(w)`
  height: 12px;
  width: 12px;
  margin-right: 2px;
`, ye = o(j)`
  &&& {
    height: 24px;
    width: 64px;
    padding: 4px 10px;
    background-color: #fafbff;
    color: #4965f2;
    border-color: #c9d1fc;
    display: flex;
    align-items: center;
    gap: 0;
    box-shadow: none;
  
    &:hover {
      color: #315efb;
      background-color: #f5faff;
      border-color: #c2d6ff;
    }
  
    &:focus {
      color: #315efb;
      background-color: #f5faff;
      border-color: #c2d6ff;
    }
  
    &:hover ${fe} g {
      stroke: #315efb;
    }
  
    &:disabled,
    &:disabled:hover {
      background: #f9fbff;
      border: 1px solid #dee9ff;
      border-radius: 4px;
  
      ${fe} g {
        stroke: #4965f230;
      }
    }
  }
`;
function ge(r2) {
  const { items: o2, refTreeComp: i2, onOpenCreatePanel: n2, onSelect: a2, onCopy: l2, onDelete: h2 } = r2, u2 = s(c), [f2, y2] = e(false), [g2, v2] = e(""), b2 = (e2) => {
    var _a;
    const t2 = (r3 = e2.children.value.getView(), o2.find((e3) => e3.id() === r3));
    var r3;
    const i3 = t2 == null ? void 0 : t2.type(), n3 = (_a = e2.children.items) == null ? void 0 : _a.getView().map((e3) => b2(e3)).filter((e3) => !!e3), a3 = { id: t2 == null ? void 0 : t2.id(), canDropBefore: (e3) => i3 === x.Folder ? (e3 == null ? void 0 : e3.type()) === x.Folder : (e3 == null ? void 0 : e3.type()) !== x.Folder, canDropAfter: (e3) => i3 === x.Folder || (e3 == null ? void 0 : e3.type()) !== x.Folder, canDropIn: (e3) => i3 === x.Folder && (!e3 || e3.type() !== x.Folder), items: n3, data: t2, addSubItem(t3) {
      const r4 = e2.children.items.pushAction({ value: t3.id() });
      e2.children.items.dispatch(r4);
    }, deleteItem(t3) {
      const r4 = e2.children.items.deleteAction(t3);
      e2.children.items.dispatch(r4);
    }, addItem(t3) {
      const r4 = e2.children.items.pushAction({ value: t3.id() });
      e2.children.items.dispatch(r4);
    }, moveItem(t3, r4) {
      const o3 = e2.children.items.arrayMoveAction(t3, r4);
      e2.children.items.dispatch(o3);
    } };
    if (!g2 || !t2 || t2.name().toLowerCase().includes(g2.toLowerCase()) || 0 !== n3.length)
      return a3;
  }, w2 = b2(i2), j2 = i2.getAllValuesInTree(), S2 = o2.filter((e2) => !j2.includes(e2.id())).map((e2) => e2.id());
  return t(() => {
    S2.length > 0 && S2.forEach((e2) => {
      const t2 = i2.children.items.pushAction({ value: e2, items: [] });
      i2.children.items.dispatch(t2);
    });
  }, [JSON.stringify(S2)]), t(() => {
    w2 == null ? void 0 : w2.items.forEach((e2, t2) => {
      Boolean(e2.id) || (w2 == null ? void 0 : w2.deleteItem(t2));
    });
  }, [w2 == null ? void 0 : w2.items]), J(ce, { style: r2.style, children: [J(de, { children: [J(pe, { children: [d("bottomPanel.title"), " (", o2.length, ")"] }), J(me, { children: [K(ue, { onClick: () => {
    y2(!f2), v2("");
  } }), J(ye, { disabled: u2, onClick: () => {
    n2();
  }, children: [K(fe, {}), d("newItem")] })] })] }), f2 && K(he, { children: K(p, { autoFocus: true, allowClear: true, value: g2, placeholder: "Search", onChange: (e2) => v2(e2.target.value), style: { marginTop: 0, height: 28 } }) }), K(m, { children: o2.length > 0 && w2 ? K("div", { style: { paddingTop: 4, paddingBottom: 100, overflow: "hidden" }, children: K(Y, { node: w2, disable: !!g2, unfoldAll: !!g2, showSubInDragOverlay: false, showDropInPositionLine: false, showPositionLineDot: true, positionLineDotDiameter: 4, positionLineHeight: 1, itemHeight: 25, positionLineIndent: (e2, t2) => {
    const r3 = 2 + 30 * (e2.length - 1);
    return t2 ? r3 + 12 : r3;
  }, renderItemContent: (e2) => {
    const { node: t2, onToggleFold: r3, onDelete: o3, ...i3 } = e2, n3 = t2.data;
    if (!n3)
      return null;
    const s2 = n3.id(), c2 = n3.type();
    return K(je, { id: s2, node: t2, resComp: n3, onToggleFold: r3, onCopy: () => l2(c2, s2), onSelect: () => a2(c2, s2), onDelete: () => {
      h2(c2, s2) && o3();
    }, ...i3 }, s2);
  } }) }) : !u2 && K(ke, { newColumn: n2 }) })] });
}
const ve = o.div`
  max-width: 100%;
  flex: 1;
  display: flex;
  padding-left: ${(e2) => 10 * e2.$level + (e2.$foldable ? 0 : 14)}px;
  border-radius: 4px;
  border: 1px solid ${(e2) => e2.$active ? a : "transparent"};
  align-items: center;
  justify-content: center;
`, xe = o.div`
  width: 100%;
  height: 25px;
  display: flex;
  user-select: none;
  padding-left: 2px;
  padding-right: 15px;
  /* background-color: #ffffff; */
  /* margin: 2px 0; */
  background-color: ${(e2) => e2.$isOverlay ? "rgba(255, 255, 255, 0.11)" : ""};

  &&& {
    background-color: ${(e2) => e2.$color && !e2.$isOverlay ? "#f2f7fc" : null};
  }

  &:hover {
    background-color: #f2f7fc80;
    cursor: pointer;
  }

  .taco-edit-text-wrapper {
    width: 100%;
    height: 21px;
    line-height: 21px;
    color: #222222;
    margin-left: 0;
    font-size: 13px;
    padding-left: 0;

    &:hover {
      background-color: transparent;
    }
  }

  .taco-edit-text-input {
    width: 100%;
    height: 21px;
    line-height: 21px;
    color: #222222;
    margin-left: 0;
    font-size: 13px;
    background-color: #fdfdfd;
    border: 1px solid #3377ff;
    border-radius: 2px;

    &:focus {
      border-color: #3377ff;
      box-shadow: 0 0 0 2px #d6e4ff;
    }
  }
`, be = o(S)`
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
  color: ${l};

  &:hover {
    color: #315efb;
  }
`, we = o.div`
  width: 12px;
  height: 12px;
  display: flex;
  margin-right: 2px;
`;
function je(t2) {
  const { id: o2, resComp: i2, isOver: n2, isOverlay: a2, path: l2, isFolded: p2, onDelete: m2, onCopy: b2, onSelect: w2, onToggleFold: j2 } = t2, [S2, k2] = e(void 0), [C2, q2] = e(false), T2 = r(h), $2 = s(c), { selectedBottomResName: F2, selectedBottomResType: I2 } = T2, A2 = l2.length - 1, N2 = i2.type(), R2 = i2.name(), z2 = i2.icon(), D2 = N2 === I2 && o2 === F2, B2 = N2 === x.Folder;
  return K(xe, { onClick: () => {
    B2 && j2(), w2();
  }, $color: D2, $isOverlay: a2, children: J(ve, { $active: n2 && B2, $level: A2, $foldable: B2, children: [B2 && K(we, { children: K(p2 ? f : u, {}) }), z2, J("div", { style: { flexGrow: 1, marginRight: "8px", width: "calc(100% - 62px)" }, children: [K(y, { text: R2, forceClickIcon: B2, disabled: !D2 || $2 || a2, onFinish: (e2) => {
    let t3 = false, r2 = R2;
    i2.rename ? (r2 = i2.rename(e2), t3 = !!r2) : (r2 = R2, t3 = T2.rename(R2, e2)), t3 && (T2.setSelectedBottomRes(r2, N2), k2(void 0));
  }, onChange: (e2) => {
    let t3 = "";
    t3 = i2.checkName ? i2.checkName(e2) : T2.checkRename(R2, e2), k2(t3);
  }, onEditStateChange: (e2) => q2(e2) }), K(g, { editorFocus: !!S2 && C2, title: S2 ? d("error") : "", content: S2, hasError: !!S2 })] }), !$2 && !a2 && K(v, { copy: B2 ? void 0 : b2, del: m2, children: K(be, { tabIndex: -1 }) })] }) });
}
const Se = o.div`
  margin: 16px 16px 0 16px;
  width: 100%;
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px dashed #d7d9e0;
  border-radius: 4px;
  overflow: auto;
  min-width: 140px;
`, ke = (e2) => K("div", { style: { display: "flex" }, children: J(Se, { children: [K("div", { style: { color: "#b8b9bf" }, children: d("query.noQueries") }), K("span", { style: { color: "#4965f2", cursor: "pointer", margin: "0 4px" }, onClick: e2.newColumn, children: d("newItem") })] }) });
var Ce = { exports: {} };
function qe(e2) {
  return "number" == typeof e2 || (!!/^0x[0-9a-f]+$/i.test(e2) || /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e2));
}
function Te(e2, t2) {
  return "constructor" === t2 && "function" == typeof e2[t2] || "__proto__" === t2;
}
var $e = function(e2, t2) {
  t2 || (t2 = {});
  var r2 = { bools: {}, strings: {}, unknownFn: null };
  "function" == typeof t2.unknown && (r2.unknownFn = t2.unknown), "boolean" == typeof t2.boolean && t2.boolean ? r2.allBools = true : [].concat(t2.boolean).filter(Boolean).forEach(function(e3) {
    r2.bools[e3] = true;
  });
  var o2 = {};
  function i2(e3) {
    return o2[e3].some(function(e4) {
      return r2.bools[e4];
    });
  }
  Object.keys(t2.alias || {}).forEach(function(e3) {
    o2[e3] = [].concat(t2.alias[e3]), o2[e3].forEach(function(t3) {
      o2[t3] = [e3].concat(o2[e3].filter(function(e4) {
        return t3 !== e4;
      }));
    });
  }), [].concat(t2.string).filter(Boolean).forEach(function(e3) {
    r2.strings[e3] = true, o2[e3] && [].concat(o2[e3]).forEach(function(e4) {
      r2.strings[e4] = true;
    });
  });
  var n2 = t2.default || {}, a2 = { _: [] };
  function l2(e3, t3, o3) {
    for (var i3 = e3, n3 = 0; n3 < t3.length - 1; n3++) {
      var a3 = t3[n3];
      if (Te(i3, a3))
        return;
      void 0 === i3[a3] && (i3[a3] = {}), i3[a3] !== Object.prototype && i3[a3] !== Number.prototype && i3[a3] !== String.prototype || (i3[a3] = {}), i3[a3] === Array.prototype && (i3[a3] = []), i3 = i3[a3];
    }
    var l3 = t3[t3.length - 1];
    Te(i3, l3) || (i3 !== Object.prototype && i3 !== Number.prototype && i3 !== String.prototype || (i3 = {}), i3 === Array.prototype && (i3 = []), void 0 === i3[l3] || r2.bools[l3] || "boolean" == typeof i3[l3] ? i3[l3] = o3 : Array.isArray(i3[l3]) ? i3[l3].push(o3) : i3[l3] = [i3[l3], o3]);
  }
  function s2(e3, t3, i3) {
    if (!i3 || !r2.unknownFn || function(e4, t4) {
      return r2.allBools && /^--[^=]+$/.test(t4) || r2.strings[e4] || r2.bools[e4] || o2[e4];
    }(e3, i3) || false !== r2.unknownFn(i3)) {
      var n3 = !r2.strings[e3] && qe(t3) ? Number(t3) : t3;
      l2(a2, e3.split("."), n3), (o2[e3] || []).forEach(function(e4) {
        l2(a2, e4.split("."), n3);
      });
    }
  }
  Object.keys(r2.bools).forEach(function(e3) {
    s2(e3, void 0 !== n2[e3] && n2[e3]);
  });
  var c2 = [];
  -1 !== e2.indexOf("--") && (c2 = e2.slice(e2.indexOf("--") + 1), e2 = e2.slice(0, e2.indexOf("--")));
  for (var d2 = 0; d2 < e2.length; d2++) {
    var p2, m2, h2 = e2[d2];
    if (/^--.+=/.test(h2)) {
      var u2 = h2.match(/^--([^=]+)=([\s\S]*)$/);
      p2 = u2[1];
      var f2 = u2[2];
      r2.bools[p2] && (f2 = "false" !== f2), s2(p2, f2, h2);
    } else if (/^--no-.+/.test(h2))
      s2(p2 = h2.match(/^--no-(.+)/)[1], false, h2);
    else if (/^--.+/.test(h2))
      p2 = h2.match(/^--(.+)/)[1], void 0 === (m2 = e2[d2 + 1]) || /^(-|--)[^-]/.test(m2) || r2.bools[p2] || r2.allBools || o2[p2] && i2(p2) ? /^(true|false)$/.test(m2) ? (s2(p2, "true" === m2, h2), d2 += 1) : s2(p2, !r2.strings[p2] || "", h2) : (s2(p2, m2, h2), d2 += 1);
    else if (/^-[^-]+/.test(h2)) {
      for (var y2 = h2.slice(1, -1).split(""), g2 = false, v2 = 0; v2 < y2.length; v2++)
        if ("-" !== (m2 = h2.slice(v2 + 2))) {
          if (/[A-Za-z]/.test(y2[v2]) && "=" === m2[0]) {
            s2(y2[v2], m2.slice(1), h2), g2 = true;
            break;
          }
          if (/[A-Za-z]/.test(y2[v2]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(m2)) {
            s2(y2[v2], m2, h2), g2 = true;
            break;
          }
          if (y2[v2 + 1] && y2[v2 + 1].match(/\W/)) {
            s2(y2[v2], h2.slice(v2 + 2), h2), g2 = true;
            break;
          }
          s2(y2[v2], !r2.strings[y2[v2]] || "", h2);
        } else
          s2(y2[v2], m2, h2);
      p2 = h2.slice(-1)[0], g2 || "-" === p2 || (!e2[d2 + 1] || /^(-|--)[^-]/.test(e2[d2 + 1]) || r2.bools[p2] || o2[p2] && i2(p2) ? e2[d2 + 1] && /^(true|false)$/.test(e2[d2 + 1]) ? (s2(p2, "true" === e2[d2 + 1], h2), d2 += 1) : s2(p2, !r2.strings[p2] || "", h2) : (s2(p2, e2[d2 + 1], h2), d2 += 1));
    } else if (r2.unknownFn && false === r2.unknownFn(h2) || a2._.push(r2.strings._ || !qe(h2) ? h2 : Number(h2)), t2.stopEarly) {
      a2._.push.apply(a2._, e2.slice(d2 + 1));
      break;
    }
  }
  return Object.keys(n2).forEach(function(e3) {
    var t3, r3, i3;
    t3 = a2, r3 = e3.split("."), i3 = t3, r3.slice(0, -1).forEach(function(e4) {
      i3 = i3[e4] || {};
    }), r3[r3.length - 1] in i3 || (l2(a2, e3.split("."), n2[e3]), (o2[e3] || []).forEach(function(t4) {
      l2(a2, t4.split("."), n2[e3]);
    }));
  }), t2["--"] ? a2["--"] = c2.slice() : c2.forEach(function(e3) {
    a2._.push(e3);
  }), a2;
};
function Fe(e2) {
  return e2.split(/:(.+)/).map((e3) => e3.trim());
}
function Ie(e2) {
  return e2.split(/=(.+)/);
}
function Ae(e2, t2 = Fe) {
  let r2 = {};
  var o2 = t2(e2);
  return r2[o2[0]] = o2[1], r2;
}
function Ne(e2) {
  if ("" === e2)
    return null;
  let t2 = {};
  return e2.split(/&/).forEach((e3) => {
    const r2 = e3.split(/=/);
    t2[r2[0]] = r2[1];
  }), t2;
}
var Re = { header: (e2) => {
  let t2 = {};
  return "string" != typeof e2 ? (e2.forEach((e3) => {
    t2 = { ...t2, ...Ae(e3, Fe) };
  }), t2) : (t2 = Ae(e2), t2);
}, body: (e2) => {
  if ("string" != typeof e2) {
    let t2 = {};
    return e2.forEach((e3) => {
      t2 = { ...t2, ...Ae(e3, Ie) };
    }), t2;
  }
  try {
    return JSON.parse(e2);
  } catch {
    try {
      return Ne(e2);
    } catch {
      return e2;
    }
  }
}, parseParamsField: Ne };
var ze = [{ name: "url", alias: ["url", "curl"], description: "Url request", convertor: null }, { name: "cookie", alias: ["b", "cookie"], description: "<name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).", convertor: null }, { name: "cookie-jar", alias: ["c", "cookie-jar"], description: "<file name> File to save response cookies to.", convertor: null }, { name: "data", alias: ["d", "data", "data-raw", "data-urlencode", "data-binary"], description: "<data> Send specified data in POST request. Details provided below.", convertor: Re.body }, { name: "fail", alias: ["f", "fail"], description: "Fail silently (don't output HTML error form if returned).", convertor: null }, { name: "form", alias: ["F", "form"], description: "<name=content> Submit form data.", convertor: null }, { name: "header", alias: ["H", "header"], description: "<header> Headers to supply with request.", convertor: Re.header }, { name: "include", alias: ["i", "include"], description: "Include HTTP headers in the output.", convertor: null }, { name: "head", alias: ["I", "head"], description: "Fetch headers only.", convertor: null }, { name: "insecure", alias: ["k", "insecure"], description: "Allow insecure connections to succeed.", convertor: null }, { name: "location", alias: ["L", "location"], description: "v", convertor: null }, { name: "output", alias: ["o", "output"], description: "<file> Write output to . Can use --create-dirs in conjunction with this to create any directories specified in the -o path.", convertor: null }, { name: "remote-name", alias: ["remote-name", "O"], description: "Write output to file named like the remote file (only writes to current directory).", convertor: null }, { name: "silent", alias: ["s", "silent"], description: "Silent (quiet) mode. Use with -S to force it to show errors.", convertor: null }, { name: "verbose", alias: ["v", "verbose"], description: "Provide more information (useful for debugging).", convertor: null }, { name: "write-out", alias: ["write-out", "w"], description: '<format> Make curl display information on stdout after a completed transfer. See man page for more details on available variables. Convenient way to force curl to append a newline to output: -w "\n" (can add to ~/.curlrc).', convertor: null }, { name: "method", alias: ["X", "request"], description: "The request method to use.", convertor: null }, { name: "user-agent", alias: ["A", "user-agent"], description: "Specify the User-Agent send to the HTTP server.", convertor: null }, { name: "referer", alias: ["e", "referer"], description: 'Sends the "Referrer Page" information to the HTTP server.', convertor: null }], De = { matchArgv: function(e2) {
  return e2.replace(/\\\n/g, " ").match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|[^\s]+/g).map((e3) => e3.startsWith("'") && e3.endsWith("'") || e3.startsWith('"') && e3.endsWith('"') ? e3.substring(1, e3.length - 1) : e3);
} };
!function() {
  const e2 = $e, t2 = Re, r2 = ze, o2 = De;
  Ce.exports = Ce.exports.default = function(i2) {
    ("string" == typeof i2 || i2 instanceof String) && (i2 = o2.matchArgv(i2));
    const n2 = e2(i2);
    let a2 = {};
    if (n2._[1] && (a2.url = n2._[1].replace(/'/g, "")), r2.forEach((e3) => {
      let t3 = e3.alias.map((e4) => n2[e4]).filter((e4) => e4)[0];
      t3 && (e3.convertor ? a2[e3.name] = e3.convertor(t3) : a2[e3.name] = t3);
    }), a2.url) {
      let e3 = new URL(a2.url);
      a2.url = e3.origin + e3.pathname;
      let r3 = new URLSearchParams(e3.search);
      Array.from(r3).length && (a2.params = t2.parseParamsField(r3.toString()));
    }
    return a2.method || (a2.method = a2.data ? "POST" : "GET"), a2;
  };
}();
const Be = se(Ce.exports), { TextArea: Ee } = ne;
function Pe(t2) {
  const { open: r2, onCancel: o2, onSuccess: i2 } = t2, [n2, a2] = e(""), [l2, s2] = e(false), c2 = () => {
    a2(""), o2();
  };
  return K(oe, { title: "Import from cURL", open: r2, onCancel: c2, footer: [K(ie, { onClick: c2, children: "Cancel" }, "cancel"), K(ie, { type: "primary", loading: l2, onClick: async () => {
    if (n2.trim()) {
      s2(true);
      try {
        const e2 = Be(n2);
        i2(e2), a2(""), o2(), ae.success("cURL command imported successfully!");
      } catch (e2) {
        console.error("Error parsing cURL command:", e2), ae.error(`Failed to parse cURL command: ${e2.message}`);
      } finally {
        s2(false);
      }
    } else
      ae.error("Please enter a cURL command");
  }, children: "Import" }, "import")], width: 600, children: J("div", { style: { marginBottom: 16 }, children: [K("div", { style: { marginBottom: 8, fontWeight: 500 }, children: "Paste cURL Command Here" }), J("div", { style: { marginBottom: 12, color: "#666", fontSize: "12px" }, children: [K("div", { style: { marginBottom: 4 }, children: K("strong", { children: "Examples:" }) }), J("div", { style: { marginBottom: 2 }, children: ["GET: ", K("code", { children: "curl -X GET https://jsonplaceholder.typicode.com/posts/1" })] }), J("div", { style: { marginBottom: 2 }, children: ["POST: ", K("code", { children: `curl -X POST https://jsonplaceholder.typicode.com/posts -H "Content-Type: application/json" -d '{"title":"foo","body":"bar","userId":1}'` })] }), J("div", { children: ["Users: ", K("code", { children: "curl -X GET https://jsonplaceholder.typicode.com/users" })] })] }), K(Ee, { value: n2, onChange: (e2) => a2(e2.target.value), placeholder: "curl -X GET https://jsonplaceholder.typicode.com/posts/1", rows: 8, style: { fontFamily: "monospace" } })] }) });
}
const Le = o.div`
  width: 100%;
  height: 100%;
  position: absolute;
  background-color: white;

  ${(e2) => "editor" === e2.$placement ? i`
          top: 0;
        ` : i`
          padding: 36px 0 0 0;
        `}

  .section-title {
    font-size: 13px;
    line-height: 1;
    color: ${k};
    margin-bottom: 8px;
  }

  .section {
    margin-bottom: 12px;

    &:last-child {
      margin-bottom: 0px;
    }
  }
`, Oe = o.div`
  height: 40px;
  display: flex;
  padding: 0 16px;
  justify-content: space-between;
  align-items: ${(e2) => "editor" === e2.$placement ? "center" : "flex-start"};

  ${(e2) => e2.$shadow ? `box-shadow: ${C};` : ""}
  .title-text {
    font-size: ${(e2) => "editor" === e2.$placement ? 16 : 18}px;
    font-weight: 500;
  }

  .title-close-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    color: ${k};

    &:hover {
      color: ${q};
    }
  }
`, Qe = o.div`
  height: calc(100% - 40px);
`, Ue = o.div`
  padding: 8px 16px 24px;
`, He = o.div`
  display: flex;
  gap: ${(e2) => "queryLibrary" === e2.$placement ? 12 : 8}px;
  flex-wrap: wrap;
`, Ve = (e2) => {
  let t2 = "", r2 = re.noop, o2 = K(D, { size: "large", dataSourceType: "object" == typeof e2.identifier ? e2.identifier.type : e2.identifier });
  const i2 = { [x.TempState]: { label: d("query.tempState"), type: x.TempState }, [x.Transformer]: { label: d("query.transformer"), type: x.Transformer }, [x.DateResponder]: { label: d("query.dataResponder"), type: x.DateResponder }, [x.Folder]: { label: d("query.folder"), type: x.Folder, extra: () => ({ id: E() }) }, js: { label: d("query.executeJSCode"), type: x.Query, extra: { compType: "js", dataSourceId: P } }, libraryQuery: { label: d("query.importFromQueryLibrary"), type: x.Query, extra: { compType: "libraryQuery" } }, restApi: { label: d("query.quickRestAPI"), type: x.Query, extra: { compType: "restApi", dataSourceId: L } }, streamApi: { label: d("query.quickStreamAPI"), type: x.Query, extra: { compType: "streamApi" } }, alasql: { label: d("query.quickAlasql"), type: x.Query, extra: { compType: "alasql" } }, sseHttpApi: { label: d("query.quickSseHttpAPI"), type: x.Query, extra: { compType: "sseHttpApi", dataSourceId: O } }, graphql: { label: d("query.quickGraphql"), type: x.Query, extra: { compType: "graphql", dataSourceId: Q } } };
  if ("object" == typeof e2.identifier) {
    const o3 = e2.identifier;
    t2 = o3.name, r2 = () => {
      e2.onSelect(x.Query, { compType: o3.type, dataSourceId: o3.id });
    };
  } else if (i2[e2.identifier]) {
    const n2 = i2[e2.identifier];
    o2 = n2.icon ?? o2, t2 = n2.label, r2 = () => {
      const t3 = "function" == typeof n2.extra ? n2.extra() : n2.extra;
      e2.onSelect(n2.type, t3);
    };
  }
  return J(A, { onClick: r2, size: e2.size, children: [o2, t2] });
};
function _e(t2) {
  const { onSelect: r2, onClose: o2, recentlyUsed: i2, datasource: n2, placement: a2 = "editor" } = t2, [l2, c2] = e(false), [p2, h2] = e(false), [u2, f2] = e(false), y2 = s(T), g2 = s($), { width: v2, ref: b2 } = F({ handleHeight: false, refreshMode: "debounce", refreshRate: 300 }), w2 = v2 ? Math.floor((v2 + 8) / 192) : 3, j2 = "queryLibrary" !== a2 ? "small" : "middle", S2 = te.throttle((e2) => {
    const t3 = e2.target.scrollTop;
    c2(t3 > 0);
  }, 100);
  return J(Le, { $placement: a2, children: [J(Oe, { $shadow: l2, $placement: a2, children: [K("div", { onScroll: S2, className: "title-text", children: d("query.newQuery") }), K("div", { className: "title-close-btn", children: K(I, { onClick: o2 }) })] }), K(Qe, { children: K(m, { scrollableNodeProps: { onScroll: S2 }, children: J(Ue, { children: [K("div", { className: "section-title", children: d("query.recentlyUsed") }), K("div", { ref: b2, className: "section", children: J(He, { $placement: a2, children: [te.uniq(i2).slice(0, w2).map((e2, t3) => K(Ve, { size: j2, identifier: e2, onSelect: r2 }, t3)), K(Ve, { size: j2, identifier: x.Folder, onSelect: r2 })] }) }), K("div", { className: "section-title", children: d("query.datasource") }), K("div", { className: "section", children: J(He, { $placement: a2, children: [n2.map((e2) => K(Ve, { size: j2, identifier: e2, onSelect: r2 }, e2.id)), (g2.orgDev || y2) && J(A, { size: j2, onClick: () => h2(true), children: [K(N, { children: K(R, {}) }), d("query.newDatasource")] })] }) }), "editor" === a2 && J(Z, { children: [K("div", { className: "section-title", children: d("code") }), K("div", { className: "section", children: J(He, { $placement: a2, children: [K(Ve, { size: j2, identifier: "js", onSelect: r2 }), K(Ve, { size: j2, identifier: x.TempState, onSelect: r2 })] }) })] }), "queryLibrary" === a2 && t2.onImport && J(Z, { children: [K("div", { className: "section-title", children: d("home.import") }), K("div", { className: "section", children: K(He, { $placement: a2, children: K(le, { accept: ".json", showUploadList: false, customRequest: (e2) => {
    t2.onImport(e2);
  }, multiple: false, children: J(A, { size: j2, children: [K(z, { width: "20px", height: "20px", style: { marginRight: "8px" } }), d("query.importFromFile")] }) }) }) })] }), "queryLibrary" === a2 && J(Z, { children: [K("div", { className: "section-title", children: d("code") }), K("div", { className: "section", children: K(He, { $placement: a2, children: K(Ve, { size: j2, identifier: "js", onSelect: r2 }) }) })] }), K("div", { className: "section-title", children: d("query.preparedDataQueries") }), K("div", { className: "section", children: !y2 && K(Ve, { size: j2, identifier: "libraryQuery", onSelect: r2 }) }), K("div", { className: "section-title", children: d("query.adHocDataQueries") }), K("div", { className: "section", children: J(He, { $placement: a2, children: [K(Ve, { size: j2, identifier: "restApi", onSelect: r2 }), K(Ve, { size: j2, identifier: "streamApi", onSelect: r2 }), K(Ve, { size: j2, identifier: "sseHttpApi", onSelect: r2 }), K(Ve, { size: j2, identifier: "alasql", onSelect: r2 }), K(Ve, { size: j2, identifier: "graphql", onSelect: r2 }), J(A, { size: j2, onClick: () => f2(true), children: [K(D, { size: "large", dataSourceType: "restApi" }), "Import from cURL"] })] }) }), K("div", { className: "section-title", children: d("query.queryResultTransformer") }), K("div", { className: "section", children: K(He, { $placement: a2, children: K(Ve, { size: j2, identifier: x.Transformer, onSelect: r2 }) }) }), K("div", { className: "section-title", children: d("query.queryResultReactor") }), K("div", { className: "section", children: K(He, { $placement: a2, children: K(Ve, { size: j2, identifier: x.DateResponder, onSelect: r2 }) }) }), K("div", { className: "section-title", children: d("query.datasource") }), K("div", { className: "section", children: J(He, { $placement: a2, children: [n2.map((e2) => K(Ve, { size: j2, identifier: e2, onSelect: r2 }, e2.id)), (g2.orgDev || y2) && J(A, { size: j2, onClick: () => h2(true), children: [K(N, { children: K(R, {}) }), d("query.newDatasource")] })] }) })] }) }) }), K(B, { open: p2, onCancel: () => h2(false), onCreated: () => h2(false) }), K(Pe, { open: u2, onCancel: () => f2(false), onSuccess: (e2) => {
    r2(x.Query, { compType: "restApi", dataSourceId: L, curlData: e2 });
  } })] });
}
const We = o.div`
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
`, Ge = o.div`
  position: relative;
  width: calc(30% - 1px);
  min-width: 248px;
  max-width: 296px;
  height: 100%;
  float: left;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
`, Me = o.div`
  width: 1px;
  height: 100%;
  background-color: #e1e3eb;
  position: relative;
  flex-shrink: 0;
`, Xe = o.div`
  position: relative;
  min-width: 0;
  height: 100%;
  overflow-y: hidden;
  overflow-x: auto;
  flex-grow: 1;
`;
function Je() {
  return J(We, { children: [K(Ge, {}), K(Me, {}), K(Xe, {})] });
}
const Ke = () => {
  var _a, _b;
  const o2 = r(h), i2 = s(U), n2 = o2.selectedBottomResComp(), [a2, l2] = e(false), c2 = o2.getQueriesComp().getView(), p2 = o2.getTempStatesComp().getView(), m2 = o2.getTransformersComp().getView(), u2 = o2.getFoldersComp().getView(), f2 = o2.getDataRespondersComp().getView(), y2 = o2.selectedBottomResType === x.Folder, g2 = o2.rootComp.children.refTree, v2 = [...c2, ...p2, ...m2, ...u2, ...f2], b2 = v2.reverse().map((e2) => {
    var _a2;
    if (e2.type() === x.Query) {
      const t2 = i2.find((t3) => {
        var _a3;
        return t3.datasource.id === ((_a3 = e2.children.datasourceId) == null ? void 0 : _a3.getView());
      });
      return (t2 == null ? void 0 : t2.datasource) || ((_a2 = e2.children.compType) == null ? void 0 : _a2.getView());
    }
    return e2.type();
  });
  t(() => {
    o2.selectedBottomResName && l2(false);
  }, [o2.selectedBottomResName, l2]);
  const w2 = ((_a = o2.selectedQueryComp()) == null ? void 0 : _a.children.datasourceId.getView()) || "", j2 = H(w2);
  return J(We, { className: V, children: [K(Ge, { children: K(Ze, { items: v2, onOpenCreatePanel: () => l2(true), onDelete: (e2, t2) => {
    const r2 = o2.getBottomResListComp(e2);
    return e2 === x.Folder && g2.hasChildren(t2) ? (X.error(d("query.folderNotEmpty")), false) : (r2.delete(t2), true);
  }, onCopy: (e2, t2) => {
    o2.getBottomResListComp(e2).copy(o2, t2);
  }, onSelect: (e2, t2) => {
    o2.getBottomResListComp(e2).select(o2, t2);
  } }) }), K(Me, {}), K(Xe, { children: J("div", { style: { width: "100%", height: "100%", minWidth: "480px", display: "flex", flexDirection: "column" }, children: [K(_.Provider, { value: j2, children: K(W.Provider, { value: ((_b = o2.selectedQueryComp()) == null ? void 0 : _b.children.name.getView()) || "", children: n2 ? n2.getPropertyView() : ot }) }), (a2 || y2) && K(_e, { recentlyUsed: b2, datasource: i2.map((e2) => e2.datasource).filter((e2) => 2 !== e2.creationSource), onSelect: (e2, t2) => {
    const r2 = o2.getBottomResListComp(e2).add(o2, t2);
    l2(false);
    const i3 = e2 === x.Folder, n3 = y2 && !i3 ? o2.selectedBottomResName : "", a3 = i3 ? u2.length : void 0;
    o2.rootComp.children.refTree.appendRef(n3, r2, a3);
  }, onClose: () => l2(false) })] }) })] });
};
function Ze(e2) {
  var _a, _b;
  const { items: t2, onOpenCreatePanel: o2, onCopy: i2, onSelect: n2, onDelete: a2 } = e2, l2 = r(h), s2 = (_a = l2.selectedQueryComp()) == null ? void 0 : _a.children.datasourceId.getView(), c2 = (_b = l2.selectedQueryComp()) == null ? void 0 : _b.children.compType.getView();
  return J(Z, { children: [K(ge, { refTreeComp: l2.rootComp.children.refTree, dataSourceId: s2, items: t2, onCopy: i2, onDelete: a2, onSelect: n2, onOpenCreatePanel: o2 }), s2 && c2 && K(ee, { dataSourceId: s2, queryType: c2 })] });
}
const Ye = i`
  user-select: text;

  font-size: 13px;
  line-height: 13px;
  cursor: text;
`, et = o.div`
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  transform: translateY(-48px);
`, tt = o.span`
  ${Ye};
  display: block;
  margin-top: 10px;
  color: #b8b9bf;
  text-align: center;
`, rt = o.div`
  height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
`, ot = J(Z, { children: [G, K(rt, { children: J(et, { children: [K(M, {}), K(tt, { children: d("bottomPanel.noSelectedQuery") })] }) })] }), it = K(rt, { children: J(et, { children: [K(M, {}), K(tt, { children: d("bottomPanel.noSelectedQuery") })] }) });
export {
  Ke as BottomContent,
  Je as BottomSkeleton,
  ot as EmptyQuery,
  it as EmptyQueryWithoutTab
};
