text: /**
   * Minified by jsDelivr using Terser v3.14.1.
   * Original file: /npm/hyperformula@0.1.3/es/interpreter/plugin/RoundingPlugin.js
   *
   * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
   */
  import"core-js/modules/es.symbol";import"core-js/modules/es.symbol.description";import"core-js/modules/es.symbol.iterator";import"core-js/modules/es.array.iterator";import"core-js/modules/es.array.some";import"core-js/modules/es.object.get-prototype-of";import"core-js/modules/es.object.to-string";import"core-js/modules/es.reflect.construct";import"core-js/modules/es.regexp.to-string";import"core-js/modules/es.string.iterator";import"core-js/modules/web.dom-collections.iterator";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),e}function _inherits(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&_setPrototypeOf(e,r)}function _setPrototypeOf(e,r){return(_setPrototypeOf=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function _createSuper(e){var r=_isNativeReflectConstruct();return function(){var t,o=_getPrototypeOf(e);if(r){var n=_getPrototypeOf(this).constructor;t=Reflect.construct(o,arguments,n)}else t=o.apply(this,arguments);return _possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,r){return!r||"object"!==_typeof(r)&&"function"!=typeof r?_assertThisInitialized(e):r}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}import{CellError,ErrorType}from"../../Cell";import{AstNodeType}from"../../parser";import{SimpleRangeValue}from"../InterpreterValue";import{FunctionPlugin}from"./FunctionPlugin";export function findNextOddNumber(e){var r=Math.ceil(e);return r%2==1?r:r+1}export function findNextEvenNumber(e){var r=Math.ceil(e);return r%2==0?r:r+1}export var RoundingPlugin=function(e){_inherits(t,FunctionPlugin);var r=_createSuper(t);function t(){return _classCallCheck(this,t),r.apply(this,arguments)}return _createClass(t,[{key:"roundup",value:function(e,r){return this.commonArgumentsHandling2(e,r,function(e,r){var t=Math.pow(10,r);return e<0?-Math.ceil(-e*t)/t:Math.ceil(e*t)/t})}},{key:"rounddown",value:function(e,r){return this.commonArgumentsHandling2(e,r,function(e,r){var t=Math.pow(10,r);return e<0?-Math.floor(-e*t)/t:Math.floor(e*t)/t})}},{key:"round",value:function(e,r){return this.commonArgumentsHandling2(e,r,function(e,r){var t=Math.pow(10,r);return e<0?-Math.round(-e*t)/t:Math.round(e*t)/t})}},{key:"trunc",value:function(e,r){return this.rounddown(e,r)}},{key:"intFunc",value:function(e,r){return this.templateWithOneCoercedToNumberArgument(e,r,function(e){return e<0?-Math.floor(-e):Math.floor(e)})}},{key:"even",value:function(e,r){return this.templateWithOneCoercedToNumberArgument(e,r,function(e){return e<0?-findNextEvenNumber(-e):findNextEvenNumber(e)})}},{key:"odd",value:function(e,r){return this.templateWithOneCoercedToNumberArgument(e,r,function(e){return e<0?-findNextOddNumber(-e):findNextOddNumber(e)})}},{key:"ceiling",value:function(e,r){if(e.args.length<1||e.args.length>3)return new CellError(ErrorType.NA);if(e.args.some(function(e){return e.type===AstNodeType.EMPTY}))return new CellError(ErrorType.NUM);var t=this.getNumericArgument(e,r,0);if(t instanceof CellError)return t;var o=1;if(e.args.length>=2&&(o=this.getNumericArgument(e,r,1))instanceof CellError)return o;var n=0;return 3===e.args.length&&(n=this.getNumericArgument(e,r,2))instanceof CellError?n:0===o||0===t?0:t>0!=o>0&&e.args.length>1?new CellError(ErrorType.NUM):(0===n&&(o=Math.abs(o)),Math.ceil(t/o)*o)}},{key:"commonArgumentsHandling2",value:function(e,r,t){if(e.args.length<1||e.args.length>2)return new CellError(ErrorType.NA);if(e.args.some(function(e){return e.type===AstNodeType.EMPTY}))return new CellError(ErrorType.NUM);var o,n=this.evaluateAst(e.args[0],r);if(n instanceof SimpleRangeValue)return new CellError(ErrorType.VALUE);if(e.args[1]){var i=this.evaluateAst(e.args[1],r);if(i instanceof SimpleRangeValue)return new CellError(ErrorType.VALUE);o=this.coerceScalarToNumberOrError(i)}else o=0;var u=this.coerceScalarToNumberOrError(n);return u instanceof CellError?u:o instanceof CellError?o:t(u,o)}}]),t}();RoundingPlugin.implementedFunctions={ROUNDUP:{method:"roundup"},ROUNDDOWN:{method:"rounddown"},ROUND:{method:"round"},TRUNC:{method:"trunc"},INT:{method:"intFunc"},EVEN:{method:"even"},ODD:{method:"odd"},CEILING:{method:"ceiling"}};
  //# sourceMappingURL=/sm/81dd5620e92ebc8d54cdd2ff34f63c7d6072dd259ad8604c46db08c378469c36.map