var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  return value;
};
import { t } from "./i18n-1c9e1aab.js";
import { c as e, E as r, a as s, b as a, S as i, d as o, A as c, e as n, f as u, O as p, s as l, g as d, R as g, h as m, i as h, D as U, j as R } from "./constants-6ebafe5b.js";
import { a as L } from "./axios-e064bed6.js";
import { _ as f, l as y } from "./lodash-62e10097.js";
import { l as I } from "./loglevel-dd4a2561.js";
import { h as A } from "./util-31a5c3fb.js";
import { S as E, l as S } from "./app_redux-c7ca7a7f.js";
import { m as w } from "./common-64096f9e.js";
const P = /query\/execute/, $ = /timeout of (\d+)ms exceeded/;
const b = (t2) => function(t3) {
  return (t3 == null ? void 0 : t3.config) && "timer" in t3.config;
}(t2) ? { ...t2, data: { ...(t2 == null ? void 0 : t2.data) ?? {}, runTime: Number((performance.now() - (t2 == null ? void 0 : t2.config.timer)).toFixed()) } } : t2, D = (t2) => ({ ...t2, timer: performance.now() }), T = (t2) => {
  var _a, _b;
  return ((_b = (_a = t2 == null ? void 0 : t2.config) == null ? void 0 : _a.url) == null ? void 0 : _b.match(P)) ? b(t2) : t2;
}, O = (a2) => {
  var _a, _b, _c, _d, _e, _f, _g, _h;
  if (!window.navigator.onLine)
    return Promise.reject({ ...a2, message: e(r) });
  if (!a2)
    return Promise.reject(a2);
  if (L.isCancel(a2))
    return Promise.reject(a2);
  if ("ECONNABORTED" === a2.code && a2.message && a2.message.match($))
    return Promise.reject({ ...a2, message: e(i), code: o.REQUEST_TIMEOUT });
  if (function(t2) {
    return Boolean(L.isAxiosError(t2) && (t2 == null ? void 0 : t2.config) && "timer" in t2.config);
  }(a2)) {
    if (a2.response) {
      if (a2.response.status === c.SERVER_ERROR)
        return Promise.reject({ ...a2, code: o.SERVER_ERROR, message: e(s) });
      if (!((t2) => {
        const e2 = window.location.pathname;
        return /^\/404/.test(e2) || /^\/user\/auth\/\w+/.test(e2) || /^\/invite\/\w+/.test(e2) || t2 && /^\/auth\/logout\w*/.test(t2);
      })((_a = a2.config) == null ? void 0 : _a.url) && a2.response.status === c.REQUEST_NOT_AUTHORISED) {
        const e2 = a2.response.headers["x-org-id"] || void 0;
        return E.getStore().dispatch(S({ notAuthorised: true, organizationId: e2 })), Promise.reject({ code: o.REQUEST_NOT_AUTHORISED, message: t("apiMessage.authenticationFail"), show: false });
      }
      if (((_c = (_b = a2.response) == null ? void 0 : _b.data) == null ? void 0 : _c.code) === n.NEED_BIND && !(() => {
        const t2 = window.location.pathname;
        return t2 === u || t2 === p;
      })())
        return A.push(u), Promise.reject({ code: o.SERVER_ERROR, message: t("apiMessage.verifyAccount"), show: false });
      if (((_e = (_d = a2.response) == null ? void 0 : _d.data) == null ? void 0 : _e.code) === n.CURRENT_EDITION_NOT_SUPPORT_THIS_FEATURE) {
        const e2 = ((_f = a2.response.data) == null ? void 0 : _f.message) ?? t("apiMessage.functionNotSupported");
        return w.destroy(), w.error(e2), Promise.reject({ message: e2 });
      }
      return a2.config && ((_h = (_g = a2.config) == null ? void 0 : _g.url) == null ? void 0 : _h.match(P)) ? b(a2.response) : Promise.resolve(a2.response);
    }
    a2.request ? I.error(a2.request) : I.error("Error", a2.message);
  }
  return I.debug(a2.config), Promise.resolve(a2);
}, C = (t2) => {
  switch (t2) {
    case 401:
      return e(a);
    case 500:
      return e(s);
    case 0:
      return e(r);
  }
};
function x(t2) {
  if (v(t2))
    return true;
  throw Error(t2.data.message);
}
function v(t2) {
  if (!t2)
    throw Error(C(0));
  if (!t2.data && !t2.status)
    throw Error(C(0));
  if (!t2.data && t2.status)
    throw Error(C(t2.status));
  return t2.data.success;
}
function k(t2, e2) {
  return t2.toString(16).padStart(e2, "0");
}
let q = null;
function G() {
  if (q)
    return q;
  const t2 = { baseURL: `${f.trimEnd(l.baseURL || d, "/")}/api/`, timeout: g, headers: m, withCredentials: true }, e2 = L.create(t2);
  return e2.interceptors.request.use(D), e2.interceptors.response.use(T, O), q = e2, q;
}
class F {
  static get(t2, e2, r2 = {}) {
    return G().request({ url: t2, method: "GET", params: e2, ...r2 });
  }
  static post(t2, e2, r2, s2 = {}) {
    return G().request({ method: "POST", url: t2, data: e2, params: r2, ...s2 });
  }
  static put(t2, e2, r2, s2 = {}) {
    return G().request({ method: "PUT", url: t2, params: r2, data: e2, ...s2 });
  }
  static patch(t2, e2, r2, s2 = {}) {
    return G().request({ method: "PATCH", url: t2, data: e2, params: r2, ...s2 });
  }
  static delete(t2, e2, r2 = {}) {
    return G().request({ method: "DELETE", url: t2, params: e2, ...r2 });
  }
}
function _(e2) {
  switch (e2) {
    case "primary":
      return t("themeDetail.primary");
    case "textDark":
      return t("themeDetail.textDark");
    case "textLight":
      return t("themeDetail.textLight");
    case "canvas":
      return t("themeDetail.canvas");
    case "primarySurface":
      return t("themeDetail.primarySurface");
    case "radius":
      return t("themeDetail.borderRadius");
    case "border":
      return t("themeDetail.borderColor");
    case "borderWidth":
      return t("themeDetail.borderWidth");
    case "borderStyle":
      return t("themeDetail.borderStyle");
    case "fontFamily":
      return t("themeDetail.fontFamily");
    case "margin":
      return t("style.margin");
    case "direction":
      return t("style.direction");
    case "padding":
      return t("style.padding");
    case "gridColumns":
      return t("themeDetail.gridColumns");
    case "textSize":
      return t("style.textSize");
    case "lineHeight":
      return t("themeDetail.lineHeight");
  }
  return "";
}
function B(t2) {
  switch (t2) {
    case "primary":
    case "textDark":
    case "textLight":
    case "canvas":
    case "primarySurface":
    case "borderRadius":
    case "borderColor":
    case "radius":
    case "border":
    case "borderWidth":
    case "borderStyle":
    case "fontFamily":
    case "margin":
    case "direction":
    case "padding":
    case "gridColumns":
    case "textSize":
    case "lineHeight":
      return true;
  }
  return false;
}
const _j = class _j extends F {
  static fetchCommonSetting(t2) {
    return F.get(_j.commonSettingUrl(t2.orgId));
  }
  static setCommonSetting(t2) {
    const { orgId: e2, ...r2 } = t2;
    return F.put(_j.commonSettingUrl(t2.orgId), r2.data);
  }
};
__publicField(_j, "commonSettingUrl", (t2) => `/organizations/${t2}/common-settings`);
let j = _j;
const _M = class _M extends F {
  static createGroup(t2) {
    return F.post(_M.createGroupURL, t2);
  }
  static updateGroup(t2, e2) {
    return F.put(_M.updateGroupURL(t2), e2);
  }
  static fetchGroup() {
    return F.get(_M.fetchGroupURL);
  }
  static fetchGroupPagination(t2) {
    return F.get(_M.fetchGroupURL, { ...t2 });
  }
  static deleteGroup(t2) {
    return F.delete(_M.deleteGroupURL(t2));
  }
  static updateUserOrgRole(t2) {
    return F.put(_M.updateUserOrgRoleURL(t2.orgId), { userId: t2.userId, role: t2.role });
  }
  static updateUserGroupRole(t2) {
    return F.put(_M.updateUserGroupRoleURL(t2.groupId), { userId: t2.userId, role: t2.role });
  }
  static fetchOrgUsers(t2) {
    return F.get(_M.fetchOrgUsersURL(t2));
  }
  static fetchOrgUsersPagination(t2) {
    const { orgId: e2, ...r2 } = t2;
    return F.get(_M.fetchOrgUsersURL(e2), { ...r2 });
  }
  static fetchGroupUsers(t2) {
    return F.get(_M.fetchGroupUsersURL(t2));
  }
  static fetchGroupUsersPagination(t2) {
    const { groupId: e2, ...r2 } = t2;
    return F.get(_M.fetchGroupUsersURL(e2), { ...r2 });
  }
  static deleteGroupUser(t2) {
    return F.delete(_M.deleteGroupUserURL(t2.groupId), { userId: t2.userId });
  }
  static addGroupUser(t2) {
    return F.post(_M.addGroupUserURL(t2.groupId), { userId: t2.userId, role: t2.role });
  }
  static deleteOrgUser(t2) {
    const { orgId: e2, ...r2 } = t2;
    return F.delete(_M.deleteOrgUsersURL(e2), r2);
  }
  static quitOrg(t2) {
    return F.delete(_M.quitOrgURL(t2));
  }
  static switchOrg(t2) {
    return F.put(_M.switchOrgURL(t2));
  }
  static quitGroup(t2) {
    return F.delete(_M.quitGroupURL(t2));
  }
  static createOrg(t2) {
    return F.post(_M.createOrgURL, { name: t2 });
  }
  static deleteOrg(t2) {
    return F.delete(_M.deleteOrgURL(t2));
  }
  static updateOrg(t2) {
    return F.put(_M.updateOrgURL(t2.id), t2);
  }
  static fetchAPIUsage(t2) {
    return F.get(_M.fetchUsage(t2));
  }
  static fetchLastMonthAPIUsage(t2) {
    return F.get(_M.fetchUsage(t2), { lastMonthOnly: true });
  }
  static fetchOrgsByEmail(t2) {
    return F.get(_M.fetchOrgsByEmailURL(t2));
  }
  static fetchOrgsPaginationByEmail(t2) {
    const { email: e2, ...r2 } = t2;
    return F.get(_M.fetchOrgsByEmailURL(e2), { ...r2 });
  }
};
__publicField(_M, "createGroupURL", "/groups");
__publicField(_M, "updateGroupURL", (t2) => `/groups/${t2}/update`);
__publicField(_M, "fetchGroupURL", "/groups/list");
__publicField(_M, "fetchGroupUsersURL", (t2) => `/groups/${t2}/members`);
__publicField(_M, "deleteGroupURL", (t2) => `/groups/${t2}`);
__publicField(_M, "fetchOrgUsersURL", (t2) => `/organizations/${t2}/members`);
__publicField(_M, "deleteOrgUsersURL", (t2) => `/organizations/${t2}/remove`);
__publicField(_M, "deleteGroupUserURL", (t2) => `/groups/${t2}/remove`);
__publicField(_M, "addGroupUserURL", (t2) => `/groups/${t2}/addMember`);
__publicField(_M, "updateUserOrgRoleURL", (t2) => `/organizations/${t2}/role`);
__publicField(_M, "updateUserGroupRoleURL", (t2) => `/groups/${t2}/role`);
__publicField(_M, "quitOrgURL", (t2) => `/organizations/${t2}/leave`);
__publicField(_M, "quitGroupURL", (t2) => `/groups/${t2}/leave`);
__publicField(_M, "switchOrgURL", (t2) => `/organizations/switchOrganization/${t2}`);
__publicField(_M, "createOrgURL", "/organizations");
__publicField(_M, "deleteOrgURL", (t2) => `/organizations/${t2}`);
__publicField(_M, "updateOrgURL", (t2) => `/organizations/${t2}/update`);
__publicField(_M, "fetchUsage", (t2) => `/organizations/${t2}/api-usage`);
__publicField(_M, "fetchOrgsByEmailURL", (t2) => `organizations/byuser/${t2}`);
let M = _M;
const z = M;
const _Q = class _Q extends F {
  static thirdPartyLogin(t2) {
    return F.post(_Q.thirdPartyLoginURL, void 0, t2);
  }
  static bindThirdParty(t2) {
    return F.post(_Q.thirdPartyBindURL, void 0, t2);
  }
  static formLogin(t2) {
    const { invitationId: e2, orgId: r2, ...s2 } = t2;
    let a2 = {};
    return e2 && (a2.invitationId = e2), r2 && (a2.orgId = r2), F.post(_Q.formLoginURL, s2, a2);
  }
  static bindEmail(t2) {
    return F.post(_Q.emailBindURL, void 0, t2);
  }
  static setPassword(t2) {
    return F.post(_Q.passwordURL, void 0, t2);
  }
  static updatePassword(t2) {
    return F.put(_Q.passwordURL, t2);
  }
  static getUser() {
    return F.get(_Q.userURL);
  }
  static getCurrentUser() {
    return F.get(_Q.currentUserURL);
  }
  static getRawCurrentUser() {
    return F.get(_Q.rawCurrentUserURL);
  }
  static userLogout() {
    return F.post(_Q.logoutURL);
  }
  static updateUser(t2) {
    return F.put(_Q.usersURL, t2);
  }
  static markUserStatus(t2) {
    return F.put(_Q.markUserStatusURL, t2);
  }
  static getUserDetail(t2) {
    return F.get(_Q.userDetailURL(t2));
  }
  static resetPassword(t2) {
    return F.post(_Q.resetPasswordURL, { userId: t2 });
  }
  static forgotPassword(t2) {
    return F.post(_Q.forgotPasswordURL, { userEmail: t2 });
  }
  static resetLostPassword(t2) {
    return F.post(_Q.resetLostPasswordURL, t2);
  }
  static createApiKey({ name: t2, description: e2 = "" }) {
    return F.post(_Q.createApiKeyURL, { name: t2, description: e2 });
  }
  static fetchApiKeys() {
    return F.get(_Q.fetchApiKeysURL);
  }
  static deleteApiKey(t2) {
    return F.delete(_Q.deleteApiKeyURL(t2));
  }
};
__publicField(_Q, "thirdPartyLoginURL", "/auth/tp/login");
__publicField(_Q, "thirdPartyBindURL", "/auth/tp/bind");
__publicField(_Q, "usersURL", "/users");
__publicField(_Q, "sendVerifyCodeURL", "/auth/otp/send");
__publicField(_Q, "logoutURL", "/auth/logout");
__publicField(_Q, "userURL", "/users/me");
__publicField(_Q, "currentUserURL", "/users/currentUser");
__publicField(_Q, "rawCurrentUserURL", "/users/rawCurrentUser");
__publicField(_Q, "emailBindURL", "/auth/email/bind");
__publicField(_Q, "passwordURL", "/users/password");
__publicField(_Q, "formLoginURL", "/auth/form/login");
__publicField(_Q, "markUserStatusURL", "/users/mark-status");
__publicField(_Q, "userDetailURL", (t2) => `/users/userDetail/${t2}`);
__publicField(_Q, "resetPasswordURL", "/users/reset-password");
__publicField(_Q, "forgotPasswordURL", "/users/lost-password");
__publicField(_Q, "resetLostPasswordURL", "/users/reset-lost-password");
__publicField(_Q, "fetchApiKeysURL", "/auth/api-keys");
__publicField(_Q, "createApiKeyURL", "/auth/api-key");
__publicField(_Q, "deleteApiKeyURL", (t2) => `/auth/api-key/${t2}`);
let Q = _Q;
const N = Q;
const _H = class _H extends F {
  static createFolder(t2) {
    return F.post(_H.url, t2);
  }
  static updateFolder(t2) {
    return F.put(_H.url, t2);
  }
  static deleteFolder(t2) {
    return F.delete(_H.url + `/${t2.folderId}`);
  }
  static moveToFolder(t2) {
    return F.put(_H.url + `/move/${t2.sourceId}`, {}, { targetFolderId: t2.folderId });
  }
  static fetchFolderElements(t2) {
    return F.get(_H.url + "/elements", { id: t2.folderId });
  }
  static fetchFolderElementsPagination(t2) {
    const { id: e2, ...r2 } = t2;
    return t2.id ? F.get(_H.url + "/elements", { id: e2, ...r2 }) : F.get(_H.url + "/elements", { ...t2 });
  }
};
__publicField(_H, "url", "/folders");
let H = _H;
const _K = class _K extends F {
  static fetchHomeData(t2) {
    return F.get(_K.fetchHomeDataURL, t2);
  }
  static fetchAllApplications(t2) {
    return F.get(_K.newURLPrefix + "/list", { ...t2, withContainerSize: false });
  }
  static fetchAllApplicationsPagination(t2) {
    return F.get(_K.newURLPrefix + "/list", { ...t2, withContainerSize: false, applicationStatus: "RECYCLED" });
  }
  static fetchAllModules(t2) {
    return F.get(_K.newURLPrefix + "/list", { applicationType: h.Module, applicationStatus: "NORMAL", withContainerSize: true, ...t2 });
  }
  static fetchRecycleList() {
    return F.get(_K.newURLPrefix + "/recycle/list");
  }
  static createApplication(t2) {
    return F.post(_K.createApplicationURL, { orgId: t2.orgId, name: t2.applicationName, applicationType: t2.applicationType, editingApplicationDSL: t2.dsl || {}, folderId: t2.folderId });
  }
  static createApplicationWithDSL(t2) {
    return F.post(_K.createApplicationURL, t2);
  }
  static recycleApplication(t2) {
    return F.put(_K.newURLPrefix + `/recycle/${t2.applicationId}`);
  }
  static restoreApplication(t2) {
    return F.put(_K.newURLPrefix + `/restore/${t2.applicationId}`);
  }
  static deleteApplication(t2) {
    return F.delete(_K.deleteApplicationURL(t2.applicationId));
  }
  static updateApplication(t2) {
    const { applicationId: e2, ...r2 } = t2;
    return F.put(_K.updateApplicationURL(e2), r2);
  }
  static publishApplication(t2) {
    return F.post(_K.publishApplicationURL(t2.applicationId));
  }
  static getApplicationDetail(t2) {
    const { type: e2, applicationId: r2 } = t2, s2 = "published" === e2 ? _K.getAppPublishInfoURL(r2) : "view_marketplace" === e2 ? _K.getMarketplaceAppURL(r2) : _K.getAppEditingInfoURL(r2);
    return F.get(s2);
  }
  static getApplicationPermissions(t2) {
    return F.get(_K.getApplicationPermissionURL(t2));
  }
  static grantAppPermission(t2) {
    const { applicationId: e2, ...r2 } = t2;
    return F.put(_K.grantAppPermissionURL(e2), r2);
  }
  static updateAppPermission(t2) {
    const { applicationId: e2, permissionId: r2, ...s2 } = t2;
    return F.put(_K.updateAppPermissionURL(e2, r2), s2);
  }
  static deleteAppPermission(t2) {
    const { applicationId: e2, permissionId: r2 } = t2;
    return F.delete(_K.updateAppPermissionURL(e2, r2));
  }
  static createFromTemplate(t2) {
    return F.post(_K.createFromTemplateURL, null, { templateId: t2 });
  }
  static publicToAll(t2, e2) {
    return F.put(_K.publicToAllURL(t2), { publicToAll: e2 });
  }
  static publicToMarketplace(t2, e2) {
    return F.put(_K.publicToMarketplaceURL(t2), { publicToMarketplace: e2 });
  }
  static fetchAllMarketplaceApps() {
    return F.get(_K.fetchAllMarketplaceAppsURL);
  }
  static getMarketplaceApp(t2) {
    return F.get(_K.getMarketplaceAppURL(t2));
  }
  static setAppEditingState(t2) {
    const { applicationId: e2, editingFinished: r2 } = t2;
    return F.put(_K.setAppEditingStateURL(e2), { editingFinished: r2 });
  }
  static fetchServerSettings() {
    return F.get(_K.serverSettingsURL());
  }
};
__publicField(_K, "newURLPrefix", "/applications");
__publicField(_K, "fetchHomeDataURL", "/applications/home");
__publicField(_K, "createApplicationURL", "/applications");
__publicField(_K, "fetchAllMarketplaceAppsURL", "/applications/marketplace-apps");
__publicField(_K, "deleteApplicationURL", (t2) => `/applications/${t2}`);
__publicField(_K, "getAppPublishInfoURL", (t2) => `/applications/${t2}/view`);
__publicField(_K, "getAppEditingInfoURL", (t2) => `/applications/${t2}`);
__publicField(_K, "updateApplicationURL", (t2) => `/applications/${t2}`);
__publicField(_K, "getApplicationPermissionURL", (t2) => `/applications/${t2}/permissions`);
__publicField(_K, "grantAppPermissionURL", (t2) => `/applications/${t2}/permissions`);
__publicField(_K, "publishApplicationURL", (t2) => `/applications/${t2}/publish`);
__publicField(_K, "updateAppPermissionURL", (t2, e2) => `/applications/${t2}/permissions/${e2}`);
__publicField(_K, "createFromTemplateURL", "/applications/createFromTemplate");
__publicField(_K, "publicToAllURL", (t2) => `/applications/${t2}/public-to-all`);
__publicField(_K, "publicToMarketplaceURL", (t2) => `/applications/${t2}/public-to-marketplace`);
__publicField(_K, "getMarketplaceAppURL", (t2) => `/applications/${t2}/view_marketplace`);
__publicField(_K, "setAppEditingStateURL", (t2) => `/applications/editState/${t2}`);
__publicField(_K, "serverSettingsURL", () => "/serverSettings");
let K = _K;
const V = K;
var Y = ((t2) => (t2.VERIFY_CA_CERT = "VERIFY_CA_CERT", t2.VERIFY_SELF_SIGNED_CERT = "VERIFY_SELF_SIGNED_CERT", t2.DISABLED = "DISABLED", t2))(Y || {});
const _W = class _W extends F {
  static fetchJsDatasourceByApp(t2) {
    return F.get(_W.url + `/jsDatasourcePlugins?appId=${t2}`);
  }
  static fetchJsDatasourcePaginationByApp(t2) {
    const { appId: e2, ...r2 } = t2;
    return F.get(_W.url + `/jsDatasourcePlugins?appId=${e2}`, { ...r2 });
  }
  static fetchDatasourceByApp(t2) {
    return F.get(_W.url + `/listByApp?appId=${t2}`);
  }
  static fetchDatasourceByOrg(t2) {
    return F.get(_W.url + `/listByOrg?orgId=${t2}`);
  }
  static fetchDatasourcePaginationByOrg(t2) {
    const { orgId: e2, ...r2 } = t2;
    return F.get(_W.url + `/listByOrg?orgId=${e2}`, { ...r2 });
  }
  static createDatasource(t2) {
    return F.post(_W.url, t2);
  }
  static testDatasource(t2) {
    return F.post(`${_W.url}/test`, t2, void 0, { timeout: U });
  }
  static updateDatasource(t2, e2) {
    return F.put(_W.url + `/${e2}`, t2);
  }
  static deleteDatasource(t2) {
    return F.delete(_W.url + `/${t2}`);
  }
  static fetchDatasourceStructure(t2, e2 = false) {
    return F.get(_W.url + `/${t2}/structure?ignoreCache=${e2}`);
  }
  static fetchDatasourceType(t2) {
    return F.get(`/organizations/${t2}/datasourceTypes`);
  }
  static fetchDynamicPluginConfig(t2, e2, r2, s2) {
    return F.post(_W.url + "/getPluginDynamicConfig", [{ pluginName: t2, path: e2, dataSourceConfig: r2, dataSourceId: s2 }]);
  }
};
__publicField(_W, "url", "datasources");
let W = _W;
const _J = class _J extends F {
  static fetchQueryLibraryByOrg() {
    return F.get(_J.url + "/listByOrg");
  }
  static fetchQueryLibraryPaginationByOrg(t2) {
    return F.get(_J.url + "/listByOrg", { ...t2 });
  }
  static fetchQueryLibraryDropdown() {
    return F.get(_J.url + "/dropDownList");
  }
  static fetchQueryLibraryRecordDSL(t2, e2) {
    return F.get(_J.recordUrl + `?libraryQueryId=${t2}&libraryQueryRecordId=${e2}`);
  }
  static fetchQueryLibraryRecords(t2) {
    return F.get(_J.recordUrl + `/listByLibraryQueryId?libraryQueryId=${t2}`);
  }
  static publishQueryLibrary(t2, e2) {
    return F.post(_J.url + `/${t2}/publish`, e2);
  }
  static createQueryLibrary(t2) {
    return F.post(_J.url, t2);
  }
  static updateQueryLibrary(t2, e2) {
    return F.put(_J.url + `/${t2}`, e2);
  }
  static deleteQueryLibrary(t2) {
    return F.delete(_J.url + `/${t2}`);
  }
};
__publicField(_J, "url", "/library-queries");
__publicField(_J, "recordUrl", "/library-query-records");
let J = _J;
const X = { "Lowcoder-Token": `${k(2527698043, 8)}-${k(14168, 4)}-${k(19528, 4)}-${k(46257, 4)}-${k(185593952632172n, 12)}`, "Content-Type": "application/json" };
let Z = null;
class tt extends F {
  static async secureRequest(t2, e2 = 6e3) {
    let r2;
    const s2 = ((t3) => {
      if (Z && !t3)
        return Z;
      const e3 = { baseURL: "https://api-service.lowcoder.cloud/api/flow", headers: { "Content-Type": "application/json" } };
      return Z = L.create(e3), Z;
    })(), a2 = L.CancelToken.source(), i2 = setTimeout(() => {
      a2.cancel("Request timed out.");
    }, e2), o2 = { method: "POST", withCredentials: true, data: t2, cancelToken: a2.token };
    try {
      r2 = await s2.request(o2);
    } catch (t3) {
      if (!L.isCancel(t3))
        throw console.warn("Error at Secure Flow Request:", t3), t3;
      try {
        const t4 = L.CancelToken.source(), e3 = setTimeout(() => {
          t4.cancel("Retry request timed out.");
        }, 1e4);
        r2 = await s2.request({ ...o2, cancelToken: t4.token }), clearTimeout(e3);
      } catch (t4) {
        throw console.warn("Error at Secure Flow Request. Retry failed:", t4), t4;
      }
    } finally {
      clearTimeout(i2);
    }
    return r2;
  }
}
const et = async (t2) => {
  const e2 = { path: "webhook/secure/search-customersubscriptions", data: t2, method: "post", headers: X };
  try {
    const t3 = await tt.secureRequest(e2);
    if (!t3 || !t3.data)
      return [];
    const r2 = t3.data.filter((t4) => "false" !== t4.success);
    return Object.values(r2.reduce((t4, e3) => (e3.data.forEach((e4) => {
      t4[e4.id] || (t4[e4.id] = e4);
    }), t4), {}));
  } catch (t3) {
    throw console.error("Error searching customer:", t3), t3;
  }
};
const _rt = class _rt extends F {
  static fetchConfig(t2) {
    let e2 = _rt.configURL;
    return (t2 == null ? void 0 : t2.length) && (e2 += `?orgId=${t2}`), F.get(e2);
  }
  static fetchDeploymentId() {
    return F.get(`${_rt.configURL}/deploymentId`);
  }
};
__publicField(_rt, "configURL", "/configs");
let rt = _rt;
const st = rt;
const _at = class _at extends F {
  static createSnapshot(t2) {
    return F.post(_at.createSnapshotURL, t2);
  }
  static getSnapshots(t2, e2, r2) {
    return r2 ? F.get(_at.archiveSnapshotsURL(t2), e2) : F.get(_at.snapshotsURL(t2), e2);
  }
  static getSnapshotDsl(t2, e2, r2) {
    return r2 ? F.get(_at.archiveSnapshotDslURL(t2, e2)) : F.get(_at.snapshotDslURL(t2, e2));
  }
};
__publicField(_at, "createSnapshotURL", "/application/history-snapshots");
__publicField(_at, "snapshotsURL", (t2) => `/application/history-snapshots/${t2}`);
__publicField(_at, "archiveSnapshotsURL", (t2) => `/application/history-snapshots/archive/${t2}`);
__publicField(_at, "snapshotDslURL", (t2, e2) => `/application/history-snapshots/${t2}/${e2}`);
__publicField(_at, "archiveSnapshotDslURL", (t2, e2) => `/application/history-snapshots/archive/${t2}/${e2}`);
let at = _at;
const it = at;
const _ot = class _ot extends F {
  static fetchPermissions(t2) {
    return F.get(_ot.url + `/${t2}/permissions`);
  }
  static grantPermission(t2) {
    return F.put(_ot.url + `/${t2.datasourceId}/permissions`, y.omit(t2, ["datasourceId"]));
  }
  static updatePermission(t2) {
    return F.put(_ot.url + `/permissions/${t2.permissionId}`, y.omit(t2, ["permissionId"]));
  }
  static deletePermission(t2) {
    return F.delete(_ot.url + `/permissions/${t2}`);
  }
};
__publicField(_ot, "url", "datasources");
let ot = _ot;
const _ct = class _ct extends F {
  static fetchMetas(t2) {
    return F.get(_ct.url + "/metas", { name: t2.names.join(",") });
  }
  static fetchRecommends() {
    return F.get(_ct.url + "/recommendations");
  }
};
__publicField(_ct, "url", "/misc/js-library");
let ct = _ct;
const _nt = class _nt extends F {
  static cancelAllQuery() {
    Object.values(_nt.queryExecuteCancelTokenSource).forEach((t2) => {
      t2.cancel();
    }), _nt.queryExecuteCancelTokenSource = {};
  }
  static executeQuery(t2, e2) {
    const r2 = t2.queryId ?? t2.libraryQueryId;
    return _nt.queryExecuteCancelTokenSource[r2] || (_nt.queryExecuteCancelTokenSource[r2] = L.CancelToken.source()), F.post(_nt.url + "/execute", t2, void 0, { timeout: e2 ? e2 + 5e3 : R, cancelToken: _nt.queryExecuteCancelTokenSource[r2].token });
  }
};
__publicField(_nt, "url", "query");
__publicField(_nt, "queryExecuteCancelTokenSource", {});
let nt = _nt;
class ut extends F {
  static version() {
    return F.get("/VERSION", { _t: Date.now() }, { baseURL: "/" });
  }
}
__publicField(ut, "url", "query");
export {
  V as A,
  st as C,
  W as D,
  H as F,
  ct as J,
  z as O,
  ut as P,
  J as Q,
  Y as S,
  N as U,
  it as a,
  j as b,
  ot as c,
  v as d,
  nt as e,
  _ as g,
  B as i,
  et as s,
  x as v
};
