{"ast":null,"code":"import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _callSuper from \"@babel/runtime/helpers/esm/callSuper\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport AbstractCalculator from './calculator';\nconst CALC_UNIT = 'CALC_UNIT';\nfunction unit(value) {\n  if (typeof value === 'number') {\n    return `${value}${CALC_UNIT}`;\n  }\n  return value;\n}\nlet CSSCalculator = /*#__PURE__*/function (_AbstractCalculator) {\n  function CSSCalculator(num) {\n    var _this;\n    _classCallCheck(this, CSSCalculator);\n    _this = _callSuper(this, CSSCalculator);\n    _this.result = '';\n    if (num instanceof CSSCalculator) {\n      _this.result = `(${num.result})`;\n    } else if (typeof num === 'number') {\n      _this.result = unit(num);\n    } else if (typeof num === 'string') {\n      _this.result = num;\n    }\n    return _this;\n  }\n  _inherits(CSSCalculator, _AbstractCalculator);\n  return _createClass(CSSCalculator, [{\n    key: \"add\",\n    value: function add(num) {\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} + ${num.getResult()}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} + ${unit(num)}`;\n      }\n      this.lowPriority = true;\n      return this;\n    }\n  }, {\n    key: \"sub\",\n    value: function sub(num) {\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} - ${num.getResult()}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} - ${unit(num)}`;\n      }\n      this.lowPriority = true;\n      return this;\n    }\n  }, {\n    key: \"mul\",\n    value: function mul(num) {\n      if (this.lowPriority) {\n        this.result = `(${this.result})`;\n      }\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} * ${num.getResult(true)}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} * ${num}`;\n      }\n      this.lowPriority = false;\n      return this;\n    }\n  }, {\n    key: \"div\",\n    value: function div(num) {\n      if (this.lowPriority) {\n        this.result = `(${this.result})`;\n      }\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} / ${num.getResult(true)}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} / ${num}`;\n      }\n      this.lowPriority = false;\n      return this;\n    }\n  }, {\n    key: \"getResult\",\n    value: function getResult(force) {\n      return this.lowPriority || force ? `(${this.result})` : this.result;\n    }\n  }, {\n    key: \"equal\",\n    value: function equal(options) {\n      const {\n        unit: cssUnit = true\n      } = options || {};\n      const regexp = new RegExp(`${CALC_UNIT}`, 'g');\n      this.result = this.result.replace(regexp, cssUnit ? 'px' : '');\n      if (typeof this.lowPriority !== 'undefined') {\n        return `calc(${this.result})`;\n      }\n      return this.result;\n    }\n  }]);\n}(AbstractCalculator);\nexport { CSSCalculator as default };","map":{"version":3,"names":["_classCallCheck","_createClass","_callSuper","_inherits","AbstractCalculator","CALC_UNIT","unit","value","CSSCalculator","_AbstractCalculator","num","_this","result","key","add","getResult","lowPriority","sub","mul","div","force","equal","options","cssUnit","regexp","RegExp","replace","default"],"sources":["D:/Project/UC_Trains_Voice/react-demo/node_modules/antd/es/theme/util/calc/CSSCalculator.js"],"sourcesContent":["import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _callSuper from \"@babel/runtime/helpers/esm/callSuper\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport AbstractCalculator from './calculator';\nconst CALC_UNIT = 'CALC_UNIT';\nfunction unit(value) {\n  if (typeof value === 'number') {\n    return `${value}${CALC_UNIT}`;\n  }\n  return value;\n}\nlet CSSCalculator = /*#__PURE__*/function (_AbstractCalculator) {\n  function CSSCalculator(num) {\n    var _this;\n    _classCallCheck(this, CSSCalculator);\n    _this = _callSuper(this, CSSCalculator);\n    _this.result = '';\n    if (num instanceof CSSCalculator) {\n      _this.result = `(${num.result})`;\n    } else if (typeof num === 'number') {\n      _this.result = unit(num);\n    } else if (typeof num === 'string') {\n      _this.result = num;\n    }\n    return _this;\n  }\n  _inherits(CSSCalculator, _AbstractCalculator);\n  return _createClass(CSSCalculator, [{\n    key: \"add\",\n    value: function add(num) {\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} + ${num.getResult()}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} + ${unit(num)}`;\n      }\n      this.lowPriority = true;\n      return this;\n    }\n  }, {\n    key: \"sub\",\n    value: function sub(num) {\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} - ${num.getResult()}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} - ${unit(num)}`;\n      }\n      this.lowPriority = true;\n      return this;\n    }\n  }, {\n    key: \"mul\",\n    value: function mul(num) {\n      if (this.lowPriority) {\n        this.result = `(${this.result})`;\n      }\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} * ${num.getResult(true)}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} * ${num}`;\n      }\n      this.lowPriority = false;\n      return this;\n    }\n  }, {\n    key: \"div\",\n    value: function div(num) {\n      if (this.lowPriority) {\n        this.result = `(${this.result})`;\n      }\n      if (num instanceof CSSCalculator) {\n        this.result = `${this.result} / ${num.getResult(true)}`;\n      } else if (typeof num === 'number' || typeof num === 'string') {\n        this.result = `${this.result} / ${num}`;\n      }\n      this.lowPriority = false;\n      return this;\n    }\n  }, {\n    key: \"getResult\",\n    value: function getResult(force) {\n      return this.lowPriority || force ? `(${this.result})` : this.result;\n    }\n  }, {\n    key: \"equal\",\n    value: function equal(options) {\n      const {\n        unit: cssUnit = true\n      } = options || {};\n      const regexp = new RegExp(`${CALC_UNIT}`, 'g');\n      this.result = this.result.replace(regexp, cssUnit ? 'px' : '');\n      if (typeof this.lowPriority !== 'undefined') {\n        return `calc(${this.result})`;\n      }\n      return this.result;\n    }\n  }]);\n}(AbstractCalculator);\nexport { CSSCalculator as default };"],"mappings":"AAAA,OAAO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