var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/dataSourceComponents/dataSourceForm/urlUtils.ts
var urlUtils_exports = {};
__export(urlUtils_exports, {
  getFormSettingParams: () => getFormSettingParams,
  getUrlParams: () => getUrlParams,
  updateTenantSettingFromUrl: () => updateTenantSettingFromUrl
});
module.exports = __toCommonJS(urlUtils_exports);
var import_utils = require("../../table/utils");
var getUrlParams = () => {
  const urlSearchParams = new URLSearchParams(window.location.search);
  const urlParams = {};
  urlSearchParams.forEach((value, key) => {
    urlParams[key] = value;
  });
  return urlParams;
};
var getFormSettingParams = (urlParams) => {
  const params = urlParams || getUrlParams();
  return {
    businessCode: params.businessCode || params.business_code,
    channelCode: params.channelCode || params.channel_code,
    isBoard: params.is_board === "1"
  };
};
var updateTenantSettingFromUrl = async (data) => {
  debugger;
  const urlParams = getFormSettingParams();
  const businessCode = urlParams.businessCode;
  const channelCode = urlParams.channelCode;
  const boardCode = urlParams.isBoard && businessCode && channelCode ? `${businessCode}+${channelCode}` : void 0;
  const requestBody = {
    business_code: businessCode || "",
    channel_code: channelCode || "",
    board_code: boardCode || "",
    data
  };
  const url = "/tenant/setting";
  return import_utils.request.getRequest().put(url, requestBody, {
    headers: {
      "Content-Type": "application/json"
    }
  });
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getFormSettingParams,
  getUrlParams,
  updateTenantSettingFromUrl
});
