"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.escapeLuaString = exports.getRisingBollardsAxisName = void 0;
const agv_constant_1 = require("../entity/agv.constant");
const webscope_service_1 = require("../webscope-service");
const isValidAxisName = value => {
  return typeof value === 'string' && value.trim().length > 0;
};
const getRisingBollardsAxisName = () => {
  var _a, _b, _c;
  try {
    const robotProxy = (_b = (_a = (0, webscope_service_1.getWebscopeService)()) === null || _a === void 0 ? void 0 : _a.getRobotProxy) === null || _b === void 0 ? void 0 : _b.call(_a);
    const axisNames = (_c = robotProxy === null || robotProxy === void 0 ? void 0 : robotProxy.getAxisNames) === null || _c === void 0 ? void 0 : _c.call(robotProxy);
    if (Array.isArray(axisNames)) {
      const firstAxisName = axisNames.find(name => isValidAxisName(name));
      if (isValidAxisName(firstAxisName)) {
        return firstAxisName;
      }
    }
  } catch (error) {}
  return agv_constant_1.RISING_BOLLARDS_AXIS_NAME;
};
exports.getRisingBollardsAxisName = getRisingBollardsAxisName;
const escapeLuaString = value => {
  return String(value !== null && value !== void 0 ? value : '').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
};
exports.escapeLuaString = escapeLuaString;
//# sourceMappingURL=risingbollards-axis.util.js.map