{"version":3,"sources":["jsdelivr-header.js","/npm/moment-business-days-diff@1.0.2/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAGA,GAAuB,mBAAZ,QAAwB,CACjC,MAAM,EAAS,QAAQ,UAGjB,EAAyB,CAAC,EAAG,EAAG,EAAG,EAAG,GACtC,EAFS,IAAS,aAEO,kBAAoB,EAEnD,EAAO,GAAG,aAAe,SAAU,GACjC,MAAM,EAAK,KAAK,QACV,EAAK,EAAM,QAEX,EAAM,EAAK,EAAK,EAAK,EAErB,EAAkB,GAHV,EAAK,EAAK,EAAK,GAGQ,OAAO,cAAe,cACrD,EAAgB,EAAO,EAAI,OAAO,cAAe,cAEjD,EAAU,EAAc,KAAK,EAAiB,QACpD,IAAI,EAAY,EAMhB,OAJK,EAAc,eAAe,KAChC,EAAY,EAAgB,gCAAgC,IAGvD,CACT,EAEA,EAAO,GAAG,cAAgB,WACxB,OAAO,EAAgB,UAAU,EAAO,MAAM,OAAO,KACvD,EAEA,EAAO,GAAG,gCAAkC,SAAU,GACpD,IAAI,EAAO,KAAM,EAAU,EAC3B,IAAK,IAAI,EAAI,EAAG,EAAI,EAAM,IACpB,EAAgB,UAAU,EAAK,OAAO,OACxC,IAEF,EAAK,IAAI,EAAG,KAEd,OAAO,CACT,EAEA,EAAO,GAAG,YAAc,SAAU,GAKhC,IAJA,IAAI,EAAM,KAAK,QACX,EAAS,EAAS,GAAK,EAAI,EAC3B,EAAY,KAAK,IAAI,GAElB,GACL,EAAI,IAAI,EAAQ,QAEZ,EAAI,iBACN,IAIJ,OAAO,CACT,EAEA,EAAO,GAAG,iBAAmB,SAAU,EAAQ,GAC7C,OAAO,KAAK,aAAa,EAAQ,EACnC,EAGqB,oBAAV,QAAyB,OAAO,UACzC,OAAO,QAAU,EAGrB","file":"/npm/moment-business-days-diff@1.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/moment-business-days-diff@1.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\r\n\r\n\r\nif (typeof require === 'function') {\r\n  const moment = require('moment');\r\n\r\n  const locale = moment().localeData();\r\n  const defaultWorkingWeekdays = [1, 2, 3, 4, 5];\r\n  const workingWeekdays = locale._workingWeekdays || defaultWorkingWeekdays;\r\n\r\n  moment.fn.businessDiff = function (param) {\r\n    const d1 = this.clone();\r\n    const d2 = param.clone();\r\n    const start = d1 < d2 ? d1 : d2;\r\n    const end = d2 > d1 ? d2 : d1;\r\n\r\n    const startDateMoment = moment(start.format('YYYY-MM-DD'), 'YYYY-MM-DD');\r\n    const endDateMoment = moment(end.format('YYYY-MM-DD'), 'YYYY-MM-DD');\r\n\r\n    const stdDiff = endDateMoment.diff(startDateMoment, 'days');\r\n    let numOfDays = 0;\r\n\r\n    if (!endDateMoment.isSameOrBefore(startDateMoment)) {\r\n      numOfDays = startDateMoment.countBusinessDaysInDaysFromDate(stdDiff);\r\n    }\r\n\r\n    return numOfDays;\r\n  };\r\n\r\n  moment.fn.isBusinessDay = function () {\r\n    return workingWeekdays.includes(+moment(this).format('E'));\r\n  };\r\n\r\n  moment.fn.countBusinessDaysInDaysFromDate = function (days) {\r\n    let date = this, counter = 0;\r\n    for (let i = 0; i < days; i++) {\r\n      if (workingWeekdays.includes(+date.format('E'))) {\r\n        counter++;\r\n      }\r\n      date.add(1, 'd')\r\n    }\r\n    return counter;\r\n  };\r\n\r\n  moment.fn.businessAdd = function (number) {\r\n    var day = this.clone();\r\n    var signal = number < 0 ? -1 : 1;\r\n    var remaining = Math.abs(number);\r\n\r\n    while (remaining) {\r\n      day.add(signal, 'days');\r\n\r\n      if (day.isBusinessDay()) {\r\n        remaining--;\r\n      }\r\n    }\r\n\r\n    return day;\r\n  };\r\n\r\n  moment.fn.businessSubtract = function (number, period) {\r\n    return this.businessAdd(-number, period);\r\n  };\r\n\r\n\r\n  if (typeof module != 'undefined' && module.exports) {\r\n    module.exports = moment;\r\n  }\r\n\r\n}"]}